diff options
author | dawes <dawes> | 2000-12-05 16:38:19 +0000 |
---|---|---|
committer | dawes <dawes> | 2000-12-05 16:38:19 +0000 |
commit | de862f7f2c68c12cbfdb72a72c4ea6e97c968f90 (patch) | |
tree | dd8e73c0ad0f1ad5a9929f858bd69b975751ec5c | |
parent | 978cb1e87ff7bfba913e89cc87b302be078c7348 (diff) |
Import of XFree86 4.0.1gX_4_0_1h
749 files changed, 156035 insertions, 10503 deletions
diff --git a/xc/config/cf/FreeBSD.cf b/xc/config/cf/FreeBSD.cf index 61d610782..ecccbc65d 100644 --- a/xc/config/cf/FreeBSD.cf +++ b/xc/config/cf/FreeBSD.cf @@ -2,7 +2,7 @@ XCOMM platform: $TOG: FreeBSD.cf /main/21 1997/10/05 20:42:34 kaleb $ XCOMM XCOMM XCOMM -XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.99 2000/11/14 23:58:30 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.101 2000/12/04 18:49:09 dawes Exp $ #ifndef UseElfFormat #define UseElfFormat DefaultToElfFormat @@ -78,6 +78,9 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #ifndef LexCmd #define LexCmd flex -l #endif +#ifndef HasFlex +#define HasFlex YES +#endif #define CcCmd cc #define CppCmd /usr/bin/cpp @@ -510,6 +513,17 @@ InstallManPageAliasesBase(file,destdir,aliases) #define PamLibraries -lpam DlLibrary #endif +#ifndef HasCookieMaker +/* Which versions have /dev/urandom? */ +#if OSMajorVersion >= 4 +#define HasCookieMaker YES +#define MkCookieCmd \ + 'dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"' +#else +#define HasCookieMaker NO +#endif +#endif + /* * A hack to work around an optimization problem with gcc 2.95.2 */ diff --git a/xc/config/cf/Imake.rules b/xc/config/cf/Imake.rules index c78d50cbc..5a1bde62a 100644 --- a/xc/config/cf/Imake.rules +++ b/xc/config/cf/Imake.rules @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.82 2000/11/09 01:35:05 dawes Exp $ +XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.85 2000/12/02 01:16:01 dawes Exp $ /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY @@ -1302,7 +1302,7 @@ XCOMM Don't do: 'AllTarget(dest.suffix.html)'. It breaks external packages @@\ dest.suffix.html: file.man RmanCmdDependency @@\ RemoveFiles(dest.suffix.html dest.suffix-html) @@\ - RunProgram(RMAN,$(RMANOPTIONS) < file.man > dest.suffix-html) &&\ @@\ + RunProgram(RMAN,$(RMANOPTIONS) < file.man > dest.suffix-html) && \ @@\ $(MV) dest.suffix-html $@ @@\ @@\ install.man:: dest.suffix.html @@\ @@ -2186,6 +2186,24 @@ clean:: @@\ RemoveFile(dst.c) #endif /* ObjectFromSpecialSource */ +#ifndef SwitchYYPrefix +#define SwitchYYPrefix(in,out,prefix) \ + sed 's/yy/prefix/g' in > out && RemoveFile(in) +#endif + +#ifndef LexFilePrefix +#define LexFilePrefix(file,prefix) @@\ +file.c: file.l @@\ + ClearmakeOSName \ + $(LEX) $(LFLAGS) file.l @@\ + SwitchYYPrefix(lex.yy.c,file.c,prefix) @@\ + @@\ +depend:: file.c @@\ + @@\ +clean:: @@\ + RemoveFiles(lex.yy.c file.c) +#endif + #ifndef LexFileExplicit #if HasClearmake /* provide a place to hang ClearmakeOSName */ #define LexFileExplicit(file) @@\ @@ -2221,6 +2239,38 @@ clean:: @@\ RemoveFile(file) #endif /* M4File */ +#ifndef YaccFilePrefix +#if HasGnuMake +#define YaccFilePrefix(file,flags,prefix) @@\ +depend:: file.c @@\ + @@\ +file.h: file.c @@\ + @@\ +file.c: file.y @@\ + ClearmakeOSName \ + $(YACC) flags file.y @@\ + SwitchYYPrefix(y.tab.c,file.c,prefix) @@\ + @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \@@\ + else exit 0; fi @@\ + @@\ +clean:: @@\ + RemoveFiles(y.tab.c y.tab.h file.h file.c) +#else +#define YaccFilePrefix(file,flags,prefix) @@\ +depend:: file.c @@\ + @@\ +file.h file.c: file.y @@\ + ClearmakeOSName \ + $(YACC) flags file.y @@\ + SwitchYYPrefix(y.tab.c,file.c,prefix) @@\ + @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \ @@\ + else exit 0; fi @@\ + @@\ +clean:: @@\ + RemoveFiles(y.tab.c y.tab.h file.h file.c) +#endif +#endif /* YaccFile */ + #ifndef YaccFile #if HasGnuMake #define YaccFile(file,flags) @@\ diff --git a/xc/config/cf/Imake.tmpl b/xc/config/cf/Imake.tmpl index 8533f964a..0de4d0835 100644 --- a/xc/config/cf/Imake.tmpl +++ b/xc/config/cf/Imake.tmpl @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/config/cf/Imake.tmpl,v 3.84 2000/11/28 16:10:21 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Imake.tmpl,v 3.87 2000/12/02 19:06:57 herrb Exp $ XCOMM ---------------------------------------------------------------------- /* @@ -231,6 +231,10 @@ XCOMM the platform-specific parameters - edit site.def to change #define BuildHtmlManPages NO #endif +#ifndef HasCookieMaker +#define HasCookieMaker NO +#endif + #include <Imake.rules> #ifndef HasSharedLibraries @@ -348,6 +352,12 @@ XCOMM the platform-specific parameters - edit site.def to change #ifndef HasFchown #define HasFchown YES #endif +#ifndef HasPam +#define HasPam NO +#endif +#ifndef HasPamMisc +#define HasPamMisc NO +#endif /* byte-order defaults */ #ifndef ByteOrder #if defined(VaxArchitecture) @@ -935,6 +945,9 @@ TCLIBDIR = TclLibDir #ifndef AsCmd #define AsCmd as #endif +#ifndef AsmDefines +#define AsmDefines /**/ +#endif #ifndef CompressCmd #define CompressCmd compress #endif @@ -982,6 +995,9 @@ TCLIBDIR = TclLibDir #ifndef LexLib #define LexLib -ll #endif +#ifndef HasFlex +#define HasFlex NO +#endif #ifndef YaccCmd #define YaccCmd yacc #endif diff --git a/xc/config/cf/NetBSD.cf b/xc/config/cf/NetBSD.cf index cc2910e6c..80c246870 100644 --- a/xc/config/cf/NetBSD.cf +++ b/xc/config/cf/NetBSD.cf @@ -2,7 +2,7 @@ XCOMM platform: $XConsortium: NetBSD.cf /main/16 1996/10/31 14:47:14 kaleb $ -XCOMM platform: $XFree86: xc/config/cf/NetBSD.cf,v 3.85 2000/08/28 15:29:07 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/NetBSD.cf,v 3.87 2000/12/03 16:14:08 herrb Exp $ #ifndef OSName @@ -248,6 +248,16 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define AdmDir /var/log +#define HasFlex YES + +/* + * NetBSD doesn't have perl in default system + * you may override this in host.def if you installed perl from the packages + */ +#ifndef HasPerl +#define HasPerl NO +#endif + /* * Make & install Features */ @@ -296,6 +306,16 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe # endif #endif /* i386Architecture */ +#ifndef HasCookieMaker +# if OSMajorVersion == 1 && OSMinorVersion >= 5 || OSMajorVersion >= 2 + /* NetBSD 1.5 and later have /dev/urandom */ +# define HasCookieMaker YES +# define MkCookieCmd \ + 'dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"' +# else +# define HasCookieMaker NO +# endif +#endif /* * ForceSubdirs - force make to build subdirectories diff --git a/xc/config/cf/OpenBSD.cf b/xc/config/cf/OpenBSD.cf index be0215d2c..e74a9dfcd 100644 --- a/xc/config/cf/OpenBSD.cf +++ b/xc/config/cf/OpenBSD.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.40 2000/11/06 19:24:00 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.44 2000/12/02 20:15:03 herrb Exp $ XCOMM #ifndef OSName @@ -198,6 +198,8 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define AdmDir /var/log +#define HasFlex YES + /* * Make & install Features */ @@ -237,6 +239,12 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #endif #endif +#ifndef HasCookieMaker +# define HasCookieMaker YES +# define MkCookieCmd \ + 'dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"' +#endif + /* * Man pages need to be formatted when installed, so override the default @@ -521,13 +529,13 @@ install:: fonts.alias @@\ # define ServerExtraDefines GccGasOption -Dmc68000 -Dmc68020 # ifndef Xsun24Server -# define Xsun24Server YES +# define Xsun24Server NO # endif # ifndef XsunServer # define XsunServer YES # endif # ifndef XsunMonoServer -# define XsunMonoServer YES +# define XsunMonoServer NO # endif #define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT @@ -632,13 +640,13 @@ install:: fonts.alias @@\ #ifdef SparcArchitecture # ifndef Xsun24Server -# define Xsun24Server YES +# define Xsun24Server NO # endif # ifndef XsunServer # define XsunServer YES # endif # ifndef XsunMonoServer -# define XsunMonoServer YES +# define XsunMonoServer NO # endif #define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT diff --git a/xc/config/cf/README b/xc/config/cf/README index 30797bd95..05b4d1500 100644 --- a/xc/config/cf/README +++ b/xc/config/cf/README @@ -3,7 +3,7 @@ $TOG: README /main/76 1998/05/11 14:35:10 barstow $ -$XFree86: xc/config/cf/README,v 1.11 2000/06/14 00:16:02 dawes Exp $ +$XFree86: xc/config/cf/README,v 1.12 2000/12/02 19:06:57 herrb Exp $ The easiest way to write an Imakefile is to find another one that does something similar and copy/modify it! @@ -58,6 +58,7 @@ Imake.tmpl provides defaults for the following variables: HasCenterLineCplusplus boolean for system has CenterLine C++ compiler HasClearmake use Clearcase's clearmake make program? HasCodeCenter boolean for system has CodeCenter + HasCookieMaker boolean for system has xauth cookie generator HasCplusplus system has a C++ compiler? HasDECnet system has DECnet? HasFortran boolean for system has Fortran compiler @@ -119,6 +120,7 @@ Imake.tmpl provides defaults for the following variables: Malloc0ReturnsNull boolean for malloc(0) == NULL Malloc0ReturnsNullDefines -D's to build libX11/libXt MathLibrary library for programs using C math functions + MkCookieCmd command to generate an xauth cookie MsMacros macro flag for TroffCmd, normally "-ms" MvCmd command to rename a file NdbmDefines -D's to turn on use of ndbm routines diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl index 987312072..bac8ddd43 100644 --- a/xc/config/cf/X11.tmpl +++ b/xc/config/cf/X11.tmpl @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.82 2000/11/28 16:10:21 dawes Exp $ +XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.86 2000/12/04 18:49:11 dawes Exp $ /*************************************************************************** * * @@ -308,7 +308,7 @@ XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.82 2000/11/28 16:10:21 dawes Exp $ #define BuildRenderLibrary BuildRender #endif #ifndef BuildXftLibrary -#define BuildXftLibrary BuildRenderLibrary && defined(Freetype2Dir) +#define BuildXftLibrary BuildRenderLibrary #endif #ifndef BuildMiscDocs @@ -321,6 +321,10 @@ XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.82 2000/11/28 16:10:21 dawes Exp $ #define BuildAllSpecsDocs NO #endif +#ifndef FSUseSyslog +#define FSUseSyslog NO +#endif + #ifndef InstallLibManPages #define InstallLibManPages YES #endif @@ -1249,7 +1253,7 @@ XCOMM X Window System make variables; these need to be coordinated with rules XLIBSRC = $(LIBSRC)/X11 #if SharedLibX11 #ifndef SharedX11Rev -#define SharedX11Rev 6.1 +#define SharedX11Rev 6.2 #endif SharedLibReferences(XONLY,X11,$(XLIBSRC),SOXLIBREV,SharedX11Rev) #else @@ -1770,7 +1774,7 @@ ProjectUnsharedLibReferences(XDMCP,Xdmcp,$(XDMCPLIBSRC),XBuildLibDir) XMUSRC = $(LIBSRC)/Xmu #if SharedLibXmu #ifndef SharedXmuRev -#define SharedXmuRev 6.1 +#define SharedXmuRev 6.2 #endif SharedDSLibReferences(XMU,Xmu,$(XMUSRC),SOXMUREV,SharedXmuRev) #else @@ -2205,10 +2209,10 @@ FREETYPE2DEFINES = -DFREETYPE2 #endif #ifndef XftClientDepLibs -#define XftClientDepLibs $(DEPXFTLIB) +#define XftClientDepLibs $(DEPXFTLIB) $(DEPXRENDERLIB) #endif #ifndef XftClientLibs -#define XftClientLibs $(XFTLIB) $(FREETYPE2LIB) +#define XftClientLibs $(XFTLIB) $(FREETYPE2LIB) $(XRENDERLIB) #endif #ifndef LdLibraryPath diff --git a/xc/config/cf/cygwin.cf b/xc/config/cf/cygwin.cf index b4feccd3e..8ba0a8ccb 100644 --- a/xc/config/cf/cygwin.cf +++ b/xc/config/cf/cygwin.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.1 2000/08/09 23:40:09 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.2 2000/11/30 23:29:55 dawes Exp $ XCOMM XCOMM - changes since B20 Cygwin32 release XCOMM - avoided tons of "not in XXX directory" messages; @@ -97,6 +97,7 @@ XCOMM #define AsCmd gcc -S #define YaccCmd byacc #define LexCmd flex -l #define LexLib -lfl +#define HasFlex YES #define PreProcessCmd CcCmd -E XCOMM #define StdIncDir `CcCmd --print-libgcc-file-name | sed ':libgcc.a:../../../../i586-cygwin32/include:'|sed 's,\\\\,/,g'` XCOMM #define PostIncDir `CcCmd --print-libgcc-file-name | sed ':libgcc.a:/include:'|sed 's,\\\\,/,g'` diff --git a/xc/config/cf/cygwin.tmpl b/xc/config/cf/cygwin.tmpl index 0b12f21b7..4de189090 100644 --- a/xc/config/cf/cygwin.tmpl +++ b/xc/config/cf/cygwin.tmpl @@ -1,5 +1,5 @@ XCOMM $XConsortium: WinLib.tmpl,v 1.1 94/01/08 18:32:51 rws Exp $ -XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.1 2000/08/09 23:40:09 dawes Exp $ +XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.2 2000/12/04 18:49:13 dawes Exp $ #define SharedOldXReqs $(LDPRELIB) $(XLIBONLY) #define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XLIBONLY) @@ -21,8 +21,9 @@ XCOMM #define SharedXfontReqs $(LDPRELIB) $(XLIB) #define SharedXpmReqs $(LDPRELIB) $(XLIB) #define SharedXxf86dgaReqs $(LDPRELIB) $(XLIB) #define SharedXssReqs $(LDPRELIB) $(XLIB) $(EXTENSIONLIB) $(XTOOLLIB) -#define SharedDpsReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) -#define SharedDpsTkReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(DPSLIB) $(XLIB) +#define SharedDPSReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) +#define SharedDPSTKReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(DPSLIB) $(XLIB) +#define SharedXrenderReqs $(LDPRELIB) $(EXTENSIONLIB) $(XLIB) #define SharedpsresReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) diff --git a/xc/config/cf/gnu.cf b/xc/config/cf/gnu.cf index 7bbc8b488..3b5862e84 100644 --- a/xc/config/cf/gnu.cf +++ b/xc/config/cf/gnu.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/gnu.cf,v 1.9 2000/11/28 16:10:22 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/gnu.cf,v 1.10 2000/11/30 23:29:55 dawes Exp $ #ifndef OSName #define OSName DefaultOSName @@ -111,6 +111,7 @@ XCOMM Not implemented and will always fail. #endif #define YaccCmd bison -y #define LexCmd flex -l +#define HasFlex YES #define LexLib -lfl #define PreProcessCmd CcCmd -E #define PostIncDir DefaultGccIncludeDir diff --git a/xc/config/cf/linux.cf b/xc/config/cf/linux.cf index 89d41cac7..cdc67bc75 100644 --- a/xc/config/cf/linux.cf +++ b/xc/config/cf/linux.cf @@ -4,7 +4,7 @@ XCOMM platform: $TOG: linux.cf /main/47 1998/04/17 11:32:51 mgreess -XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.146 2000/11/29 17:40:19 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.150 2000/12/02 19:06:57 herrb Exp $ #ifndef LinuxElfDefault # define LinuxElfDefault YES @@ -107,7 +107,9 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define InstallXinitConfig YES #define InstallXdmConfig YES #define InstallFSConfig YES +#if 0 #define HasXdmAuth YES +#endif #define DebuggableLibraries YES #define ForceNormalLib YES #define BuildSpecsDocs YES @@ -133,6 +135,11 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define NormalLibGlu YES #define BuildRman NO #define BuildHtmlManPages NO +#define FSUseSyslog YES +#endif + +#if LinuxDistribution == LinuxRedHat +#define FSUseSyslog YES #endif /* @@ -193,6 +200,13 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # endif #endif +/* <linux/input.h> support mainly for USB support */ +#ifndef HasLinuxInput +# if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 4) +# define HasLinuxInput YES +# endif +#endif + /* On x86, determine whether to build with MTRR support */ #ifndef HasMTRRSupport # ifdef i386Architecture @@ -351,6 +365,11 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define UseStaticTermcapLib NO #endif +#ifndef HasCookieMaker +#define HasCookieMaker YES +#define MkCookieCmd mcookie +#endif + #ifndef BourneShell /* * This will cause builds/installs to terminate on errors, as on other @@ -482,6 +501,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) /* Some Linux distributions have yacc, some don't. All have bison. */ #define YaccCmd bison -y #define LexCmd flex -l +#define HasFlex YES #define LexLib -lfl #define PreProcessCmd CcCmd -E #define PostIncDir DefaultGccIncludeDir @@ -597,6 +617,10 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define PamLibraries -lpam DlLibrary #endif +#ifndef PamMiscLibraries +#define PamMiscLibraries -lpam_misc +#endif + #if HasDECnet # define ConnectionFlags -DUNIXCONN -DTCPCONN -DDNETCONN # define ExtraLibraries -ldnet diff --git a/xc/config/cf/lynx.cf b/xc/config/cf/lynx.cf index 196b58e96..7e48aa4a9 100644 --- a/xc/config/cf/lynx.cf +++ b/xc/config/cf/lynx.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.38 2000/07/07 20:06:56 tsi Exp $ +XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.39 2000/11/30 23:29:56 dawes Exp $ #ifndef OSName @@ -125,6 +125,7 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #else # define LexLib /**/ #endif +#define HasFlex YES /* On LynxOS AT 2.3.0 /lib/libm.a is a symbolic link to /lib/libc.a, so we * screw up some POSIX functionality when -lm comes before -lc_p in our * ld argument list. For LynxOS-AT we don't need -lm but for others we diff --git a/xc/config/cf/os2.cf b/xc/config/cf/os2.cf index 1d8ac4ba1..a420663e4 100644 --- a/xc/config/cf/os2.cf +++ b/xc/config/cf/os2.cf @@ -2,7 +2,7 @@ XCOMM $TOG: os2.cf /main/2 1997/08/05 08:51:25 kaleb $ -XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.30 2000/07/07 20:06:56 tsi Exp $ +XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.31 2000/11/30 23:29:57 dawes Exp $ #define OSName OS/2 #define OSVendor IBM @@ -182,6 +182,7 @@ XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.30 2000/07/07 20:06:56 tsi Ex #define RanlibCmd ar s #define BourneShell /**/ #define LexCmd flex -l +#define HasFlex YES #define LexLib -lfl #define YaccCmd yacc #define LintCmd /**/ diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf index 8e4c2b5a8..395c1adab 100644 --- a/xc/config/cf/xfree86.cf +++ b/xc/config/cf/xfree86.cf @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.328 2000/11/29 15:51:18 dawes Exp $ +XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.332 2000/12/04 18:49:13 dawes Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -51,6 +51,11 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ #endif #endif +/* <linux/input.h> support mainly for USB support */ +#ifndef HasLinuxInput +# define HasLinuxInput NO +#endif + /* OS.cf files may set this for OS-specific drivers */ #ifndef XF86OSCardDrivers #define XF86OSCardDrivers /**/ @@ -174,7 +179,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers # define XF86CardDrivers mga glint nv tga s3virge sis rendition \ - neomagic i740 tdfx \ + neomagic i740 tdfx savage \ cirrus tseng trident chips apm \ GlideDriver fbdev i128 \ ati AgpGartDrivers DevelDrivers ark cyrix \ @@ -261,6 +266,10 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ # ifndef XF86Server # define XF86Server YES # endif +/* 24/32bpp conversion module */ +# ifndef XF24_32Bpp +# define XF24_32Bpp YES +# endif /* shadow fb module */ # ifndef XFShadowFB # define XFShadowFB YES @@ -283,7 +292,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ # endif # ifndef XF86CardDrivers -# define XF86CardDrivers XF86OSCardDrivers XF86ExtraCardDrivers +# define XF86CardDrivers newport XF86OSCardDrivers XF86ExtraCardDrivers # endif #endif @@ -364,7 +373,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers # define XF86CardDrivers mga tdfx glint s3virge rendition tga \ - nv DevelDrivers siliconmotion vga \ + savage nv DevelDrivers siliconmotion vga \ XF86OSCardDrivers XF86ExtraCardDrivers # endif #endif @@ -448,7 +457,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers -# define XF86CardDrivers mga glint s3virge sis \ +# define XF86CardDrivers mga glint s3virge sis savage\ trident chips fbdev \ DevelDrivers vga \ XF86OSCardDrivers XF86ExtraCardDrivers @@ -1089,10 +1098,6 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese * Other stuff used in the X Server source. */ -#ifndef AsmDefines -# define AsmDefines /**/ -#endif - #ifndef OtherIConfigFiles # define OtherIConfigFiles $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules #endif diff --git a/xc/extras/Mesa/.cvsignore b/xc/extras/Mesa/.cvsignore new file mode 100644 index 000000000..62e1e6b0b --- /dev/null +++ b/xc/extras/Mesa/.cvsignore @@ -0,0 +1,11 @@ +Makefile +Makefile.in +aclocal.m4 +configure +install-sh +missing +mkinstalldirs +config.h.in +stamp.h.in +libtool +lib diff --git a/xc/extras/Mesa/ChangeLog b/xc/extras/Mesa/ChangeLog new file mode 100644 index 000000000..f76ad545a --- /dev/null +++ b/xc/extras/Mesa/ChangeLog @@ -0,0 +1,87 @@ +1999-07-20 Thomas Tanner <tanner@ffii.org> + + * Makefile.am: no longer conforming to the GNU standards + +1999-07-10 Thomas Tanner <tanner@ffii.org> + + * most Makefile.am's: disable autmatic dependendy tracking + +1999-07-08 Thomas Tanner <tanner@ffii.org> + + * INSTALL: describe installation step and options + * INSTALL.GNU: new file + * Makefile.am: distribute INSTALL.GNU + +1999-07-03 Thomas Tanner <tanner@ffii.org> + + * src/Makefile.am: renamed libMesaGL to libGL + * src-glu/Makefile.am: renamed libMesaGLU to libGLU + +1999-06-23 Thomas Tanner <tanner@ffii.org> + + * configure.in: prefix shell variables with x when doing tests + +1999-06-16 Thomas Tanner <tanner@ffii.org> + + * Makefile.am: recursive "make exec" support + * configure.in: enable gcc specific debugging, profiling + and optimization flags, --enable-profile, compile + assembler sources when checking for cpuid, 3dnow and MMX + fixed GGI checks + * src/FX/Makefile.am: don't compile fxspan.c + +1999-06-11 Thomas Tanner <tanner@ffii.org> + + * configure.in: check for 3Dnow support + * fixed MMX/3Dnow support and GGI Makefiles + +1999-06-10 Thomas Tanner <tanner@ffii.org> + + * Makefile: renamed to Makefile.old, inform users about the + new makefile system + * acconfig.h: define new driver flags + * configure.in: generate conf.h, define driver flags in conf.h, + support --without-DRIVER, fixed Glide support + * use conf.h where necessary + * demos/Makefile.am: use double buffering and run osdemo + * samples/Makefile.am: build rgbtoppm, create a ppm image for + demos that need it, use double buffering + * src/X86/Makefile.am: mmx_blend.c -> mmx_blend.S + * src/Makefile.am, src-glu/Makefile.am: increment interface version + * src/GGI: compile conditionally + +1999-06-07 Thomas Tanner <tanner@ffii.org> + + * src/X86/Makefile.am: some fixes for automake 1.4 + +1999-06-06 Thomas Tanner <tanner@ffii.org> + + * moved to experimental-1 branch + * configure.in: define USE_3DNOW_ASM/USE_X86_ASM + * src/asm_386.*: moved to src/X86/transform.* + * src/Makefile.am: src/3Dnow/ doesn't exist any longer, moved + to src/X86/, added the new files from this branch + merged 3Dnow driver into x86 driver + * src/X86/Makefile.am, src/FX/Makefile.am: new files added + * src/X86/Makefile.am: add 3Dnow, MMX support to x86 driver + * src/X86/mmx_blend.c: add #include's, depend on USE_MMX_ASM + +1999-05-29 Thomas Tanner <tanner@ffii.org> + + * created autoconf branch + * src/X86/Makefile.am: use srcdir + +1999-05-28 Thomas Tanner <tanner@ffii.org> + + * xdemos/Makefile.am: move xfont to EXTRA_PROGRAMS + * configure.in: define SVGA + * acinclude.m4: add libtool.m4 + * configure.in: always set *_LIBS before checking for a library, + values of enable-debug are on/off, check for SHM + * src/Makefile.am: typo fixed + +1999-05-25 Thomas Tanner <tanner@ffii.org> + + * Use autoconf/automake/libtool + + $Revision: 1.1.1.1 $ $Date: 2000/12/05 16:38:37 $ diff --git a/xc/extras/Mesa/Makefile.X11 b/xc/extras/Mesa/Makefile.X11 index 247e48745..9abc4cc67 100644 --- a/xc/extras/Mesa/Makefile.X11 +++ b/xc/extras/Mesa/Makefile.X11 @@ -1,7 +1,7 @@ -# $Id: Makefile.X11,v 1.1.1.1 2000/11/30 17:31:30 dawes Exp $ +# $Id: Makefile.X11,v 1.1.1.2 2000/12/05 16:38:37 dawes Exp $ # Mesa 3-D graphics library -# Version: 3.4 +# Version: 3.4.1 # # Copyright (C) 1999-2000 Brian Paul All Rights Reserved. # @@ -472,6 +472,7 @@ LIB_FILES = \ $(DIRECTORY)/widgets-mesa/README \ $(DIRECTORY)/widgets-mesa/TODO \ $(DIRECTORY)/widgets-mesa/configure \ + $(DIRECTORY)/widgets-mesa/configure.in \ $(DIRECTORY)/widgets-mesa/demos/ChangeLog \ $(DIRECTORY)/widgets-mesa/demos/Cube \ $(DIRECTORY)/widgets-mesa/demos/Ed \ diff --git a/xc/extras/Mesa/README b/xc/extras/Mesa/README new file mode 100644 index 000000000..72c176b8b --- /dev/null +++ b/xc/extras/Mesa/README @@ -0,0 +1,2 @@ + +Please look in the docs/ directory for the README file and other documentation. diff --git a/xc/extras/Mesa/README.XF86 b/xc/extras/Mesa/README.XF86 new file mode 100644 index 000000000..06470491d --- /dev/null +++ b/xc/extras/Mesa/README.XF86 @@ -0,0 +1,47 @@ +Importing Mesa. + +Mesa should be imported from a tree checked out from the Mesa CVS +repository (:pserver:anonymous@cvs.mesa3d.sourceforge.net:/cvsroot/mesa3d). + +Instructions for importing a tagged Mesa release X.Y. + +1. Check out the release version from the Mesa CVS repository: + + % cvs -d :pserver:anonymous@cvs.mesa3d.sourceforge.net:/cvsroot/mesa3d \ + -r mesa_X_Y Mesa + +2. Remove the CVSROOT directory: + + % cd Mesa + % rm -fr CVSROOT + +3. Remove the CVS admin directories: + + % find . -name CVS -print | xargs rm -fr + +4. Import: + + % cvs import -m "Mesa version X.Y" xc/extras/Mesa MESA MESA-X_Y + +5. Merge: + + % cvs co -j MESA_PREV -j MESA-X_Y xc/extras/Mesa + + resolve conflicts, and commit. + +6. Check for new files that are GPL'd or which were in directories + previously removed. Remove them from the main branch. + + + + +When importing a snapshot of a Mesa (stable) branch, do everything as above, +except check out the branch with: + + % cvs -d :pserver:anonymous@cvs.mesa3d.sourceforge.net:/cvsroot/mesa3d \ + -r mesa_X_Y_branch Mesa + +and import with the tag MESA-X_Y-yyyymmdd indicating the date of the snapshot. + + +$XFree86: xc/extras/Mesa/README.XF86,v 1.1 2000/11/30 15:46:25 dawes Exp $ diff --git a/xc/extras/Mesa/WIN32/RULES/lib.glut32 b/xc/extras/Mesa/WIN32/RULES/lib.glut32 index bf0edbdf7..cd8811cee 100644 --- a/xc/extras/Mesa/WIN32/RULES/lib.glut32 +++ b/xc/extras/Mesa/WIN32/RULES/lib.glut32 @@ -16,5 +16,5 @@ DLLLIBS = GLU32d.lib OpenGL32d.lib winmm.lib DLLLIBS = GLU32.lib OpenGL32.lib winmm.lib !ENDIF -CPPOPTS = $(CPPOPTS) /DBUILD_GLUT32 +CPPOPTS = $(CPPOPTS) /DBUILD_GLUT32 /DMESA DLLBASE = GLUT32 diff --git a/xc/extras/Mesa/WIN32/RULES/progs.demos b/xc/extras/Mesa/WIN32/RULES/progs.demos index 2796c461f..6d2580a54 100644 --- a/xc/extras/Mesa/WIN32/RULES/progs.demos +++ b/xc/extras/Mesa/WIN32/RULES/progs.demos @@ -13,13 +13,6 @@ EXELIBS = glut32$(LIBSFX).lib glu32$(LIBSFX).lib opengl32$(LIBSFX).lib RUNTIMELIBS = glut32$(LIBSFX).dll glu32$(LIBSFX).dll opengl32$(LIBSFX).dll !ENDIF -!IF ("$(USE_SYSGL)" == "0") && ("$(DEBUG)" == "1") -EXELIBS=$(EXELIBS:.lib=d.lib) -!IF "$(RUNTIMELIBS)" != "" -RUNTIMELIBS=$(RUNTIMELIBS:.dll=d.dll) -!ENDIF -!ENDIF - !IF "$(STATIC_MESA)" == "1" EXELIBS=$(EXELIBS) winmm.lib !ENDIF diff --git a/xc/extras/Mesa/bin/gloffsets.py b/xc/extras/Mesa/bin/gloffsets.py new file mode 100755 index 000000000..4cfd45736 --- /dev/null +++ b/xc/extras/Mesa/bin/gloffsets.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python + +# $Id: gloffsets.py,v 1.1.1.1 2000/12/05 16:38:39 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# +# Copyright (C) 1999-2000 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. + + +# Generate the glapioffsets.h file. +# +# Usage: +# gloffsets.py >glapioffsets.h +# +# Dependencies: +# The gl.spec file from the SI must be in the current directory. +# +# Brian Paul 3 February 2000 + + +import string +import re + + +def PrintHead(): + print '/* DO NOT EDIT - This file generated automatically by gloffsets.py script */' + print '#ifndef _GLAPI_OFFSETS_H_' + print '#define _GLAPI_OFFSETS_H_' + print '' + return +#endif + + +def PrintTail(): + print '' + print '#endif' +#endif + + +def GenerateDefine(name, offset): + s = '#define _gloffset_' + name + ' ' + str(offset) + return s; +#enddef + + +def PrintDefines(): + functionPattern = re.compile('^[a-zA-Z0-9]+\(') + functionNamePattern = re.compile('^[a-zA-Z0-9]+') + + funcName = '' + + maxOffset = 0 + offsetInfo = { } + + f = open('gl.spec') + for line in f.readlines(): + + m = functionPattern.match(line) + if m: + # extract funcName + n = functionNamePattern.findall(line) + funcName = n[0] + + m = string.split(line) + if len(m) > 1: + if m[0] == 'param': + paramName = m[1] + if m[0] == 'offset': + if m[1] == '?': + #print 'WARNING skipping', funcName + noop = 0 + else: + funcOffset = int(m[1]) + if funcOffset > maxOffset: + maxOffset = funcOffset + s = GenerateDefine(funcName, funcOffset) + if offsetInfo.has_key(funcOffset): + print 'ERROR: offset', funcOffset, 'already used!' + raise ERROR + else: + offsetInfo[funcOffset] = s; + #endif + #endif + #endif + #endif + #endfor + + # Now print the #defines in order of dispatch offset + for i in range(0, maxOffset + 1): + if offsetInfo.has_key(i): + print offsetInfo[i] + else: + print 'ERROR: missing offset:', i + raise ERROR + +#enddef + + + +PrintHead() +PrintDefines() +PrintTail() diff --git a/xc/extras/Mesa/bin/gltable.py b/xc/extras/Mesa/bin/gltable.py new file mode 100755 index 000000000..1c2518d2e --- /dev/null +++ b/xc/extras/Mesa/bin/gltable.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python + +# $Id: gltable.py,v 1.1.1.1 2000/12/05 16:38:39 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# +# Copyright (C) 1999-2000 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. + + +# Generate the glapitable.h file. +# +# Usage: +# gltable.py >glapitable.h +# +# Dependencies: +# The gl.spec file from the SI must be in the current directory. +# +# Brian Paul 3 February 2000 + + +import string +import re + + +# +# This table maps types from the gl.spec file to the OpenGL C types. +# +TypeTable = { + 'AttribMask' : 'GLbitfield', + 'Boolean' : 'GLboolean', + 'CheckedFloat32' : 'GLfloat', + 'CheckedInt32' : 'GLint', + 'ClampedColorF' : 'GLclampf', + 'ClampedFloat32' : 'GLclampf', + 'ClampedFloat64' : 'GLclampd', + 'ClampedStencilValue' : 'GLint', + 'ClearBufferMask' : 'GLbitfield', + 'ClientAttribMask' : 'GLbitfield', + 'ColorB' : 'GLbyte', + 'ColorD' : 'GLdouble', + 'ColorF' : 'GLfloat', + 'ColorI' : 'GLint', + 'ColorIndexValueD' : 'GLdouble', + 'ColorIndexValueF' : 'GLfloat', + 'ColorIndexValueI' : 'GLint', + 'ColorIndexValueS' : 'GLshort', + 'ColorIndexValueUB' : 'GLubyte', + 'ColorS' : 'GLshort', + 'ColorUB' : 'GLubyte', + 'ColorUI' : 'GLuint', + 'ColorUS' : 'GLushort', + 'CoordF' : 'GLfloat', + 'CoordD' : 'GLdouble', + 'CoordI' : 'GLint', + 'CoordS' : 'GLshort', + 'FeedbackElement' : 'GLfloat', + 'Float32' : 'GLfloat', + 'Float64' : 'GLdouble', + 'Float32Pointer' : 'GLfloat', + 'Float64Pointer' : 'GLdouble', + 'Int8' : 'GLbyte', + 'Int16' : 'GLshort', + 'Int32' : 'GLint', + 'LineStipple' : 'GLushort', + 'List' : 'GLuint', + 'MaskedColorIndexValueF' : 'GLfloat', + 'MaskedColorIndexValueI' : 'GLuint', + 'MaskedStencilValue' : 'GLuint', + 'PixelInternalFormat' : 'GLenum', + 'SelectName' : 'GLuint', + 'SizeI' : 'GLsizei', + 'StencilValue' : 'GLint', + 'String' : 'const GLubyte *', + 'TexelInternalFormat' : 'GLint', + 'TextureComponentCount' : 'GLint', + 'WinCoord' : 'GLint', + 'UInt8' : 'GLubyte', + 'UInt16' : 'GLushort', + 'UInt32' : 'GLuint', + 'Void' : 'GLvoid', + 'VoidPointer' : 'GLvoid *', + 'void' : 'void', +} + + + +# +# Return C-style argument type string. +# Input: t = a type like ListMode, Int16, CoordF, etc. +# pointerQual = '' or '*' +# constQual = '' or 'const ' +# Return: a string like "const GLubyte *' +# +def ActualType(t, pointerQual, constQual): + if TypeTable.has_key(t): + type = TypeTable[t] + else: + type = 'GLenum' + if pointerQual == '': + s = constQual + type + else: + s = constQual + type + ' ' + pointerQual + return s +#enddef + + + +# +# Convert a Python list of arguments into a string. +# +def ArgListToString(argList): + result = '' + i = 1 + n = len(argList) + for pair in argList: + result = result + pair[0] + ' ' + pair[1] + if i < n: + result = result + ', ' + i = i + 1 + + if result == '': + result = 'void' + return result +#enddef + + +# +# Return a dispatch table entry, like "void (*Enable)(GLenum cap);" +# +def MakeTableEntry(retType, funcName, argList, offset): + s = ' ' + s = s + ActualType(retType, '', '') + s = s + ' (*' + s = s + funcName + s = s + ')(' + s = s + ArgListToString(argList) + s = s + '); /* ' + s = s + str(offset) + s = s + ' */' + return s +#enddef + + + +def GroupFromCategory(category): + baseCats = [ + 'display-list', + 'drawing', + 'drawing-control', + 'feedback', + 'framebuf', + 'misc', + 'modeling', + 'pixel-op', + 'pixel-rw', + 'state-req', + 'xform' + ] + + if baseCats.count(category) > 0: + return 'GL_1_0' + else: + return 'GL_' + category + #endif +#endif + + +def PrintGroup(group): + s = ' /* ' + s = s + group + s = s + ' */' + print s +#enddef + + + +# +# Parse gl.spec to generate all the function pointers in the dispatch struct. +# +def PrintTableEntries(): + functionPattern = re.compile('^[a-zA-Z0-9]+\(') + functionNamePattern = re.compile('^[a-zA-Z0-9]+') + + prevGroup = '' + funcName = '' + returnType = '' + argList = [ ] + maxOffset = 0 + table = { } + + f = open('gl.spec') + for line in f.readlines(): + + m = functionPattern.match(line) + if m: + # extract funcName + n = functionNamePattern.findall(line) + funcName = n[0] + argList = [ ] + #endif + + m = string.split(line) + if len(m) > 1: + # return datatype + if m[0] == 'return': + returnType = m[1] + #endif + + # function parameter + if m[0] == 'param': + constQual = '' + pointerQual = '' + if len(m) >= 5 and m[4] == 'array': + pointerQual = '*' + if m[3] == 'in': + constQual = 'const ' + paramName = m[1] + paramType = ActualType(m[2], pointerQual, constQual) + + argList.append( (paramType, paramName) ) + #endif + +# # category + if m[0] == 'category': + category = m[1] + group = GroupFromCategory(category) + if group != prevGroup: +# PrintGroup(group) + prevGroup = group + #endif + + # end of function spec + if m[0] == 'offset': + if m[1] == '?': + #print 'WARNING: skipping', funcName + noop = 0 + else: + funcOffset = int(m[1]) + if funcOffset > maxOffset: + maxOffset = funcOffset + #PrintProto(returnType, funcName, argList) + s = MakeTableEntry(returnType, funcName, argList, funcOffset) +# print s + table[funcOffset] = s; + #endif + #endif + #endif + #endfor + + # Now dump the table, this effectively does the sort by offset number + for i in range(0, maxOffset + 1): + if table.has_key(i): + print table[i] + +#enddef + + + +def PrintHead(): + print '/* DO NOT EDIT - This file generated automatically with gltable.py script */' + print '#ifndef _GLAPI_TABLE_H_' + print '#define _GLAPI_TABLE_H_' + print '' + print '#include <GL/gl.h>' + print '' + print 'struct _glapi_table' + print '{' + return +#endif + + +def PrintTail(): + print '};' + print '' + print '#endif' +#endif + + + +PrintHead() +PrintTableEntries() +PrintTail()
\ No newline at end of file diff --git a/xc/extras/Mesa/bin/glx86asm.py b/xc/extras/Mesa/bin/glx86asm.py new file mode 100755 index 000000000..32dd46b16 --- /dev/null +++ b/xc/extras/Mesa/bin/glx86asm.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python + +# $Id: glx86asm.py,v 1.1.1.1 2000/12/05 16:38:39 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.4 +# +# Copyright (C) 1999-2000 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. + + +# Generate the glapi_x86.S assembly language file. +# +# Usage: +# glx86asm.py >glapi_x86.S +# +# Dependencies: +# The gl.spec file from the SI must be in the current directory. +# +# Brian Paul 11 May 2000 + + +import string +import re + + +def PrintHead(): + print '/* DO NOT EDIT - This file generated automatically with glx86asm.py script */' + print '#include "assyntax.h"' + print '#include "glapioffsets.h"' + print '' + print '#ifndef __WIN32__' + print '' + print '#if defined(USE_MGL_NAMESPACE)' + print '#define GL_PREFIX(n) GLNAME(CONCAT(mgl,n))' + print '#else' + print '#define GL_PREFIX(n) GLNAME(CONCAT(gl,n))' + print '#endif' + print '' + print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))' + print '' + print '#ifdef GNU_ASSEMBLER' + print '#define GLOBL_FN(x) GLOBL x ; .type x,@function' + print '#else' + print '#define GLOBL_FN(x) GLOBL x' + print '#endif' + print '' + print '' + return +#endif + + +def PrintTail(): + print '' + print '#endif /* __WIN32__ */' +#endif + + +def GenerateDispatchCode(name, offset): + print 'ALIGNTEXT16' + print "GLOBL_FN(GL_PREFIX(%s))" % (name) + print "GL_PREFIX(%s):" % (name) + print '\tMOV_L(GLNAME(_glapi_Dispatch), EAX)' + print '\tTEST_L(EAX, EAX)' + print "\tJZ(GLNAME(_glapi_fallback_%s))" % (name) + print "\tJMP(GL_OFFSET(_gloffset_%s))" % (offset) + print '' +#enddef + + +def FindAlias(list, funcName): + for i in range(0, len(list)): + entry = list[i] + if entry[0] == funcName: + return entry[1] + #endif + #endfor + return '' +#enddef + + + +def PrintDefines(): + functionPattern = re.compile('^[a-zA-Z0-9]+\(') + functionNamePattern = re.compile('^[a-zA-Z0-9]+') + + funcName = '' + functions = [ ] + + f = open('gl.spec') + for line in f.readlines(): + + m = functionPattern.match(line) + if m: + # extract funcName + n = functionNamePattern.findall(line) + funcName = n[0] + + m = string.split(line) + if len(m) > 1: + if m[0] == 'param': + paramName = m[1] + if m[0] == 'offset': + if m[1] == '?': + #print 'WARNING skipping', funcName + noop = 0 + else: + entry = [ funcName, funcName ] + functions.append(entry) + #endif + elif m[0] == 'alias': + aliasedName = FindAlias(functions, m[1]) + if aliasedName: + entry = [ funcName, aliasedName ] + functions.append(entry) + else: + print 'WARNING: alias to unknown function:', aliasedName + #endif + #endif + #endif + #endfor + + # Now generate the assembly dispatch code + for i in range(0, len(functions)): + entry = functions[i] + GenerateDispatchCode( entry[0], entry[1] ) + +#enddef + + + +PrintHead() +PrintDefines() +PrintTail() diff --git a/xc/extras/Mesa/book/.cvsignore b/xc/extras/Mesa/book/.cvsignore new file mode 100644 index 000000000..7bd7c18ee --- /dev/null +++ b/xc/extras/Mesa/book/.cvsignore @@ -0,0 +1,70 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +aaindex +aapoly +aargb +accanti +accpersp +alpha +alpha3D +anti +bezcurve +bezmesh +checker +clip +colormat +cube +depthcue +dof +double +drawf +feedback +fog +fogindex +font +hello +image +jitter.h +light +lines +list +material +mipmap +model +movelight +nurbs +pickdepth +picksquare +plane +planet +polyoff +polys +quadric +robot +sccolorlight +scene +scenebamb +sceneflat +select +smooth +stencil +stroke +surface +teaambient +teapots +tess +tesswind +texbind +texgen +texprox +texsub +texturesurf +torus +trim +unproject +varray +wrap diff --git a/xc/extras/Mesa/book/Imakefile b/xc/extras/Mesa/book/Imakefile new file mode 100644 index 000000000..ab3b6d7f7 --- /dev/null +++ b/xc/extras/Mesa/book/Imakefile @@ -0,0 +1,221 @@ +LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\Mesaaux.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
+
+INCLUDES = -I$(TOP)\include
+
+SRCS = accanti.c \
+ accnot.c \
+ accpersp.c \
+ accum.c \
+ aim.c \
+ alpha.c \
+ alpha3D.c \
+ anti.c \
+ antiindex.c \
+ antipindex.c \
+ antipoint.c \
+ antipoly.c \
+ bezcurve.c \
+ bezmesh.c \
+ bezsurf.c \
+ checker.c \
+ checker2.c \
+ chess.c \
+ clip.c \
+ colormat.c \
+ cone.c \
+ cube.c \
+ curve.c \
+ depthcue.c \
+ disk.c \
+ dof.c \
+ dofnot.c \
+ double.c \
+ drawf.c \
+ feedback.c \
+ fog.c \
+ fogindex.c \
+ font.c \
+ light.c \
+ linelist.c \
+ lines.c \
+ list.c \
+ list2.c \
+ maplight.c \
+ material.c \
+ mipmap.c \
+ model.c \
+ movelight.c \
+ nurbs.c \
+ pickdepth.c \
+ pickline.c \
+ picksquare.c \
+ plane.c \
+ planet.c \
+ planetup.c \
+ polys.c \
+ robot.c \
+ sccolorlight.c \
+ scene.c \
+ scenebamb.c \
+ sceneflat.c \
+ select.c \
+ simple.c \
+ smooth.c \
+ sphere.c \
+ stencil.c \
+ stroke.c \
+ surface.c \
+ tea.c \
+ teaambient.c \
+ teapots.c \
+ texgen.c \
+ texturesurf.c \
+ trim.c \
+ xfont.c
+
+PROGRAMS = ProgramTargetName(accanti) \
+ ProgramTargetName(accnot) \
+ ProgramTargetName(accpersp) \
+ ProgramTargetName(accum) \
+ ProgramTargetName(aim) \
+ ProgramTargetName(alpha) \
+ ProgramTargetName(alpha3D) \
+ ProgramTargetName(anti) \
+ ProgramTargetName(antiindex) \
+ ProgramTargetName(antipindex) \
+ ProgramTargetName(antipoint) \
+ ProgramTargetName(antipoly) \
+ ProgramTargetName(bezcurve) \
+ ProgramTargetName(bezmesh) \
+ ProgramTargetName(bezsurf) \
+ ProgramTargetName(checker) \
+ ProgramTargetName(checker2) \
+ ProgramTargetName(chess) \
+ ProgramTargetName(clip) \
+ ProgramTargetName(colormat) \
+ ProgramTargetName(cone) \
+ ProgramTargetName(cube) \
+ ProgramTargetName(curve) \
+ ProgramTargetName(depthcue) \
+ ProgramTargetName(disk) \
+ ProgramTargetName(dof) \
+ ProgramTargetName(dofnot) \
+ ProgramTargetName(double) \
+ ProgramTargetName(drawf) \
+ ProgramTargetName(feedback) \
+ ProgramTargetName(fog) \
+ ProgramTargetName(fogindex) \
+ ProgramTargetName(font) \
+ ProgramTargetName(light) \
+ ProgramTargetName(linelist) \
+ ProgramTargetName(lines) \
+ ProgramTargetName(list) \
+ ProgramTargetName(list2) \
+ ProgramTargetName(maplight) \
+ ProgramTargetName(material) \
+ ProgramTargetName(mipmap) \
+ ProgramTargetName(model) \
+ ProgramTargetName(movelight) \
+ ProgramTargetName(nurbs) \
+ ProgramTargetName(pickdepth) \
+ ProgramTargetName(pickline) \
+ ProgramTargetName(picksquare) \
+ ProgramTargetName(plane) \
+ ProgramTargetName(planet) \
+ ProgramTargetName(planetup) \
+ ProgramTargetName(polys) \
+ ProgramTargetName(robot) \
+ ProgramTargetName(sccolorlight) \
+ ProgramTargetName(scene) \
+ ProgramTargetName(scenebamb) \
+ ProgramTargetName(sceneflat) \
+ ProgramTargetName(select) \
+ ProgramTargetName(simple) \
+ ProgramTargetName(smooth) \
+ ProgramTargetName(sphere) \
+ ProgramTargetName(stencil) \
+ ProgramTargetName(stroke) \
+ ProgramTargetName(surface) \
+ ProgramTargetName(tea) \
+ ProgramTargetName(teaambient) \
+ ProgramTargetName(teapots) \
+ ProgramTargetName(texgen) \
+ ProgramTargetName(texturesurf) \
+ ProgramTargetName(trim) \
+ ProgramTargetName(xfont)
+
+AllTarget($(PROGRAMS))
+
+NormalProgramTarget(accanti,accanti.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(accnot,accnot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(accpersp,accpersp.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(aim,aim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(alpha,alpha.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(alpha3D,alpha3D.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(anti,anti.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(antiindex,antiindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(antipindex,antipindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(antipoint,antipoint.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(antipoly,antipoly.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bezcurve,bezcurve.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bezmesh,bezmesh.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bezsurf,bezsurf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(checker,checker.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(checker2,checker2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(chess,chess.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(clip,clip.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(colormat,colormat.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(cone,cone.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(cube,cube.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(curve,curve.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(depthcue,depthcue.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(disk,disk.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(dof,dof.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(dofnot,dofnot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(double,double.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(drawf,drawf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(feedback,feedback.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(fogindex,fogindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(light,light.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(linelist,linelist.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(lines,lines.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(list,list.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(list2,list2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(maplight,maplight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(material,material.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(mipmap,mipmap.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(model,model.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(movelight,movelight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(nurbs,nurbs.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(pickdepth,pickdepth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(pickline,pickline.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(picksquare,picksquare.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(plane,plane.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(planet,planet.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(planetup,planetup.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(polys,polys.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(robot,robot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(sccolorlight,sccolorlight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(scene,scene.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(scenebamb,scenebamb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(sceneflat,sceneflat.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(simple,simple.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(smooth,smooth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(stroke,stroke.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(surface,surface.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(tea,tea.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(teaambient,teaambient.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(teapots,teapots.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(texgen,texgen.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(texturesurf,texturesurf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(trim,trim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(xfont,xfont.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+
+DependTarget()
+
diff --git a/xc/extras/Mesa/book/Makefile.BeOS-R4 b/xc/extras/Mesa/book/Makefile.BeOS-R4 new file mode 100644 index 000000000..c410eb72e --- /dev/null +++ b/xc/extras/Mesa/book/Makefile.BeOS-R4 @@ -0,0 +1,76 @@ +# $Id: Makefile.BeOS-R4,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ + +# Makefile for OpenGL Programming Guide programs for BeOS R4 +# This file is in the public domain. + + +# $Log: Makefile.BeOS-R4,v $ +# Revision 1.1.1.1 2000/12/05 16:38:37 dawes +# Import of XFree86 4.0.1g +# +# Revision 1.2 1999/09/17 00:08:31 brianp +# link with -lGLU -lGL instead of -lMesaGLU -lMesaGL +# +# Revision 1.1.1.1 1999/08/19 00:55:40 jtg +# Imported sources +# +# Revision 1.1 1999/02/25 02:13:06 brianp +# initial check-in +# + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = aaindex aapoly aargb accanti accpersp alpha alpha3D anti \ + bezcurve bezmesh checker clip colormat cube depthcue dof \ + double drawf feedback fog fogindex font hello image light \ + lines list material mipmap model movelight nurbs pickdepth \ + picksquare plane planet polyoff polys robot sccolorlight \ + scene scenebamb sceneflat select smooth stencil stroke surface \ + teaambient teapots tess tesswind texbind texgen texprox texsub \ + texturesurf torus unproject varray wrap + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config + diff --git a/xc/extras/Mesa/book/Makefile.X11 b/xc/extras/Mesa/book/Makefile.X11 new file mode 100644 index 000000000..5759d11df --- /dev/null +++ b/xc/extras/Mesa/book/Makefile.X11 @@ -0,0 +1,64 @@ +# $Id: Makefile.X11,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.1 +# Copyright (C) 1995-1998 Brian Paul + +# Makefile for programs from the OpenGL Programming Guide + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(APP_LIB_DEPS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = aaindex aapoly aargb accanti accpersp alpha alpha3D anti \ + bezcurve bezmesh checker clip colormat cube depthcue dof \ + double drawf feedback fog fogindex font hello image light \ + lines list material mipmap model movelight nurbs pickdepth \ + picksquare plane planet polyoff polys quadric robot sccolorlight \ + scene scenebamb sceneflat select smooth stencil stroke surface \ + teaambient teapots tess tesswind texbind texgen texprox texsub \ + texturesurf torus trim unproject varray wrap + + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ###### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config diff --git a/xc/extras/Mesa/book/Makefile.am b/xc/extras/Mesa/book/Makefile.am new file mode 100644 index 000000000..3a459775b --- /dev/null +++ b/xc/extras/Mesa/book/Makefile.am @@ -0,0 +1,29 @@ +## Process this file with automake to produce Makefile.in + +#AUTOMAKE_OPTIONS = no-dependencies + +INCLUDES = -I$(top_srcdir)/include $(GLUT_CFLAGS) + +check_PROGRAMS = aaindex aapoly aargb accanti accpersp alpha alpha3D anti \ + bezcurve bezmesh checker clip colormat cube depthcue dof \ + double drawf feedback fog fogindex font hello image light \ + lines list material mipmap model movelight nurbs pickdepth \ + picksquare plane planet polyoff polys quadric robot sccolorlight \ + scene scenebamb sceneflat select smooth stencil stroke surface \ + teaambient teapots tess tesswind texbind texgen texprox texsub \ + texturesurf torus trim unproject varray wrap + +EXTRA_DIST = jitter.h + +LDADD = $(GLUT_LIBS) $(top_builddir)/src-glu/libGLU.la \ + $(top_builddir)/src/libGL.la -lm +LDFLAGS = -no-install + +# execute all programs +exec: $(check_PROGRAMS) + @for prog in $(check_PROGRAMS); \ + do \ + echo -n "Running $$prog ..." ; \ + ./$$prog ; \ + echo ; \ + done diff --git a/xc/extras/Mesa/book/Makefile.win b/xc/extras/Mesa/book/Makefile.win new file mode 100644 index 000000000..79c4f6755 --- /dev/null +++ b/xc/extras/Mesa/book/Makefile.win @@ -0,0 +1,81 @@ +# Makefile for Win32 + +TOP = .. + +!include "$(TOP)/names.win" + +!include <win32.mak> + +SRCS= \ + accanti.c \ + accnot.c \ + accum.c \ + aim.c \ + alpha.c \ + alpha3D.c \ + anti.c \ + antiindex.c \ + antipindex.c \ + antipoint.c \ + antipoly.c \ + bezcurve.c \ + bezmesh.c \ + bezsurf.c \ + checker.c \ + checker2.c \ + chess.c \ + clip.c \ + colormat.c \ + cone.c \ + cube.c \ + curve.c \ + depthcue.c \ + disk.c \ + dof.c \ + dofnot.c \ + double.c \ + drawf.c \ + feedback.c \ + fog.c \ + fogindex.c \ + font.c \ + light.c \ + linelist.c \ + lines.c \ + list.c \ + list2.c \ + maplight.c \ + material.c \ + mipmap.c \ + model.c \ + movelight.c \ + nurbs.c \ + pickdepth.c \ + pickline.c \ + picksquare.c \ + plane.c \ + planet.c \ + planetup.c \ + polys.c \ + robot.c \ + sccolorlight.c \ + scene.c \ + scenebamb.c \ + sceneflat.c \ + select.c \ + smooth.c \ + sphere.c \ + stencil.c \ + stroke.c \ + surface.c \ + tea.c \ + teaambient.c \ + teapots.c \ + texgen.c \ + texturesurf.c \ + trim.c + +EXTRALIBS = $(MESAGL).lib $(MESAGLU).lib $(MESATK).lib $(MESAAUX).lib + +!include "$(TOP)/mesawin32.mak" + diff --git a/xc/extras/Mesa/book/README b/xc/extras/Mesa/book/README new file mode 100644 index 000000000..4c8d5a74c --- /dev/null +++ b/xc/extras/Mesa/book/README @@ -0,0 +1,41 @@ +/* + * For the software in this directory + * (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. + */ + +The source code examples in this directory accompany the examples +printed in the _OpenGL Programming Guide_, published by Addison-Wesley; +ISBN 0-201-63274-8. diff --git a/xc/extras/Mesa/book/aaindex.c b/xc/extras/Mesa/book/aaindex.c new file mode 100644 index 000000000..7dbc7b4b9 --- /dev/null +++ b/xc/extras/Mesa/book/aaindex.c @@ -0,0 +1,153 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * aaindex.c + * This program draws shows how to draw anti-aliased lines in color + * index mode. It draws two diagonal lines to form an X; when 'r' + * is typed in the window, the lines are rotated in opposite + * directions. + */ +#include <GL/glut.h> +#include "stdlib.h" + +#define RAMPSIZE 16 +#define RAMP1START 32 +#define RAMP2START 48 + +static float rotAngle = 0.; + +/* Initialize antialiasing for color index mode, + * including loading a green color ramp starting + * at RAMP1START, and a blue color ramp starting + * at RAMP2START. The ramps must be a multiple of 16. + */ +void init(void) +{ + int i; + + for (i = 0; i < RAMPSIZE; i++) { + GLfloat shade; + shade = (GLfloat) i/(GLfloat) RAMPSIZE; + glutSetColor(RAMP1START+(GLint)i, 0., shade, 0.); + glutSetColor(RAMP2START+(GLint)i, 0., 0., shade); + } + + glEnable (GL_LINE_SMOOTH); + glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + glLineWidth (1.5); + + glClearIndex ((GLfloat) RAMP1START); +} + +/* Draw 2 diagonal lines to form an X + */ +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glIndexi(RAMP1START); + glPushMatrix(); + glRotatef(-rotAngle, 0.0, 0.0, 0.1); + glBegin (GL_LINES); + glVertex2f (-0.5, 0.5); + glVertex2f (0.5, -0.5); + glEnd (); + glPopMatrix(); + + glIndexi(RAMP2START); + glPushMatrix(); + glRotatef(rotAngle, 0.0, 0.0, 0.1); + glBegin (GL_LINES); + glVertex2f (0.5, 0.5); + glVertex2f (-0.5, -0.5); + glEnd (); + glPopMatrix(); + + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + gluOrtho2D (-1.0, 1.0, + -1.0*(GLfloat)h/(GLfloat)w, 1.0*(GLfloat)h/(GLfloat)w); + else + gluOrtho2D (-1.0*(GLfloat)w/(GLfloat)h, + 1.0*(GLfloat)w/(GLfloat)h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 'r': + case 'R': + rotAngle += 20.; + if (rotAngle >= 360.) rotAngle = 0.; + glutPostRedisplay(); + break; + case 27: /* Escape Key */ + exit(0); + break; + default: + break; + } +} + +/* Main Loop + * Open window with initial window size, title bar, + * color index display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_INDEX); + glutInitWindowSize (200, 200); + glutCreateWindow (argv[0]); + init(); + glutReshapeFunc (reshape); + glutKeyboardFunc (keyboard); + glutDisplayFunc (display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/aapoly.c b/xc/extras/Mesa/book/aapoly.c new file mode 100644 index 000000000..757f0f48c --- /dev/null +++ b/xc/extras/Mesa/book/aapoly.c @@ -0,0 +1,172 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * aapoly.c + * This program draws filled polygons with antialiased + * edges. The special GL_SRC_ALPHA_SATURATE blending + * function is used. + * Pressing the 't' key turns the antialiasing on and off. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +GLboolean polySmooth = GL_TRUE; + +static void init(void) +{ + glCullFace (GL_BACK); + glEnable (GL_CULL_FACE); + glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE); + glClearColor (0.0, 0.0, 0.0, 0.0); +} + +#define NFACE 6 +#define NVERT 8 +void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1, + GLdouble z0, GLdouble z1) +{ + static GLfloat v[8][3]; + static GLfloat c[8][4] = { + {0.0, 0.0, 0.0, 1.0}, {1.0, 0.0, 0.0, 1.0}, + {0.0, 1.0, 0.0, 1.0}, {1.0, 1.0, 0.0, 1.0}, + {0.0, 0.0, 1.0, 1.0}, {1.0, 0.0, 1.0, 1.0}, + {0.0, 1.0, 1.0, 1.0}, {1.0, 1.0, 1.0, 1.0} + }; + +/* indices of front, top, left, bottom, right, back faces */ + static GLubyte indices[NFACE][4] = { + {4, 5, 6, 7}, {2, 3, 7, 6}, {0, 4, 7, 3}, + {0, 1, 5, 4}, {1, 5, 6, 2}, {0, 3, 2, 1} + }; + + v[0][0] = v[3][0] = v[4][0] = v[7][0] = x0; + v[1][0] = v[2][0] = v[5][0] = v[6][0] = x1; + v[0][1] = v[1][1] = v[4][1] = v[5][1] = y0; + v[2][1] = v[3][1] = v[6][1] = v[7][1] = y1; + v[0][2] = v[1][2] = v[2][2] = v[3][2] = z0; + v[4][2] = v[5][2] = v[6][2] = v[7][2] = z1; + +#ifdef GL_VERSION_1_1 + glEnableClientState (GL_VERTEX_ARRAY); + glEnableClientState (GL_COLOR_ARRAY); + glVertexPointer (3, GL_FLOAT, 0, v); + glColorPointer (4, GL_FLOAT, 0, c); + glDrawElements (GL_QUADS, NFACE*4, GL_UNSIGNED_BYTE, indices); + glDisableClientState (GL_VERTEX_ARRAY); + glDisableClientState (GL_COLOR_ARRAY); +#else + printf ("If this is GL Version 1.0, "); + printf ("vertex arrays are not supported.\n"); + exit(1); +#endif +} + +/* Note: polygons must be drawn from front to back + * for proper blending. + */ +void display(void) +{ + if (polySmooth) { + glClear (GL_COLOR_BUFFER_BIT); + glEnable (GL_BLEND); + glEnable (GL_POLYGON_SMOOTH); + glDisable (GL_DEPTH_TEST); + } + else { + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glDisable (GL_BLEND); + glDisable (GL_POLYGON_SMOOTH); + glEnable (GL_DEPTH_TEST); + } + + glPushMatrix (); + glTranslatef (0.0, 0.0, -8.0); + glRotatef (30.0, 1.0, 0.0, 0.0); + glRotatef (60.0, 0.0, 1.0, 0.0); + drawCube(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5); + glPopMatrix (); + + glFlush (); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(30.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 't': + case 'T': + polySmooth = !polySmooth; + glutPostRedisplay(); + break; + case 27: + exit(0); /* Escape key */ + break; + default: + break; + } +} + +/* Main Loop + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB + | GLUT_ALPHA | GLUT_DEPTH); + glutInitWindowSize(200, 200); + glutCreateWindow(argv[0]); + init (); + glutReshapeFunc (reshape); + glutKeyboardFunc (keyboard); + glutDisplayFunc (display); + glutMainLoop(); + return 0; +} + diff --git a/xc/extras/Mesa/book/aargb.c b/xc/extras/Mesa/book/aargb.c new file mode 100644 index 000000000..f51984170 --- /dev/null +++ b/xc/extras/Mesa/book/aargb.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * aargb.c + * This program draws shows how to draw anti-aliased lines. It draws + * two diagonal lines to form an X; when 'r' is typed in the window, + * the lines are rotated in opposite directions. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +static float rotAngle = 0.; + +/* Initialize antialiasing for RGBA mode, including alpha + * blending, hint, and line width. Print out implementation + * specific info on line width granularity and width. + */ +void init(void) +{ + GLfloat values[2]; + glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values); + printf ("GL_LINE_WIDTH_GRANULARITY value is %3.1f\n", values[0]); + + glGetFloatv (GL_LINE_WIDTH_RANGE, values); + printf ("GL_LINE_WIDTH_RANGE values are %3.1f %3.1f\n", + values[0], values[1]); + + glEnable (GL_LINE_SMOOTH); + glEnable (GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + glLineWidth (1.5); + + glClearColor(0.0, 0.0, 0.0, 0.0); +} + +/* Draw 2 diagonal lines to form an X + */ +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glColor3f (0.0, 1.0, 0.0); + glPushMatrix(); + glRotatef(-rotAngle, 0.0, 0.0, 0.1); + glBegin (GL_LINES); + glVertex2f (-0.5, 0.5); + glVertex2f (0.5, -0.5); + glEnd (); + glPopMatrix(); + + glColor3f (0.0, 0.0, 1.0); + glPushMatrix(); + glRotatef(rotAngle, 0.0, 0.0, 0.1); + glBegin (GL_LINES); + glVertex2f (0.5, 0.5); + glVertex2f (-0.5, -0.5); + glEnd (); + glPopMatrix(); + + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + gluOrtho2D (-1.0, 1.0, + -1.0*(GLfloat)h/(GLfloat)w, 1.0*(GLfloat)h/(GLfloat)w); + else + gluOrtho2D (-1.0*(GLfloat)w/(GLfloat)h, + 1.0*(GLfloat)w/(GLfloat)h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 'r': + case 'R': + rotAngle += 20.; + if (rotAngle >= 360.) rotAngle = 0.; + glutPostRedisplay(); + break; + case 27: /* Escape Key */ + exit(0); + break; + default: + break; + } +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (200, 200); + glutCreateWindow (argv[0]); + init(); + glutReshapeFunc (reshape); + glutKeyboardFunc (keyboard); + glutDisplayFunc (display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/accanti.c b/xc/extras/Mesa/book/accanti.c new file mode 100644 index 000000000..12ca16f7a --- /dev/null +++ b/xc/extras/Mesa/book/accanti.c @@ -0,0 +1,182 @@ + +/* 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. + */ +/* accanti.c + */ +#include <stdlib.h> +#include <GL/glut.h> +#include "jitter.h" + +/* Initialize lighting and other values. + */ +void myinit(void) +{ + GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_position[] = { 0.0, 0.0, 10.0, 1.0 }; + GLfloat lm_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; + + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialf(GL_FRONT, GL_SHININESS, 50.0); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glShadeModel (GL_FLAT); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearAccum(0.0, 0.0, 0.0, 0.0); +} + +void displayObjects(void) +{ + GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; + GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 }; + GLfloat sphere_diffuse[] = { 0.7, 0.0, 0.7, 1.0 }; + GLfloat octa_diffuse[] = { 0.7, 0.4, 0.4, 1.0 }; + + glPushMatrix (); + glRotatef (30.0, 1.0, 0.0, 0.0); + + glPushMatrix (); + glTranslatef (-0.80, 0.35, 0.0); + glRotatef (100.0, 1.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse); + glutSolidTorus (0.275, 0.85, 16, 16); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-0.75, -0.50, 0.0); + glRotatef (45.0, 0.0, 0.0, 1.0); + glRotatef (45.0, 1.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse); + glutSolidCube (1.5); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.75, 0.60, 0.0); + glRotatef (30.0, 1.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse); + glutSolidSphere (1.0, 16, 16); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.70, -0.90, 0.25); + glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse); + glutSolidOctahedron (); + glPopMatrix (); + + glPopMatrix (); +} + +#define ACSIZE 8 + +void display(void) +{ + GLint viewport[4]; + int jitter; + + glGetIntegerv (GL_VIEWPORT, viewport); + + glClear(GL_ACCUM_BUFFER_BIT); + for (jitter = 0; jitter < ACSIZE; jitter++) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix (); +/* Note that 4.5 is the distance in world space between + * left and right and bottom and top. + * This formula converts fractional pixel movement to + * world coordinates. + */ + glTranslatef (j8[jitter].x*4.5/viewport[2], + j8[jitter].y*4.5/viewport[3], 0.0); + displayObjects (); + glPopMatrix (); + glAccum(GL_ACCUM, 1.0/ACSIZE); + } + glAccum (GL_RETURN, 1.0); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-2.25, 2.25, -2.25*h/w, 2.25*h/w, -10.0, 10.0); + else + glOrtho (-2.25*w/h, 2.25*w/h, -2.25, 2.25, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB + | GLUT_ACCUM | GLUT_DEPTH); + glutInitWindowSize (250, 250); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/accpersp.c b/xc/extras/Mesa/book/accpersp.c new file mode 100644 index 000000000..46e369ae6 --- /dev/null +++ b/xc/extras/Mesa/book/accpersp.c @@ -0,0 +1,240 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* accpersp.c + * Use the accumulation buffer to do full-scene antialiasing + * on a scene with perspective projection, using the special + * routines accFrustum() and accPerspective(). + */ +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> +#include "jitter.h" + +#define PI_ 3.14159265358979323846 + +/* accFrustum() + * The first 6 arguments are identical to the glFrustum() call. + * + * pixdx and pixdy are anti-alias jitter in pixels. + * Set both equal to 0.0 for no anti-alias jitter. + * eyedx and eyedy are depth-of field jitter in pixels. + * Set both equal to 0.0 for no depth of field effects. + * + * focus is distance from eye to plane in focus. + * focus must be greater than, but not equal to 0.0. + * + * Note that accFrustum() calls glTranslatef(). You will + * probably want to insure that your ModelView matrix has been + * initialized to identity before calling accFrustum(). + */ +void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx, + GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus) +{ + GLdouble xwsize, ywsize; + GLdouble dx, dy; + GLint viewport[4]; + + glGetIntegerv (GL_VIEWPORT, viewport); + + xwsize = right - left; + ywsize = top - bottom; + + dx = -(pixdx*xwsize/(GLdouble) viewport[2] + eyedx*nnear/focus); + dy = -(pixdy*ywsize/(GLdouble) viewport[3] + eyedy*nnear/focus); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum (left + dx, right + dx, bottom + dy, top + dy, nnear, ffar); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef (-eyedx, -eyedy, 0.0); +} + +/* accPerspective() + * + * The first 4 arguments are identical to the gluPerspective() call. + * pixdx and pixdy are anti-alias jitter in pixels. + * Set both equal to 0.0 for no anti-alias jitter. + * eyedx and eyedy are depth-of field jitter in pixels. + * Set both equal to 0.0 for no depth of field effects. + * + * focus is distance from eye to plane in focus. + * focus must be greater than, but not equal to 0.0. + * + * Note that accPerspective() calls accFrustum(). + */ +void accPerspective(GLdouble fovy, GLdouble aspect, + GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy, + GLdouble eyedx, GLdouble eyedy, GLdouble focus) +{ + GLdouble fov2,left,right,bottom,top; + + fov2 = ((fovy*PI_) / 180.0) / 2.0; + + top = nnear / (cos(fov2) / sin(fov2)); + bottom = -top; + + right = top * aspect; + left = -right; + + accFrustum (left, right, bottom, top, nnear, ffar, + pixdx, pixdy, eyedx, eyedy, focus); +} + +/* Initialize lighting and other values. + */ +void init(void) +{ + GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_position[] = { 0.0, 0.0, 10.0, 1.0 }; + GLfloat lm_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; + + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialf(GL_FRONT, GL_SHININESS, 50.0); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + glShadeModel (GL_FLAT); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearAccum(0.0, 0.0, 0.0, 0.0); +} + +void displayObjects(void) +{ + GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; + GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 }; + GLfloat sphere_diffuse[] = { 0.7, 0.0, 0.7, 1.0 }; + GLfloat octa_diffuse[] = { 0.7, 0.4, 0.4, 1.0 }; + + glPushMatrix (); + glTranslatef (0.0, 0.0, -5.0); + glRotatef (30.0, 1.0, 0.0, 0.0); + + glPushMatrix (); + glTranslatef (-0.80, 0.35, 0.0); + glRotatef (100.0, 1.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse); + glutSolidTorus (0.275, 0.85, 16, 16); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-0.75, -0.50, 0.0); + glRotatef (45.0, 0.0, 0.0, 1.0); + glRotatef (45.0, 1.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse); + glutSolidCube (1.5); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.75, 0.60, 0.0); + glRotatef (30.0, 1.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse); + glutSolidSphere (1.0, 16, 16); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.70, -0.90, 0.25); + glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse); + glutSolidOctahedron (); + glPopMatrix (); + + glPopMatrix (); +} + +#define ACSIZE 8 + +void display(void) +{ + GLint viewport[4]; + int jitter; + + glGetIntegerv (GL_VIEWPORT, viewport); + + glClear(GL_ACCUM_BUFFER_BIT); + for (jitter = 0; jitter < ACSIZE; jitter++) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + accPerspective (50.0, + (GLdouble) viewport[2]/(GLdouble) viewport[3], + 1.0, 15.0, j8[jitter].x, j8[jitter].y, 0.0, 0.0, 1.0); + displayObjects (); + glAccum(GL_ACCUM, 1.0/ACSIZE); + } + glAccum (GL_RETURN, 1.0); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* Main Loop + * Be certain you request an accumulation buffer. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB + | GLUT_ACCUM | GLUT_DEPTH); + glutInitWindowSize (250, 250); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init(); + glutReshapeFunc(reshape); + glutDisplayFunc(display); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/alpha.c b/xc/extras/Mesa/book/alpha.c new file mode 100644 index 000000000..6eeb45b96 --- /dev/null +++ b/xc/extras/Mesa/book/alpha.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * alpha.c + * This program draws several overlapping filled polygons + * to demonstrate the effect order has on alpha blending results. + * Use the 't' key to toggle the order of drawing polygons. + */ +#include <GL/glut.h> +#include <stdlib.h> + +static int leftFirst = GL_TRUE; + +/* Initialize alpha blending function. + */ +static void init(void) +{ + glEnable (GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glShadeModel (GL_FLAT); + glClearColor (0.0, 0.0, 0.0, 0.0); +} + +static void drawLeftTriangle(void) +{ + /* draw yellow triangle on LHS of screen */ + + glBegin (GL_TRIANGLES); + glColor4f(1.0, 1.0, 0.0, 0.75); + glVertex3f(0.1, 0.9, 0.0); + glVertex3f(0.1, 0.1, 0.0); + glVertex3f(0.7, 0.5, 0.0); + glEnd(); +} + +static void drawRightTriangle(void) +{ + /* draw cyan triangle on RHS of screen */ + + glBegin (GL_TRIANGLES); + glColor4f(0.0, 1.0, 1.0, 0.75); + glVertex3f(0.9, 0.9, 0.0); + glVertex3f(0.3, 0.5, 0.0); + glVertex3f(0.9, 0.1, 0.0); + glEnd(); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + if (leftFirst) { + drawLeftTriangle(); + drawRightTriangle(); + } + else { + drawRightTriangle(); + drawLeftTriangle(); + } + + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); + else + gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 't': + case 'T': + leftFirst = !leftFirst; + glutPostRedisplay(); + break; + case 27: /* Escape key */ + exit(0); + break; + default: + break; + } +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (200, 200); + glutCreateWindow (argv[0]); + init(); + glutReshapeFunc (reshape); + glutKeyboardFunc (keyboard); + glutDisplayFunc (display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/alpha3D.c b/xc/extras/Mesa/book/alpha3D.c new file mode 100644 index 000000000..413836edd --- /dev/null +++ b/xc/extras/Mesa/book/alpha3D.c @@ -0,0 +1,175 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * alpha3D.c + * This program demonstrates how to intermix opaque and + * alpha blended polygons in the same scene, by using + * glDepthMask. Press the 'a' key to animate moving the + * transparent object through the opaque object. Press + * the 'r' key to reset the scene. + */ +#include <stdlib.h> +#include <stdio.h> +#include <GL/glut.h> + +#define MAXZ 8.0 +#define MINZ -8.0 +#define ZINC 0.4 + +static float solidZ = MAXZ; +static float transparentZ = MINZ; +static GLuint sphereList, cubeList; + +static void init(void) +{ + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 0.15 }; + GLfloat mat_shininess[] = { 100.0 }; + GLfloat position[] = { 0.5, 0.5, 1.0, 0.0 }; + + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + glLightfv(GL_LIGHT0, GL_POSITION, position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + + sphereList = glGenLists(1); + glNewList(sphereList, GL_COMPILE); + glutSolidSphere (0.4, 16, 16); + glEndList(); + + cubeList = glGenLists(1); + glNewList(cubeList, GL_COMPILE); + glutSolidCube (0.6); + glEndList(); +} + +void display(void) +{ + GLfloat mat_solid[] = { 0.75, 0.75, 0.0, 1.0 }; + GLfloat mat_zero[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat mat_transparent[] = { 0.0, 0.8, 0.8, 0.6 }; + GLfloat mat_emission[] = { 0.0, 0.3, 0.3, 0.6 }; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glTranslatef (-0.15, -0.15, solidZ); + glMaterialfv(GL_FRONT, GL_EMISSION, mat_zero); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_solid); + glCallList (sphereList); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.15, 0.15, transparentZ); + glRotatef (15.0, 1.0, 1.0, 0.0); + glRotatef (30.0, 0.0, 1.0, 0.0); + glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_transparent); + glEnable (GL_BLEND); + glDepthMask (GL_FALSE); + glBlendFunc (GL_SRC_ALPHA, GL_ONE); + glCallList (cubeList); + glDepthMask (GL_TRUE); + glDisable (GL_BLEND); + glPopMatrix (); + + glutSwapBuffers(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLint) w, (GLint) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w, + 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-1.5*(GLfloat)w/(GLfloat)h, + 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void animate(void) +{ + if (solidZ <= MINZ || transparentZ >= MAXZ) + glutIdleFunc(NULL); + else { + solidZ -= ZINC; + transparentZ += ZINC; + glutPostRedisplay(); + } +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 'a': + case 'A': + solidZ = MAXZ; + transparentZ = MINZ; + glutIdleFunc(animate); + break; + case 'r': + case 'R': + solidZ = MAXZ; + transparentZ = MINZ; + glutPostRedisplay(); + break; + case 27: + exit(0); + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(500, 500); + glutCreateWindow(argv[0]); + init(); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutDisplayFunc(display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/anti.c b/xc/extras/Mesa/book/anti.c new file mode 100644 index 000000000..9eab0bc35 --- /dev/null +++ b/xc/extras/Mesa/book/anti.c @@ -0,0 +1,124 @@ + +/* 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. + */ +/* + * anti.c + * This program draws antialiased lines in RGBA mode. + */ +#include <stdlib.h> +#include <stdio.h> +#include <GL/glut.h> + +/* Initialize antialiasing for RGBA mode, including alpha + * blending, hint, and line width. Print out implementation + * specific info on line width granularity and width. + */ +void myinit(void) +{ + GLfloat values[2]; + glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values); + printf ("GL_LINE_WIDTH_GRANULARITY value is %3.1f\n", values[0]); + + glGetFloatv (GL_LINE_WIDTH_RANGE, values); + printf ("GL_LINE_WIDTH_RANGE values are %3.1f %3.1f\n", + values[0], values[1]); + + glEnable (GL_LINE_SMOOTH); + glEnable (GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + glLineWidth (1.5); + + glShadeModel(GL_FLAT); + glClearColor(0.0, 0.0, 0.0, 0.0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); +} + +/* display() draws an icosahedron with a large alpha value, 1.0. + */ +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glColor4f (1.0, 1.0, 1.0, 1.0); + glutWireIcosahedron(); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective (45.0, (GLfloat) w/(GLfloat) h, 3.0, 5.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity (); + glTranslatef (0.0, 0.0, -4.0); /* move object into view */ +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/bezcurve.c b/xc/extras/Mesa/book/bezcurve.c new file mode 100644 index 000000000..5dee44039 --- /dev/null +++ b/xc/extras/Mesa/book/bezcurve.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* bezcurve.c + * This program uses evaluators to draw a Bezier curve. + */ +#include <stdlib.h> +#include <GL/glut.h> + +GLfloat ctrlpoints[4][3] = { + { -4.0, -4.0, 0.0}, { -2.0, 4.0, 0.0}, + {2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}}; + +void init(void) +{ + glClearColor(0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]); + glEnable(GL_MAP1_VERTEX_3); +} + +void display(void) +{ + int i; + + glClear(GL_COLOR_BUFFER_BIT); + glColor3f(1.0, 1.0, 1.0); + glBegin(GL_LINE_STRIP); + for (i = 0; i <= 30; i++) + glEvalCoord1f((GLfloat) i/30.0); + glEnd(); + /* The following code displays the control points as dots. */ + glPointSize(5.0); + glColor3f(1.0, 1.0, 0.0); + glBegin(GL_POINTS); + for (i = 0; i < 4; i++) + glVertex3fv(&ctrlpoints[i][0]); + glEnd(); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(-5.0, 5.0, -5.0*(GLfloat)h/(GLfloat)w, + 5.0*(GLfloat)h/(GLfloat)w, -5.0, 5.0); + else + glOrtho(-5.0*(GLfloat)w/(GLfloat)h, + 5.0*(GLfloat)w/(GLfloat)h, -5.0, 5.0, -5.0, 5.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/bezmesh.c b/xc/extras/Mesa/book/bezmesh.c new file mode 100644 index 000000000..55e7e827f --- /dev/null +++ b/xc/extras/Mesa/book/bezmesh.c @@ -0,0 +1,162 @@ + +/* 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. + */ +/* bezsurf.c + * This program renders a lighted, filled Bezier surface, + * using two-dimensional evaluators. + */ +#include <stdlib.h> +#include <GL/glut.h> + +GLfloat ctrlpoints[4][4][3] = +{ + { + {-1.5, -1.5, 4.0}, + {-0.5, -1.5, 2.0}, + {0.5, -1.5, -1.0}, + {1.5, -1.5, 2.0}}, + { + {-1.5, -0.5, 1.0}, + {-0.5, -0.5, 3.0}, + {0.5, -0.5, 0.0}, + {1.5, -0.5, -1.0}}, + { + {-1.5, 0.5, 4.0}, + {-0.5, 0.5, 0.0}, + {0.5, 0.5, 3.0}, + {1.5, 0.5, 4.0}}, + { + {-1.5, 1.5, -2.0}, + {-0.5, 1.5, -2.0}, + {0.5, 1.5, 0.0}, + {1.5, 1.5, -1.0}} +}; + +void +initlights(void) +{ + GLfloat ambient[] = + {0.2, 0.2, 0.2, 1.0}; + GLfloat position[] = + {0.0, 0.0, 2.0, 1.0}; + GLfloat mat_diffuse[] = + {0.6, 0.6, 0.6, 1.0}; + GLfloat mat_specular[] = + {1.0, 1.0, 1.0, 1.0}; + GLfloat mat_shininess[] = + {50.0}; + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_POSITION, position); + + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); +} + +void +display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix(); + glRotatef(85.0, 1.0, 1.0, 1.0); + glEvalMesh2(GL_FILL, 0, 20, 0, 20); + glPopMatrix(); + glFlush(); +} + +void +myinit(void) +{ + glClearColor(0.0, 0.0, 0.0, 1.0); + glEnable(GL_DEPTH_TEST); + glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, + 0, 1, 12, 4, &ctrlpoints[0][0][0]); + glEnable(GL_MAP2_VERTEX_3); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0); + initlights(); /* for lighted version only */ +} + +void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(-4.0, 4.0, -4.0 * (GLfloat) h / (GLfloat) w, + 4.0 * (GLfloat) h / (GLfloat) w, -4.0, 4.0); + else + glOrtho(-4.0 * (GLfloat) w / (GLfloat) h, + 4.0 * (GLfloat) w / (GLfloat) h, -4.0, 4.0, -4.0, 4.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/checker.c b/xc/extras/Mesa/book/checker.c new file mode 100644 index 000000000..4b7695237 --- /dev/null +++ b/xc/extras/Mesa/book/checker.c @@ -0,0 +1,139 @@ + +/* 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. + */ +/* checker.c + * This program texture maps a checkerboard image onto + * two rectangles. This program clamps the texture, if + * the texture coordinates fall outside 0.0 and 1.0. + */ +#include <GL/glut.h> + +/* Create checkerboard texture */ +#define checkImageWidth 64 +#define checkImageHeight 64 +GLubyte checkImage[checkImageWidth][checkImageHeight][3]; + +void makeCheckImage(void) +{ + int i, j, c; + + for (i = 0; i < checkImageWidth; i++) { + for (j = 0; j < checkImageHeight; j++) { + c = ((((i&0x8)==0)^((j&0x8)==0)))*255; + checkImage[i][j][0] = (GLubyte) c; + checkImage[i][j][1] = (GLubyte) c; + checkImage[i][j][2] = (GLubyte) c; + } + } +} + +void myinit(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + + makeCheckImage(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, 3, checkImageWidth, + checkImageHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, + &checkImage[0][0][0]); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glEnable(GL_TEXTURE_2D); + glShadeModel(GL_FLAT); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(1.0, 1.0); glVertex3f(0.0, 1.0, 0.0); + glTexCoord2f(1.0, 0.0); glVertex3f(0.0, -1.0, 0.0); + + glTexCoord2f(0.0, 0.0); glVertex3f(1.0, -1.0, 0.0); + glTexCoord2f(0.0, 1.0); glVertex3f(1.0, 1.0, 0.0); + glTexCoord2f(1.0, 1.0); glVertex3f(2.41421, 1.0, -1.41421); + glTexCoord2f(1.0, 0.0); glVertex3f(2.41421, -1.0, -1.41421); + glEnd(); + glutSwapBuffers(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -3.6); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +int +main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow("checker"); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/clip.c b/xc/extras/Mesa/book/clip.c new file mode 100644 index 000000000..90816f2e2 --- /dev/null +++ b/xc/extras/Mesa/book/clip.c @@ -0,0 +1,108 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * clip.c + * This program demonstrates arbitrary clipping planes. + */ +#include <GL/glut.h> +#include <stdlib.h> + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void display(void) +{ + GLdouble eqn[4] = {0.0, 1.0, 0.0, 0.0}; + GLdouble eqn2[4] = {1.0, 0.0, 0.0, 0.0}; + + glClear(GL_COLOR_BUFFER_BIT); + + glColor3f (1.0, 1.0, 1.0); + glPushMatrix(); + glTranslatef (0.0, 0.0, -5.0); + +/* clip lower half -- y < 0 */ + glClipPlane (GL_CLIP_PLANE0, eqn); + glEnable (GL_CLIP_PLANE0); +/* clip left half -- x < 0 */ + glClipPlane (GL_CLIP_PLANE1, eqn2); + glEnable (GL_CLIP_PLANE1); + + glRotatef (90.0, 1.0, 0.0, 0.0); + glutWireSphere(1.0, 20, 16); + glPopMatrix(); + + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0); + glMatrixMode (GL_MODELVIEW); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/colormat.c b/xc/extras/Mesa/book/colormat.c new file mode 100644 index 000000000..9db4491ba --- /dev/null +++ b/xc/extras/Mesa/book/colormat.c @@ -0,0 +1,153 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * colormat.c + * After initialization, the program will be in + * ColorMaterial mode. Interaction: pressing the + * mouse buttons will change the diffuse reflection values. + */ +#include <GL/glut.h> +#include <stdlib.h> + +GLfloat diffuseMaterial[4] = { 0.5, 0.5, 0.5, 1.0 }; + +/* Initialize material property, light source, lighting model, + * and depth buffer. + */ +void init(void) +{ + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseMaterial); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialf(GL_FRONT, GL_SHININESS, 25.0); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glColorMaterial(GL_FRONT, GL_DIFFUSE); + glEnable(GL_COLOR_MATERIAL); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glutSolidSphere(1.0, 20, 16); + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w, + 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-1.5*(GLfloat)w/(GLfloat)h, + 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED2 */ +void mouse(int button, int state, int x, int y) +{ + switch (button) { + case GLUT_LEFT_BUTTON: + if (state == GLUT_DOWN) { + diffuseMaterial[0] += 0.1; + if (diffuseMaterial[0] > 1.0) + diffuseMaterial[0] = 0.0; + glColor4fv(diffuseMaterial); + glutPostRedisplay(); + } + break; + case GLUT_MIDDLE_BUTTON: + if (state == GLUT_DOWN) { + diffuseMaterial[1] += 0.1; + if (diffuseMaterial[1] > 1.0) + diffuseMaterial[1] = 0.0; + glColor4fv(diffuseMaterial); + glutPostRedisplay(); + } + break; + case GLUT_RIGHT_BUTTON: + if (state == GLUT_DOWN) { + diffuseMaterial[2] += 0.1; + if (diffuseMaterial[2] > 1.0) + diffuseMaterial[2] = 0.0; + glColor4fv(diffuseMaterial); + glutPostRedisplay(); + } + break; + default: + break; + } +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutMouseFunc(mouse); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/cube.c b/xc/extras/Mesa/book/cube.c new file mode 100644 index 000000000..5ecc6280f --- /dev/null +++ b/xc/extras/Mesa/book/cube.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * cube.c + * This program demonstrates a single modeling transformation, + * glScalef() and a single viewing transformation, gluLookAt(). + * A wireframe cube is rendered. + */ +#include <GL/glut.h> +#include <stdlib.h> + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT); + glColor3f (1.0, 1.0, 1.0); + glLoadIdentity (); /* clear the matrix */ + /* viewing transformation */ + gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); + glScalef (1.0, 2.0, 1.0); /* modeling transformation */ + glutWireCube (1.0); + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0); + glMatrixMode (GL_MODELVIEW); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/depthcue.c b/xc/extras/Mesa/book/depthcue.c new file mode 100644 index 000000000..a3e5b743a --- /dev/null +++ b/xc/extras/Mesa/book/depthcue.c @@ -0,0 +1,115 @@ + +/* 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. + */ +/* + * depthcue.c + * This program draws a wireframe model, which uses + * intensity (brightness) to give clues to distance. + * Fog is used to achieve this effect. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize linear fog for depth cueing. + */ +void myinit(void) +{ + GLfloat fogColor[4] = {0.0, 0.0, 0.0, 1.0}; + + glEnable(GL_FOG); + glFogi (GL_FOG_MODE, GL_LINEAR); + glHint (GL_FOG_HINT, GL_NICEST); /* per pixel */ + glFogf (GL_FOG_START, 3.0); + glFogf (GL_FOG_END, 5.0); + glFogfv (GL_FOG_COLOR, fogColor); + glClearColor(0.0, 0.0, 0.0, 1.0); + + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glShadeModel(GL_FLAT); +} + +/* display() draws an icosahedron. + */ +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glColor3f (1.0, 1.0, 1.0); + glutWireIcosahedron(); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective (45.0, (GLfloat) w/(GLfloat) h, 3.0, 5.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity (); + glTranslatef (0.0, 0.0, -4.0); /* move object into view */ +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/dof.c b/xc/extras/Mesa/book/dof.c new file mode 100644 index 000000000..6673dc2d5 --- /dev/null +++ b/xc/extras/Mesa/book/dof.c @@ -0,0 +1,251 @@ + +/* 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. + */ +/* + * dof.c + * This program demonstrates use of the accumulation buffer to + * create an out-of-focus depth-of-field effect. The teapots + * are drawn several times into the accumulation buffer. The + * viewing volume is jittered, except at the focal point, where + * the viewing volume is at the same position, each time. In + * this case, the gold teapot remains in focus. + */ +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> +#include "jitter.h" + +#define PI_ 3.14159265358979323846 + +/* accFrustum() + * The first 6 arguments are identical to the glFrustum() call. + * + * pixdx and pixdy are anti-alias jitter in pixels. + * Set both equal to 0.0 for no anti-alias jitter. + * eyedx and eyedy are depth-of field jitter in pixels. + * Set both equal to 0.0 for no depth of field effects. + * + * focus is distance from eye to plane in focus. + * focus must be greater than, but not equal to 0.0. + * + * Note that accFrustum() calls glTranslatef(). You will + * probably want to insure that your ModelView matrix has been + * initialized to identity before calling accFrustum(). + */ +void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx, + GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus) +{ + GLdouble xwsize, ywsize; + GLdouble dx, dy; + GLint viewport[4]; + + glGetIntegerv (GL_VIEWPORT, viewport); + + xwsize = right - left; + ywsize = top - bottom; + + dx = -(pixdx*xwsize/(GLdouble) viewport[2] + eyedx*nnear/focus); + dy = -(pixdy*ywsize/(GLdouble) viewport[3] + eyedy*nnear/focus); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum (left + dx, right + dx, bottom + dy, top + dy, nnear, ffar); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef (-eyedx, -eyedy, 0.0); +} + +/* accPerspective() + * + * The first 4 arguments are identical to the gluPerspective() call. + * pixdx and pixdy are anti-alias jitter in pixels. + * Set both equal to 0.0 for no anti-alias jitter. + * eyedx and eyedy are depth-of field jitter in pixels. + * Set both equal to 0.0 for no depth of field effects. + * + * focus is distance from eye to plane in focus. + * focus must be greater than, but not equal to 0.0. + * + * Note that accPerspective() calls accFrustum(). + */ +void accPerspective(GLdouble fovy, GLdouble aspect, + GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy, + GLdouble eyedx, GLdouble eyedy, GLdouble focus) +{ + GLdouble fov2,left,right,bottom,top; + + fov2 = ((fovy*PI_) / 180.0) / 2.0; + + top = nnear / (cos(fov2) / sin(fov2)); + bottom = -top; + + right = top * aspect; + left = -right; + + accFrustum (left, right, bottom, top, nnear, ffar, + pixdx, pixdy, eyedx, eyedy, focus); +} + +void myinit(void) +{ + GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat position[] = { 0.0, 3.0, 3.0, 0.0 }; + + GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; + GLfloat local_view[] = { 0.0 }; + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); + + glFrontFace (GL_CW); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearAccum(0.0, 0.0, 0.0, 0.0); +} + +void renderTeapot (GLfloat x, GLfloat y, GLfloat z, + GLfloat ambr, GLfloat ambg, GLfloat ambb, + GLfloat difr, GLfloat difg, GLfloat difb, + GLfloat specr, GLfloat specg, GLfloat specb, GLfloat shine) +{ + float mat[4]; + + glPushMatrix(); + glTranslatef (x, y, z); + mat[0] = ambr; mat[1] = ambg; mat[2] = ambb; mat[3] = 1.0; + glMaterialfv (GL_FRONT, GL_AMBIENT, mat); + mat[0] = difr; mat[1] = difg; mat[2] = difb; + glMaterialfv (GL_FRONT, GL_DIFFUSE, mat); + mat[0] = specr; mat[1] = specg; mat[2] = specb; + glMaterialfv (GL_FRONT, GL_SPECULAR, mat); + glMaterialf (GL_FRONT, GL_SHININESS, shine*128.0); + glutSolidTeapot(0.5); + glPopMatrix(); +} + +/* display() draws 5 teapots into the accumulation buffer + * several times; each time with a jittered perspective. + * The focal point is at z = 5.0, so the gold teapot will + * stay in focus. The amount of jitter is adjusted by the + * magnitude of the accPerspective() jitter; in this example, 0.33. + * In this example, the teapots are drawn 8 times. See jitter.h + */ +void display(void) +{ + int jitter; + GLint viewport[4]; + + glGetIntegerv (GL_VIEWPORT, viewport); + glClear(GL_ACCUM_BUFFER_BIT); + + for (jitter = 0; jitter < 8; jitter++) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + accPerspective (45.0, + (GLdouble) viewport[2]/(GLdouble) viewport[3], + 1.0, 15.0, 0.0, 0.0, + 0.33*j8[jitter].x, 0.33*j8[jitter].y, 5.0); +/* ruby, gold, silver, emerald, and cyan teapots */ + renderTeapot (-1.1, -0.5, -4.5, 0.1745, 0.01175, 0.01175, + 0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 0.6); + renderTeapot (-0.5, -0.5, -5.0, 0.24725, 0.1995, 0.0745, + 0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4); + renderTeapot (0.2, -0.5, -5.5, 0.19225, 0.19225, 0.19225, + 0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4); + renderTeapot (1.0, -0.5, -6.0, 0.0215, 0.1745, 0.0215, + 0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6); + renderTeapot (1.8, -0.5, -6.5, 0.0, 0.1, 0.06, 0.0, 0.50980392, + 0.50980392, 0.50196078, 0.50196078, 0.50196078, .25); + glAccum (GL_ACCUM, 0.125); + } + + glAccum (GL_RETURN, 1.0); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, depth buffer, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB + | GLUT_ACCUM | GLUT_DEPTH); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/double.c b/xc/extras/Mesa/book/double.c new file mode 100644 index 000000000..a41229d12 --- /dev/null +++ b/xc/extras/Mesa/book/double.c @@ -0,0 +1,133 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * double.c + * This is a simple double buffered program. + * Pressing the left mouse button rotates the rectangle. + * Pressing the middle mouse button stops the rotation. + */ +#include <GL/glut.h> +#include <stdlib.h> + +static GLfloat spin = 0.0; + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glPushMatrix(); + glRotatef(spin, 0.0, 0.0, 1.0); + glColor3f(1.0, 1.0, 1.0); + glRectf(-25.0, -25.0, 25.0, 25.0); + glPopMatrix(); + + glutSwapBuffers(); +} + +void spinDisplay(void) +{ + spin = spin + 2.0; + if (spin > 360.0) + spin = spin - 360.0; + glutPostRedisplay(); +} + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void reshape(int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED2 */ +void mouse(int button, int state, int x, int y) +{ + switch (button) { + case GLUT_LEFT_BUTTON: + if (state == GLUT_DOWN) + glutIdleFunc(spinDisplay); + break; + case GLUT_MIDDLE_BUTTON: + if (state == GLUT_DOWN) + glutIdleFunc(NULL); + break; + default: + break; + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* + * Request double buffer display mode. + * Register mouse input callback functions + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); + glutInitWindowSize (250, 250); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutMouseFunc(mouse); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/drawf.c b/xc/extras/Mesa/book/drawf.c new file mode 100644 index 000000000..5bcccb6ae --- /dev/null +++ b/xc/extras/Mesa/book/drawf.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * drawf.c + * Draws the bitmapped letter F on the screen (several times). + * This demonstrates use of the glBitmap() call. + */ +#include <GL/glut.h> +#include <stdlib.h> + +GLubyte rasters[24] = { + 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, + 0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, + 0xff, 0xc0, 0xff, 0xc0}; + +void init(void) +{ + glPixelStorei (GL_UNPACK_ALIGNMENT, 1); + glClearColor (0.0, 0.0, 0.0, 0.0); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glColor3f (1.0, 1.0, 1.0); + glRasterPos2i (20, 20); + glBitmap (10, 12, 0.0, 0.0, 11.0, 0.0, rasters); + glBitmap (10, 12, 0.0, 0.0, 11.0, 0.0, rasters); + glBitmap (10, 12, 0.0, 0.0, 11.0, 0.0, rasters); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho (0, w, 0, h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + } +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(100, 100); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + init(); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutDisplayFunc(display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/feedback.c b/xc/extras/Mesa/book/feedback.c new file mode 100644 index 000000000..4981854d9 --- /dev/null +++ b/xc/extras/Mesa/book/feedback.c @@ -0,0 +1,171 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * feedback.c + * This program demonstrates use of OpenGL feedback. First, + * a lighting environment is set up and a few lines are drawn. + * Then feedback mode is entered, and the same lines are + * drawn. The results in the feedback buffer are printed. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +/* Initialize lighting. + */ +void init(void) +{ + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); +} + +/* Draw a few lines and two points, one of which will + * be clipped. If in feedback mode, a passthrough token + * is issued between the each primitive. + */ +void drawGeometry (GLenum mode) +{ + glBegin (GL_LINE_STRIP); + glNormal3f (0.0, 0.0, 1.0); + glVertex3f (30.0, 30.0, 0.0); + glVertex3f (50.0, 60.0, 0.0); + glVertex3f (70.0, 40.0, 0.0); + glEnd (); + if (mode == GL_FEEDBACK) + glPassThrough (1.0); + glBegin (GL_POINTS); + glVertex3f (-100.0, -100.0, -100.0); /* will be clipped */ + glEnd (); + if (mode == GL_FEEDBACK) + glPassThrough (2.0); + glBegin (GL_POINTS); + glNormal3f (0.0, 0.0, 1.0); + glVertex3f (50.0, 50.0, 0.0); + glEnd (); +} + +/* Write contents of one vertex to stdout. */ +void print3DcolorVertex (GLint size, GLint *count, + GLfloat *buffer) +{ + int i; + + printf (" "); + for (i = 0; i < 7; i++) { + printf ("%4.2f ", buffer[size-(*count)]); + *count = *count - 1; + } + printf ("\n"); +} + +/* Write contents of entire buffer. (Parse tokens!) */ +void printBuffer(GLint size, GLfloat *buffer) +{ + GLint count; + GLfloat token; + + count = size; + while (count) { + token = buffer[size-count]; count--; + if (token == GL_PASS_THROUGH_TOKEN) { + printf ("GL_PASS_THROUGH_TOKEN\n"); + printf (" %4.2f\n", buffer[size-count]); + count--; + } + else if (token == GL_POINT_TOKEN) { + printf ("GL_POINT_TOKEN\n"); + print3DcolorVertex (size, &count, buffer); + } + else if (token == GL_LINE_TOKEN) { + printf ("GL_LINE_TOKEN\n"); + print3DcolorVertex (size, &count, buffer); + print3DcolorVertex (size, &count, buffer); + } + else if (token == GL_LINE_RESET_TOKEN) { + printf ("GL_LINE_RESET_TOKEN\n"); + print3DcolorVertex (size, &count, buffer); + print3DcolorVertex (size, &count, buffer); + } + } +} + +void display(void) +{ + GLfloat feedBuffer[1024]; + GLint size; + + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + glOrtho (0.0, 100.0, 0.0, 100.0, 0.0, 1.0); + + glClearColor (0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + drawGeometry (GL_RENDER); + + glFeedbackBuffer (1024, GL_3D_COLOR, feedBuffer); + (void) glRenderMode (GL_FEEDBACK); + drawGeometry (GL_FEEDBACK); + + size = glRenderMode (GL_RENDER); + printBuffer (size, feedBuffer); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* Main Loop */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (100, 100); + glutInitWindowPosition (100, 100); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/fog.c b/xc/extras/Mesa/book/fog.c new file mode 100644 index 000000000..888ee138a --- /dev/null +++ b/xc/extras/Mesa/book/fog.c @@ -0,0 +1,200 @@ + +/* 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. + */ +/* + * fog.c + * This program draws 5 red teapots, each at a different + * z distance from the eye, in different types of fog. + * Pressing the left mouse button chooses between 3 types of + * fog: exponential, exponential squared, and linear. + * In this program, there is a fixed density value, as well + * as fixed start and end values for the linear fog. + */ +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + +GLint fogMode; + +void +selectFog(int mode) +{ + switch(mode) { + case GL_LINEAR: + glFogf(GL_FOG_START, 1.0); + glFogf(GL_FOG_END, 5.0); + /* falls through */ + case GL_EXP2: + case GL_EXP: + glFogi(GL_FOG_MODE, mode); + glutPostRedisplay(); + break; + case 0: + exit(0); + } +} + +/* Initialize z-buffer, projection matrix, light source, + * and lighting model. Do not specify a material property here. + */ +void +myinit(void) +{ + GLfloat position[] = + {0.0, 3.0, 3.0, 0.0}; + GLfloat local_view[] = + {0.0}; + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); + + glFrontFace(GL_CW); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + glEnable(GL_FOG); + { + GLfloat fogColor[4] = + {0.5, 0.5, 0.5, 1.0}; + + fogMode = GL_EXP; + glFogi(GL_FOG_MODE, fogMode); + glFogfv(GL_FOG_COLOR, fogColor); + glFogf(GL_FOG_DENSITY, 0.35); + glHint(GL_FOG_HINT, GL_DONT_CARE); + glClearColor(0.5, 0.5, 0.5, 1.0); + } +} + +void +renderRedTeapot(GLfloat x, GLfloat y, GLfloat z) +{ + float mat[4]; + + glPushMatrix(); + glTranslatef(x, y, z); + mat[0] = 0.1745; + mat[1] = 0.01175; + mat[2] = 0.01175; + mat[3] = 1.0; + glMaterialfv(GL_FRONT, GL_AMBIENT, mat); + mat[0] = 0.61424; + mat[1] = 0.04136; + mat[2] = 0.04136; + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat); + mat[0] = 0.727811; + mat[1] = 0.626959; + mat[2] = 0.626959; + glMaterialfv(GL_FRONT, GL_SPECULAR, mat); + glMaterialf(GL_FRONT, GL_SHININESS, 0.6 * 128.0); + glutSolidTeapot(1.0); + glPopMatrix(); +} + +/* display() draws 5 teapots at different z positions. + */ +void +display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + renderRedTeapot(-4.0, -0.5, -1.0); + renderRedTeapot(-2.0, -0.5, -2.0); + renderRedTeapot(0.0, -0.5, -3.0); + renderRedTeapot(2.0, -0.5, -4.0); + renderRedTeapot(4.0, -0.5, -5.0); + glFlush(); +} + +void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= (h * 3)) + glOrtho(-6.0, 6.0, -2.0 * ((GLfloat) h * 3) / (GLfloat) w, + 2.0 * ((GLfloat) h * 3) / (GLfloat) w, 0.0, 10.0); + else + glOrtho(-6.0 * (GLfloat) w / ((GLfloat) h * 3), + 6.0 * (GLfloat) w / ((GLfloat) h * 3), -2.0, 2.0, 0.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, depth buffer, and handle input events. + */ +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(450, 150); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutCreateMenu(selectFog); + glutAddMenuEntry("Fog EXP", GL_EXP); + glutAddMenuEntry("Fog EXP2", GL_EXP2); + glutAddMenuEntry("Fog LINEAR", GL_LINEAR); + glutAddMenuEntry("Quit", 0); + glutAttachMenu(GLUT_RIGHT_BUTTON); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/fogindex.c b/xc/extras/Mesa/book/fogindex.c new file mode 100644 index 000000000..b8bb691e2 --- /dev/null +++ b/xc/extras/Mesa/book/fogindex.c @@ -0,0 +1,152 @@ + +/* 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. + */ +/* + * fogindex.c + * This program demonstrates fog in color index mode. + * Three cones are drawn at different z values in a linear + * fog. 32 contiguous colors (from 16 to 47) are loaded + * with a color ramp. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize color map and fog. Set screen clear color + * to end of color ramp. + */ +#define NUM_COLORS 32 +#define RAMPSTART 16 + +void +myinit(void) +{ + int i; + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + for (i = 0; i < NUM_COLORS; i++) { + GLfloat shade; + shade = (GLfloat) (NUM_COLORS - i) / (GLfloat) NUM_COLORS; + glutSetColor(16 + i, shade, shade, shade); + } + glEnable(GL_FOG); + + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogi(GL_FOG_INDEX, NUM_COLORS); + glFogf(GL_FOG_START, 0.0); + glFogf(GL_FOG_END, 4.0); + glHint(GL_FOG_HINT, GL_NICEST); + glClearIndex((GLfloat) (NUM_COLORS + RAMPSTART - 1)); +} + +/* display() renders 3 cones at different z positions. + */ +void +display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix(); + glTranslatef(-1.0, -1.0, -1.0); + glRotatef(-90.0, 1.0, 0.0, 0.0); + glIndexi(RAMPSTART); + glutSolidCone(1.0, 2.0, 10, 10); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(0.0, -1.0, -2.25); + glRotatef(-90.0, 1.0, 0.0, 0.0); + glIndexi(RAMPSTART); + glutSolidCone(1.0, 2.0, 10, 10); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(1.0, -1.0, -3.5); + glRotatef(-90.0, 1.0, 0.0, 0.0); + glIndexi(RAMPSTART); + glutSolidCone(1.0, 2.0, 10, 10); + glPopMatrix(); + glFlush(); +} + +void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(-2.0, 2.0, -2.0 * (GLfloat) h / (GLfloat) w, + 2.0 * (GLfloat) h / (GLfloat) w, 0.0, 10.0); + else + glOrtho(-2.0 * (GLfloat) w / (GLfloat) h, + 2.0 * (GLfloat) w / (GLfloat) h, -2.0, 2.0, 0.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, depth buffer, and handle input events. + */ +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_INDEX | GLUT_DEPTH); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/font.c b/xc/extras/Mesa/book/font.c new file mode 100644 index 000000000..2d92e9b60 --- /dev/null +++ b/xc/extras/Mesa/book/font.c @@ -0,0 +1,167 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * font.c + * + * Draws some text in a bitmapped font. Uses glBitmap() + * and other pixel routines. Also demonstrates use of + * display lists. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <string.h> + +GLubyte space[] = +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +GLubyte letters[][13] = { +{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18}, +{0x00, 0x00, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe}, +{0x00, 0x00, 0x7e, 0xe7, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e}, +{0x00, 0x00, 0xfc, 0xce, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc7, 0xce, 0xfc}, +{0x00, 0x00, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xff}, +{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xff}, +{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xcf, 0xc0, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e}, +{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3}, +{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e}, +{0x00, 0x00, 0x7c, 0xee, 0xc6, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06}, +{0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc3}, +{0x00, 0x00, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}, +{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xff, 0xff, 0xe7, 0xc3}, +{0x00, 0x00, 0xc7, 0xc7, 0xcf, 0xcf, 0xdf, 0xdb, 0xfb, 0xf3, 0xf3, 0xe3, 0xe3}, +{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xe7, 0x7e}, +{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe}, +{0x00, 0x00, 0x3f, 0x6e, 0xdf, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c}, +{0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xd8, 0xf0, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe}, +{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0xe0, 0xc0, 0xc0, 0xe7, 0x7e}, +{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff}, +{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3}, +{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3}, +{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3}, +{0x00, 0x00, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3}, +{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3}, +{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff} +}; + +GLuint fontOffset; + +void makeRasterFont(void) +{ + GLuint i, j; + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + fontOffset = glGenLists (128); + for (i = 0,j = 'A'; i < 26; i++,j++) { + glNewList(fontOffset + j, GL_COMPILE); + glBitmap(8, 13, 0.0, 2.0, 10.0, 0.0, letters[i]); + glEndList(); + } + glNewList(fontOffset + ' ', GL_COMPILE); + glBitmap(8, 13, 0.0, 2.0, 10.0, 0.0, space); + glEndList(); +} + +void init(void) +{ + glShadeModel (GL_FLAT); + makeRasterFont(); +} + +void printString(char *s) +{ + glPushAttrib (GL_LIST_BIT); + glListBase(fontOffset); + glCallLists((GLsizei) strlen(s), GL_UNSIGNED_BYTE, (GLubyte *) s); + glPopAttrib (); +} + +/* Everything above this line could be in a library + * that defines a font. To make it work, you've got + * to call makeRasterFont() before you start making + * calls to printString(). + */ +void display(void) +{ + GLfloat white[3] = { 1.0, 1.0, 1.0 }; + + glClear(GL_COLOR_BUFFER_BIT); + glColor3fv(white); + + glRasterPos2i(20, 60); + printString("THE QUICK BROWN FOX JUMPS"); + glRasterPos2i(20, 40); + printString("OVER A LAZY DOG"); + glFlush (); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho (0.0, w, 0.0, h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + } +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(300, 100); + glutInitWindowPosition (100, 100); + glutCreateWindow(argv[0]); + init(); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutDisplayFunc(display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/hello.c b/xc/extras/Mesa/book/hello.c new file mode 100644 index 000000000..4f644a46a --- /dev/null +++ b/xc/extras/Mesa/book/hello.c @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * hello.c + * This is a simple, introductory OpenGL program. + */ +#include <GL/glut.h> + +void display(void) +{ +/* clear all pixels */ + glClear (GL_COLOR_BUFFER_BIT); + +/* draw white polygon (rectangle) with corners at + * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0) + */ + glColor3f (1.0, 1.0, 1.0); + glBegin(GL_POLYGON); + glVertex3f (0.25, 0.25, 0.0); + glVertex3f (0.75, 0.25, 0.0); + glVertex3f (0.75, 0.75, 0.0); + glVertex3f (0.25, 0.75, 0.0); + glEnd(); + +/* don't wait! + * start processing buffered OpenGL routines + */ + glFlush (); +} + +void init (void) +{ +/* select clearing color */ + glClearColor (0.0, 0.0, 0.0, 0.0); + +/* initialize viewing values */ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* + * Declare initial window size, position, and display mode + * (single buffer and RGBA). Open window with "hello" + * in its title bar. Call initialization routines. + * Register callback function to display graphics. + * Enter main loop and process events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (250, 250); + glutInitWindowPosition (100, 100); + glutCreateWindow ("hello"); + init (); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/image.c b/xc/extras/Mesa/book/image.c new file mode 100644 index 000000000..dc1a7246e --- /dev/null +++ b/xc/extras/Mesa/book/image.c @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* image.c + * This program demonstrates drawing pixels and shows the effect + * of glDrawPixels(), glCopyPixels(), and glPixelZoom(). + * Interaction: moving the mouse while pressing the mouse button + * will copy the image in the lower-left corner of the window + * to the mouse position, using the current pixel zoom factors. + * There is no attempt to prevent you from drawing over the original + * image. If you press the 'r' key, the original image and zoom + * factors are reset. If you press the 'z' or 'Z' keys, you change + * the zoom factors. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +/* Create checkerboard image */ +#define checkImageWidth 64 +#define checkImageHeight 64 +GLubyte checkImage[checkImageHeight][checkImageWidth][3]; + +static GLdouble zoomFactor = 1.0; +static GLint height; + +void makeCheckImage(void) +{ + int i, j, c; + + for (i = 0; i < checkImageHeight; i++) { + for (j = 0; j < checkImageWidth; j++) { + c = (((i&0x8)==0)^((j&0x8)==0))*255; + checkImage[i][j][0] = (GLubyte) c; + checkImage[i][j][1] = (GLubyte) c; + checkImage[i][j][2] = (GLubyte) c; + } + } +} + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + makeCheckImage(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glRasterPos2i(0, 0); + glDrawPixels(checkImageWidth, checkImageHeight, GL_RGB, + GL_UNSIGNED_BYTE, checkImage); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + height = (GLint) h; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0.0, (GLdouble) w, 0.0, (GLdouble) h); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void motion(int x, int y) +{ + static GLint screeny; + + screeny = height - (GLint) y; + glRasterPos2i (x, screeny); + glPixelZoom (zoomFactor, zoomFactor); + glCopyPixels (0, 0, checkImageWidth, checkImageHeight, GL_COLOR); + glPixelZoom (1.0, 1.0); + glFlush (); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 'r': + case 'R': + zoomFactor = 1.0; + glutPostRedisplay(); + printf ("zoomFactor reset to 1.0\n"); + break; + case 'z': + zoomFactor += 0.5; + if (zoomFactor >= 3.0) + zoomFactor = 3.0; + printf ("zoomFactor is now %4.1f\n", zoomFactor); + break; + case 'Z': + zoomFactor -= 0.5; + if (zoomFactor <= 0.5) + zoomFactor = 0.5; + printf ("zoomFactor is now %4.1f\n", zoomFactor); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(250, 250); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMotionFunc(motion); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/light.c b/xc/extras/Mesa/book/light.c new file mode 100644 index 000000000..0eed85e10 --- /dev/null +++ b/xc/extras/Mesa/book/light.c @@ -0,0 +1,113 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * light.c + * This program demonstrates the use of the OpenGL lighting + * model. A sphere is drawn using a grey material characteristic. + * A single light source illuminates the object. + */ +#include <GL/glut.h> +#include <stdlib.h> + +/* Initialize material property, light source, lighting model, + * and depth buffer. + */ +void init(void) +{ + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 50.0 }; + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_SMOOTH); + + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glutSolidSphere (1.0, 20, 16); + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w, + 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-1.5*(GLfloat)w/(GLfloat)h, + 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/lines.c b/xc/extras/Mesa/book/lines.c new file mode 100644 index 000000000..b34d4c418 --- /dev/null +++ b/xc/extras/Mesa/book/lines.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * lines.c + * This program demonstrates geometric primitives and + * their attributes. + */ +#include <GL/glut.h> +#include <stdlib.h> + +#define drawOneLine(x1,y1,x2,y2) glBegin(GL_LINES); \ + glVertex2f ((x1),(y1)); glVertex2f ((x2),(y2)); glEnd(); + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void display(void) +{ + int i; + + glClear (GL_COLOR_BUFFER_BIT); + +/* select white for all lines */ + glColor3f (1.0, 1.0, 1.0); + +/* in 1st row, 3 lines, each with a different stipple */ + glEnable (GL_LINE_STIPPLE); + + glLineStipple (1, 0x0101); /* dotted */ + drawOneLine (50.0, 125.0, 150.0, 125.0); + glLineStipple (1, 0x00FF); /* dashed */ + drawOneLine (150.0, 125.0, 250.0, 125.0); + glLineStipple (1, 0x1C47); /* dash/dot/dash */ + drawOneLine (250.0, 125.0, 350.0, 125.0); + +/* in 2nd row, 3 wide lines, each with different stipple */ + glLineWidth (5.0); + glLineStipple (1, 0x0101); /* dotted */ + drawOneLine (50.0, 100.0, 150.0, 100.0); + glLineStipple (1, 0x00FF); /* dashed */ + drawOneLine (150.0, 100.0, 250.0, 100.0); + glLineStipple (1, 0x1C47); /* dash/dot/dash */ + drawOneLine (250.0, 100.0, 350.0, 100.0); + glLineWidth (1.0); + +/* in 3rd row, 6 lines, with dash/dot/dash stipple */ +/* as part of a single connected line strip */ + glLineStipple (1, 0x1C47); /* dash/dot/dash */ + glBegin (GL_LINE_STRIP); + for (i = 0; i < 7; i++) + glVertex2f (50.0 + ((GLfloat) i * 50.0), 75.0); + glEnd (); + +/* in 4th row, 6 independent lines with same stipple */ + for (i = 0; i < 6; i++) { + drawOneLine (50.0 + ((GLfloat) i * 50.0), 50.0, + 50.0 + ((GLfloat)(i+1) * 50.0), 50.0); + } + +/* in 5th row, 1 line, with dash/dot/dash stipple */ +/* and a stipple repeat factor of 5 */ + glLineStipple (5, 0x1C47); /* dash/dot/dash */ + drawOneLine (50.0, 25.0, 350.0, 25.0); + + glDisable (GL_LINE_STIPPLE); + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (400, 150); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/list.c b/xc/extras/Mesa/book/list.c new file mode 100644 index 000000000..3b4f44bd6 --- /dev/null +++ b/xc/extras/Mesa/book/list.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * list.c + * This program demonstrates how to make and execute a + * display list. Note that attributes, such as current + * color and matrix, are changed. + */ +#include <GL/glut.h> +#include <stdlib.h> + +GLuint listName; + +static void init (void) +{ + listName = glGenLists (1); + glNewList (listName, GL_COMPILE); + glColor3f (1.0, 0.0, 0.0); /* current color red */ + glBegin (GL_TRIANGLES); + glVertex2f (0.0, 0.0); + glVertex2f (1.0, 0.0); + glVertex2f (0.0, 1.0); + glEnd (); + glTranslatef (1.5, 0.0, 0.0); /* move position */ + glEndList (); + glShadeModel (GL_FLAT); +} + +static void drawLine (void) +{ + glBegin (GL_LINES); + glVertex2f (0.0, 0.5); + glVertex2f (15.0, 0.5); + glEnd (); +} + +void display(void) +{ + GLuint i; + + glClear (GL_COLOR_BUFFER_BIT); + glColor3f (0.0, 1.0, 0.0); /* current color green */ + for (i = 0; i < 10; i++) /* draw 10 triangles */ + glCallList (listName); + drawLine (); /* is this line green? NO! */ + /* where is the line drawn? */ + glFlush (); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + gluOrtho2D (0.0, 2.0, -0.5 * (GLfloat) h/(GLfloat) w, + 1.5 * (GLfloat) h/(GLfloat) w); + else + gluOrtho2D (0.0, 2.0 * (GLfloat) w/(GLfloat) h, -0.5, 1.5); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(650, 50); + glutCreateWindow(argv[0]); + init (); + glutReshapeFunc (reshape); + glutDisplayFunc (display); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/material.c b/xc/extras/Mesa/book/material.c new file mode 100644 index 000000000..f9a4fc592 --- /dev/null +++ b/xc/extras/Mesa/book/material.c @@ -0,0 +1,306 @@ + +/* 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. + */ +/* + * material.c + * This program demonstrates the use of the GL lighting model. + * Several objects are drawn using different material characteristics. + * A single light source illuminates the objects. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize z-buffer, projection matrix, light source, + * and lighting model. Do not specify a material property here. + */ +void myinit(void) +{ + GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat position[] = { 0.0, 3.0, 2.0, 0.0 }; + GLfloat lmodel_ambient[] = { 0.4, 0.4, 0.4, 1.0 }; + GLfloat local_view[] = { 0.0 }; + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glClearColor(0.0, 0.1, 0.1, 0.0); +} + +/* Draw twelve spheres in 3 rows with 4 columns. + * The spheres in the first row have materials with no ambient reflection. + * The second row has materials with significant ambient reflection. + * The third row has materials with colored ambient reflection. + * + * The first column has materials with blue, diffuse reflection only. + * The second column has blue diffuse reflection, as well as specular + * reflection with a low shininess exponent. + * The third column has blue diffuse reflection, as well as specular + * reflection with a high shininess exponent (a more concentrated highlight). + * The fourth column has materials which also include an emissive component. + * + * glTranslatef() is used to move spheres to their appropriate locations. + */ + +void display(void) +{ + GLfloat no_mat[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat mat_ambient[] = { 0.7, 0.7, 0.7, 1.0 }; + GLfloat mat_ambient_color[] = { 0.8, 0.8, 0.2, 1.0 }; + GLfloat mat_diffuse[] = { 0.1, 0.5, 0.8, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat no_shininess[] = { 0.0 }; + GLfloat low_shininess[] = { 5.0 }; + GLfloat high_shininess[] = { 100.0 }; + GLfloat mat_emission[] = {0.3, 0.2, 0.2, 0.0}; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + +/* draw sphere in first row, first column + * diffuse reflection only; no ambient or specular + */ + glPushMatrix(); + glTranslatef (-3.75, 3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, no_mat); + glMaterialfv(GL_FRONT, GL_SHININESS, no_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in first row, second column + * diffuse and specular reflection; low shininess; no ambient + */ + glPushMatrix(); + glTranslatef (-1.25, 3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in first row, third column + * diffuse and specular reflection; high shininess; no ambient + */ + glPushMatrix(); + glTranslatef (1.25, 3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in first row, fourth column + * diffuse reflection; emission; no ambient or specular reflection + */ + glPushMatrix(); + glTranslatef (3.75, 3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, no_mat); + glMaterialfv(GL_FRONT, GL_SHININESS, no_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in second row, first column + * ambient and diffuse reflection; no specular + */ + glPushMatrix(); + glTranslatef (-3.75, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, no_mat); + glMaterialfv(GL_FRONT, GL_SHININESS, no_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in second row, second column + * ambient, diffuse and specular reflection; low shininess + */ + glPushMatrix(); + glTranslatef (-1.25, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in second row, third column + * ambient, diffuse and specular reflection; high shininess + */ + glPushMatrix(); + glTranslatef (1.25, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in second row, fourth column + * ambient and diffuse reflection; emission; no specular + */ + glPushMatrix(); + glTranslatef (3.75, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, no_mat); + glMaterialfv(GL_FRONT, GL_SHININESS, no_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in third row, first column + * colored ambient and diffuse reflection; no specular + */ + glPushMatrix(); + glTranslatef (-3.75, -3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient_color); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, no_mat); + glMaterialfv(GL_FRONT, GL_SHININESS, no_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in third row, second column + * colored ambient, diffuse and specular reflection; low shininess + */ + glPushMatrix(); + glTranslatef (-1.25, -3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient_color); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in third row, third column + * colored ambient, diffuse and specular reflection; high shininess + */ + glPushMatrix(); + glTranslatef (1.25, -3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient_color); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, no_mat); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + +/* draw sphere in third row, fourth column + * colored ambient and diffuse reflection; emission; no specular + */ + glPushMatrix(); + glTranslatef (3.75, -3.0, 0.0); + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient_color); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, no_mat); + glMaterialfv(GL_FRONT, GL_SHININESS, no_shininess); + glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission); + glutSolidSphere(1.0, 16, 16); + glPopMatrix(); + + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= (h * 2)) + glOrtho (-6.0, 6.0, -3.0*((GLfloat)h*2)/(GLfloat)w, + 3.0*((GLfloat)h*2)/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-6.0*(GLfloat)w/((GLfloat)h*2), + 6.0*(GLfloat)w/((GLfloat)h*2), -3.0, 3.0, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (600, 450); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/mipmap.c b/xc/extras/Mesa/book/mipmap.c new file mode 100644 index 000000000..d32dd725f --- /dev/null +++ b/xc/extras/Mesa/book/mipmap.c @@ -0,0 +1,178 @@ + +/* 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. + */ +/* mipmap.c + * This program demonstrates using mipmaps for texture maps. + * To overtly show the effect of mipmaps, each mipmap reduction + * level has a solidly colored, contrasting texture image. + * Thus, the quadrilateral which is drawn is drawn with several + * different colors. + */ +#include <stdlib.h> +#include <GL/glut.h> + +GLubyte mipmapImage32[32][32][3]; +GLubyte mipmapImage16[16][16][3]; +GLubyte mipmapImage8[8][8][3]; +GLubyte mipmapImage4[4][4][3]; +GLubyte mipmapImage2[2][2][3]; +GLubyte mipmapImage1[1][1][3]; + +void makeImages(void) +{ + int i, j; + + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + mipmapImage32[i][j][0] = 255; + mipmapImage32[i][j][1] = 255; + mipmapImage32[i][j][2] = 0; + } + } + for (i = 0; i < 16; i++) { + for (j = 0; j < 16; j++) { + mipmapImage16[i][j][0] = 255; + mipmapImage16[i][j][1] = 0; + mipmapImage16[i][j][2] = 255; + } + } + for (i = 0; i < 8; i++) { + for (j = 0; j < 8; j++) { + mipmapImage8[i][j][0] = 255; + mipmapImage8[i][j][1] = 0; + mipmapImage8[i][j][2] = 0; + } + } + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + mipmapImage4[i][j][0] = 0; + mipmapImage4[i][j][1] = 255; + mipmapImage4[i][j][2] = 0; + } + } + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { + mipmapImage2[i][j][0] = 0; + mipmapImage2[i][j][1] = 0; + mipmapImage2[i][j][2] = 255; + } + } + mipmapImage1[0][0][0] = 255; + mipmapImage1[0][0][1] = 255; + mipmapImage1[0][0][2] = 255; +} + +void myinit(void) +{ + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + glShadeModel(GL_FLAT); + + glTranslatef(0.0, 0.0, -3.6); + makeImages(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, 3, 32, 32, 0, + GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage32[0][0][0]); + glTexImage2D(GL_TEXTURE_2D, 1, 3, 16, 16, 0, + GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage16[0][0][0]); + glTexImage2D(GL_TEXTURE_2D, 2, 3, 8, 8, 0, + GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage8[0][0][0]); + glTexImage2D(GL_TEXTURE_2D, 3, 3, 4, 4, 0, + GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage4[0][0][0]); + glTexImage2D(GL_TEXTURE_2D, 4, 3, 2, 2, 0, + GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage2[0][0][0]); + glTexImage2D(GL_TEXTURE_2D, 5, 3, 1, 1, 0, + GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage1[0][0][0]); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST_MIPMAP_NEAREST); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glEnable(GL_TEXTURE_2D); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, 8.0); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(8.0, 8.0); glVertex3f(2000.0, 1.0, -6000.0); + glTexCoord2f(8.0, 0.0); glVertex3f(2000.0, -1.0, -6000.0); + glEnd(); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/model.c b/xc/extras/Mesa/book/model.c new file mode 100644 index 000000000..8411ef355 --- /dev/null +++ b/xc/extras/Mesa/book/model.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * model.c + * This program demonstrates modeling transformations + */ +#include <GL/glut.h> +#include <stdlib.h> + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void draw_triangle(void) +{ + glBegin (GL_LINE_LOOP); + glVertex2f(0.0, 25.0); + glVertex2f(25.0, -25.0); + glVertex2f(-25.0, -25.0); + glEnd(); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT); + glColor3f (1.0, 1.0, 1.0); + + glLoadIdentity (); + glColor3f (1.0, 1.0, 1.0); + draw_triangle (); + + glEnable (GL_LINE_STIPPLE); + glLineStipple (1, 0xF0F0); + glLoadIdentity (); + glTranslatef (-20.0, 0.0, 0.0); + draw_triangle (); + + glLineStipple (1, 0xF00F); + glLoadIdentity (); + glScalef (1.5, 0.5, 1.0); + draw_triangle (); + + glLineStipple (1, 0x8888); + glLoadIdentity (); + glRotatef (90.0, 0.0, 0.0, 1.0); + draw_triangle (); + glDisable (GL_LINE_STIPPLE); + + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + if (w <= h) + glOrtho (-50.0, 50.0, -50.0*(GLfloat)h/(GLfloat)w, + 50.0*(GLfloat)h/(GLfloat)w, -1.0, 1.0); + else + glOrtho (-50.0*(GLfloat)w/(GLfloat)h, + 50.0*(GLfloat)w/(GLfloat)h, -50.0, 50.0, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/movelight.c b/xc/extras/Mesa/book/movelight.c new file mode 100644 index 000000000..a108cad43 --- /dev/null +++ b/xc/extras/Mesa/book/movelight.c @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * movelight.c + * This program demonstrates when to issue lighting and + * transformation commands to render a model with a light + * which is moved by a modeling transformation (rotate or + * translate). The light position is reset after the modeling + * transformation is called. The eye position does not change. + * + * A sphere is drawn using a grey material characteristic. + * A single light source illuminates the object. + * + * Interaction: pressing the left mouse button alters + * the modeling transformation (x rotation) by 30 degrees. + * The scene is then redrawn with the light in a new position. + */ +#include <GL/glut.h> +#include <stdlib.h> + +static int spin = 0; + +/* Initialize material property, light source, lighting model, + * and depth buffer. + */ +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_SMOOTH); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); +} + +/* Here is where the light position is reset after the modeling + * transformation (glRotated) is called. This places the + * light at a new position in world coordinates. The cube + * represents the position of the light. + */ +void display(void) +{ + GLfloat position[] = { 0.0, 0.0, 1.5, 1.0 }; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix (); + gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); + + glPushMatrix (); + glRotated ((GLdouble) spin, 1.0, 0.0, 0.0); + glLightfv (GL_LIGHT0, GL_POSITION, position); + + glTranslated (0.0, 0.0, 1.5); + glDisable (GL_LIGHTING); + glColor3f (0.0, 1.0, 1.0); + glutWireCube (0.1); + glEnable (GL_LIGHTING); + glPopMatrix (); + + glutSolidTorus (0.275, 0.85, 8, 15); + glPopMatrix (); + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity(); + gluPerspective(40.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED2 */ +void mouse(int button, int state, int x, int y) +{ + switch (button) { + case GLUT_LEFT_BUTTON: + if (state == GLUT_DOWN) { + spin = (spin + 30) % 360; + glutPostRedisplay(); + } + break; + default: + break; + } +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutMouseFunc(mouse); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/nurbs.c b/xc/extras/Mesa/book/nurbs.c new file mode 100644 index 000000000..a7c6f0c69 --- /dev/null +++ b/xc/extras/Mesa/book/nurbs.c @@ -0,0 +1,190 @@ + +/* 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. + */ +/* + * nurbs.c + * This program shows a NURBS (Non-uniform rational B-splines) + * surface, shaped like a heart. + */ +#include <stdlib.h> +#include <GL/glut.h> + +#define S_NUMPOINTS 13 +#define S_ORDER 3 +#define S_NUMKNOTS (S_NUMPOINTS + S_ORDER) +#define T_NUMPOINTS 3 +#define T_ORDER 3 +#define T_NUMKNOTS (T_NUMPOINTS + T_ORDER) +#define SQRT2 1.41421356237309504880 + +/* initialized local data */ + +GLfloat sknots[S_NUMKNOTS] = + {-1.0, -1.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, + 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 9.0, 9.0}; +GLfloat tknots[T_NUMKNOTS] = {1.0, 1.0, 1.0, 2.0, 2.0, 2.0}; + +GLfloat ctlpoints[S_NUMPOINTS][T_NUMPOINTS][4] = { +{ {4.,2.,2.,1.},{4.,1.6,2.5,1.},{4.,2.,3.0,1.} }, +{ {5.,4.,2.,1.},{5.,4.,2.5,1.},{5.,4.,3.0,1.} }, +{ {6.,5.,2.,1.},{6.,5.,2.5,1.},{6.,5.,3.0,1.} }, +{ {SQRT2*6.,SQRT2*6.,SQRT2*2.,SQRT2}, + {SQRT2*6.,SQRT2*6.,SQRT2*2.5,SQRT2}, + {SQRT2*6.,SQRT2*6.,SQRT2*3.0,SQRT2} }, +{ {5.2,6.7,2.,1.},{5.2,6.7,2.5,1.},{5.2,6.7,3.0,1.} }, +{ {SQRT2*4.,SQRT2*6.,SQRT2*2.,SQRT2}, + {SQRT2*4.,SQRT2*6.,SQRT2*2.5,SQRT2}, + {SQRT2*4.,SQRT2*6.,SQRT2*3.0,SQRT2} }, +{ {4.,5.2,2.,1.},{4.,4.6,2.5,1.},{4.,5.2,3.0,1.} }, +{ {SQRT2*4.,SQRT2*6.,SQRT2*2.,SQRT2}, + {SQRT2*4.,SQRT2*6.,SQRT2*2.5,SQRT2}, + {SQRT2*4.,SQRT2*6.,SQRT2*3.0,SQRT2} }, +{ {2.8,6.7,2.,1.},{2.8,6.7,2.5,1.},{2.8,6.7,3.0,1.} }, +{ {SQRT2*2.,SQRT2*6.,SQRT2*2.,SQRT2}, + {SQRT2*2.,SQRT2*6.,SQRT2*2.5,SQRT2}, + {SQRT2*2.,SQRT2*6.,SQRT2*3.0,SQRT2} }, +{ {2.,5.,2.,1.},{2.,5.,2.5,1.},{2.,5.,3.0,1.} }, +{ {3.,4.,2.,1.},{3.,4.,2.5,1.},{3.,4.,3.0,1.} }, +{ {4.,2.,2.,1.},{4.,1.6,2.5,1.},{4.,2.,3.0,1.} } +}; + +GLUnurbsObj *theNurb; + +/* Initialize material property, light source, lighting model, + * and depth buffer. + */ +void myinit(void) +{ + GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_diffuse[] = { 1.0, 0.2, 1.0, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 50.0 }; + + GLfloat light0_position[] = { 1.0, 0.1, 1.0, 0.0 }; + GLfloat light1_position[] = { -1.0, 0.1, 1.0, 0.0 }; + + GLfloat lmodel_ambient[] = { 0.3, 0.3, 0.3, 1.0 }; + + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + glLightfv(GL_LIGHT0, GL_POSITION, light0_position); + glLightfv(GL_LIGHT1, GL_POSITION, light1_position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHT1); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glEnable(GL_AUTO_NORMAL); + + theNurb = gluNewNurbsRenderer(); + + gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 25.0); + gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glTranslatef (4., 4.5, 2.5); + glRotatef (220.0, 1., 0., 0.); + glRotatef (115.0, 0., 1., 0.); + glTranslatef (-4., -4.5, -2.5); + + gluBeginSurface(theNurb); + gluNurbsSurface(theNurb, + S_NUMKNOTS, sknots, + T_NUMKNOTS, tknots, + 4 * T_NUMPOINTS, + 4, + &ctlpoints[0][0][0], + S_ORDER, T_ORDER, + GL_MAP2_VERTEX_4); + gluEndSurface(theNurb); + + glPopMatrix(); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.5, 0.5, 0.8, 10.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt(7.0,4.5,4.0, 4.5,4.5,2.0, 6.0,-3.0,2.0); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/pickdepth.c b/xc/extras/Mesa/book/pickdepth.c new file mode 100644 index 000000000..4b95d245c --- /dev/null +++ b/xc/extras/Mesa/book/pickdepth.c @@ -0,0 +1,217 @@ + +/* 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. + */ +/* + * pickdepth.c + * Picking is demonstrated in this program. In + * rendering mode, three overlapping rectangles are + * drawn. When the left mouse button is pressed, + * selection mode is entered with the picking matrix. + * Rectangles which are drawn under the cursor position + * are "picked." Pay special attention to the depth + * value range, which is returned. + */ +#include <stdlib.h> +#include <stdio.h> +#include <GL/glut.h> + +void +myinit(void) +{ + glClearColor(0.0, 0.0, 0.0, 0.0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glShadeModel(GL_FLAT); + glDepthRange(0.0, 1.0); /* The default z mapping */ +} + +/* The three rectangles are drawn. In selection mode, + * each rectangle is given the same name. Note that + * each rectangle is drawn with a different z value. + */ +void +drawRects(GLenum mode) +{ + if (mode == GL_SELECT) + glLoadName(1); + glBegin(GL_QUADS); + glColor3f(1.0, 1.0, 0.0); + glVertex3i(2, 0, 0); + glVertex3i(2, 6, 0); + glVertex3i(6, 6, 0); + glVertex3i(6, 0, 0); + glEnd(); + if (mode == GL_SELECT) + glLoadName(2); + glBegin(GL_QUADS); + glColor3f(0.0, 1.0, 1.0); + glVertex3i(3, 2, -1); + glVertex3i(3, 8, -1); + glVertex3i(8, 8, -1); + glVertex3i(8, 2, -1); + glEnd(); + if (mode == GL_SELECT) + glLoadName(3); + glBegin(GL_QUADS); + glColor3f(1.0, 0.0, 1.0); + glVertex3i(0, 2, -2); + glVertex3i(0, 7, -2); + glVertex3i(5, 7, -2); + glVertex3i(5, 2, -2); + glEnd(); +} + +/* processHits() prints out the contents of the + * selection array. + */ +void +processHits(GLint hits, GLuint buffer[]) +{ + unsigned int i, j; + GLuint names, *ptr; + + printf("hits = %d\n", hits); + ptr = (GLuint *) buffer; + for (i = 0; i < hits; i++) { /* for each hit */ + names = *ptr; + printf(" number of names for hit = %d\n", names); + ptr++; + printf(" z1 is %g;", (float) *ptr/0xffffffff); + ptr++; + printf(" z2 is %g\n", (float) *ptr/0xffffffff); + ptr++; + printf(" the name is "); + for (j = 0; j < names; j++) { /* for each name */ + printf("%d ", *ptr); + ptr++; + } + printf("\n"); + } +} + +/* pickRects() sets up selection mode, name stack, + * and projection matrix for picking. Then the objects + * are drawn. + */ +#define BUFSIZE 512 + +void +pickRects(int button, int state, int x, int y) +{ + GLuint selectBuf[BUFSIZE]; + GLint hits; + GLint viewport[4]; + + if (button != GLUT_LEFT_BUTTON || state != GLUT_DOWN) + return; + + glGetIntegerv(GL_VIEWPORT, viewport); + + glSelectBuffer(BUFSIZE, selectBuf); + (void) glRenderMode(GL_SELECT); + + glInitNames(); + glPushName(-1); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); +/* create 5x5 pixel picking region near cursor location */ + gluPickMatrix((GLdouble) x, (GLdouble) (viewport[3] - y), + 5.0, 5.0, viewport); + glOrtho(0.0, 8.0, 0.0, 8.0, -0.5, 2.5); + drawRects(GL_SELECT); + glPopMatrix(); + glFlush(); + + hits = glRenderMode(GL_RENDER); + processHits(hits, selectBuf); +} + +void +display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + drawRects(GL_RENDER); + glutSwapBuffers(); +} + +void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, 8.0, 0.0, 8.0, -0.5, 2.5); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, depth buffer, and handle input events. + */ +int +main(int argc, char **argv) +{ + glutInitWindowSize(200, 200); + glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + glutInit(&argc, argv); + glutCreateWindow(argv[0]); + myinit(); + glutMouseFunc(pickRects); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/picksquare.c b/xc/extras/Mesa/book/picksquare.c new file mode 100644 index 000000000..b68117c27 --- /dev/null +++ b/xc/extras/Mesa/book/picksquare.c @@ -0,0 +1,197 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * picksquare.c + * Use of multiple names and picking are demonstrated. + * A 3x3 grid of squares is drawn. When the left mouse + * button is pressed, all squares under the cursor position + * have their color changed. + */ +#include <stdlib.h> +#include <stdio.h> +#include <GL/glut.h> + +int board[3][3]; /* amount of color for each square */ + +/* Clear color value for every square on the board */ +void init(void) +{ + int i, j; + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j ++) + board[i][j] = 0; + glClearColor (0.0, 0.0, 0.0, 0.0); +} + +/* The nine squares are drawn. In selection mode, each + * square is given two names: one for the row and the + * other for the column on the grid. The color of each + * square is determined by its position on the grid, and + * the value in the board[][] array. + */ +void drawSquares(GLenum mode) +{ + GLuint i, j; + for (i = 0; i < 3; i++) { + if (mode == GL_SELECT) + glLoadName (i); + for (j = 0; j < 3; j ++) { + if (mode == GL_SELECT) + glPushName (j); + glColor3f ((GLfloat) i/3.0, (GLfloat) j/3.0, + (GLfloat) board[i][j]/3.0); + glRecti (i, j, i+1, j+1); + if (mode == GL_SELECT) + glPopName (); + } + } +} + +/* processHits prints out the contents of the + * selection array. + */ +void processHits (GLint hits, GLuint buffer[]) +{ + unsigned int i, j; + GLuint ii = 0, jj = 0, names, *ptr; + + printf ("hits = %d\n", hits); + ptr = (GLuint *) buffer; + for (i = 0; i < hits; i++) { /* for each hit */ + names = *ptr; + printf (" number of names for this hit = %d\n", names); ptr++; + printf(" z1 is %g;", (float) *ptr/0x7fffffff); ptr++; + printf(" z2 is %g\n", (float) *ptr/0x7fffffff); ptr++; + printf (" names are "); + for (j = 0; j < names; j++) { /* for each name */ + printf ("%d ", *ptr); + if (j == 0) /* set row and column */ + ii = *ptr; + else if (j == 1) + jj = *ptr; + ptr++; + } + printf ("\n"); + board[ii][jj] = (board[ii][jj] + 1) % 3; + } +} + +/* pickSquares() sets up selection mode, name stack, + * and projection matrix for picking. Then the + * objects are drawn. + */ +#define BUFSIZE 512 + +void pickSquares(int button, int state, int x, int y) +{ + GLuint selectBuf[BUFSIZE]; + GLint hits; + GLint viewport[4]; + + if (button != GLUT_LEFT_BUTTON || state != GLUT_DOWN) + return; + + glGetIntegerv (GL_VIEWPORT, viewport); + + glSelectBuffer (BUFSIZE, selectBuf); + (void) glRenderMode (GL_SELECT); + + glInitNames(); + glPushName(0); + + glMatrixMode (GL_PROJECTION); + glPushMatrix (); + glLoadIdentity (); +/* create 5x5 pixel picking region near cursor location */ + gluPickMatrix ((GLdouble) x, (GLdouble) (viewport[3] - y), + 5.0, 5.0, viewport); + gluOrtho2D (0.0, 3.0, 0.0, 3.0); + drawSquares (GL_SELECT); + + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + glFlush (); + + hits = glRenderMode (GL_RENDER); + processHits (hits, selectBuf); + glutPostRedisplay(); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + drawSquares (GL_RENDER); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D (0.0, 3.0, 0.0, 3.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* Main Loop */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (100, 100); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutReshapeFunc (reshape); + glutDisplayFunc(display); + glutMouseFunc (pickSquares); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/plane.c b/xc/extras/Mesa/book/plane.c new file mode 100644 index 000000000..dc17f7b23 --- /dev/null +++ b/xc/extras/Mesa/book/plane.c @@ -0,0 +1,171 @@ + +/* 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. + */ +/* + * plane.c + * This program demonstrates the use of local versus + * infinite lighting on a flat plane. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize material property, light source, and lighting model. + */ +void myinit(void) +{ + GLfloat mat_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; +/* mat_specular and mat_shininess are NOT default values */ + GLfloat mat_diffuse[] = { 0.4, 0.4, 0.4, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 15.0 }; + + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; + + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); +} + +void drawPlane(void) +{ + glBegin (GL_QUADS); + glNormal3f (0.0, 0.0, 1.0); + glVertex3f (-1.0, -1.0, 0.0); + glVertex3f (0.0, -1.0, 0.0); + glVertex3f (0.0, 0.0, 0.0); + glVertex3f (-1.0, 0.0, 0.0); + + glNormal3f (0.0, 0.0, 1.0); + glVertex3f (0.0, -1.0, 0.0); + glVertex3f (1.0, -1.0, 0.0); + glVertex3f (1.0, 0.0, 0.0); + glVertex3f (0.0, 0.0, 0.0); + + glNormal3f (0.0, 0.0, 1.0); + glVertex3f (0.0, 0.0, 0.0); + glVertex3f (1.0, 0.0, 0.0); + glVertex3f (1.0, 1.0, 0.0); + glVertex3f (0.0, 1.0, 0.0); + + glNormal3f (0.0, 0.0, 1.0); + glVertex3f (0.0, 0.0, 0.0); + glVertex3f (0.0, 1.0, 0.0); + glVertex3f (-1.0, 1.0, 0.0); + glVertex3f (-1.0, 0.0, 0.0); + glEnd(); +} + +void display (void) +{ + GLfloat infinite_light[] = { 1.0, 1.0, 1.0, 0.0 }; + GLfloat local_light[] = { 1.0, 1.0, 1.0, 1.0 }; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glTranslatef (-1.5, 0.0, 0.0); + glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); + drawPlane (); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (1.5, 0.0, 0.0); + glLightfv (GL_LIGHT0, GL_POSITION, local_light); + drawPlane (); + glPopMatrix (); + glFlush (); +} + +void myReshape(int w, int h) +{ + glViewport (0, 0, w, h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + if (w <= h) + glOrtho (-1.5, 1.5, -1.5*(GLdouble)h/(GLdouble)w, + 1.5*(GLdouble)h/(GLdouble)w, -10.0, 10.0); + else + glOrtho (-1.5*(GLdouble)w/(GLdouble)h, + 1.5*(GLdouble)w/(GLdouble)h, -1.5, 1.5, -10.0, 10.0); + glMatrixMode (GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 200); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/planet.c b/xc/extras/Mesa/book/planet.c new file mode 100644 index 000000000..e13672d3f --- /dev/null +++ b/xc/extras/Mesa/book/planet.c @@ -0,0 +1,123 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * planet.c + * This program shows how to composite modeling transformations + * to draw translated and rotated models. + * Interaction: pressing the d and y keys (day and year) + * alters the rotation of the planet around the sun. + */ +#include <GL/glut.h> +#include <stdlib.h> + +static int year = 0, day = 0; + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT); + glColor3f (1.0, 1.0, 1.0); + + glPushMatrix(); + glutWireSphere(1.0, 20, 16); /* draw sun */ + glRotatef ((GLfloat) year, 0.0, 1.0, 0.0); + glTranslatef (2.0, 0.0, 0.0); + glRotatef ((GLfloat) day, 0.0, 1.0, 0.0); + glutWireSphere(0.2, 10, 8); /* draw smaller planet */ + glPopMatrix(); + glutSwapBuffers(); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); +} + +/* ARGSUSED1 */ +void keyboard (unsigned char key, int x, int y) +{ + switch (key) { + case 'd': + day = (day + 10) % 360; + glutPostRedisplay(); + break; + case 'D': + day = (day - 10) % 360; + glutPostRedisplay(); + break; + case 'y': + year = (year + 5) % 360; + glutPostRedisplay(); + break; + case 'Y': + year = (year - 5) % 360; + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/polyoff.c b/xc/extras/Mesa/book/polyoff.c new file mode 100644 index 000000000..ae7ec0b89 --- /dev/null +++ b/xc/extras/Mesa/book/polyoff.c @@ -0,0 +1,332 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * polyoff.c + * This program demonstrates polygon offset to draw a shaded + * polygon and its wireframe counterpart without ugly visual + * artifacts ("stitching"). + */ +#include <GL/glut.h> +#include <stdio.h> +#include <stdlib.h> + +#ifdef GL_VERSION_1_1 +GLuint list; +GLint fill = 1; +GLfloat spinx = 0; +GLfloat spiny = 0; +GLfloat tdist = 0.0; +GLfloat polyfactor = 1.0; +GLfloat polyunits = 1.0; +GLboolean doubleBuffer; + + +/* display() draws two spheres, one with a gray, diffuse material, + * the other sphere with a magenta material with a specular highlight. + */ +void display (void) +{ + GLfloat gray[] = { 0.8, 0.8, 0.8, 1.0 }; + GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 }; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix (); + glTranslatef (0.0, 0.0, tdist); + glRotatef ((GLfloat) spinx, 1.0, 0.0, 0.0); + glRotatef ((GLfloat) spiny, 0.0, 1.0, 0.0); + + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); + glMaterialfv(GL_FRONT, GL_SPECULAR, black); + glMaterialf(GL_FRONT, GL_SHININESS, 0.0); + if (fill) { + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(polyfactor, polyunits); + glCallList (list); + glDisable(GL_POLYGON_OFFSET_FILL); + } + + glDisable(GL_LIGHTING); + glDisable(GL_LIGHT0); + glColor3f (1.0, 1.0, 1.0); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glPolygonOffset(-polyfactor, -polyunits); + if (!fill) glEnable(GL_POLYGON_OFFSET_LINE); + glCallList (list); + glDisable(GL_POLYGON_OFFSET_LINE); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + if (!fill) { + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glCallList (list); + } + + glPopMatrix (); + glFlush (); + if (doubleBuffer) glutSwapBuffers(); +} + +/* specify initial properties + * create display list with sphere + * initialize lighting and depth buffer + */ +void gfxinit (void) +{ + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + GLfloat global_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; + + glClearColor (0.0, 0.0, 0.0, 1.0); + + list = glGenLists(1); + glNewList (list, GL_COMPILE); + glutSolidSphere(1.0, 20, 12); + glEndList (); + + glEnable(GL_DEPTH_TEST); + + glLightfv (GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv (GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv (GL_LIGHT0, GL_POSITION, light_position); + glLightModelfv (GL_LIGHT_MODEL_AMBIENT, global_ambient); +} + +/* call when window is resized */ +void reshape(int width, int height) +{ + glViewport (0, 0, width, height); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluPerspective(45.0, (GLdouble)width/(GLdouble)height, + 1.0, 10.0); + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); +} + +static void Benchmark( float xdiff, float ydiff ) +{ + int startTime, endTime; + int draws; + double seconds, fps, triPerSecond; + + printf("Benchmarking...\n"); + + draws = 0; + startTime = glutGet(GLUT_ELAPSED_TIME); + spinx = spiny = 0.0; + do { + spinx += xdiff; + spiny += ydiff; + display(); + draws++; + endTime = glutGet(GLUT_ELAPSED_TIME); + } while (endTime - startTime < 5000); /* 5 seconds */ + + /* Results */ + seconds = (double) (endTime - startTime) / 1000.0; + fps = draws / seconds; + printf("Result: fps: %g\n", fps); +} + + +/* call when mouse button is pressed */ +/* ARGSUSED2 */ +void mouse(int button, int state, int x, int y) { + switch (button) { + case GLUT_LEFT_BUTTON: + switch (state) { + case GLUT_DOWN: + spinx += 5; + glutPostRedisplay(); + break; + default: + break; + } + break; + case GLUT_MIDDLE_BUTTON: + switch (state) { + case GLUT_DOWN: + spiny += 5; + glutPostRedisplay(); + break; + default: + break; + } + break; + case GLUT_RIGHT_BUTTON: + switch (state) { + case GLUT_UP: + exit(0); + break; + default: + break; + } + break; + default: + break; + } +} + +/* ARGSUSED1 */ +void keyboard (unsigned char key, int x, int y) +{ + switch (key) { + case 't': + if (tdist < 4.0) { + tdist = (tdist + 0.5); + glutPostRedisplay(); + } + break; + case 'T': + if (tdist > -5.0) { + tdist = (tdist - 0.5); + glutPostRedisplay(); + } + break; + case 'F': + polyfactor = polyfactor + 0.1; + printf ("polyfactor is %f\n", polyfactor); + glutPostRedisplay(); + break; + case 'f': + polyfactor = polyfactor - 0.1; + printf ("polyfactor is %f\n", polyfactor); + glutPostRedisplay(); + break; + case 'U': + polyunits = polyunits + 1.0; + printf ("polyunits is %f\n", polyunits); + glutPostRedisplay(); + break; + case 'u': + polyunits = polyunits - 1.0; + printf ("polyunits is %f\n", polyunits); + glutPostRedisplay(); + break; + case 'b': + Benchmark(5.0, 0); + break; + case 'B': + Benchmark(0, 5.0); + break; + case ' ': + fill = !fill; + printf ("fill/line: %d\n", fill); + glutPostRedisplay(); + break; + case 27: /* Escape */ + exit(0); + break; + default: + break; + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + GLuint type; + glutInit(&argc, argv); + + Args(argc, argv); + + type = GLUT_DEPTH | GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + + glutInitDisplayMode(type); + glutCreateWindow("polyoff"); + glutReshapeFunc(reshape); + glutDisplayFunc(display); + glutMouseFunc(mouse); + glutKeyboardFunc(keyboard); + gfxinit(); + glutMainLoop(); + return 0; +} +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates a feature which is not in OpenGL Version 1.0.\n"); + fprintf (stderr, "If your implementation of OpenGL Version 1.0 has the right extensions,\n"); + fprintf (stderr, "you may be able to modify this program to make it run.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/polys.c b/xc/extras/Mesa/book/polys.c new file mode 100644 index 000000000..17c1cfbff --- /dev/null +++ b/xc/extras/Mesa/book/polys.c @@ -0,0 +1,138 @@ + +/* 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. + */ +/* + * polys.c + * This program demonstrates polygon stippling. + */ +#include <stdlib.h> +#include <GL/glut.h> + +void display(void) +{ + GLubyte fly[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20, +0x04, 0x30, 0x0C, 0x20, 0x04, 0x18, 0x18, 0x20, 0x04, 0x0C, 0x30, 0x20, +0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xC0, 0x22, 0x44, 0x01, 0x80, 0x22, +0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, +0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x66, 0x01, 0x80, 0x66, +0x33, 0x01, 0x80, 0xCC, 0x19, 0x81, 0x81, 0x98, 0x0C, 0xC1, 0x83, 0x30, +0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0, 0x03, 0x31, 0x8c, 0xc0, +0x03, 0x33, 0xcc, 0xc0, 0x06, 0x64, 0x26, 0x60, 0x0c, 0xcc, 0x33, 0x30, +0x18, 0xcc, 0x33, 0x18, 0x10, 0xc4, 0x23, 0x08, 0x10, 0x63, 0xC6, 0x08, +0x10, 0x30, 0x0c, 0x08, 0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08}; + + GLubyte halftone[] = { +0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, +0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, +0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, +0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, +0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, +0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55}; + + glClear (GL_COLOR_BUFFER_BIT); + +/* draw all polygons in white */ + glColor3f (1.0, 1.0, 1.0); + +/* draw one solid, unstippled rectangle, */ +/* then two stippled rectangles */ + glRectf (25.0, 25.0, 125.0, 125.0); + glEnable (GL_POLYGON_STIPPLE); + glPolygonStipple (fly); + glRectf (125.0, 25.0, 225.0, 125.0); + glPolygonStipple (halftone); + glRectf (225.0, 25.0, 325.0, 125.0); + glDisable (GL_POLYGON_STIPPLE); + + glFlush (); +} + +void myinit (void) +{ +/* clear background to black */ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +static void reshape(GLsizei w, GLsizei h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, (GLdouble)w, 0.0, (GLdouble)h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (350, 150); + glutCreateWindow (argv[0]); + myinit (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/quadric.c b/xc/extras/Mesa/book/quadric.c new file mode 100644 index 000000000..4e46c85f8 --- /dev/null +++ b/xc/extras/Mesa/book/quadric.c @@ -0,0 +1,189 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * quadric.c + * This program demonstrates the use of some of the gluQuadric* + * routines. Quadric objects are created with some quadric + * properties and the callback routine to handle errors. + * Note that the cylinder has no top or bottom and the circle + * has a hole in it. + */ +#include <GL/glut.h> +#include <stdio.h> +#include <stdlib.h> + +/* Win32 calling conventions. */ +#ifndef CALLBACK +#define CALLBACK +#endif + +GLuint startList; + +void CALLBACK errorCallback(GLenum errorCode) +{ + const GLubyte *estring; + + estring = gluErrorString(errorCode); + fprintf(stderr, "Quadric Error: %s\n", estring); + exit(0); +} + +void init(void) +{ + GLUquadricObj *qobj; + GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 50.0 }; + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + GLfloat model_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, model_ambient); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + +/* Create 4 display lists, each with a different quadric object. + * Different drawing styles and surface normal specifications + * are demonstrated. + */ + startList = glGenLists(4); + qobj = gluNewQuadric(); + gluQuadricCallback(qobj, GLU_ERROR, + (GLvoid (CALLBACK*) ()) errorCallback); + + gluQuadricDrawStyle(qobj, GLU_FILL); /* smooth shaded */ + gluQuadricNormals(qobj, GLU_SMOOTH); + glNewList(startList, GL_COMPILE); + gluSphere(qobj, 0.75, 15, 10); + glEndList(); + + gluQuadricDrawStyle(qobj, GLU_FILL); /* flat shaded */ + gluQuadricNormals(qobj, GLU_FLAT); + glNewList(startList+1, GL_COMPILE); + gluCylinder(qobj, 0.5, 0.3, 1.0, 15, 5); + glEndList(); + + gluQuadricDrawStyle(qobj, GLU_LINE); /* all polygons wireframe */ + gluQuadricNormals(qobj, GLU_NONE); + glNewList(startList+2, GL_COMPILE); + gluDisk(qobj, 0.25, 1.0, 20, 4); + glEndList(); + + gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); /* boundary only */ + gluQuadricNormals(qobj, GLU_NONE); + glNewList(startList+3, GL_COMPILE); + gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0); + glEndList(); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix(); + + glEnable(GL_LIGHTING); + glShadeModel (GL_SMOOTH); + glTranslatef(-1.0, -1.0, 0.0); + glCallList(startList); + + glShadeModel (GL_FLAT); + glTranslatef(0.0, 2.0, 0.0); + glPushMatrix(); + glRotatef(300.0, 1.0, 0.0, 0.0); + glCallList(startList+1); + glPopMatrix(); + + glDisable(GL_LIGHTING); + glColor3f(0.0, 1.0, 1.0); + glTranslatef(2.0, -2.0, 0.0); + glCallList(startList+2); + + glColor3f(1.0, 1.0, 0.0); + glTranslatef(0.0, 2.0, 0.0); + glCallList(startList+3); + + glPopMatrix(); + glFlush(); +} + +void reshape (int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w, + 2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho(-2.5*(GLfloat)w/(GLfloat)h, + 2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(500, 500); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/robot.c b/xc/extras/Mesa/book/robot.c new file mode 100644 index 000000000..94e20ac71 --- /dev/null +++ b/xc/extras/Mesa/book/robot.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * robot.c + * This program shows how to composite modeling transformations + * to draw translated and rotated hierarchical models. + * Interaction: pressing the s and e keys (shoulder and elbow) + * alters the rotation of the robot arm. + */ +#include <GL/glut.h> +#include <stdlib.h> + +static int shoulder = 0, elbow = 0; + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_FLAT); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT); + glPushMatrix(); + glTranslatef (-1.0, 0.0, 0.0); + glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0); + glTranslatef (1.0, 0.0, 0.0); + glPushMatrix(); + glScalef (2.0, 0.4, 1.0); + glutWireCube (1.0); + glPopMatrix(); + + glTranslatef (1.0, 0.0, 0.0); + glRotatef ((GLfloat) elbow, 0.0, 0.0, 1.0); + glTranslatef (1.0, 0.0, 0.0); + glPushMatrix(); + glScalef (2.0, 0.4, 1.0); + glutWireCube (1.0); + glPopMatrix(); + + glPopMatrix(); + glutSwapBuffers(); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluPerspective(65.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef (0.0, 0.0, -5.0); +} + +/* ARGSUSED1 */ +void keyboard (unsigned char key, int x, int y) +{ + switch (key) { + case 's': + shoulder = (shoulder + 5) % 360; + glutPostRedisplay(); + break; + case 'S': + shoulder = (shoulder - 5) % 360; + glutPostRedisplay(); + break; + case 'e': + elbow = (elbow + 5) % 360; + glutPostRedisplay(); + break; + case 'E': + elbow = (elbow - 5) % 360; + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/sccolorlight.c b/xc/extras/Mesa/book/sccolorlight.c new file mode 100644 index 000000000..0ea750e58 --- /dev/null +++ b/xc/extras/Mesa/book/sccolorlight.c @@ -0,0 +1,141 @@ + +/* 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. + */ +/* + * sccolorlight.c + * This program demonstrates the use of a colored + * (magenta, in this example) light source. Objects + * are drawn using a grey material characteristic. + * A single light source illuminates the objects. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize material property and light source. + */ +void myinit(void) +{ + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 0.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 0.0, 1.0, 1.0 }; +/* light_position is NOT default value */ + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix (); + glRotatef (20.0, 1.0, 0.0, 0.0); + + glPushMatrix (); + glTranslatef (-0.75, 0.5, 0.0); + glRotatef (90.0, 1.0, 0.0, 0.0); + glutSolidTorus (0.275, 0.85, 20, 20); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-0.75, -0.5, 0.0); + glRotatef (270.0, 1.0, 0.0, 0.0); + glutSolidCone (1.0, 2.0, 20, 20); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.75, 0.0, -1.0); + glutSolidSphere (1.0, 20, 20); + glPopMatrix (); + + glPopMatrix (); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w, + 2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-2.5*(GLfloat)w/(GLfloat)h, + 2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/scene.c b/xc/extras/Mesa/book/scene.c new file mode 100644 index 000000000..c3abc727b --- /dev/null +++ b/xc/extras/Mesa/book/scene.c @@ -0,0 +1,141 @@ + +/* 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. + */ +/* + * scene.c + * This program demonstrates the use of the GL lighting model. + * Objects are drawn using a grey material characteristic. + * A single light source illuminates the objects. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize material property and light source. + */ +void myinit (void) +{ + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; +/* light_position is NOT default value */ + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + glLightfv (GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv (GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv (GL_LIGHT0, GL_POSITION, light_position); + + glEnable (GL_LIGHTING); + glEnable (GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); +} + +void display (void) +{ + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glRotatef (20.0, 1.0, 0.0, 0.0); + + glPushMatrix (); + glTranslatef (-0.75, 0.5, 0.0); + glRotatef (90.0, 1.0, 0.0, 0.0); + glutSolidTorus (0.275, 0.85, 15, 15); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-0.75, -0.5, 0.0); + glRotatef (270.0, 1.0, 0.0, 0.0); + glutSolidCone (1.0, 2.0, 15, 15); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.75, 0.0, -1.0); + glutSolidSphere (1.0, 15, 15); + glPopMatrix (); + + glPopMatrix (); + glFlush (); +} + +void myReshape(int w, int h) +{ + glViewport (0, 0, w, h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + if (w <= h) + glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w, + 2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-2.5*(GLfloat)w/(GLfloat)h, + 2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0); + glMatrixMode (GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutCreateWindow (argv[0]); + myinit (); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/scenebamb.c b/xc/extras/Mesa/book/scenebamb.c new file mode 100644 index 000000000..e7264d200 --- /dev/null +++ b/xc/extras/Mesa/book/scenebamb.c @@ -0,0 +1,140 @@ + +/* 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. + */ +/* + * scenebamb.c + * This program demonstrates use of a blue ambient light + * source. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize light source and lighting. + */ +void myinit(void) +{ + GLfloat light_ambient[] = { 0.0, 0.0, 1.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; +/* light_position is NOT default value */ + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glRotatef (20.0, 1.0, 0.0, 0.0); + + glPushMatrix (); + glTranslatef (-0.75, 0.5, 0.0); + glRotatef (90.0, 1.0, 0.0, 0.0); + glutSolidTorus (0.275, 0.85, 15, 15); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-0.75, -0.5, 0.0); + glRotatef (270.0, 1.0, 0.0, 0.0); + glutSolidCone (1.0, 2.0, 15, 15); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.75, 0.0, -1.0); + glutSolidSphere (1.0, 15, 15); + glPopMatrix (); + + glPopMatrix (); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w, + 2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-2.5*(GLfloat)w/(GLfloat)h, + 2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/sceneflat.c b/xc/extras/Mesa/book/sceneflat.c new file mode 100644 index 000000000..10891fb99 --- /dev/null +++ b/xc/extras/Mesa/book/sceneflat.c @@ -0,0 +1,140 @@ + +/* 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. + */ +/* + * sceneflat.c + * This program draws lighted objects with flat shading. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize light source and shading model (GL_FLAT). + */ +void myinit(void) +{ + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; +/* light_position is NOT default value */ + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glShadeModel (GL_FLAT); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glRotatef (20.0, 1.0, 0.0, 0.0); + + glPushMatrix (); + glTranslatef (-0.75, 0.5, 0.0); + glRotatef (90.0, 1.0, 0.0, 0.0); + glutSolidTorus (0.275, 0.85, 15, 15); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-0.75, -0.5, 0.0); + glRotatef (270.0, 1.0, 0.0, 0.0); + glutSolidCone (1.0, 2.0, 15, 15); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (0.75, 0.0, -1.0); + glutSolidSphere (1.0, 15, 15); + glPopMatrix (); + + glPopMatrix (); + glFlush(); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w, + 2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); + else + glOrtho (-2.5*(GLfloat)w/(GLfloat)h, + 2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/select.c b/xc/extras/Mesa/book/select.c new file mode 100644 index 000000000..4f413e73c --- /dev/null +++ b/xc/extras/Mesa/book/select.c @@ -0,0 +1,222 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * select.c + * This is an illustration of the selection mode and + * name stack, which detects whether objects which collide + * with a viewing volume. First, four triangles and a + * rectangular box representing a viewing volume are drawn + * (drawScene routine). The green triangle and yellow + * triangles appear to lie within the viewing volume, but + * the red triangle appears to lie outside it. Then the + * selection mode is entered (selectObjects routine). + * Drawing to the screen ceases. To see if any collisions + * occur, the four triangles are called. In this example, + * the green triangle causes one hit with the name 1, and + * the yellow triangles cause one hit with the name 3. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +/* draw a triangle with vertices at (x1, y1), (x2, y2) + * and (x3, y3) at z units away from the origin. + */ +void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2, + GLfloat y2, GLfloat x3, GLfloat y3, GLfloat z) +{ + glBegin (GL_TRIANGLES); + glVertex3f (x1, y1, z); + glVertex3f (x2, y2, z); + glVertex3f (x3, y3, z); + glEnd (); +} + +/* draw a rectangular box with these outer x, y, and z values */ +void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1, + GLfloat y2, GLfloat z1, GLfloat z2) +{ + glColor3f (1.0, 1.0, 1.0); + glBegin (GL_LINE_LOOP); + glVertex3f (x1, y1, -z1); + glVertex3f (x2, y1, -z1); + glVertex3f (x2, y2, -z1); + glVertex3f (x1, y2, -z1); + glEnd (); + + glBegin (GL_LINE_LOOP); + glVertex3f (x1, y1, -z2); + glVertex3f (x2, y1, -z2); + glVertex3f (x2, y2, -z2); + glVertex3f (x1, y2, -z2); + glEnd (); + + glBegin (GL_LINES); /* 4 lines */ + glVertex3f (x1, y1, -z1); + glVertex3f (x1, y1, -z2); + glVertex3f (x1, y2, -z1); + glVertex3f (x1, y2, -z2); + glVertex3f (x2, y1, -z1); + glVertex3f (x2, y1, -z2); + glVertex3f (x2, y2, -z1); + glVertex3f (x2, y2, -z2); + glEnd (); +} + +/* drawScene draws 4 triangles and a wire frame + * which represents the viewing volume. + */ +void drawScene (void) +{ + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluPerspective (40.0, 4.0/3.0, 1.0, 100.0); + + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + gluLookAt (7.5, 7.5, 12.5, 2.5, 2.5, -5.0, 0.0, 1.0, 0.0); + glColor3f (0.0, 1.0, 0.0); /* green triangle */ + drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, -5.0); + glColor3f (1.0, 0.0, 0.0); /* red triangle */ + drawTriangle (2.0, 7.0, 3.0, 7.0, 2.5, 8.0, -5.0); + glColor3f (1.0, 1.0, 0.0); /* yellow triangles */ + drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, 0.0); + drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, -10.0); + drawViewVolume (0.0, 5.0, 0.0, 5.0, 0.0, 10.0); +} + +/* processHits prints out the contents of the selection array + */ +void processHits (GLint hits, GLuint buffer[]) +{ + unsigned int i, j; + GLuint names, *ptr; + + printf ("hits = %d\n", hits); + ptr = (GLuint *) buffer; + for (i = 0; i < hits; i++) { /* for each hit */ + names = *ptr; + printf (" number of names for hit = %d\n", names); ptr++; + printf(" z1 is %g;", (float) *ptr/0x7fffffff); ptr++; + printf(" z2 is %g\n", (float) *ptr/0x7fffffff); ptr++; + printf (" the name is "); + for (j = 0; j < names; j++) { /* for each name */ + printf ("%d ", *ptr); ptr++; + } + printf ("\n"); + } +} + +/* selectObjects "draws" the triangles in selection mode, + * assigning names for the triangles. Note that the third + * and fourth triangles share one name, so that if either + * or both triangles intersects the viewing/clipping volume, + * only one hit will be registered. + */ +#define BUFSIZE 512 + +void selectObjects(void) +{ + GLuint selectBuf[BUFSIZE]; + GLint hits; + + glSelectBuffer (BUFSIZE, selectBuf); + (void) glRenderMode (GL_SELECT); + + glInitNames(); + glPushName(0); + + glPushMatrix (); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + glOrtho (0.0, 5.0, 0.0, 5.0, 0.0, 10.0); + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + glLoadName(1); + drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, -5.0); + glLoadName(2); + drawTriangle (2.0, 7.0, 3.0, 7.0, 2.5, 8.0, -5.0); + glLoadName(3); + drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, 0.0); + drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, -10.0); + glPopMatrix (); + glFlush (); + + hits = glRenderMode (GL_RENDER); + processHits (hits, selectBuf); +} + +void init (void) +{ + glEnable(GL_DEPTH_TEST); + glShadeModel(GL_FLAT); +} + +void display(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + drawScene (); + selectObjects (); + glFlush(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* Main Loop */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (200, 200); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init(); + glutDisplayFunc(display); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/smooth.c b/xc/extras/Mesa/book/smooth.c new file mode 100644 index 000000000..9d22fc902 --- /dev/null +++ b/xc/extras/Mesa/book/smooth.c @@ -0,0 +1,106 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * smooth.c + * This program demonstrates smooth shading. + * A smooth shaded polygon is drawn in a 2-D projection. + */ +#include <GL/glut.h> +#include <stdlib.h> + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_SMOOTH); +} + +void triangle(void) +{ + glBegin (GL_TRIANGLES); + glColor3f (1.0, 0.0, 0.0); + glVertex2f (5.0, 5.0); + glColor3f (0.0, 1.0, 0.0); + glVertex2f (25.0, 5.0); + glColor3f (0.0, 0.0, 1.0); + glVertex2f (5.0, 25.0); + glEnd(); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT); + triangle (); + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + if (w <= h) + gluOrtho2D (0.0, 30.0, 0.0, 30.0 * (GLfloat) h/(GLfloat) w); + else + gluOrtho2D (0.0, 30.0 * (GLfloat) w/(GLfloat) h, 0.0, 30.0); + glMatrixMode(GL_MODELVIEW); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/stencil.c b/xc/extras/Mesa/book/stencil.c new file mode 100644 index 000000000..5626d55be --- /dev/null +++ b/xc/extras/Mesa/book/stencil.c @@ -0,0 +1,176 @@ + +/* 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. + */ +/* stencil.c + * This program draws two rotated tori in a window. + * A diamond in the center of the window masks out part + * of the scene. Within this mask, a different model + * (a sphere) is drawn in a different color. + */ +#include <stdlib.h> +#include <GL/glut.h> + +#define YELLOWMAT 1 +#define BLUEMAT 2 + +void myinit (void) +{ + GLfloat yellow_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; + GLfloat yellow_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + + GLfloat blue_diffuse[] = { 0.1, 0.1, 0.7, 1.0 }; + GLfloat blue_specular[] = { 0.1, 1.0, 1.0, 1.0 }; + + GLfloat position_one[] = { 1.0, 1.0, 1.0, 0.0 }; + + glNewList(YELLOWMAT, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_DIFFUSE, yellow_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, yellow_specular); + glMaterialf(GL_FRONT, GL_SHININESS, 64.0); + glEndList(); + + glNewList(BLUEMAT, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_DIFFUSE, blue_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, blue_specular); + glMaterialf(GL_FRONT, GL_SHININESS, 45.0); + glEndList(); + + glLightfv(GL_LIGHT0, GL_POSITION, position_one); + + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + + glClearStencil(0x0); + glEnable(GL_STENCIL_TEST); + +} + +/* Draw a sphere in a diamond-shaped section in the + * middle of a window with 2 tori. + */ +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + +/* draw blue sphere where the stencil is 1 */ + glStencilFunc (GL_EQUAL, 0x1, 0x1); + glCallList (BLUEMAT); + glutSolidSphere (0.5, 15, 15); + +/* draw the tori where the stencil is not 1 */ + glStencilFunc (GL_NOTEQUAL, 0x1, 0x1); + glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP); + glPushMatrix(); + glRotatef (45.0, 0.0, 0.0, 1.0); + glRotatef (45.0, 0.0, 1.0, 0.0); + glCallList (YELLOWMAT); + glutSolidTorus (0.275, 0.85, 15, 15); + glPushMatrix(); + glRotatef (90.0, 1.0, 0.0, 0.0); + glutSolidTorus (0.275, 0.85, 15, 15); + glPopMatrix(); + glPopMatrix(); + + glFlush(); +} + +/* Whenever the window is reshaped, redefine the + * coordinate system and redraw the stencil area. + */ +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + + glClear(GL_STENCIL_BUFFER_BIT); +/* create a diamond shaped stencil area */ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-3.0, 3.0, -3.0, 3.0, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glStencilFunc (GL_ALWAYS, 0x1, 0x1); + glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE); + glBegin(GL_QUADS); + glVertex3f (-1.0, 0.0, 0.0); + glVertex3f (0.0, 1.0, 0.0); + glVertex3f (1.0, 0.0, 0.0); + glVertex3f (0.0, -1.0, 0.0); + glEnd(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45.0, (GLfloat) w/(GLfloat) h, 3.0, 7.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -5.0); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); + glutInitWindowSize (400, 400); + glutCreateWindow (argv[0]); + myinit (); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/stroke.c b/xc/extras/Mesa/book/stroke.c new file mode 100644 index 000000000..19b0391cb --- /dev/null +++ b/xc/extras/Mesa/book/stroke.c @@ -0,0 +1,195 @@ + +/* 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. + */ +/* + * stroke.c + * This program demonstrates some characters of a + * stroke (vector) font. The characters are represented + * by display lists, which are given numbers which + * correspond to the ASCII values of the characters. + * Use of glCallLists() is demonstrated. + */ +#include <stdlib.h> +#include <string.h> +#include <GL/glut.h> + +#define PT 1 +#define STROKE 2 +#define END 3 + +typedef struct charpoint { + GLfloat x, y; + int type; +} CP; + +CP Adata[] = { + { 0, 0, PT}, {0, 9, PT}, {1, 10, PT}, {4, 10, PT}, + {5, 9, PT}, {5, 0, STROKE}, {0, 5, PT}, {5, 5, END} +}; + +CP Edata[] = { + {5, 0, PT}, {0, 0, PT}, {0, 10, PT}, {5, 10, STROKE}, + {0, 5, PT}, {4, 5, END} +}; + +CP Pdata[] = { + {0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT}, + {4, 5, PT}, {0, 5, END} +}; + +CP Rdata[] = { + {0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT}, + {4, 5, PT}, {0, 5, STROKE}, {3, 5, PT}, {5, 0, END} +}; + +CP Sdata[] = { + {0, 1, PT}, {1, 0, PT}, {4, 0, PT}, {5, 1, PT}, {5, 4, PT}, + {4, 5, PT}, {1, 5, PT}, {0, 6, PT}, {0, 9, PT}, {1, 10, PT}, + {4, 10, PT}, {5, 9, END} +}; + +/* drawLetter() interprets the instructions from the array + * for that letter and renders the letter with line segments. + */ +void drawLetter(CP *l) +{ + glBegin(GL_LINE_STRIP); + for (;;) { + switch (l->type) { + case PT: + glVertex2fv(&l->x); + break; + case STROKE: + glVertex2fv(&l->x); + glEnd(); + glBegin(GL_LINE_STRIP); + break; + case END: + glVertex2fv(&l->x); + glEnd(); + glTranslatef(8.0, 0.0, 0.0); + return; + } + l++; + } +} + +/* Create a display list for each of 6 characters */ +void myinit (void) +{ + GLuint base; + + glShadeModel (GL_FLAT); + + base = glGenLists (128); + glListBase(base); + glNewList(base+'A', GL_COMPILE); drawLetter(Adata); glEndList(); + glNewList(base+'E', GL_COMPILE); drawLetter(Edata); glEndList(); + glNewList(base+'P', GL_COMPILE); drawLetter(Pdata); glEndList(); + glNewList(base+'R', GL_COMPILE); drawLetter(Rdata); glEndList(); + glNewList(base+'S', GL_COMPILE); drawLetter(Sdata); glEndList(); + glNewList(base+' ', GL_COMPILE); glTranslatef(8.0, 0.0, 0.0); glEndList(); +} + +char *test1 = "A SPARE SERAPE APPEARS AS"; +char *test2 = "APES PREPARE RARE PEPPERS"; + +void printStrokedString(char *s) +{ + GLsizei len = (GLsizei) strlen(s); + glCallLists(len, GL_BYTE, (GLbyte *)s); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glColor3f(1.0, 1.0, 1.0); + glPushMatrix(); + glScalef(2.0, 2.0, 2.0); + glTranslatef(10.0, 30.0, 0.0); + printStrokedString(test1); + glPopMatrix(); + glPushMatrix(); + glScalef(2.0, 2.0, 2.0); + glTranslatef(10.0, 13.0, 0.0); + printStrokedString(test2); + glPopMatrix(); + glFlush(); +} + +static void reshape(GLsizei w, GLsizei h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, (GLdouble)w, 0.0, (GLdouble)h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (440, 120); + glutCreateWindow (argv[0]); + myinit (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/surface.c b/xc/extras/Mesa/book/surface.c new file mode 100644 index 000000000..8ff157418 --- /dev/null +++ b/xc/extras/Mesa/book/surface.c @@ -0,0 +1,231 @@ +/* aux2glut conversion Copyright (c) Mark J. Kilgard, 1994, 1995 */ + +/** + * (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. + */ +/** + * surface.c + * This program draws a NURBS surface in the shape of a + * symmetrical hill. + */ +#include <GL/glut.h> + +GLfloat ctlpoints[4][4][3]; +int showPoints = 0; + +GLUnurbsObj *theNurb; + +/* + * Initializes the control points of the surface to a small hill. + * The control points range from -3 to +3 in x, y, and z + */ +void init_surface(void) +{ + int u, v; + for (u = 0; u < 4; u++) { + for (v = 0; v < 4; v++) { + ctlpoints[u][v][0] = 2.0*((GLfloat)u - 1.5); + ctlpoints[u][v][1] = 2.0*((GLfloat)v - 1.5); + + if ( (u == 1 || u == 2) && (v == 1 || v == 2)) + ctlpoints[u][v][2] = 7.0; + else + ctlpoints[u][v][2] = -3.0; + } + } +} + +/* Initialize material property and depth buffer. + */ +void myinit(void) +{ + GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 100.0 }; + + glClearColor (0.0, 0.0, 0.0, 1.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + + init_surface(); + + theNurb = gluNewNurbsRenderer(); + gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 25.0); + gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef (0.0, 0.0, -5.0); +} + +void display(void) +{ + GLfloat knots[8] = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0}; + int i, j; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(330.0, 1.,0.,0.); + glScalef (0.25, 0.25, 0.25); + + gluBeginSurface(theNurb); + gluNurbsSurface(theNurb, + 8, knots, + 8, knots, + 4 * 3, + 3, + &ctlpoints[0][0][0], + 4, 4, + GL_MAP2_VERTEX_3); + gluEndSurface(theNurb); + + if(showPoints) { + glPointSize(5.0); + glDisable(GL_LIGHTING); + glColor3f(1.0, 1.0, 0.0); + glBegin(GL_POINTS); + for(i=0;i<4;i++) { + for(j=0;j<4;j++) { + glVertex3f(ctlpoints[i][j][0], ctlpoints[i][j][1], ctlpoints[i][j][2]); + } + } + glEnd(); + glEnable(GL_LIGHTING); + } + + glPopMatrix(); + glutSwapBuffers(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective (45.0, (GLdouble)w/(GLdouble)h, 3.0, 8.0); + + glMatrixMode(GL_MODELVIEW); +} + +void +menu(int value) +{ + switch (value) { + case 0: + case 1: + showPoints = value; + break; + case 2: + gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL); + break; + case 3: + gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_OUTLINE_POLYGON); + break; + } + glutPostRedisplay(); +} + +int down = 0, lastx; + +/* ARGSUSED1 */ +void +motion(int x, int y) +{ + if (down) { + glRotatef(lastx - x, 0, 1, 0); + lastx = x; + glutPostRedisplay(); + } +} + +/* ARGSUSED3 */ +void +mouse(int button, int state, int x, int y) +{ + if (button == GLUT_LEFT_BUTTON) { + if (state == GLUT_DOWN) { + lastx = x; + down = 1; + } else { + down = 0; + } + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop */ +int +main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(reshape); + glutDisplayFunc(display); + glutCreateMenu(menu); + glutAddMenuEntry("Show control points", 1); + glutAddMenuEntry("Hide control points", 0); + glutAddMenuEntry("Solid", 2); + glutAddMenuEntry("Wireframe", 3); + glutAttachMenu(GLUT_RIGHT_BUTTON); + glutMouseFunc(mouse); + glutMotionFunc(motion); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/teaambient.c b/xc/extras/Mesa/book/teaambient.c new file mode 100644 index 000000000..53b511175 --- /dev/null +++ b/xc/extras/Mesa/book/teaambient.c @@ -0,0 +1,162 @@ + +/* 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. + */ +/** + * teaambient.c + * This program renders three lighted, shaded teapots, with + * different ambient values. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* Initialize light source and lighting model. + */ +void +myinit(void) +{ + GLfloat light_ambient[] = + {0.0, 0.0, 0.0, 1.0}; + GLfloat light_diffuse[] = + {1.0, 1.0, 1.0, 1.0}; + GLfloat light_specular[] = + {1.0, 1.0, 1.0, 1.0}; +/* light_position is NOT default value */ + GLfloat light_position[] = + {1.0, 0.0, 0.0, 0.0}; + GLfloat global_ambient[] = + {0.75, 0.75, 0.75, 1.0}; + + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient); + + glFrontFace(GL_CW); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); +} + +void +display(void) +{ + GLfloat low_ambient[] = + {0.1, 0.1, 0.1, 1.0}; + GLfloat more_ambient[] = + {0.4, 0.4, 0.4, 1.0}; + GLfloat most_ambient[] = + {1.0, 1.0, 1.0, 1.0}; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* material has small ambient reflection */ + glMaterialfv(GL_FRONT, GL_AMBIENT, low_ambient); + glMaterialf(GL_FRONT, GL_SHININESS, 40.0); + glPushMatrix(); + glTranslatef(0.0, 2.0, 0.0); + glutSolidTeapot(1.0); + glPopMatrix(); + + /* material has moderate ambient reflection */ + glMaterialfv(GL_FRONT, GL_AMBIENT, more_ambient); + glPushMatrix(); + glTranslatef(0.0, 0.0, 0.0); + glutSolidTeapot(1.0); + glPopMatrix(); + + /* material has large ambient reflection */ + glMaterialfv(GL_FRONT, GL_AMBIENT, most_ambient); + glPushMatrix(); + glTranslatef(0.0, -2.0, 0.0); + glutSolidTeapot(1.0); + glPopMatrix(); + glFlush(); +} + +void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(-4.0, 4.0, -4.0 * (GLfloat) h / (GLfloat) w, + 4.0 * (GLfloat) h / (GLfloat) w, -10.0, 10.0); + else + glOrtho(-4.0 * (GLfloat) w / (GLfloat) h, + 4.0 * (GLfloat) w / (GLfloat) h, -4.0, 4.0, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(500, 500); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/teapots.c b/xc/extras/Mesa/book/teapots.c new file mode 100644 index 000000000..edca5441e --- /dev/null +++ b/xc/extras/Mesa/book/teapots.c @@ -0,0 +1,220 @@ + +/* 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. + */ +/** + * teapots.c + * This program demonstrates lots of material properties. + * A single light source illuminates the objects. + */ +#include <stdlib.h> +#include <GL/glut.h> + +/* + * Initialize depth buffer, projection matrix, light source, and lighting + * model. Do not specify a material property here. + */ +void +myinit(void) +{ + GLfloat ambient[] = + {0.0, 0.0, 0.0, 1.0}; + GLfloat diffuse[] = + {1.0, 1.0, 1.0, 1.0}; + GLfloat position[] = + {0.0, 3.0, 3.0, 0.0}; + + GLfloat lmodel_ambient[] = + {0.2, 0.2, 0.2, 1.0}; + GLfloat local_view[] = + {0.0}; + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); + + glFrontFace(GL_CW); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); +} + +/* + * Move object into position. Use 3rd through 12th parameters to specify the + * material property. Draw a teapot. + */ +void +renderTeapot(GLfloat x, GLfloat y, + GLfloat ambr, GLfloat ambg, GLfloat ambb, + GLfloat difr, GLfloat difg, GLfloat difb, + GLfloat specr, GLfloat specg, GLfloat specb, GLfloat shine) +{ + float mat[4]; + + glPushMatrix(); + glTranslatef(x, y, 0.0); + mat[0] = ambr; + mat[1] = ambg; + mat[2] = ambb; + mat[3] = 1.0; + glMaterialfv(GL_FRONT, GL_AMBIENT, mat); + mat[0] = difr; + mat[1] = difg; + mat[2] = difb; + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat); + mat[0] = specr; + mat[1] = specg; + mat[2] = specb; + glMaterialfv(GL_FRONT, GL_SPECULAR, mat); + glMaterialf(GL_FRONT, GL_SHININESS, shine * 128.0); + glutSolidTeapot(1.0); + glPopMatrix(); +} + +/** + * First column: emerald, jade, obsidian, pearl, ruby, turquoise + * 2nd column: brass, bronze, chrome, copper, gold, silver + * 3rd column: black, cyan, green, red, white, yellow plastic + * 4th column: black, cyan, green, red, white, yellow rubber + */ +void +display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + renderTeapot(2.0, 17.0, 0.0215, 0.1745, 0.0215, + 0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6); + renderTeapot(2.0, 14.0, 0.135, 0.2225, 0.1575, + 0.54, 0.89, 0.63, 0.316228, 0.316228, 0.316228, 0.1); + renderTeapot(2.0, 11.0, 0.05375, 0.05, 0.06625, + 0.18275, 0.17, 0.22525, 0.332741, 0.328634, 0.346435, 0.3); + renderTeapot(2.0, 8.0, 0.25, 0.20725, 0.20725, + 1, 0.829, 0.829, 0.296648, 0.296648, 0.296648, 0.088); + renderTeapot(2.0, 5.0, 0.1745, 0.01175, 0.01175, + 0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 0.6); + renderTeapot(2.0, 2.0, 0.1, 0.18725, 0.1745, + 0.396, 0.74151, 0.69102, 0.297254, 0.30829, 0.306678, 0.1); + renderTeapot(6.0, 17.0, 0.329412, 0.223529, 0.027451, + 0.780392, 0.568627, 0.113725, 0.992157, 0.941176, 0.807843, + 0.21794872); + renderTeapot(6.0, 14.0, 0.2125, 0.1275, 0.054, + 0.714, 0.4284, 0.18144, 0.393548, 0.271906, 0.166721, 0.2); + renderTeapot(6.0, 11.0, 0.25, 0.25, 0.25, + 0.4, 0.4, 0.4, 0.774597, 0.774597, 0.774597, 0.6); + renderTeapot(6.0, 8.0, 0.19125, 0.0735, 0.0225, + 0.7038, 0.27048, 0.0828, 0.256777, 0.137622, 0.086014, 0.1); + renderTeapot(6.0, 5.0, 0.24725, 0.1995, 0.0745, + 0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4); + renderTeapot(6.0, 2.0, 0.19225, 0.19225, 0.19225, + 0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4); + renderTeapot(10.0, 17.0, 0.0, 0.0, 0.0, 0.01, 0.01, 0.01, + 0.50, 0.50, 0.50, .25); + renderTeapot(10.0, 14.0, 0.0, 0.1, 0.06, 0.0, 0.50980392, 0.50980392, + 0.50196078, 0.50196078, 0.50196078, .25); + renderTeapot(10.0, 11.0, 0.0, 0.0, 0.0, + 0.1, 0.35, 0.1, 0.45, 0.55, 0.45, .25); + renderTeapot(10.0, 8.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, + 0.7, 0.6, 0.6, .25); + renderTeapot(10.0, 5.0, 0.0, 0.0, 0.0, 0.55, 0.55, 0.55, + 0.70, 0.70, 0.70, .25); + renderTeapot(10.0, 2.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, + 0.60, 0.60, 0.50, .25); + renderTeapot(14.0, 17.0, 0.02, 0.02, 0.02, 0.01, 0.01, 0.01, + 0.4, 0.4, 0.4, .078125); + renderTeapot(14.0, 14.0, 0.0, 0.05, 0.05, 0.4, 0.5, 0.5, + 0.04, 0.7, 0.7, .078125); + renderTeapot(14.0, 11.0, 0.0, 0.05, 0.0, 0.4, 0.5, 0.4, + 0.04, 0.7, 0.04, .078125); + renderTeapot(14.0, 8.0, 0.05, 0.0, 0.0, 0.5, 0.4, 0.4, + 0.7, 0.04, 0.04, .078125); + renderTeapot(14.0, 5.0, 0.05, 0.05, 0.05, 0.5, 0.5, 0.5, + 0.7, 0.7, 0.7, .078125); + renderTeapot(14.0, 2.0, 0.05, 0.05, 0.0, 0.5, 0.5, 0.4, + 0.7, 0.7, 0.04, .078125); + glFlush(); +} + +void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(0.0, 16.0, 0.0, 16.0 * (GLfloat) h / (GLfloat) w, + -10.0, 10.0); + else + glOrtho(0.0, 16.0 * (GLfloat) w / (GLfloat) h, 0.0, 16.0, + -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* + * Main Loop Open window with initial window size, title bar, RGBA display + * mode, and handle input events. + */ +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow(argv[0]); + myinit(); + glutReshapeFunc(myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/tess.c b/xc/extras/Mesa/book/tess.c new file mode 100644 index 000000000..eb94653f2 --- /dev/null +++ b/xc/extras/Mesa/book/tess.c @@ -0,0 +1,241 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * tess.c + * This program demonstrates polygon tessellation. + * Two tesselated objects are drawn. The first is a + * rectangle with a triangular hole. The second is a + * smooth shaded, self-intersecting star. + * + * Note the exterior rectangle is drawn with its vertices + * in counter-clockwise order, but its interior clockwise. + * Note the combineCallback is needed for the self-intersecting + * star. Also note that removing the TessProperty for the + * star will make the interior unshaded (WINDING_ODD). + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +#ifdef GLU_VERSION_1_2 + +/* Win32 calling conventions. */ +#ifndef CALLBACK +#define CALLBACK +#endif + +GLuint startList; + +void display (void) { + glClear(GL_COLOR_BUFFER_BIT); + glColor3f(1.0, 1.0, 1.0); + glCallList(startList); + glCallList(startList + 1); + glFlush(); +} + +void CALLBACK beginCallback(GLenum which) +{ + glBegin(which); +} + +void CALLBACK errorCallback(GLenum errorCode) +{ + const GLubyte *estring; + + estring = gluErrorString(errorCode); + fprintf(stderr, "Tessellation Error: %s\n", estring); + exit(0); +} + +void CALLBACK endCallback(void) +{ + glEnd(); +} + +void CALLBACK vertexCallback(GLvoid *vertex) +{ + const GLdouble *pointer; + + pointer = (GLdouble *) vertex; + glColor3dv(pointer+3); + glVertex3dv(vertex); +} + +/* combineCallback is used to create a new vertex when edges + * intersect. coordinate location is trivial to calculate, + * but weight[4] may be used to average color, normal, or texture + * coordinate data. In this program, color is weighted. + */ +void CALLBACK combineCallback(GLdouble coords[3], + GLdouble *vertex_data[4], + GLfloat weight[4], GLdouble **dataOut ) +{ + GLdouble *vertex; + int i; + + vertex = (GLdouble *) malloc(6 * sizeof(GLdouble)); + + vertex[0] = coords[0]; + vertex[1] = coords[1]; + vertex[2] = coords[2]; + for (i = 3; i < 6; i++) + vertex[i] = weight[0] * vertex_data[0][i] + + weight[1] * vertex_data[1][i] + + weight[2] * vertex_data[2][i] + + weight[3] * vertex_data[3][i]; + *dataOut = vertex; +} + +void init (void) +{ + GLUtesselator *tobj; + GLdouble rect[4][3] = {{50.0, 50.0, 0.0}, + {200.0, 50.0, 0.0}, + {200.0, 200.0, 0.0}, + {50.0, 200.0, 0.0}}; + GLdouble tri[3][3] = {{75.0, 75.0, 0.0}, + {125.0, 175.0, 0.0}, + {175.0, 75.0, 0.0}}; + GLdouble star[5][6] = {{250.0, 50.0, 0.0, 1.0, 0.0, 1.0}, + {325.0, 200.0, 0.0, 1.0, 1.0, 0.0}, + {400.0, 50.0, 0.0, 0.0, 1.0, 1.0}, + {250.0, 150.0, 0.0, 1.0, 0.0, 0.0}, + {400.0, 150.0, 0.0, 0.0, 1.0, 0.0}}; + + glClearColor(0.0, 0.0, 0.0, 0.0); + + startList = glGenLists(2); + + tobj = gluNewTess(); + gluTessCallback(tobj, GLU_TESS_VERTEX, + (GLvoid (CALLBACK*) ()) &glVertex3dv); + gluTessCallback(tobj, GLU_TESS_BEGIN, + (GLvoid (CALLBACK*) ()) &beginCallback); + gluTessCallback(tobj, GLU_TESS_END, + (GLvoid (CALLBACK*) ()) &endCallback); + gluTessCallback(tobj, GLU_TESS_ERROR, + (GLvoid (CALLBACK*) ()) &errorCallback); + + /* rectangle with triangular hole inside */ + glNewList(startList, GL_COMPILE); + glShadeModel(GL_FLAT); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + gluTessVertex(tobj, rect[0], rect[0]); + gluTessVertex(tobj, rect[1], rect[1]); + gluTessVertex(tobj, rect[2], rect[2]); + gluTessVertex(tobj, rect[3], rect[3]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + gluTessVertex(tobj, tri[0], tri[0]); + gluTessVertex(tobj, tri[1], tri[1]); + gluTessVertex(tobj, tri[2], tri[2]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + glEndList(); + + gluTessCallback(tobj, GLU_TESS_VERTEX, + (GLvoid (CALLBACK*) ()) &vertexCallback); + gluTessCallback(tobj, GLU_TESS_BEGIN, + (GLvoid (CALLBACK*) ()) &beginCallback); + gluTessCallback(tobj, GLU_TESS_END, + (GLvoid (CALLBACK*) ()) &endCallback); + gluTessCallback(tobj, GLU_TESS_ERROR, + (GLvoid (CALLBACK*) ()) &errorCallback); + gluTessCallback(tobj, GLU_TESS_COMBINE, + (GLvoid (CALLBACK*) ()) &combineCallback); + + /* smooth shaded, self-intersecting star */ + glNewList(startList + 1, GL_COMPILE); + glShadeModel(GL_SMOOTH); + gluTessProperty(tobj, GLU_TESS_WINDING_RULE, + GLU_TESS_WINDING_POSITIVE); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + gluTessVertex(tobj, star[0], star[0]); + gluTessVertex(tobj, star[1], star[1]); + gluTessVertex(tobj, star[2], star[2]); + gluTessVertex(tobj, star[3], star[3]); + gluTessVertex(tobj, star[4], star[4]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + glEndList(); + gluDeleteTess(tobj); +} + +void reshape (int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0.0, (GLdouble) w, 0.0, (GLdouble) h); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(500, 500); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} + +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates the new tesselator API in GLU 1.2.\n"); + fprintf (stderr, "Your GLU library does not support this new interface, sorry.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/tesswind.c b/xc/extras/Mesa/book/tesswind.c new file mode 100644 index 000000000..86639d488 --- /dev/null +++ b/xc/extras/Mesa/book/tesswind.c @@ -0,0 +1,290 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * tesswind.c + * This program demonstrates the winding rule polygon + * tessellation property. Four tessellated objects are drawn, + * each with very different contours. When the w key is pressed, + * the objects are drawn with a different winding rule. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +#ifdef GLU_VERSION_1_2 + +/* Win32 calling conventions. */ +#ifndef CALLBACK +#define CALLBACK +#endif + +GLdouble currentWinding = GLU_TESS_WINDING_ODD; +int currentShape = 0; +GLUtesselator *tobj; +GLuint list; + +/* Make four display lists, + * each with a different tessellated object. + */ +void makeNewLists (void) { + int i; + static GLdouble rects[12][3] = + {{ 50.0, 50.0, 0.0}, {300.0, 50.0, 0.0}, + {300.0, 300.0, 0.0}, { 50.0, 300.0, 0.0}, + {100.0, 100.0, 0.0}, {250.0, 100.0, 0.0}, + {250.0, 250.0, 0.0}, {100.0, 250.0, 0.0}, + {150.0, 150.0, 0.0}, {200.0, 150.0, 0.0}, + {200.0, 200.0, 0.0}, {150.0, 200.0, 0.0}}; + static GLdouble spiral[16][3] = + {{400.0, 250.0, 0.0}, {400.0, 50.0, 0.0}, + { 50.0, 50.0, 0.0}, { 50.0, 400.0, 0.0}, + {350.0, 400.0, 0.0}, {350.0, 100.0, 0.0}, + {100.0, 100.0, 0.0}, {100.0, 350.0, 0.0}, + {300.0, 350.0, 0.0}, {300.0, 150.0, 0.0}, + {150.0, 150.0, 0.0}, {150.0, 300.0, 0.0}, + {250.0, 300.0, 0.0}, {250.0, 200.0, 0.0}, + {200.0, 200.0, 0.0}, {200.0, 250.0, 0.0}}; + static GLdouble quad1[4][3] = + {{ 50.0, 150.0, 0.0}, {350.0, 150.0, 0.0}, + {350.0, 200.0, 0.0}, { 50.0, 200.0, 0.0}}; + static GLdouble quad2[4][3] = + {{100.0, 100.0, 0.0}, {300.0, 100.0, 0.0}, + {300.0, 350.0, 0.0}, {100.0, 350.0, 0.0}}; + static GLdouble tri[3][3] = + {{200.0, 50.0, 0.0}, {250.0, 300.0, 0.0}, + {150.0, 300.0, 0.0}}; + + gluTessProperty(tobj, GLU_TESS_WINDING_RULE, + currentWinding); + + glNewList(list, GL_COMPILE); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + for (i = 0; i < 4; i++) + gluTessVertex(tobj, rects[i], rects[i]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + for (i = 4; i < 8; i++) + gluTessVertex(tobj, rects[i], rects[i]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + for (i = 8; i < 12; i++) + gluTessVertex(tobj, rects[i], rects[i]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + glEndList(); + + glNewList(list+1, GL_COMPILE); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + for (i = 0; i < 4; i++) + gluTessVertex(tobj, rects[i], rects[i]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + for (i = 7; i >= 4; i--) + gluTessVertex(tobj, rects[i], rects[i]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + for (i = 11; i >= 8; i--) + gluTessVertex(tobj, rects[i], rects[i]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + glEndList(); + + glNewList(list+2, GL_COMPILE); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + for (i = 0; i < 16; i++) + gluTessVertex(tobj, spiral[i], spiral[i]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + glEndList(); + + glNewList(list+3, GL_COMPILE); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + for (i = 0; i < 4; i++) + gluTessVertex(tobj, quad1[i], quad1[i]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + for (i = 0; i < 4; i++) + gluTessVertex(tobj, quad2[i], quad2[i]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + for (i = 0; i < 3; i++) + gluTessVertex(tobj, tri[i], tri[i]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + glEndList(); +} + +void display (void) { + glClear(GL_COLOR_BUFFER_BIT); + glColor3f(1.0, 1.0, 1.0); + glPushMatrix(); + glCallList(list); + glTranslatef(0.0, 500.0, 0.0); + glCallList(list+1); + glTranslatef(500.0, -500.0, 0.0); + glCallList(list+2); + glTranslatef(0.0, 500.0, 0.0); + glCallList(list+3); + glPopMatrix(); + glFlush(); +} + +void CALLBACK beginCallback(GLenum which) +{ + glBegin(which); +} + +void CALLBACK errorCallback(GLenum errorCode) +{ + const GLubyte *estring; + + estring = gluErrorString(errorCode); + fprintf(stderr, "Tessellation Error: %s\n", estring); + exit(0); +} + +void CALLBACK endCallback(void) +{ + glEnd(); +} + +/* combineCallback is used to create a new vertex when edges + * intersect. coordinate location is trivial to calculate, + * but weight[4] may be used to average color, normal, or texture + * coordinate data. + */ +/* ARGSUSED */ +void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4], + GLfloat weight[4], GLdouble **dataOut ) +{ + GLdouble *vertex; + vertex = (GLdouble *) malloc(3 * sizeof(GLdouble)); + + vertex[0] = coords[0]; + vertex[1] = coords[1]; + vertex[2] = coords[2]; + *dataOut = vertex; +} + +void init(void) +{ + glClearColor(0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + + tobj = gluNewTess(); + gluTessCallback(tobj, GLU_TESS_VERTEX, + (GLvoid (CALLBACK*) ()) &glVertex3dv); + gluTessCallback(tobj, GLU_TESS_BEGIN, + (GLvoid (CALLBACK*) ()) &beginCallback); + gluTessCallback(tobj, GLU_TESS_END, + (GLvoid (CALLBACK*) ()) &endCallback); + gluTessCallback(tobj, GLU_TESS_ERROR, + (GLvoid (CALLBACK*) ()) &errorCallback); + gluTessCallback(tobj, GLU_TESS_COMBINE, + (GLvoid (CALLBACK*) ()) &combineCallback); + + list = glGenLists(4); + makeNewLists(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + gluOrtho2D(0.0, 1000.0, 0.0, 1000.0 * (GLdouble)h/(GLdouble)w); + else + gluOrtho2D(0.0, 1000.0 * (GLdouble)w/(GLdouble)h, 0.0, 1000.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 'w': + case 'W': + if (currentWinding == GLU_TESS_WINDING_ODD) + currentWinding = GLU_TESS_WINDING_NONZERO; + else if (currentWinding == GLU_TESS_WINDING_NONZERO) + currentWinding = GLU_TESS_WINDING_POSITIVE; + else if (currentWinding == GLU_TESS_WINDING_POSITIVE) + currentWinding = GLU_TESS_WINDING_NEGATIVE; + else if (currentWinding == GLU_TESS_WINDING_NEGATIVE) + currentWinding = GLU_TESS_WINDING_ABS_GEQ_TWO; + else if (currentWinding == GLU_TESS_WINDING_ABS_GEQ_TWO) + currentWinding = GLU_TESS_WINDING_ODD; + makeNewLists(); + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(500, 500); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} + +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates the new tesselator API in GLU 1.2.\n"); + fprintf (stderr, "Your GLU library does not support this new interface, sorry.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/texbind.c b/xc/extras/Mesa/book/texbind.c new file mode 100644 index 000000000..6a828ab2b --- /dev/null +++ b/xc/extras/Mesa/book/texbind.c @@ -0,0 +1,171 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* texbind.c + * This program demonstrates using glBindTexture() by + * creating and managing two textures. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +#ifdef GL_VERSION_1_1 +/* Create checkerboard texture */ +#define checkImageWidth 64 +#define checkImageHeight 64 +static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; +static GLubyte otherImage[checkImageHeight][checkImageWidth][4]; + +static GLuint texName[2]; + +void makeCheckImages(void) +{ + int i, j, c; + + for (i = 0; i < checkImageHeight; i++) { + for (j = 0; j < checkImageWidth; j++) { + c = ((((i&0x8)==0)^((j&0x8)==0)))*255; + checkImage[i][j][0] = (GLubyte) c; + checkImage[i][j][1] = (GLubyte) c; + checkImage[i][j][2] = (GLubyte) c; + checkImage[i][j][3] = (GLubyte) 255; + c = ((((i&0x10)==0)^((j&0x10)==0)))*255; + otherImage[i][j][0] = (GLubyte) c; + otherImage[i][j][1] = (GLubyte) 0; + otherImage[i][j][2] = (GLubyte) 0; + otherImage[i][j][3] = (GLubyte) 255; + } + } +} + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + + makeCheckImages(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glGenTextures(2, texName); + glBindTexture(GL_TEXTURE_2D, texName[0]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, + checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, + checkImage); + + glBindTexture(GL_TEXTURE_2D, texName[1]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, + checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, + otherImage); + glEnable(GL_TEXTURE_2D); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glBindTexture(GL_TEXTURE_2D, texName[0]); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(1.0, 1.0); glVertex3f(0.0, 1.0, 0.0); + glTexCoord2f(1.0, 0.0); glVertex3f(0.0, -1.0, 0.0); + glEnd(); + glBindTexture(GL_TEXTURE_2D, texName[1]); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(1.0, -1.0, 0.0); + glTexCoord2f(0.0, 1.0); glVertex3f(1.0, 1.0, 0.0); + glTexCoord2f(1.0, 1.0); glVertex3f(2.41421, 1.0, -1.41421); + glTexCoord2f(1.0, 0.0); glVertex3f(2.41421, -1.0, -1.41421); + glEnd(); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 30.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -3.6); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(250, 250); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + init(); + glutReshapeFunc(reshape); + glutDisplayFunc(display); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates a feature which is not in OpenGL Version 1.0.\n"); + fprintf (stderr, "If your implementation of OpenGL Version 1.0 has the right extensions,\n"); + fprintf (stderr, "you may be able to modify this program to make it run.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/texgen.c b/xc/extras/Mesa/book/texgen.c new file mode 100644 index 000000000..7c1802a3b --- /dev/null +++ b/xc/extras/Mesa/book/texgen.c @@ -0,0 +1,207 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* texgen.c + * This program draws a texture mapped teapot with + * automatically generated texture coordinates. The + * texture is rendered as stripes on the teapot. + * Initially, the object is drawn with texture coordinates + * based upon the object coordinates of the vertex + * and distance from the plane x = 0. Pressing the 'e' + * key changes the coordinate generation to eye coordinates + * of the vertex. Pressing the 'o' key switches it back + * to the object coordinates. Pressing the 's' key + * changes the plane to a slanted one (x + y + z = 0). + * Pressing the 'x' key switches it back to x = 0. + */ + +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +#define stripeImageWidth 32 +GLubyte stripeImage[4*stripeImageWidth]; + +#ifdef GL_VERSION_1_1 +static GLuint texName; +#endif + +void makeStripeImage(void) +{ + int j; + + for (j = 0; j < stripeImageWidth; j++) { + stripeImage[4*j] = (GLubyte) ((j<=4) ? 255 : 0); + stripeImage[4*j+1] = (GLubyte) ((j>4) ? 255 : 0); + stripeImage[4*j+2] = (GLubyte) 0; + stripeImage[4*j+3] = (GLubyte) 255; + } +} + +/* planes for texture coordinate generation */ +static GLfloat xequalzero[] = {1.0, 0.0, 0.0, 0.0}; +static GLfloat slanted[] = {1.0, 1.0, 1.0, 0.0}; +static GLfloat *currentCoeff; +static GLenum currentPlane; +static GLint currentGenMode; + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glEnable(GL_DEPTH_TEST); + glShadeModel(GL_SMOOTH); + + makeStripeImage(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + +#ifdef GL_VERSION_1_1 + glGenTextures(1, &texName); + glBindTexture(GL_TEXTURE_1D, texName); +#endif + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +#ifdef GL_VERSION_1_1 + glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, stripeImageWidth, 0, + GL_RGBA, GL_UNSIGNED_BYTE, stripeImage); +#else + glTexImage1D(GL_TEXTURE_1D, 0, 4, stripeImageWidth, 0, + GL_RGBA, GL_UNSIGNED_BYTE, stripeImage); +#endif + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + currentCoeff = xequalzero; + currentGenMode = GL_OBJECT_LINEAR; + currentPlane = GL_OBJECT_PLANE; + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, currentGenMode); + glTexGenfv(GL_S, currentPlane, currentCoeff); + + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_1D); + glEnable(GL_CULL_FACE); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + glFrontFace(GL_CW); + glCullFace(GL_BACK); + glMaterialf (GL_FRONT, GL_SHININESS, 64.0); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glRotatef(45.0, 0.0, 0.0, 1.0); +#ifdef GL_VERSION_1_1 + glBindTexture(GL_TEXTURE_1D, texName); +#endif + glutSolidTeapot(2.0); + glPopMatrix (); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho (-3.5, 3.5, -3.5*(GLfloat)h/(GLfloat)w, + 3.5*(GLfloat)h/(GLfloat)w, -3.5, 3.5); + else + glOrtho (-3.5*(GLfloat)w/(GLfloat)h, + 3.5*(GLfloat)w/(GLfloat)h, -3.5, 3.5, -3.5, 3.5); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +/* ARGSUSED1 */ +void keyboard (unsigned char key, int x, int y) +{ + switch (key) { + case 'e': + case 'E': + currentGenMode = GL_EYE_LINEAR; + currentPlane = GL_EYE_PLANE; + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, currentGenMode); + glTexGenfv(GL_S, currentPlane, currentCoeff); + glutPostRedisplay(); + break; + case 'o': + case 'O': + currentGenMode = GL_OBJECT_LINEAR; + currentPlane = GL_OBJECT_PLANE; + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, currentGenMode); + glTexGenfv(GL_S, currentPlane, currentCoeff); + glutPostRedisplay(); + break; + case 's': + case 'S': + currentCoeff = slanted; + glTexGenfv(GL_S, currentPlane, currentCoeff); + glutPostRedisplay(); + break; + case 'x': + case 'X': + currentCoeff = xequalzero; + glTexGenfv(GL_S, currentPlane, currentCoeff); + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(256, 256); + glutInitWindowPosition(100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/texprox.c b/xc/extras/Mesa/book/texprox.c new file mode 100644 index 000000000..6f1e853fa --- /dev/null +++ b/xc/extras/Mesa/book/texprox.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * texprox.c + * The brief program illustrates use of texture proxies. + * This program only prints out some messages about whether + * certain size textures are supported and then exits. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +#ifdef GL_VERSION_1_1 + +/* Microsoft OpenGL 1.1's <GL/gl.h> forgets to define + GL_TEXTURE_INTERNAL_FORMAT. */ +#ifndef GL_TEXTURE_INTERNAL_FORMAT +#define GL_TEXTURE_INTERNAL_FORMAT GL_TEXTURE_COMPONENTS +#endif + +void init(void) +{ + GLint proxyComponents; + + putchar('\n'); + + glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA8, + 64, 64, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, + GL_TEXTURE_INTERNAL_FORMAT, &proxyComponents); + printf ("Proxying 64x64 level 0 RGBA8 texture (level 0)\n"); + if (proxyComponents == GL_RGBA8) + printf ("proxy allocation succeeded\n"); + else + printf ("proxy allocation failed\n"); + putchar('\n'); + + glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA16, + 2048, 2048, 0, + GL_RGBA, GL_UNSIGNED_SHORT, NULL); + glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, + GL_TEXTURE_INTERNAL_FORMAT, &proxyComponents); + printf ("Proxying 2048x2048 level 0 RGBA16 texture (big so unlikely to be supported)\n"); + if (proxyComponents == GL_RGBA16) + printf ("proxy allocation succeeded\n"); + else + printf ("proxy allocation failed\n"); + putchar('\n'); +} + +void display(void) +{ + exit(0); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutMainLoop(); + return 0; +} +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates a feature which is not in OpenGL Version 1.0.\n"); + fprintf (stderr, "If your implementation of OpenGL Version 1.0 has the right extensions,\n"); + fprintf (stderr, "you may be able to modify this program to make it run.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/texsub.c b/xc/extras/Mesa/book/texsub.c new file mode 100644 index 000000000..4e829675a --- /dev/null +++ b/xc/extras/Mesa/book/texsub.c @@ -0,0 +1,187 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* texsub.c + * This program texture maps a checkerboard image onto + * two rectangles. This program clamps the texture, if + * the texture coordinates fall outside 0.0 and 1.0. + * If the s key is pressed, a texture subimage is used to + * alter the original texture. If the r key is pressed, + * the original texture is restored. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +#ifdef GL_VERSION_1_1 +/* Create checkerboard textures */ +#define checkImageWidth 64 +#define checkImageHeight 64 +#define subImageWidth 16 +#define subImageHeight 16 +static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; +static GLubyte subImage[subImageHeight][subImageWidth][4]; + +static GLuint texName; + +void makeCheckImages(void) +{ + int i, j, c; + + for (i = 0; i < checkImageHeight; i++) { + for (j = 0; j < checkImageWidth; j++) { + c = ((((i&0x8)==0)^((j&0x8)==0)))*255; + checkImage[i][j][0] = (GLubyte) c; + checkImage[i][j][1] = (GLubyte) c; + checkImage[i][j][2] = (GLubyte) c; + checkImage[i][j][3] = (GLubyte) 255; + } + } + for (i = 0; i < subImageHeight; i++) { + for (j = 0; j < subImageWidth; j++) { + c = ((((i&0x4)==0)^((j&0x4)==0)))*255; + subImage[i][j][0] = (GLubyte) c; + subImage[i][j][1] = (GLubyte) 0; + subImage[i][j][2] = (GLubyte) 0; + subImage[i][j][3] = (GLubyte) 255; + } + } +} + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + + makeCheckImages(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glGenTextures(1, &texName); + glBindTexture(GL_TEXTURE_2D, texName); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight, + 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage); +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glBindTexture(GL_TEXTURE_2D, texName); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(1.0, 1.0); glVertex3f(0.0, 1.0, 0.0); + glTexCoord2f(1.0, 0.0); glVertex3f(0.0, -1.0, 0.0); + + glTexCoord2f(0.0, 0.0); glVertex3f(1.0, -1.0, 0.0); + glTexCoord2f(0.0, 1.0); glVertex3f(1.0, 1.0, 0.0); + glTexCoord2f(1.0, 1.0); glVertex3f(2.41421, 1.0, -1.41421); + glTexCoord2f(1.0, 0.0); glVertex3f(2.41421, -1.0, -1.41421); + glEnd(); + glFlush(); + glDisable(GL_TEXTURE_2D); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 30.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -3.6); +} + +/* ARGSUSED1 */ +void keyboard (unsigned char key, int x, int y) +{ + switch (key) { + case 's': + case 'S': + glBindTexture(GL_TEXTURE_2D, texName); + glTexSubImage2D(GL_TEXTURE_2D, 0, 12, 44, subImageWidth, + subImageHeight, GL_RGBA, + GL_UNSIGNED_BYTE, subImage); + glutPostRedisplay(); + break; + case 'r': + case 'R': + glBindTexture(GL_TEXTURE_2D, texName); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, + checkImageHeight, 0, GL_RGBA, + GL_UNSIGNED_BYTE, checkImage); + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(250, 250); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates a feature which is not in OpenGL Version 1.0.\n"); + fprintf (stderr, "If your implementation of OpenGL Version 1.0 has the right extensions,\n"); + fprintf (stderr, "you may be able to modify this program to make it run.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/texturesurf.c b/xc/extras/Mesa/book/texturesurf.c new file mode 100644 index 000000000..0170070ea --- /dev/null +++ b/xc/extras/Mesa/book/texturesurf.c @@ -0,0 +1,155 @@ + +/* 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. + */ +/* texturesurf.c + * This program uses evaluators to generate a curved + * surface and automatically generated texture coordinates. + */ + +#include <stdlib.h> +#include <GL/glut.h> +#include <math.h> + +GLfloat ctrlpoints[4][4][3] = { + {{ -1.5, -1.5, 4.0}, { -0.5, -1.5, 2.0}, + {0.5, -1.5, -1.0}, {1.5, -1.5, 2.0}}, + {{ -1.5, -0.5, 1.0}, { -0.5, -0.5, 3.0}, + {0.5, -0.5, 0.0}, {1.5, -0.5, -1.0}}, + {{ -1.5, 0.5, 4.0}, { -0.5, 0.5, 0.0}, + {0.5, 0.5, 3.0}, {1.5, 0.5, 4.0}}, + {{ -1.5, 1.5, -2.0}, { -0.5, 1.5, -2.0}, + {0.5, 1.5, 0.0}, {1.5, 1.5, -1.0}} +}; + +GLfloat texpts[2][2][2] = {{{0.0, 0.0}, {0.0, 1.0}}, + {{1.0, 0.0}, {1.0, 1.0}}}; + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glColor3f(1.0, 1.0, 1.0); + glEvalMesh2(GL_FILL, 0, 20, 0, 20); + glFlush(); +} + +#define imageWidth 64 +#define imageHeight 64 +GLubyte image[3*imageWidth*imageHeight]; + +void makeImage(void) +{ + int i, j; + float ti, tj; + + for (i = 0; i < imageWidth; i++) { + ti = 2.0*3.14159265*i/imageWidth; + for (j = 0; j < imageHeight; j++) { + tj = 2.0*3.14159265*j/imageHeight; + + image[3*(imageHeight*i+j)] = (GLubyte) 127*(1.0+sin(ti)); + image[3*(imageHeight*i+j)+1] = (GLubyte) 127*(1.0+cos(2*tj)); + image[3*(imageHeight*i+j)+2] = (GLubyte) 127*(1.0+cos(ti+tj)); + } + } +} + +void myinit(void) +{ + glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, + 0, 1, 12, 4, &ctrlpoints[0][0][0]); + glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, + 0, 1, 4, 2, &texpts[0][0][0]); + glEnable(GL_MAP2_TEXTURE_COORD_2); + glEnable(GL_MAP2_VERTEX_3); + glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0); + makeImage(); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, 3, imageWidth, imageHeight, 0, + GL_RGB, GL_UNSIGNED_BYTE, image); + glEnable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); + glEnable(GL_NORMALIZE); + glShadeModel (GL_FLAT); +} + +void myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glOrtho(-4.0, 4.0, -4.0*(GLfloat)h/(GLfloat)w, + 4.0*(GLfloat)h/(GLfloat)w, -4.0, 4.0); + else + glOrtho(-4.0*(GLfloat)w/(GLfloat)h, + 4.0*(GLfloat)w/(GLfloat)h, -4.0, 4.0, -4.0, 4.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glRotatef(85.0, 1.0, 1.0, 1.0); +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutCreateWindow (argv[0]); + myinit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/book/torus.c b/xc/extras/Mesa/book/torus.c new file mode 100644 index 000000000..7ae4d41e2 --- /dev/null +++ b/xc/extras/Mesa/book/torus.c @@ -0,0 +1,152 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * torus.c + * This program demonstrates the creation of a display list. + */ + +#include <GL/glut.h> +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +/* Some <math.h> files do not define M_PI... */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +GLuint theTorus; + +/* Draw a torus */ +static void torus(int numc, int numt) +{ + int i, j, k; + double s, t, x, y, z, twopi; + + twopi = 2 * (double)M_PI; + for (i = 0; i < numc; i++) { + glBegin(GL_QUAD_STRIP); + for (j = 0; j <= numt; j++) { + for (k = 1; k >= 0; k--) { + s = (i + k) % numc + 0.5; + t = j % numt; + + x = (1+.1*cos(s*twopi/numc))*cos(t*twopi/numt); + y = (1+.1*cos(s*twopi/numc))*sin(t*twopi/numt); + z = .1 * sin(s * twopi / numc); + glVertex3f(x, y, z); + } + } + glEnd(); + } +} + +/* Create display list with Torus and initialize state */ +static void init(void) +{ + theTorus = glGenLists (1); + glNewList(theTorus, GL_COMPILE); + torus(8, 25); + glEndList(); + + glShadeModel(GL_FLAT); + glClearColor(0.0, 0.0, 0.0, 0.0); +} + +/* Clear window and draw torus */ +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glColor3f (1.0, 1.0, 1.0); + glCallList(theTorus); + glFlush(); +} + +/* Handle window resize */ +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(30, (GLfloat) w/(GLfloat) h, 1.0, 100.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); +} + +/* Rotate about x-axis when "x" typed; rotate about y-axis + when "y" typed; "i" returns torus to original view */ +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 'x': + case 'X': + glRotatef(30.,1.0,0.0,0.0); + glutPostRedisplay(); + break; + case 'y': + case 'Y': + glRotatef(30.,0.0,1.0,0.0); + glutPostRedisplay(); + break; + case 'i': + case 'I': + glLoadIdentity(); + gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + } +} + +int main(int argc, char **argv) +{ + glutInitWindowSize(200, 200); + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutCreateWindow(argv[0]); + init(); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutDisplayFunc(display); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/trim.c b/xc/extras/Mesa/book/trim.c new file mode 100644 index 000000000..26f474814 --- /dev/null +++ b/xc/extras/Mesa/book/trim.c @@ -0,0 +1,187 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * trim.c + * This program draws a NURBS surface in the shape of a + * symmetrical hill, using both a NURBS curve and pwl + * (piecewise linear) curve to trim part of the surface. + */ +#include <stdlib.h> +#include <GL/glut.h> +#include <stdio.h> + + +#ifndef CALLBACK +#define CALLBACK +#endif + + +GLfloat ctlpoints[4][4][3]; + +GLUnurbsObj *theNurb; + +/* + * Initializes the control points of the surface to a small hill. + * The control points range from -3 to +3 in x, y, and z + */ +void init_surface(void) +{ + int u, v; + for (u = 0; u < 4; u++) { + for (v = 0; v < 4; v++) { + ctlpoints[u][v][0] = 2.0*((GLfloat)u - 1.5); + ctlpoints[u][v][1] = 2.0*((GLfloat)v - 1.5); + + if ( (u == 1 || u == 2) && (v == 1 || v == 2)) + ctlpoints[u][v][2] = 3.0; + else + ctlpoints[u][v][2] = -3.0; + } + } +} + +void nurbsError(GLenum errorCode) +{ + const GLubyte *estring; + + estring = gluErrorString(errorCode); + fprintf (stderr, "Nurbs Error: %s\n", estring); + exit (0); +} + +/* Initialize material property and depth buffer. + */ +void init(void) +{ + GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 }; + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 100.0 }; + + glClearColor (0.0, 0.0, 0.0, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + glEnable(GL_AUTO_NORMAL); + glEnable(GL_NORMALIZE); + + init_surface(); + + theNurb = gluNewNurbsRenderer(); + gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 25.0); + gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL); + gluNurbsCallback(theNurb, GLU_ERROR, + (GLvoid (CALLBACK*) ()) nurbsError); +} + +void display(void) +{ + GLfloat knots[8] = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0}; + GLfloat edgePt[5][2] = /* counter clockwise */ + {{0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0.0, 0.0}}; + GLfloat curvePt[4][2] = /* clockwise */ + {{0.25, 0.5}, {0.25, 0.75}, {0.75, 0.75}, {0.75, 0.5}}; + GLfloat curveKnots[8] = + {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0}; + GLfloat pwlPt[4][2] = /* clockwise */ + {{0.75, 0.5}, {0.5, 0.25}, {0.25, 0.5}}; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix(); + glRotatef(330.0, 1.,0.,0.); + glScalef (0.5, 0.5, 0.5); + + gluBeginSurface(theNurb); + gluNurbsSurface(theNurb, 8, knots, 8, knots, + 4 * 3, 3, &ctlpoints[0][0][0], + 4, 4, GL_MAP2_VERTEX_3); + gluBeginTrim (theNurb); + gluPwlCurve (theNurb, 5, &edgePt[0][0], 2, GLU_MAP1_TRIM_2); + gluEndTrim (theNurb); + gluBeginTrim (theNurb); + gluNurbsCurve (theNurb, 8, curveKnots, 2, + &curvePt[0][0], 4, GLU_MAP1_TRIM_2); + gluPwlCurve (theNurb, 3, &pwlPt[0][0], 2, GLU_MAP1_TRIM_2); + gluEndTrim (theNurb); + gluEndSurface(theNurb); + + glPopMatrix(); + glFlush(); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective (45.0, (GLdouble)w/(GLdouble)h, 3.0, 8.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef (0.0, 0.0, -5.0); +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* Main Loop + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow(argv[0]); + init(); + glutReshapeFunc(reshape); + glutDisplayFunc(display); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/unproject.c b/xc/extras/Mesa/book/unproject.c new file mode 100644 index 000000000..134c361ba --- /dev/null +++ b/xc/extras/Mesa/book/unproject.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * unproject.c + * When the left mouse button is pressed, this program + * reads the mouse position and determines two 3D points + * from which it was transformed. Very little is displayed. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glFlush(); +} + +/* Change these values for a different transformation */ +void reshape(int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective (45.0, (GLfloat) w/(GLfloat) h, 1.0, 100.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void mouse(int button, int state, int x, int y) +{ + GLint viewport[4]; + GLdouble mvmatrix[16], projmatrix[16]; + GLint realy; /* OpenGL y coordinate position */ + GLdouble wx, wy, wz; /* returned world x, y, z coords */ + + switch (button) { + case GLUT_LEFT_BUTTON: + if (state == GLUT_DOWN) { + glGetIntegerv (GL_VIEWPORT, viewport); + glGetDoublev (GL_MODELVIEW_MATRIX, mvmatrix); + glGetDoublev (GL_PROJECTION_MATRIX, projmatrix); +/* note viewport[3] is height of window in pixels */ + realy = viewport[3] - (GLint) y - 1; + printf ("Coordinates at cursor are (%4d, %4d)\n", x, realy); + gluUnProject ((GLdouble) x, (GLdouble) realy, 0.0, + mvmatrix, projmatrix, viewport, &wx, &wy, &wz); + printf ("World coords at z=0.0 are (%f, %f, %f)\n", + wx, wy, wz); + gluUnProject ((GLdouble) x, (GLdouble) realy, 1.0, + mvmatrix, projmatrix, viewport, &wx, &wy, &wz); + printf ("World coords at z=1.0 are (%f, %f, %f)\n", + wx, wy, wz); + } + break; + case GLUT_RIGHT_BUTTON: + if (state == GLUT_DOWN) + exit(0); + break; + default: + break; + } +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +/* + * Open window, register input callback functions + */ +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (500, 500); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc (keyboard); + glutMouseFunc(mouse); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/book/varray.c b/xc/extras/Mesa/book/varray.c new file mode 100644 index 000000000..b22e723e0 --- /dev/null +++ b/xc/extras/Mesa/book/varray.c @@ -0,0 +1,195 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* + * varray.c + * This program demonstrates vertex arrays. + */ +#include <GL/glut.h> +#include <stdio.h> +#include <stdlib.h> + +#ifdef GL_VERSION_1_1 +#define POINTER 1 +#define INTERLEAVED 2 + +#define DRAWARRAY 1 +#define ARRAYELEMENT 2 +#define DRAWELEMENTS 3 + +int setupMethod = POINTER; +int derefMethod = DRAWARRAY; + +void setupPointers(void) +{ + static GLint vertices[] = {25, 25, + 100, 325, + 175, 25, + 175, 325, + 250, 25, + 325, 325}; + static GLfloat colors[] = {1.0, 0.2, 0.2, + 0.2, 0.2, 1.0, + 0.8, 1.0, 0.2, + 0.75, 0.75, 0.75, + 0.35, 0.35, 0.35, + 0.5, 0.5, 0.5}; + + glEnableClientState (GL_VERTEX_ARRAY); + glEnableClientState (GL_COLOR_ARRAY); + + glVertexPointer (2, GL_INT, 0, vertices); + glColorPointer (3, GL_FLOAT, 0, colors); +} + +void setupInterleave(void) +{ + static GLfloat intertwined[] = + {1.0, 0.2, 1.0, 100.0, 100.0, 0.0, + 1.0, 0.2, 0.2, 0.0, 200.0, 0.0, + 1.0, 1.0, 0.2, 100.0, 300.0, 0.0, + 0.2, 1.0, 0.2, 200.0, 300.0, 0.0, + 0.2, 1.0, 1.0, 300.0, 200.0, 0.0, + 0.2, 0.2, 1.0, 200.0, 100.0, 0.0}; + + glInterleavedArrays (GL_C3F_V3F, 0, intertwined); +} + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel (GL_SMOOTH); + setupPointers (); +} + +void display(void) +{ + glClear (GL_COLOR_BUFFER_BIT); + + if (derefMethod == DRAWARRAY) + glDrawArrays (GL_TRIANGLES, 0, 6); + else if (derefMethod == ARRAYELEMENT) { + glBegin (GL_TRIANGLES); + glArrayElement (2); + glArrayElement (3); + glArrayElement (5); + glEnd (); + } + else if (derefMethod == DRAWELEMENTS) { + GLuint indices[4] = {0, 1, 3, 4}; + + glDrawElements (GL_POLYGON, 4, GL_UNSIGNED_INT, indices); + } + glFlush (); +} + +void reshape (int w, int h) +{ + glViewport (0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h); +} + +/* ARGSUSED2 */ +void mouse (int button, int state, int x, int y) +{ + switch (button) { + case GLUT_LEFT_BUTTON: + if (state == GLUT_DOWN) { + if (setupMethod == POINTER) { + setupMethod = INTERLEAVED; + setupInterleave(); + } + else if (setupMethod == INTERLEAVED) { + setupMethod = POINTER; + setupPointers(); + } + glutPostRedisplay(); + } + break; + case GLUT_MIDDLE_BUTTON: + case GLUT_RIGHT_BUTTON: + if (state == GLUT_DOWN) { + if (derefMethod == DRAWARRAY) + derefMethod = ARRAYELEMENT; + else if (derefMethod == ARRAYELEMENT) + derefMethod = DRAWELEMENTS; + else if (derefMethod == DRAWELEMENTS) + derefMethod = DRAWARRAY; + glutPostRedisplay(); + } + break; + default: + break; + } +} + +/* ARGSUSED1 */ +void keyboard(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize (350, 350); + glutInitWindowPosition (100, 100); + glutCreateWindow (argv[0]); + init (); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutMouseFunc(mouse); + glutKeyboardFunc (keyboard); + glutMainLoop(); + return 0; +} +#else +int main(int argc, char** argv) +{ + fprintf (stderr, "This program demonstrates a feature which is not in OpenGL Version 1.0.\n"); + fprintf (stderr, "If your implementation of OpenGL Version 1.0 has the right extensions,\n"); + fprintf (stderr, "you may be able to modify this program to make it run.\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/book/wrap.c b/xc/extras/Mesa/book/wrap.c new file mode 100644 index 000000000..f9a1f162a --- /dev/null +++ b/xc/extras/Mesa/book/wrap.c @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1993-1997, 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(R) is a registered trademark of Silicon Graphics, Inc. + */ + +/* wrap.c + * This program texture maps a checkerboard image onto + * two rectangles. This program demonstrates the wrapping + * modes, if the texture coordinates fall outside 0.0 and 1.0. + * Interaction: Pressing the 's' and 'S' keys switch the + * wrapping between clamping and repeating for the s parameter. + * The 't' and 'T' keys control the wrapping for the t parameter. + * + * If running this program on OpenGL 1.0, texture objects are + * not used. + */ +#include <GL/glut.h> +#include <stdlib.h> +#include <stdio.h> + +/* Create checkerboard texture */ +#define checkImageWidth 64 +#define checkImageHeight 64 +static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; + +#ifdef GL_VERSION_1_1 +static GLuint texName; +#endif + +void makeCheckImage(void) +{ + int i, j, c; + + for (i = 0; i < checkImageHeight; i++) { + for (j = 0; j < checkImageWidth; j++) { + c = (((i&0x8)==0)^((j&0x8)==0))*255; + checkImage[i][j][0] = (GLubyte) c; + checkImage[i][j][1] = (GLubyte) c; + checkImage[i][j][2] = (GLubyte) c; + checkImage[i][j][3] = (GLubyte) 255; + } + } +} + +void init(void) +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + + makeCheckImage(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + +#ifdef GL_VERSION_1_1 + glGenTextures(1, &texName); + glBindTexture(GL_TEXTURE_2D, texName); +#endif + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +#ifdef GL_VERSION_1_1 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight, + 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage); +#else + glTexImage2D(GL_TEXTURE_2D, 0, 4, checkImageWidth, checkImageHeight, + 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage); +#endif +} + +void display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); +#ifdef GL_VERSION_1_1 + glBindTexture(GL_TEXTURE_2D, texName); +#endif + + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, 3.0); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(3.0, 3.0); glVertex3f(0.0, 1.0, 0.0); + glTexCoord2f(3.0, 0.0); glVertex3f(0.0, -1.0, 0.0); + + glTexCoord2f(0.0, 0.0); glVertex3f(1.0, -1.0, 0.0); + glTexCoord2f(0.0, 3.0); glVertex3f(1.0, 1.0, 0.0); + glTexCoord2f(3.0, 3.0); glVertex3f(2.41421, 1.0, -1.41421); + glTexCoord2f(3.0, 0.0); glVertex3f(2.41421, -1.0, -1.41421); + glEnd(); + glFlush(); + glDisable(GL_TEXTURE_2D); +} + +void reshape(int w, int h) +{ + glViewport(0, 0, (GLsizei) w, (GLsizei) h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 30.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -3.6); +} + +/* ARGSUSED1 */ +void keyboard (unsigned char key, int x, int y) +{ + switch (key) { + case 's': + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glutPostRedisplay(); + break; + case 'S': + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glutPostRedisplay(); + break; + case 't': + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glutPostRedisplay(); + break; + case 'T': + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glutPostRedisplay(); + break; + case 27: + exit(0); + break; + default: + break; + } +} + +int main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize(250, 250); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + init(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/bootstrap b/xc/extras/Mesa/bootstrap new file mode 100755 index 000000000..d32d501da --- /dev/null +++ b/xc/extras/Mesa/bootstrap @@ -0,0 +1,13 @@ +#! /bin/sh + +# helps bootstrapping Mesa, when checked out from CVS +# requires GNU autoconf and GNU automake +# this is not meant to go into the distributions + +test -f ltmain.sh || libtoolize -c -f +aclocal -I . +autoheader +automake -a -c +autoconf + +exit 0 diff --git a/xc/extras/Mesa/commit b/xc/extras/Mesa/commit new file mode 100755 index 000000000..591aa1039 --- /dev/null +++ b/xc/extras/Mesa/commit @@ -0,0 +1,233 @@ +#! /bin/sh + +# commit version 0.9.2 + +# Copyright (C) 1999, Free Software Foundation + +# This script is Free Software, and it can be copied, distributed and +# modified as defined in the GNU General Public License. A copy of +# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html + +# Originally by Gary V. Vaughan <gvaughan@oranda.demon.co.uk> +# Heavily modified by Alexandre Oliva <oliva@dcc.unicamp.br> + +# This scripts eases checking in changes to CVS-maintained projects +# with ChangeLog files. It will check that there have been no +# conflicting commits in the CVS repository and print which files it +# is going to commit to stderr. A list of files to compare and to +# check in can be given in the command line. If it is not given, all +# files in the current directory (and below, unless `-l' is given) are +# considered for check in. + +# The commit message will be extracted from the differences between +# the local ChangeLog and the one in the repository (unless a message +# was specified with `-m' or `-F'). An empty message is not accepted +# (but a blank line is). If the message is acceptable, it will be +# presented for verification (and possible edition) using the $PAGER +# environment variable (or `more', if it is not set, or `cat', if the +# `-f' switch is given). If $PAGER exits successfully, the modified +# files (at that moment) are checked in, unless `-n' was specified, in +# which case nothing is checked in. + +# usage: commit [-v] [-h] [-f] [-l] [-n] [-q] [-z N] +# [-m msg|-F msg_file] [--] [file|dir ...] + +# -f --fast don't check (unless *followed* by -n), and just +# --force display commit message instead of running $PAGER +# -l --local don't descend into subdirectories +# -m msg --message=msg set commit message +# --msg=msg same as -m +# -F file --file=file read commit message from file +# -n --dry-run don't commit anything +# -q --quiet run cvs in quiet mode +# -zN --compress=N set compression level (0-9, 0=none, 9=max) +# -v --version print version information +# -h,-? --help print short or long help message + +name=commit +cvsopt= +updateopt= +commitopt= +dry_run=false +commit=: +update=: +log_file="${TMPDIR-/tmp}/commitlog.$$" + +rm -f "$log_file" +trap 'rm -f "$log_file"; exit 1' 1 2 15 + +# this just eases exit handling +main_repeat=":" +while $main_repeat; do + +repeat="test $# -gt 0" +while $repeat; do + case "$1" in + -f|--force|--fast) + update=false + PAGER=cat + shift + ;; + -l|--local) + updateopt="$updateopt -l" + commitopt="$commitopt -l" + shift + ;; + -m|--message|--msg) + if test $# = 1; then + echo "$name: missing argument for $1" >&2 + break + fi + if test -f "$log_file"; then + echo "$name: you can have at most one of -m and -F" >&2 + break + fi + shift + echo "$1" > "$log_file" + shift + ;; + -F|--file) + if test -f "$log_file"; then + echo "$name: you can have at most one of -m and -F" >&2 + break + fi + if test $# = 1; then + echo "$name: missing argument for $1" >&2 + break + fi + shift + if cat < "$1" > "$log_file"; then :; else + break + fi + shift + ;; + -n|--dry-run) + commit=false + update=true + shift + ;; + -q|--quiet) + cvsopt="$cvsopt -q" + shift + ;; + -z|--compress) + if test $# = 1; then + echo "$name: missing argument for $1" >&2 + break + fi + case "$2" in + [0-9]) :;; + *) echo "$name: invalid argument for $1" >&2 + break + ;; + esac + cvsopt="$cvsopt -z$2" + shift + shift + ;; + + -m*|-F*|-z*) + opt=`echo "$1" | sed '1s/^\(..\).*$/\1/;q'` + arg=`echo "$1" | sed '1s/^-[a-zA-Z0-9]//'` + shift + set -- "$opt" "$arg" ${1+"$@"} + ;; + --message=*|--msg=*|--file=*|--compress=*) + opt=`echo "$1" | sed '1s/^\(--[^=]*\)=.*/\1/;q'` + arg=`echo "$1" | sed '1s/^--[^=]*=//'` + shift + set -- "$opt" "$arg" ${1+"$@"} + ;; + + -v|--version) + sed '/^# '$name' version /,/^# Heavily modified by/ { s/^# //; p; }; d' < $0 + exit 0 + ;; + -\?|-h) + sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 && + echo + echo "run \`$name --help | more' for full usage" + exit 0 + ;; + --help) + sed '/^# '$name' version /,/^[^#]/ { /^[^#]/ d; s/^# //; p; }; d' < $0 + exit 0 + ;; + --) + shift + repeat=false + ;; + -*) + echo "$name: invalid flag $1" >&2 + break + ;; + *) + repeat=false + ;; + esac +done +# might have used break 2 within the previous loop, but so what +$repeat && break + +$update && \ +if echo "$name: checking for conflicts..." >&2 + (cvs $cvsopt -q -n update $updateopt ${1+"$@"} 2>/dev/null \ + | while read line; do + echo "$line" + echo "$line" >&3 + done | grep '^C') 3>&1 >/dev/null; then + echo "$name: some conflicts were found, aborting..." >&2 + break +fi + +if test ! -f "$log_file"; then + echo "$name: checking commit message..." >&2 + cvs $cvsopt diff -u ChangeLog \ + | while read line; do + case "$line" in + "--- ChangeLog"*) :;; + "-"*) + echo "$name: *** Warning: the following line in ChangeLog diff is suspicious:" >&2 + echo "$line" | sed 's/^.//' >&2;; + "+ "*) + echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2 + echo "$line" | sed 's/^.//' >&2;; + "+") echo;; + "+ "*) echo "$line";; + esac + done \ + | sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \ + || break +# The sed script above removes "+TAB" from the beginning of a line, then +# deletes the first and/or the last line, when they happen to be empty +fi + +if grep '[^ ]' < "$log_file" > /dev/null; then :; else + echo "$name: empty commit message, aborting" >&2 + break +fi + +if grep '^$' < "$log_file" > /dev/null; then + echo "$name: *** Warning: blank lines should not appear within a commit messages." >&2 + echo "$name: *** They should be used to separate distinct commits." >&2 +fi + +${PAGER-more} "$log_file" || break + +sleep 1 # give the user some time for a ^C + +# Do not check for empty $log_file again, even though the user might have +# zeroed it out. If s/he did, it was probably intentional. + +if $commit; then + cvs $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break +fi + +main_repeat=false +done + +rm -f "$log_file" + +# if main_repeat was not set to `false', we failed +$main_repeat && exit 1 +exit 0 diff --git a/xc/extras/Mesa/demos/.cvsignore b/xc/extras/Mesa/demos/.cvsignore new file mode 100644 index 000000000..28f2442ae --- /dev/null +++ b/xc/extras/Mesa/demos/.cvsignore @@ -0,0 +1,46 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +bounce +clearspd +cubemap +drawpix +fire +gamma +gears +geartrain +glinfo +gloss +gltestperf +glut +glutfx +ipers +isosurf +lodbias +morph3d +multiarb +occlude +osdemo +paltex +pixeltex +pointblast +ray +readpix +reflect +renormal +spectex +stex3d +teapot +terrain +tessdemo +texcyl +texenv +texdown +texobj +trispd +tunnel +tunnel2 +winpos diff --git a/xc/extras/Mesa/demos/Makefile.BeOS-R4 b/xc/extras/Mesa/demos/Makefile.BeOS-R4 new file mode 100644 index 000000000..0570d0e5c --- /dev/null +++ b/xc/extras/Mesa/demos/Makefile.BeOS-R4 @@ -0,0 +1,96 @@ +# $Id: Makefile.BeOS-R4,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# Copyright (C) 1995-2000 Brian Paul + + +# Makefile for GLUT-based demo programs for BeOS R4 + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = bounce \ + clearspd \ + cubemap \ + drawpix \ + fire \ + gamma \ + gears \ + geartrain \ + glinfo \ + gloss \ + gltestperf \ + glutfx \ + isosurf \ + ipers \ + lodbias \ + morph3d \ + multiarb \ + occlude \ + osdemo \ + paltex \ + pixeltex \ + pointblast \ + ray \ + readpix \ + reflect \ + renormal \ + spectex \ + stex3d \ + teapot \ + terrain \ + tessdemo \ + texcyl \ + texdown \ + texenv \ + texobj \ + trispd \ + tunnel \ + tunnel2 \ + winpos + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config + diff --git a/xc/extras/Mesa/demos/Makefile.X11 b/xc/extras/Mesa/demos/Makefile.X11 new file mode 100644 index 000000000..3c915a34d --- /dev/null +++ b/xc/extras/Mesa/demos/Makefile.X11 @@ -0,0 +1,95 @@ +# $Id: Makefile.X11,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# Copyright (C) 1995-2000 Brian Paul + +# Makefile for GLUT-based demo programs for Unix/X11 + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(APP_LIB_DEPS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = bounce \ + clearspd \ + cubemap \ + drawpix \ + fire \ + gamma \ + gears \ + geartrain \ + glinfo \ + gloss \ + gltestperf \ + glutfx \ + isosurf \ + ipers \ + lodbias \ + morph3d \ + multiarb \ + occlude \ + osdemo \ + paltex \ + pixeltex \ + pointblast \ + ray \ + readpix \ + reflect \ + renormal \ + spectex \ + stex3d \ + teapot \ + terrain \ + tessdemo \ + texcyl \ + texdown \ + texenv \ + texobj \ + trispd \ + tunnel \ + tunnel2 \ + winpos + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config + diff --git a/xc/extras/Mesa/demos/Makefile.am b/xc/extras/Mesa/demos/Makefile.am new file mode 100644 index 000000000..598d9b888 --- /dev/null +++ b/xc/extras/Mesa/demos/Makefile.am @@ -0,0 +1,71 @@ +## Process this file with automake to produce Makefile.in + +#AUTOMAKE_OPTIONS = no-dependencies + +INCLUDES = -I$(top_srcdir)/include $(GLUT_CFLAGS) + +check_PROGRAMS = bounce \ + clearspd \ + cubemap \ + drawpix \ + fire \ + gamma \ + gears \ + geartrain \ + glinfo \ + gloss \ + gltestperf \ + glutfx \ + isosurf \ + ipers \ + lodbias \ + morph3d \ + multiarb \ + occlude \ + osdemo \ + paltex \ + pixeltex \ + pointblast \ + ray \ + readpix \ + reflect \ + renormal \ + spectex \ + stex3d \ + teapot \ + terrain \ + tessdemo \ + texcyl \ + texdown \ + texenv \ + texobj \ + trispd \ + tunnel \ + tunnel2 \ + winpos + + + +CLEANFILES = test.ppm + +LDADD = $(GLUT_LIBS) $(top_builddir)/src-glu/libGLU.la \ + $(top_builddir)/src/libGL.la -lm +LDFLAGS = -no-install + +EXTRA_DIST = isosurf.dat + +# use double buffering if possible +BUFFER = -db + +# execute all programs +exec: $(check_PROGRAMS) + @for prog in $(check_PROGRAMS); \ + do \ + echo -n "Running $$prog ..." ; \ + case "$$prog" in \ + osdemo) ./$$prog test.ppm ;; \ + stex3d) ./$$prog $(BUFFER) ;; \ + *) ./$$prog ;; \ + esac ; \ + echo ; \ + done diff --git a/xc/extras/Mesa/demos/Makefile.cygnus b/xc/extras/Mesa/demos/Makefile.cygnus new file mode 100644 index 000000000..584910462 --- /dev/null +++ b/xc/extras/Mesa/demos/Makefile.cygnus @@ -0,0 +1,88 @@ +# $Id: Makefile.cygnus,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# Copyright (C) 1995-2000 Brian Paul + + +# Makefile for demo programs for cygnus +# Stephane Rehel (rehel@worldnet.fr) April 13 1997 + + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -lglut -lMesaGLU -lMesaGL -lm $(WLIBS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = bounce \ + clearspd \ + cubemap \ + drawpix \ + fire \ + gamma \ + gears \ + geartrain \ + glinfo \ + gloss \ + gltestperf \ + glutfx \ + isosurf \ + ipers \ + lodbias \ + morph3d \ + multiarb \ + occlude \ + osdemo \ + paltex \ + pixeltex \ + pointblast \ + ray \ + readpix \ + reflect \ + renormal \ + spectex \ + stex3d \ + teapot \ + terrain \ + tessdemo \ + texcyl \ + texdown \ + texenv \ + texobj \ + trispd \ + tunnel \ + tunnel2 \ + winpos + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS:=.exe) + -rm *.o *~ + +targets: $(PROGS) + +include ../Make-config + + diff --git a/xc/extras/Mesa/demos/README b/xc/extras/Mesa/demos/README new file mode 100644 index 000000000..a3d0c18bb --- /dev/null +++ b/xc/extras/Mesa/demos/README @@ -0,0 +1,230 @@ +INTRODUCTION +------------ + +This directory is usually included in the Mesa demos distribution or +in the GLUT distribution. + +I have written the demos included in this directory mainly for showing +the capabilities of the Mesa library when using the Voodoo driver. +However all the demos are written using the GLUT and OpenGL so they +work with any GLUT/OpenGL platform (tested: Linux+Mesa+Voodoo driver, +Linux+Mesa+X11 driver, Win95+Mesa+Voodoo driver and SGI Onyx IR thanks +to Mark Kilgard). + +All the demos make an heavy use of texture mapping, blending, etc. so +you _need_ some kind of hardware support for the OpenGL otherwise they +will run at ~1fps. You need also a OpenGL 1.1 compliant library. + +You can find some screenshot of these demos at +http://www-hmw.caribel.pisa.it/fxmesa/fxdemos.hmtl + +Write me if you find some bug in the demos. + +David Bucciarelli (tech.hmw@plus.it) + +Humanware s.r.l. +Via XXIV Maggio 62 +Pisa, Italy +Tel./Fax +39-50-554108 +email: info.hmw@plus.it +www: www-hmw.caribel.pisa.it + + +A BRIEF DESCRIPTION OF THE DEMOS +-------------------------------- + + +IPERS +----- + +Sources: ipers.c image.c + +A nice spinning fractal object. + + +RAY +--- + +Sources: ray.c + +I'm using ray tracing to dynamically generate texture maps with +specular, diffuse, shadows, and mirror colors. Each frame the texture +maps of the plane and of the sphere are partially updated. With this +technique you can obtain true mirrors, shadows, specular highlights, +bump mapping, etc. in realtime. This demo is really CPU intensive +(~25fps on a PentiumII@300MHz with a Pure3D). Support on-the-fly +switching between fullscreen and in-window rendering under Linux/Mesa +(start your X server in 16 bpp mode and press the spacebar). + + +TUNNEL +------ + +Sources: tunnel.c image.c sources.c +Data: bw.rgb tile.rgb + +The model was designed and prelighted with Alias|Wavefront +PowerAnimator V8. Triangle strips were built with a tool written by me +and then statically included in the sources. This demo doesn't +require the ZBuffer and use antialiased polygons. Support on-the-fly +switching between fullscreen and in-window rendering under Linux/Mesa +(start your X server in 16 bpp mode and press the spacebar). + + +TUNNEL2 +------ + +Sources: tunnel2.c image.c sources.c +Data: bw.rgb tile.rgb + +The some tunnel demo but with two output channels. A nice +example of the Mesa/Voodoo support for multiple boards in +the some PC. + + +TEAPOT +------ + +Sources: teapot.c image.c dteapot.c shadow.c +Data: bw.rgb tile.rgb + +The shadow is drawn projecting the teapot geometry over the plane. All +other light effects are drawn using the standard OpenGL capabilities. +Support on-the-fly switching between fullscreen and in-window +rendering under Linux/Mesa (start your X server in 16 bpp mode and +press the spacebar). + + +FIRE +---- + +Sources: fire.c image.c +Data: s128.rgb tree2.rgb + +The demo use a small particle system to draw some nice visual effect. +You can interactively change many parameters of the particle system +and you can choose the number of particles at the startup ('fire +4000'). This demo should be called fountain. Support on-the-fly +switching between fullscreen and in-window rendering under Linux/Mesa +(start your X server in 16 bpp mode and press the spacebar). + + +TERRAIN +------- + +Sources: mesaland.c + +This demo is base on another demo written by Mikael SkiZoWalker. I +have added the capabilities to freely fly around, view culling and +some nice color. Support on-the-fly switching between fullscreen and +in-window rendering under Linux/Mesa (start your X server in 16 bpp +mode and press the spacebar). + + +GLTEST +------ + +Sources: gltest.c + +This is a simple benchmark suite that I'm using in the development of +the Mesa/Voodoo driver. Type 'gltest >my.res' and you will get some +data about the performances of your OpenGL. Follow the results with my +PC (Linux+Mesa-2.6+PentiumII@300MHz+Pure3D): + +Simple Points +587900.080674 Pnts/sec + +Smooth Lines +SIZE=480 => 39007.426183 Lins/sec +SIZE=250 => 74575.016485 Lins/sec +SIZE=100 => 179734.882409 Lins/sec +SIZE=050 => 183987.795297 Lins/sec +SIZE=025 => 183820.086309 Lins/sec + + +ZSmooth Triangles +SIZE=480 => 784.954997 Tris/sec +SIZE=250 => 2862.325889 Tris/sec +SIZE=100 => 17779.492938 Tris/sec +SIZE=050 => 159339.829844 Tris/sec +SIZE=025 => 428602.984008 Tris/sec + + +ZSmooth Tex Blend Triangles +SIZE=480 => 784.473931 Tris/sec +SIZE=250 => 2853.781513 Tris/sec +SIZE=100 => 17598.252146 Tris/sec +SIZE=050 => 152632.578337 Tris/sec +SIZE=025 => 377584.760048 Tris/sec + + +ZSmooth Tex Blend TMesh Triangles +SIZE=400 => 563.900695 Tris/sec, MPixel Fill/sec: 45.112056 +SIZE=250 => 1449.777225 Tris/sec, MPixel Fill/sec: 45.305538 +SIZE=100 => 8702.869121 Tris/sec, MPixel Fill/sec: 43.514346 +SIZE=050 => 31896.867466 Tris/sec, MPixel Fill/sec: 39.871084 +SIZE=025 => 114037.262894 Tris/sec, MPixel Fill/sec: 35.636645 +SIZE=010 => 220494.235839 Tris/sec, MPixel Fill/sec: 11.024712 +SIZE=005 => 225615.506651 Tris/sec, MPixel Fill/sec: 2.820194 +SIZE=002 => 225607.681439 Tris/sec, MPixel Fill/sec: 0.451215 + + +Color/Depth Buffer Clears +295.042474 Clrs/sec, MPixel Fill/sec: 90.553256 + + +Follow the results with my +PC (Linux+Mesa-3.0beta5+PentiumII@300MHz+Voodoo2): + + +Simple Points +1620113.525130 Pnts/sec + +Smooth Lines +SIZE=480 => 73841.166065 Lins/sec +SIZE=250 => 140794.035316 Lins/sec +SIZE=100 => 344185.242157 Lins/sec +SIZE=050 => 420399.008289 Lins/sec +SIZE=025 => 420261.389773 Lins/sec + + +ZSmooth Triangles +SIZE=480 => 1434.668506 Tris/sec +SIZE=250 => 5228.449614 Tris/sec +SIZE=100 => 46603.815842 Tris/sec +SIZE=050 => 325757.045961 Tris/sec +SIZE=025 => 589022.403336 Tris/sec + + +ZSmooth Tex Blend Triangles +SIZE=480 => 1414.900041 Tris/sec +SIZE=250 => 5006.055235 Tris/sec +SIZE=100 => 43602.252031 Tris/sec +SIZE=050 => 303497.092692 Tris/sec +SIZE=025 => 517087.428669 Tris/sec + + +ZSmooth Tex Blend TMesh Triangles +SIZE=400 => 1023.273112 Tris/sec, MPixel Fill/sec: 81.861849 +SIZE=250 => 2595.692121 Tris/sec, MPixel Fill/sec: 81.115379 +SIZE=100 => 15788.198912 Tris/sec, MPixel Fill/sec: 78.940995 +SIZE=050 => 58784.121300 Tris/sec, MPixel Fill/sec: 73.480152 +SIZE=025 => 244233.873481 Tris/sec, MPixel Fill/sec: 76.323085 +SIZE=010 => 474995.004191 Tris/sec, MPixel Fill/sec: 23.749750 +SIZE=005 => 475124.354163 Tris/sec, MPixel Fill/sec: 5.939054 +SIZE=002 => 474959.089503 Tris/sec, MPixel Fill/sec: 0.949918 + + +Color/Depth Buffer Clears +478.654830 Clrs/sec, MPixel Fill/sec: 146.906826 + + +PALTEX and GLBPALTX +------------------- + +Sources: paltex.c and glbpaltx.c + +The PALTEX example was written by Brian Paul and it shows the +capabilities of the GL_EXT_paletted_texture extension. I have written +the other example in order to show the capabilities of the +gl3DfxSetPaletteEXT() (it used only by GLQuake and Quake2). diff --git a/xc/extras/Mesa/demos/bounce.c b/xc/extras/Mesa/demos/bounce.c new file mode 100644 index 000000000..682a266ad --- /dev/null +++ b/xc/extras/Mesa/demos/bounce.c @@ -0,0 +1,220 @@ +/* $Id: bounce.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Bouncing ball demo. + * + * This program is in the public domain + * + * Brian Paul + * + * Conversion to GLUT by Mark J. Kilgard + */ + + +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <GL/glut.h> + +#define COS(X) cos( (X) * 3.14159/180.0 ) +#define SIN(X) sin( (X) * 3.14159/180.0 ) + +#define RED 1 +#define WHITE 2 +#define CYAN 3 + +GLboolean IndexMode = GL_FALSE; +GLuint Ball; +GLenum Mode; +GLfloat Zrot = 0.0, Zstep = 6.0; +GLfloat Xpos = 0.0, Ypos = 1.0; +GLfloat Xvel = 0.2, Yvel = 0.0; +GLfloat Xmin = -4.0, Xmax = 4.0; +GLfloat Ymin = -3.8, Ymax = 4.0; +GLfloat G = -0.1; + +static GLuint +make_ball(void) +{ + GLuint list; + GLfloat a, b; + GLfloat da = 18.0, db = 18.0; + GLfloat radius = 1.0; + GLuint color; + GLfloat x, y, z; + + list = glGenLists(1); + + glNewList(list, GL_COMPILE); + + color = 0; + for (a = -90.0; a + da <= 90.0; a += da) { + + glBegin(GL_QUAD_STRIP); + for (b = 0.0; b <= 360.0; b += db) { + + if (color) { + glIndexi(RED); + glColor3f(1, 0, 0); + } else { + glIndexi(WHITE); + glColor3f(1, 1, 1); + } + + x = radius * COS(b) * COS(a); + y = radius * SIN(b) * COS(a); + z = radius * SIN(a); + glVertex3f(x, y, z); + + x = radius * COS(b) * COS(a + da); + y = radius * SIN(b) * COS(a + da); + z = radius * SIN(a + da); + glVertex3f(x, y, z); + + color = 1 - color; + } + glEnd(); + + } + + glEndList(); + + return list; +} + +static void +reshape(int width, int height) +{ + float aspect = (float) width / (float) height; + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-6.0 * aspect, 6.0 * aspect, -6.0, 6.0, -6.0, 6.0); + glMatrixMode(GL_MODELVIEW); +} + +/* ARGSUSED1 */ +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: /* Escape */ + exit(0); + } +} + +static void +draw(void) +{ + GLint i; + + glClear(GL_COLOR_BUFFER_BIT); + + glIndexi(CYAN); + glColor3f(0, 1, 1); + glBegin(GL_LINES); + for (i = -5; i <= 5; i++) { + glVertex2i(i, -5); + glVertex2i(i, 5); + } + for (i = -5; i <= 5; i++) { + glVertex2i(-5, i); + glVertex2i(5, i); + } + for (i = -5; i <= 5; i++) { + glVertex2i(i, -5); + glVertex2f(i * 1.15, -5.9); + } + glVertex2f(-5.3, -5.35); + glVertex2f(5.3, -5.35); + glVertex2f(-5.75, -5.9); + glVertex2f(5.75, -5.9); + glEnd(); + + glPushMatrix(); + glTranslatef(Xpos, Ypos, 0.0); + glScalef(2.0, 2.0, 2.0); + glRotatef(8.0, 0.0, 0.0, 1.0); + glRotatef(90.0, 1.0, 0.0, 0.0); + glRotatef(Zrot, 0.0, 0.0, 1.0); + + glCallList(Ball); + + glPopMatrix(); + + glFlush(); + glutSwapBuffers(); +} + +static void +idle(void) +{ + static float vel0 = -100.0; + + Zrot += Zstep; + + Xpos += Xvel; + if (Xpos >= Xmax) { + Xpos = Xmax; + Xvel = -Xvel; + Zstep = -Zstep; + } + if (Xpos <= Xmin) { + Xpos = Xmin; + Xvel = -Xvel; + Zstep = -Zstep; + } + Ypos += Yvel; + Yvel += G; + if (Ypos < Ymin) { + Ypos = Ymin; + if (vel0 == -100.0) + vel0 = fabs(Yvel); + Yvel = vel0; + } + glutPostRedisplay(); +} + +static void +visible(int vis) +{ + if (vis == GLUT_VISIBLE) + glutIdleFunc(idle); + else + glutIdleFunc(NULL); +} + +int main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(600, 450); + + + IndexMode = argc > 1 && strcmp(argv[1], "-ci") == 0; + if (IndexMode) + glutInitDisplayMode(GLUT_INDEX | GLUT_DOUBLE); + else + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + + glutCreateWindow("Bounce"); + Ball = make_ball(); + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + glDisable(GL_DITHER); + glShadeModel(GL_FLAT); + + glutDisplayFunc(draw); + glutReshapeFunc(reshape); + glutVisibilityFunc(visible); + glutKeyboardFunc(key); + + if (IndexMode) { + glutSetColor(RED, 1.0, 0.0, 0.0); + glutSetColor(WHITE, 1.0, 1.0, 1.0); + glutSetColor(CYAN, 0.0, 1.0, 1.0); + } + + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/demos/clearspd.c b/xc/extras/Mesa/demos/clearspd.c new file mode 100644 index 000000000..3c7e21245 --- /dev/null +++ b/xc/extras/Mesa/demos/clearspd.c @@ -0,0 +1,238 @@ +/* $Id: clearspd.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Simple GLUT program to measure glClear() and glutSwapBuffers() speed. + * Brian Paul February 15, 1997 This file in public domain. + */ + +/* + * $Log: clearspd.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 2000/04/10 16:25:15 brianp + * fixed visual selection and reporting results + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.3 1999/03/28 18:18:33 brianp + * minor clean-up + * + * Revision 3.2 1999/03/18 08:16:34 joukj + * + * cmpstr needs string.h to included to avoid warnings + * + * Revision 3.1 1998/06/29 02:38:30 brianp + * removed unneeded includes + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include <GL/glut.h> + + +static float MinPeriod = 2.0; /* 2 seconds */ +static int ColorMode = GLUT_RGB; +static int Width = 400.0; +static int Height = 400.0; +static int Loops = 100; +static float ClearColor = 0.0; +static GLbitfield BufferMask = GL_COLOR_BUFFER_BIT; +static GLboolean SwapFlag = GL_FALSE; + + + +static void Idle( void ) +{ + glutPostRedisplay(); +} + + +static void Display( void ) +{ + double t0, t1; + double clearRate; + double pixelRate; + int i; + + glClearColor( ClearColor, ClearColor, ClearColor, 0.0 ); + ClearColor += 0.1; + if (ClearColor>1.0) + ClearColor = 0.0; + + if (SwapFlag) { + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + for (i=0;i<Loops;i++) { + glClear( BufferMask ); + glutSwapBuffers(); + } + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + } + else { + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + for (i=0;i<Loops;i++) { + glClear( BufferMask ); + glFlush(); + } + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + glutSwapBuffers(); + } + + if (t1-t0 < MinPeriod) { + /* Next time do more clears to get longer elapsed time */ + Loops *= 2; + return; + } + + clearRate = Loops / (t1-t0); + pixelRate = clearRate * Width * Height; + if (SwapFlag) { + printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %g pixels/s\n", + Loops, t1-t0, clearRate, pixelRate ); + } + else { + printf("Rate: %d clears in %gs = %g clears/s %g pixels/s\n", + Loops, t1-t0, clearRate, pixelRate); + } +} + + +static void Reshape( int width, int height ) +{ + Width = width; + Height = height; + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(0.0, width, 0.0, height, -1.0, 1.0); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void Init( int argc, char *argv[] ) +{ + int i; + for (i=1; i<argc; i++) { + if (strcmp(argv[i],"+rgb")==0) + ColorMode = GLUT_RGB; + else if (strcmp(argv[i],"+ci")==0) + ColorMode = GLUT_INDEX; + else if (strcmp(argv[i],"-color")==0) + BufferMask = 0; + else if (strcmp(argv[i],"+depth")==0) + BufferMask |= GL_DEPTH_BUFFER_BIT; + else if (strcmp(argv[i],"+alpha")==0) + ColorMode = GLUT_RGB | GLUT_ALPHA; + else if (strcmp(argv[i],"+stencil")==0) + BufferMask |= GL_STENCIL_BUFFER_BIT; + else if (strcmp(argv[i],"+accum")==0) + BufferMask |= GL_ACCUM_BUFFER_BIT; + else if (strcmp(argv[i],"-width")==0) { + Width = atoi(argv[i+1]); + i++; + } + else if (strcmp(argv[i],"-height")==0) { + Height = atoi(argv[i+1]); + i++; + } + else if (strcmp(argv[i],"+swap")==0) { + SwapFlag = GL_TRUE; + } + else if (strcmp(argv[i],"-swap")==0) { + SwapFlag = GL_FALSE; + } + else + printf("Unknown option: %s\n", argv[i]); + } + + if (ColorMode & GLUT_ALPHA) + printf("Mode: RGB + Alpha\n"); + else if (ColorMode==GLUT_RGB) + printf("Mode: RGB\n"); + else + printf("Mode: Color Index\n"); + printf("SwapBuffers: %s\n", SwapFlag ? "yes" : "no" ); + printf("Size: %d x %d\n", Width, Height); + printf("Buffers: "); + if (BufferMask & GL_COLOR_BUFFER_BIT) printf("color "); + if (BufferMask & GL_DEPTH_BUFFER_BIT) printf("depth "); + if (BufferMask & GL_STENCIL_BUFFER_BIT) printf("stencil "); + if (BufferMask & GL_ACCUM_BUFFER_BIT) printf("accum "); + printf("\n"); +} + + +static void Help( const char *program ) +{ + printf("%s options:\n", program); + printf(" +rgb RGB mode\n"); + printf(" +ci color index mode\n"); + printf(" -color don't clear color buffer\n"); + printf(" +alpha clear alpha buffer\n"); + printf(" +depth clear depth buffer\n"); + printf(" +stencil clear stencil buffer\n"); + printf(" +accum clear accum buffer\n"); + printf(" +swap also do SwapBuffers\n"); + printf(" -swap don't do SwapBuffers\n"); +} + + +int main( int argc, char *argv[] ) +{ + GLint mode; + + printf("For options: %s -help\n", argv[0]); + + Init( argc, argv ); + + glutInit( &argc, argv ); + glutInitWindowSize( (int) Width, (int) Height ); + glutInitWindowPosition( 0, 0 ); + + mode = ColorMode | GLUT_DOUBLE; + if (BufferMask & GL_STENCIL_BUFFER_BIT) + mode |= GLUT_STENCIL; + if (BufferMask & GL_ACCUM_BUFFER_BIT) + mode |= GLUT_ACCUM; + if (BufferMask & GL_DEPTH_BUFFER_BIT) + mode |= GLUT_DEPTH; + + glutInitDisplayMode(mode); + + glutCreateWindow( argv[0] ); + + if (argc==2 && strcmp(argv[1],"-help")==0) { + Help(argv[0]); + return 0; + } + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/cubemap.c b/xc/extras/Mesa/demos/cubemap.c new file mode 100644 index 000000000..89e462ca6 --- /dev/null +++ b/xc/extras/Mesa/demos/cubemap.c @@ -0,0 +1,250 @@ +/* $Id: cubemap.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * GL_ARB_texture_cube_map demo + * + * Brian Paul + * May 2000 + * + * + * Copyright (C) 2000 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. + */ + + +/* + * This is a pretty minimalistic demo for now. Eventually, use some + * interesting cube map textures and 3D objects. + * For now, we use 6 checkerboard "walls" and a sphere (good for + * verification purposes). + */ + + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "GL/glut.h" + +static GLfloat Xrot = 0, Yrot = 0; + + +static void draw( void ) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glRotatef(Xrot, 1, 0, 0); + glRotatef(Yrot, 0, 1, 0); + glutSolidSphere(2.0, 20, 20); + glMatrixMode(GL_MODELVIEW); + + glutSwapBuffers(); +} + + +static void idle(void) +{ + Yrot += 5.0; + glutPostRedisplay(); +} + + +static void set_mode(GLuint mode) +{ + if (mode == 0) { + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB); + printf("GL_REFLECTION_MAP_ARB mode\n"); + } + else if (mode == 1) { + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB); + printf("GL_NORMAL_MAP_ARB mode\n"); + } + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_R); +} + + +static void key(unsigned char k, int x, int y) +{ + static GLboolean anim = GL_TRUE; + static GLuint mode = 0; + (void) x; + (void) y; + switch (k) { + case ' ': + anim = !anim; + if (anim) + glutIdleFunc(idle); + else + glutIdleFunc(NULL); + break; + case 'm': + mode = !mode; + set_mode(mode); + break; + case 27: + exit(0); + } + glutPostRedisplay(); +} + + +static void specialkey(int key, int x, int y) +{ + GLfloat step = 10; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + Xrot -= step; + break; + case GLUT_KEY_DOWN: + Xrot += step; + break; + case GLUT_KEY_LEFT: + Yrot -= step; + break; + case GLUT_KEY_RIGHT: + Yrot += step; + break; + } + glutPostRedisplay(); +} + + +/* new window size or exposure */ +static void reshape(int width, int height) +{ + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 ); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -8.0 ); +} + + +static void init( void ) +{ +#define CUBE_TEX_SIZE 64 + GLubyte image[CUBE_TEX_SIZE][CUBE_TEX_SIZE][3]; + static const GLubyte colors[6][3] = { + { 255, 0, 0 }, + { 0, 255, 255 }, + { 0, 255, 0 }, + { 255, 0, 255 }, + { 0, 0, 255 }, + { 255, 255, 0 } + }; + static const GLenum targets[6] = { + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB + }; + + GLint i, j, f; + + /* check for extension */ + { + char *exten = (char *) glGetString(GL_EXTENSIONS); + if (!strstr(exten, "GL_ARB_texture_cube_map")) { + printf("Sorry, this demo requires GL_ARB_texture_cube_map\n"); + exit(0); + } + } + + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + /* make colored checkerboard cube faces */ + for (f = 0; f < 6; f++) { + for (i = 0; i < CUBE_TEX_SIZE; i++) { + for (j = 0; j < CUBE_TEX_SIZE; j++) { + if ((i/4 + j/4) & 1) { + image[i][j][0] = colors[f][0]; + image[i][j][1] = colors[f][1]; + image[i][j][2] = colors[f][2]; + } + else { + image[i][j][0] = 255; + image[i][j][1] = 255; + image[i][j][2] = 255; + } + } + } + + glTexImage2D(targets[f], 0, GL_RGB, CUBE_TEX_SIZE, CUBE_TEX_SIZE, 0, + GL_RGB, GL_UNSIGNED_BYTE, image); + } + +#if 1 + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +#else + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +#endif + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + + glClearColor(.3, .3, .3, 0); + glColor3f( 1.0, 1.0, 1.0 ); + + set_mode(0); +} + + +static void usage(void) +{ + printf("keys:\n"); + printf(" SPACE - toggle animation\n"); + printf(" CURSOR KEYS - rotation\n"); + printf(" m - toggle texgen reflection mode\n"); +} + + +int main( int argc, char *argv[] ) +{ + glutInitWindowPosition(0, 0); + glutInitWindowSize(300, 300); + glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); + glutCreateWindow("Texture Cube Maping"); + init(); + glutReshapeFunc( reshape ); + glutKeyboardFunc( key ); + glutSpecialFunc( specialkey ); + glutIdleFunc( idle ); + glutDisplayFunc( draw ); + usage(); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/descrip.mms b/xc/extras/Mesa/demos/descrip.mms new file mode 100644 index 000000000..a705f1704 --- /dev/null +++ b/xc/extras/Mesa/demos/descrip.mms @@ -0,0 +1,63 @@ +# Makefile for GLUT-based demo programs for VMS +# contributed by Jouk Jansen joukj@crys.chem.uva.nl + + +.first + define gl [-.include.gl] + +.include [-]mms-config. + +##### MACROS ##### + +INCDIR = [-.include] +CFLAGS = /include=$(INCDIR)/prefix=all + +.ifdef SHARE +GL_LIBS = $(XLIBS) +.else +GL_LIBS = [-.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) +.endif + +LIB_DEP = [-.lib]$(GL_LIB) [-.lib]$(GLU_LIB) [-.lib]$(GLUT_LIB) + +PROGS = bounce.exe;,clearspd.exe;,drawpix.exe;,gamma.exe;,gears.exe;,\ + glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,osdemo.exe;,\ + paltex.exe;,pointblast.exe;,reflect.exe;,spectex.exe;,stex3d.exe;,\ + tessdemo.exe;,texcyl.exe;,texobj.exe;,trispd.exe;,winpos.exe; + + +##### RULES ##### +.obj.exe : + link $(MMS$TARGET_NAME),$(GL_LIBS) + +##### TARGETS ##### +default : + $(MMS)$(MMSQUALIFIERS) $(PROGS) + +clean : + delete *.obj;* + +realclean : + delete $(PROGS) + delete *.obj;* + +bounce.exe; : bounce.obj $(LIB_DEP) +clearspd.exe; : clearspd.obj $(LIB_DEP) +drawpix.exe; : drawpix.obj $(LIB_DEP) +gamma.exe; : gamma.obj $(LIB_DEP) +gears.exe; : gears.obj $(LIB_DEP) +glinfo.exe; : glinfo.obj $(LIB_DEP) +glutfx.exe; : glutfx.obj $(LIB_DEP) +isosurf.exe; : isosurf.obj $(LIB_DEP) +morph3d.exe; : morph3d.obj $(LIB_DEP) +osdemo.exe; : osdemo.obj $(LIB_DEP) +paltex.exe; : paltex.obj $(LIB_DEP) +pointblast.exe; : pointblast.obj $(LIB_DEP) +reflect.exe; : reflect.obj $(LIB_DEP) +spectex.exe; : spectex.obj $(LIB_DEP) +stex3d.exe; : stex3d.obj $(LIB_DEP) +tessdemo.exe; : tessdemo.obj $(LIB_DEP) +texcyl.exe; : texcyl.obj $(LIB_DEP) +texobj.exe; : texobj.obj $(LIB_DEP) +trispd.exe; : trispd.obj $(LIB_DEP) +winpos.exe; : winpos.obj $(LIB_DEP) diff --git a/xc/extras/Mesa/demos/drawpix.c b/xc/extras/Mesa/demos/drawpix.c new file mode 100644 index 000000000..c1571ad05 --- /dev/null +++ b/xc/extras/Mesa/demos/drawpix.c @@ -0,0 +1,338 @@ +/* $Id: drawpix.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * glDrawPixels demo/test/benchmark + * + * Brian Paul September 25, 1997 This file is in the public domain. + */ + +/* + * $Log: drawpix.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.3 1999/10/28 18:23:29 brianp + * minor changes to Usage() function + * + * Revision 1.2 1999/10/21 22:13:58 brianp + * added f key to toggle front/back drawing + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.3 1999/03/28 18:18:33 brianp + * minor clean-up + * + * Revision 3.2 1998/11/05 04:34:04 brianp + * moved image files to ../images/ directory + * + * Revision 3.1 1998/02/22 16:43:17 brianp + * added a few casts to silence compiler warnings + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + +#include "../util/readtex.c" /* a hack, I know */ + +#define IMAGE_FILE "../images/girl.rgb" + +static int ImgWidth, ImgHeight; +static GLenum ImgFormat; +static GLubyte *Image = NULL; + +static int Xpos, Ypos; +static int SkipPixels, SkipRows; +static int DrawWidth, DrawHeight; +static int Scissor = 0; +static float Xzoom, Yzoom; +static GLboolean DrawFront = GL_FALSE; + + + +static void Reset( void ) +{ + Xpos = Ypos = 20; + DrawWidth = ImgWidth; + DrawHeight = ImgHeight; + SkipPixels = SkipRows = 0; + Scissor = 0; + Xzoom = Yzoom = 1.0; +} + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + +#if 0 + glRasterPos2i(Xpos, Ypos); +#else + /* This allows negative raster positions: */ + glRasterPos2i(0, 0); + glBitmap(0, 0, 0, 0, Xpos, Ypos, NULL); +#endif + + glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels); + glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows); + + glPixelZoom( Xzoom, Yzoom ); + + if (Scissor) + glEnable(GL_SCISSOR_TEST); + + glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); + + glDisable(GL_SCISSOR_TEST); + + if (!DrawFront) + glutSwapBuffers(); +} + + +static void Benchmark( void ) +{ + int startTime, endTime; + int draws = 500; + double seconds, pixelsPerSecond; + + printf("Benchmarking...\n"); + /* GL set-up */ + glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels); + glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows); + glPixelZoom( Xzoom, Yzoom ); + if (Scissor) + glEnable(GL_SCISSOR_TEST); + + if (DrawFront) + glDrawBuffer(GL_FRONT); + else + glDrawBuffer(GL_BACK); + + /* Run timing test */ + draws = 0; + startTime = glutGet(GLUT_ELAPSED_TIME); + do { + glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); + draws++; + endTime = glutGet(GLUT_ELAPSED_TIME); + } while (endTime - startTime < 4000); /* 4 seconds */ + + /* GL clean-up */ + glDisable(GL_SCISSOR_TEST); + + /* Results */ + seconds = (double) (endTime - startTime) / 1000.0; + pixelsPerSecond = draws * DrawWidth * DrawHeight / seconds; + printf("Result: %d draws in %f seconds = %f pixels/sec\n", + draws, seconds, pixelsPerSecond); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + glScissor(width/4, height/4, width/2, height/2); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case ' ': + Reset(); + break; + case 'w': + if (DrawWidth > 0) + DrawWidth--; + break; + case 'W': + DrawWidth++; + break; + case 'h': + if (DrawHeight > 0) + DrawHeight--; + break; + case 'H': + DrawHeight++; + break; + case 'p': + if (SkipPixels > 0) + SkipPixels--; + break; + case 'P': + SkipPixels++; + break; + case 'r': + if (SkipRows > 0) + SkipRows--; + break; + case 'R': + SkipRows++; + break; + case 's': + Scissor = !Scissor; + break; + case 'x': + Xzoom -= 0.1; + break; + case 'X': + Xzoom += 0.1; + break; + case 'y': + Yzoom -= 0.1; + break; + case 'Y': + Yzoom += 0.1; + break; + case 'b': + Benchmark(); + break; + case 'f': + DrawFront = !DrawFront; + if (DrawFront) + glDrawBuffer(GL_FRONT); + else + glDrawBuffer(GL_BACK); + printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK"); + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + Ypos += 1; + break; + case GLUT_KEY_DOWN: + Ypos -= 1; + break; + case GLUT_KEY_LEFT: + Xpos -= 1; + break; + case GLUT_KEY_RIGHT: + Xpos += 1; + break; + } + glutPostRedisplay(); +} + + +static void Init( GLboolean ciMode ) +{ + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat ); + if (!Image) { + printf("Couldn't read %s\n", IMAGE_FILE); + exit(0); + } + + if (ciMode) { + /* Convert RGB image to grayscale */ + GLubyte *indexImage = malloc( ImgWidth * ImgHeight ); + GLint i; + for (i=0; i<ImgWidth*ImgHeight; i++) { + int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2]; + indexImage[i] = gray / 3; + } + free(Image); + Image = indexImage; + ImgFormat = GL_COLOR_INDEX; + + for (i=0;i<255;i++) { + float g = i / 255.0; + glutSetColor(i, g, g, g); + } + } + + printf("Loaded %d by %d image\n", ImgWidth, ImgHeight ); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth); + + Reset(); +} + + +static void Usage(void) +{ + printf("Keys:\n"); + printf(" SPACE Reset Parameters\n"); + printf(" Up/Down Move image up/down\n"); + printf(" Left/Right Move image left/right\n"); + printf(" x Decrease X-axis PixelZoom\n"); + printf(" X Increase X-axis PixelZoom\n"); + printf(" y Decrease Y-axis PixelZoom\n"); + printf(" Y Increase Y-axis PixelZoom\n"); + printf(" w Decrease glDrawPixels width*\n"); + printf(" W Increase glDrawPixels width*\n"); + printf(" h Decrease glDrawPixels height*\n"); + printf(" H Increase glDrawPixels height*\n"); + printf(" p Decrease GL_UNPACK_SKIP_PIXELS*\n"); + printf(" P Increase GL_UNPACK_SKIP_PIXELS*\n"); + printf(" r Decrease GL_UNPACK_SKIP_ROWS*\n"); + printf(" R Increase GL_UNPACK_SKIP_ROWS*\n"); + printf(" s Toggle GL_SCISSOR_TEST\n"); + printf(" f Toggle front/back buffer drawing\n"); + printf(" b Benchmark test\n"); + printf(" ESC Exit\n"); + printf("* Warning: no limits are imposed on these parameters so it's\n"); + printf(" possible to cause a segfault if you go too far.\n"); +} + + +int main( int argc, char *argv[] ) +{ + GLboolean ciMode = GL_FALSE; + + if (argc > 1 && strcmp(argv[1], "-ci")==0) { + ciMode = GL_TRUE; + } + + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 500, 400 ); + + if (ciMode) + glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); + else + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + + glutCreateWindow(argv[0]); + + Init(ciMode); + Usage(); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/fire.c b/xc/extras/Mesa/demos/fire.c new file mode 100644 index 000000000..f4c45219d --- /dev/null +++ b/xc/extras/Mesa/demos/fire.c @@ -0,0 +1,738 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#ifdef WIN32 +#include <windows.h> +#include <mmsystem.h> +#endif + +#include <GL/glut.h> +#include "../util/readtex.c" + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen = 1; +#endif + +#ifndef M_PI +#define M_PI 3.1415926535 +#endif + +#define vinit(a,i,j,k) {\ + (a)[0]=i;\ + (a)[1]=j;\ + (a)[2]=k;\ +} + +#define vinit4(a,i,j,k,w) {\ + (a)[0]=i;\ + (a)[1]=j;\ + (a)[2]=k;\ + (a)[3]=w;\ +} + + +#define vadds(a,dt,b) {\ + (a)[0]+=(dt)*(b)[0];\ + (a)[1]+=(dt)*(b)[1];\ + (a)[2]+=(dt)*(b)[2];\ +} + +#define vequ(a,b) {\ + (a)[0]=(b)[0];\ + (a)[1]=(b)[1];\ + (a)[2]=(b)[2];\ +} + +#define vinter(a,dt,b,c) {\ + (a)[0]=(dt)*(b)[0]+(1.0-dt)*(c)[0];\ + (a)[1]=(dt)*(b)[1]+(1.0-dt)*(c)[1];\ + (a)[2]=(dt)*(b)[2]+(1.0-dt)*(c)[2];\ +} + +#define clamp(a) ((a) < 0.0 ? 0.0 : ((a) < 1.0 ? (a) : 1.0)) + +#define vclamp(v) {\ + (v)[0]=clamp((v)[0]);\ + (v)[1]=clamp((v)[1]);\ + (v)[2]=clamp((v)[2]);\ +} + +static int WIDTH = 640; +static int HEIGHT = 480; + +#define FRAME 50 +#define DIMP 20.0 +#define DIMTP 16.0 + +#define RIDCOL 0.4 + +#define NUMTREE 50 +#define TREEINR 2.5 +#define TREEOUTR 8.0 + +#define AGRAV -9.8 + +typedef struct +{ + int age; + float p[3][3]; + float v[3]; + float c[3][4]; +} +part; + +static float treepos[NUMTREE][3]; + +static float black[3] = { 0.0, 0.0, 0.0 }; +static float blu[3] = { 0.0, 0.2, 1.0 }; +static float blu2[3] = { 0.0, 1.0, 1.0 }; + +static float fogcolor[4] = { 1.0, 1.0, 1.0, 1.0 }; + +static float q[4][3] = { + {-DIMP, 0.0, -DIMP}, + {DIMP, 0.0, -DIMP}, + {DIMP, 0.0, DIMP}, + {-DIMP, 0.0, DIMP} +}; + +static float qt[4][2] = { + {-DIMTP, -DIMTP}, + {DIMTP, -DIMTP}, + {DIMTP, DIMTP}, + {-DIMTP, DIMTP} +}; + +static int win = 0; + +static int np; +static float eject_r, dt, maxage, eject_vy, eject_vl; +static short shadows; +static float ridtri; +static int fog = 1; +static int help = 1; +static int joyavailable = 0; +static int joyactive = 0; + +static part *p; + +static GLuint groundid; +static GLuint treeid; + +static float obs[3] = { 2.0, 1.0, 0.0 }; +static float dir[3]; +static float v = 0.0; +static float alpha = -90.0; +static float beta = 90.0; + +static float +gettime(void) +{ + static clock_t told = 0; + clock_t tnew, ris; + + tnew = clock(); + + ris = tnew - told; + + told = tnew; + + return (ris / (float) CLOCKS_PER_SEC); +} + +static float +vrnd(void) +{ + return (((float) rand()) / RAND_MAX); +} + +static void +setnewpart(part * p) +{ + float a, v[3], *c; + + p->age = 0; + + a = vrnd() * 3.14159265359 * 2.0; + + vinit(v, sin(a) * eject_r * vrnd(), 0.15, cos(a) * eject_r * vrnd()); + vinit(p->p[0], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri, + v[2] + vrnd() * ridtri); + vinit(p->p[1], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri, + v[2] + vrnd() * ridtri); + vinit(p->p[2], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri, + v[2] + vrnd() * ridtri); + + vinit(p->v, v[0] * eject_vl / (eject_r / 2), + vrnd() * eject_vy + eject_vy / 2, v[2] * eject_vl / (eject_r / 2)); + + c = blu; + + vinit4(p->c[0], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), + c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), + c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0); + vinit4(p->c[1], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), + c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), + c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0); + vinit4(p->c[2], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), + c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), + c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0); +} + +static void +setpart(part * p) +{ + float fact; + + if (p->p[0][1] < 0.1) { + setnewpart(p); + return; + } + + p->v[1] += AGRAV * dt; + + vadds(p->p[0], dt, p->v); + vadds(p->p[1], dt, p->v); + vadds(p->p[2], dt, p->v); + + p->age++; + + if ((p->age) > maxage) { + vequ(p->c[0], blu2); + vequ(p->c[1], blu2); + vequ(p->c[2], blu2); + } + else { + fact = 1.0 / maxage; + vadds(p->c[0], fact, blu2); + vclamp(p->c[0]); + p->c[0][3] = fact * (maxage - p->age); + + vadds(p->c[1], fact, blu2); + vclamp(p->c[1]); + p->c[1][3] = fact * (maxage - p->age); + + vadds(p->c[2], fact, blu2); + vclamp(p->c[2]); + p->c[2][3] = fact * (maxage - p->age); + } +} + +static void +drawtree(float x, float y, float z) +{ + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); + glVertex3f(x - 1.5, y + 0.0, z); + + glTexCoord2f(1.0, 0.0); + glVertex3f(x + 1.5, y + 0.0, z); + + glTexCoord2f(1.0, 1.0); + glVertex3f(x + 1.5, y + 3.0, z); + + glTexCoord2f(0.0, 1.0); + glVertex3f(x - 1.5, y + 3.0, z); + + + glTexCoord2f(0.0, 0.0); + glVertex3f(x, y + 0.0, z - 1.5); + + glTexCoord2f(1.0, 0.0); + glVertex3f(x, y + 0.0, z + 1.5); + + glTexCoord2f(1.0, 1.0); + glVertex3f(x, y + 3.0, z + 1.5); + + glTexCoord2f(0.0, 1.0); + glVertex3f(x, y + 3.0, z - 1.5); + + glEnd(); + +} + +static void +calcposobs(void) +{ + dir[0] = sin(alpha * M_PI / 180.0); + dir[2] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); + dir[1] = cos(beta * M_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; +} + +static void +printstring(void *font, char *string) +{ + int len, i; + + len = (int) strlen(string); + for (i = 0; i < len; i++) + glutBitmapCharacter(font, string[i]); +} + +static void +reshape(int width, int height) +{ + WIDTH = width; + HEIGHT = height; + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(70.0, width / (float) height, 0.1, 30.0); + + glMatrixMode(GL_MODELVIEW); +} + +static void +printhelp(void) +{ + glColor4f(0.0, 0.0, 0.0, 0.5); + glRecti(40, 40, 600, 440); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(300, 420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); + + glRasterPos2i(60, 390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); + + glRasterPos2i(60, 360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Increase particle size"); + glRasterPos2i(60, 330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "T - Decrease particle size"); + + glRasterPos2i(60, 300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "r - Increase emission radius"); + glRasterPos2i(60, 270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "R - Decrease emission radius"); + + glRasterPos2i(60, 240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); + glRasterPos2i(60, 210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Togle shadows"); + glRasterPos2i(60, 180); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); + glRasterPos2i(60, 150); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); + glRasterPos2i(60, 120); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); + + glRasterPos2i(60, 90); + if (joyavailable) + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "j - Togle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "(No Joystick control available)"); +} + +static void +dojoy(void) +{ +#ifdef WIN32 + static UINT max[2] = { 0, 0 }; + static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2]; + MMRESULT res; + JOYINFO joy; + + res = joyGetPos(JOYSTICKID1, &joy); + + if (res == JOYERR_NOERROR) { + joyavailable = 1; + + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2; + + if (joyactive) { + if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0])) + alpha += + 2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]); + if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1])) + beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]); + + if (joy.wButtons & JOY_BUTTON1) + v += 0.01; + if (joy.wButtons & JOY_BUTTON2) + v -= 0.01; + } + } + else + joyavailable = 0; +#endif +} + +static void +drawfire(void) +{ + static int count = 0; + static char frbuf[80]; + int j; + float fr; + + dojoy(); + + glEnable(GL_DEPTH_TEST); + + if (fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glDepthMask(GL_TRUE); + glClearColor(1.0, 1.0, 1.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + calcposobs(); + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 1.0, 0.0); + + glColor4f(1.0, 1.0, 1.0, 1.0); + + glEnable(GL_TEXTURE_2D); + + glBindTexture(GL_TEXTURE_2D, groundid); + glBegin(GL_QUADS); + glTexCoord2fv(qt[0]); + glVertex3fv(q[0]); + glTexCoord2fv(qt[1]); + glVertex3fv(q[1]); + glTexCoord2fv(qt[2]); + glVertex3fv(q[2]); + glTexCoord2fv(qt[3]); + glVertex3fv(q[3]); + glEnd(); + + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GEQUAL, 0.9); + + glBindTexture(GL_TEXTURE_2D, treeid); + for (j = 0; j < NUMTREE; j++) + drawtree(treepos[j][0], treepos[j][1], treepos[j][2]); + + glDisable(GL_TEXTURE_2D); + glDepthMask(GL_FALSE); + glDisable(GL_ALPHA_TEST); + + if (shadows) { + glBegin(GL_TRIANGLES); + for (j = 0; j < np; j++) { + glColor4f(black[0], black[1], black[2], p[j].c[0][3]); + glVertex3f(p[j].p[0][0], 0.1, p[j].p[0][2]); + + glColor4f(black[0], black[1], black[2], p[j].c[1][3]); + glVertex3f(p[j].p[1][0], 0.1, p[j].p[1][2]); + + glColor4f(black[0], black[1], black[2], p[j].c[2][3]); + glVertex3f(p[j].p[2][0], 0.1, p[j].p[2][2]); + } + glEnd(); + } + + glBegin(GL_TRIANGLES); + for (j = 0; j < np; j++) { + glColor4fv(p[j].c[0]); + glVertex3fv(p[j].p[0]); + + glColor4fv(p[j].c[1]); + glVertex3fv(p[j].p[1]); + + glColor4fv(p[j].c[2]); + glVertex3fv(p[j].p[2]); + + setpart(&p[j]); + } + glEnd(); + + if ((count % FRAME) == 0) { + fr = gettime(); + sprintf(frbuf, "Frame rate: %f", FRAME / fr); + } + + glDisable(GL_TEXTURE_2D); + glDisable(GL_ALPHA_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_FOG); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(10, 10); + printstring(GLUT_BITMAP_HELVETICA_18, frbuf); + glRasterPos2i(370, 470); + printstring(GLUT_BITMAP_HELVETICA_10, + "Fire V1.5 Written by David Bucciarelli (tech.hmw@plus.it)"); + + if (help) + printhelp(); + + reshape(WIDTH, HEIGHT); + glPopMatrix(); + + glutSwapBuffers(); + + count++; +} + + +static void +special(int key, int x, int y) +{ + switch (key) { + case GLUT_KEY_LEFT: + alpha += 2.0; + break; + case GLUT_KEY_RIGHT: + alpha -= 2.0; + break; + case GLUT_KEY_DOWN: + beta -= 2.0; + break; + case GLUT_KEY_UP: + beta += 2.0; + break; + } +} + +static void +key(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + + case 'a': + v += 0.01; + break; + case 'z': + v -= 0.01; + break; + + case 'j': + joyactive = (!joyactive); + break; + case 'h': + help = (!help); + break; + case 'f': + fog = (!fog); + break; + case 's': + shadows = !shadows; + break; + case 'R': + eject_r -= 0.03; + break; + case 'r': + eject_r += 0.03; + break; + case 't': + ridtri += 0.005; + break; + case 'T': + ridtri -= 0.005; + break; +#ifdef XMESA + case ' ': + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + fullscreen = (!fullscreen); + break; +#endif + } +} + +static void +inittextures(void) +{ + GLenum gluerr; + GLubyte tex[128][128][4]; + + glGenTextures(1, &groundid); + glBindTexture(GL_TEXTURE_2D, groundid); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + if (!LoadRGBMipmaps("../images/s128.rgb", GL_RGB)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + + glGenTextures(1, &treeid); + glBindTexture(GL_TEXTURE_2D, treeid); + + if (1) + { + int w, h; + GLenum format; + int x, y; + GLubyte *image = LoadRGBImage("../images/tree3.rgb", &w, &h, &format); + + if (!image) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + for (y = 0; y < 128; y++) + for (x = 0; x < 128; x++) { + tex[x][y][0] = image[(y + x * 128) * 3]; + tex[x][y][1] = image[(y + x * 128) * 3 + 1]; + tex[x][y][2] = image[(y + x * 128) * 3 + 2]; + if ((tex[x][y][0] == tex[x][y][1]) && + (tex[x][y][1] == tex[x][y][2]) && (tex[x][y][2] == 255)) + tex[x][y][3] = 0; + else + tex[x][y][3] = 255; + } + + if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 4, 128, 128, GL_RGBA, + GL_UNSIGNED_BYTE, (GLvoid *) (tex)))) { + fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr)); + exit(-1); + } + } + else { + if (!LoadRGBMipmaps("../images/tree2.rgba", GL_RGBA)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +} + +static void +inittree(void) +{ + int i; + float dist; + + for (i = 0; i < NUMTREE; i++) + do { + treepos[i][0] = vrnd() * TREEOUTR * 2.0 - TREEOUTR; + treepos[i][1] = 0.0; + treepos[i][2] = vrnd() * TREEOUTR * 2.0 - TREEOUTR; + dist = + sqrt(treepos[i][0] * treepos[i][0] + + treepos[i][2] * treepos[i][2]); + } while ((dist < TREEINR) || (dist > TREEOUTR)); +} + +int +main(int ac, char **av) +{ + int i; + + fprintf(stderr, + "Fire V1.5\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); + + /* Default settings */ + + WIDTH = 640; + HEIGHT = 480; + np = 800; + eject_r = 0.1; + dt = 0.015; + eject_vy = 4; + eject_vl = 1; + shadows = 1; + ridtri = 0.1; + + maxage = 1.0 / dt; + + if (ac == 2) + np = atoi(av[1]); + + if (ac == 4) { + WIDTH = atoi(av[2]); + HEIGHT = atoi(av[3]); + } + + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit(&ac, av); + + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + + if (!(win = glutCreateWindow("Fire"))) { + fprintf(stderr, "Error opening a window.\n"); + exit(-1); + } + + reshape(WIDTH, HEIGHT); + + inittextures(); + + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP); + glFogfv(GL_FOG_COLOR, fogcolor); + glFogf(GL_FOG_DENSITY, 0.1); +#ifdef FX + glHint(GL_FOG_HINT, GL_NICEST); +#endif + + p = malloc(sizeof(part) * np); + + for (i = 0; i < np; i++) + setnewpart(&p[i]); + + inittree(); + + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutDisplayFunc(drawfire); + glutIdleFunc(drawfire); + glutReshapeFunc(reshape); + glutMainLoop(); + + return (0); +} diff --git a/xc/extras/Mesa/demos/gamma.c b/xc/extras/Mesa/demos/gamma.c new file mode 100644 index 000000000..3d33c2a46 --- /dev/null +++ b/xc/extras/Mesa/demos/gamma.c @@ -0,0 +1,183 @@ + +/* $Id: gamma.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* Draw test patterns to help determine correct gamma value for a display. + When the intensities of the inner squares nearly match the intensities + of their frames (from some distance the borders should disappear) then + you've found the right gamma value. + + You can set Mesa's gamma values (for red, green and blue) with the + MESA_GAMMA environment variable. But only on X windows! + For example: + setenv MESA_GAMMA 1.5 1.6 1.4 + Sets the red gamma value to 1.5, green to 1.6 and blue to 1.4. + See the main README file for more information. + + For more info about gamma correction see: + http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html + + This program is in the public domain + + Brian Paul 19 Oct 1995 + Kai Schuetz 05 Jun 1999 */ + +/* Conversion to GLUT by Mark J. Kilgard */ + +/* + * $Log: gamma.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 2000/03/18 01:13:29 brianp + * colors were computed incorrectly (Hans Nelles) + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.1 1999/06/19 01:35:38 brianp + * merged in Kai Schuetz's RGB changes + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, (GLint) width, (GLint) height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glShadeModel(GL_FLAT); +} + +/* ARGSUSED1 */ +static void +key_esc(unsigned char key, int x, int y) +{ + if(key == 27) exit(0); /* Exit on Escape */ +} + +static GLubyte p25[] = { + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, +}; + +static GLubyte p50[] = { + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, +}; + +static GLubyte p75[] = { + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, + 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, +}; + +static GLubyte *stippletab[4] = {NULL, p25, p50, p75}; + +static void +gamma_ramp(GLfloat yoffs, GLfloat r, GLfloat g, GLfloat b) +{ + GLint d; + + glColor3f(0.0, 0.0, 0.0); /* solid black, no stipple */ + glRectf(-1.0, yoffs, -0.6, yoffs + 0.5); + + for(d = 1; d < 4; d++) { /* increasing density from 25% to 75% */ + GLfloat xcoord = (-1.0 + d*0.4); + GLfloat t = d * 0.25; + + glColor3f(r*t, g*t, b*t); /* draw outer rect */ + glRectf(xcoord, yoffs, xcoord+0.4, yoffs + 0.5); + + glColor3f(0.0, 0.0, 0.0); /* "clear" inner rect */ + glRectf(xcoord + 0.1, yoffs + 0.125, xcoord + 0.3, yoffs + 0.375); + + glColor3f(r, g, b); /* draw stippled inner rect */ + glEnable(GL_POLYGON_STIPPLE); + glPolygonStipple(stippletab[d]); + glRectf(xcoord + 0.1, yoffs + 0.125, xcoord + 0.3, yoffs + 0.375); + glDisable(GL_POLYGON_STIPPLE); + } + glColor3f(r, g, b); /* solid color, no stipple */ + glRectf(0.6, yoffs, 1.0, yoffs + 0.5); +} + +static void +display(void) +{ + gamma_ramp( 0.5, 1.0, 1.0, 1.0); /* white ramp */ + gamma_ramp( 0.0, 1.0, 0.0, 0.0); /* red ramp */ + gamma_ramp(-0.5, 0.0, 1.0, 0.0); /* green ramp */ + gamma_ramp(-1.0, 0.0, 0.0, 1.0); /* blue ramp */ + glFlush(); +} + +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); + + glutInitWindowPosition(50, 50); + glutInitWindowSize(500, 400); + + glutCreateWindow("gamma test patterns"); + glutReshapeFunc(Reshape); + glutDisplayFunc(display); + glutKeyboardFunc(key_esc); + + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/demos/gears.c b/xc/extras/Mesa/demos/gears.c new file mode 100644 index 000000000..2a38a091a --- /dev/null +++ b/xc/extras/Mesa/demos/gears.c @@ -0,0 +1,360 @@ +/* $Id: gears.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * 3-D gear wheels. This program is in the public domain. + * + * Command line options: + * -info print GL implementation information + * -exit automatically exit after 30 seconds + * + * + * Brian Paul + */ + +/* Conversion to GLUT by Mark J. Kilgard */ + + + +#include <math.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <GL/glut.h> + +#ifndef M_PI +#define M_PI 3.14159265 +#endif + +static GLint T0 = 0; +static GLint Frames = 0; +static GLint autoexit = 0; + +/** + + Draw a gear wheel. You'll probably want to call this function when + building a display list since we do a lot of trig here. + + Input: inner_radius - radius of hole at center + outer_radius - radius at center of teeth + width - width of gear + teeth - number of teeth + tooth_depth - depth of tooth + + **/ + +static void +gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, + GLint teeth, GLfloat tooth_depth) +{ + GLint i; + GLfloat r0, r1, r2; + GLfloat angle, da; + GLfloat u, v, len; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0; + r2 = outer_radius + tooth_depth / 2.0; + + da = 2.0 * M_PI / teeth / 4.0; + + glShadeModel(GL_FLAT); + + glNormal3f(0.0, 0.0, 1.0); + + /* draw front face */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + if (i < teeth) { + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); + } + } + glEnd(); + + /* draw front sides of teeth */ + glBegin(GL_QUADS); + da = 2.0 * M_PI / teeth / 4.0; + for (i = 0; i < teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); + } + glEnd(); + + glNormal3f(0.0, 0.0, -1.0); + + /* draw back face */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + if (i < teeth) { + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + } + } + glEnd(); + + /* draw back sides of teeth */ + glBegin(GL_QUADS); + da = 2.0 * M_PI / teeth / 4.0; + for (i = 0; i < teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + } + glEnd(); + + /* draw outward faces of teeth */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i < teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + u = r2 * cos(angle + da) - r1 * cos(angle); + v = r2 * sin(angle + da) - r1 * sin(angle); + len = sqrt(u * u + v * v); + u /= len; + v /= len; + glNormal3f(v, -u, 0.0); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); + glNormal3f(cos(angle), sin(angle), 0.0); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5); + u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); + v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); + glNormal3f(v, -u, 0.0); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); + glNormal3f(cos(angle), sin(angle), 0.0); + } + + glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5); + glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5); + + glEnd(); + + glShadeModel(GL_SMOOTH); + + /* draw inside radius cylinder */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + glNormal3f(-cos(angle), -sin(angle), 0.0); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + } + glEnd(); + +} + +static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; +static GLint gear1, gear2, gear3; +static GLfloat angle = 0.0; + +static void +draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(view_rotx, 1.0, 0.0, 0.0); + glRotatef(view_roty, 0.0, 1.0, 0.0); + glRotatef(view_rotz, 0.0, 0.0, 1.0); + + glPushMatrix(); + glTranslatef(-3.0, -2.0, 0.0); + glRotatef(angle, 0.0, 0.0, 1.0); + glCallList(gear1); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(3.1, -2.0, 0.0); + glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); + glCallList(gear2); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(-3.1, 4.2, 0.0); + glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); + glCallList(gear3); + glPopMatrix(); + + glPopMatrix(); + + glutSwapBuffers(); + + Frames++; + + { + GLint t = glutGet(GLUT_ELAPSED_TIME); + if (t - T0 >= 5000) { + GLfloat seconds = (t - T0) / 1000.0; + GLfloat fps = Frames / seconds; + printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); + T0 = t; + Frames = 0; + if ((t >= 999.0 * autoexit) && (autoexit)) + exit(0); + } + } +} + + +static void +idle(void) +{ + angle += 2.0; + glutPostRedisplay(); +} + +/* change view angle, exit upon ESC */ +/* ARGSUSED1 */ +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 'z': + view_rotz += 5.0; + break; + case 'Z': + view_rotz -= 5.0; + break; + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +/* change view angle */ +/* ARGSUSED1 */ +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_UP: + view_rotx += 5.0; + break; + case GLUT_KEY_DOWN: + view_rotx -= 5.0; + break; + case GLUT_KEY_LEFT: + view_roty += 5.0; + break; + case GLUT_KEY_RIGHT: + view_roty -= 5.0; + break; + default: + return; + } + glutPostRedisplay(); +} + +/* new window size or exposure */ +static void +reshape(int width, int height) +{ + GLfloat h = (GLfloat) height / (GLfloat) width; + + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -40.0); +} + +static void +init(int argc, char *argv[]) +{ + static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0}; + static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0}; + static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0}; + static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; + GLint i; + + glLightfv(GL_LIGHT0, GL_POSITION, pos); + glEnable(GL_CULL_FACE); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + + /* make the gears */ + gear1 = glGenLists(1); + glNewList(gear1, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); + gear(1.0, 4.0, 1.0, 20, 0.7); + glEndList(); + + gear2 = glGenLists(1); + glNewList(gear2, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); + gear(0.5, 2.0, 2.0, 10, 0.7); + glEndList(); + + gear3 = glGenLists(1); + glNewList(gear3, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); + gear(1.3, 2.0, 0.5, 10, 0.7); + glEndList(); + + glEnable(GL_NORMALIZE); + + for ( i=1; i<argc; i++ ) { + if (strcmp(argv[i], "-info")==0) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } + else if ( strcmp(argv[i], "-exit")==0) { + autoexit = 30; + printf("Auto Exit after %i seconds.\n", autoexit ); + } + } +} + +static void +visible(int vis) +{ + if (vis == GLUT_VISIBLE) + glutIdleFunc(idle); + else + glutIdleFunc(NULL); +} + +int main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + + glutInitWindowPosition(0, 0); + glutInitWindowSize(300, 300); + glutCreateWindow("Gears"); + init(argc, argv); + + glutDisplayFunc(draw); + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutVisibilityFunc(visible); + + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/demos/geartrain.c b/xc/extras/Mesa/demos/geartrain.c new file mode 100644 index 000000000..745000562 --- /dev/null +++ b/xc/extras/Mesa/demos/geartrain.c @@ -0,0 +1,1052 @@ +/* $Id: geartrain.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * GearTrain Simulator * Version: 1.00 + * + * Copyright (C) 1999 Shobhan Kumar Dutta All Rights Reserved. + * <skdutta@del3.vsnl.net.in> + * + * 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 + * SHOBHAN KUMAR DUTTA 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. + */ + + +#include <math.h> +#include <stdlib.h> +#include <GL/glut.h> +#include <string.h> +#include <stdio.h> + +#define min(x, y) ( x < y ? x : y ) + +#ifndef M_PI +#define M_PI 3.14159265 +#endif /* */ +typedef GLfloat TDA[4]; + +TDA background; + + +struct AXLE + { + char name[20]; + GLint id; + GLfloat radius; + GLint axis; + TDA color; + TDA position; + GLfloat length; + GLint motored; + GLfloat angular_velocity; + GLint direction; + }; + + +struct GEAR + { + char name[20]; + char type[7]; + GLint face; + GLint id; + GLfloat radius; + GLfloat width; + GLint teeth; + GLfloat tooth_depth; + GLfloat angle; + GLfloat angular_velocity; + TDA color; + GLint relative_position; + TDA position; + char axle_name[20]; + GLint axis; + GLint direction; + GLint motored; + }; + + +struct BELT + { + char name[20]; + GLint id; + char gear1_name[20]; + char gear2_name[20]; + }; + + +FILE * mainfile; +struct GEAR g[10]; +struct AXLE a[10]; +struct BELT b[10]; +int number_of_gears; +int number_of_axles; +int number_of_belts; + + +char Buf1[256], Buf2[256], Buf3[256], Buf4[256], Buf5[256]; + + +static void +strset (char buf[], char ch) +{ + int i; + for (i = 0; i < strlen (buf); i++) + buf[i] = ch; +} + + +static void +Clear_Buffers () +{ + strset (Buf1, 0); + strset (Buf2, 0); + strset (Buf3, 0); + strset (Buf4, 0); + strset (Buf5, 0); +} + + +static void +LoadTriplet (TDA A) +{ + Clear_Buffers (); + fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + A[0] = atof (Buf2); + A[1] = atof (Buf3); + A[2] = atof (Buf4); +} + + +static void +LoadReal (float *a) +{ + Clear_Buffers (); + fscanf (mainfile, "%s %s", Buf1, Buf2); + *a = atof (Buf2); +} + + +static void +LoadInteger (int *a) +{ + Clear_Buffers (); + fscanf (mainfile, "%s %s", Buf1, Buf2); + *a = atoi (Buf2); +} + + +static void +LoadText (char *a) +{ + Clear_Buffers (); + fscanf (mainfile, "%s %s", Buf1, Buf2); + strcpy (a, Buf2); +} + + +static void +getdata (char filename[]) +{ + int gear_count = 0, axle_count = 0, belt_count = 0, i; + + mainfile = fopen (filename, "r"); + if (!mainfile) { + printf("Error: couldn't open %s\n", filename); + exit(-1); + } + + do + { + Clear_Buffers (); + fscanf (mainfile, "%s", Buf1); + if (ferror (mainfile)) + { + printf ("\nError opening file !\n"); + exit (1); + } + + if (!(strcmp (Buf1, "BACKGROUND"))) + LoadTriplet (background); + + if (!(strcmp (Buf1, "ANAME"))) + { + LoadText (a[axle_count].name); + axle_count++; + } + + if (!(strcmp (Buf1, "ARADIUS"))) + LoadReal (&a[axle_count - 1].radius); + + if (!(strcmp (Buf1, "AAXIS"))) + LoadInteger (&a[axle_count - 1].axis); + + if (!(strcmp (Buf1, "ACOLOR"))) + LoadTriplet (a[axle_count - 1].color); + + if (!(strcmp (Buf1, "APOSITION"))) + LoadTriplet (a[axle_count - 1].position); + + if (!(strcmp (Buf1, "ALENGTH"))) + LoadReal (&a[axle_count - 1].length); + + if (!(strcmp (Buf1, "AMOTORED"))) + LoadInteger (&a[axle_count - 1].motored); + + if (!(strcmp (Buf1, "AANGULARVELOCITY"))) + LoadReal (&a[axle_count - 1].angular_velocity); + + if (!(strcmp (Buf1, "ADIRECTION"))) + LoadInteger (&a[axle_count - 1].direction); + + if (!(strcmp (Buf1, "GNAME"))) + { + LoadText (g[gear_count].name); + gear_count++; + } + + if (!(strcmp (Buf1, "GTYPE"))) + LoadText (g[gear_count - 1].type); + + if (!(strcmp (Buf1, "GFACE"))) + LoadInteger (&g[gear_count - 1].face); + + if (!(strcmp (Buf1, "GRADIUS"))) + LoadReal (&g[gear_count - 1].radius); + + if (!(strcmp (Buf1, "GWIDTH"))) + LoadReal (&g[gear_count - 1].width); + + if (!(strcmp (Buf1, "GTEETH"))) + LoadInteger (&g[gear_count - 1].teeth); + + if (!(strcmp (Buf1, "GTOOTHDEPTH"))) + LoadReal (&g[gear_count - 1].tooth_depth); + + if (!(strcmp (Buf1, "GCOLOR"))) + LoadTriplet (g[gear_count - 1].color); + + if (!(strcmp (Buf1, "GAXLE"))) + LoadText (g[gear_count - 1].axle_name); + + if (!(strcmp (Buf1, "GPOSITION"))) + LoadInteger (&g[gear_count - 1].relative_position); + + if (!(strcmp (Buf1, "BELTNAME"))) + { + LoadText (b[belt_count].name); + belt_count++; + } + + if (!(strcmp (Buf1, "GEAR1NAME"))) + LoadText (b[belt_count - 1].gear1_name); + + if (!(strcmp (Buf1, "GEAR2NAME"))) + LoadText (b[belt_count - 1].gear2_name); + } + + while (Buf1[0] != 0); + + for (i = 0; i < number_of_gears; i++) + { + g[i].axis = -1; + g[i].direction = 0; + g[i].angular_velocity = 0.0; + } + + number_of_gears = gear_count; + number_of_axles = axle_count; + number_of_belts = belt_count; + fclose (mainfile); +} + + +static void +axle (GLint j, GLfloat radius, GLfloat length) +{ + GLfloat angle, rad, incr = 10.0 * M_PI / 180.0; + + /* draw main cylinder */ + glBegin (GL_QUADS); + for (angle = 0.0; angle < 360.0; angle += 5.0) + { + rad = angle * M_PI / 180.0; + glNormal3f (cos (rad), sin (rad), 0.0); + glVertex3f (radius * cos (rad), radius * sin (rad), length / 2); + glVertex3f (radius * cos (rad), radius * sin (rad), -length / 2); + glVertex3f (radius * cos (rad + incr), radius * sin (rad + incr), -length / 2); + glVertex3f (radius * cos (rad + incr), radius * sin (rad + incr), length / 2); + } + glEnd (); + + /* draw front face */ + glNormal3f (0.0, 0.0, 1.0); + glBegin (GL_TRIANGLES); + for (angle = 0.0; angle < 360.0; angle += 5.0) + { + rad = angle * M_PI / 180.0; + glVertex3f (0.0, 0.0, length / 2); + glVertex3f (radius * cos (rad), radius * sin (rad), length / 2); + glVertex3f (radius * cos (rad + incr), radius * sin (rad + incr), length / 2); + glVertex3f (0.0, 0.0, length / 2); + } + glEnd (); + + /* draw back face */ + glNormal3f (0.0, 0.0, -1.0); + glBegin (GL_TRIANGLES); + for (angle = 0.0; angle <= 360.0; angle += 5.0) + { + rad = angle * M_PI / 180.0; + glVertex3f (0.0, 0.0, -length / 2); + glVertex3f (radius * cos (rad), radius * sin (rad), -length / 2); + glVertex3f (radius * cos (rad + incr), radius * sin (rad + incr), -length / 2); + glVertex3f (0.0, 0.0, -length / 2); + } + glEnd (); +} + + + +static void +gear (GLint j, char type[], GLfloat radius, GLfloat width, + GLint teeth, GLfloat tooth_depth) +{ + GLint i; + GLfloat r1, r2; + GLfloat angle, da; + GLfloat u, v, len, fraction = 0.5; + GLfloat n = 1.0; + + r1 = radius - tooth_depth; + r2 = radius; + + da = 2.0 * M_PI / teeth / 4.0; + if (!g[j].face) + { + fraction = -0.5; + n = -1.0; + } + if (!(strcmp (type, "NORMAL"))) + { + fraction = 0.5; + n = 1.0; + } + + /* draw front face */ + if (!(strcmp (type, "NORMAL"))) + { + glNormal3f (0.0, 0.0, 1.0 * n); + glBegin (GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + glVertex3f (0.0, 0.0, width * fraction); + glVertex3f (r1 * cos (angle), r1 * sin (angle), width * fraction); + glVertex3f (0.0, 0.0, width * fraction); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), width * fraction); + } + glEnd (); + } + else + { + glNormal3f (0.0, 0.0, 1.0 * n); + glBegin (GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + glVertex3f (0.0, 0.0, width * fraction); + glVertex3f ((r2 - width) * cos (angle), (r2 - width) * sin (angle), width * fraction); + glVertex3f (0.0, 0.0, width * fraction); + glVertex3f ((r2 - width) * cos (angle + 3 * da), (r2 - width) * sin (angle + 3 * da), width * fraction); + } + glEnd (); + } + + /* draw front sides of teeth */ + if (!(strcmp (type, "NORMAL"))) + { + glNormal3f (0.0, 0.0, 1.0 * n); + glBegin (GL_QUADS); + da = 2.0 * M_PI / teeth / 4.0; + for (i = 0; i < teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + glVertex3f (r1 * cos (angle), r1 * sin (angle), width * fraction); + glVertex3f (r2 * cos (angle + da), r2 * sin (angle + da), width * fraction); + glVertex3f (r2 * cos (angle + 2 * da), r2 * sin (angle + 2 * da), width * fraction); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), width * fraction); + } + glEnd (); + } + + glNormal3f (0.0, 0.0, -1.0 * n); + + /* draw back face */ + glBegin (GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + glVertex3f (r1 * cos (angle), r1 * sin (angle), -width * fraction); + glVertex3f (0.0, 0.0, -width * fraction); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), -width * fraction); + glVertex3f (0.0, 0.0, -width * fraction); + } + glEnd (); + + /* draw back sides of teeth */ + glNormal3f (0.0, 0.0, -1.0 * n); + glBegin (GL_QUADS); + da = 2.0 * M_PI / teeth / 4.0; + for (i = 0; i < teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), -width * fraction); + glVertex3f (r2 * cos (angle + 2 * da), r2 * sin (angle + 2 * da), -width * fraction); + glVertex3f (r2 * cos (angle + da), r2 * sin (angle + da), -width * fraction); + glVertex3f (r1 * cos (angle), r1 * sin (angle), -width * fraction); + } + glEnd (); + + + /* draw outward faces of teeth */ + if (!(strcmp (type, "NORMAL"))) + { + glBegin (GL_QUAD_STRIP); + for (i = 0; i < teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f (r1 * cos (angle), r1 * sin (angle), width * fraction); + glVertex3f (r1 * cos (angle), r1 * sin (angle), -width * fraction); + u = r2 * cos (angle + da) - r1 * cos (angle); + v = r2 * sin (angle + da) - r1 * sin (angle); + len = sqrt (u * u + v * v); + u /= len; + v /= len; + glNormal3f (v, -u, 0.0); + glVertex3f (r2 * cos (angle + da), r2 * sin (angle + da), width * fraction); + glVertex3f (r2 * cos (angle + da), r2 * sin (angle + da), -width * fraction); + glNormal3f (cos (angle), sin (angle), 0.0); + glVertex3f (r2 * cos (angle + 2 * da), r2 * sin (angle + 2 * da), width * fraction); + glVertex3f (r2 * cos (angle + 2 * da), r2 * sin (angle + 2 * da), -width * fraction); + u = r1 * cos (angle + 3 * da) - r2 * cos (angle + 2 * da); + v = r1 * sin (angle + 3 * da) - r2 * sin (angle + 2 * da); + glNormal3f (v, -u, 0.0); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), width * fraction); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), -width * fraction); + glNormal3f (cos (angle), sin (angle), 0.0); + } + } + else + { + glBegin (GL_QUAD_STRIP); + for (i = 0; i < teeth; i++) + { + angle = i * 2.0 * M_PI / teeth; + glVertex3f (r1 * cos (angle), r1 * sin (angle), width * fraction); + glVertex3f (r1 * cos (angle), r1 * sin (angle), -width * fraction); + u = r2 * cos (angle + da) - r1 * cos (angle); + v = r2 * sin (angle + da) - r1 * sin (angle); + len = sqrt (u * u + v * v); + u /= len; + v /= len; + glNormal3f (v, -u, 0.0); + glVertex3f ((r2 - width) * cos (angle + da), (r2 - width) * sin (angle + da), width * fraction); + glVertex3f (r2 * cos (angle + da), r2 * sin (angle + da), -width * fraction); + glNormal3f (cos (angle), sin (angle), n); + glVertex3f ((r2 - width) * cos (angle + 2 * da), (r2 - width) * sin (angle + 2 * da), width * fraction); + glVertex3f (r2 * cos (angle + 2 * da), r2 * sin (angle + 2 * da), -width * fraction); + u = r1 * cos (angle + 3 * da) - r2 * cos (angle + 2 * da); + v = r1 * sin (angle + 3 * da) - r2 * sin (angle + 2 * da); + glNormal3f (v, -u, 0.0); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), width * fraction); + glVertex3f (r1 * cos (angle + 3 * da), r1 * sin (angle + 3 * da), -width * fraction); + glNormal3f (cos (angle), sin (angle), n); + } + } + + glVertex3f (r1 * cos (0), r1 * sin (0), width * fraction); + glVertex3f (r1 * cos (0), r1 * sin (0), -width * fraction); + glEnd (); +} + + +static void +belt (struct GEAR g1, struct GEAR g2) +{ + GLfloat D, alpha, phi, angle, incr, width; + GLint indexes[3] = + { + 0, 0, 0 + }; + + GLfloat col[3] = + { + 0.0, 0.0, 0.0 + }; + + width = min (g1.width, g2.width); + D = sqrt (pow (g1.position[0] - g2.position[0], 2) + pow (g1.position[1] - g2.position[1], 2) + pow (g1.position[2] - g2.position[2], 2)); + alpha = acos ((g2.position[0] - g1.position[0]) / D); + phi = acos ((g1.radius - g2.radius) / D); + glBegin (GL_QUADS); + glColor3fv (col); + glMaterialiv (GL_FRONT, GL_COLOR_INDEXES, indexes); + incr = 1.2 * 360.0 / g1.teeth * M_PI / 180.00; + for (angle = alpha + phi; angle <= 2 * M_PI - phi + alpha; angle += 360.0 / g1.teeth * M_PI / 180.00) + { + glNormal3f (cos (angle), sin (angle), 0.0); + glVertex3f (g1.radius * cos (angle), g1.radius * sin (angle), width * 0.5); + glVertex3f (g1.radius * cos (angle), g1.radius * sin (angle), -width * 0.5); + glVertex3f (g1.radius * cos (angle + incr), g1.radius * sin (angle + incr), -width * 0.5); + glVertex3f (g1.radius * cos (angle + incr), g1.radius * sin (angle + incr), width * 0.5); + } + glEnd (); + glBegin (GL_QUADS); + glColor3fv (col); + glMaterialiv (GL_FRONT, GL_COLOR_INDEXES, indexes); + incr = 1.2 * 360.0 / g2.teeth * M_PI / 180.00; + for (angle = -phi + alpha; angle <= phi + alpha; angle += 360.0 / g1.teeth * M_PI / 180.0) + { + glNormal3f (cos (angle), sin (angle), 0.0); + glVertex3f (g2.radius * cos (angle) + g2.position[0] - g1.position[0], g2.radius * sin (angle) + g2.position[1] - g1.position[1], width * 0.5); + glVertex3f (g2.radius * cos (angle) + g2.position[0] - g1.position[0], g2.radius * sin (angle) + g2.position[1] - g1.position[1], width * -0.5); + glVertex3f (g2.radius * cos (angle + incr) + g2.position[0] - g1.position[0], g2.radius * sin (angle + incr) + g2.position[1] - g1.position[1], width * -0.5); + glVertex3f (g2.radius * cos (angle + incr) + g2.position[0] - g1.position[0], g2.radius * sin (angle + incr) + g2.position[1] - g1.position[1], width * 0.5); + } + glEnd (); + + glBegin (GL_QUADS); + glColor3fv (col); + glMaterialiv (GL_FRONT, GL_COLOR_INDEXES, indexes); + glVertex3f (g1.radius * cos (alpha + phi), g1.radius * sin (alpha + phi), width * 0.5); + glVertex3f (g1.radius * cos (alpha + phi), g1.radius * sin (alpha + phi), width * -0.5); + glVertex3f (g2.radius * cos (alpha + phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha + phi) + g2.position[1] - g1.position[1], width * -0.5); + glVertex3f (g2.radius * cos (alpha + phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha + phi) + g2.position[1] - g1.position[1], width * 0.5); + glVertex3f (g1.radius * cos (alpha - phi), g1.radius * sin (alpha - phi), width * 0.5); + glVertex3f (g1.radius * cos (alpha - phi), g1.radius * sin (alpha - phi), width * -0.5); + glVertex3f (g2.radius * cos (alpha - phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha - phi) + g2.position[1] - g1.position[1], width * -0.5); + glVertex3f (g2.radius * cos (alpha - phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha - phi) + g2.position[1] - g1.position[1], width * 0.5); + glEnd (); +} + + +static int +axle_find (char axle_name[]) +{ + int i; + + for (i = 0; i < number_of_axles; i++) + { + if (!(strcmp (axle_name, a[i].name))) + break; + } + return i; +} + + +static int +gear_find (char gear_name[]) +{ + int i; + + for (i = 0; i < number_of_gears; i++) + { + if (!(strcmp (gear_name, g[i].name))) + break; + } + return i; +} + + +static void +process () +{ + GLfloat x, y, z, D, dist; + GLint axle_index, i, j, g1, g2, k; + char error[80]; + + for (i = 0; i < number_of_gears; i++) + { + x = 0.0; + y = 0.0; + z = 0.0; + axle_index = axle_find (g[i].axle_name); + g[i].axis = a[axle_index].axis; + g[i].motored = a[axle_index].motored; + if (a[axle_index].motored) + { + g[i].direction = a[axle_index].direction; + g[i].angular_velocity = a[axle_index].angular_velocity; + } + if (g[i].axis == 0) + x = 1.0; + else if (g[i].axis == 1) + y = 1.0; + else + z = 1.0; + + g[i].position[0] = a[axle_index].position[0] + x * g[i].relative_position; + g[i].position[1] = a[axle_index].position[1] + y * g[i].relative_position; + g[i].position[2] = a[axle_index].position[2] + z * g[i].relative_position; + } + + for (k = 0; k < number_of_axles; k++) + { + for (i = 0; i < number_of_gears - 1; i++) + { + for (j = 0; j < number_of_gears; j++) + { + if (!(strcmp (g[i].type, g[j].type)) && (!(strcmp (g[i].type, "NORMAL"))) && ((strcmp (g[i].axle_name, g[j].axle_name) != 0)) && (g[i].axis == g[j].axis)) + { + D = sqrt (pow (g[i].position[0] - g[j].position[0], 2) + pow (g[i].position[1] - g[j].position[1], 2) + pow (g[i].position[2] - g[j].position[2], 2)); + if (D < 1.1 * (g[i].radius - g[i].tooth_depth + g[j].radius - g[j].tooth_depth)) + { + printf (error, "Gear %s and %s are too close to each other.", g[i].name, g[j].name); + + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + + if (g[i].axis == 0) + { + dist = g[i].position[0] - g[j].position[0]; + } + else if (g[i].axis == 1) + { + dist = g[i].position[1] - g[j].position[1]; + } + else + dist = g[i].position[2] - g[j].position[2]; + + dist = fabs (dist); + + if (dist < (g[i].width / 2 + g[j].width / 2)) + { + if ((g[i].motored) && (!(g[j].motored)) && (D < 0.95 * (g[i].radius + g[j].radius))) + { + axle_index = axle_find (g[j].axle_name); + if ((a[axle_index].direction != 0) && (g[j].angular_velocity != g[i].angular_velocity * g[i].teeth / g[j].teeth * g[i].radius / g[j].radius)) + { + printf (error, "Error in tooth linkage of gears %s and %s.", g[i].name, g[j].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + + g[j].motored = (a[axle_index].motored = 1); + g[j].direction = (a[axle_index].direction = -g[i].direction); + a[axle_index].angular_velocity = g[i].angular_velocity * g[i].teeth / g[j].teeth; + g[j].angular_velocity = (a[axle_index].angular_velocity *= g[i].radius / g[j].radius); + } + + if ((!(g[i].motored)) && (g[j].motored) && (D < 0.95 * (g[i].radius + g[j].radius))) + { + axle_index = axle_find (g[i].axle_name); + if ((a[axle_index].direction != 0) && (g[i].angular_velocity != g[j].angular_velocity * g[j].teeth / g[i].teeth * g[j].radius / g[i].radius)) + { + printf (error, "Error in tooth linkage of gears %s and %s.", g[i].name, g[j].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + + g[i].motored = (a[axle_index].motored = 1); + g[i].direction = (a[axle_index].direction = -g[j].direction); + a[axle_index].angular_velocity = g[j].angular_velocity * g[j].teeth / g[i].teeth; + g[i].angular_velocity = (a[axle_index].angular_velocity *= g[j].radius / g[i].radius); + + } + } + } + + if (!(strcmp (g[i].type, g[j].type)) && (!(strcmp (g[i].type, "BEVEL"))) && ((strcmp (g[i].axle_name, g[j].axle_name) != 0)) && (g[i].axis != g[j].axis)) + { + D = sqrt (pow (g[i].position[0] - g[j].position[0], 2) + pow (g[i].position[1] - g[j].position[1], 2) + pow (g[i].position[2] - g[j].position[2], 2)); + if ((g[i].motored) && (!(g[j].motored)) && (D < 0.95 * sqrt (g[i].radius * g[i].radius + g[j].radius * g[j].radius))) + { + axle_index = axle_find (g[j].axle_name); + if ((a[axle_index].direction != 0) && (g[j].angular_velocity != g[i].angular_velocity * g[i].teeth / g[j].teeth * g[i].radius / g[j].radius)) + { + printf (error, "Error in tooth linkage of gears %s and %s.", g[i].name, g[j].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + g[j].motored = (a[axle_index].motored = 1); + g[j].direction = (a[axle_index].direction = -g[i].direction); + a[axle_index].angular_velocity = g[i].angular_velocity * g[i].teeth / g[j].teeth; + g[j].angular_velocity = (a[axle_index].angular_velocity *= g[i].radius / g[j].radius); + } + + + if ((!(g[i].motored)) && (g[j].motored) && (D < 0.95 * sqrt (g[i].radius * g[i].radius + g[j].radius * g[j].radius))) + { + axle_index = axle_find (g[i].axle_name); + if ((a[axle_index].direction != 0) && (g[i].angular_velocity != g[j].angular_velocity * g[j].teeth / g[i].teeth * g[j].radius / g[i].radius)) + { + printf (error, "Error in tooth linkage of gears %s and %s.", g[i].name, g[j].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + g[i].motored = (a[axle_index].motored = 1); + g[i].direction = (a[axle_index].direction = -g[j].direction); + a[axle_index].angular_velocity = g[j].angular_velocity * g[j].teeth / g[i].teeth; + g[i].angular_velocity = (a[axle_index].angular_velocity *= g[j].radius / g[i].radius); + } + } + } + } + + for (i = 0; i < number_of_gears; i++) + { + axle_index = axle_find (g[i].axle_name); + g[i].motored = a[axle_index].motored; + if (a[axle_index].motored) + { + g[i].direction = a[axle_index].direction; + g[i].angular_velocity = a[axle_index].angular_velocity; + } + } + + for (i = 0; i < number_of_belts; i++) + { + g1 = gear_find (b[i].gear1_name); + g2 = gear_find (b[i].gear2_name); + D = sqrt (pow (g[g1].position[0] - g[g2].position[0], 2) + pow (g[g1].position[1] - g[g2].position[1], 2) + pow (g[g1].position[2] - g[g2].position[2], 2)); + if (!((g[g1].axis == g[g2].axis) && (!strcmp (g[g1].type, g[g2].type)) && (!strcmp (g[g1].type, "NORMAL")))) + { + printf (error, "Belt %s invalid.", b[i].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + + if ((g[g1].axis == g[g2].axis) && (!strcmp (g[g1].type, g[g2].type)) && (!strcmp (g[g1].type, "NORMAL"))) + { + /* + if((g[g1].motored)&&(g[g2].motored)) + if(g[g2].angular_velocity!=(g[g1].angular_velocity*g[g1].radius/g[g2].radius)) + { + printf(error,"Error in belt linkage of gears %s and %s".,g[g1].name,g[g2].name); + MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK); + exit(1); + } + */ + if (g[g1].axis == 0) + { + dist = g[g1].position[0] - g[g2].position[0]; + } + else if (g[i].axis == 1) + { + dist = g[g1].position[1] - g[g2].position[1]; + } + else + dist = g[g1].position[2] - g[g2].position[2]; + + dist = fabs (dist); + + if (dist > (g[g1].width / 2 + g[g2].width / 2)) + { + printf (error, "Belt %s invalid.", b[i].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + + if (dist < (g[g1].width / 2 + g[g2].width / 2)) + { + if (D < g[g1].radius + g[g2].radius) + { + printf (error, "Gears %s and %s too close to be linked with belts", g[g1].name, g[g2].name); + /*MessageBox(NULL,error,windowName,MB_ICONEXCLAMATION|MB_OK);*/ + exit (1); + } + + if ((g[g1].motored) && (!(g[g2].motored))) + { + axle_index = axle_find (g[g2].axle_name); + g[g2].motored = (a[axle_index].motored = 1); + g[g2].direction = (a[axle_index].direction = g[g1].direction); + g[g2].angular_velocity = (a[axle_index].angular_velocity = g[g1].angular_velocity * g[g1].radius / g[g2].radius); + } + + if ((!(g[g1].motored)) && (g[g2].motored)) + { + axle_index = axle_find (g[g1].axle_name); + g[g1].motored = (a[axle_index].motored = 1); + g[g1].direction = (a[axle_index].direction = g[g2].direction); + g[g1].angular_velocity = (a[axle_index].angular_velocity = g[g2].angular_velocity * g[g2].radius / g[g1].radius); + } + } + } + } + + for (i = 0; i < number_of_gears; i++) + { + axle_index = axle_find (g[i].axle_name); + g[i].motored = a[axle_index].motored; + if (a[axle_index].motored) + { + g[i].direction = a[axle_index].direction; + g[i].angular_velocity = a[axle_index].angular_velocity; + } + } + } +} + + + +GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 10.0; + + +static void +draw (void) +{ + int i; + GLfloat x, y, z; + int index; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glRotatef (view_rotx, 1.0, 0.0, 0.0); + glRotatef (view_roty, 0.0, 1.0, 0.0); + glRotatef (view_rotz, 0.0, 0.0, 1.0); + + for (i = 0; i < number_of_gears; i++) + { + x = 0.0; + y = 0.0; + z = 0.0; + glPushMatrix (); +/*glTranslatef( -3.0, -2.0, 0.0 );*/ + glTranslatef (g[i].position[0], g[i].position[1], g[i].position[2]); + if (g[i].axis == 0) + y = 1.0; + else if (g[i].axis == 1) + x = 1.0; + else + z = 1.0; + + if (z != 1.0) + glRotatef (90.0, x, y, z); + + glRotatef (g[i].direction * g[i].angle, 0.0, 0.0, 1.0); + glCallList (g[i].id); + glPopMatrix (); + } + + for (i = 0; i < number_of_axles; i++) + { + x = 0.0; + y = 0.0; + z = 0.0; + glPushMatrix (); + glTranslatef (a[i].position[0], a[i].position[1], a[i].position[2]); + if (a[i].axis == 0) + y = 1.0; + else if (a[i].axis == 1) + x = 1.0; + else + z = 1.0; + + if (z != 1.0) + glRotatef (90.0, x, y, z); + + glCallList (a[i].id); + glPopMatrix (); + } + + for (i = 0; i < number_of_belts; i++) + { + x = 0.0; + y = 0.0; + z = 0.0; + glPushMatrix (); + index = gear_find (b[i].gear1_name); + glTranslatef (g[index].position[0], g[index].position[1], g[index].position[2]); + if (g[index].axis == 0) + y = 1.0; + else if (g[index].axis == 1) + x = 1.0; + else + z = 1.0; + + if (z != 1.0) + glRotatef (90.0, x, y, z); + + glCallList (b[i].id); + glPopMatrix (); + } + + glPopMatrix (); + glutSwapBuffers (); +} + + + + +static void +idle (void) +{ + int i; + for (i = 0; i < number_of_gears; i++) + g[i].angle += g[i].angular_velocity; + glutPostRedisplay(); +} + + + + +/* change view angle, exit upon ESC */ +static void +key (unsigned char k, int x, int y) +{ + switch (k) + { + case 'x': + view_rotx += 5.0; + break; + case 'X': + view_rotx -= 5.0; + break; + case 'y': + view_roty += 5.0; + break; + case 'Y': + view_roty -= 5.0; + break; + case 'z': + view_rotz += 5.0; + break; + case 'Z': + view_rotz -= 5.0; + break; + case 0x1B: + exit(0); + } +} + + + + +/* new window size or exposure */ +static void +reshape (int width, int height) +{ + glViewport (0, 0, (GLint) width, (GLint) height); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + if (width > height) + { + GLfloat w = (GLfloat) width / (GLfloat) height; + glFrustum (-w, w, -1.0, 1.0, 5.0, 60.0); + } + else + { + GLfloat h = (GLfloat) height / (GLfloat) width; + glFrustum (-1.0, 1.0, -h, h, 5.0, 60.0); + } + + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + glTranslatef (0.0, 0.0, -40.0); + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + + + +static void +init (void) +{ + GLfloat matShine = 20.00F; + GLfloat light0Pos[4] = + { + 0.70F, 0.70F, 1.25F, 0.50F + }; + int i; + + glClearColor (background[0], background[1], background[2], 1.0F); + glClearIndex ((GLfloat) 0.0); + + glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, matShine); + glLightfv (GL_LIGHT0, GL_POSITION, light0Pos); + glEnable (GL_LIGHT0); + + glEnable (GL_LIGHTING); + glEnable (GL_DEPTH_TEST); + for (i = 0; i < number_of_gears; i++) + g[i].angle = 0.0; + + for (i = 0; i < number_of_gears; i++) + { + g[i].id = glGenLists (1); + glNewList (g[i].id, GL_COMPILE); + glColor3fv (g[i].color); + glMaterialfv (GL_FRONT, GL_SPECULAR, g[i].color); + gear (i, g[i].type, g[i].radius, g[i].width, g[i].teeth, g[i].tooth_depth); + glEndList (); + } + + for (i = 0; i < number_of_axles; i++) + { + a[i].id = glGenLists (1); + glNewList (a[i].id, GL_COMPILE); + glColor3fv (a[i].color); + glMaterialfv (GL_FRONT, GL_SPECULAR, a[i].color); + axle (i, a[i].radius, a[i].length); + glEndList (); + } + + for (i = 0; i < number_of_belts; i++) + { + b[i].id = glGenLists (1); + glNewList (b[i].id, GL_COMPILE); + belt (g[gear_find (b[i].gear1_name)], g[gear_find (b[i].gear2_name)]); + glEndList (); + } + + glEnable (GL_COLOR_MATERIAL); +} + + + +int +main (int argc, char *argv[]) +{ + char *file; + + if (argc < 2) + file = "geartrain.dat"; + else + file = argv[1]; + + glutInitWindowPosition (0, 0); + glutInitWindowSize(640,480); + glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); + + if (glutCreateWindow ("Gear Train Simulation") == GL_FALSE) + exit (1); + + getdata (file); + process (); + init (); + + glutDisplayFunc (draw); + glutReshapeFunc (reshape); + glutKeyboardFunc (key); + glutIdleFunc (idle); + glutMainLoop (); + return 0; +} + diff --git a/xc/extras/Mesa/demos/geartrain.dat b/xc/extras/Mesa/demos/geartrain.dat new file mode 100644 index 000000000..6b46745a2 --- /dev/null +++ b/xc/extras/Mesa/demos/geartrain.dat @@ -0,0 +1,119 @@ +BACKGROUND = 0.000 0.500 0.700
+
+ANAME = AXLE1
+ARADIUS = 1.000
+AAXIS = 2
+APOSITION = -7.000 0.000 0.000
+ACOLOR = 0.800 0.500 0.200
+ALENGTH = 6.000
+AMOTORED = 1
+AANGULARVELOCITY = 2.000
+ADIRECTION = 1
+
+ANAME = AXLE2
+ARADIUS = 1.000
+AAXIS = 2
+APOSITION = -3.000 0.000 0.000
+ACOLOR = 0.800 0.500 0.200
+ALENGTH = 12.000
+AMOTORED = 0
+
+ANAME = AXLE3
+ARADIUS = 1.000
+AAXIS = 2
+APOSITION = 1.000 0.000 0.000
+ACOLOR = 0.800 0.500 0.200
+ALENGTH = 6.000
+AMOTORED = 0
+
+ANAME = AXLE4
+ARADIUS = 1.000
+AAXIS = 2
+APOSITION = 8.000 0.000 0.000
+ACOLOR = 0.800 0.500 0.200
+ALENGTH = 18.000
+AMOTORED = 0
+
+ANAME = AXLE5
+ARADIUS = 1.000
+AAXIS = 1
+APOSITION = 8.000 -8.200 -7.400
+ACOLOR = 0.800 0.500 0.200
+ALENGTH = 12.000
+AMOTORED = 0
+
+GNAME = GEAR1
+GTYPE = NORMAL
+GRADIUS = 2.200
+GWIDTH = 3.000
+GTEETH = 40
+GTOOTHDEPTH = 0.500
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE1
+GPOSITION = 0.000
+
+GNAME = GEAR2
+GTYPE = NORMAL
+GRADIUS = 2.200
+GWIDTH = 3.000
+GTEETH = 30
+GTOOTHDEPTH = 0.500
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE2
+GPOSITION = 0.000
+
+GNAME = GEAR3
+GTYPE = NORMAL
+GRADIUS = 2.200
+GWIDTH = 3.000
+GTEETH = 20
+GTOOTHDEPTH = 0.500
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE3
+GPOSITION = 0.000
+
+GNAME = GEAR4
+GTYPE = NORMAL
+GRADIUS = 1.700
+GWIDTH = 1.000
+GTEETH = 20
+GTOOTHDEPTH = 0.500
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE2
+GPOSITION = 5.000
+
+GNAME = GEAR5
+GTYPE = NORMAL
+GRADIUS = 3.000
+GWIDTH = 1.000
+GTEETH = 20
+GTOOTHDEPTH = 0.500
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE4
+GPOSITION = 5.000
+
+GNAME = GEAR6
+GTYPE = BEVEL
+GFACE = 0
+GRADIUS = 4.000
+GWIDTH = 1.000
+GTEETH = 20
+GTOOTHDEPTH = 1.700
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE4
+GPOSITION = -4.000
+
+GNAME = GEAR7
+GTYPE = BEVEL
+GFACE = 0
+GRADIUS = 4.000
+GWIDTH = 1.000
+GTEETH = 20
+GTOOTHDEPTH = 1.700
+GCOLOR = 0.500 0.500 0.500
+GAXLE = AXLE5
+GPOSITION = 5.000
+
+BELTNAME = BELT1
+GEAR1NAME = GEAR5
+GEAR2NAME = GEAR4
diff --git a/xc/extras/Mesa/demos/glinfo.c b/xc/extras/Mesa/demos/glinfo.c new file mode 100644 index 000000000..cccc1c5de --- /dev/null +++ b/xc/extras/Mesa/demos/glinfo.c @@ -0,0 +1,53 @@ +/* $Id: glinfo.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Print GL, GLU and GLUT version and extension info + * + * Brian Paul This file in public domain. + * October 3, 1997 + */ + + +/* + * $Log: glinfo.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.2 1999/02/02 04:45:49 brianp + * include stdio.h before glut.h + * + * Revision 3.1 1998/02/22 16:42:54 brianp + * added casts to prevent compiler warnings + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <GL/glut.h> + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitDisplayMode( GLUT_RGB ); + glutCreateWindow(argv[0]); + + printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS)); + printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR)); + printf("GLU_VERSION: %s\n", (char *) gluGetString(GLU_VERSION)); + printf("GLU_EXTENSIONS: %s\n", (char *) gluGetString(GLU_EXTENSIONS)); + printf("GLUT_API_VERSION: %d\n", GLUT_API_VERSION); +#ifdef GLUT_XLIB_IMPLEMENTATION + printf("GLUT_XLIB_IMPLEMENTATION: %d\n", GLUT_XLIB_IMPLEMENTATION); +#endif + + return 0; +} diff --git a/xc/extras/Mesa/demos/gloss.c b/xc/extras/Mesa/demos/gloss.c new file mode 100644 index 000000000..9b7afc166 --- /dev/null +++ b/xc/extras/Mesa/demos/gloss.c @@ -0,0 +1,379 @@ +/* $Id: gloss.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Specular reflection demo. The specular highlight is modulated by + * a sphere-mapped texture. The result is a high-gloss surface. + * NOTE: you really need hardware acceleration for this. + * Also note, this technique can't be implemented with multi-texture + * and separate specular color interpolation because there's no way + * to indicate that the second texture unit (the reflection map) + * should modulate the specular color and not the base color. + * A future multi-texture extension could fix that. + * + * Command line options: + * -info print GL implementation information + * + * + * Brian Paul October 22, 1999 This program is in the public domain. + */ + + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + +#include "../util/readtex.c" /* I know, this is a hack. */ + +#define SPECULAR_TEXTURE_FILE "../images/reflect.rgb" +#define BASE_TEXTURE_FILE "../images/tile.rgb" + +/* Menu items */ +#define DO_SPEC_TEXTURE 1 +#define OBJECT 2 +#define ANIMATE 3 +#define QUIT 100 + +static GLuint CylinderObj = 0; +static GLuint TeapotObj = 0; +static GLuint Object = 0; +static GLboolean Animate = GL_TRUE; + +static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; +static GLfloat DXrot = 1.0, DYrot = 2.5; + +static GLfloat Black[4] = { 0, 0, 0, 0 }; +static GLfloat White[4] = { 1, 1, 1, 1 }; +static GLfloat Diffuse[4] = { .3, .3, 1.0, 1.0 }; /* blue */ +static GLfloat Shininess = 6; + +static GLuint BaseTexture, SpecularTexture; +static GLboolean DoSpecTexture = GL_TRUE; + +/* performance info */ +static GLint T0 = 0; +static GLint Frames = 0; + + + + +static void Idle( void ) +{ + if (Animate) { + Xrot += DXrot; + Yrot += DYrot; + glutPostRedisplay(); + } +} + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(Xrot, 1.0, 0.0, 0.0); + glRotatef(Yrot, 0.0, 1.0, 0.0); + glRotatef(Zrot, 0.0, 0.0, 1.0); + + /* First pass: diffuse lighting with base texture */ + glMaterialfv(GL_FRONT, GL_DIFFUSE, Diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, Black); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, BaseTexture); + glCallList(Object); + + /* Second pass: specular lighting with reflection texture */ + glBlendFunc(GL_ONE, GL_ONE); /* add */ + glEnable(GL_BLEND); + glDepthFunc(GL_LEQUAL); + glMaterialfv(GL_FRONT, GL_DIFFUSE, Black); + glMaterialfv(GL_FRONT, GL_SPECULAR, White); + if (DoSpecTexture) { + glBindTexture(GL_TEXTURE_2D, SpecularTexture); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + } + else { + glDisable(GL_TEXTURE_2D); + } + glCallList(Object); + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_BLEND); + + glPopMatrix(); + + glutSwapBuffers(); + + if (Animate) { + GLint t = glutGet(GLUT_ELAPSED_TIME); + Frames++; + if (t - T0 >= 5000) { + GLfloat seconds = (t - T0) / 1000.0; + GLfloat fps = Frames / seconds; + printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps); + T0 = t; + Frames = 0; + } + } +} + + +static void Reshape( int width, int height ) +{ + GLfloat h = 30.0; + GLfloat w = h * width / height; + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -w, w, -h, h, 150.0, 500.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -380.0 ); +} + + +static void ToggleAnimate(void) +{ + Animate = !Animate; + if (Animate) { + glutIdleFunc( Idle ); + T0 = glutGet(GLUT_ELAPSED_TIME); + Frames = 0; + } + else { + glutIdleFunc( NULL ); + } +} + + +static void ModeMenu(int entry) +{ + if (entry==ANIMATE) { + ToggleAnimate(); + } + else if (entry==DO_SPEC_TEXTURE) { + DoSpecTexture = !DoSpecTexture; + } + else if (entry==OBJECT) { + if (Object == TeapotObj) + Object = CylinderObj; + else + Object = TeapotObj; + } + else if (entry==QUIT) { + exit(0); + } + glutPostRedisplay(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 's': + Shininess--; + if (Shininess < 0.0) + Shininess = 0.0; + glMaterialf(GL_FRONT, GL_SHININESS, Shininess); + printf("Shininess = %g\n", Shininess); + break; + case 'S': + Shininess++; + if (Shininess > 128.0) + Shininess = 128.0; + glMaterialf(GL_FRONT, GL_SHININESS, Shininess); + printf("Shininess = %g\n", Shininess); + break; + case ' ': + ToggleAnimate(); + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + float step = 3.0; + (void) x; + (void) y; + + switch (key) { + case GLUT_KEY_UP: + Xrot += step; + break; + case GLUT_KEY_DOWN: + Xrot -= step; + break; + case GLUT_KEY_LEFT: + Yrot += step; + break; + case GLUT_KEY_RIGHT: + Yrot -= step; + break; + } + glutPostRedisplay(); +} + + +static void Init( int argc, char *argv[] ) +{ + /* Cylinder object */ + { + static GLfloat height = 100.0; + static GLfloat radius = 40.0; + static GLint slices = 24; /* pie slices around Z axis */ + static GLint stacks = 10; /* subdivisions along length of cylinder */ + static GLint rings = 4; /* rings in the end disks */ + GLUquadricObj *q = gluNewQuadric(); + assert(q); + gluQuadricTexture(q, GL_TRUE); + + CylinderObj = glGenLists(1); + glNewList(CylinderObj, GL_COMPILE); + + glPushMatrix(); + glTranslatef(0.0, 0.0, -0.5 * height); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + /*glScalef(8.0, 4.0, 2.0);*/ + glMatrixMode(GL_MODELVIEW); + + /* cylinder */ + gluQuadricNormals(q, GL_SMOOTH); + gluQuadricTexture(q, GL_TRUE); + gluCylinder(q, radius, radius, height, slices, stacks); + + /* end cap */ + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glScalef(3.0, 3.0, 1.0); + glMatrixMode(GL_MODELVIEW); + + glTranslatef(0.0, 0.0, height); + gluDisk(q, 0.0, radius, slices, rings); + + /* other end cap */ + glTranslatef(0.0, 0.0, -height); + gluQuadricOrientation(q, GLU_INSIDE); + gluDisk(q, 0.0, radius, slices, rings); + + glPopMatrix(); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + + glEndList(); + gluDeleteQuadric(q); + } + + /* Teapot */ + { + TeapotObj = glGenLists(1); + glNewList(TeapotObj, GL_COMPILE); + + glFrontFace(GL_CW); + glutSolidTeapot(40.0); + glFrontFace(GL_CCW); + + glEndList(); + } + + /* show cylinder by default */ + Object = CylinderObj; + + + /* lighting */ + glEnable(GL_LIGHTING); + { + GLfloat pos[4] = { 3, 3, 3, 1 }; + glLightfv(GL_LIGHT0, GL_AMBIENT, Black); + glLightfv(GL_LIGHT0, GL_DIFFUSE, White); + glLightfv(GL_LIGHT0, GL_SPECULAR, White); + glLightfv(GL_LIGHT0, GL_POSITION, pos); + glEnable(GL_LIGHT0); + glMaterialfv(GL_FRONT, GL_AMBIENT, Black); + glMaterialf(GL_FRONT, GL_SHININESS, Shininess); + glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); + } + + /* Base texture */ + glGenTextures(1, &BaseTexture); + glBindTexture(GL_TEXTURE_2D, BaseTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + if (!LoadRGBMipmaps(BASE_TEXTURE_FILE, GL_RGB)) { + printf("Error: couldn't load texture image file %s\n", BASE_TEXTURE_FILE); + exit(1); + } + + /* Specular texture */ + glGenTextures(1, &SpecularTexture); + glBindTexture(GL_TEXTURE_2D, SpecularTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +#if 1 + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); +#else + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV); +#endif + if (!LoadRGBMipmaps(SPECULAR_TEXTURE_FILE, GL_RGB)) { + printf("Error: couldn't load texture image file %s\n", SPECULAR_TEXTURE_FILE); + exit(1); + } + + /* misc */ + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); + glEnable(GL_NORMALIZE); + + if (argc > 1 && strcmp(argv[1], "-info")==0) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowSize( 500, 500 ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + + glutCreateWindow(argv[0] ); + + Init(argc, argv); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutCreateMenu(ModeMenu); + glutAddMenuEntry("Toggle Highlight", DO_SPEC_TEXTURE); + glutAddMenuEntry("Toggle Object", OBJECT); + glutAddMenuEntry("Toggle Animate", ANIMATE); + glutAddMenuEntry("Quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/gltestperf.c b/xc/extras/Mesa/demos/gltestperf.c new file mode 100644 index 000000000..2df168ba5 --- /dev/null +++ b/xc/extras/Mesa/demos/gltestperf.c @@ -0,0 +1,580 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <GL/glut.h> + +typedef struct +{ + char *name; + char *unit; + void (*init) (void); + int (*run) (int, int); + int type; + int numsize; + int size[10]; +} +benchmark; + +static int frontbuffer = 1; + +/***************************************************************************/ + +static void +init_test01(void) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-0.5, 639.5, -0.5, 479.5); + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_FLAT); + glDisable(GL_DEPTH_TEST); + + glClearColor(0.0, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + glColor3f(1.0, 0.0, 0.0); +} + +static int +test01(int size, int num) +{ + int x, y; + + glBegin(GL_POINTS); + for (y = 0; y < num; y++) + for (x = 0; x < 480; x++) + glVertex2i(x, x); + glEnd(); + + return 480 * num; +} + +/***************************************************************************/ + +static void +init_test02(void) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-0.5, 639.5, -0.5, 479.5); + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_SMOOTH); + glDisable(GL_DEPTH_TEST); + + glClearColor(0.0, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); +} + +static int +test02(int size, int num) +{ + int x, y; + + glBegin(GL_LINES); + for (y = 0; y < num; y++) + for (x = 0; x < size; x++) { + glColor3f(0.0, 1.0, y / (float) num); + glVertex2i(0, size - 1); + glColor3f(1.0, 0.0, x / (float) size); + glVertex2i(x, x); + } + glEnd(); + + return num * size; +} + +/***************************************************************************/ + +static void +init_test03(void) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, 1.0, -1000.0 * 480.0); + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + + glClearColor(0.0, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +static int +test03(int size, int num) +{ + int x, y, z; + + glBegin(GL_TRIANGLES); + for (y = 0; y < num; y++) + for (x = 0; x < size; x += 5) { + z = num * size - (y * size + x); + glColor3f(0.0, 1.0, 0.0); + glVertex3i(0, x, z); + + glColor3f(1.0, 0.0, x / (float) size); + glVertex3i(size - 1 - x, 0, z); + + glColor3f(1.0, x / (float) size, 0.0); + glVertex3i(x, size - 1 - x, z); + } + glEnd(); + + return size * num / 5; +} + +/***************************************************************************/ + +static void +init_test04(void) +{ + int x, y; + GLubyte tex[128 * 128 * 3]; + GLenum gluerr; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, 1.0, -1000.0 * 480.0); + + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + for (y = 0; y < 128; y++) + for (x = 0; x < 128; x++) { + tex[(x + y * 128) * 3 + 0] = ((x % (128 / 4)) < (128 / 8)) ? 255 : 0; + tex[(x + y * 128) * 3 + 1] = ((y % (128 / 4)) < (128 / 8)) ? 255 : 0; + tex[(x + y * 128) * 3 + 2] = x; + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB, + GL_UNSIGNED_BYTE, (GLvoid *) (&tex[0])))) { + fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr)); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glEnable(GL_TEXTURE_2D); + + glClearColor(0.0, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +static int +test04(int size, int num) +{ + int x, y, z; + + glBegin(GL_TRIANGLES); + for (y = 0; y < num; y++) + for (x = 0; x < size; x += 5) { + z = num * size - (y * size + x); + glTexCoord2f(1.0, 1.0); + glColor3f(1.0, 0.0, 0.0); + glVertex3i(0, x, z); + + glTexCoord2f(0.0, 1.0); + glColor3f(0.0, 1.0, 0.0); + glVertex3i(size - 1 - x, 0, z); + + glTexCoord2f(1.0, 0.0); + glColor3f(0.0, 0.0, 1.0); + glVertex3i(x, size - 1 - x, z); + } + glEnd(); + + return num * size / 5; +} + +/***************************************************************************/ + +static void +init_test05(void) +{ + int x, y; + GLubyte tex[128 * 128 * 3]; + GLenum gluerr; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + for (y = 0; y < 128; y++) + for (x = 0; x < 128; x++) { + tex[(x + y * 128) * 3 + 0] = ((x % (128 / 4)) < (128 / 8)) ? 255 : 0; + tex[(x + y * 128) * 3 + 1] = ((y % (128 / 4)) < (128 / 8)) ? 255 : 0; + tex[(x + y * 128) * 3 + 2] = x; + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB, + GL_UNSIGNED_BYTE, (GLvoid *) (&tex[0])))) { + fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr)); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glEnable(GL_TEXTURE_2D); + + glDepthFunc(GL_ALWAYS); + + glClearColor(0.0, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +static int +test05(int size, int num) +{ + int y; + float v0[3], v1[3], v2[3], v3[3]; + float cv0[3], cv1[3], cv2[3], cv3[3]; + float tv0[3], tv1[3], tv2[3], tv3[3]; + + v0[0] = 320 - size / 2; + v0[1] = 240 - size / 2; + v0[2] = 0.0; + v1[0] = 320 + size / 2; + v1[1] = 240 - size / 2; + v1[2] = 0.0; + v2[0] = 320 - size / 2; + v2[1] = 240 + size / 2; + v2[2] = 0.0; + v3[0] = 320 + size / 2; + v3[1] = 240 + size / 2; + v3[2] = 0.0; + cv0[0] = 1.0; + cv0[1] = 0.0; + cv0[2] = 0.0; + cv1[0] = 1.0; + cv1[1] = 1.0; + cv1[2] = 0.0; + cv2[0] = 1.0; + cv2[1] = 0.0; + cv2[2] = 1.0; + cv3[0] = 1.0; + cv3[1] = 1.0; + cv3[2] = 1.0; + tv0[0] = 0.0; + tv0[1] = 0.0; + tv0[2] = 0.0; + tv1[0] = 1.0; + tv1[1] = 0.0; + tv1[2] = 0.0; + tv2[0] = 0.0; + tv2[1] = 1.0; + tv2[2] = 0.0; + tv3[0] = 1.0; + tv3[1] = 1.0; + tv3[2] = 0.0; + + glBegin(GL_TRIANGLE_STRIP); + for (y = 0; y < num; y++) { + glColor3fv(cv0); + glTexCoord2fv(tv0); + glVertex3fv(v0); + + glColor3fv(cv1); + glTexCoord2fv(tv1); + glVertex3fv(v1); + + glColor3fv(cv2); + glTexCoord2fv(tv2); + glVertex3fv(v2); + + glColor3fv(cv3); + glTexCoord2fv(tv3); + glVertex3fv(v3); + } + glEnd(); + + return 4 * num - 2; +} + +/***************************************************************************/ + +static void +init_test06(void) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-0.5, 639.5, -0.5, 479.5); + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + + glClearColor(0.0, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +static int +test06(int size, int num) +{ + int y; + + for (y = 0; y < num; y++) { + glClearColor(y / (float) num, 0.1, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } + + return num; +} + +/***************************************************************************/ + +#define BMARKS_TIME 5.0 + +#define NUM_BMARKS 6 + +/* 554 ~= sqrt(640*480) */ + +static benchmark bmarks[NUM_BMARKS] = { + {"Simple Points", "Pnts", init_test01, test01, 0, 0, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, + {"Smooth Lines", "Lins", init_test02, test02, 1, 5, + {480, 250, 100, 50, 25, 0, 0, 0, 0, 0}}, + {"ZSmooth Triangles", "Tris", init_test03, test03, 1, 5, + {480, 250, 100, 50, 25, 0, 0, 0, 0, 0}}, + {"ZSmooth Tex Blend Triangles", "Tris", init_test04, test04, 1, 5, + {480, 250, 100, 50, 25, 0, 0, 0, 0, 0}}, + {"ZSmooth Tex Blend TMesh Triangles", "Tris", init_test05, test05, 2, 8, + {400, 250, 100, 50, 25, 10, 5, 2, 0, 0}}, + {"Color/Depth Buffer Clears", "Clrs", init_test06, test06, 3, 0, + {554, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +}; + +/***************************************************************************/ + +static void +dotest0param(benchmark * bmark) +{ + float stime, etime, dtime, tottime, maxtime, mintime; + int num, numelem, calibnum, j; + + glPushAttrib(GL_ALL_ATTRIB_BITS); + bmark->init(); + + stime = glutGet(GLUT_ELAPSED_TIME); + + dtime = 0.0; + calibnum = 0; + while (dtime < 2.0) { + bmark->run(0, 1); + glFinish(); + etime = glutGet(GLUT_ELAPSED_TIME); + dtime = (etime - stime) / 1000.0; + calibnum++; + } + glPopAttrib(); + + fprintf(stderr, "Elapsed time for the calibration test (%d): %f\n", + calibnum, dtime); + + num = (int) ((BMARKS_TIME / dtime) * calibnum); + + if (num < 1) + num = 1; + + fprintf(stderr, "Selected number of benchmark iterations: %d\n", num); + + mintime = HUGE_VAL; + maxtime = -HUGE_VAL; + + for (tottime = 0.0, j = 0; j < 5; j++) { + glPushAttrib(GL_ALL_ATTRIB_BITS); + bmark->init(); + + stime = glutGet(GLUT_ELAPSED_TIME); + numelem = bmark->run(0, num); + glFinish(); + etime = glutGet(GLUT_ELAPSED_TIME); + + glPopAttrib(); + + dtime = (etime - stime) / 1000.0; + tottime += dtime; + + fprintf(stderr, "Elapsed time for run %d: %f\n", j, dtime); + + if (dtime < mintime) + mintime = dtime; + if (dtime > maxtime) + maxtime = dtime; + } + + tottime -= mintime + maxtime; + + fprintf(stdout, "%s\n%f %s/sec", bmark->name, numelem / (tottime / 3.0), + bmark->unit); + + if (bmark->type == 3) + fprintf(stdout, ", MPixel Fill/sec: %f\n\n", + (numelem * bmark->size[0] * (float) bmark->size[0]) / + (1000000.0 * tottime / 3.0)); + else + fprintf(stdout, "\n\n"); +} + +/***************************************************************************/ + +static void +dotest1param(benchmark * bmark) +{ + float stime, etime, dtime, tottime, maxtime, mintime; + int num, numelem, calibnum, j, k; + + fprintf(stdout, "%s\n", bmark->name); + + for (j = 0; j < bmark->numsize; j++) { + fprintf(stderr, "Current size: %d\n", bmark->size[j]); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + bmark->init(); + + stime = glutGet(GLUT_ELAPSED_TIME); + + dtime = 0.0; + calibnum = 0; + while (dtime < 2.0) { + bmark->run(bmark->size[j], 1); + glFinish(); + etime = glutGet(GLUT_ELAPSED_TIME); + dtime = (etime - stime) / 1000.0; + calibnum++; + } + glPopAttrib(); + + fprintf(stderr, "Elapsed time for the calibration test (%d): %f\n", + calibnum, dtime); + + num = (int) ((BMARKS_TIME / dtime) * calibnum); + + if (num < 1) + num = 1; + + fprintf(stderr, "Selected number of benchmark iterations: %d\n", num); + + mintime = HUGE_VAL; + maxtime = -HUGE_VAL; + + for (numelem = 1, tottime = 0.0, k = 0; k < 5; k++) { + glPushAttrib(GL_ALL_ATTRIB_BITS); + bmark->init(); + + stime = glutGet(GLUT_ELAPSED_TIME); + numelem = bmark->run(bmark->size[j], num); + glFinish(); + etime = glutGet(GLUT_ELAPSED_TIME); + + glPopAttrib(); + + dtime = (etime - stime) / 1000.0; + tottime += dtime; + + fprintf(stderr, "Elapsed time for run %d: %f\n", k, dtime); + + if (dtime < mintime) + mintime = dtime; + if (dtime > maxtime) + maxtime = dtime; + } + + tottime -= mintime + maxtime; + + fprintf(stdout, "SIZE=%03d => %f %s/sec", bmark->size[j], + numelem / (tottime / 3.0), bmark->unit); + if (bmark->type == 2) + fprintf(stdout, ", MPixel Fill/sec: %f\n", + (numelem * bmark->size[j] * bmark->size[j] / 2) / + (1000000.0 * tottime / 3.0)); + else + fprintf(stdout, "\n"); + } + + fprintf(stdout, "\n\n"); +} + +/***************************************************************************/ + +static void +display(void) +{ + int i; + + if (frontbuffer) + glDrawBuffer(GL_FRONT); + else + glDrawBuffer(GL_BACK); + + for (i = 0; i < NUM_BMARKS; i++) { + fprintf(stderr, "Benchmark: %d\n", i); + + switch (bmarks[i].type) { + case 0: + case 3: + dotest0param(&bmarks[i]); + break; + case 1: + case 2: + dotest1param(&bmarks[i]); + break; + } + } + + exit(0); +} + +int +main(int ac, char **av) +{ + fprintf(stderr, "GLTest v1.0\nWritten by David Bucciarelli\n"); + + if (ac == 2) + frontbuffer = 0; + + glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowPosition(0, 0); + glutInitWindowSize(640, 480); + glutCreateWindow("OpenGL/Mesa Performances"); + glutDisplayFunc(display); + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/glutfx.c b/xc/extras/Mesa/demos/glutfx.c new file mode 100644 index 000000000..faa28cd41 --- /dev/null +++ b/xc/extras/Mesa/demos/glutfx.c @@ -0,0 +1,212 @@ +/* $Id: glutfx.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Example of how one might use GLUT with the 3Dfx driver in full-screen mode. + * Note: this only works with X since we're using Mesa's GLX "hack" for + * using Glide. + * + * Goals: + * easy setup and input event handling with GLUT + * use 3Dfx hardware + * automatically set MESA environment variables + * don't lose mouse input focus + * + * Brian Paul This file is in the public domain. + */ + +/* + * $Log: glutfx.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 2000/06/27 17:04:43 brianp + * fixed compiler warnings + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.2 1999/03/28 18:18:33 brianp + * minor clean-up + * + * Revision 3.1 1998/06/29 02:37:30 brianp + * minor changes for Windows (Ted Jump) + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + + +#define WIDTH 640 +#define HEIGHT 480 + + +static int Window = 0; +static int ScreenWidth, ScreenHeight; +static GLuint Torus = 0; +static GLfloat Xrot = 0.0, Yrot = 0.0; + + + +static void Display( void ) +{ + static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; + static GLfloat red[4] = {1.0, 0.2, 0.2, 1.0}; + static GLfloat green[4] = {0.2, 1.0, 0.2, 1.0}; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(Xrot, 1, 0, 0); + glRotatef(Yrot, 0, 1, 0); + + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue); + glCallList(Torus); + + glRotatef(90.0, 1, 0, 0); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red); + glCallList(Torus); + + glRotatef(90.0, 0, 1, 0); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green); + glCallList(Torus); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + float ratio = (float) width / (float) height; + + ScreenWidth = width; + ScreenHeight = height; + + /* + * The 3Dfx driver is limited to 640 x 480 but the X window may be larger. + * Enforce that here. + */ + if (width > WIDTH) + width = WIDTH; + if (height > HEIGHT) + height = HEIGHT; + + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -ratio, ratio, -1.0, 1.0, 5.0, 30.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -20.0 ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + glutDestroyWindow(Window); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + break; + case GLUT_KEY_DOWN: + break; + case GLUT_KEY_LEFT: + break; + case GLUT_KEY_RIGHT: + break; + } + glutPostRedisplay(); +} + + +static void MouseMove( int x, int y ) +{ + Xrot = y - ScreenWidth / 2; + Yrot = x - ScreenHeight / 2; + glutPostRedisplay(); +} + + +static void Init( void ) +{ + Torus = glGenLists(1); + glNewList(Torus, GL_COMPILE); + glutSolidTorus(0.5, 2.0, 10, 20); + glEndList(); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); +} + + +int main( int argc, char *argv[] ) +{ +#ifndef _WIN32 + printf("NOTE: if you've got 3Dfx VooDoo hardware you must run this"); + printf(" program as root.\n\n"); + printf("Move the mouse. Press ESC to exit.\n\n"); +#endif + + /* Tell Mesa GLX to use 3Dfx driver in fullscreen mode. */ + putenv("MESA_GLX_FX=fullscreen"); + + /* Disable 3Dfx Glide splash screen */ + putenv("FX_GLIDE_NO_SPLASH="); + + /* Give an initial size and position so user doesn't have to place window */ + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit( &argc, argv ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + + Window = glutCreateWindow(argv[0]); + if (!Window) { + printf("Error, couldn't open window\n"); + exit(1); + } + + /* + * Want the X window to fill the screen so that we don't have to + * worry about losing the mouse input focus. + * Note that we won't actually see the X window since we never draw + * to it, hence, the original X screen's contents aren't disturbed. + */ + glutFullScreen(); + + Init(); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutPassiveMotionFunc( MouseMove ); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/ipers.c b/xc/extras/Mesa/demos/ipers.c new file mode 100644 index 000000000..8993d3fc2 --- /dev/null +++ b/xc/extras/Mesa/demos/ipers.c @@ -0,0 +1,704 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#ifdef WIN32 +#include <windows.h> +#include <mmsystem.h> +#endif + +#include <GL/glut.h> + +#include "../util/readtex.c" + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen = 1; +#endif + +static int WIDTH = 640; +static int HEIGHT = 480; + +#define MAX_LOD 9 + +#define TEX_SKY_WIDTH 256 +#define TEX_SKY_HEIGHT TEX_SKY_WIDTH + +#ifndef M_PI +#define M_PI 3.1415926535 +#endif + +#define FROM_NONE 0 +#define FROM_DOWN 1 +#define FROM_UP 2 +#define FROM_LEFT 3 +#define FROM_RIGHT 4 +#define FROM_FRONT 5 +#define FROM_BACK 6 + +static int win = 0; + +static float obs[3] = { 3.8, 0.0, 0.0 }; +static float dir[3]; +static float v = 0.0; +static float alpha = -90.0; +static float beta = 90.0; + +static int fog = 1; +static int bfcull = 1; +static int usetex = 1; +static int help = 1; +static int poutline = 0; +static int normext = 1; +static int joyavailable = 0; +static int joyactive = 0; +static int LODbias = 3; +static int maxdepth = MAX_LOD; + +static unsigned int totpoly = 0; + +static GLuint t1id, t2id; +static GLuint skydlist, LODdlist[MAX_LOD], LODnumpoly[MAX_LOD]; + +static void +initlight(void) +{ + GLfloat lspec[4] = { 1.0, 1.0, 1.0, 1.0 }; + static GLfloat lightpos[4] = { 30, 15.0, 30.0, 1.0 }; + + glLightfv(GL_LIGHT0, GL_POSITION, lightpos); + glLightfv(GL_LIGHT0, GL_SPECULAR, lspec); + + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 32.0); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, lspec); +} + +static void +initdlists(void) +{ + static int slicetable[MAX_LOD][2] = { + {21, 10}, + {18, 9}, + {15, 8}, + {12, 7}, + {9, 6}, + {7, 5}, + {5, 4}, + {4, 3}, + {3, 2} + }; + GLUquadricObj *obj; + int i, xslices, yslices; + + obj = gluNewQuadric(); + + skydlist = glGenLists(1); + glNewList(skydlist, GL_COMPILE); + glBindTexture(GL_TEXTURE_2D, t2id); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glColor3f(1.0f, 1.0f, 1.0f); + + gluQuadricDrawStyle(obj, GLU_FILL); + gluQuadricNormals(obj, GLU_NONE); + gluQuadricTexture(obj, GL_TRUE); + gluQuadricOrientation(obj, GLU_INSIDE); + gluSphere(obj, 40.0f, 18, 9); + + glEndList(); + + for (i = 0; i < MAX_LOD; i++) { + LODdlist[i] = glGenLists(1); + glNewList(LODdlist[i], GL_COMPILE); + + gluQuadricDrawStyle(obj, GLU_FILL); + gluQuadricNormals(obj, GLU_SMOOTH); + gluQuadricTexture(obj, GL_TRUE); + gluQuadricOrientation(obj, GLU_OUTSIDE); + xslices = slicetable[i][0]; + yslices = slicetable[i][1]; + gluSphere(obj, 1.0f, xslices, yslices); + LODnumpoly[i] = xslices * (yslices - 2) + 2 * (xslices - 1); + + glEndList(); + } +} + +static void +inittextures(void) +{ + GLubyte tsky[TEX_SKY_HEIGHT][TEX_SKY_WIDTH][3]; + GLuint x, y; + GLfloat fact; + GLenum gluerr; + + /* Brick */ + + glGenTextures(1, &t1id); + glBindTexture(GL_TEXTURE_2D, t1id); + + if (!LoadRGBMipmaps("../images/bw.rgb", 3)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + /* Sky */ + + glGenTextures(1, &t2id); + glBindTexture(GL_TEXTURE_2D, t2id); + + for (y = 0; y < TEX_SKY_HEIGHT; y++) + for (x = 0; x < TEX_SKY_WIDTH; x++) + if (y < TEX_SKY_HEIGHT / 2) { + fact = y / (GLfloat) (TEX_SKY_HEIGHT / 2); + tsky[y][x][0] = + (GLubyte) (255.0f * (0.1f * fact + 0.3f * (1.0f - fact))); + tsky[y][x][1] = + (GLubyte) (255.0f * (0.2f * fact + 1.0f * (1.0f - fact))); + tsky[y][x][2] = 255; + } + else { + tsky[y][x][0] = tsky[TEX_SKY_HEIGHT - y - 1][x][0]; + tsky[y][x][1] = tsky[TEX_SKY_HEIGHT - y - 1][x][1]; + tsky[y][x][2] = 255; + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if ( + (gluerr = + gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TEX_SKY_WIDTH, TEX_SKY_HEIGHT, + GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *) (tsky)))) { + fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr)); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +} + +static float +gettime(void) +{ + static clock_t told = 0; + clock_t tnew, ris; + + tnew = clock(); + + ris = tnew - told; + + told = tnew; + + return (ris / (float) CLOCKS_PER_SEC); +} + +static void +calcposobs(void) +{ + dir[0] = sin(alpha * M_PI / 180.0); + dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); + dir[2] = cos(beta * M_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; +} + +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_LEFT: + alpha -= 2.0; + break; + case GLUT_KEY_RIGHT: + alpha += 2.0; + break; + case GLUT_KEY_DOWN: + beta -= 2.0; + break; + case GLUT_KEY_UP: + beta += 2.0; + break; + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: + exit(0); + break; + + case 'a': + v += 0.01; + break; + case 'z': + v -= 0.01; + break; + +#ifdef XMESA + case ' ': + fullscreen = (!fullscreen); + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + break; +#endif + + case '+': + LODbias--; + break; + case '-': + LODbias++; + break; + case 'j': + joyactive = (!joyactive); + break; + case 'h': + help = (!help); + break; + case 'f': + fog = (!fog); + break; + case 't': + usetex = (!usetex); + break; + case 'n': + normext = (!normext); + break; + case 'b': + if (bfcull) { + glDisable(GL_CULL_FACE); + bfcull = 0; + } + else { + glEnable(GL_CULL_FACE); + bfcull = 1; + } + break; + case 'p': + if (poutline) { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + poutline = 0; + usetex = 1; + } + else { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + poutline = 1; + usetex = 0; + } + break; + } +} + +static void +reshape(int w, int h) +{ + WIDTH = w; + HEIGHT = h; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90.0, w / (float) h, 0.8, 100.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, w, h); +} + +static void +printstring(void *font, char *string) +{ + int len, i; + + len = (int) strlen(string); + for (i = 0; i < len; i++) + glutBitmapCharacter(font, string[i]); +} + +static void +printhelp(void) +{ + glEnable(GL_BLEND); + glColor4f(0.5, 0.5, 0.5, 0.5); + glRecti(40, 40, 600, 440); + glDisable(GL_BLEND); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(300, 420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); + + glRasterPos2i(60, 390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); + glRasterPos2i(60, 360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); + glRasterPos2i(60, 330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); + glRasterPos2i(60, 300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); + glRasterPos2i(60, 270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); + glRasterPos2i(60, 240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); + glRasterPos2i(60, 210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); + glRasterPos2i(60, 180); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Toggle Wire frame"); + glRasterPos2i(60, 150); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "b - Toggle GL_EXT_rescale_normal extension"); + glRasterPos2i(60, 120); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "+/- - Increase/decrease the Object maximum LOD"); + + glRasterPos2i(60, 90); + if (joyavailable) + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "j - Toggle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "(No Joystick control available)"); +} + +static void +dojoy(void) +{ +#ifdef _WIN32 + static UINT max[2] = { 0, 0 }; + static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2]; + MMRESULT res; + JOYINFO joy; + + res = joyGetPos(JOYSTICKID1, &joy); + + if (res == JOYERR_NOERROR) { + joyavailable = 1; + + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2; + + if (joyactive) { + if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0])) + alpha -= + 2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]); + if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1])) + beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]); + + if (joy.wButtons & JOY_BUTTON1) + v += 0.01; + if (joy.wButtons & JOY_BUTTON2) + v -= 0.01; + } + } + else + joyavailable = 0; +#endif +} + +static void +drawipers(int depth, int from) +{ + int lod; + + if (depth == maxdepth) + return; + + lod = depth + LODbias; + if (lod < 0) + lod = 0; + if (lod >= MAX_LOD) + return; + + switch (from) { + case FROM_NONE: + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_DOWN); + drawipers(depth, FROM_UP); + drawipers(depth, FROM_FRONT); + drawipers(depth, FROM_BACK); + drawipers(depth, FROM_LEFT); + drawipers(depth, FROM_RIGHT); + break; + case FROM_FRONT: + glPushMatrix(); + glTranslatef(0.0f, -1.5f, 0.0f); + glScalef(0.5f, 0.5f, 0.5f); + + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_DOWN); + drawipers(depth, FROM_UP); + drawipers(depth, FROM_FRONT); + drawipers(depth, FROM_LEFT); + drawipers(depth, FROM_RIGHT); + glPopMatrix(); + break; + case FROM_BACK: + glPushMatrix(); + glTranslatef(0.0f, 1.5f, 0.0f); + glScalef(0.5f, 0.5f, 0.5f); + + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_DOWN); + drawipers(depth, FROM_UP); + drawipers(depth, FROM_BACK); + drawipers(depth, FROM_LEFT); + drawipers(depth, FROM_RIGHT); + glPopMatrix(); + break; + case FROM_LEFT: + glPushMatrix(); + glTranslatef(-1.5f, 0.0f, 0.0f); + glScalef(0.5f, 0.5f, 0.5f); + + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_DOWN); + drawipers(depth, FROM_UP); + drawipers(depth, FROM_FRONT); + drawipers(depth, FROM_BACK); + drawipers(depth, FROM_LEFT); + glPopMatrix(); + break; + case FROM_RIGHT: + glPushMatrix(); + glTranslatef(1.5f, 0.0f, 0.0f); + glScalef(0.5f, 0.5f, 0.5f); + + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_DOWN); + drawipers(depth, FROM_UP); + drawipers(depth, FROM_FRONT); + drawipers(depth, FROM_BACK); + drawipers(depth, FROM_RIGHT); + glPopMatrix(); + break; + case FROM_DOWN: + glPushMatrix(); + glTranslatef(0.0f, 0.0f, 1.5f); + glScalef(0.5f, 0.5f, 0.5f); + + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_DOWN); + drawipers(depth, FROM_FRONT); + drawipers(depth, FROM_BACK); + drawipers(depth, FROM_LEFT); + drawipers(depth, FROM_RIGHT); + glPopMatrix(); + break; + case FROM_UP: + glPushMatrix(); + glTranslatef(0.0f, 0.0f, -1.5f); + glScalef(0.5f, 0.5f, 0.5f); + + glCallList(LODdlist[lod]); + + depth++; + drawipers(depth, FROM_UP); + drawipers(depth, FROM_FRONT); + drawipers(depth, FROM_BACK); + drawipers(depth, FROM_LEFT); + drawipers(depth, FROM_RIGHT); + glPopMatrix(); + break; + } + + totpoly += LODnumpoly[lod]; +} + +static void +draw(void) +{ + static int count = 0; + static char frbuf[80]; + static GLfloat alpha = 0.0f; + static GLfloat beta = 0.0f; + float fr; + + dojoy(); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + if (usetex) + glEnable(GL_TEXTURE_2D); + else + glDisable(GL_TEXTURE_2D); + + if (fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glPushMatrix(); + calcposobs(); + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 0.0, 1.0); + + /* Scene */ + glEnable(GL_DEPTH_TEST); + + glShadeModel(GL_SMOOTH); + glBindTexture(GL_TEXTURE_2D, t1id); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glColor3f(1.0f, 1.0f, 1.0f); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); + + if (normext) + glEnable(GL_RESCALE_NORMAL_EXT); + else + glEnable(GL_NORMALIZE); + + glPushMatrix(); + glRotatef(alpha, 0.0f, 0.0f, 1.0f); + glRotatef(beta, 1.0f, 0.0f, 0.0f); + totpoly = 0; + drawipers(0, FROM_NONE); + glPopMatrix(); + + alpha += 0.5f; + beta += 0.3f; + + glDisable(GL_LIGHTING); + glDisable(GL_LIGHT0); + glShadeModel(GL_FLAT); + + if (normext) + glDisable(GL_RESCALE_NORMAL_EXT); + else + glDisable(GL_NORMALIZE); + + glCallList(skydlist); + + glPopMatrix(); + + /* Help Screen */ + + fr = gettime(); + sprintf(frbuf, + "Frame rate: %0.2f LOD: %d Tot. poly.: %d Poly/sec: %.1f", + 1.0 / fr, LODbias, totpoly, totpoly / fr); + + glDisable(GL_TEXTURE_2D); + glDisable(GL_FOG); + glShadeModel(GL_FLAT); + glDisable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(10, 10); + printstring(GLUT_BITMAP_HELVETICA_18, frbuf); + glRasterPos2i(350, 470); + printstring(GLUT_BITMAP_HELVETICA_10, + "IperS V1.0 Written by David Bucciarelli (tech.hmw@plus.it)"); + + if (help) + printhelp(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + glutSwapBuffers(); + + count++; +} + +int +main(int ac, char **av) +{ + float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 }; + + fprintf(stderr, + "IperS V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); + + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit(&ac, av); + + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + + if (!(win = glutCreateWindow("IperS"))) { + fprintf(stderr, "Error, couldn't open window\n"); + exit(-1); + } + + reshape(WIDTH, HEIGHT); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP2); + glFogfv(GL_FOG_COLOR, fogcolor); + + glFogf(GL_FOG_DENSITY, 0.006); + + glHint(GL_FOG_HINT, GL_NICEST); + + inittextures(); + initdlists(); + initlight(); + + glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]); + glClear(GL_COLOR_BUFFER_BIT); + + calcposobs(); + + glutReshapeFunc(reshape); + glutDisplayFunc(draw); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutIdleFunc(draw); + + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/isosurf.c b/xc/extras/Mesa/demos/isosurf.c new file mode 100644 index 000000000..c989c022f --- /dev/null +++ b/xc/extras/Mesa/demos/isosurf.c @@ -0,0 +1,966 @@ +/* $Id: isosurf.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Display an isosurface of 3-D wind speed volume. + * + * Command line options: + * -info print GL implementation information + * + * Brian Paul This file in public domain. + */ + + +/* Keys: + * ===== + * + * - Arrow keys to rotate + * - 's' toggles smooth shading + * - 'l' toggles lighting + * - 'f' toggles fog + * - 'I' and 'i' zoom in and out + * - 'c' toggles a user clip plane + * - 'm' toggles colorful materials in GL_TRIANGLES modes. + * - '+' and '-' move the user clip plane + * + * Other options are available via the popup menu. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#define GL_GLEXT_LEGACY +#include "GL/glut.h" + +#include "../util/readtex.c" /* I know, this is a hack. KW: me too. */ +#define TEXTURE_FILE "../images/reflect.rgb" + +#define LIT 0x1 +#define UNLIT 0x2 +#define TEXTURE 0x4 +#define NO_TEXTURE 0x8 +#define REFLECT 0x10 +#define NO_REFLECT 0x20 +#define POINT_FILTER 0x40 +#define LINEAR_FILTER 0x80 +#define GLVERTEX 0x100 +#define DRAW_ARRAYS 0x200 /* or draw_elts, if compiled */ +#define ARRAY_ELT 0x400 +#define COMPILED 0x800 +#define IMMEDIATE 0x1000 +#define SHADE_SMOOTH 0x2000 +#define SHADE_FLAT 0x4000 +#define TRIANGLES 0x8000 +#define STRIPS 0x10000 +#define USER_CLIP 0x20000 +#define NO_USER_CLIP 0x40000 +#define MATERIALS 0x80000 +#define NO_MATERIALS 0x100000 +#define FOG 0x200000 +#define NO_FOG 0x400000 +#define QUIT 0x800000 +#define DISPLAYLIST 0x1000000 +#define GLINFO 0x2000000 +#define STIPPLE 0x4000000 +#define NO_STIPPLE 0x8000000 + +#define LIGHT_MASK (LIT|UNLIT) +#define TEXTURE_MASK (TEXTURE|NO_TEXTURE) +#define REFLECT_MASK (REFLECT|NO_REFLECT) +#define FILTER_MASK (POINT_FILTER|LINEAR_FILTER) +#define RENDER_STYLE_MASK (GLVERTEX|DRAW_ARRAYS|ARRAY_ELT) +#define COMPILED_MASK (COMPILED|IMMEDIATE|DISPLAYLIST) +#define MATERIAL_MASK (MATERIALS|NO_MATERIALS) +#define PRIMITIVE_MASK (TRIANGLES|STRIPS) +#define CLIP_MASK (USER_CLIP|NO_USER_CLIP) +#define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT) +#define FOG_MASK (FOG|NO_FOG) +#define STIPPLE_MASK (STIPPLE|NO_STIPPLE) + +#define MAXVERTS 10000 +static float data[MAXVERTS][6]; +static float compressed_data[MAXVERTS][6]; +static GLuint indices[MAXVERTS]; +static GLuint tri_indices[MAXVERTS*3]; +static GLfloat col[100][4]; +static GLint numverts, num_tri_verts, numuniq; + +static GLfloat xrot; +static GLfloat yrot; +static GLfloat dist = -6; +static GLint state, allowed = ~0; +static GLboolean doubleBuffer = GL_TRUE; +static GLdouble plane[4] = {1.0, 0.0, -1.0, 0.0}; +static GLuint surf1; + +static GLboolean PrintInfo = GL_FALSE; + + +static GLubyte halftone[] = { + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, + 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, + 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, + 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, + 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, + 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55}; + +/* forward decl */ +int BuildList( int mode ); + + +static void read_surface( char *filename ) +{ + FILE *f; + + f = fopen(filename,"r"); + if (!f) { + printf("couldn't read %s\n", filename); + exit(1); + } + + numverts = 0; + while (!feof(f) && numverts<MAXVERTS) { + fscanf( f, "%f %f %f %f %f %f", + &data[numverts][0], &data[numverts][1], &data[numverts][2], + &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + numverts++; + } + numverts--; + + printf("%d vertices, %d triangles\n", numverts, numverts-2); + fclose(f); +} + + + + +struct data_idx { + float *data; + int idx; + int uniq_idx; +}; + + +#define COMPARE_FUNC( AXIS ) \ +static int compare_axis_##AXIS( const void *a, const void *b ) \ +{ \ + float t = ( (*(struct data_idx *)a).data[AXIS] - \ + (*(struct data_idx *)b).data[AXIS] ); \ + \ + if (t < 0) return -1; \ + if (t > 0) return 1; \ + return 0; \ +} + +COMPARE_FUNC(0) +COMPARE_FUNC(1) +COMPARE_FUNC(2) +COMPARE_FUNC(3) +COMPARE_FUNC(4) +COMPARE_FUNC(5) +COMPARE_FUNC(6) + +int (*(compare[7]))( const void *a, const void *b ) = +{ + compare_axis_0, + compare_axis_1, + compare_axis_2, + compare_axis_3, + compare_axis_4, + compare_axis_5, + compare_axis_6, +}; + + +#define VEC_ELT(f, s, i) (float *)(((char *)f) + s * i) + +static int sort_axis( int axis, + int vec_size, + int vec_stride, + struct data_idx *indices, + int start, + int finish, + float *out, + int uniq, + const float fudge ) +{ + int i; + + if (finish-start > 2) + { + qsort( indices+start, finish-start, sizeof(*indices), compare[axis] ); + } + else if (indices[start].data[axis] > indices[start+1].data[axis]) + { + struct data_idx tmp = indices[start]; + indices[start] = indices[start+1]; + indices[start+1] = tmp; + } + + if (axis == vec_size-1) { + for (i = start ; i < finish ; ) { + float max = indices[i].data[axis] + fudge; + float *dest = VEC_ELT(out, vec_stride, uniq); + int j; + + for (j = 0 ; j < vec_size ; j++) + dest[j] = indices[i].data[j]; + + for ( ; i < finish && max >= indices[i].data[axis]; i++) + indices[i].uniq_idx = uniq; + + uniq++; + } + } else { + for (i = start ; i < finish ; ) { + int j = i + 1; + float max = indices[i].data[axis] + fudge; + while (j < finish && max >= indices[j].data[axis]) j++; + if (j == i+1) { + float *dest = VEC_ELT(out, vec_stride, uniq); + int k; + + indices[i].uniq_idx = uniq; + + for (k = 0 ; k < vec_size ; k++) + dest[k] = indices[i].data[k]; + + uniq++; + } else { + uniq = sort_axis( axis+1, vec_size, vec_stride, + indices, i, j, out, uniq, fudge ); + } + i = j; + } + } + + return uniq; +} + + +static void extract_indices1( const struct data_idx *in, unsigned int *out, + int n ) +{ + int i; + for ( i = 0 ; i < n ; i++ ) { + out[in[i].idx] = in[i].uniq_idx; + } +} + + +static void compactify_arrays(void) +{ + int i; + struct data_idx *ind; + + ind = (struct data_idx *) malloc( sizeof(struct data_idx) * numverts ); + + for (i = 0 ; i < numverts ; i++) { + ind[i].idx = i; + ind[i].data = data[i]; + } + + numuniq = sort_axis(0, + sizeof(compressed_data[0])/sizeof(float), + sizeof(compressed_data[0]), + ind, + 0, + numverts, + (float *)compressed_data, + 0, + 1e-6); + + printf("Nr unique vertex/normal pairs: %d\n", numuniq); + + extract_indices1( ind, indices, numverts ); + free( ind ); +} + +static float myrand( float max ) +{ + return max*rand()/(RAND_MAX+1.0); +} + + +static void make_tri_indices( void ) +{ + unsigned int *v = tri_indices; + unsigned int parity = 0; + unsigned int i, j; + + for (j=2;j<numverts;j++,parity^=1) { + if (parity) { + *v++ = indices[j-1]; + *v++ = indices[j-2]; + *v++ = indices[j]; + } else { + *v++ = indices[j-2]; + *v++ = indices[j-1]; + *v++ = indices[j]; + } + } + + num_tri_verts = v - tri_indices; + printf("num_tri_verts: %d\n", num_tri_verts); + + for (i = j = 0 ; i < num_tri_verts ; i += 600, j++) { + col[j][3] = 1; + col[j][2] = myrand(1); + col[j][1] = myrand(1); + col[j][0] = myrand(1); + } +} + +#define MIN(x,y) (x < y) ? x : y + +static void draw_surface( int with_state ) +{ + GLuint i, j; + + switch (with_state & (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)) { +#ifdef GL_EXT_vertex_array + + case (COMPILED|DRAW_ARRAYS|STRIPS): + glDrawElements( GL_TRIANGLE_STRIP, numverts, GL_UNSIGNED_INT, indices ); + break; + + + case (COMPILED|ARRAY_ELT|STRIPS): + glBegin( GL_TRIANGLE_STRIP ); + for (i = 0 ; i < numverts ; i++) + glArrayElement( indices[i] ); + glEnd(); + break; + + case (COMPILED|DRAW_ARRAYS|TRIANGLES): + case (IMMEDIATE|DRAW_ARRAYS|TRIANGLES): + if (with_state & MATERIALS) { + for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) { + GLuint nr = MIN(num_tri_verts-i, 600); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]); + glDrawElements( GL_TRIANGLES, nr, GL_UNSIGNED_INT, tri_indices+i ); + } + } else { + glDrawElements( GL_TRIANGLES, num_tri_verts, GL_UNSIGNED_INT, + tri_indices ); + } + + break; + + /* Uses the original arrays (including duplicate elements): + */ + case (IMMEDIATE|DRAW_ARRAYS|STRIPS): + glDrawArraysEXT( GL_TRIANGLE_STRIP, 0, numverts ); + break; + + /* Uses the original arrays (including duplicate elements): + */ + case (IMMEDIATE|ARRAY_ELT|STRIPS): + glBegin( GL_TRIANGLE_STRIP ); + for (i = 0 ; i < numverts ; i++) + glArrayElement( i ); + glEnd(); + break; + + case (IMMEDIATE|ARRAY_ELT|TRIANGLES): + case (COMPILED|ARRAY_ELT|TRIANGLES): + if (with_state & MATERIALS) { + for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) { + GLuint nr = MIN(num_tri_verts-i, 600); + GLuint k; + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]); + glBegin( GL_TRIANGLES ); + for (k = 0 ; k < nr ; k++) + glArrayElement( tri_indices[i+k] ); + glEnd(); + } + } else { + glBegin( GL_TRIANGLES ); + for (i = 0 ; i < num_tri_verts ; i++) + glArrayElement( tri_indices[i] ); + + glEnd(); + } + break; + + case (IMMEDIATE|GLVERTEX|TRIANGLES): + if (with_state & MATERIALS) { + for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) { + GLuint nr = MIN(num_tri_verts-i, 600); + GLuint k; + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]); + glBegin( GL_TRIANGLES ); + for (k = 0 ; k < nr ; k++) { + glNormal3fv( &compressed_data[tri_indices[i+k]][3] ); + glVertex3fv( &compressed_data[tri_indices[i+k]][0] ); + } + glEnd(); + } + } else { + glBegin( GL_TRIANGLES ); + for (i = 0 ; i < num_tri_verts ; i++) { + glNormal3fv( &compressed_data[tri_indices[i]][3] ); + glVertex3fv( &compressed_data[tri_indices[i]][0] ); + } + glEnd(); + } + break; + + case (DISPLAYLIST|GLVERTEX|STRIPS): + if (!surf1) + surf1 = BuildList( GL_COMPILE_AND_EXECUTE ); + else + glCallList(surf1); + break; + +#endif + + /* Uses the original arrays (including duplicate elements): + */ + default: + glBegin( GL_TRIANGLE_STRIP ); + for (i=0;i<numverts;i++) { + glNormal3fv( &data[i][3] ); + glVertex3fv( &data[i][0] ); + } + glEnd(); + } +} + + + +static void Display(void) +{ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + draw_surface( state ); + glFlush(); + if (doubleBuffer) glutSwapBuffers(); +} + +int BuildList( int mode ) +{ + int rv = glGenLists(1); + glNewList(rv, mode ); + draw_surface( IMMEDIATE|GLVERTEX|STRIPS ); + glEndList(); + return rv; +} + +/* KW: only do this when necessary, so CVA can re-use results. + */ +static void set_matrix( void ) +{ + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, dist ); + glRotatef( yrot, 0.0, 1.0, 0.0 ); + glRotatef( xrot, 1.0, 0.0, 0.0 ); +} + +static void Benchmark( float xdiff, float ydiff ) +{ + int startTime, endTime; + int draws; + double seconds, fps, triPerSecond; + + printf("Benchmarking...\n"); + + draws = 0; + startTime = glutGet(GLUT_ELAPSED_TIME); + xrot = 0.0; + do { + xrot += xdiff; + yrot += ydiff; + set_matrix(); + Display(); + draws++; + endTime = glutGet(GLUT_ELAPSED_TIME); + } while (endTime - startTime < 5000); /* 5 seconds */ + + /* Results */ + seconds = (double) (endTime - startTime) / 1000.0; + triPerSecond = (numverts - 2) * draws / seconds; + fps = draws / seconds; + printf("Result: triangles/sec: %g fps: %g\n", triPerSecond, fps); +} + + +static void InitMaterials(void) +{ + static float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float diffuse[] = {0.5, 1.0, 1.0, 1.0}; + static float position0[] = {0.0, 0.0, 20.0, 0.0}; + static float position1[] = {0.0, 0.0, -20.0, 0.0}; + static float front_mat_shininess[] = {60.0}; + static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0}; + static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0}; + /* + static float back_mat_shininess[] = {60.0}; + static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0}; + static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; + */ + static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; + static float lmodel_twoside[] = {GL_FALSE}; + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position0); + glEnable(GL_LIGHT0); + + glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT1, GL_POSITION, position1); + glEnable(GL_LIGHT1); + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + + glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse); + + glPolygonStipple (halftone); +} + + + +#define UPDATE(o,n,mask) (o&=~mask, o|=n&mask) +#define CHANGED(o,n,mask) ((n&mask) && \ + (n&mask) != (o&mask) ? UPDATE(o,n,mask) : 0) + +static void ModeMenu(int m) +{ + m &= allowed; + + if (!m) return; + + if (m==QUIT) + exit(0); + + if (m==GLINFO) { + printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS)); + printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); + return; + } + + if (CHANGED(state, m, FILTER_MASK)) { + if (m & LINEAR_FILTER) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + } + + if (CHANGED(state, m, LIGHT_MASK)) { + if (m & LIT) + glEnable(GL_LIGHTING); + else + glDisable(GL_LIGHTING); + } + + if (CHANGED(state, m, SHADE_MASK)) { + if (m & SHADE_SMOOTH) + glShadeModel(GL_SMOOTH); + else + glShadeModel(GL_FLAT); + } + + + if (CHANGED(state, m, TEXTURE_MASK)) { + if (m & TEXTURE) + glEnable(GL_TEXTURE_2D); + else + glDisable(GL_TEXTURE_2D); + } + + if (CHANGED(state, m, REFLECT_MASK)) { + if (m & REFLECT) { + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + } else { + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + } + } + + if (CHANGED(state, m, CLIP_MASK)) { + if (m & USER_CLIP) { + glEnable(GL_CLIP_PLANE0); + } else { + glDisable(GL_CLIP_PLANE0); + } + } + + if (CHANGED(state, m, FOG_MASK)) { + if (m & FOG) + { + glEnable(GL_FOG); + printf("FOG enable\n"); + } + else + { + glDisable(GL_FOG); + printf("FOG disable\n"); + } + } + + if (CHANGED(state, m, STIPPLE_MASK)) { + if (m & STIPPLE) + { + glEnable(GL_POLYGON_STIPPLE); + printf("STIPPLE enable\n"); + } + else + { + glDisable(GL_POLYGON_STIPPLE); + printf("STIPPLE disable\n"); + } + } + +#ifdef GL_EXT_vertex_array + if (CHANGED(state, m, (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK))) + { + if ((m & (COMPILED_MASK|PRIMITIVE_MASK)) == (IMMEDIATE|STRIPS)) + { + glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), numverts, data ); + glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), numverts, &data[0][3]); + } + else + { + glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), numuniq, + compressed_data ); + glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), numuniq, + &compressed_data[0][3]); + } +#ifdef GL_EXT_compiled_vertex_array + if (allowed & COMPILED) { + if (m & COMPILED) { + glLockArraysEXT( 0, numuniq ); + } else { + glUnlockArraysEXT(); + } + } +#endif + } +#endif + + if (m & (RENDER_STYLE_MASK|PRIMITIVE_MASK)) { + UPDATE(state, m, (RENDER_STYLE_MASK|PRIMITIVE_MASK)); + } + + if (m & MATERIAL_MASK) { + UPDATE(state, m, MATERIAL_MASK); + } + + glutPostRedisplay(); +} + + + +static void Init(int argc, char *argv[]) +{ + GLfloat fogColor[4] = {0.5,1.0,0.5,1.0}; + + glClearColor(0.0, 0.0, 1.0, 0.0); + glEnable( GL_DEPTH_TEST ); + glEnable( GL_VERTEX_ARRAY_EXT ); + glEnable( GL_NORMAL_ARRAY_EXT ); + + InitMaterials(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5, 25 ); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glClipPlane(GL_CLIP_PLANE0, plane); + + set_matrix(); + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + + if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { + printf("Error: couldn't load texture image\n"); + exit(1); + } + + /* Green fog is easy to see */ + glFogi(GL_FOG_MODE,GL_EXP2); + glFogfv(GL_FOG_COLOR,fogColor); + glFogf(GL_FOG_DENSITY,0.15); + glHint(GL_FOG_HINT,GL_DONT_CARE); + + + compactify_arrays(); + make_tri_indices(); + + surf1 = BuildList( GL_COMPILE ); + + ModeMenu(SHADE_SMOOTH| + LIT| + NO_TEXTURE| + NO_REFLECT| + POINT_FILTER| + IMMEDIATE| + NO_USER_CLIP| + NO_MATERIALS| + NO_FOG| + NO_STIPPLE| + GLVERTEX); + + if (PrintInfo) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } +} + + + +static void Reshape(int width, int height) +{ + glViewport(0, 0, (GLint)width, (GLint)height); +} + + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + case 'f': + ModeMenu((state ^ FOG_MASK) & FOG_MASK); + break; + case 's': + ModeMenu((state ^ SHADE_MASK) & SHADE_MASK); + break; + case 't': + ModeMenu((state ^ STIPPLE_MASK) & STIPPLE_MASK); + break; + case 'l': + ModeMenu((state ^ LIGHT_MASK) & LIGHT_MASK); + break; + case 'm': + ModeMenu((state ^ MATERIAL_MASK) & MATERIAL_MASK); + break; + case 'c': + ModeMenu((state ^ CLIP_MASK) & CLIP_MASK); + break; + case 'v': + if (allowed&COMPILED) + ModeMenu(COMPILED|DRAW_ARRAYS|TRIANGLES); + break; + case 'V': + ModeMenu(IMMEDIATE|GLVERTEX|STRIPS); + break; + case 'b': + Benchmark(5.0, 0); + break; + case 'B': + Benchmark(0, 5.0); + break; + case 'i': + dist += .25; + set_matrix(); + glutPostRedisplay(); + break; + case 'I': + dist -= .25; + set_matrix(); + glutPostRedisplay(); + break; + case '-': + case '_': + plane[3] += 2.0; + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glClipPlane(GL_CLIP_PLANE0, plane); + set_matrix(); + glutPostRedisplay(); + break; + case '+': + case '=': + plane[3] -= 2.0; + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glClipPlane(GL_CLIP_PLANE0, plane); + set_matrix(); + glutPostRedisplay(); + break; + + } +} + + +static void SpecialKey( int key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_LEFT: + yrot -= 15.0; + break; + case GLUT_KEY_RIGHT: + yrot += 15.0; + break; + case GLUT_KEY_UP: + xrot += 15.0; + break; + case GLUT_KEY_DOWN: + xrot -= 15.0; + break; + default: + return; + } + set_matrix(); + glutPostRedisplay(); +} + + + +static GLint Args(int argc, char **argv) +{ + GLint i; + GLint mode = 0; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } + else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } + else if (strcmp(argv[i], "-info") == 0) { + PrintInfo = GL_TRUE; + } + else { + printf("%s (Bad option).\n", argv[i]); + return QUIT; + } + } + + return mode; +} + +int main(int argc, char **argv) +{ + GLenum type; + char *extensions; + + GLuint arg_mode = Args(argc, argv); + + if (arg_mode & QUIT) + exit(0); + + read_surface( "isosurf.dat" ); + + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 400); + + type = GLUT_DEPTH; + type |= GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Isosurface") <= 0) { + exit(0); + } + + /* Make sure server supports the vertex array extension */ + extensions = (char *) glGetString( GL_EXTENSIONS ); + + if (!strstr( extensions, "GL_EXT_vertex_array" )) + { + printf("Vertex arrays not supported by this renderer\n"); + allowed &= ~(COMPILED|DRAW_ARRAYS|ARRAY_ELT); + } + else if (!strstr( extensions, "GL_EXT_compiled_vertex_array" )) + { + printf("Compiled vertex arrays not supported by this renderer\n"); + allowed &= ~COMPILED; + } + + Init(argc, argv); + ModeMenu(arg_mode); + + glutCreateMenu(ModeMenu); + glutAddMenuEntry("GL info", GLINFO); + glutAddMenuEntry("", 0); + glutAddMenuEntry("Lit", LIT|NO_TEXTURE|NO_REFLECT); + glutAddMenuEntry("Unlit", UNLIT|NO_TEXTURE|NO_REFLECT); +/* glutAddMenuEntry("Textured", TEXTURE); */ + glutAddMenuEntry("Reflect", TEXTURE|REFLECT); + glutAddMenuEntry("", 0); + glutAddMenuEntry("Smooth", SHADE_SMOOTH); + glutAddMenuEntry("Flat", SHADE_FLAT); + glutAddMenuEntry("", 0); + glutAddMenuEntry("Fog", FOG); + glutAddMenuEntry("No Fog", NO_FOG); + glutAddMenuEntry("", 0); + glutAddMenuEntry("Stipple", STIPPLE); + glutAddMenuEntry("No Stipple", NO_STIPPLE); + glutAddMenuEntry("", 0); + glutAddMenuEntry("Point Filtered", POINT_FILTER); + glutAddMenuEntry("Linear Filtered", LINEAR_FILTER); + glutAddMenuEntry("", 0); + glutAddMenuEntry("glVertex (STRIPS)", IMMEDIATE|GLVERTEX|STRIPS); + glutAddMenuEntry("glVertex (TRIANGLES)", IMMEDIATE|GLVERTEX|TRIANGLES); + glutAddMenuEntry("", 0); + glutAddMenuEntry("glVertex display list (STRIPS)", + DISPLAYLIST|GLVERTEX|STRIPS); + glutAddMenuEntry("", 0); + if (allowed & DRAW_ARRAYS) { + glutAddMenuEntry("DrawArrays (STRIPS)", + IMMEDIATE|DRAW_ARRAYS|STRIPS); + glutAddMenuEntry("ArrayElement (STRIPS)", + IMMEDIATE|ARRAY_ELT|STRIPS); + glutAddMenuEntry("DrawElements (TRIANGLES)", + IMMEDIATE|DRAW_ARRAYS|TRIANGLES); + glutAddMenuEntry("ArrayElement (TRIANGLES)", + IMMEDIATE|ARRAY_ELT|TRIANGLES); + glutAddMenuEntry("", 0); + + } + if (allowed & COMPILED) { + glutAddMenuEntry("Compiled DrawElements (TRIANGLES)", + COMPILED|DRAW_ARRAYS|TRIANGLES); + glutAddMenuEntry("Compiled DrawElements (STRIPS)", + COMPILED|DRAW_ARRAYS|STRIPS); + glutAddMenuEntry("Compiled ArrayElement (TRIANGLES)", + COMPILED|ARRAY_ELT|TRIANGLES); + glutAddMenuEntry("Compiled ArrayElement (STRIPS)", + COMPILED|ARRAY_ELT|STRIPS); + glutAddMenuEntry("", 0); + } + glutAddMenuEntry("Quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Display); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/isosurf.dat b/xc/extras/Mesa/demos/isosurf.dat new file mode 100644 index 000000000..5cadecdb4 --- /dev/null +++ b/xc/extras/Mesa/demos/isosurf.dat @@ -0,0 +1,7179 @@ +-1.000000 0.050200 0.254800 0.280000 0.504000 0.808000 +-1.000000 0.061400 0.243900 0.248000 0.608000 0.744000 +-0.973900 0.050200 0.243900 0.312000 0.448000 0.832000 +-1.000000 0.100400 0.207000 0.040000 0.608000 0.784000 +-0.950000 0.050200 0.232900 0.312000 0.424000 0.840000 +-0.950000 0.100400 0.204500 0.176000 0.504000 0.840000 +-0.900000 0.050200 0.202100 0.368000 0.256000 0.888000 +-0.900000 0.100400 0.184100 0.296000 0.408000 0.856000 +-0.865600 0.050200 0.182900 0.480000 0.256000 0.832000 +-0.897500 0.100400 0.182900 0.392000 0.408000 0.816000 +-0.850000 0.050200 0.170400 0.488000 0.296000 0.816000 +-0.850000 0.100400 0.150400 0.488000 0.512000 0.696000 +-0.800000 0.050200 0.139800 0.504000 0.392000 0.760000 +-0.820700 0.100400 0.121900 0.496000 0.488000 0.704000 +-0.800000 0.077200 0.121900 0.512000 0.416000 0.744000 +-0.800000 0.100400 0.105500 0.480000 0.456000 0.736000 +-0.781300 0.050200 0.121900 0.536000 0.400000 0.736000 +-0.750000 0.100400 0.065100 0.488000 0.448000 0.736000 +-0.750000 0.050200 0.097600 0.464000 0.408000 0.776000 +-0.744800 0.100400 0.060900 0.496000 0.456000 0.728000 +-0.700000 0.050200 0.061900 0.536000 0.368000 0.752000 +-0.700000 0.051600 0.060900 0.528000 0.416000 0.728000 +-0.699000 0.050200 0.060900 0.608000 0.360000 0.696000 +-0.700000 0.100400 0.019100 0.504000 0.504000 0.688000 +-0.650000 0.050200 0.008200 0.568000 0.384000 0.720000 +-0.680200 0.100400 0.000000 0.600000 0.440000 0.656000 +-0.650000 0.063100 0.000000 0.592000 0.392000 0.696000 +-0.650000 0.100400 -0.043200 0.600000 0.608000 0.496000 +-0.641800 0.050200 0.000000 0.616000 0.400000 0.664000 +-0.638000 0.100400 -0.060900 0.672000 0.632000 0.368000 +-0.600000 0.050200 -0.054100 0.640000 0.448000 0.616000 +-0.600000 0.057600 -0.060900 0.728000 0.536000 0.408000 +-0.594700 0.050200 -0.060900 0.744000 0.504000 0.416000 +-0.600000 0.050200 -0.083400 0.800000 0.528000 -0.248000 +-0.573200 0.000000 -0.060900 0.920000 0.296000 -0.248000 +-0.600000 0.000000 -0.117700 0.848000 0.200000 -0.488000 +-0.554400 -0.050200 -0.060900 0.944000 0.280000 0.128000 +-0.600000 -0.008200 -0.121900 0.848000 0.208000 -0.472000 +-0.586600 -0.050200 -0.121900 0.872000 0.224000 -0.424000 +-0.600000 -0.050200 -0.162700 0.904000 0.232000 -0.344000 +-0.578300 -0.100400 -0.121900 0.848000 0.312000 -0.424000 +-0.600000 -0.077900 -0.182900 0.856000 0.208000 -0.464000 +-0.594100 -0.100400 -0.182900 0.816000 0.296000 -0.480000 +-0.600000 -0.100400 -0.193800 0.776000 0.296000 -0.544000 +-0.561800 -0.150600 -0.182900 0.544000 0.784000 -0.280000 +-0.600000 -0.150600 -0.229400 0.416000 0.744000 -0.512000 +-0.550000 -0.155500 -0.182900 0.296000 0.920000 -0.232000 +-0.600000 -0.160400 -0.243900 0.432000 0.688000 -0.576000 +-0.550000 -0.172700 -0.243900 0.008000 0.856000 -0.512000 +-0.600000 -0.200800 -0.299500 0.000000 0.872000 -0.480000 +-0.550000 -0.200800 -0.303600 -0.040000 0.880000 -0.464000 +-0.600000 -0.203400 -0.304800 0.008000 0.768000 -0.632000 +-0.550000 -0.201300 -0.304800 -0.032000 0.864000 -0.488000 +-0.600000 -0.251000 -0.360600 -0.120000 0.624000 -0.760000 +-0.550000 -0.245600 -0.365800 -0.104000 0.680000 -0.720000 +-0.576800 -0.251000 -0.365800 -0.136000 0.624000 -0.760000 +-0.550000 -0.251000 -0.371400 -0.120000 0.616000 -0.768000 +-0.600000 -0.256300 -0.365800 -0.112000 0.608000 -0.776000 +-0.550000 -0.301200 -0.401000 0.000000 0.424000 -0.904000 +-0.600000 -0.301200 -0.399100 0.008000 0.480000 -0.872000 +-0.550000 -0.349500 -0.426800 0.056000 0.416000 -0.904000 +-0.600000 -0.340300 -0.426800 0.032000 0.512000 -0.848000 +-0.600000 -0.301200 -0.399100 0.008000 0.480000 -0.872000 +-0.650000 -0.337200 -0.426800 0.016000 0.520000 -0.848000 +-0.650000 -0.301200 -0.398600 0.000000 0.528000 -0.840000 +-0.700000 -0.338200 -0.426800 -0.192000 0.592000 -0.776000 +-0.700000 -0.301200 -0.401600 0.016000 0.504000 -0.856000 +-0.736800 -0.351500 -0.426800 -0.240000 0.480000 -0.832000 +-0.750000 -0.301200 -0.392900 -0.104000 0.352000 -0.928000 +-0.750000 -0.351500 -0.422100 -0.312000 0.448000 -0.824000 +-0.800000 -0.301200 -0.380800 -0.264000 0.104000 -0.952000 +-0.800000 -0.351500 -0.388300 -0.664000 -0.152000 -0.728000 +-0.826000 -0.301200 -0.365800 -0.648000 -0.448000 -0.600000 +-0.812200 -0.351500 -0.365800 -0.856000 -0.296000 -0.408000 +-0.850000 -0.301200 -0.321900 -0.728000 -0.616000 -0.280000 +-0.821000 -0.351500 -0.304800 -0.824000 -0.504000 0.232000 +-0.850000 -0.306900 -0.304800 -0.768000 -0.624000 0.072000 +-0.807300 -0.351500 -0.243900 -0.864000 -0.472000 0.152000 +-0.850000 -0.301200 -0.293400 -0.744000 -0.560000 0.336000 +-0.834700 -0.301200 -0.243900 -0.840000 -0.504000 0.184000 +-0.850000 -0.276800 -0.243900 -0.792000 -0.552000 0.248000 +-0.831100 -0.301200 -0.182900 -0.848000 -0.520000 0.016000 +-0.850000 -0.271300 -0.182900 -0.816000 -0.568000 0.032000 +-0.832400 -0.301200 -0.121900 -0.840000 -0.528000 0.048000 +-0.850000 -0.274400 -0.121900 -0.816000 -0.568000 0.008000 +-0.826600 -0.301200 -0.060900 -0.824000 -0.544000 0.120000 +-0.850000 -0.265600 -0.060900 -0.808000 -0.568000 0.104000 +-0.817700 -0.301200 0.000000 -0.808000 -0.560000 0.168000 +-0.850000 -0.254700 0.000000 -0.800000 -0.568000 0.168000 +-0.805900 -0.301200 0.060900 -0.800000 -0.536000 0.232000 +-0.850000 -0.251000 0.014600 -0.800000 -0.560000 0.176000 +-0.838400 -0.251000 0.060900 -0.808000 -0.528000 0.248000 +-0.850000 -0.233200 0.060900 -0.816000 -0.512000 0.248000 +-0.819200 -0.251000 0.121900 -0.760000 -0.496000 0.400000 +-0.850000 -0.203500 0.121900 -0.792000 -0.528000 0.288000 +-0.800000 -0.251000 0.157900 -0.576000 -0.400000 0.696000 +-0.850000 -0.200800 0.125700 -0.776000 -0.360000 0.504000 +-0.800000 -0.206500 0.182900 -0.304000 -0.264000 0.912000 +-0.803100 -0.200800 0.182900 -0.456000 -0.168000 0.864000 +-0.800000 -0.200800 0.184500 -0.256000 -0.128000 0.952000 +-0.836800 -0.150600 0.182900 -0.304000 -0.304000 0.896000 +-0.800000 -0.150600 0.189500 -0.240000 -0.056000 0.960000 +-0.850000 -0.137400 0.182900 -0.304000 -0.312000 0.896000 +-0.800000 -0.100400 0.186900 0.104000 0.048000 0.992000 +-0.850000 -0.100400 0.192600 -0.136000 -0.312000 0.936000 +-0.800000 -0.063400 0.182900 0.240000 0.160000 0.952000 +-0.850000 -0.050200 0.193400 0.200000 0.072000 0.968000 +-0.809300 -0.050200 0.182900 0.232000 0.160000 0.952000 +-0.850000 0.000000 0.186200 0.256000 0.144000 0.952000 +-0.839600 0.000000 0.182900 0.264000 0.152000 0.944000 +-0.850000 0.016800 0.182900 0.328000 0.184000 0.920000 +-0.800000 0.000000 0.163200 0.400000 0.288000 0.864000 +-0.850000 0.050200 0.170400 0.488000 0.296000 0.816000 +-0.800000 0.050200 0.139800 0.504000 0.392000 0.760000 +-0.800000 0.000000 0.163200 0.400000 0.288000 0.864000 +-0.781300 0.050200 0.121900 0.536000 0.400000 0.736000 +-0.750000 0.000000 0.129400 0.496000 0.360000 0.776000 +-0.750000 0.012900 0.121900 0.496000 0.384000 0.768000 +-0.740500 0.000000 0.121900 0.504000 0.352000 0.784000 +-0.750000 0.050200 0.097600 0.464000 0.408000 0.776000 +-0.700000 0.000000 0.089700 0.584000 0.336000 0.736000 +-0.700000 0.050200 0.061900 0.536000 0.368000 0.752000 +-0.666100 0.000000 0.060900 0.560000 0.376000 0.728000 +-0.699000 0.050200 0.060900 0.608000 0.360000 0.696000 +-0.650000 0.000000 0.045200 0.576000 0.400000 0.704000 +-0.650000 0.050200 0.008200 0.568000 0.384000 0.720000 +-0.609800 0.000000 0.000000 0.696000 0.384000 0.592000 +-0.641800 0.050200 0.000000 0.616000 0.400000 0.664000 +-0.600000 0.000000 -0.017800 0.736000 0.384000 0.544000 +-0.600000 0.050200 -0.054100 0.640000 0.448000 0.616000 +-0.573200 0.000000 -0.060900 0.920000 0.296000 -0.248000 +-0.594700 0.050200 -0.060900 0.744000 0.504000 0.416000 +-0.594700 0.050200 -0.060900 0.744000 0.504000 0.416000 +-1.000000 0.050200 0.254800 0.280000 0.504000 0.808000 +-1.000000 0.050200 0.254800 0.280000 0.504000 0.808000 +-1.000000 0.000000 0.260200 0.424000 -0.312000 0.840000 +-0.973900 0.050200 0.243900 0.312000 0.448000 0.832000 +-0.976100 0.000000 0.243900 0.464000 -0.432000 0.768000 +-0.950000 0.050200 0.232900 0.312000 0.424000 0.840000 +-0.950000 0.000000 0.224500 0.344000 -0.144000 0.920000 +-0.900000 0.050200 0.202100 0.368000 0.256000 0.888000 +-0.900000 0.000000 0.204000 0.296000 0.088000 0.944000 +-0.865600 0.050200 0.182900 0.480000 0.256000 0.832000 +-0.850000 0.000000 0.186200 0.256000 0.144000 0.952000 +-0.850000 0.016800 0.182900 0.328000 0.184000 0.920000 +-0.865600 0.050200 0.182900 0.480000 0.256000 0.832000 +-0.850000 0.050200 0.170400 0.488000 0.296000 0.816000 +-0.850000 0.050200 0.170400 0.488000 0.296000 0.816000 +-1.000000 0.000000 0.260200 0.424000 -0.312000 0.840000 +-1.000000 0.000000 0.260200 0.424000 -0.312000 0.840000 +-0.976100 0.000000 0.243900 0.464000 -0.432000 0.768000 +-1.000000 -0.016700 0.243900 0.424000 -0.608000 0.656000 +-0.950000 0.000000 0.224500 0.344000 -0.144000 0.920000 +-1.000000 -0.050200 0.185900 -0.256000 -0.768000 0.576000 +-0.950000 -0.050200 0.212200 0.160000 -0.384000 0.904000 +-1.000000 -0.052000 0.182900 -0.336000 -0.760000 0.544000 +-0.950000 -0.074300 0.182900 -0.344000 -0.776000 0.520000 +-1.000000 -0.075600 0.121900 -0.328000 -0.896000 0.264000 +-0.950000 -0.095300 0.121900 -0.400000 -0.864000 0.280000 +-1.000000 -0.090800 0.060900 -0.320000 -0.912000 0.248000 +-0.950000 -0.100400 0.101700 -0.400000 -0.872000 0.264000 +-0.973400 -0.100400 0.060900 -0.344000 -0.904000 0.240000 +-0.950000 -0.110600 0.060900 -0.432000 -0.856000 0.248000 +-1.000000 -0.100400 0.014600 -0.304000 -0.920000 0.208000 +-0.950000 -0.123700 0.000000 -0.488000 -0.840000 0.216000 +-1.000000 -0.103100 0.000000 -0.304000 -0.920000 0.208000 +-0.950000 -0.136200 -0.060900 -0.528000 -0.832000 0.152000 +-1.000000 -0.112800 -0.060900 -0.376000 -0.912000 0.144000 +-0.950000 -0.144800 -0.121900 -0.536000 -0.832000 0.120000 +-1.000000 -0.120900 -0.121900 -0.400000 -0.904000 0.136000 +-0.950000 -0.150600 -0.169000 -0.584000 -0.792000 0.136000 +-1.000000 -0.129600 -0.182900 -0.400000 -0.904000 0.136000 +-0.952800 -0.150600 -0.182900 -0.568000 -0.808000 0.136000 +-1.000000 -0.135800 -0.243900 -0.400000 -0.904000 0.096000 +-0.966700 -0.150600 -0.243900 -0.472000 -0.864000 0.152000 +-1.000000 -0.142300 -0.304800 -0.328000 -0.456000 -0.824000 +-0.989000 -0.150600 -0.304800 -0.440000 -0.624000 -0.640000 +-1.000000 -0.100400 -0.332000 -0.256000 -0.392000 -0.880000 +-0.950000 -0.150600 -0.330800 -0.416000 -0.432000 -0.792000 +-0.950000 -0.100400 -0.349400 -0.088000 -0.160000 -0.976000 +-0.900000 -0.150600 -0.338300 -0.216000 -0.104000 -0.968000 +-0.900000 -0.100400 -0.346700 0.112000 -0.048000 -0.984000 +-0.850000 -0.150600 -0.349400 0.072000 0.056000 -0.992000 +-0.850000 -0.100400 -0.332400 0.280000 0.112000 -0.952000 +-0.800000 -0.150600 -0.340500 0.312000 0.288000 -0.896000 +-0.800000 -0.100400 -0.313000 0.368000 0.216000 -0.896000 +-0.750000 -0.150600 -0.317800 0.416000 0.384000 -0.816000 +-0.785000 -0.100400 -0.304800 0.328000 0.224000 -0.912000 +-0.750000 -0.129200 -0.304800 0.392000 0.376000 -0.832000 +-0.750000 -0.100400 -0.291100 0.336000 0.256000 -0.896000 +-0.731900 -0.150600 -0.304800 0.424000 0.400000 -0.808000 +-0.700000 -0.100400 -0.274700 0.392000 0.112000 -0.904000 +-0.700000 -0.150600 -0.284500 0.376000 0.392000 -0.832000 +-0.650000 -0.100400 -0.251900 0.448000 0.224000 -0.856000 +-0.650000 -0.150600 -0.267500 0.376000 0.464000 -0.792000 +-0.638400 -0.100400 -0.243900 0.560000 0.160000 -0.808000 +-0.612700 -0.150600 -0.243900 0.496000 0.576000 -0.640000 +-0.600000 -0.100400 -0.193800 0.776000 0.296000 -0.544000 +-0.600000 -0.150600 -0.229400 0.416000 0.744000 -0.512000 +-0.612700 -0.150600 -0.243900 0.496000 0.576000 -0.640000 +-0.600000 -0.160400 -0.243900 0.432000 0.688000 -0.576000 +-0.650000 -0.150600 -0.267500 0.376000 0.464000 -0.792000 +-0.600000 -0.200800 -0.299500 0.000000 0.872000 -0.480000 +-0.650000 -0.200800 -0.303800 0.136000 0.680000 -0.712000 +-0.600000 -0.203400 -0.304800 0.008000 0.768000 -0.632000 +-0.650000 -0.201600 -0.304800 0.104000 0.688000 -0.704000 +-0.600000 -0.251000 -0.360600 -0.120000 0.624000 -0.760000 +-0.650000 -0.251000 -0.354800 0.152000 0.632000 -0.752000 +-0.600000 -0.256300 -0.365800 -0.112000 0.608000 -0.776000 +-0.650000 -0.261300 -0.365800 0.088000 0.568000 -0.808000 +-0.600000 -0.301200 -0.399100 0.008000 0.480000 -0.872000 +-0.650000 -0.301200 -0.398600 0.000000 0.528000 -0.840000 +-0.650000 -0.261300 -0.365800 0.088000 0.568000 -0.808000 +-0.700000 -0.301200 -0.401600 0.016000 0.504000 -0.856000 +-0.700000 -0.252100 -0.365800 0.096000 0.552000 -0.824000 +-0.750000 -0.301200 -0.392900 -0.104000 0.352000 -0.928000 +-0.707800 -0.251000 -0.365800 0.064000 0.432000 -0.896000 +-0.750000 -0.251000 -0.369800 0.056000 0.280000 -0.952000 +-0.750000 -0.240500 -0.365800 0.056000 0.272000 -0.952000 +-0.800000 -0.251000 -0.370300 -0.064000 0.200000 -0.976000 +-0.800000 -0.234100 -0.365800 -0.112000 0.264000 -0.952000 +-0.828000 -0.251000 -0.365800 -0.248000 0.216000 -0.936000 +-0.800000 -0.200800 -0.355700 0.080000 0.256000 -0.960000 +-0.850000 -0.251000 -0.359600 -0.320000 0.248000 -0.912000 +-0.850000 -0.200800 -0.351200 -0.168000 0.112000 -0.976000 +-0.891700 -0.251000 -0.304800 -0.808000 -0.512000 -0.264000 +-0.900000 -0.200800 -0.331500 -0.576000 -0.328000 -0.736000 +-0.900000 -0.236500 -0.304800 -0.680000 -0.456000 -0.560000 +-0.931500 -0.200800 -0.304800 -0.648000 -0.520000 -0.544000 +-0.900000 -0.212400 -0.243900 -0.672000 -0.712000 0.176000 +-0.914100 -0.200800 -0.243900 -0.664000 -0.728000 0.128000 +-0.900000 -0.206900 -0.182900 -0.648000 -0.752000 0.056000 +-0.907400 -0.200800 -0.182900 -0.688000 -0.712000 0.072000 +-0.900000 -0.204500 -0.121900 -0.688000 -0.712000 0.104000 +-0.903800 -0.200800 -0.121900 -0.696000 -0.704000 0.120000 +-0.900000 -0.200800 -0.096200 -0.752000 -0.632000 0.128000 +-0.943100 -0.150600 -0.121900 -0.672000 -0.720000 0.120000 +-0.900000 -0.192500 -0.060900 -0.856000 -0.488000 0.144000 +-0.932400 -0.150600 -0.060900 -0.688000 -0.696000 0.176000 +-0.900000 -0.169600 0.000000 -0.800000 -0.552000 0.224000 +-0.915700 -0.150600 0.000000 -0.696000 -0.672000 0.232000 +-0.900000 -0.150600 0.057700 -0.744000 -0.616000 0.232000 +-0.950000 -0.123700 0.000000 -0.488000 -0.840000 0.216000 +-0.900000 -0.149700 0.060900 -0.696000 -0.664000 0.232000 +-0.950000 -0.110600 0.060900 -0.432000 -0.856000 0.248000 +-0.900000 -0.127600 0.121900 -0.608000 -0.704000 0.344000 +-0.950000 -0.100400 0.101700 -0.400000 -0.872000 0.264000 +-0.939400 -0.100400 0.121900 -0.456000 -0.816000 0.336000 +-0.950000 -0.095300 0.121900 -0.400000 -0.864000 0.280000 +-0.900000 -0.100400 0.174900 -0.400000 -0.624000 0.656000 +-0.950000 -0.074300 0.182900 -0.344000 -0.776000 0.520000 +-0.900000 -0.094400 0.182900 -0.312000 -0.608000 0.720000 +-0.950000 -0.050200 0.212200 0.160000 -0.384000 0.904000 +-0.900000 -0.050200 0.208600 0.200000 -0.168000 0.960000 +-0.950000 0.000000 0.224500 0.344000 -0.144000 0.920000 +-0.900000 0.000000 0.204000 0.296000 0.088000 0.944000 +-0.900000 -0.050200 0.208600 0.200000 -0.168000 0.960000 +-0.850000 0.000000 0.186200 0.256000 0.144000 0.952000 +-0.850000 -0.050200 0.193400 0.200000 0.072000 0.968000 +-0.900000 -0.050200 0.208600 0.200000 -0.168000 0.960000 +-0.850000 -0.100400 0.192600 -0.136000 -0.312000 0.936000 +-0.900000 -0.094400 0.182900 -0.312000 -0.608000 0.720000 +-0.886800 -0.100400 0.182900 -0.288000 -0.576000 0.752000 +-0.900000 -0.100400 0.174900 -0.400000 -0.624000 0.656000 +-0.850000 -0.137400 0.182900 -0.304000 -0.312000 0.896000 +-0.900000 -0.127600 0.121900 -0.608000 -0.704000 0.344000 +-0.850000 -0.150600 0.175600 -0.632000 -0.392000 0.664000 +-0.878400 -0.150600 0.121900 -0.736000 -0.560000 0.368000 +-0.850000 -0.200800 0.125700 -0.776000 -0.360000 0.504000 +-0.851500 -0.200800 0.121900 -0.832000 -0.360000 0.408000 +-0.850000 -0.203500 0.121900 -0.792000 -0.528000 0.288000 +-0.869300 -0.200800 0.060900 -0.824000 -0.496000 0.248000 +-0.850000 -0.233200 0.060900 -0.816000 -0.512000 0.248000 +-0.882700 -0.200800 0.000000 -0.840000 -0.496000 0.192000 +-0.850000 -0.251000 0.014600 -0.800000 -0.560000 0.176000 +-0.852600 -0.251000 0.000000 -0.800000 -0.568000 0.168000 +-0.850000 -0.254700 0.000000 -0.800000 -0.568000 0.168000 +-0.860100 -0.251000 -0.060900 -0.808000 -0.568000 0.112000 +-0.850000 -0.265600 -0.060900 -0.808000 -0.568000 0.104000 +-0.866600 -0.251000 -0.121900 -0.808000 -0.576000 0.072000 +-0.850000 -0.274400 -0.121900 -0.816000 -0.568000 0.008000 +-0.864200 -0.251000 -0.182900 -0.800000 -0.592000 0.000000 +-0.850000 -0.271300 -0.182900 -0.816000 -0.568000 0.032000 +-0.869200 -0.251000 -0.243900 -0.768000 -0.600000 0.200000 +-0.850000 -0.276800 -0.243900 -0.792000 -0.552000 0.248000 +-0.891700 -0.251000 -0.304800 -0.808000 -0.512000 -0.264000 +-0.850000 -0.301200 -0.293400 -0.744000 -0.560000 0.336000 +-0.854400 -0.301200 -0.304800 -0.776000 -0.608000 0.112000 +-0.850000 -0.306900 -0.304800 -0.768000 -0.624000 0.072000 +-0.850000 -0.301200 -0.321900 -0.728000 -0.616000 -0.280000 +-0.854400 -0.301200 -0.304800 -0.776000 -0.608000 0.112000 +-0.850000 -0.251000 -0.359600 -0.320000 0.248000 -0.912000 +-0.891700 -0.251000 -0.304800 -0.808000 -0.512000 -0.264000 +-0.891700 -0.251000 -0.304800 -0.808000 -0.512000 -0.264000 +-1.000000 0.100400 0.207000 0.040000 0.608000 0.784000 +-1.000000 0.100400 0.207000 0.040000 0.608000 0.784000 +-0.950000 0.100400 0.204500 0.176000 0.504000 0.840000 +-1.000000 0.136100 0.182900 0.152000 0.600000 0.776000 +-0.950000 0.127100 0.182900 0.248000 0.536000 0.800000 +-1.000000 0.150600 0.170300 0.208000 0.568000 0.792000 +-0.950000 0.150600 0.154300 0.208000 0.640000 0.736000 +-1.000000 0.192500 0.121900 0.192000 0.664000 0.720000 +-0.950000 0.178500 0.121900 0.272000 0.648000 0.704000 +-1.000000 0.200800 0.112700 0.192000 0.656000 0.720000 +-0.950000 0.200800 0.096100 0.208000 0.672000 0.704000 +-1.000000 0.241600 0.060900 0.248000 0.768000 0.584000 +-0.950000 0.226300 0.060900 0.264000 0.760000 0.584000 +-1.000000 0.251000 0.045400 0.264000 0.768000 0.568000 +-0.950000 0.251000 0.016800 0.288000 0.808000 0.504000 +-1.000000 0.274600 0.000000 0.264000 0.848000 0.448000 +-0.950000 0.258900 0.000000 0.296000 0.848000 0.432000 +-1.000000 0.294800 -0.060900 0.312000 0.944000 0.080000 +-0.950000 0.277400 -0.060900 0.336000 0.928000 0.080000 +-1.000000 0.286500 -0.121900 0.328000 0.872000 -0.344000 +-0.950000 0.267200 -0.121900 0.344000 0.864000 -0.336000 +-1.000000 0.256900 -0.182900 0.288000 0.752000 -0.584000 +-0.950000 0.251000 -0.157200 0.320000 0.808000 -0.480000 +-0.985000 0.251000 -0.182900 0.288000 0.752000 -0.576000 +-0.950000 0.237800 -0.182900 0.296000 0.760000 -0.568000 +-1.000000 0.251000 -0.191500 0.280000 0.728000 -0.616000 +-0.950000 0.200800 -0.231900 0.272000 0.640000 -0.704000 +-1.000000 0.207900 -0.243900 0.232000 0.640000 -0.728000 +-0.980800 0.200800 -0.243900 0.232000 0.632000 -0.736000 +-1.000000 0.200800 -0.251300 0.232000 0.624000 -0.736000 +-0.950000 0.189400 -0.243900 0.264000 0.616000 -0.728000 +-1.000000 0.150600 -0.296000 0.168000 0.544000 -0.816000 +-0.950000 0.150600 -0.281200 0.240000 0.600000 -0.752000 +-1.000000 0.137800 -0.304800 0.104000 0.472000 -0.872000 +-0.950000 0.126000 -0.304800 0.168000 0.528000 -0.824000 +-1.000000 0.100400 -0.326700 0.072000 0.384000 -0.912000 +-0.950000 0.100400 -0.325900 0.192000 0.384000 -0.896000 +-1.000000 0.050200 -0.349300 0.080000 0.216000 -0.968000 +-0.950000 0.050200 -0.340200 0.184000 0.072000 -0.976000 +-1.000000 0.000000 -0.357700 0.216000 -0.064000 -0.968000 +-0.950000 0.000000 -0.337100 0.184000 -0.088000 -0.976000 +-1.000000 -0.050200 -0.339100 0.152000 -0.176000 -0.968000 +-0.950000 -0.050200 -0.337400 0.088000 0.008000 -0.992000 +-1.000000 -0.100400 -0.332000 -0.256000 -0.392000 -0.880000 +-0.950000 -0.100400 -0.349400 -0.088000 -0.160000 -0.976000 +-0.950000 -0.050200 -0.337400 0.088000 0.008000 -0.992000 +-0.900000 -0.100400 -0.346700 0.112000 -0.048000 -0.984000 +-0.900000 -0.050200 -0.330000 0.160000 0.128000 -0.976000 +-0.850000 -0.100400 -0.332400 0.280000 0.112000 -0.952000 +-0.850000 -0.050200 -0.323400 0.248000 0.176000 -0.944000 +-0.800000 -0.100400 -0.313000 0.368000 0.216000 -0.896000 +-0.808200 -0.050200 -0.304800 0.280000 0.136000 -0.944000 +-0.800000 -0.066700 -0.304800 0.296000 0.144000 -0.936000 +-0.800000 -0.050200 -0.302200 0.264000 0.120000 -0.952000 +-0.785000 -0.100400 -0.304800 0.328000 0.224000 -0.912000 +-0.750000 -0.050200 -0.287100 0.288000 0.040000 -0.952000 +-0.750000 -0.100400 -0.291100 0.336000 0.256000 -0.896000 +-0.700000 -0.050200 -0.272000 0.360000 0.104000 -0.920000 +-0.700000 -0.100400 -0.274700 0.392000 0.112000 -0.904000 +-0.650000 -0.050200 -0.249300 0.496000 0.208000 -0.840000 +-0.650000 -0.100400 -0.251900 0.448000 0.224000 -0.856000 +-0.642900 -0.050200 -0.243900 0.560000 0.208000 -0.792000 +-0.638400 -0.100400 -0.243900 0.560000 0.160000 -0.808000 +-0.606100 -0.050200 -0.182900 0.864000 0.248000 -0.424000 +-0.600000 -0.100400 -0.193800 0.776000 0.296000 -0.544000 +-0.600000 -0.077900 -0.182900 0.856000 0.208000 -0.464000 +-0.606100 -0.050200 -0.182900 0.864000 0.248000 -0.424000 +-0.600000 -0.050200 -0.162700 0.904000 0.232000 -0.344000 +-0.621400 0.000000 -0.182900 0.848000 0.280000 -0.440000 +-0.600000 -0.008200 -0.121900 0.848000 0.208000 -0.472000 +-0.601900 0.000000 -0.121900 0.848000 0.208000 -0.472000 +-0.600000 0.000000 -0.117700 0.848000 0.200000 -0.488000 +-0.614300 0.050200 -0.121900 0.720000 0.480000 -0.480000 +-0.600000 0.050200 -0.083400 0.800000 0.528000 -0.248000 +-0.650000 0.089500 -0.121900 0.728000 0.552000 -0.384000 +-0.600000 0.057600 -0.060900 0.728000 0.536000 0.408000 +-0.650000 0.100400 -0.098000 0.720000 0.624000 -0.288000 +-0.638000 0.100400 -0.060900 0.672000 0.632000 0.368000 +-0.650000 0.112000 -0.060900 0.672000 0.704000 0.200000 +-0.650000 0.100400 -0.043200 0.600000 0.608000 0.496000 +-0.689800 0.150600 -0.060900 0.640000 0.736000 0.192000 +-0.680200 0.100400 0.000000 0.600000 0.440000 0.656000 +-0.700000 0.150600 -0.043600 0.552000 0.712000 0.424000 +-0.700000 0.121800 0.000000 0.536000 0.544000 0.632000 +-0.734000 0.150600 0.000000 0.496000 0.640000 0.576000 +-0.700000 0.100400 0.019100 0.504000 0.504000 0.688000 +-0.750000 0.150600 0.014500 0.472000 0.624000 0.608000 +-0.744800 0.100400 0.060900 0.496000 0.456000 0.728000 +-0.750000 0.106000 0.060900 0.496000 0.464000 0.728000 +-0.750000 0.100400 0.065100 0.488000 0.448000 0.736000 +-0.796300 0.150600 0.060900 0.512000 0.584000 0.616000 +-0.800000 0.100400 0.105500 0.480000 0.456000 0.736000 +-0.800000 0.150600 0.064100 0.424000 0.560000 0.704000 +-0.820700 0.100400 0.121900 0.496000 0.488000 0.704000 +-0.850000 0.150600 0.098600 0.360000 0.600000 0.704000 +-0.850000 0.127100 0.121900 0.424000 0.560000 0.704000 +-0.892900 0.150600 0.121900 0.360000 0.624000 0.680000 +-0.850000 0.100400 0.150400 0.488000 0.512000 0.696000 +-0.900000 0.150600 0.126400 0.344000 0.632000 0.688000 +-0.897500 0.100400 0.182900 0.392000 0.408000 0.816000 +-0.900000 0.101900 0.182900 0.304000 0.552000 0.768000 +-0.900000 0.100400 0.184100 0.296000 0.408000 0.856000 +-0.950000 0.127100 0.182900 0.248000 0.536000 0.800000 +-0.950000 0.100400 0.204500 0.176000 0.504000 0.840000 +-0.950000 0.100400 0.204500 0.176000 0.504000 0.840000 +-0.886800 -0.100400 0.182900 -0.288000 -0.576000 0.752000 +-0.886800 -0.100400 0.182900 -0.288000 -0.576000 0.752000 +-0.850000 -0.100400 0.192600 -0.136000 -0.312000 0.936000 +-0.850000 -0.137400 0.182900 -0.304000 -0.312000 0.896000 +-0.850000 -0.137400 0.182900 -0.304000 -0.312000 0.896000 +-0.800000 -0.100400 0.186900 0.104000 0.048000 0.992000 +-0.800000 -0.100400 0.186900 0.104000 0.048000 0.992000 +-0.800000 -0.063400 0.182900 0.240000 0.160000 0.952000 +-0.776900 -0.100400 0.182900 0.184000 0.120000 0.968000 +-0.800000 -0.050200 0.179900 0.264000 0.176000 0.944000 +-0.750000 -0.100400 0.174700 0.320000 0.192000 0.920000 +-0.750000 -0.050200 0.155100 0.464000 0.288000 0.832000 +-0.700000 -0.100400 0.138900 0.488000 0.288000 0.816000 +-0.708600 -0.050200 0.121900 0.496000 0.344000 0.784000 +-0.700000 -0.062200 0.121900 0.504000 0.344000 0.784000 +-0.700000 -0.050200 0.115300 0.496000 0.344000 0.792000 +-0.677900 -0.100400 0.121900 0.528000 0.328000 0.776000 +-0.650000 -0.050200 0.076400 0.576000 0.320000 0.744000 +-0.650000 -0.100400 0.096100 0.592000 0.288000 0.744000 +-0.635700 -0.050200 0.060900 0.640000 0.304000 0.696000 +-0.612900 -0.100400 0.060900 0.624000 0.376000 0.672000 +-0.600000 -0.050200 0.018400 0.648000 0.320000 0.688000 +-0.600000 -0.100400 0.044600 0.672000 0.336000 0.656000 +-0.584800 -0.050200 0.000000 0.744000 0.336000 0.568000 +-0.565600 -0.100400 0.000000 0.744000 0.440000 0.496000 +-0.554400 -0.050200 -0.060900 0.944000 0.280000 0.128000 +-0.550000 -0.100400 -0.036900 0.792000 0.376000 0.464000 +-0.550000 -0.066800 -0.060900 0.944000 0.320000 -0.008000 +-0.533200 -0.100400 -0.060900 0.712000 0.696000 -0.024000 +-0.550000 -0.100400 -0.079500 0.552000 0.552000 -0.616000 +-0.500000 -0.119500 -0.060900 -0.160000 0.976000 0.112000 +-0.550000 -0.145600 -0.121900 0.512000 0.792000 -0.312000 +-0.500000 -0.144400 -0.121900 -0.376000 0.880000 -0.280000 +-0.550000 -0.150600 -0.142400 0.376000 0.896000 -0.200000 +-0.500000 -0.150600 -0.154000 -0.424000 0.880000 -0.160000 +-0.550000 -0.155500 -0.182900 0.296000 0.920000 -0.232000 +-0.500000 -0.154300 -0.182900 -0.320000 0.920000 -0.176000 +-0.550000 -0.172700 -0.243900 0.008000 0.856000 -0.512000 +-0.500000 -0.169200 -0.243900 -0.328000 0.880000 -0.312000 +-0.550000 -0.200800 -0.303600 -0.040000 0.880000 -0.464000 +-0.500000 -0.196700 -0.304800 -0.120000 0.848000 -0.504000 +-0.544700 -0.200800 -0.304800 -0.080000 0.824000 -0.552000 +-0.500000 -0.200800 -0.313000 -0.112000 0.824000 -0.544000 +-0.550000 -0.201300 -0.304800 -0.032000 0.864000 -0.488000 +-0.500000 -0.238600 -0.365800 -0.072000 0.656000 -0.744000 +-0.550000 -0.245600 -0.365800 -0.104000 0.680000 -0.720000 +-0.500000 -0.251000 -0.377000 -0.032000 0.528000 -0.840000 +-0.550000 -0.251000 -0.371400 -0.120000 0.616000 -0.768000 +-0.500000 -0.301200 -0.402500 0.040000 0.344000 -0.936000 +-0.550000 -0.301200 -0.401000 0.000000 0.424000 -0.904000 +-0.500000 -0.351500 -0.423900 0.056000 0.504000 -0.856000 +-0.550000 -0.349500 -0.426800 0.056000 0.416000 -0.904000 +-0.538500 -0.351500 -0.426800 0.048000 0.480000 -0.872000 +-0.500000 -0.351500 -0.423900 0.056000 0.504000 -0.856000 +-0.500000 -0.355300 -0.426800 0.056000 0.520000 -0.848000 +-0.450000 -0.351500 -0.418600 0.080000 0.512000 -0.848000 +-0.450000 -0.362400 -0.426800 0.064000 0.520000 -0.848000 +-0.400000 -0.351500 -0.411400 0.000000 0.616000 -0.784000 +-0.400000 -0.368700 -0.426800 0.024000 0.560000 -0.824000 +-0.350000 -0.351500 -0.416300 -0.176000 0.600000 -0.768000 +-0.350000 -0.360100 -0.426800 -0.128000 0.680000 -0.712000 +-0.319100 -0.351500 -0.426800 -0.216000 0.568000 -0.784000 +-0.350000 -0.351500 -0.416300 -0.176000 0.600000 -0.768000 +-0.300000 -0.341100 -0.426800 -0.128000 0.536000 -0.832000 +-0.350000 -0.301200 -0.377400 0.232000 0.208000 -0.944000 +-0.300000 -0.301200 -0.369600 0.320000 0.544000 -0.768000 +-0.350000 -0.251000 -0.367200 0.240000 0.168000 -0.952000 +-0.300000 -0.296900 -0.365800 0.296000 0.528000 -0.784000 +-0.345700 -0.251000 -0.365800 0.320000 0.336000 -0.880000 +-0.300000 -0.251000 -0.348000 0.192000 0.248000 -0.944000 +-0.350000 -0.248400 -0.365800 0.184000 0.424000 -0.880000 +-0.300000 -0.200800 -0.340600 0.016000 0.280000 -0.952000 +-0.350000 -0.200800 -0.339000 0.200000 0.416000 -0.880000 +-0.300000 -0.150600 -0.319300 -0.256000 0.480000 -0.832000 +-0.350000 -0.159400 -0.304800 -0.248000 0.528000 -0.808000 +-0.331500 -0.150600 -0.304800 -0.256000 0.464000 -0.840000 +-0.350000 -0.150600 -0.298700 -0.264000 0.464000 -0.840000 +-0.300000 -0.118900 -0.304800 -0.376000 0.264000 -0.880000 +-0.350000 -0.100400 -0.248500 -0.576000 0.440000 -0.680000 +-0.300000 -0.100400 -0.298100 -0.480000 0.288000 -0.824000 +-0.350000 -0.093900 -0.243900 -0.600000 0.408000 -0.680000 +-0.300000 -0.050200 -0.270300 -0.824000 0.232000 -0.512000 +-0.321700 -0.050200 -0.243900 -0.656000 0.344000 -0.656000 +-0.300000 0.000000 -0.248500 -0.656000 0.560000 -0.488000 +-0.301700 0.000000 -0.243900 -0.744000 0.392000 -0.536000 +-0.300000 0.001800 -0.243900 -0.496000 0.680000 -0.520000 +-0.340600 0.000000 -0.182900 -0.696000 0.480000 -0.520000 +-0.300000 0.050200 -0.185100 -0.648000 0.560000 -0.504000 +-0.301000 0.050200 -0.182900 -0.704000 0.472000 -0.512000 +-0.300000 0.052000 -0.182900 -0.664000 0.464000 -0.568000 +-0.335400 0.050200 -0.121900 -0.752000 0.472000 -0.456000 +-0.300000 0.100400 -0.141500 -0.560000 0.512000 -0.640000 +-0.317300 0.100400 -0.121900 -0.712000 0.264000 -0.640000 +-0.300000 0.144000 -0.121900 -0.728000 0.496000 -0.456000 +-0.350000 0.100400 -0.076700 -0.736000 0.256000 -0.616000 +-0.300000 0.150600 -0.105900 -0.768000 0.536000 -0.320000 +-0.350000 0.148000 -0.060900 -0.504000 0.552000 0.656000 +-0.346000 0.150600 -0.060900 -0.768000 -0.144000 0.616000 +-0.350000 0.100400 -0.017600 -0.744000 0.352000 0.552000 +-0.300000 0.150600 -0.036000 -0.360000 0.064000 0.920000 +-0.321000 0.100400 0.000000 -0.264000 0.416000 0.864000 +-0.300000 0.112500 0.000000 -0.064000 0.472000 0.872000 +-0.300000 0.100400 0.006400 -0.200000 0.408000 0.880000 +-0.250000 0.104200 0.000000 0.144000 0.480000 0.856000 +-0.250000 0.100400 0.002600 0.144000 0.496000 0.848000 +-0.238500 0.100400 0.000000 0.152000 0.496000 0.848000 +-0.250000 0.050200 0.048300 0.000000 0.552000 0.832000 +-0.200000 0.089800 0.000000 0.216000 0.544000 0.800000 +-0.200000 0.050200 0.037800 0.512000 0.448000 0.720000 +-0.163800 0.050200 0.000000 0.704000 0.216000 0.664000 +-0.200000 0.020500 0.060900 0.664000 0.440000 0.600000 +-0.150800 0.000000 0.000000 0.744000 0.072000 0.656000 +-0.190300 0.000000 0.060900 0.816000 0.200000 0.536000 +-0.152800 -0.050200 0.000000 0.848000 0.032000 0.520000 +-0.193200 -0.050200 0.060900 0.808000 0.008000 0.584000 +-0.150600 -0.100400 0.000000 0.800000 0.040000 0.592000 +-0.190200 -0.100400 0.060900 0.752000 -0.248000 0.600000 +-0.150000 -0.104300 0.000000 0.496000 0.120000 0.848000 +-0.200000 -0.121800 0.060900 0.728000 -0.328000 0.592000 +-0.150000 -0.150600 0.010200 0.376000 0.208000 0.896000 +-0.200000 -0.150600 0.042600 0.640000 -0.096000 0.752000 +-0.150000 -0.200800 0.013600 0.104000 0.200000 0.968000 +-0.200000 -0.200800 0.045500 0.568000 -0.152000 0.808000 +-0.150000 -0.251000 0.002400 -0.056000 -0.176000 0.976000 +-0.200000 -0.251000 0.018200 0.408000 -0.392000 0.816000 +-0.150000 -0.301200 0.010200 -0.304000 -0.280000 0.904000 +-0.200000 -0.279600 0.000000 -0.016000 -0.496000 0.864000 +-0.169100 -0.301200 0.000000 -0.376000 -0.392000 0.832000 +-0.200000 -0.301200 -0.017500 -0.064000 -0.432000 0.896000 +-0.150000 -0.346200 0.000000 -0.392000 -0.160000 0.904000 +-0.200000 -0.351500 -0.031500 -0.320000 -0.128000 0.936000 +-0.150000 -0.351500 -0.001100 -0.192000 -0.352000 0.912000 +-0.200000 -0.401700 -0.023400 -0.056000 -0.008000 0.992000 +-0.150000 -0.401700 -0.019000 0.408000 -0.232000 0.880000 +-0.200000 -0.451900 -0.018000 0.376000 -0.112000 0.912000 +-0.150000 -0.451900 -0.041900 0.560000 -0.440000 0.696000 +-0.200000 -0.502100 -0.039000 0.512000 -0.608000 0.592000 +-0.150000 -0.470000 -0.060900 0.568000 -0.552000 0.600000 +-0.181900 -0.502100 -0.060900 0.504000 -0.680000 0.520000 +-0.150000 -0.502100 -0.111600 0.592000 -0.752000 0.280000 +-0.200000 -0.511900 -0.060900 0.416000 -0.800000 0.424000 +-0.150000 -0.505100 -0.121900 0.584000 -0.768000 0.240000 +-0.200000 -0.534300 -0.121900 0.456000 -0.832000 0.296000 +-0.150000 -0.510100 -0.182900 0.616000 -0.760000 0.168000 +-0.200000 -0.549300 -0.182900 0.504000 -0.784000 0.344000 +-0.150000 -0.530700 -0.243900 0.632000 -0.664000 0.392000 +-0.200000 -0.552300 -0.190900 0.520000 -0.768000 0.360000 +-0.172800 -0.552300 -0.243900 0.592000 -0.568000 0.560000 +-0.200000 -0.579600 -0.243900 0.568000 -0.648000 0.496000 +-0.150000 -0.552300 -0.270100 0.544000 -0.504000 0.656000 +-0.200000 -0.602500 -0.268600 0.488000 -0.432000 0.752000 +-0.150000 -0.602500 -0.302600 0.392000 -0.240000 0.880000 +-0.200000 -0.652700 -0.286600 0.488000 -0.272000 0.824000 +-0.150000 -0.609400 -0.304800 0.840000 -0.512000 0.152000 +-0.171500 -0.652700 -0.304800 0.576000 -0.304000 0.752000 +-0.150000 -0.602500 -0.307600 0.456000 -0.280000 -0.840000 +-0.200000 -0.652700 -0.326500 0.488000 -0.272000 -0.824000 +-0.200000 -0.602500 -0.345500 0.488000 -0.272000 -0.824000 +-0.250000 -0.652700 -0.361600 0.240000 -0.216000 -0.944000 +-0.229500 -0.602500 -0.365800 0.408000 -0.240000 -0.872000 +-0.250000 -0.639500 -0.365800 0.216000 -0.224000 -0.944000 +-0.250000 -0.602500 -0.376000 0.360000 -0.328000 -0.872000 +-0.282800 -0.652700 -0.365800 0.080000 -0.160000 -0.976000 +-0.300000 -0.602500 -0.397300 -0.248000 -0.488000 -0.832000 +-0.300000 -0.652700 -0.367500 0.064000 -0.112000 -0.984000 +-0.328400 -0.602500 -0.365800 -0.832000 -0.248000 -0.488000 +-0.350000 -0.652700 -0.376000 0.560000 0.160000 -0.808000 +-0.350000 -0.629600 -0.365800 0.056000 0.640000 -0.760000 +-0.400000 -0.652700 -0.368100 -0.128000 -0.872000 -0.456000 +-0.357100 -0.602500 -0.365800 0.904000 0.256000 -0.312000 +-0.400000 -0.621700 -0.426800 0.392000 -0.856000 -0.304000 +-0.370300 -0.602500 -0.426800 0.624000 -0.760000 -0.160000 +-0.357100 -0.602500 -0.365800 0.904000 0.256000 -0.312000 +-0.350000 -0.582100 -0.426800 0.344000 -0.808000 -0.456000 +-0.350000 -0.585900 -0.365800 0.168000 -0.792000 -0.576000 +-0.300000 -0.582000 -0.426800 0.336000 -0.608000 -0.712000 +-0.328400 -0.602500 -0.365800 -0.832000 -0.248000 -0.488000 +-0.300000 -0.602500 -0.397300 -0.248000 -0.488000 -0.832000 +-0.300000 -0.582000 -0.426800 0.336000 -0.608000 -0.712000 +-0.250000 -0.602500 -0.376000 0.360000 -0.328000 -0.872000 +-0.275900 -0.552300 -0.426800 0.528000 -0.480000 -0.696000 +-0.250000 -0.552300 -0.402600 0.504000 -0.312000 -0.792000 +-0.250000 -0.526200 -0.426800 0.576000 -0.448000 -0.672000 +-0.200000 -0.552300 -0.367100 0.360000 -0.232000 -0.896000 +-0.235700 -0.502100 -0.426800 0.696000 -0.464000 -0.536000 +-0.200000 -0.502100 -0.370700 0.184000 -0.352000 -0.912000 +-0.200000 -0.459900 -0.426800 0.560000 -0.592000 -0.576000 +-0.150000 -0.502100 -0.367300 0.088000 -0.320000 -0.936000 +-0.191200 -0.451900 -0.426800 0.664000 -0.480000 -0.560000 +-0.150000 -0.451900 -0.368100 0.456000 -0.056000 -0.880000 +-0.194300 -0.401700 -0.426800 0.792000 0.416000 -0.432000 +-0.150000 -0.417500 -0.365800 0.544000 0.056000 -0.832000 +-0.151700 -0.401700 -0.365800 0.568000 0.104000 -0.808000 +-0.150000 -0.401700 -0.364300 0.552000 0.080000 -0.824000 +-0.200000 -0.365300 -0.365800 0.504000 0.768000 -0.376000 +-0.150000 -0.351500 -0.350300 0.512000 0.192000 -0.832000 +-0.200000 -0.351500 -0.343300 0.312000 0.640000 -0.696000 +-0.150000 -0.301200 -0.318500 -0.024000 0.504000 -0.856000 +-0.200000 -0.301200 -0.313400 0.328000 0.152000 -0.928000 +-0.150000 -0.286300 -0.304800 -0.184000 0.480000 -0.848000 +-0.200000 -0.251000 -0.307600 0.408000 0.096000 -0.904000 +-0.195100 -0.251000 -0.304800 0.376000 0.112000 -0.912000 +-0.200000 -0.200800 -0.306700 0.368000 -0.184000 -0.904000 +-0.196100 -0.200800 -0.304800 0.360000 -0.200000 -0.904000 +-0.200000 -0.150600 -0.333300 0.216000 -0.272000 -0.936000 +-0.150000 -0.159100 -0.304800 0.152000 -0.400000 -0.896000 +-0.150000 -0.150600 -0.309500 -0.032000 -0.400000 -0.912000 +-0.108400 -0.200800 -0.304800 -0.496000 -0.048000 -0.856000 +-0.100000 -0.150600 -0.315000 -0.456000 -0.064000 -0.880000 +-0.100000 -0.200800 -0.311700 -0.496000 0.128000 -0.856000 +-0.050000 -0.150600 -0.332400 0.016000 -0.080000 -0.992000 +-0.050000 -0.200800 -0.320900 -0.056000 0.280000 -0.952000 +0.000000 -0.150600 -0.318000 0.160000 0.016000 -0.984000 +0.000000 -0.200800 -0.332000 -0.296000 0.528000 -0.784000 +0.050000 -0.150600 -0.318000 0.352000 0.312000 -0.872000 +0.050000 -0.200800 -0.360800 -0.016000 0.576000 -0.808000 +0.096000 -0.150600 -0.304800 0.176000 0.336000 -0.920000 +0.100000 -0.200800 -0.352600 0.240000 0.528000 -0.800000 +0.100000 -0.151600 -0.304800 -0.176000 0.536000 -0.816000 +0.150000 -0.200800 -0.325200 0.160000 0.176000 -0.968000 +0.101900 -0.150600 -0.304800 -0.296000 0.368000 -0.872000 +0.150000 -0.150600 -0.323600 -0.232000 0.464000 -0.848000 +0.114400 -0.100400 -0.304800 -0.344000 0.128000 -0.928000 +0.150000 -0.100400 -0.322200 0.000000 0.224000 -0.968000 +0.150000 -0.064700 -0.304800 -0.200000 0.328000 -0.912000 +0.185500 -0.100400 -0.304800 0.296000 0.104000 -0.944000 +0.150000 -0.050200 -0.298400 -0.176000 0.328000 -0.920000 +0.200000 -0.100400 -0.298900 0.088000 0.040000 -0.992000 +0.188500 -0.050200 -0.304800 -0.128000 0.184000 -0.968000 +0.200000 -0.061600 -0.304800 0.000000 -0.144000 -0.984000 +0.200000 -0.050200 -0.307000 0.000000 0.192000 -0.976000 +0.211400 -0.050200 -0.304800 0.152000 0.184000 -0.968000 +0.200000 -0.045300 -0.304800 -0.008000 0.344000 -0.936000 +0.250000 -0.050200 -0.297000 0.000000 0.040000 -0.992000 +0.200000 0.000000 -0.277300 0.080000 0.528000 -0.840000 +0.250000 0.000000 -0.271900 -0.336000 0.528000 -0.776000 +0.200000 0.025700 -0.243900 0.016000 0.752000 -0.648000 +0.250000 0.018500 -0.243900 -0.144000 0.856000 -0.480000 +0.200000 0.019700 -0.182900 0.160000 0.648000 0.736000 +0.250000 0.002800 -0.182900 0.128000 0.640000 0.752000 +0.200000 0.000000 -0.161400 0.032000 0.656000 0.752000 +0.250000 0.000000 -0.180400 0.176000 0.568000 0.792000 +0.200000 -0.041200 -0.121900 0.160000 0.488000 0.856000 +0.250000 -0.050200 -0.132500 0.192000 0.528000 0.816000 +0.222300 -0.050200 -0.121900 0.200000 0.432000 0.872000 +0.250000 -0.068700 -0.121900 0.096000 0.400000 0.904000 +0.200000 -0.050200 -0.116900 0.136000 0.368000 0.912000 +0.250000 -0.100400 -0.106800 0.080000 0.336000 0.936000 +0.200000 -0.100400 -0.095800 0.064000 0.272000 0.952000 +0.250000 -0.150600 -0.087200 0.040000 0.104000 0.992000 +0.200000 -0.150600 -0.099300 0.040000 0.104000 0.992000 +0.250000 -0.200800 -0.084100 0.120000 -0.168000 0.976000 +0.200000 -0.200800 -0.086600 0.112000 -0.336000 0.928000 +0.250000 -0.237200 -0.121900 0.048000 -0.656000 0.744000 +0.200000 -0.240500 -0.121900 0.152000 -0.656000 0.728000 +0.250000 -0.251000 -0.140300 -0.072000 -0.512000 0.848000 +0.200000 -0.251000 -0.134700 0.128000 -0.784000 0.600000 +0.250000 -0.301200 -0.149400 -0.376000 -0.584000 0.712000 +0.200000 -0.290700 -0.182900 -0.520000 -0.680000 0.512000 +0.211500 -0.301200 -0.182900 -0.568000 -0.672000 0.464000 +0.200000 -0.301200 -0.206400 -0.600000 -0.688000 0.384000 +0.250000 -0.319600 -0.182900 -0.280000 -0.832000 0.472000 +0.200000 -0.319700 -0.243900 -0.624000 -0.696000 0.328000 +0.250000 -0.343100 -0.243900 -0.320000 -0.920000 0.208000 +0.200000 -0.340400 -0.304800 -0.480000 -0.448000 -0.744000 +0.250000 -0.348300 -0.304800 -0.128000 -0.736000 -0.656000 +0.200000 -0.301200 -0.321600 -0.488000 -0.368000 -0.784000 +0.250000 -0.313600 -0.365800 -0.336000 -0.640000 -0.680000 +0.236200 -0.301200 -0.365800 -0.608000 -0.320000 -0.712000 +0.250000 -0.301200 -0.379400 -0.536000 -0.264000 -0.792000 +0.250000 -0.271800 -0.365800 -0.320000 0.360000 -0.872000 +0.300000 -0.301200 -0.372900 0.128000 -0.472000 -0.864000 +0.300000 -0.284400 -0.365800 0.136000 0.360000 -0.920000 +0.333500 -0.301200 -0.365800 0.208000 -0.080000 -0.968000 +0.300000 -0.251000 -0.347800 0.304000 0.384000 -0.864000 +0.350000 -0.301200 -0.360500 0.376000 0.184000 -0.904000 +0.350000 -0.251000 -0.329500 0.536000 0.472000 -0.688000 +0.400000 -0.301200 -0.307300 0.704000 0.496000 -0.496000 +0.366700 -0.251000 -0.304800 0.704000 0.488000 -0.496000 +0.400000 -0.299100 -0.304800 0.736000 0.472000 -0.472000 +0.399000 -0.251000 -0.243900 0.912000 -0.008000 -0.392000 +0.400000 -0.252300 -0.243900 0.744000 0.488000 -0.440000 +0.398900 -0.251000 -0.182900 0.896000 -0.160000 0.400000 +0.400000 -0.252800 -0.182900 0.760000 0.464000 0.440000 +0.354900 -0.251000 -0.121900 0.704000 -0.304000 0.632000 +0.400000 -0.301200 -0.149800 0.528000 0.376000 0.752000 +0.350000 -0.260400 -0.121900 0.448000 -0.472000 0.752000 +0.350000 -0.301200 -0.148100 0.392000 -0.048000 0.912000 +0.328900 -0.251000 -0.121900 -0.264000 -0.304000 0.912000 +0.300000 -0.301200 -0.149800 -0.024000 -0.480000 0.872000 +0.300000 -0.251000 -0.132800 -0.224000 -0.464000 0.856000 +0.250000 -0.301200 -0.149400 -0.376000 -0.584000 0.712000 +0.250000 -0.251000 -0.140300 -0.072000 -0.512000 0.848000 +0.300000 -0.251000 -0.132800 -0.224000 -0.464000 0.856000 +0.250000 -0.237200 -0.121900 0.048000 -0.656000 0.744000 +0.300000 -0.234400 -0.121900 0.104000 -0.472000 0.872000 +0.250000 -0.200800 -0.084100 0.120000 -0.168000 0.976000 +0.300000 -0.200800 -0.101500 0.424000 -0.216000 0.872000 +0.250000 -0.150600 -0.087200 0.040000 0.104000 0.992000 +0.300000 -0.150600 -0.090800 0.240000 -0.024000 0.968000 +0.250000 -0.100400 -0.106800 0.080000 0.336000 0.936000 +0.300000 -0.100400 -0.098900 -0.360000 0.344000 0.856000 +0.250000 -0.068700 -0.121900 0.096000 0.400000 0.904000 +0.300000 -0.060700 -0.121900 -0.512000 0.456000 0.720000 +0.250000 -0.050200 -0.132500 0.192000 0.528000 0.816000 +0.300000 -0.050200 -0.130700 -0.504000 0.472000 0.720000 +0.250000 0.000000 -0.180400 0.176000 0.568000 0.792000 +0.300000 0.000000 -0.166100 -0.488000 0.464000 0.728000 +0.250000 0.002800 -0.182900 0.128000 0.640000 0.752000 +0.300000 0.018000 -0.182900 -0.296000 0.768000 0.552000 +0.250000 0.018500 -0.243900 -0.144000 0.856000 -0.480000 +0.300000 0.032100 -0.243900 -0.576000 0.680000 -0.432000 +0.250000 0.000000 -0.271900 -0.336000 0.528000 -0.776000 +0.300000 0.000000 -0.302400 -0.544000 0.608000 -0.568000 +0.250000 -0.050200 -0.297000 0.000000 0.040000 -0.992000 +0.300000 -0.003100 -0.304800 -0.376000 0.424000 -0.816000 +0.266500 -0.050200 -0.304800 -0.280000 0.064000 -0.952000 +0.300000 -0.050200 -0.319900 -0.536000 0.224000 -0.808000 +0.278900 -0.100400 -0.304800 -0.176000 0.256000 -0.944000 +0.300000 -0.100400 -0.310000 -0.248000 0.072000 -0.960000 +0.250000 -0.114900 -0.304800 -0.104000 0.280000 -0.952000 +0.300000 -0.150600 -0.312600 0.312000 -0.200000 -0.920000 +0.250000 -0.150600 -0.317700 0.024000 0.336000 -0.936000 +0.300000 -0.200800 -0.324200 0.480000 0.248000 -0.832000 +0.250000 -0.200800 -0.343100 0.104000 0.232000 -0.960000 +0.300000 -0.251000 -0.347800 0.304000 0.384000 -0.864000 +0.250000 -0.251000 -0.353900 0.064000 0.384000 -0.920000 +0.300000 -0.284400 -0.365800 0.136000 0.360000 -0.920000 +0.250000 -0.271800 -0.365800 -0.320000 0.360000 -0.872000 +0.250000 -0.251000 -0.353900 0.064000 0.384000 -0.920000 +0.236200 -0.301200 -0.365800 -0.608000 -0.320000 -0.712000 +0.200000 -0.251000 -0.346500 -0.184000 0.088000 -0.976000 +0.200000 -0.301200 -0.321600 -0.488000 -0.368000 -0.784000 +0.150000 -0.251000 -0.336000 0.080000 -0.336000 -0.928000 +0.170700 -0.301200 -0.304800 -0.520000 -0.608000 -0.592000 +0.150000 -0.287400 -0.304800 0.000000 -0.712000 -0.688000 +0.176900 -0.301200 -0.243900 -0.504000 -0.800000 0.304000 +0.150000 -0.287700 -0.243900 -0.208000 -0.968000 0.064000 +0.200000 -0.301200 -0.206400 -0.600000 -0.688000 0.384000 +0.150000 -0.278000 -0.182900 -0.064000 -0.936000 0.328000 +0.200000 -0.290700 -0.182900 -0.520000 -0.680000 0.512000 +0.150000 -0.253200 -0.121900 0.192000 -0.808000 0.552000 +0.200000 -0.251000 -0.134700 0.128000 -0.784000 0.600000 +0.161400 -0.251000 -0.121900 0.152000 -0.792000 0.576000 +0.200000 -0.240500 -0.121900 0.152000 -0.656000 0.728000 +0.150000 -0.251000 -0.118100 0.224000 -0.792000 0.560000 +0.200000 -0.200800 -0.086600 0.112000 -0.336000 0.928000 +0.150000 -0.200800 -0.071800 0.312000 -0.208000 0.920000 +0.200000 -0.150600 -0.099300 0.040000 0.104000 0.992000 +0.150000 -0.150600 -0.071000 0.136000 0.176000 0.968000 +0.200000 -0.100400 -0.095800 0.064000 0.272000 0.952000 +0.150000 -0.100400 -0.080500 0.184000 0.336000 0.920000 +0.200000 -0.050200 -0.116900 0.136000 0.368000 0.912000 +0.150000 -0.050200 -0.113700 0.032000 0.448000 0.888000 +0.200000 -0.041200 -0.121900 0.160000 0.488000 0.856000 +0.150000 -0.036300 -0.121900 0.008000 0.488000 0.864000 +0.200000 0.000000 -0.161400 0.032000 0.656000 0.752000 +0.150000 0.000000 -0.166100 -0.096000 0.688000 0.712000 +0.200000 0.019700 -0.182900 0.160000 0.648000 0.736000 +0.150000 0.016800 -0.182900 -0.152000 0.840000 0.520000 +0.200000 0.025700 -0.243900 0.016000 0.752000 -0.648000 +0.150000 0.015400 -0.243900 -0.208000 0.728000 -0.640000 +0.200000 0.000000 -0.277300 0.080000 0.528000 -0.840000 +0.150000 0.000000 -0.257100 -0.208000 0.552000 -0.800000 +0.200000 -0.045300 -0.304800 -0.008000 0.344000 -0.936000 +0.150000 -0.050200 -0.298400 -0.176000 0.328000 -0.920000 +0.188500 -0.050200 -0.304800 -0.128000 0.184000 -0.968000 +0.200000 -0.045300 -0.304800 -0.008000 0.344000 -0.936000 +0.200000 -0.050200 -0.307000 0.000000 0.192000 -0.976000 +0.200000 -0.050200 -0.307000 0.000000 0.192000 -0.976000 +-0.800000 -0.100400 0.186900 0.104000 0.048000 0.992000 +-0.800000 -0.100400 0.186900 0.104000 0.048000 0.992000 +-0.776900 -0.100400 0.182900 0.184000 0.120000 0.968000 +-0.800000 -0.150600 0.189500 -0.240000 -0.056000 0.960000 +-0.750000 -0.136500 0.182900 0.216000 0.112000 0.968000 +-0.750000 -0.150600 0.184600 0.192000 0.080000 0.976000 +-0.743500 -0.150600 0.182900 0.192000 0.096000 0.968000 +-0.750000 -0.200800 0.187200 0.064000 -0.048000 0.992000 +-0.703900 -0.200800 0.182900 0.128000 0.064000 0.984000 +-0.750000 -0.251000 0.186100 -0.160000 -0.136000 0.976000 +-0.700000 -0.208700 0.182900 0.176000 0.120000 0.968000 +-0.700000 -0.251000 0.184700 0.008000 -0.024000 0.992000 +-0.650000 -0.249200 0.182900 0.176000 0.464000 0.864000 +-0.650000 -0.251000 0.183700 0.152000 0.272000 0.944000 +-0.638500 -0.251000 0.182900 0.072000 0.424000 0.896000 +-0.650000 -0.301200 0.185200 -0.152000 0.008000 0.984000 +-0.600000 -0.260000 0.182900 0.056000 0.320000 0.944000 +-0.600000 -0.301200 0.196400 -0.152000 0.176000 0.968000 +-0.550000 -0.264400 0.182900 -0.072000 0.456000 0.880000 +-0.550000 -0.301200 0.200100 -0.040000 0.312000 0.944000 +-0.512000 -0.251000 0.182900 -0.112000 0.632000 0.760000 +-0.500000 -0.301200 0.199600 -0.128000 0.216000 0.960000 +-0.500000 -0.251000 0.185100 -0.112000 0.632000 0.760000 +-0.450000 -0.301200 0.203900 0.032000 0.168000 0.984000 +-0.450000 -0.251000 0.195400 -0.152000 0.392000 0.904000 +-0.400000 -0.301200 0.211000 0.416000 0.000000 0.904000 +-0.400000 -0.251000 0.203200 0.024000 0.208000 0.976000 +-0.369700 -0.301200 0.182900 0.552000 -0.328000 0.752000 +-0.350000 -0.251000 0.206900 0.584000 -0.272000 0.760000 +-0.350000 -0.276800 0.182900 0.600000 -0.432000 0.664000 +-0.334800 -0.251000 0.182900 0.672000 -0.480000 0.552000 +-0.350000 -0.301200 0.167500 0.592000 -0.368000 0.712000 +-0.300000 -0.251000 0.131000 0.632000 -0.616000 0.464000 +-0.327200 -0.301200 0.121900 0.792000 -0.368000 0.472000 +-0.300000 -0.256400 0.121900 0.624000 -0.624000 0.456000 +-0.300000 -0.301200 0.065200 0.504000 -0.568000 0.640000 +-0.294600 -0.251000 0.121900 0.616000 -0.600000 0.488000 +-0.295000 -0.301200 0.060900 0.472000 -0.584000 0.648000 +-0.250000 -0.251000 0.071500 0.528000 -0.408000 0.736000 +-0.250000 -0.262800 0.060900 0.496000 -0.520000 0.688000 +-0.236900 -0.251000 0.060900 0.464000 -0.480000 0.728000 +-0.250000 -0.301200 0.006000 0.344000 -0.608000 0.704000 +-0.200000 -0.251000 0.018200 0.408000 -0.392000 0.816000 +-0.235900 -0.301200 0.000000 0.272000 -0.568000 0.768000 +-0.200000 -0.279600 0.000000 -0.016000 -0.496000 0.864000 +-0.200000 -0.301200 -0.017500 -0.064000 -0.432000 0.896000 +-0.235900 -0.301200 0.000000 0.272000 -0.568000 0.768000 +-0.200000 -0.351500 -0.031500 -0.320000 -0.128000 0.936000 +-0.250000 -0.307700 0.000000 0.288000 -0.576000 0.760000 +-0.250000 -0.351500 -0.038300 0.104000 -0.504000 0.848000 +-0.300000 -0.343500 0.000000 0.832000 -0.408000 0.360000 +-0.300000 -0.351500 -0.012600 0.872000 -0.352000 0.320000 +-0.303300 -0.351500 0.000000 0.888000 -0.344000 0.288000 +-0.300000 -0.401700 -0.045100 0.792000 -0.248000 0.544000 +-0.319500 -0.401700 0.000000 0.536000 -0.584000 0.592000 +-0.300000 -0.435300 -0.060900 -0.192000 -0.360000 0.912000 +-0.350000 -0.427600 0.000000 0.560000 -0.752000 0.336000 +-0.338500 -0.451900 -0.060900 0.112000 -0.632000 0.760000 +-0.350000 -0.451900 -0.058800 0.248000 -0.624000 0.728000 +-0.350000 -0.453900 -0.060900 0.248000 -0.624000 0.728000 +-0.400000 -0.451900 -0.009600 0.744000 -0.536000 0.376000 +-0.380200 -0.502100 -0.060900 0.648000 -0.616000 0.432000 +-0.400000 -0.502100 -0.024700 0.848000 -0.224000 0.464000 +-0.400000 -0.527700 -0.060900 0.080000 -0.768000 0.624000 +-0.450000 -0.502100 -0.045100 0.560000 -0.696000 0.432000 +-0.450000 -0.512800 -0.060900 0.208000 -0.760000 0.608000 +-0.466200 -0.502100 0.000000 0.712000 -0.616000 0.320000 +-0.478800 -0.552300 -0.060900 0.704000 -0.592000 0.376000 +-0.500000 -0.548400 0.000000 0.368000 -0.816000 0.432000 +-0.500000 -0.552300 -0.009400 0.352000 -0.840000 0.400000 +-0.509600 -0.552300 0.000000 0.320000 -0.840000 0.424000 +-0.500000 -0.570000 -0.060900 0.480000 -0.800000 0.328000 +-0.550000 -0.565800 0.000000 0.224000 -0.872000 0.424000 +-0.550000 -0.588500 -0.060900 0.224000 -0.888000 0.384000 +-0.600000 -0.566300 0.000000 -0.184000 -0.816000 0.544000 +-0.600000 -0.601900 -0.060900 -0.072000 -0.808000 0.568000 +-0.633400 -0.552300 0.000000 -0.384000 -0.672000 0.624000 +-0.650000 -0.594800 -0.060900 -0.368000 -0.640000 0.664000 +-0.650000 -0.552300 -0.012600 -0.496000 -0.592000 0.624000 +-0.685200 -0.552300 -0.060900 -0.696000 -0.384000 0.592000 +-0.650000 -0.541900 0.000000 -0.528000 -0.600000 0.592000 +-0.700000 -0.507800 -0.060900 -0.864000 -0.200000 0.448000 +-0.674300 -0.502100 0.000000 -0.656000 -0.632000 0.384000 +-0.700000 -0.502100 -0.057900 -0.752000 -0.512000 0.400000 +-0.700000 -0.478200 0.000000 -0.704000 -0.632000 0.312000 +-0.701200 -0.502100 -0.060900 -0.816000 -0.416000 0.392000 +-0.719800 -0.451900 0.000000 -0.816000 -0.520000 0.240000 +-0.735400 -0.451900 -0.060900 -0.768000 -0.512000 0.360000 +-0.750000 -0.403200 0.000000 -0.832000 -0.504000 0.216000 +-0.750000 -0.426100 -0.060900 -0.864000 -0.448000 0.200000 +-0.750800 -0.401700 0.000000 -0.816000 -0.520000 0.208000 +-0.762700 -0.401700 -0.060900 -0.840000 -0.496000 0.168000 +-0.782800 -0.351500 0.000000 -0.816000 -0.536000 0.208000 +-0.794800 -0.351500 -0.060900 -0.816000 -0.552000 0.144000 +-0.800000 -0.327900 0.000000 -0.800000 -0.560000 0.176000 +-0.800000 -0.343900 -0.060900 -0.816000 -0.552000 0.128000 +-0.817700 -0.301200 0.000000 -0.808000 -0.560000 0.168000 +-0.826600 -0.301200 -0.060900 -0.824000 -0.544000 0.120000 +-0.800000 -0.343900 -0.060900 -0.816000 -0.552000 0.128000 +-0.832400 -0.301200 -0.121900 -0.840000 -0.528000 0.048000 +-0.800000 -0.351500 -0.101400 -0.840000 -0.528000 0.104000 +-0.802000 -0.351500 -0.121900 -0.840000 -0.520000 0.096000 +-0.800000 -0.354700 -0.121900 -0.848000 -0.512000 0.080000 +-0.802200 -0.351500 -0.182900 -0.872000 -0.480000 0.016000 +-0.800000 -0.355500 -0.182900 -0.872000 -0.472000 0.032000 +-0.807300 -0.351500 -0.243900 -0.864000 -0.472000 0.152000 +-0.800000 -0.365300 -0.243900 -0.880000 -0.440000 0.160000 +-0.821000 -0.351500 -0.304800 -0.824000 -0.504000 0.232000 +-0.800000 -0.395700 -0.304800 -0.920000 -0.376000 0.000000 +-0.812200 -0.351500 -0.365800 -0.856000 -0.296000 -0.408000 +-0.800000 -0.388500 -0.365800 -0.864000 -0.288000 -0.400000 +-0.800000 -0.351500 -0.388300 -0.664000 -0.152000 -0.728000 +-0.796500 -0.401700 -0.365800 -0.952000 -0.168000 -0.232000 +-0.750000 -0.351500 -0.422100 -0.312000 0.448000 -0.824000 +-0.777800 -0.401700 -0.426800 -0.928000 0.040000 -0.360000 +-0.750000 -0.359700 -0.426800 -0.368000 0.408000 -0.832000 +-0.750000 -0.351500 -0.422100 -0.312000 0.448000 -0.824000 +-0.736800 -0.351500 -0.426800 -0.240000 0.480000 -0.832000 +-0.736800 -0.351500 -0.426800 -0.240000 0.480000 -0.832000 +-0.750000 -0.150600 0.184600 0.192000 0.080000 0.976000 +-0.750000 -0.150600 0.184600 0.192000 0.080000 0.976000 +-0.800000 -0.150600 0.189500 -0.240000 -0.056000 0.960000 +-0.750000 -0.200800 0.187200 0.064000 -0.048000 0.992000 +-0.800000 -0.200800 0.184500 -0.256000 -0.128000 0.952000 +-0.750000 -0.251000 0.186100 -0.160000 -0.136000 0.976000 +-0.800000 -0.206500 0.182900 -0.304000 -0.264000 0.912000 +-0.762000 -0.251000 0.182900 -0.256000 -0.192000 0.936000 +-0.800000 -0.251000 0.157900 -0.576000 -0.400000 0.696000 +-0.750000 -0.267900 0.182900 -0.232000 -0.192000 0.944000 +-0.800000 -0.280700 0.121900 -0.736000 -0.528000 0.408000 +-0.750000 -0.301200 0.168400 -0.360000 -0.432000 0.816000 +-0.783300 -0.301200 0.121900 -0.688000 -0.568000 0.440000 +-0.750000 -0.342500 0.121900 -0.536000 -0.592000 0.592000 +-0.800000 -0.301200 0.085900 -0.768000 -0.544000 0.304000 +-0.750000 -0.351500 0.110100 -0.600000 -0.584000 0.536000 +-0.800000 -0.310100 0.060900 -0.800000 -0.544000 0.224000 +-0.767900 -0.351500 0.060900 -0.760000 -0.568000 0.296000 +-0.800000 -0.327900 0.000000 -0.800000 -0.560000 0.176000 +-0.782800 -0.351500 0.000000 -0.816000 -0.536000 0.208000 +-0.767900 -0.351500 0.060900 -0.760000 -0.568000 0.296000 +-0.750800 -0.401700 0.000000 -0.816000 -0.520000 0.208000 +-0.750000 -0.377100 0.060900 -0.760000 -0.552000 0.320000 +-0.750000 -0.401700 0.004100 -0.816000 -0.520000 0.232000 +-0.731300 -0.401700 0.060900 -0.784000 -0.496000 0.344000 +-0.750000 -0.403200 0.000000 -0.832000 -0.504000 0.216000 +-0.701000 -0.451900 0.060900 -0.792000 -0.480000 0.344000 +-0.719800 -0.451900 0.000000 -0.816000 -0.520000 0.240000 +-0.700000 -0.453200 0.060900 -0.560000 -0.720000 0.392000 +-0.700000 -0.478200 0.000000 -0.704000 -0.632000 0.312000 +-0.650000 -0.495900 0.060900 -0.528000 -0.720000 0.432000 +-0.674300 -0.502100 0.000000 -0.656000 -0.632000 0.384000 +-0.650000 -0.502100 0.048300 -0.536000 -0.712000 0.440000 +-0.650000 -0.541900 0.000000 -0.528000 -0.600000 0.592000 +-0.640700 -0.502100 0.060900 -0.496000 -0.728000 0.456000 +-0.633400 -0.552300 0.000000 -0.384000 -0.672000 0.624000 +-0.600000 -0.531600 0.060900 -0.448000 -0.736000 0.496000 +-0.600000 -0.552300 0.023900 -0.224000 -0.776000 0.584000 +-0.550000 -0.532000 0.060900 0.080000 -0.776000 0.624000 +-0.550000 -0.552300 0.031000 0.256000 -0.800000 0.528000 +-0.500000 -0.517700 0.060900 0.632000 -0.632000 0.440000 +-0.509600 -0.552300 0.000000 0.320000 -0.840000 0.424000 +-0.500000 -0.548400 0.000000 0.368000 -0.816000 0.432000 +-0.500000 -0.517700 0.060900 0.632000 -0.632000 0.440000 +-0.466200 -0.502100 0.000000 0.712000 -0.616000 0.320000 +-0.489100 -0.502100 0.060900 0.704000 -0.616000 0.328000 +-0.450000 -0.489500 0.000000 0.584000 -0.760000 0.264000 +-0.450000 -0.471900 0.060900 0.592000 -0.752000 0.272000 +-0.403800 -0.451900 0.000000 0.744000 -0.560000 0.352000 +-0.425300 -0.451900 0.060900 0.696000 -0.640000 0.304000 +-0.400000 -0.447100 0.000000 0.720000 -0.584000 0.344000 +-0.400000 -0.423000 0.060900 0.616000 -0.696000 0.360000 +-0.350000 -0.427600 0.000000 0.560000 -0.752000 0.336000 +-0.350000 -0.406300 0.060900 0.592000 -0.728000 0.320000 +-0.319500 -0.401700 0.000000 0.536000 -0.584000 0.592000 +-0.344500 -0.401700 0.060900 0.632000 -0.688000 0.328000 +-0.303300 -0.351500 0.000000 0.888000 -0.344000 0.288000 +-0.319700 -0.351500 0.060900 0.864000 -0.376000 0.328000 +-0.300000 -0.343500 0.000000 0.832000 -0.408000 0.360000 +-0.300000 -0.305300 0.060900 0.512000 -0.568000 0.632000 +-0.250000 -0.307700 0.000000 0.288000 -0.576000 0.760000 +-0.295000 -0.301200 0.060900 0.472000 -0.584000 0.648000 +-0.250000 -0.301200 0.006000 0.344000 -0.608000 0.704000 +-0.250000 -0.262800 0.060900 0.496000 -0.520000 0.688000 +-0.250000 -0.262800 0.060900 0.496000 -0.520000 0.688000 +-0.762000 -0.251000 0.182900 -0.256000 -0.192000 0.936000 +-0.762000 -0.251000 0.182900 -0.256000 -0.192000 0.936000 +-0.750000 -0.251000 0.186100 -0.160000 -0.136000 0.976000 +-0.750000 -0.267900 0.182900 -0.232000 -0.192000 0.944000 +-0.700000 -0.251000 0.184700 0.008000 -0.024000 0.992000 +-0.700000 -0.272200 0.182900 -0.072000 -0.128000 0.984000 +-0.650000 -0.251000 0.183700 0.152000 0.272000 0.944000 +-0.671000 -0.301200 0.182900 -0.120000 -0.104000 0.984000 +-0.650000 -0.301200 0.185200 -0.152000 0.008000 0.984000 +-0.663400 -0.351500 0.182900 -0.304000 -0.080000 0.944000 +-0.650000 -0.351500 0.187800 -0.272000 -0.048000 0.952000 +-0.650000 -0.385200 0.182900 -0.496000 -0.152000 0.848000 +-0.600000 -0.351500 0.201700 -0.216000 0.016000 0.968000 +-0.644900 -0.401700 0.182900 -0.528000 -0.240000 0.808000 +-0.600000 -0.401700 0.205900 -0.320000 -0.144000 0.928000 +-0.600000 -0.446800 0.182900 -0.240000 -0.464000 0.848000 +-0.550000 -0.401700 0.218500 0.000000 -0.272000 0.960000 +-0.583500 -0.451900 0.182900 -0.128000 -0.544000 0.824000 +-0.550000 -0.451900 0.188900 -0.024000 -0.624000 0.776000 +-0.550000 -0.456500 0.182900 0.056000 -0.736000 0.672000 +-0.523100 -0.451900 0.182900 0.136000 -0.648000 0.744000 +-0.550000 -0.494000 0.121900 0.024000 -0.832000 0.536000 +-0.500000 -0.451900 0.177400 0.160000 -0.648000 0.736000 +-0.500000 -0.486900 0.121900 0.296000 -0.800000 0.504000 +-0.450000 -0.451900 0.126400 0.752000 -0.472000 0.448000 +-0.450000 -0.453600 0.121900 0.584000 -0.744000 0.288000 +-0.447800 -0.451900 0.121900 0.672000 -0.648000 0.344000 +-0.450000 -0.471900 0.060900 0.592000 -0.752000 0.272000 +-0.425300 -0.451900 0.060900 0.696000 -0.640000 0.304000 +-0.447800 -0.451900 0.121900 0.672000 -0.648000 0.344000 +-0.400000 -0.423000 0.060900 0.616000 -0.696000 0.360000 +-0.404400 -0.401700 0.121900 0.648000 -0.656000 0.368000 +-0.400000 -0.401700 0.111300 0.640000 -0.680000 0.336000 +-0.400000 -0.397400 0.121900 0.632000 -0.672000 0.368000 +-0.350000 -0.401700 0.073400 0.632000 -0.688000 0.344000 +-0.350000 -0.369000 0.121900 0.736000 -0.464000 0.480000 +-0.344500 -0.401700 0.060900 0.632000 -0.688000 0.328000 +-0.341600 -0.351500 0.121900 0.808000 -0.352000 0.456000 +-0.319700 -0.351500 0.060900 0.864000 -0.376000 0.328000 +-0.327200 -0.301200 0.121900 0.792000 -0.368000 0.472000 +-0.300000 -0.305300 0.060900 0.512000 -0.568000 0.632000 +-0.300000 -0.301200 0.065200 0.504000 -0.568000 0.640000 +-0.295000 -0.301200 0.060900 0.472000 -0.584000 0.648000 +-0.295000 -0.301200 0.060900 0.472000 -0.584000 0.648000 +-0.650000 -0.301200 0.185200 -0.152000 0.008000 0.984000 +-0.650000 -0.301200 0.185200 -0.152000 0.008000 0.984000 +-0.650000 -0.351500 0.187800 -0.272000 -0.048000 0.952000 +-0.600000 -0.301200 0.196400 -0.152000 0.176000 0.968000 +-0.600000 -0.351500 0.201700 -0.216000 0.016000 0.968000 +-0.550000 -0.301200 0.200100 -0.040000 0.312000 0.944000 +-0.550000 -0.351500 0.211500 0.000000 0.128000 0.984000 +-0.500000 -0.301200 0.199600 -0.128000 0.216000 0.960000 +-0.500000 -0.351500 0.209200 0.072000 0.104000 0.984000 +-0.450000 -0.301200 0.203900 0.032000 0.168000 0.984000 +-0.450000 -0.351500 0.215900 0.592000 -0.216000 0.768000 +-0.400000 -0.301200 0.211000 0.416000 0.000000 0.904000 +-0.400000 -0.351500 0.196700 0.560000 -0.576000 0.584000 +-0.369700 -0.301200 0.182900 0.552000 -0.328000 0.752000 +-0.389000 -0.351500 0.182900 0.544000 -0.632000 0.536000 +-0.350000 -0.301200 0.167500 0.592000 -0.368000 0.712000 +-0.350000 -0.351500 0.138600 0.680000 -0.440000 0.568000 +-0.327200 -0.301200 0.121900 0.792000 -0.368000 0.472000 +-0.341600 -0.351500 0.121900 0.808000 -0.352000 0.456000 +-0.350000 -0.351500 0.138600 0.680000 -0.440000 0.568000 +-0.350000 -0.369000 0.121900 0.736000 -0.464000 0.480000 +-0.389000 -0.351500 0.182900 0.544000 -0.632000 0.536000 +-0.400000 -0.397400 0.121900 0.632000 -0.672000 0.368000 +-0.400000 -0.359600 0.182900 0.520000 -0.680000 0.496000 +-0.404400 -0.401700 0.121900 0.648000 -0.656000 0.368000 +-0.445800 -0.401700 0.182900 0.648000 -0.488000 0.568000 +-0.447800 -0.451900 0.121900 0.672000 -0.648000 0.344000 +-0.450000 -0.407300 0.182900 0.664000 -0.488000 0.552000 +-0.450000 -0.451900 0.126400 0.752000 -0.472000 0.448000 +-0.500000 -0.444100 0.182900 0.168000 -0.480000 0.848000 +-0.500000 -0.451900 0.177400 0.160000 -0.648000 0.736000 +-0.523100 -0.451900 0.182900 0.136000 -0.648000 0.744000 +-0.500000 -0.444100 0.182900 0.168000 -0.480000 0.848000 +-0.550000 -0.451900 0.188900 -0.024000 -0.624000 0.776000 +-0.500000 -0.401700 0.210500 0.208000 -0.296000 0.928000 +-0.550000 -0.401700 0.218500 0.000000 -0.272000 0.960000 +-0.500000 -0.351500 0.209200 0.072000 0.104000 0.984000 +-0.550000 -0.351500 0.211500 0.000000 0.128000 0.984000 +-0.550000 -0.401700 0.218500 0.000000 -0.272000 0.960000 +-0.600000 -0.351500 0.201700 -0.216000 0.016000 0.968000 +-0.600000 -0.401700 0.205900 -0.320000 -0.144000 0.928000 +-0.600000 -0.401700 0.205900 -0.320000 -0.144000 0.928000 +-0.512000 -0.251000 0.182900 -0.112000 0.632000 0.760000 +-0.512000 -0.251000 0.182900 -0.112000 0.632000 0.760000 +-0.500000 -0.249000 0.182900 -0.112000 0.656000 0.744000 +-0.500000 -0.251000 0.185100 -0.112000 0.632000 0.760000 +-0.450000 -0.233700 0.182900 -0.216000 0.472000 0.848000 +-0.450000 -0.251000 0.195400 -0.152000 0.392000 0.904000 +-0.400000 -0.206800 0.182900 -0.168000 0.424000 0.880000 +-0.400000 -0.251000 0.203200 0.024000 0.208000 0.976000 +-0.383500 -0.200800 0.182900 -0.152000 0.448000 0.872000 +-0.350000 -0.251000 0.206900 0.584000 -0.272000 0.760000 +-0.350000 -0.200800 0.190300 -0.112000 0.384000 0.912000 +-0.334800 -0.251000 0.182900 0.672000 -0.480000 0.552000 +-0.300000 -0.200800 0.189700 0.744000 -0.432000 0.496000 +-0.300000 -0.205800 0.182900 0.768000 -0.472000 0.416000 +-0.296900 -0.200800 0.182900 0.792000 -0.440000 0.408000 +-0.300000 -0.251000 0.131000 0.632000 -0.616000 0.464000 +-0.278100 -0.200800 0.121900 0.816000 -0.432000 0.368000 +-0.294600 -0.251000 0.121900 0.616000 -0.600000 0.488000 +-0.250000 -0.200800 0.078600 0.664000 -0.312000 0.672000 +-0.250000 -0.251000 0.071500 0.528000 -0.408000 0.736000 +-0.222100 -0.200800 0.060900 0.488000 -0.184000 0.848000 +-0.236900 -0.251000 0.060900 0.464000 -0.480000 0.728000 +-0.200000 -0.200800 0.045500 0.568000 -0.152000 0.808000 +-0.200000 -0.251000 0.018200 0.408000 -0.392000 0.816000 +-0.200000 -0.251000 0.018200 0.408000 -0.392000 0.816000 +-0.450000 -0.351500 0.215900 0.592000 -0.216000 0.768000 +-0.450000 -0.351500 0.215900 0.592000 -0.216000 0.768000 +-0.500000 -0.351500 0.209200 0.072000 0.104000 0.984000 +-0.450000 -0.401700 0.188700 0.656000 -0.464000 0.584000 +-0.500000 -0.401700 0.210500 0.208000 -0.296000 0.928000 +-0.450000 -0.407300 0.182900 0.664000 -0.488000 0.552000 +-0.500000 -0.444100 0.182900 0.168000 -0.480000 0.848000 +-0.500000 -0.444100 0.182900 0.168000 -0.480000 0.848000 +-0.400000 -0.351500 0.196700 0.560000 -0.576000 0.584000 +-0.400000 -0.351500 0.196700 0.560000 -0.576000 0.584000 +-0.400000 -0.359600 0.182900 0.520000 -0.680000 0.496000 +-0.450000 -0.351500 0.215900 0.592000 -0.216000 0.768000 +-0.445800 -0.401700 0.182900 0.648000 -0.488000 0.568000 +-0.450000 -0.401700 0.188700 0.656000 -0.464000 0.584000 +-0.450000 -0.407300 0.182900 0.664000 -0.488000 0.552000 +-0.450000 -0.407300 0.182900 0.664000 -0.488000 0.552000 +-0.383500 -0.200800 0.182900 -0.152000 0.448000 0.872000 +-0.383500 -0.200800 0.182900 -0.152000 0.448000 0.872000 +-0.350000 -0.189600 0.182900 -0.288000 0.472000 0.824000 +-0.350000 -0.200800 0.190300 -0.112000 0.384000 0.912000 +-0.311100 -0.150600 0.182900 -0.424000 0.464000 0.768000 +-0.300000 -0.200800 0.189700 0.744000 -0.432000 0.496000 +-0.300000 -0.150600 0.190700 0.000000 0.520000 0.848000 +-0.296900 -0.200800 0.182900 0.792000 -0.440000 0.408000 +-0.288800 -0.150600 0.182900 0.600000 0.360000 0.712000 +-0.278100 -0.200800 0.121900 0.816000 -0.432000 0.368000 +-0.252800 -0.150600 0.121900 0.720000 -0.296000 0.616000 +-0.250000 -0.200800 0.078600 0.664000 -0.312000 0.672000 +-0.250000 -0.150600 0.117900 0.712000 -0.320000 0.616000 +-0.222100 -0.200800 0.060900 0.488000 -0.184000 0.848000 +-0.212600 -0.150600 0.060900 0.712000 -0.216000 0.664000 +-0.200000 -0.200800 0.045500 0.568000 -0.152000 0.808000 +-0.200000 -0.150600 0.042600 0.640000 -0.096000 0.752000 +-0.212600 -0.150600 0.060900 0.712000 -0.216000 0.664000 +-0.200000 -0.121800 0.060900 0.728000 -0.328000 0.592000 +-0.250000 -0.150600 0.117900 0.712000 -0.320000 0.616000 +-0.200000 -0.100400 0.076800 0.784000 -0.136000 0.600000 +-0.250000 -0.144000 0.121900 0.720000 -0.312000 0.608000 +-0.230200 -0.100400 0.121900 0.776000 -0.176000 0.600000 +-0.250000 -0.100400 0.155000 0.480000 0.160000 0.856000 +-0.247100 -0.050200 0.121900 0.488000 0.512000 0.696000 +-0.250000 -0.050200 0.123600 0.200000 0.440000 0.864000 +-0.250000 -0.048000 0.121900 0.272000 0.640000 0.704000 +-0.255700 -0.050200 0.121900 -0.192000 0.512000 0.832000 +-0.250000 0.000000 0.079500 -0.144000 0.552000 0.816000 +-0.300000 -0.050200 0.104800 -0.312000 0.512000 0.792000 +-0.300000 0.000000 0.088800 -0.240000 0.432000 0.864000 +-0.350000 -0.050200 0.083200 -0.416000 0.344000 0.832000 +-0.348200 0.000000 0.060900 -0.376000 0.448000 0.800000 +-0.350000 -0.001900 0.060900 -0.656000 0.280000 0.688000 +-0.350000 0.000000 0.059800 -0.688000 0.400000 0.592000 +-0.367400 -0.050200 0.060900 -0.696000 0.408000 0.584000 +-0.373100 0.000000 0.000000 -0.880000 0.240000 0.392000 +-0.399300 -0.050200 0.000000 -0.696000 0.680000 0.184000 +-0.377800 0.000000 -0.060900 -0.864000 0.424000 -0.248000 +-0.400000 -0.050200 -0.003200 -0.712000 0.672000 0.168000 +-0.400000 -0.037800 -0.060900 -0.728000 0.664000 0.152000 +-0.406900 -0.050200 -0.060900 -0.848000 0.520000 0.000000 +-0.400000 -0.050200 -0.118700 -0.832000 0.528000 -0.160000 +-0.450000 -0.099400 -0.060900 -0.760000 0.616000 0.160000 +-0.400000 -0.050900 -0.121900 -0.736000 0.536000 -0.408000 +-0.450000 -0.100400 -0.065100 -0.512000 0.824000 -0.200000 +-0.434900 -0.100400 -0.121900 -0.608000 0.744000 -0.256000 +-0.450000 -0.111500 -0.121900 -0.376000 0.896000 -0.224000 +-0.403600 -0.100400 -0.182900 -0.616000 0.592000 -0.512000 +-0.450000 -0.128500 -0.182900 -0.504000 0.800000 -0.296000 +-0.400000 -0.100400 -0.188300 -0.616000 0.576000 -0.520000 +-0.450000 -0.150600 -0.239400 -0.408000 0.792000 -0.448000 +-0.400000 -0.131400 -0.243900 -0.384000 0.744000 -0.536000 +-0.444500 -0.150600 -0.243900 -0.312000 0.784000 -0.528000 +-0.400000 -0.150600 -0.272200 -0.312000 0.624000 -0.704000 +-0.450000 -0.152500 -0.243900 -0.384000 0.800000 -0.448000 +-0.400000 -0.174400 -0.304800 -0.224000 0.736000 -0.632000 +-0.450000 -0.186700 -0.304800 -0.216000 0.808000 -0.528000 +-0.400000 -0.200800 -0.333600 -0.064000 0.568000 -0.816000 +-0.450000 -0.200800 -0.327900 -0.112000 0.704000 -0.696000 +-0.400000 -0.239300 -0.365800 0.048000 0.512000 -0.848000 +-0.450000 -0.235000 -0.365800 -0.016000 0.592000 -0.800000 +-0.400000 -0.251000 -0.373300 0.080000 0.400000 -0.904000 +-0.450000 -0.251000 -0.376500 0.032000 0.432000 -0.896000 +-0.400000 -0.301200 -0.390900 0.144000 0.296000 -0.936000 +-0.450000 -0.301200 -0.399100 0.080000 0.320000 -0.936000 +-0.400000 -0.351500 -0.411400 0.000000 0.616000 -0.784000 +-0.450000 -0.351500 -0.418600 0.080000 0.512000 -0.848000 +-0.450000 -0.301200 -0.399100 0.080000 0.320000 -0.936000 +-0.500000 -0.351500 -0.423900 0.056000 0.504000 -0.856000 +-0.500000 -0.301200 -0.402500 0.040000 0.344000 -0.936000 +-0.450000 -0.301200 -0.399100 0.080000 0.320000 -0.936000 +-0.500000 -0.251000 -0.377000 -0.032000 0.528000 -0.840000 +-0.450000 -0.251000 -0.376500 0.032000 0.432000 -0.896000 +-0.500000 -0.238600 -0.365800 -0.072000 0.656000 -0.744000 +-0.450000 -0.235000 -0.365800 -0.016000 0.592000 -0.800000 +-0.500000 -0.200800 -0.313000 -0.112000 0.824000 -0.544000 +-0.450000 -0.200800 -0.327900 -0.112000 0.704000 -0.696000 +-0.500000 -0.196700 -0.304800 -0.120000 0.848000 -0.504000 +-0.450000 -0.186700 -0.304800 -0.216000 0.808000 -0.528000 +-0.500000 -0.169200 -0.243900 -0.328000 0.880000 -0.312000 +-0.450000 -0.152500 -0.243900 -0.384000 0.800000 -0.448000 +-0.500000 -0.154300 -0.182900 -0.320000 0.920000 -0.176000 +-0.450000 -0.150600 -0.239400 -0.408000 0.792000 -0.448000 +-0.491700 -0.150600 -0.182900 -0.448000 0.848000 -0.264000 +-0.450000 -0.128500 -0.182900 -0.504000 0.800000 -0.296000 +-0.500000 -0.150600 -0.154000 -0.424000 0.880000 -0.160000 +-0.450000 -0.111500 -0.121900 -0.376000 0.896000 -0.224000 +-0.500000 -0.144400 -0.121900 -0.376000 0.880000 -0.280000 +-0.450000 -0.100400 -0.065100 -0.512000 0.824000 -0.200000 +-0.500000 -0.119500 -0.060900 -0.160000 0.976000 0.112000 +-0.452400 -0.100400 -0.060900 -0.344000 0.936000 -0.016000 +-0.500000 -0.141000 0.000000 -0.040000 0.880000 0.456000 +-0.450000 -0.100400 -0.057100 -0.400000 0.872000 0.264000 +-0.450000 -0.112700 0.000000 -0.520000 0.784000 0.320000 +-0.434300 -0.100400 0.000000 -0.648000 0.720000 0.208000 +-0.450000 -0.136300 0.060900 -0.512000 0.720000 0.448000 +-0.405500 -0.100400 0.060900 -0.712000 0.456000 0.520000 +-0.450000 -0.150600 0.089400 -0.440000 0.744000 0.496000 +-0.400000 -0.100400 0.069600 -0.688000 0.456000 0.552000 +-0.414900 -0.150600 0.121900 -0.424000 0.616000 0.648000 +-0.400000 -0.140400 0.121900 -0.448000 0.624000 0.632000 +-0.400000 -0.150600 0.133500 -0.392000 0.600000 0.688000 +-0.351400 -0.100400 0.121900 -0.608000 0.368000 0.696000 +-0.350000 -0.150600 0.151300 -0.584000 0.352000 0.720000 +-0.350000 -0.100400 0.123500 -0.608000 0.328000 0.712000 +-0.311100 -0.150600 0.182900 -0.424000 0.464000 0.768000 +-0.300000 -0.100400 0.149000 -0.304000 0.432000 0.840000 +-0.300000 -0.142200 0.182900 0.000000 0.616000 0.776000 +-0.250000 -0.100400 0.155000 0.480000 0.160000 0.856000 +-0.288800 -0.150600 0.182900 0.600000 0.360000 0.712000 +-0.250000 -0.144000 0.121900 0.720000 -0.312000 0.608000 +-0.252800 -0.150600 0.121900 0.720000 -0.296000 0.616000 +-0.250000 -0.150600 0.117900 0.712000 -0.320000 0.616000 +-0.250000 -0.150600 0.117900 0.712000 -0.320000 0.616000 +-0.400000 -0.351500 0.196700 0.560000 -0.576000 0.584000 +-0.400000 -0.351500 0.196700 0.560000 -0.576000 0.584000 +-0.389000 -0.351500 0.182900 0.544000 -0.632000 0.536000 +-0.400000 -0.359600 0.182900 0.520000 -0.680000 0.496000 +-0.400000 -0.359600 0.182900 0.520000 -0.680000 0.496000 +-0.311100 -0.150600 0.182900 -0.424000 0.464000 0.768000 +-0.311100 -0.150600 0.182900 -0.424000 0.464000 0.768000 +-0.300000 -0.142200 0.182900 0.000000 0.616000 0.776000 +-0.300000 -0.150600 0.190700 0.000000 0.520000 0.848000 +-0.288800 -0.150600 0.182900 0.600000 0.360000 0.712000 +-0.288800 -0.150600 0.182900 0.600000 0.360000 0.712000 +0.577700 0.301200 0.182900 -0.536000 0.272000 0.792000 +0.577700 0.301200 0.182900 -0.536000 0.272000 0.792000 +0.600000 0.327100 0.182900 -0.144000 0.552000 0.816000 +0.600000 0.301200 0.199900 -0.528000 0.136000 0.832000 +0.650000 0.311500 0.182900 0.424000 0.496000 0.752000 +0.650000 0.301200 0.190400 0.408000 0.464000 0.776000 +0.660200 0.301200 0.182900 0.480000 0.488000 0.720000 +0.650000 0.251000 0.217300 -0.016000 0.232000 0.968000 +0.700000 0.263400 0.182900 0.512000 0.536000 0.664000 +0.700000 0.251000 0.193900 0.488000 0.504000 0.704000 +0.711700 0.251000 0.182900 0.560000 0.528000 0.624000 +0.700000 0.200800 0.226400 0.328000 0.432000 0.832000 +0.750000 0.208300 0.182900 0.448000 0.624000 0.632000 +0.750000 0.200800 0.191100 0.424000 0.552000 0.712000 +0.761100 0.200800 0.182900 0.432000 0.472000 0.760000 +0.750000 0.150600 0.201100 0.320000 0.240000 0.912000 +0.797300 0.150600 0.182900 0.336000 0.288000 0.888000 +0.750000 0.100400 0.207000 0.032000 -0.192000 0.976000 +0.800000 0.148000 0.182900 0.424000 0.336000 0.832000 +0.800000 0.100400 0.199400 -0.032000 0.024000 0.992000 +0.850000 0.129700 0.182900 0.408000 0.752000 0.504000 +0.850000 0.100400 0.222500 0.440000 0.584000 0.672000 +0.891700 0.100400 0.182900 0.576000 0.688000 0.424000 +0.850000 0.050200 0.216300 -0.184000 -0.272000 0.936000 +0.900000 0.093100 0.182900 0.568000 0.672000 0.464000 +0.900000 0.050200 0.226800 0.488000 0.496000 0.712000 +0.940200 0.050200 0.182900 0.624000 0.528000 0.568000 +0.900000 0.000000 0.237100 -0.176000 -0.616000 0.760000 +0.950000 0.037400 0.182900 0.520000 0.504000 0.680000 +0.950000 0.000000 0.206500 0.400000 0.008000 0.912000 +1.000000 0.004900 0.182900 0.336000 0.520000 0.776000 +1.000000 0.000000 0.186800 0.376000 0.128000 0.912000 +0.950000 0.000000 0.206500 0.400000 0.008000 0.912000 +1.000000 -0.012000 0.182900 0.384000 -0.248000 0.880000 +0.950000 -0.050200 0.197900 0.336000 -0.192000 0.920000 +0.975800 -0.050200 0.182900 0.464000 -0.232000 0.848000 +0.950000 -0.100400 0.196500 0.208000 -0.704000 0.672000 +0.959000 -0.100400 0.182900 0.616000 -0.584000 0.520000 +0.950000 -0.108800 0.182900 0.232000 -0.768000 0.584000 +1.000000 -0.100400 0.134700 0.432000 -0.528000 0.720000 +0.950000 -0.142500 0.121900 -0.608000 -0.672000 0.392000 +1.000000 -0.126300 0.121900 0.016000 -0.480000 0.872000 +0.950000 -0.150600 0.094900 -0.648000 -0.696000 0.272000 +1.000000 -0.150600 0.101600 -0.080000 -0.576000 0.808000 +0.950000 -0.158100 0.060900 -0.608000 -0.760000 0.200000 +1.000000 -0.176100 0.060900 -0.688000 -0.632000 0.336000 +0.950000 -0.168100 0.000000 -0.640000 -0.744000 0.184000 +1.000000 -0.200800 0.012500 -0.656000 -0.696000 0.264000 +0.995800 -0.200800 0.000000 -0.648000 -0.704000 0.264000 +1.000000 -0.204500 0.000000 -0.624000 -0.728000 0.256000 +0.973000 -0.200800 -0.060900 -0.584000 -0.760000 0.264000 +1.000000 -0.224100 -0.060900 -0.616000 -0.728000 0.280000 +0.950500 -0.200800 -0.121900 -0.632000 -0.744000 0.192000 +1.000000 -0.243600 -0.121900 -0.640000 -0.736000 0.184000 +0.950000 -0.200800 -0.124000 -0.680000 -0.712000 0.160000 +1.000000 -0.251000 -0.154300 -0.728000 -0.648000 0.200000 +0.950000 -0.211700 -0.182900 -0.704000 -0.680000 0.176000 +0.993400 -0.251000 -0.182900 -0.736000 -0.640000 0.200000 +0.950000 -0.224400 -0.243900 -0.688000 -0.640000 0.328000 +0.978600 -0.251000 -0.243900 -0.696000 -0.616000 0.352000 +0.950000 -0.251000 -0.295200 -0.640000 -0.496000 0.576000 +1.000000 -0.277900 -0.243900 -0.712000 -0.592000 0.360000 +0.950000 -0.261400 -0.304800 -0.752000 -0.584000 0.288000 +1.000000 -0.301200 -0.291200 -0.640000 -0.488000 0.576000 +0.989600 -0.301200 -0.304800 -0.816000 -0.560000 0.128000 +1.000000 -0.316200 -0.304800 -0.800000 -0.552000 0.224000 +1.000000 -0.301200 -0.328200 -0.784000 -0.440000 -0.424000 +0.989600 -0.301200 -0.304800 -0.816000 -0.560000 0.128000 +1.000000 -0.251000 -0.355700 -0.816000 -0.248000 -0.504000 +0.950000 -0.261400 -0.304800 -0.752000 -0.584000 0.288000 +0.950000 -0.251000 -0.328200 -0.712000 -0.568000 -0.392000 +0.942100 -0.251000 -0.304800 -0.752000 -0.552000 0.344000 +0.950000 -0.200800 -0.357000 -0.272000 -0.104000 -0.952000 +0.911900 -0.200800 -0.304800 -0.864000 -0.480000 -0.128000 +0.950000 -0.150600 -0.345500 -0.032000 0.064000 -0.992000 +0.900000 -0.181100 -0.304800 -0.768000 -0.440000 -0.448000 +0.900000 -0.150600 -0.332000 -0.672000 -0.328000 -0.656000 +0.883200 -0.150600 -0.304800 -0.864000 -0.368000 -0.320000 +0.900000 -0.100400 -0.341700 -0.464000 -0.104000 -0.872000 +0.869700 -0.100400 -0.304800 -0.880000 -0.248000 -0.400000 +0.900000 -0.050200 -0.348300 -0.256000 0.192000 -0.944000 +0.867300 -0.050200 -0.304800 -0.784000 -0.136000 -0.600000 +0.900000 0.000000 -0.329500 -0.080000 0.648000 -0.744000 +0.877300 0.000000 -0.304800 -0.592000 0.480000 -0.632000 +0.900000 0.016700 -0.304800 -0.152000 0.720000 -0.664000 +0.850000 0.000000 -0.279000 -0.536000 0.488000 -0.680000 +0.900000 0.050200 -0.268900 0.208000 0.672000 -0.696000 +0.850000 0.042400 -0.243900 -0.408000 0.528000 -0.736000 +0.858900 0.050200 -0.243900 -0.424000 0.568000 -0.696000 +0.850000 0.050200 -0.237100 -0.376000 0.576000 -0.720000 +0.900000 0.070800 -0.243900 -0.096000 0.744000 -0.656000 +0.850000 0.100400 -0.218500 0.128000 0.592000 -0.784000 +0.900000 0.100400 -0.203200 0.536000 0.688000 -0.472000 +0.850000 0.127100 -0.182900 0.192000 0.744000 -0.632000 +0.900000 0.111100 -0.182900 0.552000 0.712000 -0.416000 +0.850000 0.150600 -0.140900 0.432000 0.840000 -0.304000 +0.900000 0.127900 -0.121900 0.560000 0.776000 -0.264000 +0.859300 0.150600 -0.121900 0.456000 0.840000 -0.272000 +0.900000 0.143500 -0.060900 0.528000 0.808000 -0.240000 +0.888500 0.150600 -0.060900 0.504000 0.856000 -0.040000 +0.900000 0.131100 0.000000 0.480000 0.848000 0.192000 +0.867700 0.150600 0.000000 0.552000 0.816000 0.152000 +0.900000 0.118900 0.060900 0.472000 0.856000 0.184000 +0.855400 0.150600 0.060900 0.680000 0.720000 0.072000 +0.900000 0.107300 0.121900 0.512000 0.832000 0.184000 +0.850900 0.150600 0.121900 0.704000 0.704000 0.080000 +0.900000 0.100400 0.165200 0.584000 0.744000 0.296000 +0.850000 0.150600 0.126500 0.640000 0.560000 0.512000 +0.891700 0.100400 0.182900 0.576000 0.688000 0.424000 +0.850000 0.129700 0.182900 0.408000 0.752000 0.504000 +0.850000 0.150600 0.126500 0.640000 0.560000 0.512000 +0.800000 0.148000 0.182900 0.424000 0.336000 0.832000 +0.800000 0.150600 0.181400 0.520000 0.336000 0.776000 +0.797300 0.150600 0.182900 0.336000 0.288000 0.888000 +0.800000 0.190400 0.121900 0.624000 0.752000 0.168000 +0.761100 0.200800 0.182900 0.432000 0.472000 0.760000 +0.788900 0.200800 0.121900 0.632000 0.744000 0.184000 +0.750000 0.208300 0.182900 0.448000 0.624000 0.632000 +0.750000 0.233400 0.121900 0.720000 0.680000 -0.080000 +0.711700 0.251000 0.182900 0.560000 0.528000 0.624000 +0.736800 0.251000 0.121900 0.752000 0.632000 0.144000 +0.700000 0.263400 0.182900 0.512000 0.536000 0.664000 +0.700000 0.297800 0.121900 0.728000 0.680000 -0.032000 +0.660200 0.301200 0.182900 0.480000 0.488000 0.720000 +0.696500 0.301200 0.121900 0.712000 0.672000 0.168000 +0.650000 0.311500 0.182900 0.424000 0.496000 0.752000 +0.653800 0.351500 0.121900 0.656000 0.616000 0.424000 +0.650000 0.351500 0.128300 0.616000 0.616000 0.480000 +0.650000 0.355500 0.121900 0.632000 0.632000 0.432000 +0.600000 0.351500 0.157200 -0.376000 0.584000 0.704000 +0.600000 0.382600 0.121900 0.272000 0.776000 0.560000 +0.566500 0.351500 0.121900 -0.632000 0.576000 0.496000 +0.600000 0.401700 0.085900 0.096000 0.928000 0.336000 +0.550000 0.351500 0.078000 -0.616000 0.672000 0.392000 +0.584600 0.401700 0.060900 -0.416000 0.872000 0.248000 +0.550000 0.359900 0.060900 -0.592000 0.640000 0.480000 +0.568400 0.401700 0.000000 -0.472000 0.832000 -0.264000 +0.550000 0.388900 0.000000 -0.392000 0.856000 0.320000 +0.600000 0.401700 -0.057700 0.168000 0.920000 -0.344000 +0.550000 0.398000 -0.060900 0.000000 0.968000 -0.216000 +0.600000 0.400600 -0.060900 -0.072000 0.912000 -0.384000 +0.550000 0.362300 -0.121900 0.400000 0.656000 -0.632000 +0.600000 0.351500 -0.101600 0.448000 0.496000 -0.736000 +0.566700 0.351500 -0.121900 0.448000 0.536000 -0.704000 +0.600000 0.310600 -0.121900 0.480000 0.424000 -0.760000 +0.550000 0.351500 -0.135900 0.456000 0.632000 -0.616000 +0.600000 0.301200 -0.128700 0.472000 0.520000 -0.704000 +0.550000 0.301200 -0.167400 0.408000 0.504000 -0.752000 +0.600000 0.256700 -0.182900 0.328000 0.496000 -0.792000 +0.550000 0.283200 -0.182900 0.320000 0.472000 -0.816000 +0.600000 0.251000 -0.187000 0.320000 0.456000 -0.816000 +0.550000 0.251000 -0.199600 0.176000 0.288000 -0.936000 +0.600000 0.200800 -0.209200 0.248000 0.288000 -0.920000 +0.550000 0.200800 -0.211100 0.016000 0.048000 -0.992000 +0.600000 0.150600 -0.225200 0.008000 0.128000 -0.984000 +0.550000 0.150600 -0.215400 -0.144000 0.080000 -0.984000 +0.600000 0.100400 -0.237100 -0.096000 0.168000 -0.976000 +0.550000 0.100400 -0.212600 -0.200000 0.352000 -0.904000 +0.600000 0.076600 -0.243900 -0.096000 0.360000 -0.920000 +0.550000 0.067800 -0.243900 0.024000 0.672000 -0.728000 +0.600000 0.050200 -0.251100 0.248000 0.344000 -0.896000 +0.550000 0.050200 -0.258400 0.160000 0.632000 -0.752000 +0.600000 0.000000 -0.284600 0.512000 0.112000 -0.840000 +0.550000 0.015600 -0.304800 0.472000 0.712000 -0.512000 +0.578400 0.000000 -0.304800 0.536000 0.480000 -0.688000 +0.550000 0.000000 -0.335900 0.576000 0.464000 -0.664000 +0.587300 -0.050200 -0.304800 0.688000 0.056000 -0.712000 +0.550000 -0.050200 -0.345500 0.192000 -0.560000 -0.792000 +0.550000 -0.083700 -0.304800 0.088000 -0.736000 -0.664000 +0.500000 -0.050200 -0.339600 -0.136000 -0.672000 -0.720000 +0.500000 -0.082600 -0.304800 0.216000 -0.680000 -0.688000 +0.450000 -0.050200 -0.325200 -0.120000 -0.568000 -0.808000 +0.475800 -0.100400 -0.304800 0.512000 -0.104000 -0.848000 +0.450000 -0.100400 -0.322200 0.392000 -0.360000 -0.840000 +0.500000 -0.127100 -0.304800 0.480000 0.456000 -0.744000 +0.450000 -0.150600 -0.321300 -0.008000 0.120000 -0.992000 +0.500000 -0.150600 -0.319100 0.336000 0.504000 -0.792000 +0.450000 -0.200800 -0.331300 -0.472000 -0.400000 -0.776000 +0.500000 -0.200800 -0.334200 -0.376000 -0.448000 -0.800000 +0.450000 -0.217600 -0.304800 -0.352000 -0.736000 -0.560000 +0.500000 -0.222600 -0.304800 -0.320000 -0.704000 -0.624000 +0.450000 -0.248400 -0.243900 -0.224000 -0.888000 -0.384000 +0.500000 -0.251000 -0.264200 -0.272000 -0.744000 -0.600000 +0.459300 -0.251000 -0.243900 -0.280000 -0.864000 -0.400000 +0.500000 -0.282700 -0.243900 -0.568000 -0.592000 -0.560000 +0.450000 -0.251000 -0.203800 -0.216000 -0.960000 -0.144000 +0.500000 -0.288400 -0.182900 -0.520000 -0.656000 0.528000 +0.450000 -0.255300 -0.182900 -0.208000 -0.656000 0.712000 +0.500000 -0.251000 -0.123800 -0.544000 -0.688000 0.456000 +0.450000 -0.251000 -0.179900 -0.288000 -0.680000 0.664000 +0.500000 -0.250100 -0.121900 -0.432000 -0.712000 0.536000 +0.450000 -0.227100 -0.121900 -0.296000 -0.712000 0.624000 +0.500000 -0.203100 -0.060900 -0.256000 -0.616000 0.736000 +0.450000 -0.200800 -0.072200 -0.256000 -0.536000 0.800000 +0.491400 -0.200800 -0.060900 -0.168000 -0.584000 0.784000 +0.450000 -0.150600 -0.064700 -0.192000 0.128000 0.968000 +0.463100 -0.150600 -0.060900 -0.168000 0.352000 0.912000 +0.450000 -0.100400 -0.078400 -0.088000 0.200000 0.968000 +0.500000 -0.139000 -0.060900 0.080000 0.536000 0.832000 +0.500000 -0.100400 -0.086800 -0.048000 0.256000 0.960000 +0.530700 -0.150600 -0.060900 0.208000 0.504000 0.832000 +0.550000 -0.100400 -0.076900 0.056000 0.056000 0.992000 +0.550000 -0.150600 -0.067100 0.240000 0.480000 0.840000 +0.600000 -0.100400 -0.077400 0.584000 0.048000 0.800000 +0.600000 -0.150600 -0.093600 0.304000 0.568000 0.752000 +0.626600 -0.100400 -0.121900 0.848000 0.208000 0.472000 +0.650000 -0.150600 -0.116200 0.720000 0.480000 0.488000 +0.650000 -0.146100 -0.121900 0.720000 0.504000 0.464000 +0.652900 -0.150600 -0.121900 0.752000 0.456000 0.464000 +0.650000 -0.117900 -0.182900 0.792000 0.600000 0.024000 +0.675300 -0.150600 -0.182900 0.768000 0.552000 0.296000 +0.650000 -0.120200 -0.243900 0.704000 0.520000 -0.472000 +0.674200 -0.150600 -0.243900 0.696000 0.600000 -0.384000 +0.650000 -0.150600 -0.274900 0.544000 0.464000 -0.688000 +0.700000 -0.175300 -0.243900 0.752000 0.600000 -0.240000 +0.650000 -0.200800 -0.297000 0.088000 0.616000 -0.776000 +0.700000 -0.200800 -0.294000 0.576000 0.608000 -0.536000 +0.650000 -0.208600 -0.304800 0.024000 0.680000 -0.728000 +0.700000 -0.211400 -0.304800 0.288000 0.624000 -0.720000 +0.650000 -0.245700 -0.365800 0.168000 0.856000 -0.480000 +0.700000 -0.251000 -0.357800 0.296000 0.496000 -0.808000 +0.678000 -0.251000 -0.365800 0.264000 0.520000 -0.808000 +0.700000 -0.301200 -0.354900 0.160000 -0.240000 -0.952000 +0.650000 -0.267900 -0.365800 0.280000 -0.440000 -0.848000 +0.650000 -0.301200 -0.350300 0.016000 -0.440000 -0.888000 +0.600000 -0.288400 -0.365800 -0.376000 -0.712000 -0.584000 +0.600000 -0.301200 -0.352300 -0.528000 -0.312000 -0.776000 +0.573000 -0.251000 -0.365800 -0.696000 0.544000 -0.464000 +0.567500 -0.301200 -0.304800 -0.696000 0.400000 -0.584000 +0.550000 -0.251000 -0.326800 -0.648000 -0.504000 -0.560000 +0.550000 -0.272400 -0.304800 -0.680000 -0.440000 -0.576000 +0.535300 -0.251000 -0.304800 -0.648000 -0.480000 -0.576000 +0.550000 -0.301200 -0.279200 -0.712000 0.120000 -0.680000 +0.500000 -0.251000 -0.264200 -0.272000 -0.744000 -0.600000 +0.513800 -0.301200 -0.243900 -0.728000 0.592000 -0.328000 +0.500000 -0.282700 -0.243900 -0.568000 -0.592000 -0.560000 +0.511800 -0.301200 -0.182900 -0.912000 0.352000 0.176000 +0.500000 -0.288400 -0.182900 -0.520000 -0.656000 0.528000 +0.550000 -0.301200 -0.123600 -0.624000 -0.440000 0.632000 +0.500000 -0.251000 -0.123800 -0.544000 -0.688000 0.456000 +0.550000 -0.300100 -0.121900 -0.624000 -0.616000 0.472000 +0.501100 -0.251000 -0.121900 -0.552000 -0.624000 0.544000 +0.550000 -0.251000 -0.069700 -0.416000 -0.584000 0.688000 +0.500000 -0.250100 -0.121900 -0.432000 -0.712000 0.536000 +0.550000 -0.242100 -0.060900 -0.400000 -0.536000 0.736000 +0.500000 -0.203100 -0.060900 -0.256000 -0.616000 0.736000 +0.550000 -0.200800 -0.034900 0.016000 -0.040000 0.992000 +0.500000 -0.200800 -0.058700 -0.200000 -0.576000 0.784000 +0.550000 -0.159500 -0.060900 0.248000 0.472000 0.840000 +0.500000 -0.150600 -0.051600 0.024000 0.352000 0.928000 +0.530700 -0.150600 -0.060900 0.208000 0.504000 0.832000 +0.500000 -0.139000 -0.060900 0.080000 0.536000 0.832000 +0.500000 -0.150600 -0.051600 0.024000 0.352000 0.928000 +0.463100 -0.150600 -0.060900 -0.168000 0.352000 0.912000 +0.500000 -0.200800 -0.058700 -0.200000 -0.576000 0.784000 +0.491400 -0.200800 -0.060900 -0.168000 -0.584000 0.784000 +0.500000 -0.203100 -0.060900 -0.256000 -0.616000 0.736000 +0.500000 -0.203100 -0.060900 -0.256000 -0.616000 0.736000 +0.600000 0.251000 0.198700 -0.584000 -0.144000 0.792000 +0.600000 0.251000 0.198700 -0.584000 -0.144000 0.792000 +0.600000 0.301200 0.199900 -0.528000 0.136000 0.832000 +0.586200 0.251000 0.182900 -0.672000 -0.144000 0.720000 +0.577700 0.301200 0.182900 -0.536000 0.272000 0.792000 +0.550000 0.251000 0.125100 -0.872000 -0.184000 0.440000 +0.550000 0.301200 0.149100 -0.896000 -0.096000 0.416000 +0.548800 0.251000 0.121900 -0.912000 -0.176000 0.360000 +0.538800 0.301200 0.121900 -0.912000 0.128000 0.376000 +0.533200 0.251000 0.060900 -0.856000 0.032000 0.512000 +0.526500 0.301200 0.060900 -0.896000 0.008000 0.432000 +0.500800 0.251000 0.000000 -0.792000 -0.016000 0.608000 +0.500000 0.301200 0.002700 -0.768000 -0.080000 0.624000 +0.500000 0.266900 0.000000 -0.760000 -0.040000 0.640000 +0.497900 0.301200 0.000000 -0.728000 -0.144000 0.664000 +0.500000 0.251000 -0.000900 -0.496000 0.112000 0.856000 +0.450000 0.301200 -0.039700 -0.448000 -0.256000 0.848000 +0.450000 0.251000 -0.039600 -0.400000 -0.080000 0.904000 +0.400000 0.301200 -0.051900 -0.168000 -0.472000 0.856000 +0.400000 0.251000 -0.058700 -0.328000 -0.176000 0.920000 +0.353900 0.301200 -0.060900 -0.128000 -0.544000 0.824000 +0.395100 0.251000 -0.060900 -0.344000 -0.184000 0.912000 +0.350000 0.301200 -0.062100 -0.176000 -0.704000 0.680000 +0.350000 0.251000 -0.088400 -0.448000 -0.320000 0.824000 +0.300000 0.301200 -0.077400 -0.160000 -0.712000 0.680000 +0.300000 0.251000 -0.114600 -0.168000 -0.536000 0.824000 +0.250000 0.301200 -0.083600 -0.096000 -0.744000 0.648000 +0.271900 0.251000 -0.121900 -0.240000 -0.760000 0.592000 +0.250000 0.256500 -0.121900 -0.200000 -0.800000 0.552000 +0.300000 0.251000 -0.156100 -0.368000 -0.808000 -0.448000 +0.250000 0.284000 -0.182900 -0.096000 -0.256000 -0.952000 +0.300000 0.284000 -0.182900 -0.168000 -0.184000 -0.960000 +0.250000 0.301200 -0.184400 -0.080000 -0.056000 -0.992000 +0.300000 0.301200 -0.184400 -0.064000 -0.072000 -0.992000 +0.250000 0.351500 -0.189100 -0.160000 0.168000 -0.968000 +0.300000 0.351500 -0.193900 -0.008000 0.064000 -0.992000 +0.250000 0.370000 -0.182900 -0.184000 0.304000 -0.928000 +0.300000 0.379400 -0.182900 -0.016000 0.272000 -0.960000 +0.250000 0.401700 -0.172700 -0.016000 0.288000 -0.952000 +0.300000 0.401700 -0.174800 0.040000 0.368000 -0.920000 +0.250000 0.451900 -0.137900 0.128000 0.536000 -0.824000 +0.300000 0.451900 -0.131100 0.200000 0.712000 -0.664000 +0.250000 0.466900 -0.121900 0.232000 0.968000 0.016000 +0.300000 0.458100 -0.121900 0.224000 0.952000 -0.176000 +0.250000 0.451900 -0.094000 0.248000 0.784000 0.552000 +0.300000 0.451900 -0.106900 0.184000 0.864000 0.456000 +0.250000 0.432000 -0.060900 0.224000 0.624000 0.736000 +0.300000 0.430700 -0.060900 0.128000 0.808000 0.568000 +0.250000 0.401700 -0.026800 -0.216000 0.176000 0.952000 +0.300000 0.401700 -0.022200 0.096000 0.472000 0.864000 +0.250000 0.351500 -0.020200 -0.488000 -0.416000 0.760000 +0.300000 0.351500 -0.009100 -0.016000 -0.144000 0.984000 +0.250000 0.317900 -0.060900 -0.432000 -0.680000 0.584000 +0.300000 0.310700 -0.060900 -0.072000 -0.760000 0.640000 +0.250000 0.301200 -0.083600 -0.096000 -0.744000 0.648000 +0.300000 0.301200 -0.077400 -0.160000 -0.712000 0.680000 +0.300000 0.310700 -0.060900 -0.072000 -0.760000 0.640000 +0.350000 0.301200 -0.062100 -0.176000 -0.704000 0.680000 +0.350000 0.302200 -0.060900 -0.144000 -0.624000 0.760000 +0.353900 0.301200 -0.060900 -0.128000 -0.544000 0.824000 +0.350000 0.351500 -0.021800 0.032000 -0.048000 0.992000 +0.400000 0.301200 -0.051900 -0.168000 -0.472000 0.856000 +0.400000 0.351500 -0.018700 -0.136000 -0.208000 0.960000 +0.450000 0.301200 -0.039700 -0.448000 -0.256000 0.848000 +0.450000 0.351500 -0.003200 -0.296000 0.344000 0.888000 +0.497900 0.301200 0.000000 -0.728000 -0.144000 0.664000 +0.458200 0.351500 0.000000 -0.280000 0.520000 0.800000 +0.500000 0.301200 0.002700 -0.768000 -0.080000 0.624000 +0.500000 0.351500 0.029100 -0.680000 0.048000 0.728000 +0.526500 0.301200 0.060900 -0.896000 0.008000 0.432000 +0.540600 0.351500 0.060900 -0.584000 0.632000 0.496000 +0.538800 0.301200 0.121900 -0.912000 0.128000 0.376000 +0.550000 0.351500 0.078000 -0.616000 0.672000 0.392000 +0.550000 0.331800 0.121900 -0.696000 0.536000 0.456000 +0.566500 0.351500 0.121900 -0.632000 0.576000 0.496000 +0.550000 0.301200 0.149100 -0.896000 -0.096000 0.416000 +0.600000 0.351500 0.157200 -0.376000 0.584000 0.704000 +0.577700 0.301200 0.182900 -0.536000 0.272000 0.792000 +0.600000 0.327100 0.182900 -0.144000 0.552000 0.816000 +0.600000 0.351500 0.157200 -0.376000 0.584000 0.704000 +0.650000 0.311500 0.182900 0.424000 0.496000 0.752000 +0.650000 0.351500 0.128300 0.616000 0.616000 0.480000 +0.650000 0.351500 0.128300 0.616000 0.616000 0.480000 +0.586200 0.251000 0.182900 -0.672000 -0.144000 0.720000 +0.586200 0.251000 0.182900 -0.672000 -0.144000 0.720000 +0.600000 0.251000 0.198700 -0.584000 -0.144000 0.792000 +0.600000 0.211800 0.182900 -0.672000 -0.280000 0.672000 +0.650000 0.251000 0.217300 -0.016000 0.232000 0.968000 +0.604600 0.200800 0.182900 -0.672000 -0.288000 0.664000 +0.650000 0.200800 0.219700 -0.496000 -0.256000 0.824000 +0.641000 0.150600 0.182900 -0.528000 -0.464000 0.696000 +0.650000 0.150600 0.191100 -0.504000 -0.472000 0.720000 +0.650000 0.141000 0.182900 -0.512000 -0.488000 0.704000 +0.700000 0.150600 0.220800 -0.264000 -0.416000 0.864000 +0.685300 0.100400 0.182900 -0.504000 -0.560000 0.648000 +0.700000 0.100400 0.197200 -0.456000 -0.560000 0.680000 +0.700000 0.088000 0.182900 -0.464000 -0.608000 0.640000 +0.750000 0.100400 0.207000 0.032000 -0.192000 0.976000 +0.750000 0.062100 0.182900 -0.416000 -0.632000 0.648000 +0.800000 0.100400 0.199400 -0.032000 0.024000 0.992000 +0.762700 0.050200 0.182900 -0.512000 -0.672000 0.520000 +0.800000 0.050200 0.211000 -0.336000 -0.552000 0.752000 +0.800000 0.035400 0.182900 -0.432000 -0.808000 0.384000 +0.850000 0.050200 0.216300 -0.184000 -0.272000 0.936000 +0.846600 0.000000 0.182900 -0.736000 -0.616000 0.264000 +0.850000 0.000000 0.194300 -0.704000 -0.640000 0.296000 +0.850000 -0.004200 0.182900 -0.720000 -0.616000 0.288000 +0.900000 0.000000 0.237100 -0.176000 -0.616000 0.760000 +0.880500 -0.050200 0.182900 -0.744000 -0.528000 0.384000 +0.900000 -0.050200 0.230400 -0.448000 -0.568000 0.680000 +0.900000 -0.076800 0.182900 -0.504000 -0.624000 0.592000 +0.950000 -0.050200 0.197900 0.336000 -0.192000 0.920000 +0.934300 -0.100400 0.182900 -0.392000 -0.752000 0.520000 +0.950000 -0.100400 0.196500 0.208000 -0.704000 0.672000 +0.950000 -0.108800 0.182900 0.232000 -0.768000 0.584000 +0.934300 -0.100400 0.182900 -0.392000 -0.752000 0.520000 +0.950000 -0.142500 0.121900 -0.608000 -0.672000 0.392000 +0.900000 -0.100400 0.145900 -0.608000 -0.728000 0.304000 +0.900000 -0.107100 0.121900 -0.584000 -0.768000 0.240000 +0.892500 -0.100400 0.121900 -0.688000 -0.680000 0.240000 +0.900000 -0.117100 0.060900 -0.656000 -0.736000 0.136000 +0.881900 -0.100400 0.060900 -0.752000 -0.632000 0.152000 +0.900000 -0.125700 0.000000 -0.664000 -0.728000 0.136000 +0.873300 -0.100400 0.000000 -0.752000 -0.632000 0.120000 +0.900000 -0.135500 -0.060900 -0.672000 -0.712000 0.168000 +0.865600 -0.100400 -0.060900 -0.776000 -0.616000 0.120000 +0.900000 -0.148200 -0.121900 -0.664000 -0.728000 0.088000 +0.858300 -0.100400 -0.121900 -0.792000 -0.600000 0.056000 +0.900000 -0.150600 -0.145400 -0.696000 -0.704000 0.104000 +0.858100 -0.100400 -0.182900 -0.824000 -0.552000 0.000000 +0.895100 -0.150600 -0.182900 -0.744000 -0.648000 0.104000 +0.860900 -0.100400 -0.243900 -0.856000 -0.496000 -0.072000 +0.890800 -0.150600 -0.243900 -0.848000 -0.512000 0.064000 +0.869700 -0.100400 -0.304800 -0.880000 -0.248000 -0.400000 +0.883200 -0.150600 -0.304800 -0.864000 -0.368000 -0.320000 +0.890800 -0.150600 -0.243900 -0.848000 -0.512000 0.064000 +0.900000 -0.181100 -0.304800 -0.768000 -0.440000 -0.448000 +0.900000 -0.163000 -0.243900 -0.816000 -0.552000 0.128000 +0.911900 -0.200800 -0.304800 -0.864000 -0.480000 -0.128000 +0.928800 -0.200800 -0.243900 -0.736000 -0.616000 0.240000 +0.942100 -0.251000 -0.304800 -0.752000 -0.552000 0.344000 +0.950000 -0.224400 -0.243900 -0.688000 -0.640000 0.328000 +0.950000 -0.251000 -0.295200 -0.640000 -0.496000 0.576000 +0.942100 -0.251000 -0.304800 -0.752000 -0.552000 0.344000 +0.950000 -0.261400 -0.304800 -0.752000 -0.584000 0.288000 +0.950000 -0.261400 -0.304800 -0.752000 -0.584000 0.288000 +0.650000 0.251000 0.217300 -0.016000 0.232000 0.968000 +0.650000 0.251000 0.217300 -0.016000 0.232000 0.968000 +0.600000 0.251000 0.198700 -0.584000 -0.144000 0.792000 +0.650000 0.301200 0.190400 0.408000 0.464000 0.776000 +0.600000 0.301200 0.199900 -0.528000 0.136000 0.832000 +0.600000 0.301200 0.199900 -0.528000 0.136000 0.832000 +0.700000 0.251000 0.193900 0.488000 0.504000 0.704000 +0.700000 0.251000 0.193900 0.488000 0.504000 0.704000 +0.650000 0.251000 0.217300 -0.016000 0.232000 0.968000 +0.700000 0.200800 0.226400 0.328000 0.432000 0.832000 +0.650000 0.200800 0.219700 -0.496000 -0.256000 0.824000 +0.700000 0.150600 0.220800 -0.264000 -0.416000 0.864000 +0.650000 0.150600 0.191100 -0.504000 -0.472000 0.720000 +0.650000 0.150600 0.191100 -0.504000 -0.472000 0.720000 +0.750000 0.200800 0.191100 0.424000 0.552000 0.712000 +0.750000 0.200800 0.191100 0.424000 0.552000 0.712000 +0.700000 0.200800 0.226400 0.328000 0.432000 0.832000 +0.750000 0.150600 0.201100 0.320000 0.240000 0.912000 +0.700000 0.150600 0.220800 -0.264000 -0.416000 0.864000 +0.750000 0.100400 0.207000 0.032000 -0.192000 0.976000 +0.700000 0.100400 0.197200 -0.456000 -0.560000 0.680000 +0.700000 0.100400 0.197200 -0.456000 -0.560000 0.680000 +0.850000 0.050200 0.216300 -0.184000 -0.272000 0.936000 +0.850000 0.050200 0.216300 -0.184000 -0.272000 0.936000 +0.800000 0.050200 0.211000 -0.336000 -0.552000 0.752000 +0.850000 0.100400 0.222500 0.440000 0.584000 0.672000 +0.800000 0.100400 0.199400 -0.032000 0.024000 0.992000 +0.800000 0.100400 0.199400 -0.032000 0.024000 0.992000 +0.900000 0.000000 0.237100 -0.176000 -0.616000 0.760000 +0.900000 0.000000 0.237100 -0.176000 -0.616000 0.760000 +0.850000 0.000000 0.194300 -0.704000 -0.640000 0.296000 +0.900000 0.050200 0.226800 0.488000 0.496000 0.712000 +0.850000 0.050200 0.216300 -0.184000 -0.272000 0.936000 +0.850000 0.050200 0.216300 -0.184000 -0.272000 0.936000 +0.950000 -0.050200 0.197900 0.336000 -0.192000 0.920000 +0.950000 -0.050200 0.197900 0.336000 -0.192000 0.920000 +0.900000 -0.050200 0.230400 -0.448000 -0.568000 0.680000 +0.950000 0.000000 0.206500 0.400000 0.008000 0.912000 +0.900000 0.000000 0.237100 -0.176000 -0.616000 0.760000 +0.900000 0.000000 0.237100 -0.176000 -0.616000 0.760000 +-0.950000 0.150600 0.154300 0.208000 0.640000 0.736000 +-0.950000 0.150600 0.154300 0.208000 0.640000 0.736000 +-0.900000 0.150600 0.126400 0.344000 0.632000 0.688000 +-0.950000 0.178500 0.121900 0.272000 0.648000 0.704000 +-0.900000 0.154600 0.121900 0.352000 0.624000 0.688000 +-0.950000 0.200800 0.096100 0.208000 0.672000 0.704000 +-0.900000 0.200800 0.074800 0.296000 0.712000 0.624000 +-0.950000 0.226300 0.060900 0.264000 0.760000 0.584000 +-0.900000 0.210300 0.060900 0.312000 0.744000 0.576000 +-0.950000 0.251000 0.016800 0.288000 0.808000 0.504000 +-0.900000 0.240500 0.000000 0.368000 0.840000 0.376000 +-0.928700 0.251000 0.000000 0.312000 0.848000 0.408000 +-0.900000 0.251000 -0.035000 0.384000 0.864000 0.312000 +-0.950000 0.258900 0.000000 0.296000 0.848000 0.432000 +-0.900000 0.258900 -0.060900 0.400000 0.896000 0.144000 +-0.950000 0.277400 -0.060900 0.336000 0.928000 0.080000 +-0.900000 0.251000 -0.101700 0.376000 0.896000 -0.216000 +-0.950000 0.267200 -0.121900 0.344000 0.864000 -0.336000 +-0.910500 0.251000 -0.121900 0.344000 0.880000 -0.304000 +-0.950000 0.251000 -0.157200 0.320000 0.808000 -0.480000 +-0.900000 0.246900 -0.121900 0.360000 0.872000 -0.304000 +-0.950000 0.237800 -0.182900 0.296000 0.760000 -0.568000 +-0.900000 0.214200 -0.182900 0.360000 0.720000 -0.576000 +-0.950000 0.200800 -0.231900 0.272000 0.640000 -0.704000 +-0.900000 0.200800 -0.201400 0.352000 0.680000 -0.640000 +-0.950000 0.189400 -0.243900 0.264000 0.616000 -0.728000 +-0.900000 0.162400 -0.243900 0.336000 0.616000 -0.704000 +-0.950000 0.150600 -0.281200 0.240000 0.600000 -0.752000 +-0.900000 0.150600 -0.256300 0.328000 0.616000 -0.704000 +-0.950000 0.126000 -0.304800 0.168000 0.528000 -0.824000 +-0.900000 0.104600 -0.304800 0.304000 0.568000 -0.760000 +-0.950000 0.100400 -0.325900 0.192000 0.384000 -0.896000 +-0.900000 0.100400 -0.308600 0.312000 0.536000 -0.776000 +-0.950000 0.050200 -0.340200 0.184000 0.072000 -0.976000 +-0.900000 0.050200 -0.331200 0.320000 0.232000 -0.912000 +-0.950000 0.000000 -0.337100 0.184000 -0.088000 -0.976000 +-0.900000 0.000000 -0.328400 0.216000 0.000000 -0.968000 +-0.950000 -0.050200 -0.337400 0.088000 0.008000 -0.992000 +-0.900000 -0.050200 -0.330000 0.160000 0.128000 -0.976000 +-0.900000 0.000000 -0.328400 0.216000 0.000000 -0.968000 +-0.850000 -0.050200 -0.323400 0.248000 0.176000 -0.944000 +-0.850000 0.000000 -0.313800 0.264000 0.064000 -0.960000 +-0.808200 -0.050200 -0.304800 0.280000 0.136000 -0.944000 +-0.823600 0.000000 -0.304800 0.296000 0.080000 -0.944000 +-0.800000 -0.050200 -0.302200 0.264000 0.120000 -0.952000 +-0.800000 0.000000 -0.298500 0.248000 0.080000 -0.960000 +-0.750000 -0.050200 -0.287100 0.288000 0.040000 -0.952000 +-0.750000 0.000000 -0.285200 0.328000 0.160000 -0.920000 +-0.700000 -0.050200 -0.272000 0.360000 0.104000 -0.920000 +-0.700000 0.000000 -0.262900 0.392000 0.288000 -0.864000 +-0.650000 -0.050200 -0.249300 0.496000 0.208000 -0.840000 +-0.669700 0.000000 -0.243900 0.480000 0.312000 -0.808000 +-0.650000 -0.035200 -0.243900 0.544000 0.264000 -0.792000 +-0.650000 0.000000 -0.224600 0.632000 0.368000 -0.672000 +-0.642900 -0.050200 -0.243900 0.560000 0.208000 -0.792000 +-0.621400 0.000000 -0.182900 0.848000 0.280000 -0.440000 +-0.606100 -0.050200 -0.182900 0.864000 0.248000 -0.424000 +-0.606100 -0.050200 -0.182900 0.864000 0.248000 -0.424000 +-0.950000 0.127100 0.182900 0.248000 0.536000 0.800000 +-0.950000 0.127100 0.182900 0.248000 0.536000 0.800000 +-0.950000 0.150600 0.154300 0.208000 0.640000 0.736000 +-0.900000 0.101900 0.182900 0.304000 0.552000 0.768000 +-0.900000 0.150600 0.126400 0.344000 0.632000 0.688000 +-0.900000 0.150600 0.126400 0.344000 0.632000 0.688000 +-0.939400 -0.100400 0.121900 -0.456000 -0.816000 0.336000 +-0.939400 -0.100400 0.121900 -0.456000 -0.816000 0.336000 +-0.900000 -0.100400 0.174900 -0.400000 -0.624000 0.656000 +-0.900000 -0.127600 0.121900 -0.608000 -0.704000 0.344000 +-0.900000 -0.127600 0.121900 -0.608000 -0.704000 0.344000 +-0.900000 0.150600 0.126400 0.344000 0.632000 0.688000 +-0.900000 0.150600 0.126400 0.344000 0.632000 0.688000 +-0.900000 0.154600 0.121900 0.352000 0.624000 0.688000 +-0.892900 0.150600 0.121900 0.360000 0.624000 0.680000 +-0.900000 0.200800 0.074800 0.296000 0.712000 0.624000 +-0.850000 0.150600 0.098600 0.360000 0.600000 0.704000 +-0.879600 0.200800 0.060900 0.352000 0.712000 0.600000 +-0.850000 0.184100 0.060900 0.376000 0.632000 0.664000 +-0.850000 0.200800 0.035600 0.384000 0.744000 0.536000 +-0.800000 0.153700 0.060900 0.432000 0.632000 0.632000 +-0.811000 0.200800 0.000000 0.408000 0.816000 0.392000 +-0.800000 0.195100 0.000000 0.456000 0.768000 0.432000 +-0.800000 0.200800 -0.016800 0.416000 0.840000 0.336000 +-0.750000 0.162200 0.000000 0.464000 0.672000 0.560000 +-0.768900 0.200800 -0.060900 0.424000 0.888000 0.160000 +-0.750000 0.191300 -0.060900 0.496000 0.856000 0.072000 +-0.800000 0.200800 -0.113900 0.392000 0.880000 -0.256000 +-0.750000 0.174400 -0.121900 0.448000 0.824000 -0.336000 +-0.800000 0.198900 -0.121900 0.384000 0.872000 -0.288000 +-0.750000 0.150600 -0.159200 0.432000 0.664000 -0.600000 +-0.800000 0.163000 -0.182900 0.392000 0.688000 -0.600000 +-0.779100 0.150600 -0.182900 0.400000 0.664000 -0.616000 +-0.800000 0.150600 -0.199200 0.384000 0.648000 -0.648000 +-0.750000 0.132600 -0.182900 0.408000 0.656000 -0.624000 +-0.800000 0.108800 -0.243900 0.352000 0.608000 -0.704000 +-0.750000 0.100400 -0.222000 0.432000 0.576000 -0.680000 +-0.785800 0.100400 -0.243900 0.360000 0.584000 -0.720000 +-0.750000 0.077000 -0.243900 0.368000 0.552000 -0.744000 +-0.800000 0.100400 -0.252800 0.360000 0.584000 -0.720000 +-0.750000 0.050200 -0.267100 0.368000 0.432000 -0.816000 +-0.800000 0.050200 -0.288900 0.352000 0.360000 -0.856000 +-0.750000 0.000000 -0.285200 0.328000 0.160000 -0.920000 +-0.800000 0.000000 -0.298500 0.248000 0.080000 -0.960000 +-0.800000 0.050200 -0.288900 0.352000 0.360000 -0.856000 +-0.823600 0.000000 -0.304800 0.296000 0.080000 -0.944000 +-0.836500 0.050200 -0.304800 0.336000 0.344000 -0.872000 +-0.850000 0.000000 -0.313800 0.264000 0.064000 -0.960000 +-0.850000 0.050200 -0.311100 0.336000 0.328000 -0.872000 +-0.900000 0.000000 -0.328400 0.216000 0.000000 -0.968000 +-0.900000 0.050200 -0.331200 0.320000 0.232000 -0.912000 +-0.850000 0.050200 -0.311100 0.336000 0.328000 -0.872000 +-0.900000 0.100400 -0.308600 0.312000 0.536000 -0.776000 +-0.850000 0.061400 -0.304800 0.336000 0.392000 -0.848000 +-0.892300 0.100400 -0.304800 0.320000 0.536000 -0.776000 +-0.850000 0.100400 -0.281200 0.344000 0.488000 -0.792000 +-0.900000 0.104600 -0.304800 0.304000 0.568000 -0.760000 +-0.850000 0.135500 -0.243900 0.320000 0.608000 -0.712000 +-0.900000 0.150600 -0.256300 0.328000 0.616000 -0.704000 +-0.878700 0.150600 -0.243900 0.328000 0.616000 -0.704000 +-0.900000 0.162400 -0.243900 0.336000 0.616000 -0.704000 +-0.850000 0.150600 -0.229000 0.320000 0.608000 -0.720000 +-0.900000 0.200800 -0.201400 0.352000 0.680000 -0.640000 +-0.850000 0.188600 -0.182900 0.360000 0.712000 -0.592000 +-0.874200 0.200800 -0.182900 0.360000 0.712000 -0.584000 +-0.850000 0.200800 -0.163600 0.360000 0.768000 -0.512000 +-0.900000 0.214200 -0.182900 0.360000 0.720000 -0.576000 +-0.850000 0.222300 -0.121900 0.408000 0.856000 -0.296000 +-0.900000 0.246900 -0.121900 0.360000 0.872000 -0.304000 +-0.850000 0.235300 -0.060900 0.408000 0.904000 0.008000 +-0.900000 0.251000 -0.101700 0.376000 0.896000 -0.216000 +-0.884300 0.251000 -0.060900 0.432000 0.880000 0.144000 +-0.900000 0.258900 -0.060900 0.400000 0.896000 0.144000 +-0.900000 0.251000 -0.035000 0.384000 0.864000 0.312000 +-0.884300 0.251000 -0.060900 0.432000 0.880000 0.144000 +-0.900000 0.240500 0.000000 0.368000 0.840000 0.376000 +-0.850000 0.235300 -0.060900 0.408000 0.904000 0.008000 +-0.850000 0.219100 0.000000 0.368000 0.824000 0.424000 +-0.800000 0.214400 -0.060900 0.400000 0.896000 0.176000 +-0.811000 0.200800 0.000000 0.408000 0.816000 0.392000 +-0.800000 0.200800 -0.016800 0.416000 0.840000 0.336000 +-0.800000 0.214400 -0.060900 0.400000 0.896000 0.176000 +-0.768900 0.200800 -0.060900 0.424000 0.888000 0.160000 +-0.800000 0.200800 -0.113900 0.392000 0.880000 -0.256000 +-0.800000 0.214400 -0.060900 0.400000 0.896000 0.176000 +-0.804300 0.200800 -0.121900 0.384000 0.872000 -0.288000 +-0.850000 0.235300 -0.060900 0.408000 0.904000 0.008000 +-0.850000 0.222300 -0.121900 0.408000 0.856000 -0.296000 +-0.804300 0.200800 -0.121900 0.384000 0.872000 -0.288000 +-0.850000 0.200800 -0.163600 0.360000 0.768000 -0.512000 +-0.800000 0.198900 -0.121900 0.384000 0.872000 -0.288000 +-0.850000 0.188600 -0.182900 0.360000 0.712000 -0.592000 +-0.800000 0.163000 -0.182900 0.392000 0.688000 -0.600000 +-0.850000 0.150600 -0.229000 0.320000 0.608000 -0.720000 +-0.800000 0.150600 -0.199200 0.384000 0.648000 -0.648000 +-0.850000 0.135500 -0.243900 0.320000 0.608000 -0.712000 +-0.800000 0.108800 -0.243900 0.352000 0.608000 -0.704000 +-0.850000 0.100400 -0.281200 0.344000 0.488000 -0.792000 +-0.800000 0.100400 -0.252800 0.360000 0.584000 -0.720000 +-0.850000 0.061400 -0.304800 0.336000 0.392000 -0.848000 +-0.800000 0.050200 -0.288900 0.352000 0.360000 -0.856000 +-0.836500 0.050200 -0.304800 0.336000 0.344000 -0.872000 +-0.850000 0.061400 -0.304800 0.336000 0.392000 -0.848000 +-0.850000 0.050200 -0.311100 0.336000 0.328000 -0.872000 +-0.850000 0.050200 -0.311100 0.336000 0.328000 -0.872000 +-0.850000 0.127100 0.121900 0.424000 0.560000 0.704000 +-0.850000 0.127100 0.121900 0.424000 0.560000 0.704000 +-0.820700 0.100400 0.121900 0.496000 0.488000 0.704000 +-0.850000 0.100400 0.150400 0.488000 0.512000 0.696000 +-0.850000 0.100400 0.150400 0.488000 0.512000 0.696000 +-0.839600 0.000000 0.182900 0.264000 0.152000 0.944000 +-0.839600 0.000000 0.182900 0.264000 0.152000 0.944000 +-0.809300 -0.050200 0.182900 0.232000 0.160000 0.952000 +-0.800000 0.000000 0.163200 0.400000 0.288000 0.864000 +-0.800000 -0.050200 0.179900 0.264000 0.176000 0.944000 +-0.750000 0.000000 0.129400 0.496000 0.360000 0.776000 +-0.750000 -0.050200 0.155100 0.464000 0.288000 0.832000 +-0.740500 0.000000 0.121900 0.504000 0.352000 0.784000 +-0.708600 -0.050200 0.121900 0.496000 0.344000 0.784000 +-0.700000 0.000000 0.089700 0.584000 0.336000 0.736000 +-0.700000 -0.050200 0.115300 0.496000 0.344000 0.792000 +-0.666100 0.000000 0.060900 0.560000 0.376000 0.728000 +-0.650000 -0.050200 0.076400 0.576000 0.320000 0.744000 +-0.650000 -0.023500 0.060900 0.576000 0.360000 0.720000 +-0.635700 -0.050200 0.060900 0.640000 0.304000 0.696000 +-0.650000 0.000000 0.045200 0.576000 0.400000 0.704000 +-0.600000 -0.050200 0.018400 0.648000 0.320000 0.688000 +-0.609800 0.000000 0.000000 0.696000 0.384000 0.592000 +-0.600000 -0.018300 0.000000 0.712000 0.368000 0.584000 +-0.600000 0.000000 -0.017800 0.736000 0.384000 0.544000 +-0.584800 -0.050200 0.000000 0.744000 0.336000 0.568000 +-0.573200 0.000000 -0.060900 0.920000 0.296000 -0.248000 +-0.554400 -0.050200 -0.060900 0.944000 0.280000 0.128000 +-0.554400 -0.050200 -0.060900 0.944000 0.280000 0.128000 +-0.800000 -0.063400 0.182900 0.240000 0.160000 0.952000 +-0.800000 -0.063400 0.182900 0.240000 0.160000 0.952000 +-0.809300 -0.050200 0.182900 0.232000 0.160000 0.952000 +-0.800000 -0.050200 0.179900 0.264000 0.176000 0.944000 +-0.800000 -0.050200 0.179900 0.264000 0.176000 0.944000 +-0.850000 -0.137400 0.182900 -0.304000 -0.312000 0.896000 +-0.850000 -0.137400 0.182900 -0.304000 -0.312000 0.896000 +-0.836800 -0.150600 0.182900 -0.304000 -0.304000 0.896000 +-0.850000 -0.150600 0.175600 -0.632000 -0.392000 0.664000 +-0.803100 -0.200800 0.182900 -0.456000 -0.168000 0.864000 +-0.850000 -0.200800 0.125700 -0.776000 -0.360000 0.504000 +-0.850000 -0.200800 0.125700 -0.776000 -0.360000 0.504000 +-0.800000 -0.251000 0.157900 -0.576000 -0.400000 0.696000 +-0.800000 -0.251000 0.157900 -0.576000 -0.400000 0.696000 +-0.800000 -0.280700 0.121900 -0.736000 -0.528000 0.408000 +-0.819200 -0.251000 0.121900 -0.760000 -0.496000 0.400000 +-0.800000 -0.301200 0.085900 -0.768000 -0.544000 0.304000 +-0.838400 -0.251000 0.060900 -0.808000 -0.528000 0.248000 +-0.805900 -0.301200 0.060900 -0.800000 -0.536000 0.232000 +-0.800000 -0.301200 0.085900 -0.768000 -0.544000 0.304000 +-0.800000 -0.310100 0.060900 -0.800000 -0.544000 0.224000 +-0.805900 -0.301200 0.060900 -0.800000 -0.536000 0.232000 +-0.800000 -0.327900 0.000000 -0.800000 -0.560000 0.176000 +-0.817700 -0.301200 0.000000 -0.808000 -0.560000 0.168000 +-0.817700 -0.301200 0.000000 -0.808000 -0.560000 0.168000 +-0.800000 0.077200 0.121900 0.512000 0.416000 0.744000 +-0.800000 0.077200 0.121900 0.512000 0.416000 0.744000 +-0.781300 0.050200 0.121900 0.536000 0.400000 0.736000 +-0.800000 0.050200 0.139800 0.504000 0.392000 0.760000 +-0.800000 0.050200 0.139800 0.504000 0.392000 0.760000 +-0.776900 -0.100400 0.182900 0.184000 0.120000 0.968000 +-0.776900 -0.100400 0.182900 0.184000 0.120000 0.968000 +-0.750000 -0.100400 0.174700 0.320000 0.192000 0.920000 +-0.750000 -0.136500 0.182900 0.216000 0.112000 0.968000 +-0.700000 -0.100400 0.138900 0.488000 0.288000 0.816000 +-0.743500 -0.150600 0.182900 0.192000 0.096000 0.968000 +-0.700000 -0.150600 0.164200 0.408000 0.248000 0.872000 +-0.703900 -0.200800 0.182900 0.128000 0.064000 0.984000 +-0.700000 -0.200800 0.182200 0.152000 0.072000 0.984000 +-0.700000 -0.208700 0.182900 0.176000 0.120000 0.968000 +-0.650000 -0.200800 0.153500 0.376000 0.280000 0.872000 +-0.650000 -0.249200 0.182900 0.176000 0.464000 0.864000 +-0.600000 -0.200800 0.130000 0.152000 0.560000 0.808000 +-0.638500 -0.251000 0.182900 0.072000 0.424000 0.896000 +-0.600000 -0.251000 0.177800 0.080000 0.520000 0.840000 +-0.600000 -0.260000 0.182900 0.056000 0.320000 0.944000 +-0.550000 -0.251000 0.173600 -0.016000 0.472000 0.872000 +-0.550000 -0.264400 0.182900 -0.072000 0.456000 0.880000 +-0.512000 -0.251000 0.182900 -0.112000 0.632000 0.760000 +-0.550000 -0.251000 0.173600 -0.016000 0.472000 0.872000 +-0.500000 -0.249000 0.182900 -0.112000 0.656000 0.744000 +-0.550000 -0.202900 0.121900 0.032000 0.728000 0.680000 +-0.500000 -0.200800 0.127000 -0.088000 0.600000 0.784000 +-0.536800 -0.200800 0.121900 -0.104000 0.736000 0.664000 +-0.500000 -0.196200 0.121900 -0.112000 0.784000 0.600000 +-0.550000 -0.200800 0.118700 0.032000 0.784000 0.608000 +-0.500000 -0.166600 0.060900 -0.304000 0.832000 0.448000 +-0.550000 -0.166800 0.060900 0.264000 0.816000 0.504000 +-0.500000 -0.150600 0.019400 -0.216000 0.856000 0.464000 +-0.550000 -0.150600 0.029600 0.504000 0.688000 0.512000 +-0.500000 -0.141000 0.000000 -0.040000 0.880000 0.456000 +-0.550000 -0.125000 0.000000 0.608000 0.616000 0.488000 +-0.500000 -0.119500 -0.060900 -0.160000 0.976000 0.112000 +-0.550000 -0.100400 -0.036900 0.792000 0.376000 0.464000 +-0.533200 -0.100400 -0.060900 0.712000 0.696000 -0.024000 +-0.533200 -0.100400 -0.060900 0.712000 0.696000 -0.024000 +-0.750000 -0.267900 0.182900 -0.232000 -0.192000 0.944000 +-0.750000 -0.267900 0.182900 -0.232000 -0.192000 0.944000 +-0.750000 -0.301200 0.168400 -0.360000 -0.432000 0.816000 +-0.700000 -0.272200 0.182900 -0.072000 -0.128000 0.984000 +-0.700000 -0.301200 0.175400 -0.248000 -0.280000 0.920000 +-0.671000 -0.301200 0.182900 -0.120000 -0.104000 0.984000 +-0.700000 -0.351500 0.155000 -0.664000 -0.344000 0.656000 +-0.663400 -0.351500 0.182900 -0.304000 -0.080000 0.944000 +-0.700000 -0.401700 0.124500 -0.664000 -0.408000 0.616000 +-0.650000 -0.385200 0.182900 -0.496000 -0.152000 0.848000 +-0.650000 -0.401700 0.178700 -0.552000 -0.344000 0.752000 +-0.644900 -0.401700 0.182900 -0.528000 -0.240000 0.808000 +-0.650000 -0.451900 0.140100 -0.528000 -0.568000 0.624000 +-0.600000 -0.446800 0.182900 -0.240000 -0.464000 0.848000 +-0.600000 -0.451900 0.179400 -0.216000 -0.496000 0.832000 +-0.583500 -0.451900 0.182900 -0.128000 -0.544000 0.824000 +-0.600000 -0.495400 0.121900 -0.392000 -0.720000 0.560000 +-0.550000 -0.456500 0.182900 0.056000 -0.736000 0.672000 +-0.550000 -0.494000 0.121900 0.024000 -0.832000 0.536000 +-0.600000 -0.495400 0.121900 -0.392000 -0.720000 0.560000 +-0.550000 -0.502100 0.104800 0.104000 -0.840000 0.520000 +-0.600000 -0.502100 0.110700 -0.280000 -0.792000 0.528000 +-0.550000 -0.532000 0.060900 0.080000 -0.776000 0.624000 +-0.600000 -0.531600 0.060900 -0.448000 -0.736000 0.496000 +-0.600000 -0.502100 0.110700 -0.280000 -0.792000 0.528000 +-0.640700 -0.502100 0.060900 -0.496000 -0.728000 0.456000 +-0.600000 -0.495400 0.121900 -0.392000 -0.720000 0.560000 +-0.650000 -0.495900 0.060900 -0.528000 -0.720000 0.432000 +-0.650000 -0.463300 0.121900 -0.512000 -0.696000 0.496000 +-0.700000 -0.453200 0.060900 -0.560000 -0.720000 0.392000 +-0.664200 -0.451900 0.121900 -0.552000 -0.696000 0.448000 +-0.700000 -0.451900 0.063700 -0.672000 -0.600000 0.424000 +-0.700000 -0.404000 0.121900 -0.624000 -0.536000 0.560000 +-0.701000 -0.451900 0.060900 -0.792000 -0.480000 0.344000 +-0.701700 -0.401700 0.121900 -0.704000 -0.408000 0.568000 +-0.731300 -0.401700 0.060900 -0.784000 -0.496000 0.344000 +-0.739400 -0.351500 0.121900 -0.528000 -0.576000 0.616000 +-0.750000 -0.377100 0.060900 -0.760000 -0.552000 0.320000 +-0.750000 -0.351500 0.110100 -0.600000 -0.584000 0.536000 +-0.767900 -0.351500 0.060900 -0.760000 -0.568000 0.296000 +-0.767900 -0.351500 0.060900 -0.760000 -0.568000 0.296000 +-0.750000 -0.301200 0.168400 -0.360000 -0.432000 0.816000 +-0.750000 -0.301200 0.168400 -0.360000 -0.432000 0.816000 +-0.700000 -0.301200 0.175400 -0.248000 -0.280000 0.920000 +-0.750000 -0.342500 0.121900 -0.536000 -0.592000 0.592000 +-0.700000 -0.351500 0.155000 -0.664000 -0.344000 0.656000 +-0.739400 -0.351500 0.121900 -0.528000 -0.576000 0.616000 +-0.700000 -0.401700 0.124500 -0.664000 -0.408000 0.616000 +-0.701700 -0.401700 0.121900 -0.704000 -0.408000 0.568000 +-0.700000 -0.404000 0.121900 -0.624000 -0.536000 0.560000 +-0.700000 -0.401700 0.124500 -0.664000 -0.408000 0.616000 +-0.664200 -0.451900 0.121900 -0.552000 -0.696000 0.448000 +-0.650000 -0.401700 0.178700 -0.552000 -0.344000 0.752000 +-0.650000 -0.451900 0.140100 -0.528000 -0.568000 0.624000 +-0.664200 -0.451900 0.121900 -0.552000 -0.696000 0.448000 +-0.650000 -0.463300 0.121900 -0.512000 -0.696000 0.496000 +-0.650000 -0.451900 0.140100 -0.528000 -0.568000 0.624000 +-0.600000 -0.495400 0.121900 -0.392000 -0.720000 0.560000 +-0.600000 -0.451900 0.179400 -0.216000 -0.496000 0.832000 +-0.600000 -0.451900 0.179400 -0.216000 -0.496000 0.832000 +-0.700000 -0.062200 0.121900 0.504000 0.344000 0.784000 +-0.700000 -0.062200 0.121900 0.504000 0.344000 0.784000 +-0.677900 -0.100400 0.121900 0.528000 0.328000 0.776000 +-0.700000 -0.100400 0.138900 0.488000 0.288000 0.816000 +-0.650000 -0.141800 0.121900 0.432000 0.328000 0.832000 +-0.700000 -0.150600 0.164200 0.408000 0.248000 0.872000 +-0.650000 -0.150600 0.126000 0.408000 0.336000 0.840000 +-0.700000 -0.200800 0.182200 0.152000 0.072000 0.984000 +-0.650000 -0.200800 0.153500 0.376000 0.280000 0.872000 +-0.650000 -0.150600 0.126000 0.408000 0.336000 0.840000 +-0.600000 -0.200800 0.130000 0.152000 0.560000 0.808000 +-0.642900 -0.150600 0.121900 0.408000 0.352000 0.832000 +-0.600000 -0.190600 0.121900 0.296000 0.496000 0.808000 +-0.600000 -0.150600 0.080700 0.576000 0.424000 0.688000 +-0.559300 -0.200800 0.121900 0.160000 0.720000 0.672000 +-0.575700 -0.150600 0.060900 0.384000 0.664000 0.632000 +-0.550000 -0.200800 0.118700 0.032000 0.784000 0.608000 +-0.550000 -0.166800 0.060900 0.264000 0.816000 0.504000 +-0.575700 -0.150600 0.060900 0.384000 0.664000 0.632000 +-0.550000 -0.150600 0.029600 0.504000 0.688000 0.512000 +-0.600000 -0.122400 0.060900 0.616000 0.400000 0.664000 +-0.550000 -0.125000 0.000000 0.608000 0.616000 0.488000 +-0.600000 -0.100400 0.044600 0.672000 0.336000 0.656000 +-0.565600 -0.100400 0.000000 0.744000 0.440000 0.496000 +-0.550000 -0.125000 0.000000 0.608000 0.616000 0.488000 +-0.550000 -0.100400 -0.036900 0.792000 0.376000 0.464000 +-0.550000 -0.100400 -0.036900 0.792000 0.376000 0.464000 +-0.650000 -0.150600 0.126000 0.408000 0.336000 0.840000 +-0.650000 -0.150600 0.126000 0.408000 0.336000 0.840000 +-0.650000 -0.141800 0.121900 0.432000 0.328000 0.832000 +-0.642900 -0.150600 0.121900 0.408000 0.352000 0.832000 +-0.650000 -0.100400 0.096100 0.592000 0.288000 0.744000 +-0.600000 -0.150600 0.080700 0.576000 0.424000 0.688000 +-0.612900 -0.100400 0.060900 0.624000 0.376000 0.672000 +-0.600000 -0.122400 0.060900 0.616000 0.400000 0.664000 +-0.600000 -0.100400 0.044600 0.672000 0.336000 0.656000 +-0.600000 -0.100400 0.044600 0.672000 0.336000 0.656000 +-0.600000 -0.190600 0.121900 0.296000 0.496000 0.808000 +-0.600000 -0.190600 0.121900 0.296000 0.496000 0.808000 +-0.559300 -0.200800 0.121900 0.160000 0.720000 0.672000 +-0.600000 -0.200800 0.130000 0.152000 0.560000 0.808000 +-0.550000 -0.202900 0.121900 0.032000 0.728000 0.680000 +-0.600000 -0.251000 0.177800 0.080000 0.520000 0.840000 +-0.550000 -0.251000 0.173600 -0.016000 0.472000 0.872000 +-0.550000 -0.251000 0.173600 -0.016000 0.472000 0.872000 +-0.500000 -0.200800 0.127000 -0.088000 0.600000 0.784000 +-0.500000 -0.200800 0.127000 -0.088000 0.600000 0.784000 +-0.450000 -0.200800 0.150000 -0.304000 0.608000 0.720000 +-0.500000 -0.196200 0.121900 -0.112000 0.784000 0.600000 +-0.450000 -0.173700 0.121900 -0.368000 0.648000 0.656000 +-0.500000 -0.166600 0.060900 -0.304000 0.832000 0.448000 +-0.450000 -0.150600 0.089400 -0.440000 0.744000 0.496000 +-0.472400 -0.150600 0.060900 -0.464000 0.768000 0.416000 +-0.450000 -0.136300 0.060900 -0.512000 0.720000 0.448000 +-0.500000 -0.150600 0.019400 -0.216000 0.856000 0.464000 +-0.450000 -0.112700 0.000000 -0.520000 0.784000 0.320000 +-0.500000 -0.141000 0.000000 -0.040000 0.880000 0.456000 +-0.500000 -0.141000 0.000000 -0.040000 0.880000 0.456000 +-0.500000 -0.200800 0.127000 -0.088000 0.600000 0.784000 +-0.500000 -0.200800 0.127000 -0.088000 0.600000 0.784000 +-0.500000 -0.249000 0.182900 -0.112000 0.656000 0.744000 +-0.450000 -0.200800 0.150000 -0.304000 0.608000 0.720000 +-0.450000 -0.233700 0.182900 -0.216000 0.472000 0.848000 +-0.400000 -0.200800 0.179200 -0.200000 0.464000 0.856000 +-0.400000 -0.206800 0.182900 -0.168000 0.424000 0.880000 +-0.383500 -0.200800 0.182900 -0.152000 0.448000 0.872000 +-0.400000 -0.200800 0.179200 -0.200000 0.464000 0.856000 +-0.350000 -0.189600 0.182900 -0.288000 0.472000 0.824000 +-0.400000 -0.150600 0.133500 -0.392000 0.600000 0.688000 +-0.350000 -0.150600 0.151300 -0.584000 0.352000 0.720000 +-0.350000 -0.189600 0.182900 -0.288000 0.472000 0.824000 +-0.311100 -0.150600 0.182900 -0.424000 0.464000 0.768000 +-0.311100 -0.150600 0.182900 -0.424000 0.464000 0.768000 +-0.400000 -0.200800 0.179200 -0.200000 0.464000 0.856000 +-0.400000 -0.200800 0.179200 -0.200000 0.464000 0.856000 +-0.450000 -0.200800 0.150000 -0.304000 0.608000 0.720000 +-0.400000 -0.150600 0.133500 -0.392000 0.600000 0.688000 +-0.450000 -0.173700 0.121900 -0.368000 0.648000 0.656000 +-0.414900 -0.150600 0.121900 -0.424000 0.616000 0.648000 +-0.450000 -0.150600 0.089400 -0.440000 0.744000 0.496000 +-0.450000 -0.150600 0.089400 -0.440000 0.744000 0.496000 +-0.351400 -0.100400 0.121900 -0.608000 0.368000 0.696000 +-0.351400 -0.100400 0.121900 -0.608000 0.368000 0.696000 +-0.350000 -0.097900 0.121900 -0.560000 0.424000 0.704000 +-0.350000 -0.100400 0.123500 -0.608000 0.328000 0.712000 +-0.300000 -0.066800 0.121900 -0.280000 0.584000 0.752000 +-0.300000 -0.100400 0.149000 -0.304000 0.432000 0.840000 +-0.255700 -0.050200 0.121900 -0.192000 0.512000 0.832000 +-0.250000 -0.100400 0.155000 0.480000 0.160000 0.856000 +-0.250000 -0.050200 0.123600 0.200000 0.440000 0.864000 +-0.250000 -0.050200 0.123600 0.200000 0.440000 0.864000 +-0.369700 -0.301200 0.182900 0.552000 -0.328000 0.752000 +-0.369700 -0.301200 0.182900 0.552000 -0.328000 0.752000 +-0.350000 -0.276800 0.182900 0.600000 -0.432000 0.664000 +-0.350000 -0.301200 0.167500 0.592000 -0.368000 0.712000 +-0.350000 -0.301200 0.167500 0.592000 -0.368000 0.712000 +-0.334800 -0.251000 0.182900 0.672000 -0.480000 0.552000 +-0.334800 -0.251000 0.182900 0.672000 -0.480000 0.552000 +-0.300000 -0.205800 0.182900 0.768000 -0.472000 0.416000 +-0.300000 -0.251000 0.131000 0.632000 -0.616000 0.464000 +-0.300000 -0.251000 0.131000 0.632000 -0.616000 0.464000 +-0.300000 -0.251000 0.131000 0.632000 -0.616000 0.464000 +-0.300000 -0.251000 0.131000 0.632000 -0.616000 0.464000 +-0.294600 -0.251000 0.121900 0.616000 -0.600000 0.488000 +-0.300000 -0.256400 0.121900 0.624000 -0.624000 0.456000 +-0.300000 -0.256400 0.121900 0.624000 -0.624000 0.456000 +0.550000 0.331800 0.121900 -0.696000 0.536000 0.456000 +0.550000 0.331800 0.121900 -0.696000 0.536000 0.456000 +0.550000 0.301200 0.149100 -0.896000 -0.096000 0.416000 +0.538800 0.301200 0.121900 -0.912000 0.128000 0.376000 +0.538800 0.301200 0.121900 -0.912000 0.128000 0.376000 +0.548800 0.251000 0.121900 -0.912000 -0.176000 0.360000 +0.548800 0.251000 0.121900 -0.912000 -0.176000 0.360000 +0.550000 0.251000 0.125100 -0.872000 -0.184000 0.440000 +0.550000 0.246100 0.121900 -0.904000 -0.224000 0.352000 +0.586200 0.251000 0.182900 -0.672000 -0.144000 0.720000 +0.567500 0.200800 0.121900 -0.784000 -0.344000 0.504000 +0.600000 0.211800 0.182900 -0.672000 -0.280000 0.672000 +0.600000 0.200800 0.176700 -0.712000 -0.296000 0.624000 +0.604600 0.200800 0.182900 -0.672000 -0.288000 0.664000 +0.600000 0.150600 0.141200 -0.712000 -0.440000 0.536000 +0.641000 0.150600 0.182900 -0.528000 -0.464000 0.696000 +0.600000 0.134700 0.121900 -0.776000 -0.456000 0.424000 +0.650000 0.141000 0.182900 -0.512000 -0.488000 0.704000 +0.627900 0.100400 0.121900 -0.608000 -0.608000 0.504000 +0.650000 0.100400 0.150000 -0.536000 -0.592000 0.592000 +0.650000 0.080100 0.121900 -0.576000 -0.640000 0.496000 +0.685300 0.100400 0.182900 -0.504000 -0.560000 0.648000 +0.692100 0.050200 0.121900 -0.432000 -0.784000 0.424000 +0.700000 0.088000 0.182900 -0.464000 -0.608000 0.640000 +0.700000 0.050200 0.131500 -0.112000 -0.824000 0.544000 +0.750000 0.062100 0.182900 -0.416000 -0.632000 0.648000 +0.744700 0.050200 0.121900 0.096000 -0.864000 0.480000 +0.750000 0.050900 0.121900 0.096000 -0.792000 0.600000 +0.750000 0.050200 0.120200 -0.160000 -0.904000 0.376000 +0.751700 0.050200 0.121900 -0.392000 -0.816000 0.416000 +0.750000 0.031700 0.060900 -0.136000 -0.928000 0.336000 +0.800000 0.028400 0.121900 -0.376000 -0.808000 0.432000 +0.798100 0.000000 0.060900 -0.504000 -0.792000 0.312000 +0.800000 0.000000 0.064400 -0.576000 -0.736000 0.344000 +0.800000 -0.001000 0.060900 -0.584000 -0.776000 0.216000 +0.829700 0.000000 0.121900 -0.704000 -0.616000 0.344000 +0.843600 -0.050200 0.060900 -0.704000 -0.672000 0.184000 +0.850000 -0.029600 0.121900 -0.840000 -0.432000 0.312000 +0.850000 -0.050200 0.089500 -0.768000 -0.592000 0.216000 +0.857500 -0.050200 0.121900 -0.848000 -0.448000 0.272000 +0.850000 -0.056700 0.060900 -0.720000 -0.664000 0.176000 +0.892500 -0.100400 0.121900 -0.688000 -0.680000 0.240000 +0.881900 -0.100400 0.060900 -0.752000 -0.632000 0.152000 +0.850000 -0.056700 0.060900 -0.720000 -0.664000 0.176000 +0.873300 -0.100400 0.000000 -0.752000 -0.632000 0.120000 +0.850000 -0.068700 0.000000 -0.752000 -0.640000 0.136000 +0.865600 -0.100400 -0.060900 -0.776000 -0.616000 0.120000 +0.850000 -0.079400 -0.060900 -0.768000 -0.616000 0.120000 +0.858300 -0.100400 -0.121900 -0.792000 -0.600000 0.056000 +0.850000 -0.088400 -0.121900 -0.808000 -0.584000 0.016000 +0.858100 -0.100400 -0.182900 -0.824000 -0.552000 0.000000 +0.850000 -0.086900 -0.182900 -0.848000 -0.512000 -0.048000 +0.860900 -0.100400 -0.243900 -0.856000 -0.496000 -0.072000 +0.850000 -0.077200 -0.243900 -0.824000 -0.432000 -0.344000 +0.869700 -0.100400 -0.304800 -0.880000 -0.248000 -0.400000 +0.850000 -0.050200 -0.276700 -0.784000 -0.280000 -0.544000 +0.867300 -0.050200 -0.304800 -0.784000 -0.136000 -0.600000 +0.850000 0.000000 -0.279000 -0.536000 0.488000 -0.680000 +0.877300 0.000000 -0.304800 -0.592000 0.480000 -0.632000 +0.877300 0.000000 -0.304800 -0.592000 0.480000 -0.632000 +0.600000 0.150600 0.141200 -0.712000 -0.440000 0.536000 +0.600000 0.150600 0.141200 -0.712000 -0.440000 0.536000 +0.600000 0.200800 0.176700 -0.712000 -0.296000 0.624000 +0.591100 0.150600 0.121900 -0.792000 -0.400000 0.440000 +0.567500 0.200800 0.121900 -0.784000 -0.344000 0.504000 +0.560700 0.150600 0.060900 -0.704000 -0.368000 0.592000 +0.550000 0.200800 0.086900 -0.880000 -0.256000 0.392000 +0.550000 0.174700 0.060900 -0.744000 -0.320000 0.576000 +0.538800 0.200800 0.060900 -0.824000 -0.216000 0.520000 +0.550000 0.150600 0.048400 -0.632000 -0.416000 0.640000 +0.500000 0.200800 0.008600 -0.576000 -0.176000 0.792000 +0.510200 0.150600 0.000000 -0.752000 -0.384000 0.520000 +0.500000 0.181600 0.000000 -0.600000 -0.304000 0.728000 +0.500000 0.150600 -0.020200 -0.704000 -0.472000 0.520000 +0.488800 0.200800 0.000000 -0.512000 0.024000 0.856000 +0.460500 0.150600 -0.060900 -0.624000 -0.512000 0.584000 +0.450000 0.200800 -0.035500 -0.536000 -0.264000 0.792000 +0.450000 0.163500 -0.060900 -0.600000 -0.504000 0.608000 +0.416500 0.200800 -0.060900 -0.560000 -0.352000 0.744000 +0.450000 0.150600 -0.075000 -0.616000 -0.488000 0.608000 +0.400000 0.200800 -0.077800 -0.600000 -0.432000 0.664000 +0.401900 0.150600 -0.121900 -0.864000 -0.496000 -0.024000 +0.400000 0.152400 -0.121900 -0.688000 -0.712000 -0.048000 +0.407800 0.150600 -0.182900 -0.544000 -0.240000 -0.800000 +0.400000 0.155900 -0.182900 -0.216000 -0.144000 -0.960000 +0.450000 0.150600 -0.187200 -0.088000 0.168000 -0.976000 +0.400000 0.200800 -0.189400 -0.152000 -0.072000 -0.984000 +0.450000 0.200800 -0.192400 -0.128000 -0.040000 -0.984000 +0.400000 0.251000 -0.186400 -0.152000 0.040000 -0.984000 +0.450000 0.251000 -0.188200 -0.104000 0.040000 -0.992000 +0.400000 0.301200 -0.184200 -0.016000 -0.016000 -0.992000 +0.450000 0.301200 -0.186200 0.000000 -0.016000 -0.992000 +0.400000 0.351500 -0.194500 0.000000 0.072000 -0.992000 +0.450000 0.351500 -0.196000 0.120000 0.128000 -0.976000 +0.400000 0.377300 -0.182900 0.016000 0.320000 -0.944000 +0.450000 0.373800 -0.182900 0.104000 0.432000 -0.888000 +0.400000 0.401700 -0.171200 0.088000 0.472000 -0.872000 +0.450000 0.401700 -0.160800 0.376000 0.656000 -0.640000 +0.400000 0.432800 -0.121900 0.160000 0.904000 -0.384000 +0.450000 0.422200 -0.121900 0.368000 0.832000 -0.392000 +0.400000 0.419800 -0.060900 0.080000 0.848000 0.520000 +0.450000 0.414500 -0.060900 0.192000 0.928000 0.304000 +0.400000 0.401700 -0.034800 -0.040000 0.584000 0.808000 +0.450000 0.401700 -0.038900 -0.120000 0.592000 0.784000 +0.400000 0.351500 -0.018700 -0.136000 -0.208000 0.960000 +0.450000 0.351500 -0.003200 -0.296000 0.344000 0.888000 +0.450000 0.401700 -0.038900 -0.120000 0.592000 0.784000 +0.458200 0.351500 0.000000 -0.280000 0.520000 0.800000 +0.500000 0.401700 -0.057700 0.096000 0.864000 0.480000 +0.500000 0.369100 0.000000 -0.184000 0.800000 0.552000 +0.517100 0.401700 -0.060900 0.080000 0.968000 0.224000 +0.550000 0.388900 0.000000 -0.392000 0.856000 0.320000 +0.550000 0.398000 -0.060900 0.000000 0.968000 -0.216000 +0.517100 0.401700 -0.060900 0.080000 0.968000 0.224000 +0.550000 0.362300 -0.121900 0.400000 0.656000 -0.632000 +0.500000 0.401700 -0.069300 0.168000 0.952000 -0.216000 +0.500000 0.393600 -0.121900 0.504000 0.744000 -0.432000 +0.488600 0.401700 -0.121900 0.504000 0.776000 -0.368000 +0.500000 0.355500 -0.182900 0.400000 0.616000 -0.664000 +0.450000 0.401700 -0.160800 0.376000 0.656000 -0.640000 +0.450000 0.373800 -0.182900 0.104000 0.432000 -0.888000 +0.500000 0.355500 -0.182900 0.400000 0.616000 -0.664000 +0.450000 0.351500 -0.196000 0.120000 0.128000 -0.976000 +0.500000 0.351500 -0.187300 0.416000 0.568000 -0.696000 +0.450000 0.301200 -0.186200 0.000000 -0.016000 -0.992000 +0.500000 0.301200 -0.193500 0.168000 0.072000 -0.976000 +0.450000 0.251000 -0.188200 -0.104000 0.040000 -0.992000 +0.500000 0.251000 -0.199400 0.072000 0.096000 -0.984000 +0.450000 0.200800 -0.192400 -0.128000 -0.040000 -0.984000 +0.500000 0.200800 -0.200200 -0.104000 -0.048000 -0.992000 +0.450000 0.150600 -0.187200 -0.088000 0.168000 -0.976000 +0.500000 0.150600 -0.194400 -0.208000 0.240000 -0.944000 +0.450000 0.100400 -0.233000 -0.008000 0.816000 -0.568000 +0.500000 0.100400 -0.210700 0.048000 0.704000 -0.704000 +0.450000 0.095300 -0.243900 -0.008000 0.856000 -0.512000 +0.500000 0.082500 -0.243900 0.216000 0.832000 -0.504000 +0.450000 0.055500 -0.304800 0.064000 0.864000 -0.496000 +0.500000 0.050200 -0.303800 0.264000 0.816000 -0.504000 +0.496000 0.050200 -0.304800 0.104000 0.800000 -0.576000 +0.500000 0.049600 -0.304800 0.264000 0.736000 -0.616000 +0.450000 0.050200 -0.314200 0.064000 0.744000 -0.656000 +0.500000 0.014000 -0.365800 0.216000 0.784000 -0.568000 +0.450000 0.007700 -0.365800 -0.264000 0.744000 -0.600000 +0.500000 0.000000 -0.393700 0.528000 0.072000 -0.840000 +0.450000 0.000000 -0.377000 -0.360000 0.400000 -0.840000 +0.500000 -0.027200 -0.365800 0.264000 -0.576000 -0.768000 +0.450000 -0.014200 -0.365800 -0.336000 -0.568000 -0.744000 +0.500000 -0.050200 -0.339600 -0.136000 -0.672000 -0.720000 +0.450000 -0.050200 -0.325200 -0.120000 -0.568000 -0.808000 +0.450000 -0.014200 -0.365800 -0.336000 -0.568000 -0.744000 +0.400000 -0.050200 -0.360800 0.184000 -0.432000 -0.872000 +0.431500 0.000000 -0.365800 -0.424000 0.312000 -0.840000 +0.400000 0.000000 -0.343200 -0.216000 0.592000 -0.768000 +0.450000 0.007700 -0.365800 -0.264000 0.744000 -0.600000 +0.400000 0.041200 -0.304800 -0.352000 0.672000 -0.648000 +0.450000 0.050200 -0.314200 0.064000 0.744000 -0.656000 +0.419200 0.050200 -0.304800 -0.224000 0.736000 -0.632000 +0.450000 0.055500 -0.304800 0.064000 0.864000 -0.496000 +0.400000 0.050200 -0.294000 -0.352000 0.672000 -0.640000 +0.450000 0.095300 -0.243900 -0.008000 0.856000 -0.512000 +0.400000 0.083700 -0.243900 -0.328000 0.768000 -0.536000 +0.450000 0.100400 -0.233000 -0.008000 0.816000 -0.568000 +0.400000 0.100400 -0.207800 -0.424000 0.688000 -0.576000 +0.450000 0.150600 -0.187200 -0.088000 0.168000 -0.976000 +0.400000 0.146600 -0.182900 -0.440000 0.464000 -0.760000 +0.407800 0.150600 -0.182900 -0.544000 -0.240000 -0.800000 +0.400000 0.100400 -0.150800 -0.768000 0.376000 0.512000 +0.401900 0.150600 -0.121900 -0.864000 -0.496000 -0.024000 +0.415000 0.100400 -0.121900 -0.640000 0.192000 0.736000 +0.450000 0.150600 -0.075000 -0.616000 -0.488000 0.608000 +0.450000 0.100400 -0.090700 -0.384000 -0.320000 0.856000 +0.460500 0.150600 -0.060900 -0.624000 -0.512000 0.584000 +0.500000 0.100400 -0.067100 -0.632000 -0.296000 0.704000 +0.500000 0.107000 -0.060900 -0.608000 -0.480000 0.616000 +0.504600 0.100400 -0.060900 -0.704000 -0.248000 0.656000 +0.500000 0.150600 -0.020200 -0.704000 -0.472000 0.520000 +0.550000 0.100400 -0.005700 -0.672000 -0.576000 0.448000 +0.510200 0.150600 0.000000 -0.752000 -0.384000 0.520000 +0.550000 0.104000 0.000000 -0.664000 -0.568000 0.464000 +0.550000 0.150600 0.048400 -0.632000 -0.416000 0.640000 +0.553100 0.100400 0.000000 -0.664000 -0.576000 0.464000 +0.560700 0.150600 0.060900 -0.704000 -0.368000 0.592000 +0.593200 0.100400 0.060900 -0.640000 -0.584000 0.496000 +0.591100 0.150600 0.121900 -0.792000 -0.400000 0.440000 +0.600000 0.100400 0.071800 -0.648000 -0.592000 0.472000 +0.600000 0.134700 0.121900 -0.776000 -0.456000 0.424000 +0.627900 0.100400 0.121900 -0.608000 -0.608000 0.504000 +0.600000 0.100400 0.071800 -0.648000 -0.592000 0.472000 +0.650000 0.080100 0.121900 -0.576000 -0.640000 0.496000 +0.600000 0.093600 0.060900 -0.624000 -0.616000 0.464000 +0.650000 0.050200 0.073400 -0.576000 -0.624000 0.512000 +0.641200 0.050200 0.060900 -0.600000 -0.608000 0.512000 +0.650000 0.041800 0.060900 -0.568000 -0.648000 0.504000 +0.602900 0.050200 0.000000 -0.576000 -0.704000 0.400000 +0.650000 0.013100 0.000000 -0.448000 -0.792000 0.392000 +0.600000 0.050200 -0.005300 -0.440000 -0.752000 0.480000 +0.650000 0.000000 -0.040500 0.104000 -0.944000 0.296000 +0.600000 0.000000 -0.044900 -0.016000 -0.720000 0.688000 +0.650000 -0.010200 -0.060900 0.168000 -0.784000 0.592000 +0.600000 -0.012300 -0.060900 0.104000 -0.576000 0.800000 +0.650000 -0.033500 -0.121900 0.512000 -0.672000 0.520000 +0.600000 -0.050200 -0.088500 0.448000 -0.400000 0.792000 +0.638000 -0.050200 -0.121900 0.800000 -0.536000 0.256000 +0.600000 -0.100400 -0.077400 0.584000 0.048000 0.800000 +0.626600 -0.100400 -0.121900 0.848000 0.208000 0.472000 +0.638000 -0.050200 -0.121900 0.800000 -0.536000 0.256000 +0.638900 -0.100400 -0.182900 0.920000 0.368000 0.072000 +0.649100 -0.050200 -0.182900 0.816000 -0.544000 0.144000 +0.637300 -0.100400 -0.243900 0.848000 0.016000 -0.520000 +0.637200 -0.050200 -0.243900 0.840000 -0.080000 -0.528000 +0.604900 -0.100400 -0.304800 0.744000 -0.360000 -0.552000 +0.600000 -0.050200 -0.286000 0.712000 0.144000 -0.680000 +0.600000 -0.086300 -0.304800 0.440000 0.312000 -0.832000 +0.587300 -0.050200 -0.304800 0.688000 0.056000 -0.712000 +0.589400 -0.100400 -0.304800 -0.440000 -0.424000 -0.784000 +0.550000 -0.083700 -0.304800 0.088000 -0.736000 -0.664000 +0.550000 -0.100400 -0.280800 -0.008000 -0.528000 -0.840000 +0.500000 -0.082600 -0.304800 0.216000 -0.680000 -0.688000 +0.500000 -0.100400 -0.277800 0.560000 -0.104000 -0.816000 +0.475800 -0.100400 -0.304800 0.512000 -0.104000 -0.848000 +0.500000 -0.127100 -0.304800 0.480000 0.456000 -0.744000 +0.500000 -0.100400 -0.277800 0.560000 -0.104000 -0.816000 +0.523400 -0.150600 -0.304800 0.376000 0.592000 -0.704000 +0.550000 -0.100400 -0.280800 -0.008000 -0.528000 -0.840000 +0.550000 -0.150600 -0.287800 0.352000 0.528000 -0.768000 +0.589400 -0.100400 -0.304800 -0.440000 -0.424000 -0.784000 +0.600000 -0.150600 -0.265200 0.248000 0.032000 -0.960000 +0.600000 -0.105700 -0.304800 0.312000 -0.728000 -0.600000 +0.650000 -0.150600 -0.274900 0.544000 0.464000 -0.688000 +0.604900 -0.100400 -0.304800 0.744000 -0.360000 -0.552000 +0.650000 -0.120200 -0.243900 0.704000 0.520000 -0.472000 +0.637300 -0.100400 -0.243900 0.848000 0.016000 -0.520000 +0.650000 -0.117900 -0.182900 0.792000 0.600000 0.024000 +0.638900 -0.100400 -0.182900 0.920000 0.368000 0.072000 +0.650000 -0.146100 -0.121900 0.720000 0.504000 0.464000 +0.626600 -0.100400 -0.121900 0.848000 0.208000 0.472000 +0.626600 -0.100400 -0.121900 0.848000 0.208000 0.472000 +0.591100 0.150600 0.121900 -0.792000 -0.400000 0.440000 +0.591100 0.150600 0.121900 -0.792000 -0.400000 0.440000 +0.600000 0.150600 0.141200 -0.712000 -0.440000 0.536000 +0.600000 0.134700 0.121900 -0.776000 -0.456000 0.424000 +0.600000 0.134700 0.121900 -0.776000 -0.456000 0.424000 +0.650000 0.141000 0.182900 -0.512000 -0.488000 0.704000 +0.650000 0.141000 0.182900 -0.512000 -0.488000 0.704000 +0.685300 0.100400 0.182900 -0.504000 -0.560000 0.648000 +0.650000 0.100400 0.150000 -0.536000 -0.592000 0.592000 +0.650000 0.100400 0.150000 -0.536000 -0.592000 0.592000 +0.692100 0.050200 0.121900 -0.432000 -0.784000 0.424000 +0.692100 0.050200 0.121900 -0.432000 -0.784000 0.424000 +0.700000 0.050200 0.131500 -0.112000 -0.824000 0.544000 +0.700000 0.046100 0.121900 -0.152000 -0.904000 0.376000 +0.744700 0.050200 0.121900 0.096000 -0.864000 0.480000 +0.700000 0.026800 0.060900 -0.288000 -0.896000 0.328000 +0.750000 0.050200 0.120200 -0.160000 -0.904000 0.376000 +0.750000 0.031700 0.060900 -0.136000 -0.928000 0.336000 +0.700000 0.026800 0.060900 -0.288000 -0.896000 0.328000 +0.750000 0.013300 0.000000 -0.240000 -0.936000 0.240000 +0.700000 0.012000 0.000000 -0.032000 -0.960000 0.272000 +0.750000 0.001600 -0.060900 -0.416000 -0.904000 -0.016000 +0.700000 0.001400 -0.060900 0.088000 -0.968000 0.192000 +0.750000 0.004300 -0.121900 -0.408000 -0.880000 -0.216000 +0.700000 0.000400 -0.121900 0.224000 -0.968000 0.032000 +0.750000 0.019900 -0.182900 -0.176000 -0.792000 -0.576000 +0.700000 0.009000 -0.182900 0.456000 -0.744000 -0.472000 +0.750000 0.050200 -0.223600 -0.168000 -0.552000 -0.808000 +0.700000 0.050200 -0.225700 0.368000 -0.368000 -0.848000 +0.750000 0.100400 -0.218500 0.200000 0.232000 -0.944000 +0.700000 0.100400 -0.234000 0.272000 0.000000 -0.960000 +0.750000 0.150600 -0.191500 0.256000 0.656000 -0.704000 +0.700000 0.150600 -0.210500 0.296000 0.424000 -0.848000 +0.750000 0.157000 -0.182900 0.280000 0.720000 -0.624000 +0.700000 0.190400 -0.182900 0.432000 0.560000 -0.696000 +0.750000 0.186400 -0.121900 0.504000 0.648000 -0.560000 +0.700000 0.200800 -0.171600 0.480000 0.608000 -0.616000 +0.734900 0.200800 -0.121900 0.552000 0.608000 -0.552000 +0.700000 0.229200 -0.121900 0.528000 0.656000 -0.528000 +0.750000 0.200800 -0.104400 0.480000 0.680000 -0.544000 +0.700000 0.251000 -0.093200 0.552000 0.600000 -0.568000 +0.750000 0.228900 -0.060900 0.576000 0.696000 -0.416000 +0.725300 0.251000 -0.060900 0.696000 0.648000 -0.288000 +0.750000 0.219200 0.000000 0.672000 0.728000 0.080000 +0.721000 0.251000 0.000000 0.784000 0.608000 -0.040000 +0.750000 0.222200 0.060900 0.704000 0.696000 -0.080000 +0.727500 0.251000 0.060900 0.792000 0.584000 -0.112000 +0.750000 0.233400 0.121900 0.720000 0.680000 -0.080000 +0.736800 0.251000 0.121900 0.752000 0.632000 0.144000 +0.727500 0.251000 0.060900 0.792000 0.584000 -0.112000 +0.700000 0.297800 0.121900 0.728000 0.680000 -0.032000 +0.700000 0.290800 0.060900 0.800000 0.576000 -0.104000 +0.696500 0.301200 0.121900 0.712000 0.672000 0.168000 +0.692400 0.301200 0.060900 0.752000 0.648000 -0.056000 +0.653800 0.351500 0.121900 0.656000 0.616000 0.424000 +0.663900 0.351500 0.060900 0.768000 0.624000 0.096000 +0.650000 0.355500 0.121900 0.632000 0.632000 0.432000 +0.650000 0.370100 0.060900 0.776000 0.624000 0.048000 +0.600000 0.382600 0.121900 0.272000 0.776000 0.560000 +0.612200 0.401700 0.060900 0.488000 0.832000 0.224000 +0.600000 0.401700 0.085900 0.096000 0.928000 0.336000 +0.600000 0.407100 0.060900 0.120000 0.968000 0.184000 +0.584600 0.401700 0.060900 -0.416000 0.872000 0.248000 +0.600000 0.410900 0.000000 0.104000 0.992000 -0.032000 +0.568400 0.401700 0.000000 -0.472000 0.832000 -0.264000 +0.600000 0.401700 -0.057700 0.168000 0.920000 -0.344000 +0.600000 0.410900 0.000000 0.104000 0.992000 -0.032000 +0.616700 0.401700 0.000000 0.496000 0.864000 -0.032000 +0.600000 0.407100 0.060900 0.120000 0.968000 0.184000 +0.612200 0.401700 0.060900 0.488000 0.832000 0.224000 +0.616700 0.401700 0.000000 0.496000 0.864000 -0.032000 +0.650000 0.370100 0.060900 0.776000 0.624000 0.048000 +0.650000 0.368200 0.000000 0.792000 0.584000 -0.144000 +0.663900 0.351500 0.060900 0.768000 0.624000 0.096000 +0.660900 0.351500 0.000000 0.832000 0.512000 -0.176000 +0.692400 0.301200 0.060900 0.752000 0.648000 -0.056000 +0.685300 0.301200 0.000000 0.832000 0.536000 -0.104000 +0.700000 0.290800 0.060900 0.800000 0.576000 -0.104000 +0.700000 0.279600 0.000000 0.792000 0.600000 -0.048000 +0.727500 0.251000 0.060900 0.792000 0.584000 -0.112000 +0.721000 0.251000 0.000000 0.784000 0.608000 -0.040000 +0.700000 0.279600 0.000000 0.792000 0.600000 -0.048000 +0.725300 0.251000 -0.060900 0.696000 0.648000 -0.288000 +0.700000 0.278700 -0.060900 0.648000 0.584000 -0.472000 +0.700000 0.251000 -0.093200 0.552000 0.600000 -0.568000 +0.680100 0.301200 -0.060900 0.752000 0.544000 -0.368000 +0.673000 0.251000 -0.121900 0.568000 0.576000 -0.584000 +0.650000 0.301200 -0.100800 0.528000 0.504000 -0.672000 +0.650000 0.278000 -0.121900 0.448000 0.624000 -0.624000 +0.608400 0.301200 -0.121900 0.448000 0.488000 -0.744000 +0.650000 0.251000 -0.154700 0.488000 0.640000 -0.584000 +0.600000 0.301200 -0.128700 0.472000 0.520000 -0.704000 +0.608400 0.251000 -0.182900 0.328000 0.488000 -0.800000 +0.600000 0.256700 -0.182900 0.328000 0.496000 -0.792000 +0.600000 0.251000 -0.187000 0.320000 0.456000 -0.816000 +0.608400 0.251000 -0.182900 0.328000 0.488000 -0.800000 +0.600000 0.200800 -0.209200 0.248000 0.288000 -0.920000 +0.650000 0.227800 -0.182900 0.368000 0.576000 -0.720000 +0.650000 0.200800 -0.204000 0.272000 0.408000 -0.864000 +0.687200 0.200800 -0.182900 0.432000 0.544000 -0.712000 +0.650000 0.150600 -0.219600 0.200000 0.280000 -0.928000 +0.700000 0.190400 -0.182900 0.432000 0.560000 -0.696000 +0.700000 0.150600 -0.210500 0.296000 0.424000 -0.848000 +0.650000 0.150600 -0.219600 0.200000 0.280000 -0.928000 +0.700000 0.100400 -0.234000 0.272000 0.000000 -0.960000 +0.650000 0.100400 -0.241400 0.232000 0.064000 -0.968000 +0.700000 0.050200 -0.225700 0.368000 -0.368000 -0.848000 +0.650000 0.067400 -0.243900 0.208000 0.056000 -0.968000 +0.653800 0.050200 -0.243900 0.232000 0.032000 -0.968000 +0.650000 0.050200 -0.244900 0.216000 0.040000 -0.968000 +0.653800 0.000000 -0.243900 0.576000 -0.112000 -0.808000 +0.650000 0.000000 -0.248500 0.680000 -0.160000 -0.712000 +0.650000 -0.016900 -0.243900 0.704000 -0.184000 -0.672000 +0.600000 0.000000 -0.284600 0.512000 0.112000 -0.840000 +0.637200 -0.050200 -0.243900 0.840000 -0.080000 -0.528000 +0.600000 -0.050200 -0.286000 0.712000 0.144000 -0.680000 +0.600000 0.000000 -0.284600 0.512000 0.112000 -0.840000 +0.587300 -0.050200 -0.304800 0.688000 0.056000 -0.712000 +0.578400 0.000000 -0.304800 0.536000 0.480000 -0.688000 +0.578400 0.000000 -0.304800 0.536000 0.480000 -0.688000 +0.750000 0.062100 0.182900 -0.416000 -0.632000 0.648000 +0.750000 0.062100 0.182900 -0.416000 -0.632000 0.648000 +0.750000 0.050900 0.121900 0.096000 -0.792000 0.600000 +0.762700 0.050200 0.182900 -0.512000 -0.672000 0.520000 +0.751700 0.050200 0.121900 -0.392000 -0.816000 0.416000 +0.800000 0.035400 0.182900 -0.432000 -0.808000 0.384000 +0.800000 0.028400 0.121900 -0.376000 -0.808000 0.432000 +0.846600 0.000000 0.182900 -0.736000 -0.616000 0.264000 +0.829700 0.000000 0.121900 -0.704000 -0.616000 0.344000 +0.850000 -0.004200 0.182900 -0.720000 -0.616000 0.288000 +0.850000 -0.029600 0.121900 -0.840000 -0.432000 0.312000 +0.880500 -0.050200 0.182900 -0.744000 -0.528000 0.384000 +0.857500 -0.050200 0.121900 -0.848000 -0.448000 0.272000 +0.900000 -0.076800 0.182900 -0.504000 -0.624000 0.592000 +0.892500 -0.100400 0.121900 -0.688000 -0.680000 0.240000 +0.900000 -0.100400 0.145900 -0.608000 -0.728000 0.304000 +0.900000 -0.076800 0.182900 -0.504000 -0.624000 0.592000 +0.934300 -0.100400 0.182900 -0.392000 -0.752000 0.520000 +0.934300 -0.100400 0.182900 -0.392000 -0.752000 0.520000 +0.800000 0.150600 0.181400 0.520000 0.336000 0.776000 +0.800000 0.150600 0.181400 0.520000 0.336000 0.776000 +0.850000 0.150600 0.126500 0.640000 0.560000 0.512000 +0.800000 0.190400 0.121900 0.624000 0.752000 0.168000 +0.850000 0.151600 0.121900 0.680000 0.720000 0.080000 +0.800000 0.182100 0.060900 0.560000 0.824000 -0.024000 +0.850000 0.154700 0.060900 0.576000 0.800000 0.096000 +0.800000 0.184600 0.000000 0.464000 0.872000 0.120000 +0.850000 0.161100 0.000000 0.480000 0.856000 0.160000 +0.800000 0.194300 -0.060900 0.416000 0.824000 -0.360000 +0.850000 0.171300 -0.060900 0.448000 0.864000 -0.216000 +0.800000 0.164900 -0.121900 0.312000 0.800000 -0.504000 +0.850000 0.155600 -0.121900 0.432000 0.856000 -0.272000 +0.800000 0.150600 -0.164100 0.256000 0.800000 -0.528000 +0.850000 0.150600 -0.140900 0.432000 0.840000 -0.304000 +0.800000 0.138600 -0.182900 0.232000 0.712000 -0.656000 +0.850000 0.127100 -0.182900 0.192000 0.744000 -0.632000 +0.800000 0.100400 -0.216300 0.104000 0.416000 -0.896000 +0.850000 0.100400 -0.218500 0.128000 0.592000 -0.784000 +0.800000 0.050200 -0.233400 -0.176000 0.416000 -0.880000 +0.850000 0.050200 -0.237100 -0.376000 0.576000 -0.720000 +0.800000 0.000000 -0.217200 -0.656000 -0.464000 -0.584000 +0.850000 0.042400 -0.243900 -0.408000 0.528000 -0.736000 +0.819700 0.000000 -0.243900 -0.752000 -0.192000 -0.616000 +0.850000 0.000000 -0.279000 -0.536000 0.488000 -0.680000 +0.835300 -0.050200 -0.243900 -0.840000 -0.416000 -0.336000 +0.850000 -0.050200 -0.276700 -0.784000 -0.280000 -0.544000 +0.850000 -0.077200 -0.243900 -0.824000 -0.432000 -0.344000 +0.835300 -0.050200 -0.243900 -0.840000 -0.416000 -0.336000 +0.850000 -0.086900 -0.182900 -0.848000 -0.512000 -0.048000 +0.822900 -0.050200 -0.182900 -0.792000 -0.592000 -0.088000 +0.850000 -0.088400 -0.121900 -0.808000 -0.584000 0.016000 +0.818400 -0.050200 -0.121900 -0.760000 -0.640000 0.016000 +0.850000 -0.079400 -0.060900 -0.768000 -0.616000 0.120000 +0.823600 -0.050200 -0.060900 -0.736000 -0.664000 0.112000 +0.850000 -0.068700 0.000000 -0.752000 -0.640000 0.136000 +0.832800 -0.050200 0.000000 -0.728000 -0.656000 0.144000 +0.850000 -0.056700 0.060900 -0.720000 -0.664000 0.176000 +0.843600 -0.050200 0.060900 -0.704000 -0.672000 0.184000 +0.850000 -0.050200 0.089500 -0.768000 -0.592000 0.216000 +0.850000 -0.050200 0.089500 -0.768000 -0.592000 0.216000 +0.850000 0.150600 0.126500 0.640000 0.560000 0.512000 +0.850000 0.150600 0.126500 0.640000 0.560000 0.512000 +0.850000 0.151600 0.121900 0.680000 0.720000 0.080000 +0.850900 0.150600 0.121900 0.704000 0.704000 0.080000 +0.850000 0.154700 0.060900 0.576000 0.800000 0.096000 +0.855400 0.150600 0.060900 0.680000 0.720000 0.072000 +0.850000 0.161100 0.000000 0.480000 0.856000 0.160000 +0.867700 0.150600 0.000000 0.552000 0.816000 0.152000 +0.850000 0.171300 -0.060900 0.448000 0.864000 -0.216000 +0.888500 0.150600 -0.060900 0.504000 0.856000 -0.040000 +0.850000 0.155600 -0.121900 0.432000 0.856000 -0.272000 +0.859300 0.150600 -0.121900 0.456000 0.840000 -0.272000 +0.850000 0.150600 -0.140900 0.432000 0.840000 -0.304000 +0.850000 0.150600 -0.140900 0.432000 0.840000 -0.304000 +0.891700 0.100400 0.182900 0.576000 0.688000 0.424000 +0.891700 0.100400 0.182900 0.576000 0.688000 0.424000 +0.900000 0.100400 0.165200 0.584000 0.744000 0.296000 +0.900000 0.093100 0.182900 0.568000 0.672000 0.464000 +0.911800 0.100400 0.121900 0.528000 0.800000 0.264000 +0.940200 0.050200 0.182900 0.624000 0.528000 0.568000 +0.950000 0.069700 0.121900 0.360000 0.840000 0.384000 +0.950000 0.050200 0.169400 0.600000 0.560000 0.560000 +1.000000 0.053600 0.121900 0.280000 0.872000 0.392000 +1.000000 0.050200 0.131000 0.336000 0.784000 0.512000 +0.950000 0.050200 0.169400 0.600000 0.560000 0.560000 +1.000000 0.004900 0.182900 0.336000 0.520000 0.776000 +0.950000 0.037400 0.182900 0.520000 0.504000 0.680000 +0.950000 0.050200 0.169400 0.600000 0.560000 0.560000 +0.940200 0.050200 0.182900 0.624000 0.528000 0.568000 +0.940200 0.050200 0.182900 0.624000 0.528000 0.568000 +0.900000 0.100400 0.165200 0.584000 0.744000 0.296000 +0.900000 0.100400 0.165200 0.584000 0.744000 0.296000 +0.900000 0.107300 0.121900 0.512000 0.832000 0.184000 +0.911800 0.100400 0.121900 0.528000 0.800000 0.264000 +0.900000 0.118900 0.060900 0.472000 0.856000 0.184000 +0.936800 0.100400 0.060900 0.456000 0.872000 0.168000 +0.900000 0.131100 0.000000 0.480000 0.848000 0.192000 +0.950000 0.100400 0.012800 0.496000 0.848000 0.136000 +0.950000 0.102000 0.000000 0.472000 0.864000 0.120000 +0.952900 0.100400 0.000000 0.504000 0.848000 0.120000 +0.950000 0.106300 -0.060900 0.576000 0.776000 -0.240000 +0.957800 0.100400 -0.060900 0.544000 0.824000 -0.120000 +0.950000 0.100400 -0.078300 0.560000 0.768000 -0.304000 +1.000000 0.074600 -0.060900 0.496000 0.816000 -0.280000 +0.950000 0.086300 -0.121900 0.544000 0.784000 -0.280000 +1.000000 0.056100 -0.121900 0.488000 0.808000 -0.304000 +0.950000 0.069900 -0.182900 0.544000 0.736000 -0.392000 +1.000000 0.050200 -0.141200 0.512000 0.792000 -0.320000 +0.978000 0.050200 -0.182900 0.512000 0.768000 -0.376000 +1.000000 0.035800 -0.182900 0.504000 0.768000 -0.376000 +0.950000 0.050200 -0.224500 0.472000 0.712000 -0.504000 +1.000000 0.004200 -0.243900 0.464000 0.680000 -0.552000 +0.950000 0.037500 -0.243900 0.432000 0.688000 -0.576000 +1.000000 0.000000 -0.249700 0.512000 0.464000 -0.720000 +0.950000 0.000000 -0.291100 0.424000 0.536000 -0.720000 +1.000000 -0.050200 -0.288900 0.520000 0.432000 -0.728000 +0.950000 -0.016600 -0.304800 0.448000 0.520000 -0.720000 +0.981700 -0.050200 -0.304800 0.528000 0.432000 -0.720000 +0.950000 -0.050200 -0.338500 0.440000 0.400000 -0.800000 +1.000000 -0.073100 -0.304800 0.536000 0.424000 -0.720000 +0.950000 -0.100400 -0.351000 0.336000 0.064000 -0.936000 +1.000000 -0.100400 -0.325200 0.488000 0.344000 -0.792000 +0.950000 -0.150600 -0.345500 -0.032000 0.064000 -0.992000 +1.000000 -0.150600 -0.335800 0.136000 0.136000 -0.976000 +0.950000 -0.200800 -0.357000 -0.272000 -0.104000 -0.952000 +1.000000 -0.200800 -0.338800 0.136000 -0.384000 -0.904000 +0.950000 -0.251000 -0.328200 -0.712000 -0.568000 -0.392000 +1.000000 -0.251000 -0.355700 -0.816000 -0.248000 -0.504000 +1.000000 -0.251000 -0.355700 -0.816000 -0.248000 -0.504000 +1.000000 -0.012000 0.182900 0.384000 -0.248000 0.880000 +1.000000 -0.012000 0.182900 0.384000 -0.248000 0.880000 +1.000000 -0.050200 0.168100 0.416000 -0.344000 0.832000 +0.975800 -0.050200 0.182900 0.464000 -0.232000 0.848000 +1.000000 -0.100400 0.134700 0.432000 -0.528000 0.720000 +0.959000 -0.100400 0.182900 0.616000 -0.584000 0.520000 +0.959000 -0.100400 0.182900 0.616000 -0.584000 0.520000 +-0.900000 0.200800 0.074800 0.296000 0.712000 0.624000 +-0.900000 0.200800 0.074800 0.296000 0.712000 0.624000 +-0.900000 0.210300 0.060900 0.312000 0.744000 0.576000 +-0.879600 0.200800 0.060900 0.352000 0.712000 0.600000 +-0.900000 0.240500 0.000000 0.368000 0.840000 0.376000 +-0.850000 0.200800 0.035600 0.384000 0.744000 0.536000 +-0.850000 0.219100 0.000000 0.368000 0.824000 0.424000 +-0.811000 0.200800 0.000000 0.408000 0.816000 0.392000 +-0.811000 0.200800 0.000000 0.408000 0.816000 0.392000 +-0.900000 -0.127600 0.121900 -0.608000 -0.704000 0.344000 +-0.900000 -0.127600 0.121900 -0.608000 -0.704000 0.344000 +-0.900000 -0.149700 0.060900 -0.696000 -0.664000 0.232000 +-0.878400 -0.150600 0.121900 -0.736000 -0.560000 0.368000 +-0.899200 -0.150600 0.060900 -0.816000 -0.504000 0.256000 +-0.851500 -0.200800 0.121900 -0.832000 -0.360000 0.408000 +-0.869300 -0.200800 0.060900 -0.824000 -0.496000 0.248000 +-0.899200 -0.150600 0.060900 -0.816000 -0.504000 0.256000 +-0.882700 -0.200800 0.000000 -0.840000 -0.496000 0.192000 +-0.900000 -0.150600 0.057700 -0.744000 -0.616000 0.232000 +-0.900000 -0.169600 0.000000 -0.800000 -0.552000 0.224000 +-0.882700 -0.200800 0.000000 -0.840000 -0.496000 0.192000 +-0.900000 -0.192500 -0.060900 -0.856000 -0.488000 0.144000 +-0.895700 -0.200800 -0.060900 -0.864000 -0.480000 0.136000 +-0.900000 -0.200800 -0.096200 -0.752000 -0.632000 0.128000 +-0.860100 -0.251000 -0.060900 -0.808000 -0.568000 0.112000 +-0.900000 -0.204500 -0.121900 -0.688000 -0.712000 0.104000 +-0.866600 -0.251000 -0.121900 -0.808000 -0.576000 0.072000 +-0.900000 -0.206900 -0.182900 -0.648000 -0.752000 0.056000 +-0.864200 -0.251000 -0.182900 -0.800000 -0.592000 0.000000 +-0.900000 -0.212400 -0.243900 -0.672000 -0.712000 0.176000 +-0.869200 -0.251000 -0.243900 -0.768000 -0.600000 0.200000 +-0.900000 -0.236500 -0.304800 -0.680000 -0.456000 -0.560000 +-0.891700 -0.251000 -0.304800 -0.808000 -0.512000 -0.264000 +-0.891700 -0.251000 -0.304800 -0.808000 -0.512000 -0.264000 +-0.850000 0.184100 0.060900 0.376000 0.632000 0.664000 +-0.850000 0.184100 0.060900 0.376000 0.632000 0.664000 +-0.850000 0.150600 0.098600 0.360000 0.600000 0.704000 +-0.800000 0.153700 0.060900 0.432000 0.632000 0.632000 +-0.800000 0.150600 0.064100 0.424000 0.560000 0.704000 +-0.796300 0.150600 0.060900 0.512000 0.584000 0.616000 +-0.800000 0.153700 0.060900 0.432000 0.632000 0.632000 +-0.750000 0.150600 0.014500 0.472000 0.624000 0.608000 +-0.800000 0.195100 0.000000 0.456000 0.768000 0.432000 +-0.750000 0.162200 0.000000 0.464000 0.672000 0.560000 +-0.750000 0.150600 0.014500 0.472000 0.624000 0.608000 +-0.734000 0.150600 0.000000 0.496000 0.640000 0.576000 +-0.750000 0.162200 0.000000 0.464000 0.672000 0.560000 +-0.700000 0.150600 -0.043600 0.552000 0.712000 0.424000 +-0.750000 0.191300 -0.060900 0.496000 0.856000 0.072000 +-0.700000 0.159000 -0.060900 0.600000 0.776000 0.184000 +-0.750000 0.174400 -0.121900 0.448000 0.824000 -0.336000 +-0.700000 0.150600 -0.089800 0.592000 0.744000 -0.280000 +-0.715000 0.150600 -0.121900 0.512000 0.744000 -0.408000 +-0.700000 0.140000 -0.121900 0.536000 0.728000 -0.408000 +-0.750000 0.150600 -0.159200 0.432000 0.664000 -0.600000 +-0.700000 0.100400 -0.182100 0.536000 0.592000 -0.592000 +-0.750000 0.132600 -0.182900 0.408000 0.656000 -0.624000 +-0.700900 0.100400 -0.182900 0.440000 0.608000 -0.648000 +-0.750000 0.100400 -0.222000 0.432000 0.576000 -0.680000 +-0.700000 0.099700 -0.182900 0.504000 0.560000 -0.640000 +-0.750000 0.077000 -0.243900 0.368000 0.552000 -0.744000 +-0.700000 0.050200 -0.235800 0.504000 0.432000 -0.744000 +-0.711800 0.050200 -0.243900 0.416000 0.432000 -0.792000 +-0.700000 0.037400 -0.243900 0.440000 0.392000 -0.800000 +-0.750000 0.050200 -0.267100 0.368000 0.432000 -0.816000 +-0.700000 0.000000 -0.262900 0.392000 0.288000 -0.864000 +-0.750000 0.000000 -0.285200 0.328000 0.160000 -0.920000 +-0.750000 0.000000 -0.285200 0.328000 0.160000 -0.920000 +-0.750000 0.012900 0.121900 0.496000 0.384000 0.768000 +-0.750000 0.012900 0.121900 0.496000 0.384000 0.768000 +-0.781300 0.050200 0.121900 0.536000 0.400000 0.736000 +-0.750000 0.050200 0.097600 0.464000 0.408000 0.776000 +-0.750000 0.050200 0.097600 0.464000 0.408000 0.776000 +-0.800000 -0.280700 0.121900 -0.736000 -0.528000 0.408000 +-0.800000 -0.280700 0.121900 -0.736000 -0.528000 0.408000 +-0.783300 -0.301200 0.121900 -0.688000 -0.568000 0.440000 +-0.800000 -0.301200 0.085900 -0.768000 -0.544000 0.304000 +-0.800000 -0.301200 0.085900 -0.768000 -0.544000 0.304000 +-0.750000 -0.342500 0.121900 -0.536000 -0.592000 0.592000 +-0.750000 -0.342500 0.121900 -0.536000 -0.592000 0.592000 +-0.739400 -0.351500 0.121900 -0.528000 -0.576000 0.616000 +-0.750000 -0.351500 0.110100 -0.600000 -0.584000 0.536000 +-0.750000 -0.351500 0.110100 -0.600000 -0.584000 0.536000 +-0.701000 -0.451900 0.060900 -0.792000 -0.480000 0.344000 +-0.701000 -0.451900 0.060900 -0.792000 -0.480000 0.344000 +-0.700000 -0.451900 0.063700 -0.672000 -0.600000 0.424000 +-0.700000 -0.453200 0.060900 -0.560000 -0.720000 0.392000 +-0.700000 -0.453200 0.060900 -0.560000 -0.720000 0.392000 +-0.650000 -0.141800 0.121900 0.432000 0.328000 0.832000 +-0.650000 -0.141800 0.121900 0.432000 0.328000 0.832000 +-0.677900 -0.100400 0.121900 0.528000 0.328000 0.776000 +-0.650000 -0.100400 0.096100 0.592000 0.288000 0.744000 +-0.650000 -0.100400 0.096100 0.592000 0.288000 0.744000 +-0.600000 -0.122400 0.060900 0.616000 0.400000 0.664000 +-0.600000 -0.122400 0.060900 0.616000 0.400000 0.664000 +-0.575700 -0.150600 0.060900 0.384000 0.664000 0.632000 +-0.600000 -0.150600 0.080700 0.576000 0.424000 0.688000 +-0.600000 -0.150600 0.080700 0.576000 0.424000 0.688000 +-0.559300 -0.200800 0.121900 0.160000 0.720000 0.672000 +-0.559300 -0.200800 0.121900 0.160000 0.720000 0.672000 +-0.550000 -0.200800 0.118700 0.032000 0.784000 0.608000 +-0.550000 -0.202900 0.121900 0.032000 0.728000 0.680000 +-0.536800 -0.200800 0.121900 -0.104000 0.736000 0.664000 +-0.536800 -0.200800 0.121900 -0.104000 0.736000 0.664000 +-0.550000 -0.494000 0.121900 0.024000 -0.832000 0.536000 +-0.550000 -0.494000 0.121900 0.024000 -0.832000 0.536000 +-0.550000 -0.502100 0.104800 0.104000 -0.840000 0.520000 +-0.500000 -0.486900 0.121900 0.296000 -0.800000 0.504000 +-0.500000 -0.502100 0.088800 0.616000 -0.688000 0.376000 +-0.450000 -0.453600 0.121900 0.584000 -0.744000 0.288000 +-0.489100 -0.502100 0.060900 0.704000 -0.616000 0.328000 +-0.450000 -0.471900 0.060900 0.592000 -0.752000 0.272000 +-0.450000 -0.471900 0.060900 0.592000 -0.752000 0.272000 +-0.550000 -0.502100 0.104800 0.104000 -0.840000 0.520000 +-0.550000 -0.502100 0.104800 0.104000 -0.840000 0.520000 +-0.550000 -0.532000 0.060900 0.080000 -0.776000 0.624000 +-0.500000 -0.502100 0.088800 0.616000 -0.688000 0.376000 +-0.500000 -0.517700 0.060900 0.632000 -0.632000 0.440000 +-0.489100 -0.502100 0.060900 0.704000 -0.616000 0.328000 +-0.489100 -0.502100 0.060900 0.704000 -0.616000 0.328000 +-0.405500 -0.100400 0.060900 -0.712000 0.456000 0.520000 +-0.405500 -0.100400 0.060900 -0.712000 0.456000 0.520000 +-0.400000 -0.090100 0.060900 -0.696000 0.400000 0.584000 +-0.400000 -0.100400 0.069600 -0.688000 0.456000 0.552000 +-0.367400 -0.050200 0.060900 -0.696000 0.408000 0.584000 +-0.351400 -0.100400 0.121900 -0.608000 0.368000 0.696000 +-0.350000 -0.050200 0.083200 -0.416000 0.344000 0.832000 +-0.350000 -0.097900 0.121900 -0.560000 0.424000 0.704000 +-0.300000 -0.050200 0.104800 -0.312000 0.512000 0.792000 +-0.300000 -0.066800 0.121900 -0.280000 0.584000 0.752000 +-0.255700 -0.050200 0.121900 -0.192000 0.512000 0.832000 +-0.255700 -0.050200 0.121900 -0.192000 0.512000 0.832000 +-0.350000 -0.001900 0.060900 -0.656000 0.280000 0.688000 +-0.350000 -0.001900 0.060900 -0.656000 0.280000 0.688000 +-0.350000 -0.050200 0.083200 -0.416000 0.344000 0.832000 +-0.367400 -0.050200 0.060900 -0.696000 0.408000 0.584000 +-0.367400 -0.050200 0.060900 -0.696000 0.408000 0.584000 +-0.351400 -0.100400 0.121900 -0.608000 0.368000 0.696000 +-0.351400 -0.100400 0.121900 -0.608000 0.368000 0.696000 +-0.400000 -0.140400 0.121900 -0.448000 0.624000 0.632000 +-0.400000 -0.100400 0.069600 -0.688000 0.456000 0.552000 +-0.400000 -0.100400 0.069600 -0.688000 0.456000 0.552000 +-0.400000 -0.401700 0.111300 0.640000 -0.680000 0.336000 +-0.400000 -0.401700 0.111300 0.640000 -0.680000 0.336000 +-0.400000 -0.423000 0.060900 0.616000 -0.696000 0.360000 +-0.350000 -0.401700 0.073400 0.632000 -0.688000 0.344000 +-0.350000 -0.406300 0.060900 0.592000 -0.728000 0.320000 +-0.344500 -0.401700 0.060900 0.632000 -0.688000 0.328000 +-0.344500 -0.401700 0.060900 0.632000 -0.688000 0.328000 +-0.348200 0.000000 0.060900 -0.376000 0.448000 0.800000 +-0.348200 0.000000 0.060900 -0.376000 0.448000 0.800000 +-0.300000 0.027200 0.060900 -0.160000 0.552000 0.808000 +-0.300000 0.000000 0.088800 -0.240000 0.432000 0.864000 +-0.250000 0.033500 0.060900 0.056000 0.528000 0.840000 +-0.250000 0.000000 0.079500 -0.144000 0.552000 0.816000 +-0.200000 0.020500 0.060900 0.664000 0.440000 0.600000 +-0.200000 0.000000 0.081400 0.696000 0.336000 0.624000 +-0.190300 0.000000 0.060900 0.816000 0.200000 0.536000 +-0.200000 -0.050200 0.072600 0.688000 0.360000 0.624000 +-0.193200 -0.050200 0.060900 0.808000 0.008000 0.584000 +-0.200000 -0.100400 0.076800 0.784000 -0.136000 0.600000 +-0.190200 -0.100400 0.060900 0.752000 -0.248000 0.600000 +-0.200000 -0.121800 0.060900 0.728000 -0.328000 0.592000 +-0.200000 -0.121800 0.060900 0.728000 -0.328000 0.592000 +-0.250000 0.000000 0.079500 -0.144000 0.552000 0.816000 +-0.250000 0.000000 0.079500 -0.144000 0.552000 0.816000 +-0.200000 0.000000 0.081400 0.696000 0.336000 0.624000 +-0.250000 -0.048000 0.121900 0.272000 0.640000 0.704000 +-0.200000 -0.050200 0.072600 0.688000 0.360000 0.624000 +-0.247100 -0.050200 0.121900 0.488000 0.512000 0.696000 +-0.200000 -0.100400 0.076800 0.784000 -0.136000 0.600000 +-0.230200 -0.100400 0.121900 0.776000 -0.176000 0.600000 +-0.230200 -0.100400 0.121900 0.776000 -0.176000 0.600000 +0.550000 0.351500 0.078000 -0.616000 0.672000 0.392000 +0.550000 0.351500 0.078000 -0.616000 0.672000 0.392000 +0.540600 0.351500 0.060900 -0.584000 0.632000 0.496000 +0.550000 0.359900 0.060900 -0.592000 0.640000 0.480000 +0.500000 0.351500 0.029100 -0.680000 0.048000 0.728000 +0.550000 0.388900 0.000000 -0.392000 0.856000 0.320000 +0.500000 0.369100 0.000000 -0.184000 0.800000 0.552000 +0.500000 0.351500 0.029100 -0.680000 0.048000 0.728000 +0.458200 0.351500 0.000000 -0.280000 0.520000 0.800000 +0.458200 0.351500 0.000000 -0.280000 0.520000 0.800000 +0.550000 0.246100 0.121900 -0.904000 -0.224000 0.352000 +0.550000 0.246100 0.121900 -0.904000 -0.224000 0.352000 +0.550000 0.200800 0.086900 -0.880000 -0.256000 0.392000 +0.548800 0.251000 0.121900 -0.912000 -0.176000 0.360000 +0.538800 0.200800 0.060900 -0.824000 -0.216000 0.520000 +0.533200 0.251000 0.060900 -0.856000 0.032000 0.512000 +0.500000 0.200800 0.008600 -0.576000 -0.176000 0.792000 +0.500800 0.251000 0.000000 -0.792000 -0.016000 0.608000 +0.500000 0.245700 0.000000 -0.568000 0.120000 0.808000 +0.500000 0.251000 -0.000900 -0.496000 0.112000 0.856000 +0.488800 0.200800 0.000000 -0.512000 0.024000 0.856000 +0.450000 0.251000 -0.039600 -0.400000 -0.080000 0.904000 +0.450000 0.200800 -0.035500 -0.536000 -0.264000 0.792000 +0.400000 0.251000 -0.058700 -0.328000 -0.176000 0.920000 +0.416500 0.200800 -0.060900 -0.560000 -0.352000 0.744000 +0.400000 0.242400 -0.060900 -0.352000 -0.192000 0.904000 +0.400000 0.200800 -0.077800 -0.600000 -0.432000 0.664000 +0.395100 0.251000 -0.060900 -0.344000 -0.184000 0.912000 +0.366500 0.200800 -0.121900 -0.760000 -0.624000 0.168000 +0.350000 0.251000 -0.088400 -0.448000 -0.320000 0.824000 +0.350000 0.218900 -0.121900 -0.504000 -0.816000 0.264000 +0.300000 0.251000 -0.114600 -0.168000 -0.536000 0.824000 +0.300000 0.236900 -0.121900 -0.304000 -0.688000 0.640000 +0.271900 0.251000 -0.121900 -0.240000 -0.760000 0.592000 +0.300000 0.251000 -0.156100 -0.368000 -0.808000 -0.448000 +0.300000 0.236900 -0.121900 -0.304000 -0.688000 0.640000 +0.321900 0.251000 -0.182900 -0.240000 -0.296000 -0.920000 +0.350000 0.218900 -0.121900 -0.504000 -0.816000 0.264000 +0.350000 0.236900 -0.182900 -0.272000 -0.424000 -0.856000 +0.366500 0.200800 -0.121900 -0.760000 -0.624000 0.168000 +0.380800 0.200800 -0.182900 -0.440000 -0.264000 -0.856000 +0.400000 0.152400 -0.121900 -0.688000 -0.712000 -0.048000 +0.400000 0.155900 -0.182900 -0.216000 -0.144000 -0.960000 +0.380800 0.200800 -0.182900 -0.440000 -0.264000 -0.856000 +0.400000 0.200800 -0.189400 -0.152000 -0.072000 -0.984000 +0.350000 0.236900 -0.182900 -0.272000 -0.424000 -0.856000 +0.400000 0.251000 -0.186400 -0.152000 0.040000 -0.984000 +0.350000 0.251000 -0.187300 -0.168000 -0.184000 -0.960000 +0.400000 0.301200 -0.184200 -0.016000 -0.016000 -0.992000 +0.350000 0.301200 -0.184400 -0.056000 0.000000 -0.992000 +0.400000 0.351500 -0.194500 0.000000 0.072000 -0.992000 +0.350000 0.351500 -0.192800 0.000000 0.056000 -0.992000 +0.400000 0.377300 -0.182900 0.016000 0.320000 -0.944000 +0.350000 0.377400 -0.182900 0.000000 0.280000 -0.952000 +0.400000 0.401700 -0.171200 0.088000 0.472000 -0.872000 +0.350000 0.401700 -0.174600 0.056000 0.440000 -0.888000 +0.400000 0.432800 -0.121900 0.160000 0.904000 -0.384000 +0.350000 0.445000 -0.121900 0.208000 0.960000 -0.152000 +0.400000 0.419800 -0.060900 0.080000 0.848000 0.520000 +0.350000 0.424300 -0.060900 0.120000 0.824000 0.544000 +0.400000 0.401700 -0.034800 -0.040000 0.584000 0.808000 +0.350000 0.401700 -0.031000 0.032000 0.488000 0.864000 +0.400000 0.351500 -0.018700 -0.136000 -0.208000 0.960000 +0.350000 0.351500 -0.021800 0.032000 -0.048000 0.992000 +0.350000 0.401700 -0.031000 0.032000 0.488000 0.864000 +0.300000 0.351500 -0.009100 -0.016000 -0.144000 0.984000 +0.300000 0.401700 -0.022200 0.096000 0.472000 0.864000 +0.350000 0.401700 -0.031000 0.032000 0.488000 0.864000 +0.300000 0.430700 -0.060900 0.128000 0.808000 0.568000 +0.350000 0.424300 -0.060900 0.120000 0.824000 0.544000 +0.300000 0.451900 -0.106900 0.184000 0.864000 0.456000 +0.350000 0.445000 -0.121900 0.208000 0.960000 -0.152000 +0.323400 0.451900 -0.121900 0.248000 0.944000 -0.200000 +0.350000 0.401700 -0.174600 0.056000 0.440000 -0.888000 +0.300000 0.451900 -0.131100 0.200000 0.712000 -0.664000 +0.300000 0.401700 -0.174800 0.040000 0.368000 -0.920000 +0.350000 0.401700 -0.174600 0.056000 0.440000 -0.888000 +0.300000 0.379400 -0.182900 -0.016000 0.272000 -0.960000 +0.350000 0.377400 -0.182900 0.000000 0.280000 -0.952000 +0.300000 0.351500 -0.193900 -0.008000 0.064000 -0.992000 +0.350000 0.351500 -0.192800 0.000000 0.056000 -0.992000 +0.300000 0.301200 -0.184400 -0.064000 -0.072000 -0.992000 +0.350000 0.301200 -0.184400 -0.056000 0.000000 -0.992000 +0.300000 0.284000 -0.182900 -0.168000 -0.184000 -0.960000 +0.350000 0.251000 -0.187300 -0.168000 -0.184000 -0.960000 +0.321900 0.251000 -0.182900 -0.240000 -0.296000 -0.920000 +0.350000 0.236900 -0.182900 -0.272000 -0.424000 -0.856000 +0.350000 0.236900 -0.182900 -0.272000 -0.424000 -0.856000 +0.550000 0.246100 0.121900 -0.904000 -0.224000 0.352000 +0.550000 0.246100 0.121900 -0.904000 -0.224000 0.352000 +0.567500 0.200800 0.121900 -0.784000 -0.344000 0.504000 +0.550000 0.200800 0.086900 -0.880000 -0.256000 0.392000 +0.550000 0.200800 0.086900 -0.880000 -0.256000 0.392000 +0.600000 0.100400 0.071800 -0.648000 -0.592000 0.472000 +0.600000 0.100400 0.071800 -0.648000 -0.592000 0.472000 +0.600000 0.093600 0.060900 -0.624000 -0.616000 0.464000 +0.593200 0.100400 0.060900 -0.640000 -0.584000 0.496000 +0.600000 0.053300 0.000000 -0.472000 -0.712000 0.512000 +0.553100 0.100400 0.000000 -0.664000 -0.576000 0.464000 +0.600000 0.050200 -0.005300 -0.440000 -0.752000 0.480000 +0.550000 0.100400 -0.005700 -0.672000 -0.576000 0.448000 +0.550000 0.050200 -0.037800 -0.320000 -0.688000 0.640000 +0.504600 0.100400 -0.060900 -0.704000 -0.248000 0.656000 +0.500000 0.050200 -0.057700 -0.560000 0.128000 0.816000 +0.500000 0.067400 -0.060900 -0.592000 0.120000 0.792000 +0.495100 0.050200 -0.060900 -0.456000 0.136000 0.872000 +0.500000 0.100400 -0.067100 -0.632000 -0.296000 0.704000 +0.450000 0.050200 -0.077000 -0.360000 0.120000 0.920000 +0.450000 0.100400 -0.090700 -0.384000 -0.320000 0.856000 +0.400000 0.050200 -0.114800 -0.552000 0.256000 0.784000 +0.415000 0.100400 -0.121900 -0.640000 0.192000 0.736000 +0.400000 0.072600 -0.121900 -0.632000 0.256000 0.720000 +0.400000 0.100400 -0.150800 -0.768000 0.376000 0.512000 +0.393200 0.050200 -0.121900 -0.648000 0.352000 0.664000 +0.381500 0.100400 -0.182900 -0.896000 0.440000 -0.008000 +0.357200 0.050200 -0.182900 -0.736000 0.640000 0.184000 +0.400000 0.100400 -0.207800 -0.424000 0.688000 -0.576000 +0.351400 0.050200 -0.243900 -0.480000 0.768000 -0.416000 +0.400000 0.083700 -0.243900 -0.328000 0.768000 -0.536000 +0.400000 0.050200 -0.294000 -0.352000 0.672000 -0.640000 +0.351400 0.050200 -0.243900 -0.480000 0.768000 -0.416000 +0.400000 0.041200 -0.304800 -0.352000 0.672000 -0.648000 +0.350000 0.049300 -0.243900 -0.512000 0.784000 -0.320000 +0.350000 0.024300 -0.304800 -0.456000 0.784000 -0.408000 +0.300000 0.032100 -0.243900 -0.576000 0.680000 -0.432000 +0.301400 0.000000 -0.304800 -0.584000 0.656000 -0.464000 +0.300000 0.000000 -0.302400 -0.544000 0.608000 -0.568000 +0.300000 -0.003100 -0.304800 -0.376000 0.424000 -0.816000 +0.301400 0.000000 -0.304800 -0.584000 0.656000 -0.464000 +0.300000 -0.050200 -0.319900 -0.536000 0.224000 -0.808000 +0.350000 0.000000 -0.339100 -0.264000 0.552000 -0.784000 +0.342100 -0.050200 -0.365800 -0.640000 -0.104000 -0.752000 +0.350000 -0.037900 -0.365800 -0.440000 0.432000 -0.776000 +0.350000 -0.050200 -0.374000 -0.496000 -0.096000 -0.856000 +0.383500 -0.050200 -0.365800 0.200000 -0.288000 -0.928000 +0.350000 -0.059800 -0.365800 -0.280000 -0.560000 -0.768000 +0.400000 -0.050200 -0.360800 0.184000 -0.432000 -0.872000 +0.350000 -0.100400 -0.331300 -0.432000 -0.520000 -0.728000 +0.400000 -0.100400 -0.340000 -0.040000 -0.360000 -0.928000 +0.350000 -0.127600 -0.304800 0.032000 -0.600000 -0.792000 +0.400000 -0.150600 -0.318400 -0.432000 -0.416000 -0.792000 +0.380400 -0.150600 -0.304800 -0.424000 -0.456000 -0.776000 +0.400000 -0.168700 -0.304800 -0.504000 -0.464000 -0.720000 +0.350000 -0.150600 -0.283600 -0.064000 -0.424000 -0.896000 +0.400000 -0.200800 -0.276700 0.448000 -0.472000 -0.752000 +0.350000 -0.200800 -0.271400 0.216000 0.224000 -0.944000 +0.400000 -0.249400 -0.243900 0.760000 -0.472000 -0.424000 +0.350000 -0.228300 -0.304800 0.616000 0.528000 -0.576000 +0.399000 -0.251000 -0.243900 0.912000 -0.008000 -0.392000 +0.366700 -0.251000 -0.304800 0.704000 0.488000 -0.496000 +0.350000 -0.228300 -0.304800 0.616000 0.528000 -0.576000 +0.350000 -0.251000 -0.329500 0.536000 0.472000 -0.688000 +0.320800 -0.200800 -0.304800 0.496000 0.328000 -0.800000 +0.300000 -0.251000 -0.347800 0.304000 0.384000 -0.864000 +0.300000 -0.200800 -0.324200 0.480000 0.248000 -0.832000 +0.320800 -0.200800 -0.304800 0.496000 0.328000 -0.800000 +0.300000 -0.150600 -0.312600 0.312000 -0.200000 -0.920000 +0.313400 -0.150600 -0.304800 0.400000 -0.360000 -0.840000 +0.300000 -0.100400 -0.310000 -0.248000 0.072000 -0.960000 +0.350000 -0.127600 -0.304800 0.032000 -0.600000 -0.792000 +0.350000 -0.100400 -0.331300 -0.432000 -0.520000 -0.728000 +0.300000 -0.100400 -0.310000 -0.248000 0.072000 -0.960000 +0.350000 -0.059800 -0.365800 -0.280000 -0.560000 -0.768000 +0.300000 -0.050200 -0.319900 -0.536000 0.224000 -0.808000 +0.342100 -0.050200 -0.365800 -0.640000 -0.104000 -0.752000 +0.350000 -0.059800 -0.365800 -0.280000 -0.560000 -0.768000 +0.350000 -0.050200 -0.374000 -0.496000 -0.096000 -0.856000 +0.350000 -0.050200 -0.374000 -0.496000 -0.096000 -0.856000 +0.650000 0.080100 0.121900 -0.576000 -0.640000 0.496000 +0.650000 0.080100 0.121900 -0.576000 -0.640000 0.496000 +0.692100 0.050200 0.121900 -0.432000 -0.784000 0.424000 +0.650000 0.050200 0.073400 -0.576000 -0.624000 0.512000 +0.700000 0.046100 0.121900 -0.152000 -0.904000 0.376000 +0.650000 0.041800 0.060900 -0.568000 -0.648000 0.504000 +0.700000 0.026800 0.060900 -0.288000 -0.896000 0.328000 +0.650000 0.013100 0.000000 -0.448000 -0.792000 0.392000 +0.700000 0.012000 0.000000 -0.032000 -0.960000 0.272000 +0.650000 0.000000 -0.040500 0.104000 -0.944000 0.296000 +0.700000 0.001400 -0.060900 0.088000 -0.968000 0.192000 +0.686800 0.000000 -0.060900 0.208000 -0.960000 0.144000 +0.700000 0.000400 -0.121900 0.224000 -0.968000 0.032000 +0.698200 0.000000 -0.121900 0.296000 -0.952000 0.032000 +0.700000 0.009000 -0.182900 0.456000 -0.744000 -0.472000 +0.687300 0.000000 -0.182900 0.648000 -0.600000 -0.456000 +0.700000 0.050200 -0.225700 0.368000 -0.368000 -0.848000 +0.653800 0.000000 -0.243900 0.576000 -0.112000 -0.808000 +0.653800 0.050200 -0.243900 0.232000 0.032000 -0.968000 +0.653800 0.050200 -0.243900 0.232000 0.032000 -0.968000 +0.750000 0.233400 0.121900 0.720000 0.680000 -0.080000 +0.750000 0.233400 0.121900 0.720000 0.680000 -0.080000 +0.788900 0.200800 0.121900 0.632000 0.744000 0.184000 +0.750000 0.222200 0.060900 0.704000 0.696000 -0.080000 +0.772600 0.200800 0.060900 0.648000 0.736000 -0.136000 +0.750000 0.219200 0.000000 0.672000 0.728000 0.080000 +0.770200 0.200800 0.000000 0.616000 0.776000 0.056000 +0.750000 0.228900 -0.060900 0.576000 0.696000 -0.416000 +0.787300 0.200800 -0.060900 0.520000 0.824000 -0.184000 +0.750000 0.200800 -0.104400 0.480000 0.680000 -0.544000 +0.800000 0.194300 -0.060900 0.416000 0.824000 -0.360000 +0.750000 0.186400 -0.121900 0.504000 0.648000 -0.560000 +0.800000 0.164900 -0.121900 0.312000 0.800000 -0.504000 +0.750000 0.157000 -0.182900 0.280000 0.720000 -0.624000 +0.800000 0.150600 -0.164100 0.256000 0.800000 -0.528000 +0.769100 0.150600 -0.182900 0.248000 0.704000 -0.648000 +0.800000 0.138600 -0.182900 0.232000 0.712000 -0.656000 +0.750000 0.150600 -0.191500 0.256000 0.656000 -0.704000 +0.800000 0.100400 -0.216300 0.104000 0.416000 -0.896000 +0.750000 0.100400 -0.218500 0.200000 0.232000 -0.944000 +0.800000 0.050200 -0.233400 -0.176000 0.416000 -0.880000 +0.750000 0.050200 -0.223600 -0.168000 -0.552000 -0.808000 +0.800000 0.000000 -0.217200 -0.656000 -0.464000 -0.584000 +0.750000 0.019900 -0.182900 -0.176000 -0.792000 -0.576000 +0.776700 0.000000 -0.182900 -0.576000 -0.728000 -0.360000 +0.750000 0.004300 -0.121900 -0.408000 -0.880000 -0.216000 +0.756600 0.000000 -0.121900 -0.496000 -0.856000 -0.080000 +0.750000 0.001600 -0.060900 -0.416000 -0.904000 -0.016000 +0.753100 0.000000 -0.060900 -0.472000 -0.872000 0.000000 +0.750000 0.013300 0.000000 -0.240000 -0.936000 0.240000 +0.772100 0.000000 0.000000 -0.504000 -0.832000 0.224000 +0.750000 0.031700 0.060900 -0.136000 -0.928000 0.336000 +0.798100 0.000000 0.060900 -0.504000 -0.792000 0.312000 +0.772100 0.000000 0.000000 -0.504000 -0.832000 0.224000 +0.800000 -0.001000 0.060900 -0.584000 -0.776000 0.216000 +0.800000 -0.015400 0.000000 -0.560000 -0.800000 0.184000 +0.843600 -0.050200 0.060900 -0.704000 -0.672000 0.184000 +0.832800 -0.050200 0.000000 -0.728000 -0.656000 0.144000 +0.800000 -0.015400 0.000000 -0.560000 -0.800000 0.184000 +0.823600 -0.050200 -0.060900 -0.736000 -0.664000 0.112000 +0.800000 -0.024700 -0.060900 -0.616000 -0.776000 0.088000 +0.818400 -0.050200 -0.121900 -0.760000 -0.640000 0.016000 +0.800000 -0.027900 -0.121900 -0.664000 -0.736000 -0.072000 +0.822900 -0.050200 -0.182900 -0.792000 -0.592000 -0.088000 +0.800000 -0.017800 -0.182900 -0.616000 -0.680000 -0.376000 +0.835300 -0.050200 -0.243900 -0.840000 -0.416000 -0.336000 +0.800000 0.000000 -0.217200 -0.656000 -0.464000 -0.584000 +0.819700 0.000000 -0.243900 -0.752000 -0.192000 -0.616000 +0.819700 0.000000 -0.243900 -0.752000 -0.192000 -0.616000 +0.788900 0.200800 0.121900 0.632000 0.744000 0.184000 +0.788900 0.200800 0.121900 0.632000 0.744000 0.184000 +0.800000 0.190400 0.121900 0.624000 0.752000 0.168000 +0.772600 0.200800 0.060900 0.648000 0.736000 -0.136000 +0.800000 0.182100 0.060900 0.560000 0.824000 -0.024000 +0.770200 0.200800 0.000000 0.616000 0.776000 0.056000 +0.800000 0.184600 0.000000 0.464000 0.872000 0.120000 +0.787300 0.200800 -0.060900 0.520000 0.824000 -0.184000 +0.800000 0.194300 -0.060900 0.416000 0.824000 -0.360000 +0.800000 0.194300 -0.060900 0.416000 0.824000 -0.360000 +0.800000 0.028400 0.121900 -0.376000 -0.808000 0.432000 +0.800000 0.028400 0.121900 -0.376000 -0.808000 0.432000 +0.829700 0.000000 0.121900 -0.704000 -0.616000 0.344000 +0.800000 0.000000 0.064400 -0.576000 -0.736000 0.344000 +0.800000 0.000000 0.064400 -0.576000 -0.736000 0.344000 +0.911800 0.100400 0.121900 0.528000 0.800000 0.264000 +0.911800 0.100400 0.121900 0.528000 0.800000 0.264000 +0.950000 0.069700 0.121900 0.360000 0.840000 0.384000 +0.936800 0.100400 0.060900 0.456000 0.872000 0.168000 +0.950000 0.091300 0.060900 0.600000 0.776000 0.176000 +0.950000 0.100400 0.012800 0.496000 0.848000 0.136000 +1.000000 0.068400 0.060900 0.464000 0.872000 0.104000 +0.952900 0.100400 0.000000 0.504000 0.848000 0.120000 +1.000000 0.075000 0.000000 0.472000 0.872000 0.072000 +0.957800 0.100400 -0.060900 0.544000 0.824000 -0.120000 +1.000000 0.074600 -0.060900 0.496000 0.816000 -0.280000 +1.000000 0.074600 -0.060900 0.496000 0.816000 -0.280000 +0.950000 -0.142500 0.121900 -0.608000 -0.672000 0.392000 +0.950000 -0.142500 0.121900 -0.608000 -0.672000 0.392000 +0.950000 -0.150600 0.094900 -0.648000 -0.696000 0.272000 +0.900000 -0.107100 0.121900 -0.584000 -0.768000 0.240000 +0.942000 -0.150600 0.060900 -0.704000 -0.672000 0.200000 +0.900000 -0.117100 0.060900 -0.656000 -0.736000 0.136000 +0.931300 -0.150600 0.000000 -0.640000 -0.744000 0.144000 +0.900000 -0.125700 0.000000 -0.664000 -0.728000 0.136000 +0.917800 -0.150600 -0.060900 -0.640000 -0.736000 0.184000 +0.900000 -0.135500 -0.060900 -0.672000 -0.712000 0.168000 +0.902600 -0.150600 -0.121900 -0.664000 -0.736000 0.096000 +0.900000 -0.148200 -0.121900 -0.664000 -0.728000 0.088000 +0.900000 -0.150600 -0.145400 -0.696000 -0.704000 0.104000 +0.902600 -0.150600 -0.121900 -0.664000 -0.736000 0.096000 +0.900000 -0.155900 -0.182900 -0.744000 -0.648000 0.112000 +0.950000 -0.200400 -0.121900 -0.720000 -0.672000 0.136000 +0.939100 -0.200800 -0.182900 -0.712000 -0.672000 0.160000 +0.950000 -0.200800 -0.124000 -0.680000 -0.712000 0.160000 +0.950000 -0.211700 -0.182900 -0.704000 -0.680000 0.176000 +0.939100 -0.200800 -0.182900 -0.712000 -0.672000 0.160000 +0.950000 -0.224400 -0.243900 -0.688000 -0.640000 0.328000 +0.928800 -0.200800 -0.243900 -0.736000 -0.616000 0.240000 +0.939100 -0.200800 -0.182900 -0.712000 -0.672000 0.160000 +0.900000 -0.163000 -0.243900 -0.816000 -0.552000 0.128000 +0.900000 -0.155900 -0.182900 -0.744000 -0.648000 0.112000 +0.890800 -0.150600 -0.243900 -0.848000 -0.512000 0.064000 +0.895100 -0.150600 -0.182900 -0.744000 -0.648000 0.104000 +0.900000 -0.155900 -0.182900 -0.744000 -0.648000 0.112000 +0.900000 -0.150600 -0.145400 -0.696000 -0.704000 0.104000 +0.900000 -0.150600 -0.145400 -0.696000 -0.704000 0.104000 +0.950000 -0.150600 0.094900 -0.648000 -0.696000 0.272000 +0.950000 -0.150600 0.094900 -0.648000 -0.696000 0.272000 +0.950000 -0.158100 0.060900 -0.608000 -0.760000 0.200000 +0.942000 -0.150600 0.060900 -0.704000 -0.672000 0.200000 +0.950000 -0.168100 0.000000 -0.640000 -0.744000 0.184000 +0.931300 -0.150600 0.000000 -0.640000 -0.744000 0.144000 +0.950000 -0.183700 -0.060900 -0.632000 -0.728000 0.232000 +0.917800 -0.150600 -0.060900 -0.640000 -0.736000 0.184000 +0.950000 -0.200400 -0.121900 -0.720000 -0.672000 0.136000 +0.902600 -0.150600 -0.121900 -0.664000 -0.736000 0.096000 +0.902600 -0.150600 -0.121900 -0.664000 -0.736000 0.096000 +1.000000 0.053600 0.121900 0.280000 0.872000 0.392000 +1.000000 0.053600 0.121900 0.280000 0.872000 0.392000 +0.950000 0.069700 0.121900 0.360000 0.840000 0.384000 +1.000000 0.068400 0.060900 0.464000 0.872000 0.104000 +0.950000 0.091300 0.060900 0.600000 0.776000 0.176000 +0.950000 0.091300 0.060900 0.600000 0.776000 0.176000 +-1.000000 -0.090800 0.060900 -0.320000 -0.912000 0.248000 +-1.000000 -0.090800 0.060900 -0.320000 -0.912000 0.248000 +-0.973400 -0.100400 0.060900 -0.344000 -0.904000 0.240000 +-1.000000 -0.100400 0.014600 -0.304000 -0.920000 0.208000 +-1.000000 -0.100400 0.014600 -0.304000 -0.920000 0.208000 +-0.950000 0.258900 0.000000 0.296000 0.848000 0.432000 +-0.950000 0.258900 0.000000 0.296000 0.848000 0.432000 +-0.928700 0.251000 0.000000 0.312000 0.848000 0.408000 +-0.950000 0.251000 0.016800 0.288000 0.808000 0.504000 +-0.950000 0.251000 0.016800 0.288000 0.808000 0.504000 +-0.900000 -0.149700 0.060900 -0.696000 -0.664000 0.232000 +-0.900000 -0.149700 0.060900 -0.696000 -0.664000 0.232000 +-0.899200 -0.150600 0.060900 -0.816000 -0.504000 0.256000 +-0.900000 -0.150600 0.057700 -0.744000 -0.616000 0.232000 +-0.900000 -0.150600 0.057700 -0.744000 -0.616000 0.232000 +-0.750000 0.106000 0.060900 0.496000 0.464000 0.728000 +-0.750000 0.106000 0.060900 0.496000 0.464000 0.728000 +-0.796300 0.150600 0.060900 0.512000 0.584000 0.616000 +-0.750000 0.150600 0.014500 0.472000 0.624000 0.608000 +-0.750000 0.150600 0.014500 0.472000 0.624000 0.608000 +-0.750800 -0.401700 0.000000 -0.816000 -0.520000 0.208000 +-0.750800 -0.401700 0.000000 -0.816000 -0.520000 0.208000 +-0.750000 -0.401700 0.004100 -0.816000 -0.520000 0.232000 +-0.750000 -0.403200 0.000000 -0.832000 -0.504000 0.216000 +-0.750000 -0.403200 0.000000 -0.832000 -0.504000 0.216000 +-0.700000 0.051600 0.060900 0.528000 0.416000 0.728000 +-0.700000 0.051600 0.060900 0.528000 0.416000 0.728000 +-0.744800 0.100400 0.060900 0.496000 0.456000 0.728000 +-0.700000 0.100400 0.019100 0.504000 0.504000 0.688000 +-0.700000 0.100400 0.019100 0.504000 0.504000 0.688000 +-0.700000 0.121800 0.000000 0.536000 0.544000 0.632000 +-0.700000 0.121800 0.000000 0.536000 0.544000 0.632000 +-0.680200 0.100400 0.000000 0.600000 0.440000 0.656000 +-0.700000 0.100400 0.019100 0.504000 0.504000 0.688000 +-0.700000 0.100400 0.019100 0.504000 0.504000 0.688000 +-0.650000 -0.023500 0.060900 0.576000 0.360000 0.720000 +-0.650000 -0.023500 0.060900 0.576000 0.360000 0.720000 +-0.666100 0.000000 0.060900 0.560000 0.376000 0.728000 +-0.650000 0.000000 0.045200 0.576000 0.400000 0.704000 +-0.650000 0.000000 0.045200 0.576000 0.400000 0.704000 +-0.650000 0.063100 0.000000 0.592000 0.392000 0.696000 +-0.650000 0.063100 0.000000 0.592000 0.392000 0.696000 +-0.641800 0.050200 0.000000 0.616000 0.400000 0.664000 +-0.650000 0.050200 0.008200 0.568000 0.384000 0.720000 +-0.650000 0.050200 0.008200 0.568000 0.384000 0.720000 +-0.650000 -0.495900 0.060900 -0.528000 -0.720000 0.432000 +-0.650000 -0.495900 0.060900 -0.528000 -0.720000 0.432000 +-0.640700 -0.502100 0.060900 -0.496000 -0.728000 0.456000 +-0.650000 -0.502100 0.048300 -0.536000 -0.712000 0.440000 +-0.650000 -0.502100 0.048300 -0.536000 -0.712000 0.440000 +-0.633400 -0.552300 0.000000 -0.384000 -0.672000 0.624000 +-0.633400 -0.552300 0.000000 -0.384000 -0.672000 0.624000 +-0.600000 -0.552300 0.023900 -0.224000 -0.776000 0.584000 +-0.600000 -0.566300 0.000000 -0.184000 -0.816000 0.544000 +-0.550000 -0.552300 0.031000 0.256000 -0.800000 0.528000 +-0.550000 -0.565800 0.000000 0.224000 -0.872000 0.424000 +-0.509600 -0.552300 0.000000 0.320000 -0.840000 0.424000 +-0.509600 -0.552300 0.000000 0.320000 -0.840000 0.424000 +-0.600000 -0.018300 0.000000 0.712000 0.368000 0.584000 +-0.600000 -0.018300 0.000000 0.712000 0.368000 0.584000 +-0.584800 -0.050200 0.000000 0.744000 0.336000 0.568000 +-0.600000 -0.050200 0.018400 0.648000 0.320000 0.688000 +-0.600000 -0.050200 0.018400 0.648000 0.320000 0.688000 +-0.472400 -0.150600 0.060900 -0.464000 0.768000 0.416000 +-0.472400 -0.150600 0.060900 -0.464000 0.768000 0.416000 +-0.500000 -0.166600 0.060900 -0.304000 0.832000 0.448000 +-0.500000 -0.150600 0.019400 -0.216000 0.856000 0.464000 +-0.500000 -0.150600 0.019400 -0.216000 0.856000 0.464000 +-0.434300 -0.100400 0.000000 -0.648000 0.720000 0.208000 +-0.434300 -0.100400 0.000000 -0.648000 0.720000 0.208000 +-0.405500 -0.100400 0.060900 -0.712000 0.456000 0.520000 +-0.400000 -0.050900 0.000000 -0.776000 0.576000 0.224000 +-0.400000 -0.090100 0.060900 -0.696000 0.400000 0.584000 +-0.399300 -0.050200 0.000000 -0.696000 0.680000 0.184000 +-0.367400 -0.050200 0.060900 -0.696000 0.408000 0.584000 +-0.367400 -0.050200 0.060900 -0.696000 0.408000 0.584000 +-0.355100 0.050200 0.000000 -0.872000 0.216000 0.416000 +-0.355100 0.050200 0.000000 -0.872000 0.216000 0.416000 +-0.350000 0.077100 0.000000 -0.776000 0.256000 0.568000 +-0.350000 0.050200 0.010900 -0.568000 0.448000 0.680000 +-0.321000 0.100400 0.000000 -0.264000 0.416000 0.864000 +-0.300000 0.050200 0.038600 -0.224000 0.544000 0.800000 +-0.300000 0.100400 0.006400 -0.200000 0.408000 0.880000 +-0.250000 0.050200 0.048300 0.000000 0.552000 0.832000 +-0.250000 0.100400 0.002600 0.144000 0.496000 0.848000 +-0.250000 0.100400 0.002600 0.144000 0.496000 0.848000 +-0.350000 0.000000 0.059800 -0.688000 0.400000 0.592000 +-0.350000 0.000000 0.059800 -0.688000 0.400000 0.592000 +-0.350000 0.050200 0.010900 -0.568000 0.448000 0.680000 +-0.373100 0.000000 0.000000 -0.880000 0.240000 0.392000 +-0.355100 0.050200 0.000000 -0.872000 0.216000 0.416000 +-0.377800 0.000000 -0.060900 -0.864000 0.424000 -0.248000 +-0.358600 0.050200 -0.060900 -0.920000 0.168000 -0.328000 +-0.372200 0.000000 -0.121900 -0.848000 0.480000 -0.200000 +-0.350000 0.050200 -0.078800 -0.832000 0.272000 -0.472000 +-0.350000 0.031200 -0.121900 -0.744000 0.552000 -0.352000 +-0.335400 0.050200 -0.121900 -0.752000 0.472000 -0.456000 +-0.350000 0.000000 -0.171400 -0.688000 0.416000 -0.584000 +-0.301000 0.050200 -0.182900 -0.704000 0.472000 -0.512000 +-0.340600 0.000000 -0.182900 -0.696000 0.480000 -0.520000 +-0.350000 0.000000 -0.171400 -0.688000 0.416000 -0.584000 +-0.350000 -0.016600 -0.182900 -0.688000 0.360000 -0.616000 +-0.372200 0.000000 -0.121900 -0.848000 0.480000 -0.200000 +-0.365500 -0.050200 -0.182900 -0.728000 0.384000 -0.560000 +-0.399400 -0.050200 -0.121900 -0.760000 0.504000 -0.392000 +-0.400000 -0.096400 -0.182900 -0.664000 0.552000 -0.496000 +-0.400000 -0.050900 -0.121900 -0.736000 0.536000 -0.408000 +-0.403600 -0.100400 -0.182900 -0.616000 0.592000 -0.512000 +-0.434900 -0.100400 -0.121900 -0.608000 0.744000 -0.256000 +-0.434900 -0.100400 -0.121900 -0.608000 0.744000 -0.256000 +-0.350000 0.000000 0.059800 -0.688000 0.400000 0.592000 +-0.350000 0.000000 0.059800 -0.688000 0.400000 0.592000 +-0.350000 0.050200 0.010900 -0.568000 0.448000 0.680000 +-0.348200 0.000000 0.060900 -0.376000 0.448000 0.800000 +-0.300000 0.050200 0.038600 -0.224000 0.544000 0.800000 +-0.300000 0.027200 0.060900 -0.160000 0.552000 0.808000 +-0.250000 0.050200 0.048300 0.000000 0.552000 0.832000 +-0.250000 0.033500 0.060900 0.056000 0.528000 0.840000 +-0.200000 0.050200 0.037800 0.512000 0.448000 0.720000 +-0.200000 0.020500 0.060900 0.664000 0.440000 0.600000 +-0.200000 0.020500 0.060900 0.664000 0.440000 0.600000 +-0.208400 0.401700 0.000000 -0.424000 0.248000 0.864000 +-0.208400 0.401700 0.000000 -0.424000 0.248000 0.864000 +-0.200000 0.408700 0.000000 -0.112000 0.496000 0.856000 +-0.200000 0.401700 0.005100 -0.168000 0.288000 0.936000 +-0.185900 0.401700 0.000000 0.264000 0.248000 0.928000 +-0.200000 0.384800 0.000000 -0.112000 -0.232000 0.960000 +-0.150000 0.401700 -0.011900 0.240000 0.256000 0.928000 +-0.200000 0.351500 -0.009600 0.208000 -0.208000 0.952000 +-0.150000 0.351500 -0.029900 0.096000 -0.168000 0.976000 +-0.200000 0.301200 -0.022600 0.056000 -0.176000 0.976000 +-0.150000 0.301200 -0.033800 0.040000 -0.024000 0.992000 +-0.200000 0.251000 -0.048300 -0.120000 -0.296000 0.944000 +-0.150000 0.251000 -0.027500 -0.136000 -0.104000 0.984000 +-0.200000 0.206100 -0.060900 -0.448000 -0.184000 0.872000 +-0.150000 0.200800 -0.027500 -0.320000 -0.168000 0.928000 +-0.198000 0.200800 -0.060900 -0.464000 0.288000 0.832000 +-0.150000 0.150600 -0.037800 0.256000 -0.016000 0.960000 +-0.200000 0.199100 -0.060900 -0.320000 0.504000 0.792000 +-0.200000 0.150600 -0.023100 -0.360000 0.472000 0.792000 +-0.250000 0.177000 -0.060900 -0.096000 0.568000 0.808000 +-0.250000 0.150600 -0.042200 0.008000 0.568000 0.816000 +-0.277600 0.200800 -0.060900 0.584000 -0.072000 0.800000 +-0.300000 0.150600 -0.036000 -0.360000 0.064000 0.920000 +-0.300000 0.200800 -0.040500 0.440000 0.208000 0.864000 +-0.346000 0.150600 -0.060900 -0.768000 -0.144000 0.616000 +-0.350000 0.200800 -0.003200 -0.528000 -0.104000 0.832000 +-0.350000 0.153200 -0.060900 -0.608000 -0.784000 0.016000 +-0.368900 0.200800 -0.060900 -0.952000 0.040000 -0.280000 +-0.350000 0.200800 -0.076700 -0.368000 -0.104000 -0.920000 +-0.356100 0.251000 -0.060900 -0.936000 0.104000 -0.312000 +-0.350000 0.251000 -0.067500 -0.624000 0.048000 -0.768000 +-0.353500 0.301200 -0.060900 -0.872000 0.080000 -0.464000 +-0.350000 0.301200 -0.064600 -0.624000 0.064000 -0.768000 +-0.350000 0.329400 -0.060900 -0.960000 0.152000 -0.224000 +-0.300000 0.301200 -0.089300 -0.344000 0.056000 -0.936000 +-0.344500 0.351500 -0.060900 -0.776000 0.288000 0.552000 +-0.300000 0.351500 -0.083400 -0.432000 0.176000 -0.880000 +-0.307400 0.401700 -0.060900 -0.696000 0.688000 -0.152000 +-0.300000 0.401700 -0.066400 -0.448000 0.440000 -0.768000 +-0.300000 0.408800 -0.060900 -0.664000 0.712000 -0.184000 +-0.250000 0.401700 -0.091800 -0.416000 0.456000 -0.776000 +-0.250000 0.447500 -0.060900 -0.512000 0.744000 0.408000 +-0.208300 0.401700 -0.121900 -0.432000 0.432000 -0.784000 +-0.242600 0.451900 -0.060900 -0.440000 0.728000 0.512000 +-0.200000 0.409200 -0.121900 -0.400000 0.464000 -0.776000 +-0.200000 0.451900 -0.081300 -0.400000 0.504000 -0.752000 +-0.152100 0.451900 -0.121900 -0.424000 0.536000 -0.720000 +-0.200000 0.477600 -0.060900 -0.544000 0.808000 -0.208000 +-0.150000 0.453400 -0.121900 -0.320000 0.624000 -0.704000 +-0.150000 0.501300 -0.060900 -0.376000 0.880000 -0.280000 +-0.100000 0.479800 -0.121900 -0.288000 0.584000 -0.752000 +-0.146800 0.502100 -0.060900 -0.272000 0.960000 0.016000 +-0.100000 0.502100 -0.081300 -0.184000 0.840000 -0.488000 +-0.100000 0.517800 -0.060900 -0.120000 0.976000 0.136000 +-0.050000 0.502100 -0.117100 -0.040000 0.912000 -0.392000 +-0.050000 0.515300 -0.060900 0.432000 0.792000 0.408000 +-0.033200 0.502100 -0.060900 0.616000 0.496000 0.600000 +-0.050000 0.502100 -0.046900 0.400000 0.496000 0.760000 +-0.023600 0.451900 -0.060900 0.376000 0.152000 0.904000 +-0.050000 0.451900 -0.049700 0.432000 0.024000 0.896000 +-0.005200 0.401700 -0.060900 0.264000 0.168000 0.944000 +-0.050000 0.401700 -0.052300 0.176000 0.040000 0.976000 +0.000000 0.393800 -0.060900 0.224000 0.176000 0.952000 +-0.050000 0.351500 -0.043600 0.248000 0.032000 0.960000 +0.000000 0.351500 -0.051600 0.280000 -0.248000 0.920000 +-0.050000 0.301200 -0.044600 0.440000 -0.008000 0.896000 +0.000000 0.334500 -0.060900 0.312000 -0.368000 0.864000 +-0.027600 0.301200 -0.060900 0.456000 -0.208000 0.856000 +0.000000 0.301200 -0.076500 0.296000 -0.272000 0.904000 +-0.035000 0.251000 -0.060900 0.512000 -0.448000 0.728000 +0.000000 0.251000 -0.086600 0.344000 -0.360000 0.864000 +-0.050000 0.236000 -0.060900 0.536000 -0.496000 0.672000 +0.000000 0.211400 -0.121900 0.496000 -0.712000 0.480000 +-0.050000 0.200800 -0.090500 0.520000 -0.520000 0.672000 +-0.012800 0.200800 -0.121900 0.688000 -0.616000 0.376000 +-0.050000 0.170300 -0.121900 0.584000 -0.576000 0.560000 +0.000000 0.200800 -0.169000 0.576000 -0.744000 0.320000 +-0.050000 0.150600 -0.159500 0.712000 -0.480000 0.504000 +0.000000 0.195100 -0.182900 0.504000 -0.656000 -0.544000 +-0.033200 0.150600 -0.182900 0.832000 -0.552000 -0.016000 +0.000000 0.200800 -0.186400 0.272000 -0.456000 -0.840000 +-0.050000 0.150600 -0.210200 0.840000 -0.208000 -0.496000 +-0.050000 0.200800 -0.204500 0.304000 -0.328000 -0.888000 +-0.077600 0.150600 -0.243900 0.320000 0.328000 -0.880000 +-0.100000 0.200800 -0.221500 0.056000 0.392000 -0.912000 +-0.100000 0.164100 -0.243900 -0.032000 0.432000 -0.896000 +-0.150000 0.200800 -0.199200 -0.328000 0.272000 -0.896000 +-0.126800 0.150600 -0.243900 -0.208000 0.496000 -0.832000 +-0.150000 0.150600 -0.235500 -0.296000 0.536000 -0.784000 +-0.150000 0.141700 -0.243900 -0.352000 0.528000 -0.768000 +-0.200000 0.150600 -0.197300 -0.488000 0.464000 -0.728000 +-0.198500 0.100400 -0.243900 -0.376000 0.480000 -0.784000 +-0.200000 0.100400 -0.242800 -0.520000 0.512000 -0.672000 +-0.200000 0.099300 -0.243900 -0.456000 0.488000 -0.736000 +-0.249100 0.100400 -0.182900 -0.576000 0.496000 -0.640000 +-0.250000 0.055800 -0.243900 -0.560000 0.648000 -0.504000 +-0.250000 0.099600 -0.182900 -0.488000 0.616000 -0.608000 +-0.256300 0.050200 -0.243900 -0.592000 0.624000 -0.488000 +-0.300000 0.052000 -0.182900 -0.664000 0.464000 -0.568000 +-0.300000 0.050200 -0.185100 -0.648000 0.560000 -0.504000 +-0.256300 0.050200 -0.243900 -0.592000 0.624000 -0.488000 +-0.300000 0.001800 -0.243900 -0.496000 0.680000 -0.520000 +-0.250000 0.050200 -0.254100 -0.584000 0.656000 -0.464000 +-0.300000 0.000000 -0.248500 -0.656000 0.560000 -0.488000 +-0.250000 0.000000 -0.286200 -0.320000 0.712000 -0.616000 +-0.300000 -0.050200 -0.270300 -0.824000 0.232000 -0.512000 +-0.250000 -0.028200 -0.304800 -0.400000 0.416000 -0.808000 +-0.266700 -0.050200 -0.304800 -0.504000 0.288000 -0.808000 +-0.250000 -0.050200 -0.318700 -0.440000 0.320000 -0.832000 +-0.288100 -0.100400 -0.304800 -0.408000 0.240000 -0.872000 +-0.250000 -0.100400 -0.327300 -0.384000 0.152000 -0.904000 +-0.300000 -0.118900 -0.304800 -0.376000 0.264000 -0.880000 +-0.250000 -0.150600 -0.327500 -0.120000 0.152000 -0.976000 +-0.300000 -0.150600 -0.319300 -0.256000 0.480000 -0.832000 +-0.250000 -0.200800 -0.333200 0.168000 0.080000 -0.976000 +-0.300000 -0.200800 -0.340600 0.016000 0.280000 -0.952000 +-0.250000 -0.251000 -0.337900 0.384000 0.112000 -0.912000 +-0.300000 -0.251000 -0.348000 0.192000 0.248000 -0.944000 +-0.250000 -0.301200 -0.349000 0.296000 0.272000 -0.912000 +-0.300000 -0.296900 -0.365800 0.296000 0.528000 -0.784000 +-0.291400 -0.301200 -0.365800 0.272000 0.504000 -0.808000 +-0.300000 -0.301200 -0.369600 0.320000 0.544000 -0.768000 +-0.250000 -0.342900 -0.365800 0.504000 0.512000 -0.680000 +-0.300000 -0.341100 -0.426800 -0.128000 0.536000 -0.832000 +-0.250000 -0.351500 -0.379700 0.552000 0.712000 -0.416000 +-0.273100 -0.351500 -0.426800 0.480000 0.752000 -0.440000 +-0.250000 -0.368100 -0.426800 0.504000 0.792000 -0.336000 +-0.250000 -0.351500 -0.379700 0.552000 0.712000 -0.416000 +-0.200000 -0.393200 -0.426800 0.696000 0.632000 -0.328000 +-0.241400 -0.351500 -0.365800 0.488000 0.640000 -0.576000 +-0.200000 -0.365300 -0.365800 0.504000 0.768000 -0.376000 +-0.200000 -0.351500 -0.343300 0.312000 0.640000 -0.696000 +-0.241400 -0.351500 -0.365800 0.488000 0.640000 -0.576000 +-0.200000 -0.301200 -0.313400 0.328000 0.152000 -0.928000 +-0.250000 -0.342900 -0.365800 0.504000 0.512000 -0.680000 +-0.250000 -0.301200 -0.349000 0.296000 0.272000 -0.912000 +-0.291400 -0.301200 -0.365800 0.272000 0.504000 -0.808000 +-0.291400 -0.301200 -0.365800 0.272000 0.504000 -0.808000 +-0.200000 0.401700 0.005100 -0.168000 0.288000 0.936000 +-0.200000 0.401700 0.005100 -0.168000 0.288000 0.936000 +-0.200000 0.384800 0.000000 -0.112000 -0.232000 0.960000 +-0.208400 0.401700 0.000000 -0.424000 0.248000 0.864000 +-0.200000 0.351500 -0.009600 0.208000 -0.208000 0.952000 +-0.250000 0.401700 -0.023000 -0.400000 -0.016000 0.912000 +-0.250000 0.351500 -0.004200 0.040000 0.000000 0.992000 +-0.300000 0.401700 -0.053800 -0.512000 0.520000 0.672000 +-0.300000 0.351500 -0.024700 -0.384000 0.216000 0.896000 +-0.307400 0.401700 -0.060900 -0.696000 0.688000 -0.152000 +-0.344500 0.351500 -0.060900 -0.776000 0.288000 0.552000 +-0.300000 0.351500 -0.024700 -0.384000 0.216000 0.896000 +-0.350000 0.329400 -0.060900 -0.960000 0.152000 -0.224000 +-0.300000 0.301200 -0.020200 -0.184000 0.032000 0.976000 +-0.350000 0.301200 -0.051600 -0.832000 0.120000 0.528000 +-0.300000 0.251000 -0.020200 0.208000 -0.160000 0.960000 +-0.350000 0.251000 -0.040500 -0.808000 0.200000 0.544000 +-0.300000 0.200800 -0.040500 0.440000 0.208000 0.864000 +-0.350000 0.200800 -0.003200 -0.528000 -0.104000 0.832000 +-0.350000 0.251000 -0.040500 -0.808000 0.200000 0.544000 +-0.368900 0.200800 -0.060900 -0.952000 0.040000 -0.280000 +-0.356100 0.251000 -0.060900 -0.936000 0.104000 -0.312000 +-0.350000 0.251000 -0.040500 -0.808000 0.200000 0.544000 +-0.353500 0.301200 -0.060900 -0.872000 0.080000 -0.464000 +-0.350000 0.301200 -0.051600 -0.832000 0.120000 0.528000 +-0.350000 0.329400 -0.060900 -0.960000 0.152000 -0.224000 +-0.350000 0.329400 -0.060900 -0.960000 0.152000 -0.224000 +-0.250000 -0.301200 0.006000 0.344000 -0.608000 0.704000 +-0.250000 -0.301200 0.006000 0.344000 -0.608000 0.704000 +-0.235900 -0.301200 0.000000 0.272000 -0.568000 0.768000 +-0.250000 -0.307700 0.000000 0.288000 -0.576000 0.760000 +-0.250000 -0.307700 0.000000 0.288000 -0.576000 0.760000 +-0.169100 -0.301200 0.000000 -0.376000 -0.392000 0.832000 +-0.169100 -0.301200 0.000000 -0.376000 -0.392000 0.832000 +-0.150000 -0.301200 0.010200 -0.304000 -0.280000 0.904000 +-0.150000 -0.346200 0.000000 -0.392000 -0.160000 0.904000 +-0.100000 -0.301200 0.037800 -0.016000 -0.152000 0.984000 +-0.100000 -0.344900 0.000000 0.072000 -0.528000 0.840000 +-0.050000 -0.301200 0.029100 0.312000 -0.280000 0.904000 +-0.050000 -0.329200 0.000000 0.264000 -0.624000 0.720000 +-0.002200 -0.301200 0.000000 0.384000 -0.648000 0.648000 +-0.050000 -0.351500 -0.027000 0.488000 -0.688000 0.528000 +0.000000 -0.301200 -0.001900 0.408000 -0.704000 0.568000 +-0.029100 -0.351500 -0.060900 0.584000 -0.680000 0.424000 +0.000000 -0.326800 -0.060900 0.344000 -0.824000 0.432000 +0.000000 -0.351500 -0.112600 0.544000 -0.704000 0.448000 +0.032200 -0.301200 -0.060900 0.552000 -0.696000 0.448000 +0.006400 -0.351500 -0.121900 0.552000 -0.776000 0.288000 +0.050000 -0.301200 -0.085900 0.528000 -0.704000 0.464000 +0.050000 -0.321600 -0.121900 0.584000 -0.712000 0.376000 +0.074000 -0.301200 -0.121900 0.536000 -0.792000 0.264000 +0.050000 -0.327900 -0.182900 0.552000 -0.824000 0.048000 +0.088900 -0.301200 -0.182900 0.488000 -0.864000 0.072000 +0.050000 -0.327900 -0.243900 0.480000 -0.872000 0.000000 +0.091700 -0.301200 -0.243900 0.488000 -0.864000 -0.008000 +0.050000 -0.326800 -0.304800 0.424000 -0.880000 -0.184000 +0.085600 -0.301200 -0.304800 0.544000 -0.768000 -0.320000 +0.050000 -0.303000 -0.365800 0.400000 -0.792000 -0.448000 +0.052200 -0.301200 -0.365800 0.552000 -0.720000 -0.416000 +0.050000 -0.301200 -0.369000 0.376000 -0.768000 -0.512000 +0.100000 -0.263400 -0.365800 0.480000 -0.672000 -0.544000 +0.050000 -0.251000 -0.406500 0.232000 -0.312000 -0.912000 +0.100000 -0.251000 -0.380100 0.472000 -0.384000 -0.784000 +0.050000 -0.206300 -0.365800 -0.112000 0.608000 -0.776000 +0.100000 -0.224900 -0.365800 0.352000 0.456000 -0.808000 +0.050000 -0.200800 -0.360800 -0.016000 0.576000 -0.808000 +0.100000 -0.200800 -0.352600 0.240000 0.528000 -0.800000 +0.100000 -0.224900 -0.365800 0.352000 0.456000 -0.808000 +0.150000 -0.200800 -0.325200 0.160000 0.176000 -0.968000 +0.118000 -0.251000 -0.365800 0.536000 -0.224000 -0.808000 +0.150000 -0.251000 -0.336000 0.080000 -0.336000 -0.928000 +0.100000 -0.263400 -0.365800 0.480000 -0.672000 -0.544000 +0.150000 -0.287400 -0.304800 0.000000 -0.712000 -0.688000 +0.100000 -0.292600 -0.304800 0.432000 -0.840000 -0.304000 +0.150000 -0.287700 -0.243900 -0.208000 -0.968000 0.064000 +0.100000 -0.296900 -0.243900 0.408000 -0.912000 0.000000 +0.150000 -0.278000 -0.182900 -0.064000 -0.936000 0.328000 +0.100000 -0.295100 -0.182900 0.440000 -0.880000 0.144000 +0.150000 -0.253200 -0.121900 0.192000 -0.808000 0.552000 +0.100000 -0.284500 -0.121900 0.464000 -0.744000 0.472000 +0.150000 -0.251000 -0.118100 0.224000 -0.792000 0.560000 +0.100000 -0.256900 -0.060900 0.456000 -0.800000 0.368000 +0.110300 -0.251000 -0.060900 0.504000 -0.760000 0.392000 +0.100000 -0.251000 -0.044600 0.544000 -0.608000 0.568000 +0.130700 -0.200800 -0.060900 0.504000 0.008000 0.856000 +0.100000 -0.200800 -0.044900 0.416000 0.232000 0.872000 +0.100000 -0.170000 -0.060900 0.256000 0.296000 0.912000 +0.050000 -0.200800 -0.016400 0.232000 0.648000 0.720000 +0.076800 -0.150600 -0.060900 0.208000 0.432000 0.872000 +0.050000 -0.150600 -0.053500 0.160000 0.448000 0.872000 +0.050000 -0.140200 -0.060900 0.152000 0.504000 0.848000 +0.000000 -0.150600 -0.047300 0.168000 0.600000 0.768000 +0.000000 -0.136800 -0.060900 0.088000 0.520000 0.840000 +-0.050000 -0.150600 -0.033100 0.152000 0.512000 0.840000 +-0.050000 -0.119400 -0.060900 0.168000 0.528000 0.824000 +-0.100000 -0.150600 -0.019000 0.512000 0.456000 0.720000 +-0.100000 -0.105500 -0.060900 0.480000 0.464000 0.736000 +-0.129500 -0.150600 0.000000 0.416000 0.264000 0.864000 +-0.104300 -0.100400 -0.060900 0.528000 0.416000 0.728000 +-0.150000 -0.104300 0.000000 0.496000 0.120000 0.848000 +-0.150000 -0.100400 -0.001300 0.848000 0.032000 0.520000 +-0.150600 -0.100400 0.000000 0.800000 0.040000 0.592000 +-0.150000 -0.050200 -0.005700 0.768000 -0.024000 0.632000 +-0.152800 -0.050200 0.000000 0.848000 0.032000 0.520000 +-0.150000 0.000000 -0.001200 0.744000 0.064000 0.656000 +-0.150800 0.000000 0.000000 0.744000 0.072000 0.656000 +-0.150000 0.050200 -0.012600 0.624000 0.240000 0.728000 +-0.163800 0.050200 0.000000 0.704000 0.216000 0.664000 +-0.150000 0.100400 -0.027500 0.432000 0.296000 0.848000 +-0.200000 0.089800 0.000000 0.216000 0.544000 0.800000 +-0.200000 0.100400 -0.008800 0.176000 0.488000 0.848000 +-0.238500 0.100400 0.000000 0.152000 0.496000 0.848000 +-0.200000 0.150600 -0.023100 -0.360000 0.472000 0.792000 +-0.250000 0.104200 0.000000 0.144000 0.480000 0.856000 +-0.250000 0.150600 -0.042200 0.008000 0.568000 0.816000 +-0.300000 0.112500 0.000000 -0.064000 0.472000 0.872000 +-0.300000 0.150600 -0.036000 -0.360000 0.064000 0.920000 +-0.300000 0.150600 -0.036000 -0.360000 0.064000 0.920000 +-0.150000 -0.104300 0.000000 0.496000 0.120000 0.848000 +-0.150000 -0.104300 0.000000 0.496000 0.120000 0.848000 +-0.129500 -0.150600 0.000000 0.416000 0.264000 0.864000 +-0.150000 -0.150600 0.010200 0.376000 0.208000 0.896000 +-0.100000 -0.188700 0.000000 0.176000 0.408000 0.888000 +-0.150000 -0.200800 0.013600 0.104000 0.200000 0.968000 +-0.100000 -0.200800 0.005100 0.056000 0.344000 0.936000 +-0.150000 -0.251000 0.002400 -0.056000 -0.176000 0.976000 +-0.100000 -0.251000 0.029400 -0.128000 0.120000 0.976000 +-0.150000 -0.301200 0.010200 -0.304000 -0.280000 0.904000 +-0.100000 -0.301200 0.037800 -0.016000 -0.152000 0.984000 +-0.100000 -0.251000 0.029400 -0.128000 0.120000 0.976000 +-0.050000 -0.301200 0.029100 0.312000 -0.280000 0.904000 +-0.050000 -0.251000 0.040700 0.136000 0.064000 0.984000 +-0.002200 -0.301200 0.000000 0.384000 -0.648000 0.648000 +0.000000 -0.251000 0.031300 0.424000 -0.232000 0.872000 +0.000000 -0.299000 0.000000 0.440000 -0.464000 0.760000 +0.050000 -0.251000 0.003400 0.512000 0.320000 0.792000 +0.050000 -0.253500 0.000000 0.448000 -0.608000 0.648000 +0.054200 -0.251000 0.000000 0.552000 0.192000 0.800000 +0.050000 -0.286400 -0.060900 0.528000 -0.720000 0.440000 +0.100000 -0.251000 -0.044600 0.544000 -0.608000 0.568000 +0.100000 -0.256900 -0.060900 0.456000 -0.800000 0.368000 +0.050000 -0.286400 -0.060900 0.528000 -0.720000 0.440000 +0.100000 -0.284500 -0.121900 0.464000 -0.744000 0.472000 +0.050000 -0.301200 -0.085900 0.528000 -0.704000 0.464000 +0.074000 -0.301200 -0.121900 0.536000 -0.792000 0.264000 +0.100000 -0.284500 -0.121900 0.464000 -0.744000 0.472000 +0.088900 -0.301200 -0.182900 0.488000 -0.864000 0.072000 +0.100000 -0.295100 -0.182900 0.440000 -0.880000 0.144000 +0.091700 -0.301200 -0.243900 0.488000 -0.864000 -0.008000 +0.100000 -0.296900 -0.243900 0.408000 -0.912000 0.000000 +0.085600 -0.301200 -0.304800 0.544000 -0.768000 -0.320000 +0.100000 -0.292600 -0.304800 0.432000 -0.840000 -0.304000 +0.052200 -0.301200 -0.365800 0.552000 -0.720000 -0.416000 +0.100000 -0.263400 -0.365800 0.480000 -0.672000 -0.544000 +0.100000 -0.263400 -0.365800 0.480000 -0.672000 -0.544000 +-0.100000 -0.200800 0.005100 0.056000 0.344000 0.936000 +-0.100000 -0.200800 0.005100 0.056000 0.344000 0.936000 +-0.050000 -0.200800 0.008600 0.032000 0.536000 0.840000 +-0.100000 -0.188700 0.000000 0.176000 0.408000 0.888000 +-0.050000 -0.190400 0.000000 0.096000 0.648000 0.744000 +-0.100000 -0.150600 -0.019000 0.512000 0.456000 0.720000 +-0.050000 -0.150600 -0.033100 0.152000 0.512000 0.840000 +-0.050000 -0.190400 0.000000 0.096000 0.648000 0.744000 +0.000000 -0.150600 -0.047300 0.168000 0.600000 0.768000 +0.000000 -0.198800 0.000000 0.160000 0.688000 0.704000 +0.050000 -0.150600 -0.053500 0.160000 0.448000 0.872000 +0.006800 -0.200800 0.000000 0.232000 0.576000 0.776000 +0.050000 -0.200800 -0.016400 0.232000 0.648000 0.720000 +0.050000 -0.244100 0.000000 0.488000 0.320000 0.800000 +0.100000 -0.200800 -0.044900 0.416000 0.232000 0.872000 +0.054200 -0.251000 0.000000 0.552000 0.192000 0.800000 +0.100000 -0.251000 -0.044600 0.544000 -0.608000 0.568000 +0.100000 -0.251000 -0.044600 0.544000 -0.608000 0.568000 +-0.100000 -0.200800 0.005100 0.056000 0.344000 0.936000 +-0.100000 -0.200800 0.005100 0.056000 0.344000 0.936000 +-0.100000 -0.251000 0.029400 -0.128000 0.120000 0.976000 +-0.050000 -0.200800 0.008600 0.032000 0.536000 0.840000 +-0.050000 -0.251000 0.040700 0.136000 0.064000 0.984000 +0.000000 -0.200800 0.002300 0.160000 0.560000 0.808000 +0.000000 -0.251000 0.031300 0.424000 -0.232000 0.872000 +0.006800 -0.200800 0.000000 0.232000 0.576000 0.776000 +0.050000 -0.251000 0.003400 0.512000 0.320000 0.792000 +0.050000 -0.244100 0.000000 0.488000 0.320000 0.800000 +0.054200 -0.251000 0.000000 0.552000 0.192000 0.800000 +0.054200 -0.251000 0.000000 0.552000 0.192000 0.800000 +-0.050000 -0.190400 0.000000 0.096000 0.648000 0.744000 +-0.050000 -0.190400 0.000000 0.096000 0.648000 0.744000 +-0.050000 -0.200800 0.008600 0.032000 0.536000 0.840000 +0.000000 -0.198800 0.000000 0.160000 0.688000 0.704000 +0.000000 -0.200800 0.002300 0.160000 0.560000 0.808000 +0.006800 -0.200800 0.000000 0.232000 0.576000 0.776000 +0.006800 -0.200800 0.000000 0.232000 0.576000 0.776000 +0.500000 0.245700 0.000000 -0.568000 0.120000 0.808000 +0.500000 0.245700 0.000000 -0.568000 0.120000 0.808000 +0.500000 0.200800 0.008600 -0.576000 -0.176000 0.792000 +0.488800 0.200800 0.000000 -0.512000 0.024000 0.856000 +0.500000 0.181600 0.000000 -0.600000 -0.304000 0.728000 +0.500000 0.181600 0.000000 -0.600000 -0.304000 0.728000 +0.550000 0.174700 0.060900 -0.744000 -0.320000 0.576000 +0.550000 0.174700 0.060900 -0.744000 -0.320000 0.576000 +0.560700 0.150600 0.060900 -0.704000 -0.368000 0.592000 +0.550000 0.150600 0.048400 -0.632000 -0.416000 0.640000 +0.550000 0.150600 0.048400 -0.632000 -0.416000 0.640000 +0.641200 0.050200 0.060900 -0.600000 -0.608000 0.512000 +0.641200 0.050200 0.060900 -0.600000 -0.608000 0.512000 +0.600000 0.093600 0.060900 -0.624000 -0.616000 0.464000 +0.602900 0.050200 0.000000 -0.576000 -0.704000 0.400000 +0.600000 0.053300 0.000000 -0.472000 -0.712000 0.512000 +0.600000 0.050200 -0.005300 -0.440000 -0.752000 0.480000 +0.600000 0.050200 -0.005300 -0.440000 -0.752000 0.480000 +-0.915700 -0.150600 0.000000 -0.696000 -0.672000 0.232000 +-0.915700 -0.150600 0.000000 -0.696000 -0.672000 0.232000 +-0.950000 -0.123700 0.000000 -0.488000 -0.840000 0.216000 +-0.932400 -0.150600 -0.060900 -0.688000 -0.696000 0.176000 +-0.950000 -0.136200 -0.060900 -0.528000 -0.832000 0.152000 +-0.943100 -0.150600 -0.121900 -0.672000 -0.720000 0.120000 +-0.950000 -0.144800 -0.121900 -0.536000 -0.832000 0.120000 +-0.950000 -0.150600 -0.169000 -0.584000 -0.792000 0.136000 +-0.943100 -0.150600 -0.121900 -0.672000 -0.720000 0.120000 +-0.950000 -0.152700 -0.182900 -0.600000 -0.784000 0.144000 +-0.903800 -0.200800 -0.121900 -0.696000 -0.704000 0.120000 +-0.907400 -0.200800 -0.182900 -0.688000 -0.712000 0.072000 +-0.950000 -0.152700 -0.182900 -0.600000 -0.784000 0.144000 +-0.914100 -0.200800 -0.243900 -0.664000 -0.728000 0.128000 +-0.950000 -0.161800 -0.243900 -0.584000 -0.784000 0.176000 +-0.931500 -0.200800 -0.304800 -0.648000 -0.520000 -0.544000 +-0.950000 -0.180000 -0.304800 -0.552000 -0.600000 -0.568000 +-0.900000 -0.200800 -0.331500 -0.576000 -0.328000 -0.736000 +-0.950000 -0.150600 -0.330800 -0.416000 -0.432000 -0.792000 +-0.900000 -0.150600 -0.338300 -0.216000 -0.104000 -0.968000 +-0.900000 -0.200800 -0.331500 -0.576000 -0.328000 -0.736000 +-0.850000 -0.150600 -0.349400 0.072000 0.056000 -0.992000 +-0.850000 -0.200800 -0.351200 -0.168000 0.112000 -0.976000 +-0.800000 -0.150600 -0.340500 0.312000 0.288000 -0.896000 +-0.800000 -0.200800 -0.355700 0.080000 0.256000 -0.960000 +-0.750000 -0.150600 -0.317800 0.416000 0.384000 -0.816000 +-0.750000 -0.200800 -0.348300 0.272000 0.384000 -0.872000 +-0.731900 -0.150600 -0.304800 0.424000 0.400000 -0.808000 +-0.700000 -0.200800 -0.326900 0.208000 0.528000 -0.816000 +-0.700000 -0.175200 -0.304800 0.352000 0.528000 -0.768000 +-0.651700 -0.200800 -0.304800 0.320000 0.544000 -0.768000 +-0.700000 -0.150600 -0.284500 0.376000 0.392000 -0.832000 +-0.650000 -0.200800 -0.303800 0.136000 0.680000 -0.712000 +-0.650000 -0.150600 -0.267500 0.376000 0.464000 -0.792000 +-0.650000 -0.150600 -0.267500 0.376000 0.464000 -0.792000 +-0.895700 -0.200800 -0.060900 -0.864000 -0.480000 0.136000 +-0.895700 -0.200800 -0.060900 -0.864000 -0.480000 0.136000 +-0.882700 -0.200800 0.000000 -0.840000 -0.496000 0.192000 +-0.860100 -0.251000 -0.060900 -0.808000 -0.568000 0.112000 +-0.852600 -0.251000 0.000000 -0.800000 -0.568000 0.168000 +-0.852600 -0.251000 0.000000 -0.800000 -0.568000 0.168000 +-0.700000 -0.502100 -0.057900 -0.752000 -0.512000 0.400000 +-0.700000 -0.502100 -0.057900 -0.752000 -0.512000 0.400000 +-0.700000 -0.507800 -0.060900 -0.864000 -0.200000 0.448000 +-0.701200 -0.502100 -0.060900 -0.816000 -0.416000 0.392000 +-0.700000 -0.552300 -0.082500 -0.736000 -0.280000 0.608000 +-0.723300 -0.502100 -0.121900 -0.896000 -0.224000 0.368000 +-0.750000 -0.552300 -0.119400 0.072000 0.512000 0.848000 +-0.750000 -0.549900 -0.121900 0.080000 0.648000 0.752000 +-0.800000 -0.552300 -0.095900 0.424000 0.264000 0.864000 +-0.800000 -0.539500 -0.121900 0.176000 0.680000 0.704000 +-0.850000 -0.552300 -0.082300 -0.704000 -0.480000 0.504000 +-0.850000 -0.519700 -0.121900 0.200000 0.624000 0.752000 +-0.868200 -0.552300 -0.121900 -0.520000 -0.224000 0.816000 +-0.850000 -0.502100 -0.144600 0.400000 0.776000 0.480000 +-0.900000 -0.511500 -0.121900 -0.520000 -0.664000 0.528000 +-0.878700 -0.502100 -0.121900 0.408000 0.368000 0.832000 +-0.900000 -0.502100 -0.104000 -0.752000 0.000000 0.656000 +-0.900000 -0.492700 -0.121900 -0.520000 0.712000 0.448000 +-0.906100 -0.502100 -0.121900 -0.920000 0.072000 0.376000 +-0.900000 -0.462200 -0.182900 0.320000 0.888000 0.304000 +-0.925200 -0.502100 -0.182900 -0.976000 -0.008000 0.208000 +-0.900000 -0.451900 -0.229200 0.512000 0.832000 0.168000 +-0.929300 -0.502100 -0.243900 -0.992000 0.064000 -0.008000 +-0.921000 -0.451900 -0.243900 -0.184000 0.968000 0.160000 +-0.920600 -0.502100 -0.304800 -0.888000 -0.288000 -0.344000 +-0.912200 -0.451900 -0.304800 -0.496000 0.720000 -0.464000 +-0.900000 -0.502100 -0.352600 -0.672000 0.128000 -0.720000 +-0.900000 -0.451900 -0.318500 0.104000 0.872000 -0.464000 +-0.864000 -0.502100 -0.365800 -0.304000 0.480000 -0.816000 +-0.891000 -0.451900 -0.304800 0.528000 0.824000 -0.192000 +-0.850000 -0.496800 -0.365800 -0.176000 0.616000 -0.760000 +-0.850000 -0.473200 -0.304800 0.272000 0.896000 -0.336000 +-0.800000 -0.496400 -0.365800 -0.664000 0.416000 -0.608000 +-0.800000 -0.473000 -0.304800 -0.736000 0.648000 -0.168000 +-0.786000 -0.451900 -0.365800 -0.872000 0.080000 -0.472000 +-0.787800 -0.451900 -0.304800 -0.984000 0.136000 -0.040000 +-0.796500 -0.401700 -0.365800 -0.952000 -0.168000 -0.232000 +-0.797400 -0.401700 -0.304800 -0.928000 -0.344000 0.056000 +-0.800000 -0.388500 -0.365800 -0.864000 -0.288000 -0.400000 +-0.800000 -0.395700 -0.304800 -0.920000 -0.376000 0.000000 +-0.797400 -0.401700 -0.304800 -0.928000 -0.344000 0.056000 +-0.800000 -0.365300 -0.243900 -0.880000 -0.440000 0.160000 +-0.781800 -0.401700 -0.243900 -0.912000 -0.336000 0.208000 +-0.800000 -0.355500 -0.182900 -0.872000 -0.472000 0.032000 +-0.775200 -0.401700 -0.182900 -0.904000 -0.400000 0.120000 +-0.800000 -0.354700 -0.121900 -0.848000 -0.512000 0.080000 +-0.771000 -0.401700 -0.121900 -0.872000 -0.456000 0.128000 +-0.800000 -0.351500 -0.101400 -0.840000 -0.528000 0.104000 +-0.762700 -0.401700 -0.060900 -0.840000 -0.496000 0.168000 +-0.794800 -0.351500 -0.060900 -0.816000 -0.552000 0.144000 +-0.800000 -0.351500 -0.101400 -0.840000 -0.528000 0.104000 +-0.800000 -0.343900 -0.060900 -0.816000 -0.552000 0.128000 +-0.800000 -0.343900 -0.060900 -0.816000 -0.552000 0.128000 +-0.700000 0.150600 -0.043600 0.552000 0.712000 0.424000 +-0.700000 0.150600 -0.043600 0.552000 0.712000 0.424000 +-0.700000 0.159000 -0.060900 0.600000 0.776000 0.184000 +-0.689800 0.150600 -0.060900 0.640000 0.736000 0.192000 +-0.700000 0.150600 -0.089800 0.592000 0.744000 -0.280000 +-0.650000 0.112000 -0.060900 0.672000 0.704000 0.200000 +-0.700000 0.140000 -0.121900 0.536000 0.728000 -0.408000 +-0.650000 0.100400 -0.098000 0.720000 0.624000 -0.288000 +-0.657700 0.100400 -0.121900 0.728000 0.576000 -0.360000 +-0.650000 0.089500 -0.121900 0.728000 0.552000 -0.384000 +-0.700000 0.100400 -0.182100 0.536000 0.592000 -0.592000 +-0.650000 0.050200 -0.178200 0.664000 0.544000 -0.504000 +-0.700000 0.099700 -0.182900 0.504000 0.560000 -0.640000 +-0.652800 0.050200 -0.182900 0.592000 0.536000 -0.592000 +-0.700000 0.050200 -0.235800 0.504000 0.432000 -0.744000 +-0.650000 0.045800 -0.182900 0.672000 0.432000 -0.592000 +-0.700000 0.037400 -0.243900 0.440000 0.392000 -0.800000 +-0.650000 0.000000 -0.224600 0.632000 0.368000 -0.672000 +-0.669700 0.000000 -0.243900 0.480000 0.312000 -0.808000 +-0.700000 0.037400 -0.243900 0.440000 0.392000 -0.800000 +-0.700000 0.000000 -0.262900 0.392000 0.288000 -0.864000 +-0.700000 0.000000 -0.262900 0.392000 0.288000 -0.864000 +-0.650000 -0.541900 0.000000 -0.528000 -0.600000 0.592000 +-0.650000 -0.541900 0.000000 -0.528000 -0.600000 0.592000 +-0.633400 -0.552300 0.000000 -0.384000 -0.672000 0.624000 +-0.650000 -0.552300 -0.012600 -0.496000 -0.592000 0.624000 +-0.650000 -0.552300 -0.012600 -0.496000 -0.592000 0.624000 +-0.452400 -0.100400 -0.060900 -0.344000 0.936000 -0.016000 +-0.452400 -0.100400 -0.060900 -0.344000 0.936000 -0.016000 +-0.450000 -0.099400 -0.060900 -0.760000 0.616000 0.160000 +-0.450000 -0.100400 -0.057100 -0.400000 0.872000 0.264000 +-0.406900 -0.050200 -0.060900 -0.848000 0.520000 0.000000 +-0.434300 -0.100400 0.000000 -0.648000 0.720000 0.208000 +-0.400000 -0.050200 -0.003200 -0.712000 0.672000 0.168000 +-0.400000 -0.050900 0.000000 -0.776000 0.576000 0.224000 +-0.399300 -0.050200 0.000000 -0.696000 0.680000 0.184000 +-0.399300 -0.050200 0.000000 -0.696000 0.680000 0.184000 +-0.466200 -0.502100 0.000000 0.712000 -0.616000 0.320000 +-0.466200 -0.502100 0.000000 0.712000 -0.616000 0.320000 +-0.450000 -0.489500 0.000000 0.584000 -0.760000 0.264000 +-0.450000 -0.502100 -0.045100 0.560000 -0.696000 0.432000 +-0.403800 -0.451900 0.000000 0.744000 -0.560000 0.352000 +-0.400000 -0.502100 -0.024700 0.848000 -0.224000 0.464000 +-0.400000 -0.451900 -0.009600 0.744000 -0.536000 0.376000 +-0.403800 -0.451900 0.000000 0.744000 -0.560000 0.352000 +-0.400000 -0.447100 0.000000 0.720000 -0.584000 0.344000 +-0.400000 -0.451900 -0.009600 0.744000 -0.536000 0.376000 +-0.350000 -0.427600 0.000000 0.560000 -0.752000 0.336000 +-0.350000 -0.451900 -0.058800 0.248000 -0.624000 0.728000 +-0.350000 -0.451900 -0.058800 0.248000 -0.624000 0.728000 +-0.500000 -0.552300 -0.009400 0.352000 -0.840000 0.400000 +-0.500000 -0.552300 -0.009400 0.352000 -0.840000 0.400000 +-0.478800 -0.552300 -0.060900 0.704000 -0.592000 0.376000 +-0.500000 -0.570000 -0.060900 0.480000 -0.800000 0.328000 +-0.452200 -0.552300 -0.121900 0.864000 0.184000 0.464000 +-0.500000 -0.589900 -0.121900 0.408000 -0.832000 0.352000 +-0.450000 -0.552300 -0.127200 0.616000 -0.144000 0.768000 +-0.500000 -0.602500 -0.155300 0.000000 -0.920000 0.376000 +-0.450000 -0.558900 -0.121900 0.808000 0.320000 0.488000 +-0.474100 -0.602500 -0.121900 -0.520000 -0.712000 0.456000 +-0.450000 -0.602500 -0.084100 -0.232000 -0.736000 0.624000 +-0.450000 -0.612400 -0.121900 0.032000 -0.944000 0.312000 +-0.410500 -0.602500 -0.121900 0.456000 -0.632000 0.616000 +-0.450000 -0.629600 -0.182900 -0.344000 -0.872000 0.320000 +-0.400000 -0.602500 -0.131300 0.560000 -0.576000 0.584000 +-0.400000 -0.651500 -0.182900 -0.552000 -0.472000 0.672000 +-0.386500 -0.602500 -0.182900 0.376000 -0.032000 0.920000 +-0.400000 -0.652700 -0.184800 -0.640000 -0.536000 0.536000 +-0.350000 -0.647900 -0.182900 0.008000 0.768000 0.624000 +-0.396000 -0.652700 -0.182900 -0.176000 0.000000 0.984000 +-0.350000 -0.652700 -0.168800 -0.864000 0.056000 0.488000 +-0.350700 -0.703000 -0.182900 -0.792000 -0.176000 0.576000 +-0.350000 -0.703000 -0.180700 -0.616000 -0.504000 0.592000 +-0.350000 -0.704300 -0.182900 -0.112000 -0.808000 0.576000 +-0.300000 -0.703000 -0.173800 0.616000 -0.544000 0.552000 +-0.300000 -0.708000 -0.182900 0.360000 -0.768000 0.520000 +-0.293800 -0.703000 -0.182900 0.608000 -0.624000 0.488000 +-0.300000 -0.736500 -0.243900 0.320000 -0.832000 0.440000 +-0.256000 -0.703000 -0.243900 0.696000 -0.392000 0.584000 +-0.300000 -0.753200 -0.286100 0.088000 -0.928000 0.352000 +-0.250000 -0.703000 -0.252700 0.704000 -0.368000 0.600000 +-0.281500 -0.753200 -0.304800 0.312000 -0.920000 -0.216000 +-0.250000 -0.737300 -0.304800 0.568000 -0.808000 -0.112000 +-0.300000 -0.753200 -0.317300 0.136000 -0.840000 -0.512000 +-0.250000 -0.703000 -0.346500 0.432000 -0.280000 -0.848000 +-0.300000 -0.703000 -0.365100 0.056000 -0.232000 -0.968000 +-0.250000 -0.652700 -0.361600 0.240000 -0.216000 -0.944000 +-0.300000 -0.687100 -0.365800 0.104000 -0.048000 -0.992000 +-0.282800 -0.652700 -0.365800 0.080000 -0.160000 -0.976000 +-0.300000 -0.652700 -0.367500 0.064000 -0.112000 -0.984000 +-0.300000 -0.687100 -0.365800 0.104000 -0.048000 -0.992000 +-0.350000 -0.652700 -0.376000 0.560000 0.160000 -0.808000 +-0.350000 -0.679200 -0.365800 -0.072000 -0.176000 -0.976000 +-0.400000 -0.652700 -0.368100 -0.128000 -0.872000 -0.456000 +-0.400000 -0.653700 -0.365800 -0.176000 -0.888000 -0.416000 +-0.405700 -0.652700 -0.365800 -0.144000 -0.920000 -0.344000 +-0.400000 -0.672200 -0.304800 -0.400000 -0.904000 -0.128000 +-0.450000 -0.652700 -0.319500 -0.256000 -0.952000 -0.136000 +-0.450000 -0.654300 -0.304800 -0.272000 -0.952000 0.040000 +-0.455200 -0.652700 -0.304800 -0.280000 -0.952000 0.040000 +-0.450000 -0.652700 -0.293400 -0.288000 -0.936000 0.160000 +-0.500000 -0.637800 -0.304800 -0.208000 -0.976000 -0.032000 +-0.450000 -0.644000 -0.243900 -0.352000 -0.912000 0.200000 +-0.500000 -0.625200 -0.243900 -0.096000 -0.960000 0.240000 +-0.450000 -0.629600 -0.182900 -0.344000 -0.872000 0.320000 +-0.500000 -0.610400 -0.182900 -0.136000 -0.936000 0.304000 +-0.450000 -0.612400 -0.121900 0.032000 -0.944000 0.312000 +-0.500000 -0.602500 -0.155300 0.000000 -0.920000 0.376000 +-0.474100 -0.602500 -0.121900 -0.520000 -0.712000 0.456000 +-0.474100 -0.602500 -0.121900 -0.520000 -0.712000 0.456000 +-0.350000 0.148000 -0.060900 -0.504000 0.552000 0.656000 +-0.350000 0.148000 -0.060900 -0.504000 0.552000 0.656000 +-0.350000 0.100400 -0.017600 -0.744000 0.352000 0.552000 +-0.361800 0.100400 -0.060900 -0.920000 0.112000 -0.352000 +-0.350000 0.077100 0.000000 -0.776000 0.256000 0.568000 +-0.358600 0.050200 -0.060900 -0.920000 0.168000 -0.328000 +-0.355100 0.050200 0.000000 -0.872000 0.216000 0.416000 +-0.355100 0.050200 0.000000 -0.872000 0.216000 0.416000 +-0.307400 0.401700 -0.060900 -0.696000 0.688000 -0.152000 +-0.307400 0.401700 -0.060900 -0.696000 0.688000 -0.152000 +-0.300000 0.408800 -0.060900 -0.664000 0.712000 -0.184000 +-0.300000 0.401700 -0.053800 -0.512000 0.520000 0.672000 +-0.250000 0.447500 -0.060900 -0.512000 0.744000 0.408000 +-0.250000 0.401700 -0.023000 -0.400000 -0.016000 0.912000 +-0.242600 0.451900 -0.060900 -0.440000 0.728000 0.512000 +-0.208400 0.401700 0.000000 -0.424000 0.248000 0.864000 +-0.200000 0.451900 -0.034900 -0.360000 0.584000 0.720000 +-0.200000 0.408700 0.000000 -0.112000 0.496000 0.856000 +-0.150000 0.451900 -0.004000 -0.136000 0.584000 0.792000 +-0.185900 0.401700 0.000000 0.264000 0.248000 0.928000 +-0.150000 0.401700 -0.011900 0.240000 0.256000 0.928000 +-0.150000 0.451900 -0.004000 -0.136000 0.584000 0.792000 +-0.100000 0.401700 -0.042400 0.232000 -0.088000 0.960000 +-0.100000 0.451900 -0.019200 0.136000 0.056000 0.984000 +-0.050000 0.401700 -0.052300 0.176000 0.040000 0.976000 +-0.050000 0.451900 -0.049700 0.432000 0.024000 0.896000 +-0.100000 0.451900 -0.019200 0.136000 0.056000 0.984000 +-0.050000 0.502100 -0.046900 0.400000 0.496000 0.760000 +-0.100000 0.502100 -0.041900 -0.080000 0.528000 0.840000 +-0.050000 0.515300 -0.060900 0.432000 0.792000 0.408000 +-0.100000 0.517800 -0.060900 -0.120000 0.976000 0.136000 +-0.100000 0.502100 -0.041900 -0.080000 0.528000 0.840000 +-0.146800 0.502100 -0.060900 -0.272000 0.960000 0.016000 +-0.100000 0.451900 -0.019200 0.136000 0.056000 0.984000 +-0.150000 0.501300 -0.060900 -0.376000 0.880000 -0.280000 +-0.150000 0.451900 -0.004000 -0.136000 0.584000 0.792000 +-0.200000 0.477600 -0.060900 -0.544000 0.808000 -0.208000 +-0.200000 0.451900 -0.034900 -0.360000 0.584000 0.720000 +-0.242600 0.451900 -0.060900 -0.440000 0.728000 0.512000 +-0.200000 0.477600 -0.060900 -0.544000 0.808000 -0.208000 +-0.200000 0.451900 -0.081300 -0.400000 0.504000 -0.752000 +-0.200000 0.451900 -0.081300 -0.400000 0.504000 -0.752000 +-0.321000 0.100400 0.000000 -0.264000 0.416000 0.864000 +-0.321000 0.100400 0.000000 -0.264000 0.416000 0.864000 +-0.350000 0.077100 0.000000 -0.776000 0.256000 0.568000 +-0.350000 0.100400 -0.017600 -0.744000 0.352000 0.552000 +-0.350000 0.100400 -0.017600 -0.744000 0.352000 0.552000 +-0.250000 0.351500 -0.004200 0.040000 0.000000 0.992000 +-0.250000 0.351500 -0.004200 0.040000 0.000000 0.992000 +-0.300000 0.351500 -0.024700 -0.384000 0.216000 0.896000 +-0.250000 0.301200 -0.005700 0.112000 -0.104000 0.984000 +-0.300000 0.301200 -0.020200 -0.184000 0.032000 0.976000 +-0.250000 0.251000 -0.029400 0.176000 -0.456000 0.864000 +-0.300000 0.251000 -0.020200 0.208000 -0.160000 0.960000 +-0.250000 0.219300 -0.060900 0.304000 -0.640000 0.696000 +-0.300000 0.200800 -0.040500 0.440000 0.208000 0.864000 +-0.277600 0.200800 -0.060900 0.584000 -0.072000 0.800000 +-0.250000 0.219300 -0.060900 0.304000 -0.640000 0.696000 +-0.250000 0.200800 -0.094600 -0.184000 -0.064000 0.976000 +-0.200000 0.206100 -0.060900 -0.448000 -0.184000 0.872000 +-0.200000 0.200800 -0.062300 -0.304000 0.376000 0.864000 +-0.198000 0.200800 -0.060900 -0.464000 0.288000 0.832000 +-0.200000 0.199100 -0.060900 -0.320000 0.504000 0.792000 +-0.200000 0.200800 -0.062300 -0.304000 0.376000 0.864000 +-0.250000 0.177000 -0.060900 -0.096000 0.568000 0.808000 +-0.250000 0.200800 -0.094600 -0.184000 -0.064000 0.976000 +-0.277600 0.200800 -0.060900 0.584000 -0.072000 0.800000 +-0.277600 0.200800 -0.060900 0.584000 -0.072000 0.800000 +-0.250000 -0.351500 -0.038300 0.104000 -0.504000 0.848000 +-0.250000 -0.351500 -0.038300 0.104000 -0.504000 0.848000 +-0.300000 -0.351500 -0.012600 0.872000 -0.352000 0.320000 +-0.250000 -0.401700 -0.058800 -0.096000 -0.136000 0.984000 +-0.300000 -0.401700 -0.045100 0.792000 -0.248000 0.544000 +-0.250000 -0.451900 -0.040500 -0.352000 -0.008000 0.928000 +-0.300000 -0.435300 -0.060900 -0.192000 -0.360000 0.912000 +-0.287100 -0.451900 -0.060900 -0.448000 -0.328000 0.824000 +-0.300000 -0.451900 -0.070300 -0.328000 -0.392000 0.856000 +-0.279200 -0.502100 -0.060900 -0.688000 -0.328000 0.640000 +-0.300000 -0.502100 -0.097100 -0.592000 -0.576000 0.560000 +-0.250000 -0.533000 -0.060900 -0.336000 -0.760000 0.544000 +-0.300000 -0.516400 -0.121900 -0.256000 -0.872000 0.400000 +-0.250000 -0.552300 -0.101500 -0.080000 -0.904000 0.400000 +-0.260200 -0.552300 -0.121900 -0.560000 -0.752000 0.336000 +-0.250000 -0.559400 -0.121900 -0.088000 -0.912000 0.384000 +-0.285200 -0.552300 -0.182900 -0.616000 -0.680000 0.384000 +-0.250000 -0.581300 -0.182900 -0.104000 -0.888000 0.440000 +-0.300000 -0.552300 -0.209900 -0.624000 -0.616000 0.456000 +-0.250000 -0.602500 -0.226600 0.288000 -0.512000 0.800000 +-0.300000 -0.594300 -0.243900 -0.424000 -0.464000 0.768000 +-0.286800 -0.602500 -0.243900 -0.320000 0.232000 0.912000 +-0.300000 -0.602500 -0.250000 -0.408000 0.368000 0.824000 +-0.300000 -0.607200 -0.243900 -0.248000 0.672000 0.688000 +-0.344900 -0.602500 -0.304800 -0.744000 0.664000 -0.032000 +-0.350000 -0.630200 -0.243900 -0.144000 0.776000 0.600000 +-0.350000 -0.605300 -0.304800 0.248000 0.960000 -0.032000 +-0.371400 -0.602500 -0.243900 0.928000 0.016000 0.352000 +-0.351600 -0.602500 -0.304800 0.944000 0.304000 0.024000 +-0.363900 -0.552300 -0.243900 0.816000 -0.480000 0.304000 +-0.350000 -0.594300 -0.304800 0.520000 -0.800000 0.280000 +-0.350000 -0.552300 -0.283400 -0.096000 -0.680000 0.720000 +-0.344900 -0.602500 -0.304800 -0.744000 0.664000 -0.032000 +-0.317500 -0.552300 -0.243900 -0.600000 -0.648000 0.448000 +-0.300000 -0.602500 -0.250000 -0.408000 0.368000 0.824000 +-0.300000 -0.594300 -0.243900 -0.424000 -0.464000 0.768000 +-0.317500 -0.552300 -0.243900 -0.600000 -0.648000 0.448000 +-0.300000 -0.552300 -0.209900 -0.624000 -0.616000 0.456000 +-0.350000 -0.535600 -0.243900 0.360000 -0.840000 0.384000 +-0.300000 -0.538300 -0.182900 -0.584000 -0.696000 0.408000 +-0.350000 -0.518400 -0.182900 -0.088000 -0.928000 0.360000 +-0.300000 -0.516400 -0.121900 -0.256000 -0.872000 0.400000 +-0.350000 -0.503000 -0.121900 0.232000 -0.880000 0.400000 +-0.300000 -0.502100 -0.097100 -0.592000 -0.576000 0.560000 +-0.350000 -0.502100 -0.119400 0.240000 -0.864000 0.424000 +-0.300000 -0.451900 -0.070300 -0.328000 -0.392000 0.856000 +-0.350000 -0.453900 -0.060900 0.248000 -0.624000 0.728000 +-0.338500 -0.451900 -0.060900 0.112000 -0.632000 0.760000 +-0.300000 -0.451900 -0.070300 -0.328000 -0.392000 0.856000 +-0.300000 -0.435300 -0.060900 -0.192000 -0.360000 0.912000 +-0.300000 -0.435300 -0.060900 -0.192000 -0.360000 0.912000 +-0.287100 -0.451900 -0.060900 -0.448000 -0.328000 0.824000 +-0.287100 -0.451900 -0.060900 -0.448000 -0.328000 0.824000 +-0.279200 -0.502100 -0.060900 -0.688000 -0.328000 0.640000 +-0.250000 -0.451900 -0.040500 -0.352000 -0.008000 0.928000 +-0.250000 -0.502100 -0.016400 -0.320000 -0.344000 0.872000 +-0.200000 -0.451900 -0.018000 0.376000 -0.112000 0.912000 +-0.200000 -0.502100 -0.039000 0.512000 -0.608000 0.592000 +-0.250000 -0.502100 -0.016400 -0.320000 -0.344000 0.872000 +-0.200000 -0.511900 -0.060900 0.416000 -0.800000 0.424000 +-0.250000 -0.533000 -0.060900 -0.336000 -0.760000 0.544000 +-0.200000 -0.534300 -0.121900 0.456000 -0.832000 0.296000 +-0.250000 -0.552300 -0.101500 -0.080000 -0.904000 0.400000 +-0.235800 -0.552300 -0.121900 0.448000 -0.816000 0.336000 +-0.250000 -0.559400 -0.121900 -0.088000 -0.912000 0.384000 +-0.204600 -0.552300 -0.182900 0.504000 -0.776000 0.360000 +-0.250000 -0.581300 -0.182900 -0.104000 -0.888000 0.440000 +-0.200000 -0.552300 -0.190900 0.520000 -0.768000 0.360000 +-0.250000 -0.602500 -0.226600 0.288000 -0.512000 0.800000 +-0.200000 -0.579600 -0.243900 0.568000 -0.648000 0.496000 +-0.233200 -0.602500 -0.243900 0.608000 -0.320000 0.720000 +-0.200000 -0.602500 -0.268600 0.488000 -0.432000 0.752000 +-0.241600 -0.652700 -0.243900 0.680000 -0.216000 0.688000 +-0.200000 -0.652700 -0.286600 0.488000 -0.272000 0.824000 +-0.250000 -0.679700 -0.243900 0.728000 -0.208000 0.640000 +-0.200000 -0.693500 -0.304800 0.872000 -0.464000 -0.120000 +-0.250000 -0.703000 -0.252700 0.704000 -0.368000 0.600000 +-0.204300 -0.703000 -0.304800 0.856000 -0.496000 -0.088000 +-0.250000 -0.737300 -0.304800 0.568000 -0.808000 -0.112000 +-0.250000 -0.703000 -0.346500 0.432000 -0.280000 -0.848000 +-0.204300 -0.703000 -0.304800 0.856000 -0.496000 -0.088000 +-0.250000 -0.652700 -0.361600 0.240000 -0.216000 -0.944000 +-0.200000 -0.693500 -0.304800 0.872000 -0.464000 -0.120000 +-0.200000 -0.652700 -0.326500 0.488000 -0.272000 -0.824000 +-0.171500 -0.652700 -0.304800 0.576000 -0.304000 0.752000 +-0.200000 -0.693500 -0.304800 0.872000 -0.464000 -0.120000 +-0.200000 -0.652700 -0.286600 0.488000 -0.272000 0.824000 +-0.200000 -0.652700 -0.286600 0.488000 -0.272000 0.824000 +-0.279200 -0.502100 -0.060900 -0.688000 -0.328000 0.640000 +-0.279200 -0.502100 -0.060900 -0.688000 -0.328000 0.640000 +-0.250000 -0.502100 -0.016400 -0.320000 -0.344000 0.872000 +-0.250000 -0.533000 -0.060900 -0.336000 -0.760000 0.544000 +-0.250000 -0.533000 -0.060900 -0.336000 -0.760000 0.544000 +-0.200000 0.351500 -0.009600 0.208000 -0.208000 0.952000 +-0.200000 0.351500 -0.009600 0.208000 -0.208000 0.952000 +-0.250000 0.351500 -0.004200 0.040000 0.000000 0.992000 +-0.200000 0.301200 -0.022600 0.056000 -0.176000 0.976000 +-0.250000 0.301200 -0.005700 0.112000 -0.104000 0.984000 +-0.200000 0.251000 -0.048300 -0.120000 -0.296000 0.944000 +-0.250000 0.251000 -0.029400 0.176000 -0.456000 0.864000 +-0.200000 0.206100 -0.060900 -0.448000 -0.184000 0.872000 +-0.250000 0.219300 -0.060900 0.304000 -0.640000 0.696000 +-0.250000 0.219300 -0.060900 0.304000 -0.640000 0.696000 +-0.200000 -0.351500 -0.031500 -0.320000 -0.128000 0.936000 +-0.200000 -0.351500 -0.031500 -0.320000 -0.128000 0.936000 +-0.250000 -0.351500 -0.038300 0.104000 -0.504000 0.848000 +-0.200000 -0.401700 -0.023400 -0.056000 -0.008000 0.992000 +-0.250000 -0.401700 -0.058800 -0.096000 -0.136000 0.984000 +-0.200000 -0.451900 -0.018000 0.376000 -0.112000 0.912000 +-0.250000 -0.451900 -0.040500 -0.352000 -0.008000 0.928000 +-0.250000 -0.451900 -0.040500 -0.352000 -0.008000 0.928000 +-0.200000 0.150600 -0.023100 -0.360000 0.472000 0.792000 +-0.200000 0.150600 -0.023100 -0.360000 0.472000 0.792000 +-0.200000 0.100400 -0.008800 0.176000 0.488000 0.848000 +-0.150000 0.150600 -0.037800 0.256000 -0.016000 0.960000 +-0.150000 0.100400 -0.027500 0.432000 0.296000 0.848000 +-0.114400 0.150600 -0.060900 0.520000 -0.344000 0.776000 +-0.122500 0.100400 -0.060900 0.768000 -0.048000 0.624000 +-0.100000 0.150600 -0.075000 0.592000 -0.416000 0.688000 +-0.100000 0.100400 -0.099400 0.760000 -0.264000 0.584000 +-0.067900 0.150600 -0.121900 0.736000 -0.432000 0.504000 +-0.089100 0.100400 -0.121900 0.816000 -0.232000 0.520000 +-0.050000 0.150600 -0.159500 0.712000 -0.480000 0.504000 +-0.053800 0.100400 -0.182900 0.984000 -0.072000 0.112000 +-0.050000 0.116900 -0.182900 0.944000 -0.304000 0.048000 +-0.051400 0.100400 -0.243900 0.776000 0.216000 -0.576000 +-0.050000 0.150600 -0.210200 0.840000 -0.208000 -0.496000 +-0.077600 0.150600 -0.243900 0.320000 0.328000 -0.880000 +-0.051400 0.100400 -0.243900 0.776000 0.216000 -0.576000 +-0.100000 0.150600 -0.251000 -0.024000 0.408000 -0.904000 +-0.100000 0.100400 -0.276400 0.032000 0.376000 -0.920000 +-0.126800 0.150600 -0.243900 -0.208000 0.496000 -0.832000 +-0.150000 0.100400 -0.267100 -0.312000 0.440000 -0.832000 +-0.150000 0.141700 -0.243900 -0.352000 0.528000 -0.768000 +-0.198500 0.100400 -0.243900 -0.376000 0.480000 -0.784000 +-0.150000 0.100400 -0.267100 -0.312000 0.440000 -0.832000 +-0.200000 0.099300 -0.243900 -0.456000 0.488000 -0.736000 +-0.150000 0.050200 -0.299600 -0.080000 0.408000 -0.904000 +-0.200000 0.050200 -0.277000 -0.312000 0.416000 -0.848000 +-0.150000 0.040500 -0.304800 -0.136000 0.416000 -0.896000 +-0.200000 0.008900 -0.304800 -0.304000 0.456000 -0.832000 +-0.150000 0.000000 -0.322200 0.064000 0.240000 -0.968000 +-0.200000 0.000000 -0.310700 -0.288000 0.424000 -0.848000 +-0.150000 -0.050200 -0.328000 0.128000 0.064000 -0.984000 +-0.200000 -0.050200 -0.330400 -0.144000 0.264000 -0.944000 +-0.150000 -0.100400 -0.338700 0.056000 -0.088000 -0.992000 +-0.200000 -0.100400 -0.330100 -0.024000 -0.008000 -0.992000 +-0.150000 -0.150600 -0.309500 -0.032000 -0.400000 -0.912000 +-0.200000 -0.150600 -0.333300 0.216000 -0.272000 -0.936000 +-0.200000 -0.100400 -0.330100 -0.024000 -0.008000 -0.992000 +-0.250000 -0.150600 -0.327500 -0.120000 0.152000 -0.976000 +-0.250000 -0.100400 -0.327300 -0.384000 0.152000 -0.904000 +-0.200000 -0.100400 -0.330100 -0.024000 -0.008000 -0.992000 +-0.250000 -0.050200 -0.318700 -0.440000 0.320000 -0.832000 +-0.200000 -0.050200 -0.330400 -0.144000 0.264000 -0.944000 +-0.250000 -0.028200 -0.304800 -0.400000 0.416000 -0.808000 +-0.200000 0.000000 -0.310700 -0.288000 0.424000 -0.848000 +-0.213400 0.000000 -0.304800 -0.304000 0.448000 -0.832000 +-0.200000 0.008900 -0.304800 -0.304000 0.456000 -0.832000 +-0.250000 0.000000 -0.286200 -0.320000 0.712000 -0.616000 +-0.200000 0.050200 -0.277000 -0.312000 0.416000 -0.848000 +-0.250000 0.050200 -0.254100 -0.584000 0.656000 -0.464000 +-0.200000 0.099300 -0.243900 -0.456000 0.488000 -0.736000 +-0.250000 0.055800 -0.243900 -0.560000 0.648000 -0.504000 +-0.250000 0.050200 -0.254100 -0.584000 0.656000 -0.464000 +-0.256300 0.050200 -0.243900 -0.592000 0.624000 -0.488000 +-0.256300 0.050200 -0.243900 -0.592000 0.624000 -0.488000 +-0.200000 -0.502100 -0.039000 0.512000 -0.608000 0.592000 +-0.200000 -0.502100 -0.039000 0.512000 -0.608000 0.592000 +-0.181900 -0.502100 -0.060900 0.504000 -0.680000 0.520000 +-0.200000 -0.511900 -0.060900 0.416000 -0.800000 0.424000 +-0.200000 -0.511900 -0.060900 0.416000 -0.800000 0.424000 +-0.100000 0.401700 -0.042400 0.232000 -0.088000 0.960000 +-0.100000 0.401700 -0.042400 0.232000 -0.088000 0.960000 +-0.150000 0.401700 -0.011900 0.240000 0.256000 0.928000 +-0.100000 0.351500 -0.035500 0.120000 0.000000 0.992000 +-0.150000 0.351500 -0.029900 0.096000 -0.168000 0.976000 +-0.100000 0.301200 -0.032000 0.168000 0.008000 0.984000 +-0.150000 0.301200 -0.033800 0.040000 -0.024000 0.992000 +-0.100000 0.251000 -0.029400 0.344000 -0.104000 0.928000 +-0.150000 0.251000 -0.027500 -0.136000 -0.104000 0.984000 +-0.100000 0.200800 -0.041900 0.456000 -0.304000 0.832000 +-0.150000 0.200800 -0.027500 -0.320000 -0.168000 0.928000 +-0.100000 0.167200 -0.060900 0.520000 -0.424000 0.736000 +-0.150000 0.150600 -0.037800 0.256000 -0.016000 0.960000 +-0.114400 0.150600 -0.060900 0.520000 -0.344000 0.776000 +-0.100000 0.167200 -0.060900 0.520000 -0.424000 0.736000 +-0.100000 0.150600 -0.075000 0.592000 -0.416000 0.688000 +-0.078700 0.200800 -0.060900 0.568000 -0.416000 0.704000 +-0.067900 0.150600 -0.121900 0.736000 -0.432000 0.504000 +-0.050000 0.200800 -0.090500 0.520000 -0.520000 0.672000 +-0.050000 0.170300 -0.121900 0.584000 -0.576000 0.560000 +-0.067900 0.150600 -0.121900 0.736000 -0.432000 0.504000 +-0.050000 0.150600 -0.159500 0.712000 -0.480000 0.504000 +-0.050000 0.150600 -0.159500 0.712000 -0.480000 0.504000 +-0.150000 0.100400 -0.027500 0.432000 0.296000 0.848000 +-0.150000 0.100400 -0.027500 0.432000 0.296000 0.848000 +-0.150000 0.050200 -0.012600 0.624000 0.240000 0.728000 +-0.122500 0.100400 -0.060900 0.768000 -0.048000 0.624000 +-0.123500 0.050200 -0.060900 0.888000 -0.104000 0.440000 +-0.100000 0.100400 -0.099400 0.760000 -0.264000 0.584000 +-0.100700 0.050200 -0.121900 0.856000 0.048000 0.504000 +-0.100000 0.054100 -0.121900 0.816000 -0.176000 0.544000 +-0.100000 0.050200 -0.123300 0.696000 -0.176000 0.688000 +-0.089100 0.100400 -0.121900 0.816000 -0.232000 0.520000 +-0.051100 0.050200 -0.182900 0.712000 0.184000 0.664000 +-0.053800 0.100400 -0.182900 0.984000 -0.072000 0.112000 +-0.050000 0.050200 -0.189300 0.800000 0.488000 0.336000 +-0.051400 0.100400 -0.243900 0.776000 0.216000 -0.576000 +-0.050000 0.095100 -0.243900 0.808000 0.256000 -0.520000 +-0.100000 0.100400 -0.276400 0.032000 0.376000 -0.920000 +-0.050000 0.050200 -0.257500 0.608000 0.208000 -0.760000 +-0.100000 0.050200 -0.292200 0.304000 0.312000 -0.896000 +-0.050000 0.000000 -0.288000 0.256000 0.560000 -0.776000 +-0.100000 0.022400 -0.304800 0.184000 0.304000 -0.928000 +-0.077600 0.000000 -0.304800 0.248000 0.344000 -0.896000 +-0.100000 0.000000 -0.309600 0.168000 0.152000 -0.968000 +-0.050000 -0.015100 -0.304800 0.280000 0.536000 -0.784000 +-0.100000 -0.050200 -0.318600 0.080000 0.144000 -0.984000 +-0.050000 -0.050200 -0.321000 0.120000 0.280000 -0.944000 +-0.100000 -0.100400 -0.323700 -0.040000 -0.152000 -0.984000 +-0.050000 -0.100400 -0.342800 0.056000 -0.032000 -0.992000 +-0.100000 -0.150600 -0.315000 -0.456000 -0.064000 -0.880000 +-0.050000 -0.150600 -0.332400 0.016000 -0.080000 -0.992000 +-0.050000 -0.100400 -0.342800 0.056000 -0.032000 -0.992000 +0.000000 -0.150600 -0.318000 0.160000 0.016000 -0.984000 +0.000000 -0.100400 -0.336000 0.328000 -0.184000 -0.920000 +0.050000 -0.150600 -0.318000 0.352000 0.312000 -0.872000 +0.039400 -0.100400 -0.304800 0.408000 0.224000 -0.880000 +0.050000 -0.119800 -0.304800 0.416000 0.264000 -0.864000 +0.050000 -0.100400 -0.298100 0.360000 0.248000 -0.896000 +0.096000 -0.150600 -0.304800 0.176000 0.336000 -0.920000 +0.100000 -0.100400 -0.298900 0.040000 0.136000 -0.984000 +0.100000 -0.150600 -0.303900 -0.176000 0.088000 -0.976000 +0.114400 -0.100400 -0.304800 -0.344000 0.128000 -0.928000 +0.101900 -0.150600 -0.304800 -0.296000 0.368000 -0.872000 +0.100000 -0.150600 -0.303900 -0.176000 0.088000 -0.976000 +0.100000 -0.151600 -0.304800 -0.176000 0.536000 -0.816000 +0.096000 -0.150600 -0.304800 0.176000 0.336000 -0.920000 +0.096000 -0.150600 -0.304800 0.176000 0.336000 -0.920000 +-0.150000 0.050200 -0.012600 0.624000 0.240000 0.728000 +-0.150000 0.050200 -0.012600 0.624000 0.240000 0.728000 +-0.150000 0.000000 -0.001200 0.744000 0.064000 0.656000 +-0.123500 0.050200 -0.060900 0.888000 -0.104000 0.440000 +-0.120900 0.000000 -0.060900 0.800000 0.080000 0.592000 +-0.100700 0.050200 -0.121900 0.856000 0.048000 0.504000 +-0.100000 0.000000 -0.110200 0.808000 0.176000 0.552000 +-0.100000 0.044900 -0.121900 0.816000 0.112000 0.552000 +-0.089600 0.000000 -0.121900 0.568000 0.512000 0.632000 +-0.100000 0.050200 -0.123300 0.696000 -0.176000 0.688000 +-0.050000 0.000000 -0.158900 0.584000 0.336000 0.728000 +-0.051100 0.050200 -0.182900 0.712000 0.184000 0.664000 +-0.050000 0.047900 -0.182900 0.488000 0.480000 0.720000 +-0.050000 0.050200 -0.189300 0.800000 0.488000 0.336000 +0.000000 0.039200 -0.182900 0.256000 0.544000 0.792000 +0.000000 0.050200 -0.198900 0.168000 0.840000 0.504000 +0.050000 0.005700 -0.182900 0.312000 0.584000 0.744000 +0.046000 0.050200 -0.243900 0.728000 0.480000 -0.472000 +0.050000 0.042300 -0.243900 0.688000 0.376000 -0.616000 +0.000000 0.050200 -0.275900 0.288000 0.416000 -0.856000 +0.050000 0.000000 -0.258500 0.448000 0.256000 -0.848000 +0.000000 0.000000 -0.289100 0.520000 0.272000 -0.800000 +0.050000 -0.050200 -0.279200 0.280000 0.320000 -0.896000 +0.000000 -0.038700 -0.304800 0.368000 0.192000 -0.904000 +0.004800 -0.050200 -0.304800 0.368000 0.176000 -0.904000 +0.000000 -0.050200 -0.306900 0.320000 0.152000 -0.928000 +0.039400 -0.100400 -0.304800 0.408000 0.224000 -0.880000 +0.000000 -0.100400 -0.336000 0.328000 -0.184000 -0.920000 +0.000000 -0.050200 -0.306900 0.320000 0.152000 -0.928000 +-0.050000 -0.100400 -0.342800 0.056000 -0.032000 -0.992000 +-0.050000 -0.050200 -0.321000 0.120000 0.280000 -0.944000 +0.000000 -0.050200 -0.306900 0.320000 0.152000 -0.928000 +-0.050000 -0.015100 -0.304800 0.280000 0.536000 -0.784000 +0.000000 -0.038700 -0.304800 0.368000 0.192000 -0.904000 +-0.050000 0.000000 -0.288000 0.256000 0.560000 -0.776000 +0.000000 0.000000 -0.289100 0.520000 0.272000 -0.800000 +-0.050000 0.050200 -0.257500 0.608000 0.208000 -0.760000 +0.000000 0.050200 -0.275900 0.288000 0.416000 -0.856000 +-0.050000 0.095100 -0.243900 0.808000 0.256000 -0.520000 +0.000000 0.087200 -0.243900 0.456000 0.816000 -0.344000 +-0.050000 0.050200 -0.189300 0.800000 0.488000 0.336000 +0.000000 0.050200 -0.198900 0.168000 0.840000 0.504000 +0.000000 0.087200 -0.243900 0.456000 0.816000 -0.344000 +0.046000 0.050200 -0.243900 0.728000 0.480000 -0.472000 +0.000000 0.050200 -0.275900 0.288000 0.416000 -0.856000 +0.000000 0.050200 -0.275900 0.288000 0.416000 -0.856000 +-0.150000 0.000000 -0.001200 0.744000 0.064000 0.656000 +-0.150000 0.000000 -0.001200 0.744000 0.064000 0.656000 +-0.150000 -0.050200 -0.005700 0.768000 -0.024000 0.632000 +-0.120900 0.000000 -0.060900 0.800000 0.080000 0.592000 +-0.114700 -0.050200 -0.060900 0.632000 0.112000 0.760000 +-0.100000 0.000000 -0.110200 0.808000 0.176000 0.552000 +-0.100000 -0.050200 -0.077100 0.584000 0.232000 0.768000 +-0.089600 0.000000 -0.121900 0.568000 0.512000 0.632000 +-0.050000 -0.050200 -0.098600 0.240000 0.488000 0.832000 +-0.050000 -0.024600 -0.121900 0.296000 0.656000 0.688000 +0.000000 -0.050200 -0.114000 0.064000 0.408000 0.904000 +0.000000 -0.035500 -0.121900 0.072000 0.496000 0.856000 +0.050000 -0.050200 -0.115700 0.016000 0.416000 0.904000 +0.050000 -0.038600 -0.121900 0.000000 0.528000 0.840000 +0.100000 -0.050200 -0.113200 -0.016000 0.464000 0.880000 +0.100000 -0.037100 -0.121900 -0.016000 0.544000 0.832000 +0.150000 -0.050200 -0.113700 0.032000 0.448000 0.888000 +0.150000 -0.036300 -0.121900 0.008000 0.488000 0.864000 +0.100000 -0.037100 -0.121900 -0.016000 0.544000 0.832000 +0.150000 0.000000 -0.166100 -0.096000 0.688000 0.712000 +0.100000 0.000000 -0.179900 0.000000 0.528000 0.840000 +0.150000 0.016800 -0.182900 -0.152000 0.840000 0.520000 +0.100000 0.004900 -0.182900 -0.288000 0.864000 0.400000 +0.150000 0.015400 -0.243900 -0.208000 0.728000 -0.640000 +0.100000 0.000000 -0.203800 -0.256000 0.936000 -0.224000 +0.113100 0.000000 -0.243900 -0.392000 0.768000 -0.496000 +0.100000 -0.005500 -0.243900 -0.184000 0.760000 -0.616000 +0.150000 0.000000 -0.257100 -0.208000 0.552000 -0.800000 +0.100000 -0.050200 -0.272200 -0.136000 0.384000 -0.904000 +0.150000 -0.050200 -0.298400 -0.176000 0.328000 -0.920000 +0.100000 -0.100400 -0.298900 0.040000 0.136000 -0.984000 +0.150000 -0.064700 -0.304800 -0.200000 0.328000 -0.912000 +0.114400 -0.100400 -0.304800 -0.344000 0.128000 -0.928000 +0.114400 -0.100400 -0.304800 -0.344000 0.128000 -0.928000 +-0.150000 -0.050200 -0.005700 0.768000 -0.024000 0.632000 +-0.150000 -0.050200 -0.005700 0.768000 -0.024000 0.632000 +-0.150000 -0.100400 -0.001300 0.848000 0.032000 0.520000 +-0.114700 -0.050200 -0.060900 0.632000 0.112000 0.760000 +-0.104300 -0.100400 -0.060900 0.528000 0.416000 0.728000 +-0.100000 -0.050200 -0.077100 0.584000 0.232000 0.768000 +-0.100000 -0.100400 -0.064700 0.496000 0.416000 0.752000 +-0.050000 -0.050200 -0.098600 0.240000 0.488000 0.832000 +-0.050000 -0.100400 -0.073900 0.136000 0.480000 0.864000 +0.000000 -0.050200 -0.114000 0.064000 0.408000 0.904000 +0.000000 -0.100400 -0.085100 0.096000 0.456000 0.880000 +0.050000 -0.050200 -0.115700 0.016000 0.416000 0.904000 +0.050000 -0.100400 -0.083400 0.000000 0.440000 0.888000 +0.100000 -0.050200 -0.113200 -0.016000 0.464000 0.880000 +0.100000 -0.100400 -0.084200 0.032000 0.360000 0.928000 +0.150000 -0.050200 -0.113700 0.032000 0.448000 0.888000 +0.150000 -0.100400 -0.080500 0.184000 0.336000 0.920000 +0.100000 -0.100400 -0.084200 0.032000 0.360000 0.928000 +0.150000 -0.150600 -0.071000 0.136000 0.176000 0.968000 +0.100000 -0.150600 -0.068400 0.184000 0.416000 0.888000 +0.150000 -0.200800 -0.071800 0.312000 -0.208000 0.920000 +0.100000 -0.170000 -0.060900 0.256000 0.296000 0.912000 +0.130700 -0.200800 -0.060900 0.504000 0.008000 0.856000 +0.150000 -0.200800 -0.071800 0.312000 -0.208000 0.920000 +0.110300 -0.251000 -0.060900 0.504000 -0.760000 0.392000 +0.150000 -0.251000 -0.118100 0.224000 -0.792000 0.560000 +0.150000 -0.251000 -0.118100 0.224000 -0.792000 0.560000 +-0.100000 -0.188700 0.000000 0.176000 0.408000 0.888000 +-0.100000 -0.188700 0.000000 0.176000 0.408000 0.888000 +-0.129500 -0.150600 0.000000 0.416000 0.264000 0.864000 +-0.100000 -0.150600 -0.019000 0.512000 0.456000 0.720000 +-0.100000 -0.150600 -0.019000 0.512000 0.456000 0.720000 +-0.150000 -0.346200 0.000000 -0.392000 -0.160000 0.904000 +-0.150000 -0.346200 0.000000 -0.392000 -0.160000 0.904000 +-0.150000 -0.351500 -0.001100 -0.192000 -0.352000 0.912000 +-0.100000 -0.344900 0.000000 0.072000 -0.528000 0.840000 +-0.100000 -0.351500 -0.005700 0.248000 -0.576000 0.776000 +-0.050000 -0.329200 0.000000 0.264000 -0.624000 0.720000 +-0.050000 -0.351500 -0.027000 0.488000 -0.688000 0.528000 +-0.100000 -0.351500 -0.005700 0.248000 -0.576000 0.776000 +-0.050000 -0.370100 -0.060900 0.592000 -0.672000 0.424000 +-0.100000 -0.401700 -0.044900 0.592000 -0.496000 0.624000 +-0.087700 -0.401700 -0.060900 0.608000 -0.600000 0.504000 +-0.100000 -0.415900 -0.060900 0.680000 -0.544000 0.480000 +-0.054100 -0.401700 -0.121900 0.656000 -0.688000 0.280000 +-0.100000 -0.451900 -0.117700 0.624000 -0.664000 0.392000 +-0.098000 -0.451900 -0.121900 0.712000 -0.680000 0.120000 +-0.100000 -0.453500 -0.121900 0.600000 -0.776000 0.168000 +-0.098100 -0.451900 -0.182900 0.736000 -0.672000 0.032000 +-0.100000 -0.453800 -0.182900 0.696000 -0.712000 0.024000 +-0.094700 -0.451900 -0.243900 0.784000 -0.568000 0.216000 +-0.100000 -0.458900 -0.243900 0.744000 -0.632000 0.192000 +-0.061500 -0.451900 -0.304800 0.928000 -0.352000 0.088000 +-0.100000 -0.502100 -0.283200 0.616000 -0.376000 0.680000 +-0.074100 -0.502100 -0.304800 0.864000 -0.480000 0.112000 +-0.100000 -0.549700 -0.304800 0.696000 -0.392000 0.592000 +-0.100000 -0.502100 -0.325200 0.520000 -0.368000 -0.760000 +-0.101500 -0.552300 -0.304800 0.552000 -0.392000 0.720000 +-0.147100 -0.502100 -0.365800 0.472000 -0.192000 -0.848000 +-0.150000 -0.552300 -0.337600 0.424000 -0.304000 -0.840000 +-0.150000 -0.505900 -0.365800 0.272000 -0.320000 -0.904000 +-0.196100 -0.552300 -0.365800 0.320000 -0.272000 -0.904000 +-0.150000 -0.502100 -0.367300 0.088000 -0.320000 -0.936000 +-0.200000 -0.552300 -0.367100 0.360000 -0.232000 -0.896000 +-0.200000 -0.502100 -0.370700 0.184000 -0.352000 -0.912000 +-0.200000 -0.502100 -0.370700 0.184000 -0.352000 -0.912000 +-0.100000 -0.351500 -0.005700 0.248000 -0.576000 0.776000 +-0.100000 -0.351500 -0.005700 0.248000 -0.576000 0.776000 +-0.150000 -0.351500 -0.001100 -0.192000 -0.352000 0.912000 +-0.100000 -0.401700 -0.044900 0.592000 -0.496000 0.624000 +-0.150000 -0.401700 -0.019000 0.408000 -0.232000 0.880000 +-0.100000 -0.415900 -0.060900 0.680000 -0.544000 0.480000 +-0.150000 -0.451900 -0.041900 0.560000 -0.440000 0.696000 +-0.133200 -0.451900 -0.060900 0.584000 -0.656000 0.464000 +-0.150000 -0.470000 -0.060900 0.568000 -0.552000 0.600000 +-0.100000 -0.451900 -0.117700 0.624000 -0.664000 0.392000 +-0.150000 -0.502100 -0.111600 0.592000 -0.752000 0.280000 +-0.100000 -0.453500 -0.121900 0.600000 -0.776000 0.168000 +-0.146100 -0.502100 -0.121900 0.616000 -0.744000 0.232000 +-0.100000 -0.453800 -0.182900 0.696000 -0.712000 0.024000 +-0.141200 -0.502100 -0.182900 0.696000 -0.688000 0.184000 +-0.100000 -0.458900 -0.243900 0.744000 -0.632000 0.192000 +-0.125700 -0.502100 -0.243900 0.664000 -0.408000 0.624000 +-0.100000 -0.502100 -0.283200 0.616000 -0.376000 0.680000 +-0.150000 -0.530700 -0.243900 0.632000 -0.664000 0.392000 +-0.100000 -0.549700 -0.304800 0.696000 -0.392000 0.592000 +-0.150000 -0.552300 -0.270100 0.544000 -0.504000 0.656000 +-0.101500 -0.552300 -0.304800 0.552000 -0.392000 0.720000 +-0.150000 -0.602500 -0.302600 0.392000 -0.240000 0.880000 +-0.145700 -0.602500 -0.304800 0.824000 -0.528000 0.192000 +-0.150000 -0.609400 -0.304800 0.840000 -0.512000 0.152000 +-0.150000 -0.602500 -0.307600 0.456000 -0.280000 -0.840000 +-0.145700 -0.602500 -0.304800 0.824000 -0.528000 0.192000 +-0.150000 -0.552300 -0.337600 0.424000 -0.304000 -0.840000 +-0.101500 -0.552300 -0.304800 0.552000 -0.392000 0.720000 +-0.101500 -0.552300 -0.304800 0.552000 -0.392000 0.720000 +-0.050000 0.401700 -0.052300 0.176000 0.040000 0.976000 +-0.050000 0.401700 -0.052300 0.176000 0.040000 0.976000 +-0.100000 0.401700 -0.042400 0.232000 -0.088000 0.960000 +-0.050000 0.351500 -0.043600 0.248000 0.032000 0.960000 +-0.100000 0.351500 -0.035500 0.120000 0.000000 0.992000 +-0.050000 0.301200 -0.044600 0.440000 -0.008000 0.896000 +-0.100000 0.301200 -0.032000 0.168000 0.008000 0.984000 +-0.050000 0.251000 -0.047300 0.528000 -0.360000 0.760000 +-0.100000 0.251000 -0.029400 0.344000 -0.104000 0.928000 +-0.050000 0.236000 -0.060900 0.536000 -0.496000 0.672000 +-0.100000 0.200800 -0.041900 0.456000 -0.304000 0.832000 +-0.078700 0.200800 -0.060900 0.568000 -0.416000 0.704000 +-0.100000 0.167200 -0.060900 0.520000 -0.424000 0.736000 +-0.100000 0.167200 -0.060900 0.520000 -0.424000 0.736000 +-0.027600 0.301200 -0.060900 0.456000 -0.208000 0.856000 +-0.027600 0.301200 -0.060900 0.456000 -0.208000 0.856000 +-0.050000 0.301200 -0.044600 0.440000 -0.008000 0.896000 +-0.035000 0.251000 -0.060900 0.512000 -0.448000 0.728000 +-0.050000 0.251000 -0.047300 0.528000 -0.360000 0.760000 +-0.050000 0.236000 -0.060900 0.536000 -0.496000 0.672000 +-0.050000 0.236000 -0.060900 0.536000 -0.496000 0.672000 +-0.002200 -0.301200 0.000000 0.384000 -0.648000 0.648000 +-0.002200 -0.301200 0.000000 0.384000 -0.648000 0.648000 +0.000000 -0.299000 0.000000 0.440000 -0.464000 0.760000 +0.000000 -0.301200 -0.001900 0.408000 -0.704000 0.568000 +0.050000 -0.253500 0.000000 0.448000 -0.608000 0.648000 +0.032200 -0.301200 -0.060900 0.552000 -0.696000 0.448000 +0.050000 -0.286400 -0.060900 0.528000 -0.720000 0.440000 +0.050000 -0.301200 -0.085900 0.528000 -0.704000 0.464000 +0.050000 -0.301200 -0.085900 0.528000 -0.704000 0.464000 +-0.050000 -0.351500 -0.027000 0.488000 -0.688000 0.528000 +-0.050000 -0.351500 -0.027000 0.488000 -0.688000 0.528000 +-0.029100 -0.351500 -0.060900 0.584000 -0.680000 0.424000 +-0.050000 -0.370100 -0.060900 0.592000 -0.672000 0.424000 +0.000000 -0.351500 -0.112600 0.544000 -0.704000 0.448000 +-0.050000 -0.398200 -0.121900 0.592000 -0.704000 0.368000 +0.000000 -0.356400 -0.121900 0.560000 -0.728000 0.384000 +-0.050000 -0.389600 -0.182900 0.656000 -0.736000 -0.128000 +0.000000 -0.353400 -0.182900 0.520000 -0.832000 -0.160000 +-0.050000 -0.380500 -0.243900 0.664000 -0.736000 -0.104000 +0.000000 -0.351500 -0.193300 0.504000 -0.832000 -0.176000 +-0.013800 -0.351500 -0.243900 0.552000 -0.808000 -0.168000 +0.000000 -0.343100 -0.243900 0.464000 -0.864000 -0.160000 +-0.026900 -0.351500 -0.304800 0.608000 -0.688000 -0.384000 +0.000000 -0.336000 -0.304800 0.392000 -0.872000 -0.264000 +-0.050000 -0.351500 -0.336900 0.024000 -0.576000 -0.808000 +0.000000 -0.316900 -0.365800 0.224000 -0.832000 -0.496000 +-0.050000 -0.309800 -0.365800 -0.336000 -0.416000 -0.840000 +0.000000 -0.301200 -0.413400 -0.392000 -0.192000 -0.896000 +-0.050000 -0.301200 -0.370400 -0.392000 -0.264000 -0.872000 +0.000000 -0.251000 -0.386300 -0.352000 0.496000 -0.792000 +-0.050000 -0.266900 -0.365800 -0.288000 0.088000 -0.944000 +-0.044700 -0.251000 -0.365800 -0.216000 0.376000 -0.896000 +-0.050000 -0.251000 -0.364300 -0.216000 0.352000 -0.904000 +0.000000 -0.238800 -0.365800 -0.192000 0.648000 -0.728000 +-0.050000 -0.200800 -0.320900 -0.056000 0.280000 -0.952000 +0.000000 -0.200800 -0.332000 -0.296000 0.528000 -0.784000 +0.000000 -0.238800 -0.365800 -0.192000 0.648000 -0.728000 +0.050000 -0.200800 -0.360800 -0.016000 0.576000 -0.808000 +0.050000 -0.206300 -0.365800 -0.112000 0.608000 -0.776000 +0.000000 -0.238800 -0.365800 -0.192000 0.648000 -0.728000 +0.050000 -0.251000 -0.406500 0.232000 -0.312000 -0.912000 +0.000000 -0.251000 -0.386300 -0.352000 0.496000 -0.792000 +0.050000 -0.301200 -0.369000 0.376000 -0.768000 -0.512000 +0.000000 -0.301200 -0.413400 -0.392000 -0.192000 -0.896000 +0.050000 -0.303000 -0.365800 0.400000 -0.792000 -0.448000 +0.000000 -0.316900 -0.365800 0.224000 -0.832000 -0.496000 +0.050000 -0.326800 -0.304800 0.424000 -0.880000 -0.184000 +0.000000 -0.336000 -0.304800 0.392000 -0.872000 -0.264000 +0.050000 -0.327900 -0.243900 0.480000 -0.872000 0.000000 +0.000000 -0.343100 -0.243900 0.464000 -0.864000 -0.160000 +0.050000 -0.327900 -0.182900 0.552000 -0.824000 0.048000 +0.000000 -0.351500 -0.193300 0.504000 -0.832000 -0.176000 +0.003100 -0.351500 -0.182900 0.504000 -0.840000 -0.160000 +0.000000 -0.353400 -0.182900 0.520000 -0.832000 -0.160000 +0.006400 -0.351500 -0.121900 0.552000 -0.776000 0.288000 +0.000000 -0.356400 -0.121900 0.560000 -0.728000 0.384000 +0.000000 -0.351500 -0.112600 0.544000 -0.704000 0.448000 +0.000000 -0.351500 -0.112600 0.544000 -0.704000 0.448000 +0.000000 0.351500 -0.051600 0.280000 -0.248000 0.920000 +0.000000 0.351500 -0.051600 0.280000 -0.248000 0.920000 +0.000000 0.393800 -0.060900 0.224000 0.176000 0.952000 +0.042100 0.351500 -0.060900 0.160000 -0.080000 0.976000 +0.000000 0.401700 -0.062800 0.256000 0.176000 0.944000 +0.050000 0.351500 -0.062500 0.000000 -0.264000 0.960000 +0.050000 0.401700 -0.062500 -0.008000 0.136000 0.984000 +0.065700 0.351500 -0.060900 -0.064000 -0.312000 0.944000 +0.100000 0.401700 -0.066700 -0.048000 0.000000 0.992000 +0.100000 0.368600 -0.060900 0.104000 0.120000 0.984000 +0.150000 0.401700 -0.062100 -0.392000 -0.400000 0.816000 +0.111400 0.351500 -0.060900 0.184000 -0.224000 0.952000 +0.150000 0.351500 -0.070300 -0.056000 -0.480000 0.872000 +0.100000 0.345700 -0.060900 0.056000 -0.392000 0.912000 +0.150000 0.301200 -0.094700 0.096000 -0.408000 0.904000 +0.100000 0.301200 -0.081200 0.144000 -0.392000 0.904000 +0.150000 0.253300 -0.121900 0.144000 -0.672000 0.712000 +0.100000 0.251000 -0.119300 0.048000 -0.664000 0.736000 +0.134200 0.251000 -0.121900 0.072000 -0.752000 0.648000 +0.100000 0.248700 -0.121900 0.064000 -0.824000 0.552000 +0.150000 0.251000 -0.128300 0.144000 -0.904000 0.392000 +0.100000 0.246100 -0.182900 0.136000 -0.488000 -0.856000 +0.150000 0.224100 -0.182900 0.056000 -0.672000 -0.728000 +0.100000 0.251000 -0.185300 0.160000 -0.296000 -0.936000 +0.150000 0.251000 -0.192500 0.112000 0.024000 -0.992000 +0.100000 0.301200 -0.188500 0.112000 0.128000 -0.984000 +0.150000 0.284700 -0.182900 0.352000 0.368000 -0.856000 +0.133500 0.301200 -0.182900 0.272000 0.264000 -0.920000 +0.150000 0.251000 -0.128300 0.144000 -0.904000 0.392000 +0.150000 0.301200 -0.172900 0.456000 0.432000 -0.768000 +0.134200 0.251000 -0.121900 0.072000 -0.752000 0.648000 +0.150000 0.253300 -0.121900 0.144000 -0.672000 0.712000 +0.150000 0.301200 -0.172900 0.456000 0.432000 -0.768000 +0.200000 0.269500 -0.121900 -0.008000 -0.896000 0.432000 +0.200000 0.301200 -0.179700 -0.152000 -0.352000 -0.920000 +0.250000 0.256500 -0.121900 -0.200000 -0.800000 0.552000 +0.215700 0.301200 -0.182900 -0.120000 -0.160000 -0.976000 +0.250000 0.284000 -0.182900 -0.096000 -0.256000 -0.952000 +0.250000 0.301200 -0.184400 -0.080000 -0.056000 -0.992000 +0.215700 0.301200 -0.182900 -0.120000 -0.160000 -0.976000 +0.250000 0.351500 -0.189100 -0.160000 0.168000 -0.968000 +0.226900 0.351500 -0.182900 -0.224000 0.192000 -0.952000 +0.250000 0.370000 -0.182900 -0.184000 0.304000 -0.928000 +0.200000 0.351500 -0.169700 -0.320000 0.304000 -0.888000 +0.250000 0.401700 -0.172700 -0.016000 0.288000 -0.952000 +0.200000 0.401700 -0.169400 -0.056000 0.168000 -0.976000 +0.250000 0.451900 -0.137900 0.128000 0.536000 -0.824000 +0.200000 0.451900 -0.151000 0.136000 0.400000 -0.896000 +0.250000 0.466900 -0.121900 0.232000 0.968000 0.016000 +0.200000 0.484800 -0.121900 0.312000 0.872000 0.360000 +0.250000 0.451900 -0.094000 0.248000 0.784000 0.552000 +0.200000 0.453000 -0.060900 0.112000 0.728000 0.672000 +0.203100 0.451900 -0.060900 0.264000 0.672000 0.680000 +0.200000 0.451900 -0.059700 0.136000 0.632000 0.760000 +0.250000 0.432000 -0.060900 0.224000 0.624000 0.736000 +0.200000 0.401700 -0.033800 -0.352000 0.000000 0.928000 +0.250000 0.401700 -0.026800 -0.216000 0.176000 0.952000 +0.200000 0.352900 -0.060900 -0.368000 -0.496000 0.776000 +0.250000 0.351500 -0.020200 -0.488000 -0.416000 0.760000 +0.201200 0.351500 -0.060900 -0.488000 -0.576000 0.648000 +0.250000 0.317900 -0.060900 -0.432000 -0.680000 0.584000 +0.200000 0.351500 -0.062100 -0.312000 -0.640000 0.696000 +0.250000 0.301200 -0.083600 -0.096000 -0.744000 0.648000 +0.200000 0.301200 -0.098800 -0.120000 -0.584000 0.800000 +0.250000 0.256500 -0.121900 -0.200000 -0.800000 0.552000 +0.200000 0.269500 -0.121900 -0.008000 -0.896000 0.432000 +0.200000 0.301200 -0.098800 -0.120000 -0.584000 0.800000 +0.150000 0.253300 -0.121900 0.144000 -0.672000 0.712000 +0.150000 0.301200 -0.094700 0.096000 -0.408000 0.904000 +0.200000 0.301200 -0.098800 -0.120000 -0.584000 0.800000 +0.150000 0.351500 -0.070300 -0.056000 -0.480000 0.872000 +0.200000 0.351500 -0.062100 -0.312000 -0.640000 0.696000 +0.150000 0.401700 -0.062100 -0.392000 -0.400000 0.816000 +0.200000 0.352900 -0.060900 -0.368000 -0.496000 0.776000 +0.151400 0.401700 -0.060900 -0.480000 -0.416000 0.760000 +0.200000 0.401700 -0.033800 -0.352000 0.000000 0.928000 +0.150000 0.409600 -0.060900 -0.208000 -0.072000 0.968000 +0.200000 0.451900 -0.059700 0.136000 0.632000 0.760000 +0.150000 0.451900 -0.057100 -0.080000 0.496000 0.856000 +0.200000 0.453000 -0.060900 0.112000 0.728000 0.672000 +0.150000 0.456100 -0.060900 0.048000 0.664000 0.736000 +0.200000 0.484800 -0.121900 0.312000 0.872000 0.360000 +0.150000 0.502100 -0.119700 0.016000 0.656000 0.752000 +0.153400 0.502100 -0.121900 0.448000 0.824000 -0.336000 +0.150000 0.503100 -0.121900 0.272000 0.456000 -0.840000 +0.150000 0.502100 -0.123200 0.032000 0.424000 -0.896000 +0.138500 0.502100 -0.121900 -0.184000 0.952000 -0.216000 +0.150000 0.451900 -0.151900 0.184000 0.376000 -0.904000 +0.100000 0.494400 -0.121900 -0.184000 0.952000 -0.216000 +0.100000 0.451900 -0.146900 -0.088000 0.224000 -0.968000 +0.050000 0.485400 -0.121900 -0.032000 0.904000 -0.408000 +0.050000 0.451900 -0.139600 -0.080000 0.232000 -0.960000 +0.000000 0.493800 -0.121900 0.128000 0.960000 -0.232000 +0.000000 0.451900 -0.135500 0.000000 0.160000 -0.984000 +-0.050000 0.500300 -0.121900 -0.104000 0.896000 -0.424000 +-0.050000 0.451900 -0.137500 0.040000 0.112000 -0.992000 +-0.100000 0.479800 -0.121900 -0.288000 0.584000 -0.752000 +-0.100000 0.451900 -0.142300 -0.128000 0.312000 -0.936000 +-0.150000 0.453400 -0.121900 -0.320000 0.624000 -0.704000 +-0.150000 0.451900 -0.123200 -0.344000 0.512000 -0.784000 +-0.152100 0.451900 -0.121900 -0.424000 0.536000 -0.720000 +-0.150000 0.401700 -0.148200 -0.240000 0.400000 -0.872000 +-0.200000 0.409200 -0.121900 -0.400000 0.464000 -0.776000 +-0.200000 0.401700 -0.127400 -0.400000 0.440000 -0.800000 +-0.208300 0.401700 -0.121900 -0.432000 0.432000 -0.784000 +-0.200000 0.351500 -0.146000 -0.416000 0.224000 -0.872000 +-0.233300 0.351500 -0.121900 -0.616000 0.184000 -0.752000 +-0.200000 0.301200 -0.154100 -0.392000 0.112000 -0.904000 +-0.245300 0.301200 -0.121900 -0.680000 0.120000 -0.720000 +-0.200000 0.251000 -0.156200 -0.432000 0.168000 -0.880000 +-0.250000 0.268200 -0.121900 -0.464000 0.088000 -0.872000 +-0.250000 0.251000 -0.124000 -0.376000 0.088000 -0.920000 +-0.254200 0.251000 -0.121900 -0.384000 0.088000 -0.912000 +-0.250000 0.200800 -0.129700 -0.392000 0.152000 -0.904000 +-0.263400 0.200800 -0.121900 -0.480000 0.216000 -0.840000 +-0.250000 0.150600 -0.154100 -0.464000 0.344000 -0.808000 +-0.295300 0.150600 -0.121900 -0.728000 0.520000 -0.432000 +-0.250000 0.100400 -0.182000 -0.504000 0.488000 -0.704000 +-0.300000 0.144000 -0.121900 -0.728000 0.496000 -0.456000 +-0.300000 0.100400 -0.141500 -0.560000 0.512000 -0.640000 +-0.250000 0.100400 -0.182000 -0.504000 0.488000 -0.704000 +-0.300000 0.052000 -0.182900 -0.664000 0.464000 -0.568000 +-0.250000 0.099600 -0.182900 -0.488000 0.616000 -0.608000 +-0.250000 0.100400 -0.182000 -0.504000 0.488000 -0.704000 +-0.249100 0.100400 -0.182900 -0.576000 0.496000 -0.640000 +-0.250000 0.150600 -0.154100 -0.464000 0.344000 -0.808000 +-0.216700 0.150600 -0.182900 -0.560000 0.376000 -0.728000 +-0.250000 0.200800 -0.129700 -0.392000 0.152000 -0.904000 +-0.200000 0.172600 -0.182900 -0.488000 0.416000 -0.760000 +-0.200000 0.200800 -0.161600 -0.480000 0.384000 -0.776000 +-0.173800 0.200800 -0.182900 -0.480000 0.344000 -0.800000 +-0.200000 0.251000 -0.156200 -0.432000 0.168000 -0.880000 +-0.153800 0.251000 -0.182900 -0.312000 0.176000 -0.928000 +-0.200000 0.301200 -0.154100 -0.392000 0.112000 -0.904000 +-0.150000 0.257900 -0.182900 -0.288000 0.168000 -0.936000 +-0.150000 0.301200 -0.169700 -0.080000 0.248000 -0.960000 +-0.100000 0.273500 -0.182900 -0.112000 0.208000 -0.968000 +-0.100000 0.301200 -0.172200 -0.168000 0.416000 -0.888000 +-0.058500 0.301200 -0.182900 -0.128000 0.320000 -0.936000 +-0.100000 0.351500 -0.158200 0.008000 0.264000 -0.960000 +-0.050000 0.304700 -0.182900 -0.120000 0.336000 -0.928000 +-0.050000 0.351500 -0.155800 -0.048000 0.328000 -0.936000 +0.000000 0.313300 -0.182900 -0.064000 0.304000 -0.944000 +0.000000 0.351500 -0.164900 -0.080000 0.368000 -0.920000 +0.050000 0.327400 -0.182900 -0.016000 0.344000 -0.936000 +0.050000 0.351500 -0.166400 0.000000 0.392000 -0.912000 +0.100000 0.320500 -0.182900 0.096000 0.312000 -0.936000 +0.100000 0.351500 -0.169000 0.056000 0.272000 -0.952000 +0.133500 0.301200 -0.182900 0.272000 0.264000 -0.920000 +0.150000 0.351500 -0.160600 0.144000 0.128000 -0.976000 +0.150000 0.301200 -0.172900 0.456000 0.432000 -0.768000 +0.200000 0.351500 -0.169700 -0.320000 0.304000 -0.888000 +0.200000 0.301200 -0.179700 -0.152000 -0.352000 -0.920000 +0.226900 0.351500 -0.182900 -0.224000 0.192000 -0.952000 +0.215700 0.301200 -0.182900 -0.120000 -0.160000 -0.976000 +0.215700 0.301200 -0.182900 -0.120000 -0.160000 -0.976000 +0.000000 0.351500 -0.051600 0.280000 -0.248000 0.920000 +0.000000 0.351500 -0.051600 0.280000 -0.248000 0.920000 +0.042100 0.351500 -0.060900 0.160000 -0.080000 0.976000 +0.000000 0.334500 -0.060900 0.312000 -0.368000 0.864000 +0.050000 0.351500 -0.062500 0.000000 -0.264000 0.960000 +0.000000 0.301200 -0.076500 0.296000 -0.272000 0.904000 +0.050000 0.301200 -0.074400 0.160000 -0.248000 0.952000 +0.000000 0.251000 -0.086600 0.344000 -0.360000 0.864000 +0.050000 0.251000 -0.100200 0.224000 -0.464000 0.848000 +0.000000 0.211400 -0.121900 0.496000 -0.712000 0.480000 +0.050000 0.230600 -0.121900 0.312000 -0.824000 0.464000 +0.000000 0.200800 -0.169000 0.576000 -0.744000 0.320000 +0.050000 0.219300 -0.182900 0.280000 -0.632000 -0.712000 +0.008500 0.200800 -0.182900 0.416000 -0.688000 -0.584000 +0.050000 0.251000 -0.200200 0.040000 -0.232000 -0.968000 +0.000000 0.200800 -0.186400 0.272000 -0.456000 -0.840000 +0.000000 0.251000 -0.201400 0.024000 -0.152000 -0.984000 +-0.050000 0.200800 -0.204500 0.304000 -0.328000 -0.888000 +-0.050000 0.251000 -0.205600 -0.136000 0.216000 -0.960000 +-0.100000 0.200800 -0.221500 0.056000 0.392000 -0.912000 +-0.100000 0.251000 -0.188700 -0.192000 0.256000 -0.944000 +-0.150000 0.200800 -0.199200 -0.328000 0.272000 -0.896000 +-0.150000 0.251000 -0.184400 -0.280000 0.168000 -0.936000 +-0.173800 0.200800 -0.182900 -0.480000 0.344000 -0.800000 +-0.153800 0.251000 -0.182900 -0.312000 0.176000 -0.928000 +-0.150000 0.251000 -0.184400 -0.280000 0.168000 -0.936000 +-0.150000 0.257900 -0.182900 -0.288000 0.168000 -0.936000 +-0.100000 0.251000 -0.188700 -0.192000 0.256000 -0.944000 +-0.100000 0.273500 -0.182900 -0.112000 0.208000 -0.968000 +-0.050000 0.251000 -0.205600 -0.136000 0.216000 -0.960000 +-0.058500 0.301200 -0.182900 -0.128000 0.320000 -0.936000 +-0.050000 0.301200 -0.184300 -0.112000 0.296000 -0.944000 +-0.050000 0.304700 -0.182900 -0.120000 0.336000 -0.928000 +0.000000 0.301200 -0.186500 -0.056000 0.232000 -0.968000 +0.000000 0.313300 -0.182900 -0.064000 0.304000 -0.944000 +0.050000 0.301200 -0.192400 0.024000 0.192000 -0.976000 +0.050000 0.327400 -0.182900 -0.016000 0.344000 -0.936000 +0.100000 0.301200 -0.188500 0.112000 0.128000 -0.984000 +0.100000 0.320500 -0.182900 0.096000 0.312000 -0.936000 +0.133500 0.301200 -0.182900 0.272000 0.264000 -0.920000 +0.133500 0.301200 -0.182900 0.272000 0.264000 -0.920000 +0.000000 -0.301200 -0.001900 0.408000 -0.704000 0.568000 +0.000000 -0.301200 -0.001900 0.408000 -0.704000 0.568000 +0.032200 -0.301200 -0.060900 0.552000 -0.696000 0.448000 +0.000000 -0.326800 -0.060900 0.344000 -0.824000 0.432000 +0.000000 -0.326800 -0.060900 0.344000 -0.824000 0.432000 +0.065700 0.351500 -0.060900 -0.064000 -0.312000 0.944000 +0.065700 0.351500 -0.060900 -0.064000 -0.312000 0.944000 +0.100000 0.368600 -0.060900 0.104000 0.120000 0.984000 +0.100000 0.351500 -0.058100 0.120000 -0.240000 0.960000 +0.111400 0.351500 -0.060900 0.184000 -0.224000 0.952000 +0.100000 0.345700 -0.060900 0.056000 -0.392000 0.912000 +0.100000 0.351500 -0.058100 0.120000 -0.240000 0.960000 +0.065700 0.351500 -0.060900 -0.064000 -0.312000 0.944000 +0.100000 0.345700 -0.060900 0.056000 -0.392000 0.912000 +0.050000 0.351500 -0.062500 0.000000 -0.264000 0.960000 +0.100000 0.301200 -0.081200 0.144000 -0.392000 0.904000 +0.050000 0.301200 -0.074400 0.160000 -0.248000 0.952000 +0.100000 0.251000 -0.119300 0.048000 -0.664000 0.736000 +0.050000 0.251000 -0.100200 0.224000 -0.464000 0.848000 +0.100000 0.248700 -0.121900 0.064000 -0.824000 0.552000 +0.050000 0.230600 -0.121900 0.312000 -0.824000 0.464000 +0.100000 0.246100 -0.182900 0.136000 -0.488000 -0.856000 +0.050000 0.219300 -0.182900 0.280000 -0.632000 -0.712000 +0.100000 0.251000 -0.185300 0.160000 -0.296000 -0.936000 +0.050000 0.251000 -0.200200 0.040000 -0.232000 -0.968000 +0.100000 0.301200 -0.188500 0.112000 0.128000 -0.984000 +0.050000 0.301200 -0.192400 0.024000 0.192000 -0.976000 +0.050000 0.251000 -0.200200 0.040000 -0.232000 -0.968000 +0.000000 0.301200 -0.186500 -0.056000 0.232000 -0.968000 +0.000000 0.251000 -0.201400 0.024000 -0.152000 -0.984000 +-0.050000 0.301200 -0.184300 -0.112000 0.296000 -0.944000 +-0.050000 0.251000 -0.205600 -0.136000 0.216000 -0.960000 +-0.050000 0.251000 -0.205600 -0.136000 0.216000 -0.960000 +0.150000 0.456100 -0.060900 0.048000 0.664000 0.736000 +0.150000 0.456100 -0.060900 0.048000 0.664000 0.736000 +0.150000 0.451900 -0.057100 -0.080000 0.496000 0.856000 +0.121900 0.451900 -0.060900 -0.112000 0.472000 0.872000 +0.150000 0.409600 -0.060900 -0.208000 -0.072000 0.968000 +0.100000 0.451900 -0.066700 -0.192000 0.072000 0.976000 +0.150000 0.401700 -0.062100 -0.392000 -0.400000 0.816000 +0.100000 0.401700 -0.066700 -0.048000 0.000000 0.992000 +0.100000 0.451900 -0.066700 -0.192000 0.072000 0.976000 +0.050000 0.401700 -0.062500 -0.008000 0.136000 0.984000 +0.050000 0.451900 -0.077800 0.016000 0.408000 0.912000 +0.000000 0.401700 -0.062800 0.256000 0.176000 0.944000 +0.000000 0.451900 -0.081100 0.280000 0.456000 0.832000 +-0.005200 0.401700 -0.060900 0.264000 0.168000 0.944000 +-0.023600 0.451900 -0.060900 0.376000 0.152000 0.904000 +0.000000 0.451900 -0.081100 0.280000 0.456000 0.832000 +-0.033200 0.502100 -0.060900 0.616000 0.496000 0.600000 +0.000000 0.493800 -0.121900 0.128000 0.960000 -0.232000 +-0.050000 0.502100 -0.117100 -0.040000 0.912000 -0.392000 +-0.050000 0.500300 -0.121900 -0.104000 0.896000 -0.424000 +-0.100000 0.502100 -0.081300 -0.184000 0.840000 -0.488000 +-0.100000 0.479800 -0.121900 -0.288000 0.584000 -0.752000 +-0.100000 0.479800 -0.121900 -0.288000 0.584000 -0.752000 +0.350000 0.302200 -0.060900 -0.144000 -0.624000 0.760000 +0.350000 0.302200 -0.060900 -0.144000 -0.624000 0.760000 +0.300000 0.310700 -0.060900 -0.072000 -0.760000 0.640000 +0.350000 0.351500 -0.021800 0.032000 -0.048000 0.992000 +0.300000 0.351500 -0.009100 -0.016000 -0.144000 0.984000 +0.300000 0.351500 -0.009100 -0.016000 -0.144000 0.984000 +0.395100 0.251000 -0.060900 -0.344000 -0.184000 0.912000 +0.395100 0.251000 -0.060900 -0.344000 -0.184000 0.912000 +0.400000 0.251000 -0.058700 -0.328000 -0.176000 0.920000 +0.400000 0.242400 -0.060900 -0.352000 -0.192000 0.904000 +0.400000 0.242400 -0.060900 -0.352000 -0.192000 0.904000 +0.450000 0.401700 -0.038900 -0.120000 0.592000 0.784000 +0.450000 0.401700 -0.038900 -0.120000 0.592000 0.784000 +0.500000 0.401700 -0.057700 0.096000 0.864000 0.480000 +0.450000 0.414500 -0.060900 0.192000 0.928000 0.304000 +0.500000 0.403100 -0.060900 0.112000 0.944000 0.280000 +0.450000 0.422200 -0.121900 0.368000 0.832000 -0.392000 +0.500000 0.401700 -0.069300 0.168000 0.952000 -0.216000 +0.488600 0.401700 -0.121900 0.504000 0.776000 -0.368000 +0.450000 0.422200 -0.121900 0.368000 0.832000 -0.392000 +0.450000 0.401700 -0.160800 0.376000 0.656000 -0.640000 +0.450000 0.401700 -0.160800 0.376000 0.656000 -0.640000 +0.460500 0.150600 -0.060900 -0.624000 -0.512000 0.584000 +0.460500 0.150600 -0.060900 -0.624000 -0.512000 0.584000 +0.500000 0.150600 -0.020200 -0.704000 -0.472000 0.520000 +0.500000 0.107000 -0.060900 -0.608000 -0.480000 0.616000 +0.500000 0.107000 -0.060900 -0.608000 -0.480000 0.616000 +0.500000 0.000000 -0.045100 -0.376000 -0.208000 0.896000 +0.500000 0.000000 -0.045100 -0.376000 -0.208000 0.896000 +0.500000 0.050200 -0.057700 -0.560000 0.128000 0.816000 +0.478700 0.000000 -0.060900 -0.440000 -0.008000 0.888000 +0.495100 0.050200 -0.060900 -0.456000 0.136000 0.872000 +0.450000 0.000000 -0.073300 -0.344000 -0.088000 0.928000 +0.450000 0.050200 -0.077000 -0.360000 0.120000 0.920000 +0.400000 0.000000 -0.102200 -0.272000 0.176000 0.936000 +0.400000 0.050200 -0.114800 -0.552000 0.256000 0.784000 +0.351500 0.000000 -0.121900 -0.376000 0.528000 0.752000 +0.393200 0.050200 -0.121900 -0.648000 0.352000 0.664000 +0.350000 0.000000 -0.123200 -0.512000 0.592000 0.608000 +0.357200 0.050200 -0.182900 -0.736000 0.640000 0.184000 +0.350000 0.043300 -0.182900 -0.488000 0.704000 0.504000 +0.351400 0.050200 -0.243900 -0.480000 0.768000 -0.416000 +0.350000 0.049300 -0.243900 -0.512000 0.784000 -0.320000 +0.350000 0.043300 -0.182900 -0.488000 0.704000 0.504000 +0.300000 0.032100 -0.243900 -0.576000 0.680000 -0.432000 +0.300000 0.018000 -0.182900 -0.296000 0.768000 0.552000 +0.350000 0.043300 -0.182900 -0.488000 0.704000 0.504000 +0.300000 0.000000 -0.166100 -0.488000 0.464000 0.728000 +0.350000 0.000000 -0.123200 -0.512000 0.592000 0.608000 +0.300000 -0.050200 -0.130700 -0.504000 0.472000 0.720000 +0.350000 -0.001200 -0.121900 -0.472000 0.472000 0.736000 +0.307700 -0.050200 -0.121900 -0.592000 0.464000 0.648000 +0.350000 -0.050200 -0.093300 -0.312000 0.392000 0.856000 +0.300000 -0.060700 -0.121900 -0.512000 0.456000 0.720000 +0.350000 -0.100400 -0.081200 -0.280000 0.032000 0.952000 +0.300000 -0.100400 -0.098900 -0.360000 0.344000 0.856000 +0.350000 -0.150600 -0.101500 0.088000 -0.352000 0.928000 +0.300000 -0.150600 -0.090800 0.240000 -0.024000 0.968000 +0.350000 -0.182300 -0.121900 -0.032000 -0.520000 0.848000 +0.300000 -0.200800 -0.101500 0.424000 -0.216000 0.872000 +0.329200 -0.200800 -0.121900 0.376000 -0.264000 0.880000 +0.300000 -0.234400 -0.121900 0.104000 -0.472000 0.872000 +0.350000 -0.200800 -0.137500 0.248000 -0.232000 0.936000 +0.300000 -0.251000 -0.132800 -0.224000 -0.464000 0.856000 +0.350000 -0.234100 -0.121900 0.384000 0.224000 0.888000 +0.328900 -0.251000 -0.121900 -0.264000 -0.304000 0.912000 +0.350000 -0.251000 -0.114600 0.576000 -0.200000 0.784000 +0.350000 -0.260400 -0.121900 0.448000 -0.472000 0.752000 +0.354900 -0.251000 -0.121900 0.704000 -0.304000 0.632000 +0.350000 -0.251000 -0.114600 0.576000 -0.200000 0.784000 +0.350000 -0.234100 -0.121900 0.384000 0.224000 0.888000 +0.354900 -0.251000 -0.121900 0.704000 -0.304000 0.632000 +0.350000 -0.200800 -0.137500 0.248000 -0.232000 0.936000 +0.400000 -0.203000 -0.121900 -0.184000 -0.672000 0.712000 +0.391400 -0.200800 -0.121900 -0.176000 -0.648000 0.736000 +0.400000 -0.200800 -0.119100 -0.200000 -0.688000 0.688000 +0.350000 -0.182300 -0.121900 -0.032000 -0.520000 0.848000 +0.400000 -0.150600 -0.068400 -0.344000 -0.312000 0.880000 +0.350000 -0.150600 -0.101500 0.088000 -0.352000 0.928000 +0.400000 -0.100400 -0.080400 -0.024000 0.176000 0.976000 +0.350000 -0.100400 -0.081200 -0.280000 0.032000 0.952000 +0.400000 -0.050200 -0.089900 -0.128000 0.176000 0.968000 +0.350000 -0.050200 -0.093300 -0.312000 0.392000 0.856000 +0.400000 0.000000 -0.102200 -0.272000 0.176000 0.936000 +0.350000 -0.001200 -0.121900 -0.472000 0.472000 0.736000 +0.351500 0.000000 -0.121900 -0.376000 0.528000 0.752000 +0.350000 0.000000 -0.123200 -0.512000 0.592000 0.608000 +0.350000 0.000000 -0.123200 -0.512000 0.592000 0.608000 +0.478700 0.000000 -0.060900 -0.440000 -0.008000 0.888000 +0.478700 0.000000 -0.060900 -0.440000 -0.008000 0.888000 +0.500000 0.000000 -0.045100 -0.376000 -0.208000 0.896000 +0.500000 -0.026100 -0.060900 -0.336000 -0.328000 0.872000 +0.550000 0.000000 -0.046900 0.008000 -0.120000 0.992000 +0.550000 -0.046200 -0.060900 -0.104000 -0.168000 0.976000 +0.600000 0.000000 -0.044900 -0.016000 -0.720000 0.688000 +0.600000 -0.012300 -0.060900 0.104000 -0.576000 0.800000 +0.550000 -0.046200 -0.060900 -0.104000 -0.168000 0.976000 +0.600000 -0.050200 -0.088500 0.448000 -0.400000 0.792000 +0.550000 -0.050200 -0.061500 -0.064000 -0.152000 0.984000 +0.600000 -0.100400 -0.077400 0.584000 0.048000 0.800000 +0.550000 -0.100400 -0.076900 0.056000 0.056000 0.992000 +0.550000 -0.050200 -0.061500 -0.064000 -0.152000 0.984000 +0.500000 -0.100400 -0.086800 -0.048000 0.256000 0.960000 +0.500000 -0.050200 -0.068900 -0.136000 -0.144000 0.976000 +0.450000 -0.100400 -0.078400 -0.088000 0.200000 0.968000 +0.450000 -0.050200 -0.086300 -0.128000 -0.040000 0.984000 +0.400000 -0.100400 -0.080400 -0.024000 0.176000 0.976000 +0.400000 -0.050200 -0.089900 -0.128000 0.176000 0.968000 +0.450000 -0.050200 -0.086300 -0.128000 -0.040000 0.984000 +0.400000 0.000000 -0.102200 -0.272000 0.176000 0.936000 +0.450000 0.000000 -0.073300 -0.344000 -0.088000 0.928000 +0.450000 -0.050200 -0.086300 -0.128000 -0.040000 0.984000 +0.478700 0.000000 -0.060900 -0.440000 -0.008000 0.888000 +0.500000 -0.050200 -0.068900 -0.136000 -0.144000 0.976000 +0.500000 -0.026100 -0.060900 -0.336000 -0.328000 0.872000 +0.550000 -0.050200 -0.061500 -0.064000 -0.152000 0.984000 +0.550000 -0.046200 -0.060900 -0.104000 -0.168000 0.976000 +0.550000 -0.046200 -0.060900 -0.104000 -0.168000 0.976000 +0.500000 0.401700 -0.057700 0.096000 0.864000 0.480000 +0.500000 0.401700 -0.057700 0.096000 0.864000 0.480000 +0.500000 0.403100 -0.060900 0.112000 0.944000 0.280000 +0.517100 0.401700 -0.060900 0.080000 0.968000 0.224000 +0.500000 0.401700 -0.069300 0.168000 0.952000 -0.216000 +0.500000 0.401700 -0.069300 0.168000 0.952000 -0.216000 +0.500000 0.266900 0.000000 -0.760000 -0.040000 0.640000 +0.500000 0.266900 0.000000 -0.760000 -0.040000 0.640000 +0.500800 0.251000 0.000000 -0.792000 -0.016000 0.608000 +0.500000 0.251000 -0.000900 -0.496000 0.112000 0.856000 +0.500000 0.251000 -0.000900 -0.496000 0.112000 0.856000 +0.500000 0.050200 -0.057700 -0.560000 0.128000 0.816000 +0.500000 0.050200 -0.057700 -0.560000 0.128000 0.816000 +0.500000 0.000000 -0.045100 -0.376000 -0.208000 0.896000 +0.550000 0.050200 -0.037800 -0.320000 -0.688000 0.640000 +0.550000 0.000000 -0.046900 0.008000 -0.120000 0.992000 +0.600000 0.050200 -0.005300 -0.440000 -0.752000 0.480000 +0.600000 0.000000 -0.044900 -0.016000 -0.720000 0.688000 +0.600000 0.000000 -0.044900 -0.016000 -0.720000 0.688000 +0.550000 0.104000 0.000000 -0.664000 -0.568000 0.464000 +0.550000 0.104000 0.000000 -0.664000 -0.568000 0.464000 +0.553100 0.100400 0.000000 -0.664000 -0.576000 0.464000 +0.550000 0.100400 -0.005700 -0.672000 -0.576000 0.448000 +0.550000 0.100400 -0.005700 -0.672000 -0.576000 0.448000 +0.550000 -0.200800 -0.034900 0.016000 -0.040000 0.992000 +0.550000 -0.200800 -0.034900 0.016000 -0.040000 0.992000 +0.600000 -0.200800 -0.056500 0.336000 0.448000 0.816000 +0.550000 -0.159500 -0.060900 0.248000 0.472000 0.840000 +0.600000 -0.194800 -0.060900 0.352000 0.496000 0.784000 +0.550000 -0.150600 -0.067100 0.240000 0.480000 0.840000 +0.600000 -0.150600 -0.093600 0.304000 0.568000 0.752000 +0.600000 -0.194800 -0.060900 0.352000 0.496000 0.784000 +0.650000 -0.150600 -0.116200 0.720000 0.480000 0.488000 +0.608400 -0.200800 -0.060900 0.360000 0.488000 0.792000 +0.650000 -0.200800 -0.092600 0.656000 0.384000 0.640000 +0.650000 -0.242600 -0.060900 0.392000 0.384000 0.824000 +0.677400 -0.200800 -0.121900 0.528000 0.512000 0.672000 +0.657600 -0.251000 -0.060900 0.456000 -0.072000 0.880000 +0.700000 -0.217500 -0.121900 0.616000 0.552000 0.544000 +0.700000 -0.251000 -0.086700 0.608000 0.464000 0.632000 +0.719200 -0.251000 -0.121900 0.760000 0.456000 0.440000 +0.700000 -0.301200 -0.068800 0.336000 0.392000 0.848000 +0.750000 -0.297400 -0.121900 0.656000 0.584000 0.464000 +0.750000 -0.301200 -0.116500 0.704000 0.400000 0.568000 +0.752700 -0.301200 -0.121900 0.792000 0.344000 0.488000 +0.750000 -0.351500 -0.097900 0.640000 0.048000 0.760000 +0.775700 -0.351500 -0.121900 0.600000 0.328000 0.720000 +0.750000 -0.401700 -0.115900 -0.264000 -0.344000 0.896000 +0.800000 -0.391100 -0.121900 0.384000 0.416000 0.816000 +0.800000 -0.401700 -0.115500 0.392000 0.184000 0.896000 +0.810500 -0.401700 -0.121900 0.456000 0.104000 0.872000 +0.800000 -0.418600 -0.121900 0.304000 -0.320000 0.888000 +0.850000 -0.401700 -0.151500 0.608000 0.552000 0.560000 +0.800000 -0.451900 -0.135400 0.168000 -0.384000 0.904000 +0.850000 -0.451900 -0.123600 0.328000 0.296000 0.888000 +0.800000 -0.502100 -0.171200 -0.360000 -0.648000 0.664000 +0.850000 -0.502100 -0.142100 -0.224000 -0.520000 0.816000 +0.800000 -0.511100 -0.182900 -0.376000 -0.744000 0.544000 +0.850000 -0.533300 -0.182900 -0.416000 -0.736000 0.528000 +0.800000 -0.519900 -0.243900 -0.400000 -0.904000 -0.112000 +0.850000 -0.540400 -0.243900 -0.360000 -0.768000 -0.512000 +0.800000 -0.502100 -0.293400 -0.120000 -0.840000 -0.520000 +0.850000 -0.504700 -0.304800 -0.096000 -0.664000 -0.736000 +0.832800 -0.502100 -0.304800 -0.104000 -0.544000 -0.824000 +0.850000 -0.502100 -0.307100 0.032000 -0.240000 -0.968000 +0.850000 -0.490600 -0.304800 0.216000 0.112000 -0.968000 +0.856800 -0.502100 -0.304800 0.288000 0.144000 -0.944000 +0.850000 -0.451900 -0.293100 0.448000 0.248000 -0.848000 +0.900000 -0.502100 -0.284600 -0.008000 -0.096000 -0.992000 +0.900000 -0.451900 -0.272400 0.368000 0.408000 -0.824000 +0.950000 -0.502100 -0.277800 0.272000 0.288000 -0.912000 +0.950000 -0.451900 -0.300000 0.488000 0.464000 -0.728000 +1.000000 -0.502100 -0.271100 0.392000 0.584000 -0.696000 +0.980700 -0.451900 -0.243900 0.752000 0.648000 0.032000 +1.000000 -0.475100 -0.243900 0.736000 0.608000 -0.280000 +0.950000 -0.451900 -0.206400 0.504000 0.736000 0.440000 +1.000000 -0.502100 -0.189300 0.760000 0.568000 0.296000 +0.950000 -0.463500 -0.182900 0.464000 0.672000 0.568000 +0.998000 -0.502100 -0.182900 0.528000 0.664000 0.520000 +0.950000 -0.502100 -0.136000 -0.296000 0.400000 0.864000 +1.000000 -0.503200 -0.182900 0.400000 0.704000 0.576000 +0.950000 -0.531200 -0.121900 -0.376000 0.368000 0.840000 +1.000000 -0.544400 -0.121900 0.360000 0.712000 0.592000 +0.950000 -0.552300 -0.115100 -0.432000 -0.368000 0.816000 +1.000000 -0.552300 -0.111000 0.040000 -0.024000 0.992000 +0.950000 -0.560000 -0.121900 -0.400000 -0.536000 0.728000 +1.000000 -0.602500 -0.115100 -0.504000 -0.464000 0.712000 +0.992300 -0.602500 -0.121900 -0.520000 -0.480000 0.696000 +1.000000 -0.611000 -0.121900 -0.528000 -0.480000 0.696000 +0.950000 -0.602500 -0.169200 -0.536000 -0.520000 0.656000 +1.000000 -0.652700 -0.168000 -0.488000 -0.568000 0.656000 +0.950000 -0.619400 -0.182900 -0.632000 -0.592000 0.480000 +0.983200 -0.652700 -0.182900 -0.528000 -0.608000 0.584000 +0.950000 -0.619400 -0.243900 -0.600000 -0.584000 -0.536000 +0.979500 -0.652700 -0.243900 -0.672000 -0.664000 -0.304000 +0.950000 -0.602500 -0.260200 -0.544000 -0.504000 -0.664000 +1.000000 -0.652700 -0.268800 -0.592000 -0.512000 -0.608000 +0.990600 -0.602500 -0.304800 -0.488000 -0.376000 -0.784000 +1.000000 -0.614600 -0.304800 -0.488000 -0.376000 -0.776000 +1.000000 -0.602500 -0.311200 -0.448000 -0.336000 -0.816000 +0.990600 -0.602500 -0.304800 -0.488000 -0.376000 -0.784000 +1.000000 -0.552300 -0.319800 -0.248000 0.216000 -0.936000 +0.953900 -0.552300 -0.304800 -0.328000 0.312000 -0.888000 +1.000000 -0.525900 -0.304800 -0.248000 0.496000 -0.824000 +0.950000 -0.552300 -0.303200 -0.304000 0.392000 -0.864000 +1.000000 -0.502100 -0.271100 0.392000 0.584000 -0.696000 +0.950000 -0.502100 -0.277800 0.272000 0.288000 -0.912000 +0.950000 -0.552300 -0.303200 -0.304000 0.392000 -0.864000 +0.900000 -0.502100 -0.284600 -0.008000 -0.096000 -0.992000 +0.900000 -0.552300 -0.278500 -0.424000 -0.592000 -0.672000 +0.856800 -0.502100 -0.304800 0.288000 0.144000 -0.944000 +0.868400 -0.552300 -0.243900 -0.552000 -0.760000 -0.328000 +0.850000 -0.504700 -0.304800 -0.096000 -0.664000 -0.736000 +0.850000 -0.540400 -0.243900 -0.360000 -0.768000 -0.512000 +0.868400 -0.552300 -0.243900 -0.552000 -0.760000 -0.328000 +0.850000 -0.533300 -0.182900 -0.416000 -0.736000 0.528000 +0.876500 -0.552300 -0.182900 -0.528000 -0.672000 0.504000 +0.850000 -0.502100 -0.142100 -0.224000 -0.520000 0.816000 +0.900000 -0.552300 -0.159100 -0.496000 -0.592000 0.632000 +0.900000 -0.502100 -0.123800 -0.168000 -0.208000 0.960000 +0.940600 -0.552300 -0.121900 -0.512000 -0.272000 0.808000 +0.950000 -0.502100 -0.136000 -0.296000 0.400000 0.864000 +0.950000 -0.531200 -0.121900 -0.376000 0.368000 0.840000 +0.940600 -0.552300 -0.121900 -0.512000 -0.272000 0.808000 +0.950000 -0.552300 -0.115100 -0.432000 -0.368000 0.816000 +0.950000 -0.560000 -0.121900 -0.400000 -0.536000 0.728000 +0.940600 -0.552300 -0.121900 -0.512000 -0.272000 0.808000 +0.950000 -0.602500 -0.169200 -0.536000 -0.520000 0.656000 +0.900000 -0.552300 -0.159100 -0.496000 -0.592000 0.632000 +0.935000 -0.602500 -0.182900 -0.552000 -0.552000 0.608000 +0.900000 -0.573700 -0.182900 -0.608000 -0.704000 0.344000 +0.933200 -0.602500 -0.243900 -0.584000 -0.624000 -0.512000 +0.900000 -0.578300 -0.243900 -0.552000 -0.704000 -0.440000 +0.950000 -0.602500 -0.260200 -0.544000 -0.504000 -0.664000 +0.900000 -0.552300 -0.278500 -0.424000 -0.592000 -0.672000 +0.950000 -0.552300 -0.303200 -0.304000 0.392000 -0.864000 +0.950000 -0.602500 -0.260200 -0.544000 -0.504000 -0.664000 +0.953900 -0.552300 -0.304800 -0.328000 0.312000 -0.888000 +0.990600 -0.602500 -0.304800 -0.488000 -0.376000 -0.784000 +0.990600 -0.602500 -0.304800 -0.488000 -0.376000 -0.784000 +0.550000 -0.242100 -0.060900 -0.400000 -0.536000 0.736000 +0.550000 -0.242100 -0.060900 -0.400000 -0.536000 0.736000 +0.550000 -0.200800 -0.034900 0.016000 -0.040000 0.992000 +0.562800 -0.251000 -0.060900 -0.368000 -0.568000 0.720000 +0.600000 -0.200800 -0.056500 0.336000 0.448000 0.816000 +0.600000 -0.251000 -0.042400 -0.104000 -0.208000 0.968000 +0.608400 -0.200800 -0.060900 0.360000 0.488000 0.792000 +0.650000 -0.251000 -0.056300 0.424000 -0.024000 0.896000 +0.650000 -0.242600 -0.060900 0.392000 0.384000 0.824000 +0.657600 -0.251000 -0.060900 0.456000 -0.072000 0.880000 +0.650000 -0.251000 -0.056300 0.424000 -0.024000 0.896000 +0.650000 -0.258100 -0.060900 0.392000 -0.456000 0.792000 +0.600000 -0.251000 -0.042400 -0.104000 -0.208000 0.968000 +0.600000 -0.272000 -0.060900 -0.264000 -0.632000 0.720000 +0.562800 -0.251000 -0.060900 -0.368000 -0.568000 0.720000 +0.600000 -0.301200 -0.098800 -0.176000 -0.576000 0.792000 +0.550000 -0.251000 -0.069700 -0.416000 -0.584000 0.688000 +0.552600 -0.301200 -0.121900 -0.368000 -0.384000 0.840000 +0.550000 -0.300100 -0.121900 -0.624000 -0.616000 0.472000 +0.550000 -0.301200 -0.123600 -0.624000 -0.440000 0.632000 +0.552600 -0.301200 -0.121900 -0.368000 -0.384000 0.840000 +0.550000 -0.317100 -0.121900 -0.368000 0.064000 0.920000 +0.600000 -0.333000 -0.121900 0.024000 -0.312000 0.944000 +0.558500 -0.351500 -0.121900 0.208000 -0.648000 0.728000 +0.600000 -0.351500 -0.136300 0.144000 -0.792000 0.584000 +0.550000 -0.353000 -0.121900 -0.032000 -0.832000 0.536000 +0.600000 -0.392700 -0.182900 -0.184000 -0.752000 0.624000 +0.550000 -0.389500 -0.182900 -0.304000 -0.784000 0.528000 +0.600000 -0.401700 -0.203000 -0.208000 -0.872000 0.432000 +0.550000 -0.401700 -0.218900 -0.128000 -0.904000 0.392000 +0.600000 -0.414700 -0.243900 -0.184000 -0.936000 0.272000 +0.550000 -0.409700 -0.243900 -0.144000 -0.944000 0.272000 +0.600000 -0.422100 -0.304800 -0.120000 -0.768000 -0.616000 +0.550000 -0.415900 -0.304800 -0.192000 -0.848000 -0.480000 +0.600000 -0.401700 -0.327900 -0.024000 -0.544000 -0.832000 +0.550000 -0.401700 -0.333700 -0.144000 -0.688000 -0.704000 +0.600000 -0.351500 -0.337900 0.040000 -0.080000 -0.992000 +0.550000 -0.351500 -0.364500 0.120000 -0.104000 -0.984000 +0.600000 -0.301200 -0.352300 -0.528000 -0.312000 -0.776000 +0.550000 -0.316300 -0.304800 -0.472000 0.688000 -0.536000 +0.567500 -0.301200 -0.304800 -0.696000 0.400000 -0.584000 +0.550000 -0.301200 -0.279200 -0.712000 0.120000 -0.680000 +0.550000 -0.272400 -0.304800 -0.680000 -0.440000 -0.576000 +0.550000 -0.272400 -0.304800 -0.680000 -0.440000 -0.576000 +0.616700 0.401700 0.000000 0.496000 0.864000 -0.032000 +0.616700 0.401700 0.000000 0.496000 0.864000 -0.032000 +0.650000 0.368200 0.000000 0.792000 0.584000 -0.144000 +0.600000 0.401700 -0.057700 0.168000 0.920000 -0.344000 +0.650000 0.351500 -0.057700 0.800000 0.552000 -0.208000 +0.600000 0.400600 -0.060900 -0.072000 0.912000 -0.384000 +0.648900 0.351500 -0.060900 0.576000 0.600000 -0.544000 +0.600000 0.351500 -0.101600 0.448000 0.496000 -0.736000 +0.650000 0.350500 -0.060900 0.712000 0.536000 -0.440000 +0.600000 0.310600 -0.121900 0.480000 0.424000 -0.760000 +0.650000 0.301200 -0.100800 0.528000 0.504000 -0.672000 +0.608400 0.301200 -0.121900 0.448000 0.488000 -0.744000 +0.600000 0.310600 -0.121900 0.480000 0.424000 -0.760000 +0.600000 0.301200 -0.128700 0.472000 0.520000 -0.704000 +0.600000 0.301200 -0.128700 0.472000 0.520000 -0.704000 +0.648900 0.351500 -0.060900 0.576000 0.600000 -0.544000 +0.648900 0.351500 -0.060900 0.576000 0.600000 -0.544000 +0.650000 0.350500 -0.060900 0.712000 0.536000 -0.440000 +0.650000 0.351500 -0.057700 0.800000 0.552000 -0.208000 +0.680100 0.301200 -0.060900 0.752000 0.544000 -0.368000 +0.660900 0.351500 0.000000 0.832000 0.512000 -0.176000 +0.685300 0.301200 0.000000 0.832000 0.536000 -0.104000 +0.680100 0.301200 -0.060900 0.752000 0.544000 -0.368000 +0.700000 0.279600 0.000000 0.792000 0.600000 -0.048000 +0.700000 0.278700 -0.060900 0.648000 0.584000 -0.472000 +0.700000 0.278700 -0.060900 0.648000 0.584000 -0.472000 +0.600000 -0.194800 -0.060900 0.352000 0.496000 0.784000 +0.600000 -0.194800 -0.060900 0.352000 0.496000 0.784000 +0.608400 -0.200800 -0.060900 0.360000 0.488000 0.792000 +0.600000 -0.200800 -0.056500 0.336000 0.448000 0.816000 +0.600000 -0.200800 -0.056500 0.336000 0.448000 0.816000 +0.650000 0.368200 0.000000 0.792000 0.584000 -0.144000 +0.650000 0.368200 0.000000 0.792000 0.584000 -0.144000 +0.650000 0.351500 -0.057700 0.800000 0.552000 -0.208000 +0.660900 0.351500 0.000000 0.832000 0.512000 -0.176000 +0.660900 0.351500 0.000000 0.832000 0.512000 -0.176000 +0.650000 0.000000 -0.040500 0.104000 -0.944000 0.296000 +0.650000 0.000000 -0.040500 0.104000 -0.944000 0.296000 +0.686800 0.000000 -0.060900 0.208000 -0.960000 0.144000 +0.650000 -0.010200 -0.060900 0.168000 -0.784000 0.592000 +0.698200 0.000000 -0.121900 0.296000 -0.952000 0.032000 +0.650000 -0.033500 -0.121900 0.512000 -0.672000 0.520000 +0.687300 0.000000 -0.182900 0.648000 -0.600000 -0.456000 +0.650000 -0.048900 -0.182900 0.792000 -0.584000 0.152000 +0.653800 0.000000 -0.243900 0.576000 -0.112000 -0.808000 +0.650000 -0.016900 -0.243900 0.704000 -0.184000 -0.672000 +0.650000 -0.048900 -0.182900 0.792000 -0.584000 0.152000 +0.637200 -0.050200 -0.243900 0.840000 -0.080000 -0.528000 +0.649100 -0.050200 -0.182900 0.816000 -0.544000 0.144000 +0.650000 -0.048900 -0.182900 0.792000 -0.584000 0.152000 +0.638000 -0.050200 -0.121900 0.800000 -0.536000 0.256000 +0.650000 -0.033500 -0.121900 0.512000 -0.672000 0.520000 +0.650000 -0.033500 -0.121900 0.512000 -0.672000 0.520000 +0.800000 -0.015400 0.000000 -0.560000 -0.800000 0.184000 +0.800000 -0.015400 0.000000 -0.560000 -0.800000 0.184000 +0.772100 0.000000 0.000000 -0.504000 -0.832000 0.224000 +0.800000 -0.024700 -0.060900 -0.616000 -0.776000 0.088000 +0.753100 0.000000 -0.060900 -0.472000 -0.872000 0.000000 +0.800000 -0.027900 -0.121900 -0.664000 -0.736000 -0.072000 +0.756600 0.000000 -0.121900 -0.496000 -0.856000 -0.080000 +0.800000 -0.017800 -0.182900 -0.616000 -0.680000 -0.376000 +0.776700 0.000000 -0.182900 -0.576000 -0.728000 -0.360000 +0.800000 0.000000 -0.217200 -0.656000 -0.464000 -0.584000 +0.800000 0.000000 -0.217200 -0.656000 -0.464000 -0.584000 +0.900000 0.131100 0.000000 0.480000 0.848000 0.192000 +0.900000 0.131100 0.000000 0.480000 0.848000 0.192000 +0.950000 0.102000 0.000000 0.472000 0.864000 0.120000 +0.900000 0.143500 -0.060900 0.528000 0.808000 -0.240000 +0.950000 0.106300 -0.060900 0.576000 0.776000 -0.240000 +0.900000 0.127900 -0.121900 0.560000 0.776000 -0.264000 +0.950000 0.100400 -0.078300 0.560000 0.768000 -0.304000 +0.931600 0.100400 -0.121900 0.600000 0.744000 -0.272000 +0.950000 0.086300 -0.121900 0.544000 0.784000 -0.280000 +0.912000 0.100400 -0.182900 0.600000 0.704000 -0.360000 +0.950000 0.069900 -0.182900 0.544000 0.736000 -0.392000 +0.900000 0.100400 -0.203200 0.536000 0.688000 -0.472000 +0.950000 0.050200 -0.224500 0.472000 0.712000 -0.504000 +0.900000 0.070800 -0.243900 -0.096000 0.744000 -0.656000 +0.929600 0.050200 -0.243900 0.432000 0.672000 -0.584000 +0.900000 0.050200 -0.268900 0.208000 0.672000 -0.696000 +0.950000 0.037500 -0.243900 0.432000 0.688000 -0.576000 +0.900000 0.016700 -0.304800 -0.152000 0.720000 -0.664000 +0.950000 0.000000 -0.291100 0.424000 0.536000 -0.720000 +0.927400 0.000000 -0.304800 0.400000 0.560000 -0.720000 +0.950000 -0.016600 -0.304800 0.448000 0.520000 -0.720000 +0.900000 0.000000 -0.329500 -0.080000 0.648000 -0.744000 +0.950000 -0.050200 -0.338500 0.440000 0.400000 -0.800000 +0.900000 -0.050200 -0.348300 -0.256000 0.192000 -0.944000 +0.950000 -0.100400 -0.351000 0.336000 0.064000 -0.936000 +0.900000 -0.100400 -0.341700 -0.464000 -0.104000 -0.872000 +0.950000 -0.150600 -0.345500 -0.032000 0.064000 -0.992000 +0.900000 -0.150600 -0.332000 -0.672000 -0.328000 -0.656000 +0.900000 -0.150600 -0.332000 -0.672000 -0.328000 -0.656000 +0.995800 -0.200800 0.000000 -0.648000 -0.704000 0.264000 +0.995800 -0.200800 0.000000 -0.648000 -0.704000 0.264000 +0.950000 -0.168100 0.000000 -0.640000 -0.744000 0.184000 +0.973000 -0.200800 -0.060900 -0.584000 -0.760000 0.264000 +0.950000 -0.183700 -0.060900 -0.632000 -0.728000 0.232000 +0.950500 -0.200800 -0.121900 -0.632000 -0.744000 0.192000 +0.950000 -0.200400 -0.121900 -0.720000 -0.672000 0.136000 +0.950000 -0.200800 -0.124000 -0.680000 -0.712000 0.160000 +0.950000 -0.200800 -0.124000 -0.680000 -0.712000 0.160000 +-0.910500 0.251000 -0.121900 0.344000 0.880000 -0.304000 +-0.910500 0.251000 -0.121900 0.344000 0.880000 -0.304000 +-0.900000 0.246900 -0.121900 0.360000 0.872000 -0.304000 +-0.900000 0.251000 -0.101700 0.376000 0.896000 -0.216000 +-0.900000 0.251000 -0.101700 0.376000 0.896000 -0.216000 +-0.900000 -0.502100 -0.104000 -0.752000 0.000000 0.656000 +-0.900000 -0.502100 -0.104000 -0.752000 0.000000 0.656000 +-0.900000 -0.511500 -0.121900 -0.520000 -0.664000 0.528000 +-0.906100 -0.502100 -0.121900 -0.920000 0.072000 0.376000 +-0.900000 -0.542100 -0.182900 -0.808000 -0.560000 0.136000 +-0.925200 -0.502100 -0.182900 -0.976000 -0.008000 0.208000 +-0.900000 -0.551700 -0.243900 -0.808000 -0.568000 -0.120000 +-0.929300 -0.502100 -0.243900 -0.992000 0.064000 -0.008000 +-0.900000 -0.539600 -0.304800 -0.720000 -0.488000 -0.480000 +-0.920600 -0.502100 -0.304800 -0.888000 -0.288000 -0.344000 +-0.900000 -0.502100 -0.352600 -0.672000 0.128000 -0.720000 +-0.900000 -0.539600 -0.304800 -0.720000 -0.488000 -0.480000 +-0.864000 -0.502100 -0.365800 -0.304000 0.480000 -0.816000 +-0.891900 -0.552300 -0.304800 -0.800000 -0.568000 -0.136000 +-0.860100 -0.552300 -0.365800 -0.680000 -0.432000 -0.584000 +-0.850000 -0.602000 -0.304800 -0.640000 -0.736000 -0.184000 +-0.850000 -0.564700 -0.365800 -0.608000 -0.528000 -0.584000 +-0.849200 -0.602500 -0.304800 -0.536000 -0.720000 -0.432000 +-0.806700 -0.602500 -0.365800 -0.520000 -0.656000 -0.536000 +-0.800000 -0.636000 -0.304800 -0.536000 -0.792000 -0.272000 +-0.800000 -0.607700 -0.365800 -0.488000 -0.640000 -0.584000 +-0.750000 -0.652200 -0.304800 -0.040000 -0.952000 -0.288000 +-0.750000 -0.628000 -0.365800 -0.232000 -0.808000 -0.528000 +-0.734200 -0.652700 -0.304800 -0.024000 -0.976000 -0.192000 +-0.700000 -0.639000 -0.365800 -0.040000 -0.920000 -0.376000 +-0.700000 -0.652700 -0.309000 0.024000 -0.952000 -0.296000 +-0.650000 -0.641900 -0.365800 -0.024000 -0.952000 -0.280000 +-0.688500 -0.652700 -0.304800 0.080000 -0.992000 -0.064000 +-0.650000 -0.650400 -0.304800 0.048000 -0.992000 0.096000 +-0.700000 -0.652700 -0.298900 0.056000 -0.976000 0.184000 +-0.650000 -0.641500 -0.243900 0.040000 -0.976000 0.168000 +-0.700000 -0.645500 -0.243900 -0.008000 -0.984000 0.160000 +-0.650000 -0.630900 -0.182900 0.008000 -0.968000 0.232000 +-0.700000 -0.633400 -0.182900 -0.064000 -0.960000 0.248000 +-0.650000 -0.615500 -0.121900 -0.008000 -0.952000 0.304000 +-0.700000 -0.614700 -0.121900 -0.136000 -0.888000 0.424000 +-0.650000 -0.602500 -0.069700 -0.072000 -0.800000 0.584000 +-0.700000 -0.602500 -0.083600 -0.192000 -0.680000 0.704000 +-0.650000 -0.594800 -0.060900 -0.368000 -0.640000 0.664000 +-0.700000 -0.552300 -0.082500 -0.736000 -0.280000 0.608000 +-0.685200 -0.552300 -0.060900 -0.696000 -0.384000 0.592000 +-0.700000 -0.507800 -0.060900 -0.864000 -0.200000 0.448000 +-0.700000 -0.507800 -0.060900 -0.864000 -0.200000 0.448000 +-0.868200 -0.552300 -0.121900 -0.520000 -0.224000 0.816000 +-0.868200 -0.552300 -0.121900 -0.520000 -0.224000 0.816000 +-0.850000 -0.552300 -0.082300 -0.704000 -0.480000 0.504000 +-0.850000 -0.569100 -0.121900 -0.488000 -0.776000 0.384000 +-0.800000 -0.552300 -0.095900 0.424000 0.264000 0.864000 +-0.800000 -0.584500 -0.121900 -0.288000 -0.544000 0.776000 +-0.750000 -0.552300 -0.119400 0.072000 0.512000 0.848000 +-0.764000 -0.602500 -0.121900 -0.176000 -0.816000 0.544000 +-0.750000 -0.602500 -0.116200 -0.176000 -0.808000 0.544000 +-0.750000 -0.605000 -0.121900 -0.152000 -0.872000 0.456000 +-0.700000 -0.602500 -0.083600 -0.192000 -0.680000 0.704000 +-0.700000 -0.614700 -0.121900 -0.136000 -0.888000 0.424000 +-0.750000 -0.605000 -0.121900 -0.152000 -0.872000 0.456000 +-0.700000 -0.633400 -0.182900 -0.064000 -0.960000 0.248000 +-0.750000 -0.630100 -0.182900 -0.144000 -0.912000 0.360000 +-0.700000 -0.645500 -0.243900 -0.008000 -0.984000 0.160000 +-0.750000 -0.646000 -0.243900 -0.088000 -0.984000 0.144000 +-0.700000 -0.652700 -0.298900 0.056000 -0.976000 0.184000 +-0.750000 -0.652200 -0.304800 -0.040000 -0.952000 -0.288000 +-0.734200 -0.652700 -0.304800 -0.024000 -0.976000 -0.192000 +-0.700000 -0.652700 -0.298900 0.056000 -0.976000 0.184000 +-0.700000 -0.653800 -0.304800 0.056000 -0.992000 -0.080000 +-0.688500 -0.652700 -0.304800 0.080000 -0.992000 -0.064000 +-0.700000 -0.652700 -0.309000 0.024000 -0.952000 -0.296000 +-0.700000 -0.653800 -0.304800 0.056000 -0.992000 -0.080000 +-0.734200 -0.652700 -0.304800 -0.024000 -0.976000 -0.192000 +-0.734200 -0.652700 -0.304800 -0.024000 -0.976000 -0.192000 +-0.804300 0.200800 -0.121900 0.384000 0.872000 -0.288000 +-0.804300 0.200800 -0.121900 0.384000 0.872000 -0.288000 +-0.800000 0.198900 -0.121900 0.384000 0.872000 -0.288000 +-0.800000 0.200800 -0.113900 0.392000 0.880000 -0.256000 +-0.800000 0.200800 -0.113900 0.392000 0.880000 -0.256000 +-0.762700 -0.401700 -0.060900 -0.840000 -0.496000 0.168000 +-0.762700 -0.401700 -0.060900 -0.840000 -0.496000 0.168000 +-0.771000 -0.401700 -0.121900 -0.872000 -0.456000 0.128000 +-0.750000 -0.426100 -0.060900 -0.864000 -0.448000 0.200000 +-0.750000 -0.448400 -0.121900 -0.880000 -0.432000 0.160000 +-0.735400 -0.451900 -0.060900 -0.768000 -0.512000 0.360000 +-0.748200 -0.451900 -0.121900 -0.880000 -0.440000 0.160000 +-0.701200 -0.502100 -0.060900 -0.816000 -0.416000 0.392000 +-0.723300 -0.502100 -0.121900 -0.896000 -0.224000 0.368000 +-0.748200 -0.451900 -0.121900 -0.880000 -0.440000 0.160000 +-0.749300 -0.502100 -0.182900 -0.920000 -0.232000 0.288000 +-0.750000 -0.451900 -0.133400 -0.896000 -0.392000 0.184000 +-0.750000 -0.499500 -0.182900 -0.936000 -0.200000 0.264000 +-0.757600 -0.451900 -0.182900 -0.952000 -0.232000 0.184000 +-0.750000 -0.502100 -0.184800 -0.496000 0.696000 0.496000 +-0.769800 -0.451900 -0.243900 -0.952000 -0.080000 0.272000 +-0.800000 -0.502100 -0.227500 0.432000 0.824000 0.352000 +-0.800000 -0.496000 -0.243900 0.424000 0.840000 0.320000 +-0.820300 -0.502100 -0.182900 0.496000 0.792000 0.344000 +-0.850000 -0.480800 -0.243900 0.376000 0.912000 0.152000 +-0.850000 -0.490700 -0.182900 0.328000 0.896000 0.288000 +-0.896800 -0.451900 -0.243900 0.600000 0.776000 0.136000 +-0.900000 -0.462200 -0.182900 0.320000 0.888000 0.304000 +-0.900000 -0.451900 -0.229200 0.512000 0.832000 0.168000 +-0.896800 -0.451900 -0.243900 0.600000 0.776000 0.136000 +-0.900000 -0.449600 -0.243900 0.496000 0.856000 0.136000 +-0.891000 -0.451900 -0.304800 0.528000 0.824000 -0.192000 +-0.900000 -0.446300 -0.304800 0.160000 0.912000 -0.360000 +-0.900000 -0.451900 -0.318500 0.104000 0.872000 -0.464000 +-0.912200 -0.451900 -0.304800 -0.496000 0.720000 -0.464000 +-0.900000 -0.446300 -0.304800 0.160000 0.912000 -0.360000 +-0.921000 -0.451900 -0.243900 -0.184000 0.968000 0.160000 +-0.900000 -0.449600 -0.243900 0.496000 0.856000 0.136000 +-0.900000 -0.451900 -0.229200 0.512000 0.832000 0.168000 +-0.900000 -0.451900 -0.229200 0.512000 0.832000 0.168000 +-0.700000 -0.602500 -0.083600 -0.192000 -0.680000 0.704000 +-0.700000 -0.602500 -0.083600 -0.192000 -0.680000 0.704000 +-0.750000 -0.602500 -0.116200 -0.176000 -0.808000 0.544000 +-0.700000 -0.552300 -0.082500 -0.736000 -0.280000 0.608000 +-0.750000 -0.552300 -0.119400 0.072000 0.512000 0.848000 +-0.750000 -0.552300 -0.119400 0.072000 0.512000 0.848000 +-0.650000 -0.594800 -0.060900 -0.368000 -0.640000 0.664000 +-0.650000 -0.594800 -0.060900 -0.368000 -0.640000 0.664000 +-0.650000 -0.602500 -0.069700 -0.072000 -0.800000 0.584000 +-0.600000 -0.601900 -0.060900 -0.072000 -0.808000 0.568000 +-0.600000 -0.602500 -0.062100 -0.056000 -0.816000 0.560000 +-0.550000 -0.588500 -0.060900 0.224000 -0.888000 0.384000 +-0.550000 -0.602500 -0.100200 0.256000 -0.912000 0.288000 +-0.500000 -0.570000 -0.060900 0.480000 -0.800000 0.328000 +-0.531000 -0.602500 -0.121900 0.248000 -0.920000 0.272000 +-0.500000 -0.589900 -0.121900 0.408000 -0.832000 0.352000 +-0.500000 -0.602500 -0.155300 0.000000 -0.920000 0.376000 +-0.531000 -0.602500 -0.121900 0.248000 -0.920000 0.272000 +-0.500000 -0.610400 -0.182900 -0.136000 -0.936000 0.304000 +-0.550000 -0.606400 -0.121900 0.192000 -0.952000 0.216000 +-0.550000 -0.618800 -0.182900 0.168000 -0.944000 0.272000 +-0.600000 -0.616000 -0.121900 0.080000 -0.960000 0.256000 +-0.600000 -0.629300 -0.182900 0.072000 -0.968000 0.224000 +-0.650000 -0.615500 -0.121900 -0.008000 -0.952000 0.304000 +-0.650000 -0.630900 -0.182900 0.008000 -0.968000 0.232000 +-0.600000 -0.629300 -0.182900 0.072000 -0.968000 0.224000 +-0.650000 -0.641500 -0.243900 0.040000 -0.976000 0.168000 +-0.600000 -0.640700 -0.243900 0.080000 -0.976000 0.192000 +-0.650000 -0.650400 -0.304800 0.048000 -0.992000 0.096000 +-0.600000 -0.650800 -0.304800 0.064000 -0.992000 0.000000 +-0.650000 -0.641900 -0.365800 -0.024000 -0.952000 -0.280000 +-0.600000 -0.645500 -0.365800 0.016000 -0.968000 -0.216000 +-0.650000 -0.621300 -0.426800 -0.080000 -0.904000 -0.400000 +-0.600000 -0.630300 -0.426800 -0.072000 -0.944000 -0.312000 +-0.600000 -0.645500 -0.365800 0.016000 -0.968000 -0.216000 +-0.550000 -0.626200 -0.426800 0.144000 -0.960000 -0.232000 +-0.550000 -0.637200 -0.365800 0.152000 -0.968000 -0.168000 +-0.500000 -0.621400 -0.426800 0.072000 -0.968000 -0.232000 +-0.500000 -0.633000 -0.365800 -0.088000 -0.968000 -0.200000 +-0.450000 -0.629300 -0.426800 -0.048000 -0.904000 -0.416000 +-0.450000 -0.645700 -0.365800 -0.144000 -0.904000 -0.392000 +-0.400000 -0.621700 -0.426800 0.392000 -0.856000 -0.304000 +-0.405700 -0.652700 -0.365800 -0.144000 -0.920000 -0.344000 +-0.400000 -0.652700 -0.368100 -0.128000 -0.872000 -0.456000 +-0.400000 -0.652700 -0.368100 -0.128000 -0.872000 -0.456000 +-0.650000 -0.602500 -0.069700 -0.072000 -0.800000 0.584000 +-0.650000 -0.602500 -0.069700 -0.072000 -0.800000 0.584000 +-0.650000 -0.615500 -0.121900 -0.008000 -0.952000 0.304000 +-0.600000 -0.602500 -0.062100 -0.056000 -0.816000 0.560000 +-0.600000 -0.616000 -0.121900 0.080000 -0.960000 0.256000 +-0.550000 -0.602500 -0.100200 0.256000 -0.912000 0.288000 +-0.550000 -0.606400 -0.121900 0.192000 -0.952000 0.216000 +-0.531000 -0.602500 -0.121900 0.248000 -0.920000 0.272000 +-0.531000 -0.602500 -0.121900 0.248000 -0.920000 0.272000 +-0.554400 -0.050200 -0.060900 0.944000 0.280000 0.128000 +-0.554400 -0.050200 -0.060900 0.944000 0.280000 0.128000 +-0.586600 -0.050200 -0.121900 0.872000 0.224000 -0.424000 +-0.550000 -0.066800 -0.060900 0.944000 0.320000 -0.008000 +-0.578300 -0.100400 -0.121900 0.848000 0.312000 -0.424000 +-0.550000 -0.100400 -0.079500 0.552000 0.552000 -0.616000 +-0.550000 -0.145600 -0.121900 0.512000 0.792000 -0.312000 +-0.578300 -0.100400 -0.121900 0.848000 0.312000 -0.424000 +-0.550000 -0.150600 -0.142400 0.376000 0.896000 -0.200000 +-0.594100 -0.100400 -0.182900 0.816000 0.296000 -0.480000 +-0.561800 -0.150600 -0.182900 0.544000 0.784000 -0.280000 +-0.550000 -0.150600 -0.142400 0.376000 0.896000 -0.200000 +-0.550000 -0.155500 -0.182900 0.296000 0.920000 -0.232000 +-0.550000 -0.155500 -0.182900 0.296000 0.920000 -0.232000 +-0.452400 -0.100400 -0.060900 -0.344000 0.936000 -0.016000 +-0.452400 -0.100400 -0.060900 -0.344000 0.936000 -0.016000 +-0.450000 -0.100400 -0.065100 -0.512000 0.824000 -0.200000 +-0.450000 -0.099400 -0.060900 -0.760000 0.616000 0.160000 +-0.450000 -0.099400 -0.060900 -0.760000 0.616000 0.160000 +-0.450000 -0.512800 -0.060900 0.208000 -0.760000 0.608000 +-0.450000 -0.512800 -0.060900 0.208000 -0.760000 0.608000 +-0.478800 -0.552300 -0.060900 0.704000 -0.592000 0.376000 +-0.450000 -0.549200 -0.121900 -0.080000 -0.800000 0.584000 +-0.452200 -0.552300 -0.121900 0.864000 0.184000 0.464000 +-0.450000 -0.552300 -0.127200 0.616000 -0.144000 0.768000 +-0.450000 -0.549200 -0.121900 -0.080000 -0.800000 0.584000 +-0.440600 -0.552300 -0.121900 -0.264000 -0.768000 0.568000 +-0.450000 -0.512800 -0.060900 0.208000 -0.760000 0.608000 +-0.400000 -0.552300 -0.100200 0.624000 -0.512000 0.584000 +-0.400000 -0.527700 -0.060900 0.080000 -0.768000 0.624000 +-0.393200 -0.552300 -0.121900 0.872000 -0.352000 0.320000 +-0.380200 -0.502100 -0.060900 0.648000 -0.616000 0.432000 +-0.350000 -0.503000 -0.121900 0.232000 -0.880000 0.400000 +-0.350000 -0.502100 -0.119400 0.240000 -0.864000 0.424000 +-0.380200 -0.502100 -0.060900 0.648000 -0.616000 0.432000 +-0.350000 -0.453900 -0.060900 0.248000 -0.624000 0.728000 +-0.350000 -0.453900 -0.060900 0.248000 -0.624000 0.728000 +-0.450000 -0.602500 -0.084100 -0.232000 -0.736000 0.624000 +-0.450000 -0.602500 -0.084100 -0.232000 -0.736000 0.624000 +-0.450000 -0.558900 -0.121900 0.808000 0.320000 0.488000 +-0.410500 -0.602500 -0.121900 0.456000 -0.632000 0.616000 +-0.450000 -0.552300 -0.127200 0.616000 -0.144000 0.768000 +-0.400000 -0.602500 -0.131300 0.560000 -0.576000 0.584000 +-0.440600 -0.552300 -0.121900 -0.264000 -0.768000 0.568000 +-0.400000 -0.588000 -0.121900 0.672000 -0.144000 0.720000 +-0.400000 -0.552300 -0.100200 0.624000 -0.512000 0.584000 +-0.393200 -0.552300 -0.121900 0.872000 -0.352000 0.320000 +-0.400000 -0.588000 -0.121900 0.672000 -0.144000 0.720000 +-0.379200 -0.552300 -0.182900 0.864000 -0.416000 0.264000 +-0.400000 -0.602500 -0.131300 0.560000 -0.576000 0.584000 +-0.386500 -0.602500 -0.182900 0.376000 -0.032000 0.920000 +-0.379200 -0.552300 -0.182900 0.864000 -0.416000 0.264000 +-0.371400 -0.602500 -0.243900 0.928000 0.016000 0.352000 +-0.363900 -0.552300 -0.243900 0.816000 -0.480000 0.304000 +-0.379200 -0.552300 -0.182900 0.864000 -0.416000 0.264000 +-0.350000 -0.535600 -0.243900 0.360000 -0.840000 0.384000 +-0.350000 -0.518400 -0.182900 -0.088000 -0.928000 0.360000 +-0.379200 -0.552300 -0.182900 0.864000 -0.416000 0.264000 +-0.350000 -0.503000 -0.121900 0.232000 -0.880000 0.400000 +-0.393200 -0.552300 -0.121900 0.872000 -0.352000 0.320000 +-0.393200 -0.552300 -0.121900 0.872000 -0.352000 0.320000 +-0.350000 0.148000 -0.060900 -0.504000 0.552000 0.656000 +-0.350000 0.148000 -0.060900 -0.504000 0.552000 0.656000 +-0.361800 0.100400 -0.060900 -0.920000 0.112000 -0.352000 +-0.350000 0.100400 -0.076700 -0.736000 0.256000 -0.616000 +-0.358600 0.050200 -0.060900 -0.920000 0.168000 -0.328000 +-0.350000 0.050200 -0.078800 -0.832000 0.272000 -0.472000 +-0.350000 0.100400 -0.076700 -0.736000 0.256000 -0.616000 +-0.335400 0.050200 -0.121900 -0.752000 0.472000 -0.456000 +-0.317300 0.100400 -0.121900 -0.712000 0.264000 -0.640000 +-0.317300 0.100400 -0.121900 -0.712000 0.264000 -0.640000 +-0.377800 0.000000 -0.060900 -0.864000 0.424000 -0.248000 +-0.377800 0.000000 -0.060900 -0.864000 0.424000 -0.248000 +-0.400000 -0.037800 -0.060900 -0.728000 0.664000 0.152000 +-0.372200 0.000000 -0.121900 -0.848000 0.480000 -0.200000 +-0.400000 -0.050200 -0.118700 -0.832000 0.528000 -0.160000 +-0.399400 -0.050200 -0.121900 -0.760000 0.504000 -0.392000 +-0.400000 -0.050900 -0.121900 -0.736000 0.536000 -0.408000 +-0.400000 -0.050900 -0.121900 -0.736000 0.536000 -0.408000 +-0.350000 0.301200 -0.064600 -0.624000 0.064000 -0.768000 +-0.350000 0.301200 -0.064600 -0.624000 0.064000 -0.768000 +-0.300000 0.301200 -0.089300 -0.344000 0.056000 -0.936000 +-0.350000 0.251000 -0.067500 -0.624000 0.048000 -0.768000 +-0.300000 0.251000 -0.090000 -0.368000 0.088000 -0.920000 +-0.350000 0.200800 -0.076700 -0.368000 -0.104000 -0.920000 +-0.300000 0.200800 -0.077300 -0.504000 0.240000 -0.824000 +-0.350000 0.153200 -0.060900 -0.608000 -0.784000 0.016000 +-0.300000 0.150600 -0.105900 -0.768000 0.536000 -0.320000 +-0.346000 0.150600 -0.060900 -0.768000 -0.144000 0.616000 +-0.346000 0.150600 -0.060900 -0.768000 -0.144000 0.616000 +-0.300000 0.401700 -0.066400 -0.448000 0.440000 -0.768000 +-0.300000 0.401700 -0.066400 -0.448000 0.440000 -0.768000 +-0.250000 0.401700 -0.091800 -0.416000 0.456000 -0.776000 +-0.300000 0.351500 -0.083400 -0.432000 0.176000 -0.880000 +-0.250000 0.351500 -0.107800 -0.464000 0.176000 -0.864000 +-0.300000 0.301200 -0.089300 -0.344000 0.056000 -0.936000 +-0.250000 0.301200 -0.116200 -0.672000 0.120000 -0.720000 +-0.300000 0.251000 -0.090000 -0.368000 0.088000 -0.920000 +-0.250000 0.268200 -0.121900 -0.464000 0.088000 -0.872000 +-0.254200 0.251000 -0.121900 -0.384000 0.088000 -0.912000 +-0.300000 0.251000 -0.090000 -0.368000 0.088000 -0.920000 +-0.263400 0.200800 -0.121900 -0.480000 0.216000 -0.840000 +-0.300000 0.200800 -0.077300 -0.504000 0.240000 -0.824000 +-0.295300 0.150600 -0.121900 -0.728000 0.520000 -0.432000 +-0.300000 0.150600 -0.105900 -0.768000 0.536000 -0.320000 +-0.300000 0.144000 -0.121900 -0.728000 0.496000 -0.456000 +-0.300000 0.144000 -0.121900 -0.728000 0.496000 -0.456000 +-0.250000 0.401700 -0.091800 -0.416000 0.456000 -0.776000 +-0.250000 0.401700 -0.091800 -0.416000 0.456000 -0.776000 +-0.208300 0.401700 -0.121900 -0.432000 0.432000 -0.784000 +-0.250000 0.351500 -0.107800 -0.464000 0.176000 -0.864000 +-0.233300 0.351500 -0.121900 -0.616000 0.184000 -0.752000 +-0.250000 0.301200 -0.116200 -0.672000 0.120000 -0.720000 +-0.245300 0.301200 -0.121900 -0.680000 0.120000 -0.720000 +-0.250000 0.268200 -0.121900 -0.464000 0.088000 -0.872000 +-0.250000 0.268200 -0.121900 -0.464000 0.088000 -0.872000 +-0.104300 -0.100400 -0.060900 0.528000 0.416000 0.728000 +-0.104300 -0.100400 -0.060900 0.528000 0.416000 0.728000 +-0.100000 -0.100400 -0.064700 0.496000 0.416000 0.752000 +-0.100000 -0.105500 -0.060900 0.480000 0.464000 0.736000 +-0.050000 -0.100400 -0.073900 0.136000 0.480000 0.864000 +-0.050000 -0.119400 -0.060900 0.168000 0.528000 0.824000 +0.000000 -0.100400 -0.085100 0.096000 0.456000 0.880000 +0.000000 -0.136800 -0.060900 0.088000 0.520000 0.840000 +0.050000 -0.100400 -0.083400 0.000000 0.440000 0.888000 +0.050000 -0.140200 -0.060900 0.152000 0.504000 0.848000 +0.100000 -0.100400 -0.084200 0.032000 0.360000 0.928000 +0.076800 -0.150600 -0.060900 0.208000 0.432000 0.872000 +0.100000 -0.150600 -0.068400 0.184000 0.416000 0.888000 +0.100000 -0.170000 -0.060900 0.256000 0.296000 0.912000 +0.100000 -0.170000 -0.060900 0.256000 0.296000 0.912000 +-0.133200 -0.451900 -0.060900 0.584000 -0.656000 0.464000 +-0.133200 -0.451900 -0.060900 0.584000 -0.656000 0.464000 +-0.100000 -0.415900 -0.060900 0.680000 -0.544000 0.480000 +-0.100000 -0.451900 -0.117700 0.624000 -0.664000 0.392000 +-0.100000 -0.451900 -0.117700 0.624000 -0.664000 0.392000 +-0.150000 -0.502100 -0.111600 0.592000 -0.752000 0.280000 +-0.150000 -0.502100 -0.111600 0.592000 -0.752000 0.280000 +-0.146100 -0.502100 -0.121900 0.616000 -0.744000 0.232000 +-0.150000 -0.505100 -0.121900 0.584000 -0.768000 0.240000 +-0.141200 -0.502100 -0.182900 0.696000 -0.688000 0.184000 +-0.150000 -0.510100 -0.182900 0.616000 -0.760000 0.168000 +-0.125700 -0.502100 -0.243900 0.664000 -0.408000 0.624000 +-0.150000 -0.530700 -0.243900 0.632000 -0.664000 0.392000 +-0.150000 -0.530700 -0.243900 0.632000 -0.664000 0.392000 +-0.078700 0.200800 -0.060900 0.568000 -0.416000 0.704000 +-0.078700 0.200800 -0.060900 0.568000 -0.416000 0.704000 +-0.050000 0.236000 -0.060900 0.536000 -0.496000 0.672000 +-0.050000 0.200800 -0.090500 0.520000 -0.520000 0.672000 +-0.050000 0.200800 -0.090500 0.520000 -0.520000 0.672000 +-0.100000 0.100400 -0.099400 0.760000 -0.264000 0.584000 +-0.100000 0.100400 -0.099400 0.760000 -0.264000 0.584000 +-0.089100 0.100400 -0.121900 0.816000 -0.232000 0.520000 +-0.100000 0.054100 -0.121900 0.816000 -0.176000 0.544000 +-0.100000 0.054100 -0.121900 0.816000 -0.176000 0.544000 +-0.050000 -0.370100 -0.060900 0.592000 -0.672000 0.424000 +-0.050000 -0.370100 -0.060900 0.592000 -0.672000 0.424000 +-0.087700 -0.401700 -0.060900 0.608000 -0.600000 0.504000 +-0.050000 -0.398200 -0.121900 0.592000 -0.704000 0.368000 +-0.054100 -0.401700 -0.121900 0.656000 -0.688000 0.280000 +-0.050000 -0.389600 -0.182900 0.656000 -0.736000 -0.128000 +-0.061900 -0.401700 -0.182900 0.744000 -0.648000 -0.120000 +-0.050000 -0.380500 -0.243900 0.664000 -0.736000 -0.104000 +-0.071000 -0.401700 -0.243900 0.856000 -0.496000 -0.072000 +-0.050000 -0.374600 -0.304800 0.584000 -0.672000 -0.448000 +-0.073900 -0.401700 -0.304800 0.784000 -0.304000 -0.528000 +-0.050000 -0.351500 -0.336900 0.024000 -0.576000 -0.808000 +-0.100000 -0.401700 -0.330800 0.576000 -0.152000 -0.792000 +-0.100000 -0.351500 -0.338800 0.024000 -0.312000 -0.944000 +-0.150000 -0.401700 -0.364300 0.552000 0.080000 -0.824000 +-0.150000 -0.351500 -0.350300 0.512000 0.192000 -0.832000 +-0.100000 -0.351500 -0.338800 0.024000 -0.312000 -0.944000 +-0.150000 -0.301200 -0.318500 -0.024000 0.504000 -0.856000 +-0.100000 -0.301200 -0.349000 -0.368000 0.264000 -0.888000 +-0.150000 -0.286300 -0.304800 -0.184000 0.480000 -0.848000 +-0.100000 -0.251000 -0.333700 -0.512000 0.248000 -0.816000 +-0.123600 -0.251000 -0.304800 -0.536000 0.288000 -0.784000 +-0.100000 -0.200800 -0.311700 -0.496000 0.128000 -0.856000 +-0.108400 -0.200800 -0.304800 -0.496000 -0.048000 -0.856000 +-0.123600 -0.251000 -0.304800 -0.536000 0.288000 -0.784000 +-0.150000 -0.200800 -0.284500 0.024000 -0.216000 -0.968000 +-0.150000 -0.251000 -0.289400 -0.264000 0.272000 -0.920000 +-0.196100 -0.200800 -0.304800 0.360000 -0.200000 -0.904000 +-0.195100 -0.251000 -0.304800 0.376000 0.112000 -0.912000 +-0.150000 -0.251000 -0.289400 -0.264000 0.272000 -0.920000 +-0.150000 -0.286300 -0.304800 -0.184000 0.480000 -0.848000 +-0.123600 -0.251000 -0.304800 -0.536000 0.288000 -0.784000 +-0.123600 -0.251000 -0.304800 -0.536000 0.288000 -0.784000 +0.000000 0.393800 -0.060900 0.224000 0.176000 0.952000 +0.000000 0.393800 -0.060900 0.224000 0.176000 0.952000 +-0.005200 0.401700 -0.060900 0.264000 0.168000 0.944000 +0.000000 0.401700 -0.062800 0.256000 0.176000 0.944000 +0.000000 0.401700 -0.062800 0.256000 0.176000 0.944000 +0.000000 0.493800 -0.121900 0.128000 0.960000 -0.232000 +0.000000 0.493800 -0.121900 0.128000 0.960000 -0.232000 +0.000000 0.451900 -0.081100 0.280000 0.456000 0.832000 +0.050000 0.485400 -0.121900 -0.032000 0.904000 -0.408000 +0.050000 0.451900 -0.077800 0.016000 0.408000 0.912000 +0.100000 0.494400 -0.121900 -0.184000 0.952000 -0.216000 +0.100000 0.451900 -0.066700 -0.192000 0.072000 0.976000 +0.138500 0.502100 -0.121900 -0.184000 0.952000 -0.216000 +0.121900 0.451900 -0.060900 -0.112000 0.472000 0.872000 +0.150000 0.502100 -0.119700 0.016000 0.656000 0.752000 +0.150000 0.456100 -0.060900 0.048000 0.664000 0.736000 +0.150000 0.456100 -0.060900 0.048000 0.664000 0.736000 +0.150000 0.503100 -0.121900 0.272000 0.456000 -0.840000 +0.150000 0.503100 -0.121900 0.272000 0.456000 -0.840000 +0.150000 0.502100 -0.119700 0.016000 0.656000 0.752000 +0.138500 0.502100 -0.121900 -0.184000 0.952000 -0.216000 +0.138500 0.502100 -0.121900 -0.184000 0.952000 -0.216000 +0.150000 0.409600 -0.060900 -0.208000 -0.072000 0.968000 +0.150000 0.409600 -0.060900 -0.208000 -0.072000 0.968000 +0.151400 0.401700 -0.060900 -0.480000 -0.416000 0.760000 +0.150000 0.401700 -0.062100 -0.392000 -0.400000 0.816000 +0.150000 0.401700 -0.062100 -0.392000 -0.400000 0.816000 +0.150000 -0.251000 -0.118100 0.224000 -0.792000 0.560000 +0.150000 -0.251000 -0.118100 0.224000 -0.792000 0.560000 +0.161400 -0.251000 -0.121900 0.152000 -0.792000 0.576000 +0.150000 -0.253200 -0.121900 0.192000 -0.808000 0.552000 +0.150000 -0.253200 -0.121900 0.192000 -0.808000 0.552000 +0.250000 0.432000 -0.060900 0.224000 0.624000 0.736000 +0.250000 0.432000 -0.060900 0.224000 0.624000 0.736000 +0.203100 0.451900 -0.060900 0.264000 0.672000 0.680000 +0.250000 0.451900 -0.094000 0.248000 0.784000 0.552000 +0.250000 0.451900 -0.094000 0.248000 0.784000 0.552000 +0.200000 0.352900 -0.060900 -0.368000 -0.496000 0.776000 +0.200000 0.352900 -0.060900 -0.368000 -0.496000 0.776000 +0.201200 0.351500 -0.060900 -0.488000 -0.576000 0.648000 +0.200000 0.351500 -0.062100 -0.312000 -0.640000 0.696000 +0.200000 0.351500 -0.062100 -0.312000 -0.640000 0.696000 +0.200000 -0.041200 -0.121900 0.160000 0.488000 0.856000 +0.200000 -0.041200 -0.121900 0.160000 0.488000 0.856000 +0.222300 -0.050200 -0.121900 0.200000 0.432000 0.872000 +0.200000 -0.050200 -0.116900 0.136000 0.368000 0.912000 +0.200000 -0.050200 -0.116900 0.136000 0.368000 0.912000 +0.300000 0.451900 -0.106900 0.184000 0.864000 0.456000 +0.300000 0.451900 -0.106900 0.184000 0.864000 0.456000 +0.300000 0.458100 -0.121900 0.224000 0.952000 -0.176000 +0.323400 0.451900 -0.121900 0.248000 0.944000 -0.200000 +0.300000 0.451900 -0.131100 0.200000 0.712000 -0.664000 +0.300000 0.451900 -0.131100 0.200000 0.712000 -0.664000 +0.366500 0.200800 -0.121900 -0.760000 -0.624000 0.168000 +0.366500 0.200800 -0.121900 -0.760000 -0.624000 0.168000 +0.400000 0.200800 -0.077800 -0.600000 -0.432000 0.664000 +0.400000 0.152400 -0.121900 -0.688000 -0.712000 -0.048000 +0.400000 0.152400 -0.121900 -0.688000 -0.712000 -0.048000 +0.400000 0.072600 -0.121900 -0.632000 0.256000 0.720000 +0.400000 0.072600 -0.121900 -0.632000 0.256000 0.720000 +0.400000 0.050200 -0.114800 -0.552000 0.256000 0.784000 +0.393200 0.050200 -0.121900 -0.648000 0.352000 0.664000 +0.393200 0.050200 -0.121900 -0.648000 0.352000 0.664000 +0.450000 -0.100400 -0.078400 -0.088000 0.200000 0.968000 +0.450000 -0.100400 -0.078400 -0.088000 0.200000 0.968000 +0.400000 -0.100400 -0.080400 -0.024000 0.176000 0.976000 +0.450000 -0.150600 -0.064700 -0.192000 0.128000 0.968000 +0.400000 -0.150600 -0.068400 -0.344000 -0.312000 0.880000 +0.450000 -0.200800 -0.072200 -0.256000 -0.536000 0.800000 +0.400000 -0.200800 -0.119100 -0.200000 -0.688000 0.688000 +0.450000 -0.227100 -0.121900 -0.296000 -0.712000 0.624000 +0.400000 -0.203000 -0.121900 -0.184000 -0.672000 0.712000 +0.450000 -0.251000 -0.179900 -0.288000 -0.680000 0.664000 +0.400000 -0.249800 -0.182900 0.472000 -0.752000 0.448000 +0.415700 -0.251000 -0.182900 -0.088000 -0.872000 0.480000 +0.400000 -0.249400 -0.243900 0.760000 -0.472000 -0.424000 +0.450000 -0.251000 -0.203800 -0.216000 -0.960000 -0.144000 +0.450000 -0.248400 -0.243900 -0.224000 -0.888000 -0.384000 +0.459300 -0.251000 -0.243900 -0.280000 -0.864000 -0.400000 +0.459300 -0.251000 -0.243900 -0.280000 -0.864000 -0.400000 +0.450000 0.163500 -0.060900 -0.600000 -0.504000 0.608000 +0.450000 0.163500 -0.060900 -0.600000 -0.504000 0.608000 +0.460500 0.150600 -0.060900 -0.624000 -0.512000 0.584000 +0.450000 0.150600 -0.075000 -0.616000 -0.488000 0.608000 +0.450000 0.150600 -0.075000 -0.616000 -0.488000 0.608000 +0.504600 0.100400 -0.060900 -0.704000 -0.248000 0.656000 +0.504600 0.100400 -0.060900 -0.704000 -0.248000 0.656000 +0.500000 0.067400 -0.060900 -0.592000 0.120000 0.792000 +0.500000 0.100400 -0.067100 -0.632000 -0.296000 0.704000 +0.500000 0.100400 -0.067100 -0.632000 -0.296000 0.704000 +0.550000 -0.159500 -0.060900 0.248000 0.472000 0.840000 +0.550000 -0.159500 -0.060900 0.248000 0.472000 0.840000 +0.530700 -0.150600 -0.060900 0.208000 0.504000 0.832000 +0.550000 -0.150600 -0.067100 0.240000 0.480000 0.840000 +0.550000 -0.150600 -0.067100 0.240000 0.480000 0.840000 +0.546800 -0.351500 -0.121900 -0.560000 -0.304000 0.760000 +0.546800 -0.351500 -0.121900 -0.560000 -0.304000 0.760000 +0.550000 -0.317100 -0.121900 -0.368000 0.064000 0.920000 +0.550000 -0.351500 -0.118900 -0.368000 0.056000 0.920000 +0.558500 -0.351500 -0.121900 0.208000 -0.648000 0.728000 +0.550000 -0.353000 -0.121900 -0.032000 -0.832000 0.536000 +0.550000 -0.351500 -0.118900 -0.368000 0.056000 0.920000 +0.546800 -0.351500 -0.121900 -0.560000 -0.304000 0.760000 +0.550000 -0.353000 -0.121900 -0.032000 -0.832000 0.536000 +0.500000 -0.351500 -0.156800 -0.392000 -0.248000 0.880000 +0.550000 -0.389500 -0.182900 -0.304000 -0.784000 0.528000 +0.500000 -0.372900 -0.182900 -0.184000 -0.776000 0.592000 +0.550000 -0.401700 -0.218900 -0.128000 -0.904000 0.392000 +0.500000 -0.400600 -0.243900 0.024000 -0.920000 0.384000 +0.503900 -0.401700 -0.243900 -0.232000 -0.936000 0.256000 +0.500000 -0.400200 -0.304800 -0.176000 -0.672000 -0.712000 +0.502600 -0.401700 -0.304800 -0.320000 -0.840000 -0.416000 +0.500000 -0.351500 -0.354900 -0.384000 -0.472000 -0.784000 +0.550000 -0.401700 -0.333700 -0.144000 -0.688000 -0.704000 +0.550000 -0.351500 -0.364500 0.120000 -0.104000 -0.984000 +0.500000 -0.351500 -0.354900 -0.384000 -0.472000 -0.784000 +0.550000 -0.316300 -0.304800 -0.472000 0.688000 -0.536000 +0.500000 -0.333600 -0.304800 -0.408000 0.824000 -0.376000 +0.550000 -0.301200 -0.279200 -0.712000 0.120000 -0.680000 +0.500000 -0.310500 -0.243900 -0.600000 0.776000 -0.152000 +0.513800 -0.301200 -0.243900 -0.728000 0.592000 -0.328000 +0.500000 -0.316400 -0.182900 -0.704000 0.472000 0.520000 +0.511800 -0.301200 -0.182900 -0.912000 0.352000 0.176000 +0.500000 -0.351500 -0.156800 -0.392000 -0.248000 0.880000 +0.550000 -0.301200 -0.123600 -0.624000 -0.440000 0.632000 +0.546800 -0.351500 -0.121900 -0.560000 -0.304000 0.760000 +0.550000 -0.317100 -0.121900 -0.368000 0.064000 0.920000 +0.550000 -0.317100 -0.121900 -0.368000 0.064000 0.920000 +0.550000 -0.242100 -0.060900 -0.400000 -0.536000 0.736000 +0.550000 -0.242100 -0.060900 -0.400000 -0.536000 0.736000 +0.562800 -0.251000 -0.060900 -0.368000 -0.568000 0.720000 +0.550000 -0.251000 -0.069700 -0.416000 -0.584000 0.688000 +0.550000 -0.251000 -0.069700 -0.416000 -0.584000 0.688000 +0.552600 -0.301200 -0.121900 -0.368000 -0.384000 0.840000 +0.552600 -0.301200 -0.121900 -0.368000 -0.384000 0.840000 +0.600000 -0.301200 -0.098800 -0.176000 -0.576000 0.792000 +0.600000 -0.333000 -0.121900 0.024000 -0.312000 0.944000 +0.650000 -0.301200 -0.100200 0.264000 -0.568000 0.768000 +0.650000 -0.327200 -0.121900 -0.280000 -0.536000 0.792000 +0.700000 -0.301200 -0.068800 0.336000 0.392000 0.848000 +0.679500 -0.351500 -0.121900 -0.424000 -0.464000 0.768000 +0.700000 -0.351500 -0.108700 -0.352000 -0.464000 0.808000 +0.700000 -0.372000 -0.121900 -0.360000 -0.440000 0.816000 +0.750000 -0.351500 -0.097900 0.640000 0.048000 0.760000 +0.737900 -0.401700 -0.121900 -0.352000 -0.448000 0.816000 +0.750000 -0.401700 -0.115900 -0.264000 -0.344000 0.896000 +0.750000 -0.411100 -0.121900 -0.304000 -0.456000 0.824000 +0.800000 -0.401700 -0.115500 0.392000 0.184000 0.896000 +0.800000 -0.418600 -0.121900 0.304000 -0.320000 0.888000 +0.750000 -0.411100 -0.121900 -0.304000 -0.456000 0.824000 +0.800000 -0.451900 -0.135400 0.168000 -0.384000 0.904000 +0.750000 -0.451900 -0.153800 -0.384000 -0.528000 0.752000 +0.800000 -0.502100 -0.171200 -0.360000 -0.648000 0.664000 +0.750000 -0.479900 -0.182900 -0.456000 -0.632000 0.616000 +0.783200 -0.502100 -0.182900 -0.448000 -0.720000 0.512000 +0.750000 -0.502100 -0.236900 -0.448000 -0.776000 0.432000 +0.800000 -0.511100 -0.182900 -0.376000 -0.744000 0.544000 +0.750000 -0.505200 -0.243900 -0.480000 -0.856000 0.152000 +0.800000 -0.519900 -0.243900 -0.400000 -0.904000 -0.112000 +0.750000 -0.502100 -0.254300 -0.448000 -0.832000 -0.312000 +0.800000 -0.502100 -0.293400 -0.120000 -0.840000 -0.520000 +0.750000 -0.487000 -0.304800 -0.104000 -0.744000 -0.656000 +0.800000 -0.493800 -0.304800 0.032000 -0.688000 -0.720000 +0.750000 -0.451900 -0.330900 0.152000 -0.080000 -0.984000 +0.800000 -0.451900 -0.330300 0.328000 0.200000 -0.920000 +0.750000 -0.401700 -0.321600 0.336000 0.000000 -0.936000 +0.800000 -0.418300 -0.304800 0.408000 0.496000 -0.760000 +0.779200 -0.401700 -0.304800 0.400000 0.336000 -0.848000 +0.800000 -0.401700 -0.291400 0.440000 0.456000 -0.760000 +0.754800 -0.351500 -0.304800 0.424000 0.136000 -0.888000 +0.800000 -0.351500 -0.277300 0.568000 0.408000 -0.704000 +0.750000 -0.334300 -0.304800 0.512000 0.112000 -0.840000 +0.800000 -0.328800 -0.243900 0.640000 0.656000 -0.384000 +0.750000 -0.301200 -0.299800 0.512000 0.144000 -0.840000 +0.780500 -0.301200 -0.243900 0.848000 0.504000 -0.128000 +0.750000 -0.251000 -0.256700 0.824000 0.520000 -0.208000 +0.752500 -0.251000 -0.243900 0.840000 0.528000 -0.096000 +0.750000 -0.247000 -0.243900 0.832000 0.536000 -0.096000 +0.750000 -0.251000 -0.218200 0.840000 0.520000 0.096000 +0.717800 -0.200800 -0.243900 0.824000 0.560000 -0.064000 +0.746300 -0.251000 -0.182900 0.848000 0.496000 0.152000 +0.713600 -0.200800 -0.182900 0.824000 0.512000 0.224000 +0.719200 -0.251000 -0.121900 0.760000 0.456000 0.440000 +0.700000 -0.200800 -0.144600 0.696000 0.528000 0.480000 +0.700000 -0.217500 -0.121900 0.616000 0.552000 0.544000 +0.677400 -0.200800 -0.121900 0.528000 0.512000 0.672000 +0.700000 -0.200800 -0.144600 0.696000 0.528000 0.480000 +0.652900 -0.150600 -0.121900 0.752000 0.456000 0.464000 +0.700000 -0.178500 -0.182900 0.792000 0.568000 0.200000 +0.675300 -0.150600 -0.182900 0.768000 0.552000 0.296000 +0.700000 -0.175300 -0.243900 0.752000 0.600000 -0.240000 +0.674200 -0.150600 -0.243900 0.696000 0.600000 -0.384000 +0.674200 -0.150600 -0.243900 0.696000 0.600000 -0.384000 +0.600000 -0.272000 -0.060900 -0.264000 -0.632000 0.720000 +0.600000 -0.272000 -0.060900 -0.264000 -0.632000 0.720000 +0.600000 -0.301200 -0.098800 -0.176000 -0.576000 0.792000 +0.650000 -0.258100 -0.060900 0.392000 -0.456000 0.792000 +0.650000 -0.301200 -0.100200 0.264000 -0.568000 0.768000 +0.657600 -0.251000 -0.060900 0.456000 -0.072000 0.880000 +0.700000 -0.301200 -0.068800 0.336000 0.392000 0.848000 +0.700000 -0.251000 -0.086700 0.608000 0.464000 0.632000 +0.700000 -0.251000 -0.086700 0.608000 0.464000 0.632000 +0.650000 0.350500 -0.060900 0.712000 0.536000 -0.440000 +0.650000 0.350500 -0.060900 0.712000 0.536000 -0.440000 +0.650000 0.301200 -0.100800 0.528000 0.504000 -0.672000 +0.680100 0.301200 -0.060900 0.752000 0.544000 -0.368000 +0.680100 0.301200 -0.060900 0.752000 0.544000 -0.368000 +0.700000 0.251000 -0.093200 0.552000 0.600000 -0.568000 +0.700000 0.251000 -0.093200 0.552000 0.600000 -0.568000 +0.673000 0.251000 -0.121900 0.568000 0.576000 -0.584000 +0.700000 0.229200 -0.121900 0.528000 0.656000 -0.528000 +0.650000 0.251000 -0.154700 0.488000 0.640000 -0.584000 +0.700000 0.200800 -0.171600 0.480000 0.608000 -0.616000 +0.650000 0.227800 -0.182900 0.368000 0.576000 -0.720000 +0.687200 0.200800 -0.182900 0.432000 0.544000 -0.712000 +0.700000 0.200800 -0.171600 0.480000 0.608000 -0.616000 +0.700000 0.190400 -0.182900 0.432000 0.560000 -0.696000 +0.700000 0.190400 -0.182900 0.432000 0.560000 -0.696000 +0.650000 -0.200800 -0.092600 0.656000 0.384000 0.640000 +0.650000 -0.200800 -0.092600 0.656000 0.384000 0.640000 +0.650000 -0.150600 -0.116200 0.720000 0.480000 0.488000 +0.677400 -0.200800 -0.121900 0.528000 0.512000 0.672000 +0.652900 -0.150600 -0.121900 0.752000 0.456000 0.464000 +0.652900 -0.150600 -0.121900 0.752000 0.456000 0.464000 +0.734900 0.200800 -0.121900 0.552000 0.608000 -0.552000 +0.734900 0.200800 -0.121900 0.552000 0.608000 -0.552000 +0.750000 0.186400 -0.121900 0.504000 0.648000 -0.560000 +0.750000 0.200800 -0.104400 0.480000 0.680000 -0.544000 +0.750000 0.200800 -0.104400 0.480000 0.680000 -0.544000 +0.750000 -0.351500 -0.097900 0.640000 0.048000 0.760000 +0.750000 -0.351500 -0.097900 0.640000 0.048000 0.760000 +0.700000 -0.351500 -0.108700 -0.352000 -0.464000 0.808000 +0.750000 -0.301200 -0.116500 0.704000 0.400000 0.568000 +0.700000 -0.301200 -0.068800 0.336000 0.392000 0.848000 +0.700000 -0.301200 -0.068800 0.336000 0.392000 0.848000 +-0.950000 -0.150600 -0.169000 -0.584000 -0.792000 0.136000 +-0.950000 -0.150600 -0.169000 -0.584000 -0.792000 0.136000 +-0.950000 -0.152700 -0.182900 -0.600000 -0.784000 0.144000 +-0.952800 -0.150600 -0.182900 -0.568000 -0.808000 0.136000 +-0.950000 -0.161800 -0.243900 -0.584000 -0.784000 0.176000 +-0.966700 -0.150600 -0.243900 -0.472000 -0.864000 0.152000 +-0.950000 -0.180000 -0.304800 -0.552000 -0.600000 -0.568000 +-0.989000 -0.150600 -0.304800 -0.440000 -0.624000 -0.640000 +-0.950000 -0.150600 -0.330800 -0.416000 -0.432000 -0.792000 +-0.950000 -0.150600 -0.330800 -0.416000 -0.432000 -0.792000 +-0.900000 -0.492700 -0.121900 -0.520000 0.712000 0.448000 +-0.900000 -0.492700 -0.121900 -0.520000 0.712000 0.448000 +-0.900000 -0.462200 -0.182900 0.320000 0.888000 0.304000 +-0.878700 -0.502100 -0.121900 0.408000 0.368000 0.832000 +-0.850000 -0.490700 -0.182900 0.328000 0.896000 0.288000 +-0.850000 -0.502100 -0.144600 0.400000 0.776000 0.480000 +-0.820300 -0.502100 -0.182900 0.496000 0.792000 0.344000 +-0.850000 -0.519700 -0.121900 0.200000 0.624000 0.752000 +-0.800000 -0.513200 -0.182900 -0.080000 0.880000 0.456000 +-0.800000 -0.539500 -0.121900 0.176000 0.680000 0.704000 +-0.750000 -0.503000 -0.182900 -0.200000 0.848000 0.472000 +-0.750000 -0.549900 -0.121900 0.080000 0.648000 0.752000 +-0.749300 -0.502100 -0.182900 -0.920000 -0.232000 0.288000 +-0.723300 -0.502100 -0.121900 -0.896000 -0.224000 0.368000 +-0.723300 -0.502100 -0.121900 -0.896000 -0.224000 0.368000 +-0.900000 -0.511500 -0.121900 -0.520000 -0.664000 0.528000 +-0.900000 -0.511500 -0.121900 -0.520000 -0.664000 0.528000 +-0.900000 -0.542100 -0.182900 -0.808000 -0.560000 0.136000 +-0.868200 -0.552300 -0.121900 -0.520000 -0.224000 0.816000 +-0.892400 -0.552300 -0.182900 -0.760000 -0.624000 0.176000 +-0.850000 -0.569100 -0.121900 -0.488000 -0.776000 0.384000 +-0.850000 -0.592600 -0.182900 -0.520000 -0.800000 0.264000 +-0.800000 -0.584500 -0.121900 -0.288000 -0.544000 0.776000 +-0.832500 -0.602500 -0.182900 -0.576000 -0.768000 0.272000 +-0.800000 -0.602500 -0.136500 -0.416000 -0.648000 0.632000 +-0.800000 -0.620600 -0.182900 -0.312000 -0.880000 0.336000 +-0.764000 -0.602500 -0.121900 -0.176000 -0.816000 0.544000 +-0.750000 -0.630100 -0.182900 -0.144000 -0.912000 0.360000 +-0.750000 -0.605000 -0.121900 -0.152000 -0.872000 0.456000 +-0.750000 -0.605000 -0.121900 -0.152000 -0.872000 0.456000 +-0.802000 -0.351500 -0.121900 -0.840000 -0.520000 0.096000 +-0.802000 -0.351500 -0.121900 -0.840000 -0.520000 0.096000 +-0.832400 -0.301200 -0.121900 -0.840000 -0.528000 0.048000 +-0.802200 -0.351500 -0.182900 -0.872000 -0.480000 0.016000 +-0.831100 -0.301200 -0.182900 -0.848000 -0.520000 0.016000 +-0.807300 -0.351500 -0.243900 -0.864000 -0.472000 0.152000 +-0.834700 -0.301200 -0.243900 -0.840000 -0.504000 0.184000 +-0.834700 -0.301200 -0.243900 -0.840000 -0.504000 0.184000 +-0.779100 0.150600 -0.182900 0.400000 0.664000 -0.616000 +-0.779100 0.150600 -0.182900 0.400000 0.664000 -0.616000 +-0.750000 0.132600 -0.182900 0.408000 0.656000 -0.624000 +-0.750000 0.150600 -0.159200 0.432000 0.664000 -0.600000 +-0.750000 0.150600 -0.159200 0.432000 0.664000 -0.600000 +-0.750000 -0.448400 -0.121900 -0.880000 -0.432000 0.160000 +-0.750000 -0.448400 -0.121900 -0.880000 -0.432000 0.160000 +-0.750000 -0.451900 -0.133400 -0.896000 -0.392000 0.184000 +-0.771000 -0.401700 -0.121900 -0.872000 -0.456000 0.128000 +-0.757600 -0.451900 -0.182900 -0.952000 -0.232000 0.184000 +-0.775200 -0.401700 -0.182900 -0.904000 -0.400000 0.120000 +-0.769800 -0.451900 -0.243900 -0.952000 -0.080000 0.272000 +-0.781800 -0.401700 -0.243900 -0.912000 -0.336000 0.208000 +-0.787800 -0.451900 -0.304800 -0.984000 0.136000 -0.040000 +-0.797400 -0.401700 -0.304800 -0.928000 -0.344000 0.056000 +-0.797400 -0.401700 -0.304800 -0.928000 -0.344000 0.056000 +-0.800000 -0.584500 -0.121900 -0.288000 -0.544000 0.776000 +-0.800000 -0.584500 -0.121900 -0.288000 -0.544000 0.776000 +-0.764000 -0.602500 -0.121900 -0.176000 -0.816000 0.544000 +-0.800000 -0.602500 -0.136500 -0.416000 -0.648000 0.632000 +-0.800000 -0.602500 -0.136500 -0.416000 -0.648000 0.632000 +-0.750000 0.174400 -0.121900 0.448000 0.824000 -0.336000 +-0.750000 0.174400 -0.121900 0.448000 0.824000 -0.336000 +-0.750000 0.150600 -0.159200 0.432000 0.664000 -0.600000 +-0.715000 0.150600 -0.121900 0.512000 0.744000 -0.408000 +-0.715000 0.150600 -0.121900 0.512000 0.744000 -0.408000 +-0.700900 0.100400 -0.182900 0.440000 0.608000 -0.648000 +-0.700900 0.100400 -0.182900 0.440000 0.608000 -0.648000 +-0.700000 0.099700 -0.182900 0.504000 0.560000 -0.640000 +-0.700000 0.100400 -0.182100 0.536000 0.592000 -0.592000 +-0.700000 0.100400 -0.182100 0.536000 0.592000 -0.592000 +-0.750000 -0.448400 -0.121900 -0.880000 -0.432000 0.160000 +-0.750000 -0.448400 -0.121900 -0.880000 -0.432000 0.160000 +-0.748200 -0.451900 -0.121900 -0.880000 -0.440000 0.160000 +-0.750000 -0.451900 -0.133400 -0.896000 -0.392000 0.184000 +-0.750000 -0.451900 -0.133400 -0.896000 -0.392000 0.184000 +-0.700000 0.140000 -0.121900 0.536000 0.728000 -0.408000 +-0.700000 0.140000 -0.121900 0.536000 0.728000 -0.408000 +-0.700000 0.100400 -0.182100 0.536000 0.592000 -0.592000 +-0.657700 0.100400 -0.121900 0.728000 0.576000 -0.360000 +-0.657700 0.100400 -0.121900 0.728000 0.576000 -0.360000 +-0.652800 0.050200 -0.182900 0.592000 0.536000 -0.592000 +-0.652800 0.050200 -0.182900 0.592000 0.536000 -0.592000 +-0.650000 0.045800 -0.182900 0.672000 0.432000 -0.592000 +-0.650000 0.050200 -0.178200 0.664000 0.544000 -0.504000 +-0.621400 0.000000 -0.182900 0.848000 0.280000 -0.440000 +-0.614300 0.050200 -0.121900 0.720000 0.480000 -0.480000 +-0.601900 0.000000 -0.121900 0.848000 0.208000 -0.472000 +-0.601900 0.000000 -0.121900 0.848000 0.208000 -0.472000 +-0.650000 0.089500 -0.121900 0.728000 0.552000 -0.384000 +-0.650000 0.089500 -0.121900 0.728000 0.552000 -0.384000 +-0.650000 0.050200 -0.178200 0.664000 0.544000 -0.504000 +-0.614300 0.050200 -0.121900 0.720000 0.480000 -0.480000 +-0.614300 0.050200 -0.121900 0.720000 0.480000 -0.480000 +-0.491700 -0.150600 -0.182900 -0.448000 0.848000 -0.264000 +-0.491700 -0.150600 -0.182900 -0.448000 0.848000 -0.264000 +-0.500000 -0.150600 -0.154000 -0.424000 0.880000 -0.160000 +-0.500000 -0.154300 -0.182900 -0.320000 0.920000 -0.176000 +-0.500000 -0.154300 -0.182900 -0.320000 0.920000 -0.176000 +-0.372200 0.000000 -0.121900 -0.848000 0.480000 -0.200000 +-0.372200 0.000000 -0.121900 -0.848000 0.480000 -0.200000 +-0.350000 0.000000 -0.171400 -0.688000 0.416000 -0.584000 +-0.350000 0.031200 -0.121900 -0.744000 0.552000 -0.352000 +-0.350000 0.031200 -0.121900 -0.744000 0.552000 -0.352000 +-0.350000 -0.652700 -0.168800 -0.864000 0.056000 0.488000 +-0.350000 -0.652700 -0.168800 -0.864000 0.056000 0.488000 +-0.300000 -0.652700 -0.176500 0.496000 0.568000 0.648000 +-0.350000 -0.647900 -0.182900 0.008000 0.768000 0.624000 +-0.300000 -0.647500 -0.182900 0.464000 0.632000 0.616000 +-0.350000 -0.630200 -0.243900 -0.144000 0.776000 0.600000 +-0.300000 -0.607200 -0.243900 -0.248000 0.672000 0.688000 +-0.300000 -0.647500 -0.182900 0.464000 0.632000 0.616000 +-0.286800 -0.602500 -0.243900 -0.320000 0.232000 0.912000 +-0.293900 -0.652700 -0.182900 0.576000 0.496000 0.640000 +-0.250000 -0.602500 -0.226600 0.288000 -0.512000 0.800000 +-0.250000 -0.652700 -0.232900 0.624000 0.072000 0.768000 +-0.233200 -0.602500 -0.243900 0.608000 -0.320000 0.720000 +-0.241600 -0.652700 -0.243900 0.680000 -0.216000 0.688000 +-0.250000 -0.652700 -0.232900 0.624000 0.072000 0.768000 +-0.250000 -0.679700 -0.243900 0.728000 -0.208000 0.640000 +-0.293900 -0.652700 -0.182900 0.576000 0.496000 0.640000 +-0.256000 -0.703000 -0.243900 0.696000 -0.392000 0.584000 +-0.293800 -0.703000 -0.182900 0.608000 -0.624000 0.488000 +-0.293900 -0.652700 -0.182900 0.576000 0.496000 0.640000 +-0.300000 -0.703000 -0.173800 0.616000 -0.544000 0.552000 +-0.300000 -0.652700 -0.176500 0.496000 0.568000 0.648000 +-0.350000 -0.703000 -0.180700 -0.616000 -0.504000 0.592000 +-0.350000 -0.652700 -0.168800 -0.864000 0.056000 0.488000 +-0.350000 -0.652700 -0.168800 -0.864000 0.056000 0.488000 +-0.260200 -0.552300 -0.121900 -0.560000 -0.752000 0.336000 +-0.260200 -0.552300 -0.121900 -0.560000 -0.752000 0.336000 +-0.300000 -0.516400 -0.121900 -0.256000 -0.872000 0.400000 +-0.285200 -0.552300 -0.182900 -0.616000 -0.680000 0.384000 +-0.300000 -0.538300 -0.182900 -0.584000 -0.696000 0.408000 +-0.300000 -0.552300 -0.209900 -0.624000 -0.616000 0.456000 +-0.300000 -0.552300 -0.209900 -0.624000 -0.616000 0.456000 +-0.300000 -0.647500 -0.182900 0.464000 0.632000 0.616000 +-0.300000 -0.647500 -0.182900 0.464000 0.632000 0.616000 +-0.293900 -0.652700 -0.182900 0.576000 0.496000 0.640000 +-0.300000 -0.652700 -0.176500 0.496000 0.568000 0.648000 +-0.300000 -0.652700 -0.176500 0.496000 0.568000 0.648000 +-0.200000 0.251000 -0.156200 -0.432000 0.168000 -0.880000 +-0.200000 0.251000 -0.156200 -0.432000 0.168000 -0.880000 +-0.250000 0.251000 -0.124000 -0.376000 0.088000 -0.920000 +-0.200000 0.200800 -0.161600 -0.480000 0.384000 -0.776000 +-0.250000 0.200800 -0.129700 -0.392000 0.152000 -0.904000 +-0.250000 0.200800 -0.129700 -0.392000 0.152000 -0.904000 +-0.200000 -0.534300 -0.121900 0.456000 -0.832000 0.296000 +-0.200000 -0.534300 -0.121900 0.456000 -0.832000 0.296000 +-0.235800 -0.552300 -0.121900 0.448000 -0.816000 0.336000 +-0.200000 -0.549300 -0.182900 0.504000 -0.784000 0.344000 +-0.204600 -0.552300 -0.182900 0.504000 -0.776000 0.360000 +-0.200000 -0.552300 -0.190900 0.520000 -0.768000 0.360000 +-0.200000 -0.552300 -0.190900 0.520000 -0.768000 0.360000 +-0.200000 0.401700 -0.127400 -0.400000 0.440000 -0.800000 +-0.200000 0.401700 -0.127400 -0.400000 0.440000 -0.800000 +-0.150000 0.401700 -0.148200 -0.240000 0.400000 -0.872000 +-0.200000 0.351500 -0.146000 -0.416000 0.224000 -0.872000 +-0.150000 0.351500 -0.156300 -0.024000 0.152000 -0.984000 +-0.200000 0.301200 -0.154100 -0.392000 0.112000 -0.904000 +-0.150000 0.301200 -0.169700 -0.080000 0.248000 -0.960000 +-0.150000 0.351500 -0.156300 -0.024000 0.152000 -0.984000 +-0.100000 0.301200 -0.172200 -0.168000 0.416000 -0.888000 +-0.100000 0.351500 -0.158200 0.008000 0.264000 -0.960000 +-0.150000 0.351500 -0.156300 -0.024000 0.152000 -0.984000 +-0.100000 0.401700 -0.143600 0.056000 0.120000 -0.984000 +-0.150000 0.401700 -0.148200 -0.240000 0.400000 -0.872000 +-0.100000 0.451900 -0.142300 -0.128000 0.312000 -0.936000 +-0.150000 0.451900 -0.123200 -0.344000 0.512000 -0.784000 +-0.150000 0.451900 -0.123200 -0.344000 0.512000 -0.784000 +-0.100000 0.044900 -0.121900 0.816000 0.112000 0.552000 +-0.100000 0.044900 -0.121900 0.816000 0.112000 0.552000 +-0.100700 0.050200 -0.121900 0.856000 0.048000 0.504000 +-0.100000 0.050200 -0.123300 0.696000 -0.176000 0.688000 +-0.100000 0.050200 -0.123300 0.696000 -0.176000 0.688000 +-0.100000 0.451900 -0.142300 -0.128000 0.312000 -0.936000 +-0.100000 0.451900 -0.142300 -0.128000 0.312000 -0.936000 +-0.050000 0.451900 -0.137500 0.040000 0.112000 -0.992000 +-0.100000 0.401700 -0.143600 0.056000 0.120000 -0.984000 +-0.050000 0.401700 -0.142300 0.000000 0.168000 -0.984000 +-0.100000 0.351500 -0.158200 0.008000 0.264000 -0.960000 +-0.050000 0.351500 -0.155800 -0.048000 0.328000 -0.936000 +-0.050000 0.401700 -0.142300 0.000000 0.168000 -0.984000 +0.000000 0.351500 -0.164900 -0.080000 0.368000 -0.920000 +0.000000 0.401700 -0.144600 -0.056000 0.192000 -0.976000 +0.050000 0.351500 -0.166400 0.000000 0.392000 -0.912000 +0.050000 0.401700 -0.150400 -0.088000 0.216000 -0.968000 +0.100000 0.351500 -0.169000 0.056000 0.272000 -0.952000 +0.100000 0.401700 -0.152800 -0.048000 0.168000 -0.984000 +0.150000 0.351500 -0.160600 0.144000 0.128000 -0.976000 +0.150000 0.401700 -0.154900 -0.096000 0.088000 -0.984000 +0.200000 0.351500 -0.169700 -0.320000 0.304000 -0.888000 +0.200000 0.401700 -0.169400 -0.056000 0.168000 -0.976000 +0.150000 0.401700 -0.154900 -0.096000 0.088000 -0.984000 +0.200000 0.451900 -0.151000 0.136000 0.400000 -0.896000 +0.150000 0.451900 -0.151900 0.184000 0.376000 -0.904000 +0.200000 0.484800 -0.121900 0.312000 0.872000 0.360000 +0.150000 0.502100 -0.123200 0.032000 0.424000 -0.896000 +0.153400 0.502100 -0.121900 0.448000 0.824000 -0.336000 +0.153400 0.502100 -0.121900 0.448000 0.824000 -0.336000 +-0.089600 0.000000 -0.121900 0.568000 0.512000 0.632000 +-0.089600 0.000000 -0.121900 0.568000 0.512000 0.632000 +-0.050000 0.000000 -0.158900 0.584000 0.336000 0.728000 +-0.050000 -0.024600 -0.121900 0.296000 0.656000 0.688000 +0.000000 0.000000 -0.165000 0.096000 0.640000 0.752000 +0.000000 -0.035500 -0.121900 0.072000 0.496000 0.856000 +0.050000 0.000000 -0.179700 0.216000 0.504000 0.832000 +0.050000 -0.038600 -0.121900 0.000000 0.528000 0.840000 +0.100000 0.000000 -0.179900 0.000000 0.528000 0.840000 +0.100000 -0.037100 -0.121900 -0.016000 0.544000 0.832000 +0.100000 -0.037100 -0.121900 -0.016000 0.544000 0.832000 +-0.054100 -0.401700 -0.121900 0.656000 -0.688000 0.280000 +-0.054100 -0.401700 -0.121900 0.656000 -0.688000 0.280000 +-0.098000 -0.451900 -0.121900 0.712000 -0.680000 0.120000 +-0.061900 -0.401700 -0.182900 0.744000 -0.648000 -0.120000 +-0.098100 -0.451900 -0.182900 0.736000 -0.672000 0.032000 +-0.071000 -0.401700 -0.243900 0.856000 -0.496000 -0.072000 +-0.094700 -0.451900 -0.243900 0.784000 -0.568000 0.216000 +-0.073900 -0.401700 -0.304800 0.784000 -0.304000 -0.528000 +-0.061500 -0.451900 -0.304800 0.928000 -0.352000 0.088000 +-0.100000 -0.401700 -0.330800 0.576000 -0.152000 -0.792000 +-0.100000 -0.451900 -0.336100 0.496000 -0.048000 -0.856000 +-0.150000 -0.401700 -0.364300 0.552000 0.080000 -0.824000 +-0.145700 -0.451900 -0.365800 0.464000 0.040000 -0.880000 +-0.150000 -0.417500 -0.365800 0.544000 0.056000 -0.832000 +-0.150000 -0.451900 -0.368100 0.456000 -0.056000 -0.880000 +-0.145700 -0.451900 -0.365800 0.464000 0.040000 -0.880000 +-0.150000 -0.502100 -0.367300 0.088000 -0.320000 -0.936000 +-0.147100 -0.502100 -0.365800 0.472000 -0.192000 -0.848000 +-0.150000 -0.505900 -0.365800 0.272000 -0.320000 -0.904000 +-0.150000 -0.505900 -0.365800 0.272000 -0.320000 -0.904000 +-0.050000 0.401700 -0.142300 0.000000 0.168000 -0.984000 +-0.050000 0.401700 -0.142300 0.000000 0.168000 -0.984000 +-0.050000 0.451900 -0.137500 0.040000 0.112000 -0.992000 +0.000000 0.401700 -0.144600 -0.056000 0.192000 -0.976000 +0.000000 0.451900 -0.135500 0.000000 0.160000 -0.984000 +0.050000 0.401700 -0.150400 -0.088000 0.216000 -0.968000 +0.050000 0.451900 -0.139600 -0.080000 0.232000 -0.960000 +0.100000 0.401700 -0.152800 -0.048000 0.168000 -0.984000 +0.100000 0.451900 -0.146900 -0.088000 0.224000 -0.968000 +0.150000 0.401700 -0.154900 -0.096000 0.088000 -0.984000 +0.150000 0.451900 -0.151900 0.184000 0.376000 -0.904000 +0.150000 0.451900 -0.151900 0.184000 0.376000 -0.904000 +-0.012800 0.200800 -0.121900 0.688000 -0.616000 0.376000 +-0.012800 0.200800 -0.121900 0.688000 -0.616000 0.376000 +0.000000 0.211400 -0.121900 0.496000 -0.712000 0.480000 +0.000000 0.200800 -0.169000 0.576000 -0.744000 0.320000 +0.000000 0.200800 -0.169000 0.576000 -0.744000 0.320000 +-0.050000 0.150600 -0.159500 0.712000 -0.480000 0.504000 +-0.050000 0.150600 -0.159500 0.712000 -0.480000 0.504000 +-0.033200 0.150600 -0.182900 0.832000 -0.552000 -0.016000 +-0.050000 0.116900 -0.182900 0.944000 -0.304000 0.048000 +-0.050000 0.150600 -0.210200 0.840000 -0.208000 -0.496000 +-0.050000 0.150600 -0.210200 0.840000 -0.208000 -0.496000 +-0.050000 0.047900 -0.182900 0.488000 0.480000 0.720000 +-0.050000 0.047900 -0.182900 0.488000 0.480000 0.720000 +-0.050000 0.000000 -0.158900 0.584000 0.336000 0.728000 +0.000000 0.039200 -0.182900 0.256000 0.544000 0.792000 +0.000000 0.000000 -0.165000 0.096000 0.640000 0.752000 +0.050000 0.005700 -0.182900 0.312000 0.584000 0.744000 +0.050000 0.000000 -0.179700 0.216000 0.504000 0.832000 +0.100000 0.004900 -0.182900 -0.288000 0.864000 0.400000 +0.100000 0.000000 -0.179900 0.000000 0.528000 0.840000 +0.100000 0.000000 -0.179900 0.000000 0.528000 0.840000 +0.000000 0.200800 -0.169000 0.576000 -0.744000 0.320000 +0.000000 0.200800 -0.169000 0.576000 -0.744000 0.320000 +0.008500 0.200800 -0.182900 0.416000 -0.688000 -0.584000 +0.000000 0.195100 -0.182900 0.504000 -0.656000 -0.544000 +0.000000 0.200800 -0.186400 0.272000 -0.456000 -0.840000 +0.000000 0.200800 -0.186400 0.272000 -0.456000 -0.840000 +0.050000 -0.327900 -0.182900 0.552000 -0.824000 0.048000 +0.050000 -0.327900 -0.182900 0.552000 -0.824000 0.048000 +0.003100 -0.351500 -0.182900 0.504000 -0.840000 -0.160000 +0.050000 -0.321600 -0.121900 0.584000 -0.712000 0.376000 +0.006400 -0.351500 -0.121900 0.552000 -0.776000 0.288000 +0.006400 -0.351500 -0.121900 0.552000 -0.776000 0.288000 +0.150000 0.251000 -0.128300 0.144000 -0.904000 0.392000 +0.150000 0.251000 -0.128300 0.144000 -0.904000 0.392000 +0.150000 0.284700 -0.182900 0.352000 0.368000 -0.856000 +0.194700 0.251000 -0.182900 0.496000 -0.104000 -0.856000 +0.150000 0.251000 -0.192500 0.112000 0.024000 -0.992000 +0.150000 0.224100 -0.182900 0.056000 -0.672000 -0.728000 +0.194700 0.251000 -0.182900 0.496000 -0.104000 -0.856000 +0.150000 0.251000 -0.128300 0.144000 -0.904000 0.392000 +0.150000 0.251000 -0.128300 0.144000 -0.904000 0.392000 +0.211500 -0.301200 -0.182900 -0.568000 -0.672000 0.464000 +0.211500 -0.301200 -0.182900 -0.568000 -0.672000 0.464000 +0.250000 -0.301200 -0.149400 -0.376000 -0.584000 0.712000 +0.250000 -0.319600 -0.182900 -0.280000 -0.832000 0.472000 +0.300000 -0.301200 -0.149800 -0.024000 -0.480000 0.872000 +0.300000 -0.330300 -0.182900 -0.312000 -0.696000 0.632000 +0.350000 -0.301200 -0.148100 0.392000 -0.048000 0.912000 +0.331500 -0.351500 -0.182900 -0.432000 -0.576000 0.688000 +0.350000 -0.351500 -0.171100 -0.312000 -0.512000 0.792000 +0.350000 -0.366900 -0.182900 -0.368000 -0.552000 0.736000 +0.400000 -0.351500 -0.165500 0.064000 -0.056000 0.992000 +0.400000 -0.370500 -0.182900 -0.008000 -0.616000 0.776000 +0.450000 -0.351500 -0.174300 0.040000 0.080000 0.992000 +0.450000 -0.370700 -0.182900 -0.080000 -0.520000 0.848000 +0.500000 -0.351500 -0.156800 -0.392000 -0.248000 0.880000 +0.500000 -0.372900 -0.182900 -0.184000 -0.776000 0.592000 +0.450000 -0.370700 -0.182900 -0.080000 -0.520000 0.848000 +0.500000 -0.400600 -0.243900 0.024000 -0.920000 0.384000 +0.450000 -0.401700 -0.212100 0.240000 -0.816000 0.520000 +0.496800 -0.401700 -0.243900 0.256000 -0.880000 0.376000 +0.450000 -0.418500 -0.243900 -0.152000 -0.896000 0.400000 +0.492100 -0.401700 -0.304800 0.152000 -0.576000 -0.792000 +0.450000 -0.411100 -0.304800 -0.144000 -0.808000 -0.560000 +0.450000 -0.401700 -0.316200 -0.184000 -0.360000 -0.904000 +0.428900 -0.401700 -0.304800 -0.392000 -0.464000 -0.784000 +0.450000 -0.380500 -0.304800 -0.144000 0.256000 -0.952000 +0.400000 -0.401700 -0.257800 0.112000 -0.952000 -0.280000 +0.450000 -0.351500 -0.290700 -0.176000 0.632000 -0.744000 +0.400000 -0.388800 -0.304800 0.392000 -0.800000 -0.448000 +0.437100 -0.351500 -0.304800 0.688000 0.472000 -0.536000 +0.400000 -0.351500 -0.338800 0.360000 -0.568000 -0.728000 +0.401200 -0.301200 -0.304800 0.744000 0.488000 -0.440000 +0.400000 -0.301200 -0.307300 0.704000 0.496000 -0.496000 +0.400000 -0.299100 -0.304800 0.736000 0.472000 -0.472000 +0.401200 -0.301200 -0.304800 0.744000 0.488000 -0.440000 +0.400000 -0.252300 -0.243900 0.744000 0.488000 -0.440000 +0.429200 -0.301200 -0.243900 0.816000 0.544000 -0.176000 +0.400000 -0.252800 -0.182900 0.760000 0.464000 0.440000 +0.427100 -0.301200 -0.182900 0.776000 0.464000 0.416000 +0.400000 -0.301200 -0.149800 0.528000 0.376000 0.752000 +0.450000 -0.338000 -0.182900 0.248000 0.592000 0.752000 +0.400000 -0.351500 -0.165500 0.064000 -0.056000 0.992000 +0.450000 -0.351500 -0.174300 0.040000 0.080000 0.992000 +0.450000 -0.338000 -0.182900 0.248000 0.592000 0.752000 +0.500000 -0.351500 -0.156800 -0.392000 -0.248000 0.880000 +0.500000 -0.316400 -0.182900 -0.704000 0.472000 0.520000 +0.450000 -0.338000 -0.182900 0.248000 0.592000 0.752000 +0.500000 -0.310500 -0.243900 -0.600000 0.776000 -0.152000 +0.450000 -0.327300 -0.243900 -0.064000 0.864000 -0.488000 +0.500000 -0.333600 -0.304800 -0.408000 0.824000 -0.376000 +0.450000 -0.351500 -0.290700 -0.176000 0.632000 -0.744000 +0.458900 -0.351500 -0.304800 -0.472000 0.360000 -0.792000 +0.450000 -0.380500 -0.304800 -0.144000 0.256000 -0.952000 +0.500000 -0.400200 -0.304800 -0.176000 -0.672000 -0.712000 +0.492100 -0.401700 -0.304800 0.152000 -0.576000 -0.792000 +0.500000 -0.400600 -0.243900 0.024000 -0.920000 0.384000 +0.496800 -0.401700 -0.243900 0.256000 -0.880000 0.376000 +0.496800 -0.401700 -0.243900 0.256000 -0.880000 0.376000 +0.265700 0.200800 -0.182900 -0.312000 -0.760000 -0.552000 +0.265700 0.200800 -0.182900 -0.312000 -0.760000 -0.552000 +0.300000 0.218000 -0.182900 0.768000 0.424000 -0.464000 +0.300000 0.200800 -0.174500 0.536000 -0.360000 0.752000 +0.306800 0.200800 -0.182900 0.752000 -0.400000 -0.512000 +0.300000 0.193900 -0.182900 0.520000 -0.696000 -0.480000 +0.300000 0.200800 -0.185900 0.256000 -0.192000 -0.944000 +0.265700 0.200800 -0.182900 -0.312000 -0.760000 -0.552000 +0.300000 0.218000 -0.182900 0.768000 0.424000 -0.464000 +0.300000 0.200800 -0.185900 0.256000 -0.192000 -0.944000 +0.306800 0.200800 -0.182900 0.752000 -0.400000 -0.512000 +0.306800 0.200800 -0.182900 0.752000 -0.400000 -0.512000 +0.265700 0.200800 -0.182900 -0.312000 -0.760000 -0.552000 +0.265700 0.200800 -0.182900 -0.312000 -0.760000 -0.552000 +0.300000 0.200800 -0.174500 0.536000 -0.360000 0.752000 +0.300000 0.193900 -0.182900 0.520000 -0.696000 -0.480000 +0.300000 0.193900 -0.182900 0.520000 -0.696000 -0.480000 +0.300000 0.284000 -0.182900 -0.168000 -0.184000 -0.960000 +0.300000 0.284000 -0.182900 -0.168000 -0.184000 -0.960000 +0.300000 0.251000 -0.156100 -0.368000 -0.808000 -0.448000 +0.321900 0.251000 -0.182900 -0.240000 -0.296000 -0.920000 +0.321900 0.251000 -0.182900 -0.240000 -0.296000 -0.920000 +0.307700 -0.050200 -0.121900 -0.592000 0.464000 0.648000 +0.307700 -0.050200 -0.121900 -0.592000 0.464000 0.648000 +0.300000 -0.060700 -0.121900 -0.512000 0.456000 0.720000 +0.300000 -0.050200 -0.130700 -0.504000 0.472000 0.720000 +0.300000 -0.050200 -0.130700 -0.504000 0.472000 0.720000 +0.329200 -0.200800 -0.121900 0.376000 -0.264000 0.880000 +0.329200 -0.200800 -0.121900 0.376000 -0.264000 0.880000 +0.350000 -0.182300 -0.121900 -0.032000 -0.520000 0.848000 +0.350000 -0.200800 -0.137500 0.248000 -0.232000 0.936000 +0.391400 -0.200800 -0.121900 -0.176000 -0.648000 0.736000 +0.391400 -0.200800 -0.121900 -0.176000 -0.648000 0.736000 +0.400000 0.100400 -0.150800 -0.768000 0.376000 0.512000 +0.400000 0.100400 -0.150800 -0.768000 0.376000 0.512000 +0.381500 0.100400 -0.182900 -0.896000 0.440000 -0.008000 +0.400000 0.146600 -0.182900 -0.440000 0.464000 -0.760000 +0.400000 0.100400 -0.207800 -0.424000 0.688000 -0.576000 +0.400000 0.100400 -0.207800 -0.424000 0.688000 -0.576000 +0.400000 -0.203000 -0.121900 -0.184000 -0.672000 0.712000 +0.400000 -0.203000 -0.121900 -0.184000 -0.672000 0.712000 +0.354900 -0.251000 -0.121900 0.704000 -0.304000 0.632000 +0.400000 -0.249800 -0.182900 0.472000 -0.752000 0.448000 +0.398900 -0.251000 -0.182900 0.896000 -0.160000 0.400000 +0.400000 -0.249400 -0.243900 0.760000 -0.472000 -0.424000 +0.399000 -0.251000 -0.243900 0.912000 -0.008000 -0.392000 +0.399000 -0.251000 -0.243900 0.912000 -0.008000 -0.392000 +0.400000 -0.351500 -0.165500 0.064000 -0.056000 0.992000 +0.400000 -0.351500 -0.165500 0.064000 -0.056000 0.992000 +0.350000 -0.351500 -0.171100 -0.312000 -0.512000 0.792000 +0.400000 -0.301200 -0.149800 0.528000 0.376000 0.752000 +0.350000 -0.301200 -0.148100 0.392000 -0.048000 0.912000 +0.350000 -0.301200 -0.148100 0.392000 -0.048000 0.912000 +0.450000 -0.251000 -0.179900 -0.288000 -0.680000 0.664000 +0.450000 -0.251000 -0.179900 -0.288000 -0.680000 0.664000 +0.450000 -0.255300 -0.182900 -0.208000 -0.656000 0.712000 +0.415700 -0.251000 -0.182900 -0.088000 -0.872000 0.480000 +0.450000 -0.251000 -0.203800 -0.216000 -0.960000 -0.144000 +0.450000 -0.251000 -0.203800 -0.216000 -0.960000 -0.144000 +0.500000 0.355500 -0.182900 0.400000 0.616000 -0.664000 +0.500000 0.355500 -0.182900 0.400000 0.616000 -0.664000 +0.506000 0.351500 -0.182900 0.424000 0.584000 -0.680000 +0.500000 0.393600 -0.121900 0.504000 0.744000 -0.432000 +0.550000 0.351500 -0.135900 0.456000 0.632000 -0.616000 +0.550000 0.362300 -0.121900 0.400000 0.656000 -0.632000 +0.566700 0.351500 -0.121900 0.448000 0.536000 -0.704000 +0.566700 0.351500 -0.121900 0.448000 0.536000 -0.704000 +0.550000 0.351500 -0.135900 0.456000 0.632000 -0.616000 +0.550000 0.351500 -0.135900 0.456000 0.632000 -0.616000 +0.550000 0.301200 -0.167400 0.408000 0.504000 -0.752000 +0.506000 0.351500 -0.182900 0.424000 0.584000 -0.680000 +0.526000 0.301200 -0.182900 0.408000 0.312000 -0.848000 +0.500000 0.351500 -0.187300 0.416000 0.568000 -0.696000 +0.500000 0.301200 -0.193500 0.168000 0.072000 -0.976000 +0.526000 0.301200 -0.182900 0.408000 0.312000 -0.848000 +0.500000 0.251000 -0.199400 0.072000 0.096000 -0.984000 +0.550000 0.283200 -0.182900 0.320000 0.472000 -0.816000 +0.550000 0.251000 -0.199600 0.176000 0.288000 -0.936000 +0.500000 0.251000 -0.199400 0.072000 0.096000 -0.984000 +0.550000 0.200800 -0.211100 0.016000 0.048000 -0.992000 +0.500000 0.200800 -0.200200 -0.104000 -0.048000 -0.992000 +0.550000 0.150600 -0.215400 -0.144000 0.080000 -0.984000 +0.500000 0.150600 -0.194400 -0.208000 0.240000 -0.944000 +0.550000 0.100400 -0.212600 -0.200000 0.352000 -0.904000 +0.500000 0.100400 -0.210700 0.048000 0.704000 -0.704000 +0.550000 0.067800 -0.243900 0.024000 0.672000 -0.728000 +0.500000 0.082500 -0.243900 0.216000 0.832000 -0.504000 +0.550000 0.050200 -0.258400 0.160000 0.632000 -0.752000 +0.500000 0.050200 -0.303800 0.264000 0.816000 -0.504000 +0.550000 0.015600 -0.304800 0.472000 0.712000 -0.512000 +0.500000 0.049600 -0.304800 0.264000 0.736000 -0.616000 +0.550000 0.000000 -0.335900 0.576000 0.464000 -0.664000 +0.500000 0.014000 -0.365800 0.216000 0.784000 -0.568000 +0.524100 0.000000 -0.365800 0.648000 0.312000 -0.688000 +0.500000 0.000000 -0.393700 0.528000 0.072000 -0.840000 +0.500000 -0.027200 -0.365800 0.264000 -0.576000 -0.768000 +0.524100 0.000000 -0.365800 0.648000 0.312000 -0.688000 +0.500000 -0.050200 -0.339600 -0.136000 -0.672000 -0.720000 +0.550000 0.000000 -0.335900 0.576000 0.464000 -0.664000 +0.550000 -0.050200 -0.345500 0.192000 -0.560000 -0.792000 +0.550000 -0.050200 -0.345500 0.192000 -0.560000 -0.792000 +0.526000 0.301200 -0.182900 0.408000 0.312000 -0.848000 +0.526000 0.301200 -0.182900 0.408000 0.312000 -0.848000 +0.550000 0.283200 -0.182900 0.320000 0.472000 -0.816000 +0.550000 0.301200 -0.167400 0.408000 0.504000 -0.752000 +0.550000 0.301200 -0.167400 0.408000 0.504000 -0.752000 +0.500000 -0.250100 -0.121900 -0.432000 -0.712000 0.536000 +0.500000 -0.250100 -0.121900 -0.432000 -0.712000 0.536000 +0.501100 -0.251000 -0.121900 -0.552000 -0.624000 0.544000 +0.500000 -0.251000 -0.123800 -0.544000 -0.688000 0.456000 +0.500000 -0.251000 -0.123800 -0.544000 -0.688000 0.456000 +0.608400 0.251000 -0.182900 0.328000 0.488000 -0.800000 +0.608400 0.251000 -0.182900 0.328000 0.488000 -0.800000 +0.650000 0.227800 -0.182900 0.368000 0.576000 -0.720000 +0.650000 0.251000 -0.154700 0.488000 0.640000 -0.584000 +0.650000 0.251000 -0.154700 0.488000 0.640000 -0.584000 +0.600000 -0.333000 -0.121900 0.024000 -0.312000 0.944000 +0.600000 -0.333000 -0.121900 0.024000 -0.312000 0.944000 +0.600000 -0.351500 -0.136300 0.144000 -0.792000 0.584000 +0.650000 -0.327200 -0.121900 -0.280000 -0.536000 0.792000 +0.650000 -0.351500 -0.143500 -0.280000 -0.536000 0.784000 +0.679500 -0.351500 -0.121900 -0.424000 -0.464000 0.768000 +0.650000 -0.401700 -0.175000 -0.240000 -0.688000 0.680000 +0.700000 -0.372000 -0.121900 -0.360000 -0.440000 0.816000 +0.700000 -0.401700 -0.145100 -0.400000 -0.504000 0.752000 +0.737900 -0.401700 -0.121900 -0.352000 -0.448000 0.816000 +0.700000 -0.435200 -0.182900 -0.448000 -0.712000 0.536000 +0.750000 -0.411100 -0.121900 -0.304000 -0.456000 0.824000 +0.719600 -0.451900 -0.182900 -0.568000 -0.640000 0.512000 +0.750000 -0.451900 -0.153800 -0.384000 -0.528000 0.752000 +0.750000 -0.479900 -0.182900 -0.456000 -0.632000 0.616000 +0.719600 -0.451900 -0.182900 -0.568000 -0.640000 0.512000 +0.750000 -0.502100 -0.236900 -0.448000 -0.776000 0.432000 +0.700000 -0.451900 -0.215800 -0.528000 -0.696000 0.472000 +0.744200 -0.502100 -0.243900 -0.480000 -0.864000 0.128000 +0.700000 -0.472400 -0.243900 -0.560000 -0.816000 -0.016000 +0.750000 -0.502100 -0.254300 -0.448000 -0.832000 -0.312000 +0.700000 -0.481300 -0.304800 -0.240000 -0.712000 -0.656000 +0.750000 -0.487000 -0.304800 -0.104000 -0.744000 -0.656000 +0.700000 -0.451900 -0.321600 -0.136000 -0.312000 -0.936000 +0.750000 -0.451900 -0.330900 0.152000 -0.080000 -0.984000 +0.700000 -0.401700 -0.334100 0.120000 -0.128000 -0.976000 +0.750000 -0.401700 -0.321600 0.336000 0.000000 -0.936000 +0.700000 -0.351500 -0.333900 0.344000 -0.040000 -0.936000 +0.750000 -0.351500 -0.307800 0.512000 0.128000 -0.840000 +0.700000 -0.301200 -0.354900 0.160000 -0.240000 -0.952000 +0.750000 -0.334300 -0.304800 0.512000 0.112000 -0.840000 +0.744500 -0.301200 -0.304800 0.640000 0.104000 -0.760000 +0.750000 -0.301200 -0.299800 0.512000 0.144000 -0.840000 +0.728900 -0.251000 -0.304800 0.720000 0.440000 -0.528000 +0.750000 -0.251000 -0.256700 0.824000 0.520000 -0.208000 +0.700000 -0.211400 -0.304800 0.288000 0.624000 -0.720000 +0.750000 -0.247000 -0.243900 0.832000 0.536000 -0.096000 +0.700000 -0.200800 -0.294000 0.576000 0.608000 -0.536000 +0.717800 -0.200800 -0.243900 0.824000 0.560000 -0.064000 +0.700000 -0.175300 -0.243900 0.752000 0.600000 -0.240000 +0.713600 -0.200800 -0.182900 0.824000 0.512000 0.224000 +0.700000 -0.178500 -0.182900 0.792000 0.568000 0.200000 +0.700000 -0.200800 -0.144600 0.696000 0.528000 0.480000 +0.700000 -0.200800 -0.144600 0.696000 0.528000 0.480000 +0.600000 -0.351500 -0.136300 0.144000 -0.792000 0.584000 +0.600000 -0.351500 -0.136300 0.144000 -0.792000 0.584000 +0.650000 -0.351500 -0.143500 -0.280000 -0.536000 0.784000 +0.600000 -0.392700 -0.182900 -0.184000 -0.752000 0.624000 +0.650000 -0.401700 -0.175000 -0.240000 -0.688000 0.680000 +0.628900 -0.401700 -0.182900 -0.216000 -0.760000 0.608000 +0.650000 -0.407700 -0.182900 -0.272000 -0.728000 0.624000 +0.600000 -0.401700 -0.203000 -0.208000 -0.872000 0.432000 +0.650000 -0.436800 -0.243900 -0.416000 -0.848000 0.320000 +0.600000 -0.414700 -0.243900 -0.184000 -0.936000 0.272000 +0.650000 -0.449600 -0.304800 -0.280000 -0.432000 -0.848000 +0.600000 -0.422100 -0.304800 -0.120000 -0.768000 -0.616000 +0.650000 -0.401700 -0.330300 -0.240000 -0.360000 -0.896000 +0.600000 -0.401700 -0.327900 -0.024000 -0.544000 -0.832000 +0.650000 -0.351500 -0.332000 0.016000 -0.144000 -0.984000 +0.600000 -0.351500 -0.337900 0.040000 -0.080000 -0.992000 +0.650000 -0.301200 -0.350300 0.016000 -0.440000 -0.888000 +0.600000 -0.301200 -0.352300 -0.528000 -0.312000 -0.776000 +0.600000 -0.301200 -0.352300 -0.528000 -0.312000 -0.776000 +0.650000 0.278000 -0.121900 0.448000 0.624000 -0.624000 +0.650000 0.278000 -0.121900 0.448000 0.624000 -0.624000 +0.650000 0.251000 -0.154700 0.488000 0.640000 -0.584000 +0.673000 0.251000 -0.121900 0.568000 0.576000 -0.584000 +0.673000 0.251000 -0.121900 0.568000 0.576000 -0.584000 +0.700000 -0.401700 -0.145100 -0.400000 -0.504000 0.752000 +0.700000 -0.401700 -0.145100 -0.400000 -0.504000 0.752000 +0.650000 -0.401700 -0.175000 -0.240000 -0.688000 0.680000 +0.700000 -0.435200 -0.182900 -0.448000 -0.712000 0.536000 +0.650000 -0.407700 -0.182900 -0.272000 -0.728000 0.624000 +0.700000 -0.451900 -0.215800 -0.528000 -0.696000 0.472000 +0.650000 -0.436800 -0.243900 -0.416000 -0.848000 0.320000 +0.673600 -0.451900 -0.243900 -0.480000 -0.752000 0.448000 +0.650000 -0.449600 -0.304800 -0.280000 -0.432000 -0.848000 +0.653100 -0.451900 -0.304800 -0.336000 -0.480000 -0.800000 +0.650000 -0.401700 -0.330300 -0.240000 -0.360000 -0.896000 +0.700000 -0.451900 -0.321600 -0.136000 -0.312000 -0.936000 +0.700000 -0.401700 -0.334100 0.120000 -0.128000 -0.976000 +0.650000 -0.401700 -0.330300 -0.240000 -0.360000 -0.896000 +0.700000 -0.351500 -0.333900 0.344000 -0.040000 -0.936000 +0.650000 -0.351500 -0.332000 0.016000 -0.144000 -0.984000 +0.700000 -0.301200 -0.354900 0.160000 -0.240000 -0.952000 +0.650000 -0.301200 -0.350300 0.016000 -0.440000 -0.888000 +0.650000 -0.301200 -0.350300 0.016000 -0.440000 -0.888000 +0.719200 -0.251000 -0.121900 0.760000 0.456000 0.440000 +0.719200 -0.251000 -0.121900 0.760000 0.456000 0.440000 +0.750000 -0.297400 -0.121900 0.656000 0.584000 0.464000 +0.746300 -0.251000 -0.182900 0.848000 0.496000 0.152000 +0.750000 -0.257500 -0.182900 0.856000 0.488000 0.120000 +0.750000 -0.251000 -0.218200 0.840000 0.520000 0.096000 +0.777000 -0.301200 -0.182900 0.784000 0.536000 0.304000 +0.752500 -0.251000 -0.243900 0.840000 0.528000 -0.096000 +0.780500 -0.301200 -0.243900 0.848000 0.504000 -0.128000 +0.777000 -0.301200 -0.182900 0.784000 0.536000 0.304000 +0.800000 -0.328800 -0.243900 0.640000 0.656000 -0.384000 +0.800000 -0.333100 -0.182900 0.680000 0.680000 0.256000 +0.829500 -0.351500 -0.243900 0.648000 0.640000 -0.400000 +0.821300 -0.351500 -0.182900 0.624000 0.648000 0.416000 +0.850000 -0.375700 -0.243900 0.544000 0.616000 -0.552000 +0.850000 -0.381900 -0.182900 0.632000 0.696000 0.328000 +0.890600 -0.401700 -0.243900 0.576000 0.616000 -0.528000 +0.872200 -0.401700 -0.182900 0.632000 0.640000 0.416000 +0.900000 -0.412700 -0.243900 0.520000 0.640000 -0.552000 +0.900000 -0.433800 -0.182900 0.512000 0.688000 0.504000 +0.950000 -0.433400 -0.243900 0.528000 0.832000 0.152000 +0.933400 -0.451900 -0.182900 0.464000 0.712000 0.512000 +0.950000 -0.451900 -0.206400 0.504000 0.736000 0.440000 +0.950000 -0.463500 -0.182900 0.464000 0.672000 0.568000 +0.933400 -0.451900 -0.182900 0.464000 0.712000 0.512000 +0.950000 -0.502100 -0.136000 -0.296000 0.400000 0.864000 +0.900000 -0.451900 -0.156900 0.400000 0.632000 0.656000 +0.900000 -0.502100 -0.123800 -0.168000 -0.208000 0.960000 +0.850000 -0.451900 -0.123600 0.328000 0.296000 0.888000 +0.850000 -0.502100 -0.142100 -0.224000 -0.520000 0.816000 +0.850000 -0.502100 -0.142100 -0.224000 -0.520000 0.816000 +0.750000 -0.257500 -0.182900 0.856000 0.488000 0.120000 +0.750000 -0.257500 -0.182900 0.856000 0.488000 0.120000 +0.750000 -0.297400 -0.121900 0.656000 0.584000 0.464000 +0.777000 -0.301200 -0.182900 0.784000 0.536000 0.304000 +0.752700 -0.301200 -0.121900 0.792000 0.344000 0.488000 +0.800000 -0.333100 -0.182900 0.680000 0.680000 0.256000 +0.775700 -0.351500 -0.121900 0.600000 0.328000 0.720000 +0.800000 -0.351500 -0.149400 0.664000 0.512000 0.528000 +0.800000 -0.391100 -0.121900 0.384000 0.416000 0.816000 +0.821300 -0.351500 -0.182900 0.624000 0.648000 0.416000 +0.810500 -0.401700 -0.121900 0.456000 0.104000 0.872000 +0.850000 -0.381900 -0.182900 0.632000 0.696000 0.328000 +0.850000 -0.401700 -0.151500 0.608000 0.552000 0.560000 +0.872200 -0.401700 -0.182900 0.632000 0.640000 0.416000 +0.850000 -0.451900 -0.123600 0.328000 0.296000 0.888000 +0.900000 -0.433800 -0.182900 0.512000 0.688000 0.504000 +0.900000 -0.451900 -0.156900 0.400000 0.632000 0.656000 +0.933400 -0.451900 -0.182900 0.464000 0.712000 0.512000 +0.933400 -0.451900 -0.182900 0.464000 0.712000 0.512000 +0.783200 -0.502100 -0.182900 -0.448000 -0.720000 0.512000 +0.783200 -0.502100 -0.182900 -0.448000 -0.720000 0.512000 +0.800000 -0.502100 -0.171200 -0.360000 -0.648000 0.664000 +0.800000 -0.511100 -0.182900 -0.376000 -0.744000 0.544000 +0.800000 -0.511100 -0.182900 -0.376000 -0.744000 0.544000 +0.800000 -0.333100 -0.182900 0.680000 0.680000 0.256000 +0.800000 -0.333100 -0.182900 0.680000 0.680000 0.256000 +0.821300 -0.351500 -0.182900 0.624000 0.648000 0.416000 +0.800000 -0.351500 -0.149400 0.664000 0.512000 0.528000 +0.800000 -0.351500 -0.149400 0.664000 0.512000 0.528000 +0.900000 -0.552300 -0.159100 -0.496000 -0.592000 0.632000 +0.900000 -0.552300 -0.159100 -0.496000 -0.592000 0.632000 +0.900000 -0.573700 -0.182900 -0.608000 -0.704000 0.344000 +0.876500 -0.552300 -0.182900 -0.528000 -0.672000 0.504000 +0.900000 -0.578300 -0.243900 -0.552000 -0.704000 -0.440000 +0.868400 -0.552300 -0.243900 -0.552000 -0.760000 -0.328000 +0.900000 -0.552300 -0.278500 -0.424000 -0.592000 -0.672000 +0.900000 -0.552300 -0.278500 -0.424000 -0.592000 -0.672000 +0.900000 0.127900 -0.121900 0.560000 0.776000 -0.264000 +0.900000 0.127900 -0.121900 0.560000 0.776000 -0.264000 +0.931600 0.100400 -0.121900 0.600000 0.744000 -0.272000 +0.900000 0.111100 -0.182900 0.552000 0.712000 -0.416000 +0.912000 0.100400 -0.182900 0.600000 0.704000 -0.360000 +0.900000 0.100400 -0.203200 0.536000 0.688000 -0.472000 +0.900000 0.100400 -0.203200 0.536000 0.688000 -0.472000 +0.950000 -0.602500 -0.169200 -0.536000 -0.520000 0.656000 +0.950000 -0.602500 -0.169200 -0.536000 -0.520000 0.656000 +0.950000 -0.619400 -0.182900 -0.632000 -0.592000 0.480000 +0.935000 -0.602500 -0.182900 -0.552000 -0.552000 0.608000 +0.950000 -0.619400 -0.243900 -0.600000 -0.584000 -0.536000 +0.933200 -0.602500 -0.243900 -0.584000 -0.624000 -0.512000 +0.950000 -0.602500 -0.260200 -0.544000 -0.504000 -0.664000 +0.950000 -0.602500 -0.260200 -0.544000 -0.504000 -0.664000 +1.000000 -0.251000 -0.154300 -0.728000 -0.648000 0.200000 +1.000000 -0.251000 -0.154300 -0.728000 -0.648000 0.200000 +1.000000 -0.258900 -0.182900 -0.752000 -0.616000 0.208000 +0.993400 -0.251000 -0.182900 -0.736000 -0.640000 0.200000 +1.000000 -0.277900 -0.243900 -0.712000 -0.592000 0.360000 +0.978600 -0.251000 -0.243900 -0.696000 -0.616000 0.352000 +0.978600 -0.251000 -0.243900 -0.696000 -0.616000 0.352000 +0.950000 -0.560000 -0.121900 -0.400000 -0.536000 0.728000 +0.950000 -0.560000 -0.121900 -0.400000 -0.536000 0.728000 +0.992300 -0.602500 -0.121900 -0.520000 -0.480000 0.696000 +0.950000 -0.602500 -0.169200 -0.536000 -0.520000 0.656000 +0.950000 -0.602500 -0.169200 -0.536000 -0.520000 0.656000 +1.000000 -0.652700 -0.168000 -0.488000 -0.568000 0.656000 +1.000000 -0.652700 -0.168000 -0.488000 -0.568000 0.656000 +1.000000 -0.666200 -0.182900 -0.536000 -0.632000 0.544000 +0.983200 -0.652700 -0.182900 -0.528000 -0.608000 0.584000 +1.000000 -0.673300 -0.243900 -0.656000 -0.656000 -0.368000 +0.979500 -0.652700 -0.243900 -0.672000 -0.664000 -0.304000 +1.000000 -0.652700 -0.268800 -0.592000 -0.512000 -0.608000 +1.000000 -0.652700 -0.268800 -0.592000 -0.512000 -0.608000 +-1.000000 0.256900 -0.182900 0.288000 0.752000 -0.584000 +-1.000000 0.256900 -0.182900 0.288000 0.752000 -0.584000 +-1.000000 0.251000 -0.191500 0.280000 0.728000 -0.616000 +-0.985000 0.251000 -0.182900 0.288000 0.752000 -0.576000 +-0.985000 0.251000 -0.182900 0.288000 0.752000 -0.576000 +-0.980800 0.200800 -0.243900 0.232000 0.632000 -0.736000 +-0.980800 0.200800 -0.243900 0.232000 0.632000 -0.736000 +-0.950000 0.189400 -0.243900 0.264000 0.616000 -0.728000 +-0.950000 0.200800 -0.231900 0.272000 0.640000 -0.704000 +-0.950000 0.200800 -0.231900 0.272000 0.640000 -0.704000 +-0.900000 0.214200 -0.182900 0.360000 0.720000 -0.576000 +-0.900000 0.214200 -0.182900 0.360000 0.720000 -0.576000 +-0.900000 0.200800 -0.201400 0.352000 0.680000 -0.640000 +-0.874200 0.200800 -0.182900 0.360000 0.712000 -0.584000 +-0.874200 0.200800 -0.182900 0.360000 0.712000 -0.584000 +-0.878700 0.150600 -0.243900 0.328000 0.616000 -0.704000 +-0.878700 0.150600 -0.243900 0.328000 0.616000 -0.704000 +-0.850000 0.135500 -0.243900 0.320000 0.608000 -0.712000 +-0.850000 0.150600 -0.229000 0.320000 0.608000 -0.720000 +-0.850000 0.150600 -0.229000 0.320000 0.608000 -0.720000 +-0.900000 -0.542100 -0.182900 -0.808000 -0.560000 0.136000 +-0.900000 -0.542100 -0.182900 -0.808000 -0.560000 0.136000 +-0.900000 -0.551700 -0.243900 -0.808000 -0.568000 -0.120000 +-0.892400 -0.552300 -0.182900 -0.760000 -0.624000 0.176000 +-0.899500 -0.552300 -0.243900 -0.800000 -0.592000 -0.072000 +-0.850000 -0.592600 -0.182900 -0.520000 -0.800000 0.264000 +-0.851300 -0.602500 -0.243900 -0.680000 -0.720000 -0.008000 +-0.850000 -0.602500 -0.238600 -0.616000 -0.752000 0.216000 +-0.850000 -0.603800 -0.243900 -0.656000 -0.744000 0.064000 +-0.832500 -0.602500 -0.182900 -0.576000 -0.768000 0.272000 +-0.800000 -0.632800 -0.243900 -0.432000 -0.896000 0.072000 +-0.800000 -0.620600 -0.182900 -0.312000 -0.880000 0.336000 +-0.750000 -0.646000 -0.243900 -0.088000 -0.984000 0.144000 +-0.750000 -0.630100 -0.182900 -0.144000 -0.912000 0.360000 +-0.750000 -0.630100 -0.182900 -0.144000 -0.912000 0.360000 +-0.820300 -0.502100 -0.182900 0.496000 0.792000 0.344000 +-0.820300 -0.502100 -0.182900 0.496000 0.792000 0.344000 +-0.800000 -0.502100 -0.227500 0.432000 0.824000 0.352000 +-0.800000 -0.513200 -0.182900 -0.080000 0.880000 0.456000 +-0.750000 -0.502100 -0.184800 -0.496000 0.696000 0.496000 +-0.750000 -0.503000 -0.182900 -0.200000 0.848000 0.472000 +-0.749300 -0.502100 -0.182900 -0.920000 -0.232000 0.288000 +-0.750000 -0.502100 -0.184800 -0.496000 0.696000 0.496000 +-0.750000 -0.499500 -0.182900 -0.936000 -0.200000 0.264000 +-0.750000 -0.499500 -0.182900 -0.936000 -0.200000 0.264000 +-0.850000 -0.592600 -0.182900 -0.520000 -0.800000 0.264000 +-0.850000 -0.592600 -0.182900 -0.520000 -0.800000 0.264000 +-0.832500 -0.602500 -0.182900 -0.576000 -0.768000 0.272000 +-0.850000 -0.602500 -0.238600 -0.616000 -0.752000 0.216000 +-0.850000 -0.602500 -0.238600 -0.616000 -0.752000 0.216000 +-0.650000 0.045800 -0.182900 0.672000 0.432000 -0.592000 +-0.650000 0.045800 -0.182900 0.672000 0.432000 -0.592000 +-0.650000 0.000000 -0.224600 0.632000 0.368000 -0.672000 +-0.621400 0.000000 -0.182900 0.848000 0.280000 -0.440000 +-0.621400 0.000000 -0.182900 0.848000 0.280000 -0.440000 +-0.600000 -0.629300 -0.182900 0.072000 -0.968000 0.224000 +-0.600000 -0.629300 -0.182900 0.072000 -0.968000 0.224000 +-0.600000 -0.640700 -0.243900 0.080000 -0.976000 0.192000 +-0.550000 -0.618800 -0.182900 0.168000 -0.944000 0.272000 +-0.550000 -0.629900 -0.243900 0.160000 -0.960000 0.200000 +-0.500000 -0.610400 -0.182900 -0.136000 -0.936000 0.304000 +-0.500000 -0.625200 -0.243900 -0.096000 -0.960000 0.240000 +-0.550000 -0.629900 -0.243900 0.160000 -0.960000 0.200000 +-0.500000 -0.637800 -0.304800 -0.208000 -0.976000 -0.032000 +-0.550000 -0.639800 -0.304800 0.152000 -0.984000 0.000000 +-0.500000 -0.633000 -0.365800 -0.088000 -0.968000 -0.200000 +-0.550000 -0.637200 -0.365800 0.152000 -0.968000 -0.168000 +-0.550000 -0.639800 -0.304800 0.152000 -0.984000 0.000000 +-0.600000 -0.645500 -0.365800 0.016000 -0.968000 -0.216000 +-0.600000 -0.650800 -0.304800 0.064000 -0.992000 0.000000 +-0.550000 -0.639800 -0.304800 0.152000 -0.984000 0.000000 +-0.600000 -0.640700 -0.243900 0.080000 -0.976000 0.192000 +-0.550000 -0.629900 -0.243900 0.160000 -0.960000 0.200000 +-0.550000 -0.629900 -0.243900 0.160000 -0.960000 0.200000 +-0.403600 -0.100400 -0.182900 -0.616000 0.592000 -0.512000 +-0.403600 -0.100400 -0.182900 -0.616000 0.592000 -0.512000 +-0.400000 -0.100400 -0.188300 -0.616000 0.576000 -0.520000 +-0.400000 -0.096400 -0.182900 -0.664000 0.552000 -0.496000 +-0.354400 -0.100400 -0.243900 -0.584000 0.448000 -0.664000 +-0.365500 -0.050200 -0.182900 -0.728000 0.384000 -0.560000 +-0.350000 -0.093900 -0.243900 -0.600000 0.408000 -0.680000 +-0.350000 -0.050200 -0.209400 -0.696000 0.392000 -0.584000 +-0.321700 -0.050200 -0.243900 -0.656000 0.344000 -0.656000 +-0.350000 -0.016600 -0.182900 -0.688000 0.360000 -0.616000 +-0.301700 0.000000 -0.243900 -0.744000 0.392000 -0.536000 +-0.340600 0.000000 -0.182900 -0.696000 0.480000 -0.520000 +-0.340600 0.000000 -0.182900 -0.696000 0.480000 -0.520000 +-0.444500 -0.150600 -0.243900 -0.312000 0.784000 -0.528000 +-0.444500 -0.150600 -0.243900 -0.312000 0.784000 -0.528000 +-0.450000 -0.150600 -0.239400 -0.408000 0.792000 -0.448000 +-0.450000 -0.152500 -0.243900 -0.384000 0.800000 -0.448000 +-0.450000 -0.152500 -0.243900 -0.384000 0.800000 -0.448000 +-0.400000 -0.651500 -0.182900 -0.552000 -0.472000 0.672000 +-0.400000 -0.651500 -0.182900 -0.552000 -0.472000 0.672000 +-0.400000 -0.652700 -0.184800 -0.640000 -0.536000 0.536000 +-0.450000 -0.629600 -0.182900 -0.344000 -0.872000 0.320000 +-0.428400 -0.652700 -0.243900 -0.584000 -0.736000 0.336000 +-0.450000 -0.644000 -0.243900 -0.352000 -0.912000 0.200000 +-0.450000 -0.652700 -0.293400 -0.288000 -0.936000 0.160000 +-0.428400 -0.652700 -0.243900 -0.584000 -0.736000 0.336000 +-0.450000 -0.654300 -0.304800 -0.272000 -0.952000 0.040000 +-0.400000 -0.663600 -0.243900 -0.504000 -0.840000 0.160000 +-0.400000 -0.672200 -0.304800 -0.400000 -0.904000 -0.128000 +-0.363900 -0.703000 -0.243900 -0.784000 -0.584000 0.176000 +-0.371300 -0.703000 -0.304800 -0.816000 -0.552000 -0.144000 +-0.350000 -0.730400 -0.243900 -0.544000 -0.776000 0.296000 +-0.350000 -0.747900 -0.304800 -0.512000 -0.832000 -0.184000 +-0.300000 -0.736500 -0.243900 0.320000 -0.832000 0.440000 +-0.330700 -0.753200 -0.304800 -0.192000 -0.968000 -0.112000 +-0.300000 -0.753200 -0.286100 0.088000 -0.928000 0.352000 +-0.300000 -0.758500 -0.304800 0.104000 -0.976000 -0.144000 +-0.281500 -0.753200 -0.304800 0.312000 -0.920000 -0.216000 +-0.300000 -0.753200 -0.317300 0.136000 -0.840000 -0.512000 +-0.300000 -0.758500 -0.304800 0.104000 -0.976000 -0.144000 +-0.330700 -0.753200 -0.304800 -0.192000 -0.968000 -0.112000 +-0.300000 -0.753200 -0.317300 0.136000 -0.840000 -0.512000 +-0.350000 -0.747900 -0.304800 -0.512000 -0.832000 -0.184000 +-0.300000 -0.703000 -0.365100 0.056000 -0.232000 -0.968000 +-0.350000 -0.703000 -0.357000 -0.336000 -0.496000 -0.792000 +-0.300000 -0.687100 -0.365800 0.104000 -0.048000 -0.992000 +-0.350000 -0.679200 -0.365800 -0.072000 -0.176000 -0.976000 +-0.350000 -0.703000 -0.357000 -0.336000 -0.496000 -0.792000 +-0.400000 -0.653700 -0.365800 -0.176000 -0.888000 -0.416000 +-0.371300 -0.703000 -0.304800 -0.816000 -0.552000 -0.144000 +-0.400000 -0.672200 -0.304800 -0.400000 -0.904000 -0.128000 +-0.400000 -0.672200 -0.304800 -0.400000 -0.904000 -0.128000 +-0.428400 -0.652700 -0.243900 -0.584000 -0.736000 0.336000 +-0.428400 -0.652700 -0.243900 -0.584000 -0.736000 0.336000 +-0.400000 -0.652700 -0.184800 -0.640000 -0.536000 0.536000 +-0.400000 -0.663600 -0.243900 -0.504000 -0.840000 0.160000 +-0.396000 -0.652700 -0.182900 -0.176000 0.000000 0.984000 +-0.363900 -0.703000 -0.243900 -0.784000 -0.584000 0.176000 +-0.350700 -0.703000 -0.182900 -0.792000 -0.176000 0.576000 +-0.350000 -0.730400 -0.243900 -0.544000 -0.776000 0.296000 +-0.350000 -0.704300 -0.182900 -0.112000 -0.808000 0.576000 +-0.300000 -0.736500 -0.243900 0.320000 -0.832000 0.440000 +-0.300000 -0.708000 -0.182900 0.360000 -0.768000 0.520000 +-0.300000 -0.708000 -0.182900 0.360000 -0.768000 0.520000 +-0.365500 -0.050200 -0.182900 -0.728000 0.384000 -0.560000 +-0.365500 -0.050200 -0.182900 -0.728000 0.384000 -0.560000 +-0.350000 -0.050200 -0.209400 -0.696000 0.392000 -0.584000 +-0.350000 -0.016600 -0.182900 -0.688000 0.360000 -0.616000 +-0.350000 -0.016600 -0.182900 -0.688000 0.360000 -0.616000 +-0.400000 -0.100400 -0.188300 -0.616000 0.576000 -0.520000 +-0.400000 -0.100400 -0.188300 -0.616000 0.576000 -0.520000 +-0.400000 -0.131400 -0.243900 -0.384000 0.744000 -0.536000 +-0.354400 -0.100400 -0.243900 -0.584000 0.448000 -0.664000 +-0.400000 -0.150600 -0.272200 -0.312000 0.624000 -0.704000 +-0.350000 -0.100400 -0.248500 -0.576000 0.440000 -0.680000 +-0.350000 -0.150600 -0.298700 -0.264000 0.464000 -0.840000 +-0.400000 -0.150600 -0.272200 -0.312000 0.624000 -0.704000 +-0.350000 -0.159400 -0.304800 -0.248000 0.528000 -0.808000 +-0.400000 -0.174400 -0.304800 -0.224000 0.736000 -0.632000 +-0.350000 -0.200800 -0.339000 0.200000 0.416000 -0.880000 +-0.400000 -0.200800 -0.333600 -0.064000 0.568000 -0.816000 +-0.350000 -0.248400 -0.365800 0.184000 0.424000 -0.880000 +-0.400000 -0.239300 -0.365800 0.048000 0.512000 -0.848000 +-0.350000 -0.251000 -0.367200 0.240000 0.168000 -0.952000 +-0.400000 -0.251000 -0.373300 0.080000 0.400000 -0.904000 +-0.350000 -0.301200 -0.377400 0.232000 0.208000 -0.944000 +-0.400000 -0.301200 -0.390900 0.144000 0.296000 -0.936000 +-0.350000 -0.351500 -0.416300 -0.176000 0.600000 -0.768000 +-0.400000 -0.351500 -0.411400 0.000000 0.616000 -0.784000 +-0.400000 -0.351500 -0.411400 0.000000 0.616000 -0.784000 +-0.350000 -0.647900 -0.182900 0.008000 0.768000 0.624000 +-0.350000 -0.647900 -0.182900 0.008000 0.768000 0.624000 +-0.386500 -0.602500 -0.182900 0.376000 -0.032000 0.920000 +-0.350000 -0.630200 -0.243900 -0.144000 0.776000 0.600000 +-0.371400 -0.602500 -0.243900 0.928000 0.016000 0.352000 +-0.371400 -0.602500 -0.243900 0.928000 0.016000 0.352000 +-0.200000 0.172600 -0.182900 -0.488000 0.416000 -0.760000 +-0.200000 0.172600 -0.182900 -0.488000 0.416000 -0.760000 +-0.216700 0.150600 -0.182900 -0.560000 0.376000 -0.728000 +-0.200000 0.150600 -0.197300 -0.488000 0.464000 -0.728000 +-0.249100 0.100400 -0.182900 -0.576000 0.496000 -0.640000 +-0.200000 0.100400 -0.242800 -0.520000 0.512000 -0.672000 +-0.200000 0.100400 -0.242800 -0.520000 0.512000 -0.672000 +-0.200000 0.172600 -0.182900 -0.488000 0.416000 -0.760000 +-0.200000 0.172600 -0.182900 -0.488000 0.416000 -0.760000 +-0.200000 0.150600 -0.197300 -0.488000 0.464000 -0.728000 +-0.173800 0.200800 -0.182900 -0.480000 0.344000 -0.800000 +-0.150000 0.150600 -0.235500 -0.296000 0.536000 -0.784000 +-0.150000 0.200800 -0.199200 -0.328000 0.272000 -0.896000 +-0.150000 0.200800 -0.199200 -0.328000 0.272000 -0.896000 +0.100000 0.004900 -0.182900 -0.288000 0.864000 0.400000 +0.100000 0.004900 -0.182900 -0.288000 0.864000 0.400000 +0.050000 0.005700 -0.182900 0.312000 0.584000 0.744000 +0.100000 0.000000 -0.203800 -0.256000 0.936000 -0.224000 +0.050000 0.042300 -0.243900 0.688000 0.376000 -0.616000 +0.078000 0.000000 -0.243900 0.336000 0.616000 -0.696000 +0.050000 0.000000 -0.258500 0.448000 0.256000 -0.848000 +0.100000 -0.005500 -0.243900 -0.184000 0.760000 -0.616000 +0.050000 -0.050200 -0.279200 0.280000 0.320000 -0.896000 +0.100000 -0.050200 -0.272200 -0.136000 0.384000 -0.904000 +0.050000 -0.100400 -0.298100 0.360000 0.248000 -0.896000 +0.100000 -0.100400 -0.298900 0.040000 0.136000 -0.984000 +0.100000 -0.100400 -0.298900 0.040000 0.136000 -0.984000 +0.078000 0.000000 -0.243900 0.336000 0.616000 -0.696000 +0.078000 0.000000 -0.243900 0.336000 0.616000 -0.696000 +0.100000 -0.005500 -0.243900 -0.184000 0.760000 -0.616000 +0.100000 0.000000 -0.203800 -0.256000 0.936000 -0.224000 +0.100000 0.000000 -0.203800 -0.256000 0.936000 -0.224000 +0.200000 -0.301200 -0.206400 -0.600000 -0.688000 0.384000 +0.200000 -0.301200 -0.206400 -0.600000 -0.688000 0.384000 +0.200000 -0.319700 -0.243900 -0.624000 -0.696000 0.328000 +0.176900 -0.301200 -0.243900 -0.504000 -0.800000 0.304000 +0.200000 -0.340400 -0.304800 -0.480000 -0.448000 -0.744000 +0.170700 -0.301200 -0.304800 -0.520000 -0.608000 -0.592000 +0.200000 -0.301200 -0.321600 -0.488000 -0.368000 -0.784000 +0.200000 -0.301200 -0.321600 -0.488000 -0.368000 -0.784000 +0.300000 -0.330300 -0.182900 -0.312000 -0.696000 0.632000 +0.300000 -0.330300 -0.182900 -0.312000 -0.696000 0.632000 +0.300000 -0.351500 -0.225700 -0.416000 -0.800000 0.416000 +0.250000 -0.319600 -0.182900 -0.280000 -0.832000 0.472000 +0.277600 -0.351500 -0.243900 -0.264000 -0.888000 0.352000 +0.250000 -0.343100 -0.243900 -0.320000 -0.920000 0.208000 +0.271900 -0.351500 -0.304800 -0.112000 -0.784000 -0.608000 +0.250000 -0.348300 -0.304800 -0.128000 -0.736000 -0.656000 +0.300000 -0.351500 -0.310200 -0.192000 -0.728000 -0.648000 +0.250000 -0.313600 -0.365800 -0.336000 -0.640000 -0.680000 +0.300000 -0.308000 -0.365800 0.080000 -0.656000 -0.744000 +0.250000 -0.301200 -0.379400 -0.536000 -0.264000 -0.792000 +0.300000 -0.301200 -0.372900 0.128000 -0.472000 -0.864000 +0.300000 -0.308000 -0.365800 0.080000 -0.656000 -0.744000 +0.333500 -0.301200 -0.365800 0.208000 -0.080000 -0.968000 +0.300000 -0.351500 -0.310200 -0.192000 -0.728000 -0.648000 +0.350000 -0.301200 -0.360500 0.376000 0.184000 -0.904000 +0.348000 -0.351500 -0.365800 -0.720000 -0.032000 -0.680000 +0.350000 -0.334300 -0.365800 -0.304000 0.096000 -0.944000 +0.350000 -0.351500 -0.368100 -0.440000 0.096000 -0.888000 +0.355700 -0.351500 -0.365800 0.360000 -0.072000 -0.928000 +0.350000 -0.354600 -0.365800 -0.264000 -0.632000 -0.720000 +0.400000 -0.351500 -0.338800 0.360000 -0.568000 -0.728000 +0.350000 -0.401700 -0.317400 -0.608000 -0.560000 -0.544000 +0.400000 -0.388800 -0.304800 0.392000 -0.800000 -0.448000 +0.376800 -0.401700 -0.304800 0.336000 -0.848000 -0.392000 +0.400000 -0.401700 -0.257800 0.112000 -0.952000 -0.280000 +0.350000 -0.410700 -0.304800 -0.592000 -0.664000 -0.440000 +0.400000 -0.404800 -0.243900 0.016000 -0.968000 0.240000 +0.350000 -0.409600 -0.243900 -0.632000 -0.696000 0.320000 +0.400000 -0.401700 -0.239700 -0.184000 -0.720000 0.656000 +0.350000 -0.401700 -0.229000 -0.616000 -0.656000 0.416000 +0.400000 -0.370500 -0.182900 -0.008000 -0.616000 0.776000 +0.350000 -0.366900 -0.182900 -0.368000 -0.552000 0.736000 +0.350000 -0.401700 -0.229000 -0.616000 -0.656000 0.416000 +0.331500 -0.351500 -0.182900 -0.432000 -0.576000 0.688000 +0.343800 -0.401700 -0.243900 -0.728000 -0.584000 0.344000 +0.300000 -0.351500 -0.225700 -0.416000 -0.800000 0.416000 +0.300000 -0.357600 -0.243900 -0.288000 -0.920000 0.248000 +0.277600 -0.351500 -0.243900 -0.264000 -0.888000 0.352000 +0.300000 -0.355300 -0.304800 -0.272000 -0.752000 -0.592000 +0.271900 -0.351500 -0.304800 -0.112000 -0.784000 -0.608000 +0.300000 -0.351500 -0.310200 -0.192000 -0.728000 -0.648000 +0.300000 -0.355300 -0.304800 -0.272000 -0.752000 -0.592000 +0.348000 -0.351500 -0.365800 -0.720000 -0.032000 -0.680000 +0.344100 -0.401700 -0.304800 -0.784000 -0.512000 -0.336000 +0.350000 -0.354600 -0.365800 -0.264000 -0.632000 -0.720000 +0.350000 -0.401700 -0.317400 -0.608000 -0.560000 -0.544000 +0.344100 -0.401700 -0.304800 -0.784000 -0.512000 -0.336000 +0.350000 -0.410700 -0.304800 -0.592000 -0.664000 -0.440000 +0.343800 -0.401700 -0.243900 -0.728000 -0.584000 0.344000 +0.350000 -0.409600 -0.243900 -0.632000 -0.696000 0.320000 +0.350000 -0.401700 -0.229000 -0.616000 -0.656000 0.416000 +0.350000 -0.401700 -0.229000 -0.616000 -0.656000 0.416000 +0.300000 -0.330300 -0.182900 -0.312000 -0.696000 0.632000 +0.300000 -0.330300 -0.182900 -0.312000 -0.696000 0.632000 +0.331500 -0.351500 -0.182900 -0.432000 -0.576000 0.688000 +0.300000 -0.351500 -0.225700 -0.416000 -0.800000 0.416000 +0.300000 -0.351500 -0.225700 -0.416000 -0.800000 0.416000 +0.427100 -0.301200 -0.182900 0.776000 0.464000 0.416000 +0.427100 -0.301200 -0.182900 0.776000 0.464000 0.416000 +0.450000 -0.338000 -0.182900 0.248000 0.592000 0.752000 +0.429200 -0.301200 -0.243900 0.816000 0.544000 -0.176000 +0.450000 -0.327300 -0.243900 -0.064000 0.864000 -0.488000 +0.401200 -0.301200 -0.304800 0.744000 0.488000 -0.440000 +0.450000 -0.351500 -0.290700 -0.176000 0.632000 -0.744000 +0.437100 -0.351500 -0.304800 0.688000 0.472000 -0.536000 +0.437100 -0.351500 -0.304800 0.688000 0.472000 -0.536000 +0.450000 -0.370700 -0.182900 -0.080000 -0.520000 0.848000 +0.450000 -0.370700 -0.182900 -0.080000 -0.520000 0.848000 +0.400000 -0.370500 -0.182900 -0.008000 -0.616000 0.776000 +0.450000 -0.401700 -0.212100 0.240000 -0.816000 0.520000 +0.400000 -0.401700 -0.239700 -0.184000 -0.720000 0.656000 +0.450000 -0.418500 -0.243900 -0.152000 -0.896000 0.400000 +0.400000 -0.404800 -0.243900 0.016000 -0.968000 0.240000 +0.450000 -0.411100 -0.304800 -0.144000 -0.808000 -0.560000 +0.400000 -0.401700 -0.257800 0.112000 -0.952000 -0.280000 +0.428900 -0.401700 -0.304800 -0.392000 -0.464000 -0.784000 +0.428900 -0.401700 -0.304800 -0.392000 -0.464000 -0.784000 +0.500000 0.355500 -0.182900 0.400000 0.616000 -0.664000 +0.500000 0.355500 -0.182900 0.400000 0.616000 -0.664000 +0.500000 0.351500 -0.187300 0.416000 0.568000 -0.696000 +0.506000 0.351500 -0.182900 0.424000 0.584000 -0.680000 +0.506000 0.351500 -0.182900 0.424000 0.584000 -0.680000 +0.550000 -0.401700 -0.218900 -0.128000 -0.904000 0.392000 +0.550000 -0.401700 -0.218900 -0.128000 -0.904000 0.392000 +0.550000 -0.409700 -0.243900 -0.144000 -0.944000 0.272000 +0.503900 -0.401700 -0.243900 -0.232000 -0.936000 0.256000 +0.550000 -0.415900 -0.304800 -0.192000 -0.848000 -0.480000 +0.502600 -0.401700 -0.304800 -0.320000 -0.840000 -0.416000 +0.550000 -0.401700 -0.333700 -0.144000 -0.688000 -0.704000 +0.550000 -0.401700 -0.333700 -0.144000 -0.688000 -0.704000 +0.600000 0.200800 -0.209200 0.248000 0.288000 -0.920000 +0.600000 0.200800 -0.209200 0.248000 0.288000 -0.920000 +0.650000 0.200800 -0.204000 0.272000 0.408000 -0.864000 +0.600000 0.150600 -0.225200 0.008000 0.128000 -0.984000 +0.650000 0.150600 -0.219600 0.200000 0.280000 -0.928000 +0.600000 0.100400 -0.237100 -0.096000 0.168000 -0.976000 +0.650000 0.100400 -0.241400 0.232000 0.064000 -0.968000 +0.600000 0.076600 -0.243900 -0.096000 0.360000 -0.920000 +0.650000 0.067400 -0.243900 0.208000 0.056000 -0.968000 +0.600000 0.050200 -0.251100 0.248000 0.344000 -0.896000 +0.650000 0.050200 -0.244900 0.216000 0.040000 -0.968000 +0.600000 0.000000 -0.284600 0.512000 0.112000 -0.840000 +0.650000 0.000000 -0.248500 0.680000 -0.160000 -0.712000 +0.650000 0.000000 -0.248500 0.680000 -0.160000 -0.712000 +0.600000 -0.392700 -0.182900 -0.184000 -0.752000 0.624000 +0.600000 -0.392700 -0.182900 -0.184000 -0.752000 0.624000 +0.628900 -0.401700 -0.182900 -0.216000 -0.760000 0.608000 +0.600000 -0.401700 -0.203000 -0.208000 -0.872000 0.432000 +0.600000 -0.401700 -0.203000 -0.208000 -0.872000 0.432000 +0.700000 -0.451900 -0.215800 -0.528000 -0.696000 0.472000 +0.700000 -0.451900 -0.215800 -0.528000 -0.696000 0.472000 +0.700000 -0.472400 -0.243900 -0.560000 -0.816000 -0.016000 +0.673600 -0.451900 -0.243900 -0.480000 -0.752000 0.448000 +0.700000 -0.481300 -0.304800 -0.240000 -0.712000 -0.656000 +0.653100 -0.451900 -0.304800 -0.336000 -0.480000 -0.800000 +0.700000 -0.451900 -0.321600 -0.136000 -0.312000 -0.936000 +0.700000 -0.451900 -0.321600 -0.136000 -0.312000 -0.936000 +0.700000 -0.435200 -0.182900 -0.448000 -0.712000 0.536000 +0.700000 -0.435200 -0.182900 -0.448000 -0.712000 0.536000 +0.719600 -0.451900 -0.182900 -0.568000 -0.640000 0.512000 +0.700000 -0.451900 -0.215800 -0.528000 -0.696000 0.472000 +0.700000 -0.451900 -0.215800 -0.528000 -0.696000 0.472000 +0.750000 -0.502100 -0.236900 -0.448000 -0.776000 0.432000 +0.750000 -0.502100 -0.236900 -0.448000 -0.776000 0.432000 +0.750000 -0.505200 -0.243900 -0.480000 -0.856000 0.152000 +0.744200 -0.502100 -0.243900 -0.480000 -0.864000 0.128000 +0.750000 -0.502100 -0.254300 -0.448000 -0.832000 -0.312000 +0.750000 -0.502100 -0.254300 -0.448000 -0.832000 -0.312000 +0.750000 0.157000 -0.182900 0.280000 0.720000 -0.624000 +0.750000 0.157000 -0.182900 0.280000 0.720000 -0.624000 +0.750000 0.150600 -0.191500 0.256000 0.656000 -0.704000 +0.769100 0.150600 -0.182900 0.248000 0.704000 -0.648000 +0.769100 0.150600 -0.182900 0.248000 0.704000 -0.648000 +0.929600 0.050200 -0.243900 0.432000 0.672000 -0.584000 +0.929600 0.050200 -0.243900 0.432000 0.672000 -0.584000 +0.950000 0.037500 -0.243900 0.432000 0.688000 -0.576000 +0.950000 0.050200 -0.224500 0.472000 0.712000 -0.504000 +0.950000 0.050200 -0.224500 0.472000 0.712000 -0.504000 +0.950000 0.069900 -0.182900 0.544000 0.736000 -0.392000 +0.950000 0.069900 -0.182900 0.544000 0.736000 -0.392000 +0.950000 0.050200 -0.224500 0.472000 0.712000 -0.504000 +0.978000 0.050200 -0.182900 0.512000 0.768000 -0.376000 +0.978000 0.050200 -0.182900 0.512000 0.768000 -0.376000 +0.950000 -0.451900 -0.206400 0.504000 0.736000 0.440000 +0.950000 -0.451900 -0.206400 0.504000 0.736000 0.440000 +0.950000 -0.433400 -0.243900 0.528000 0.832000 0.152000 +0.980700 -0.451900 -0.243900 0.752000 0.648000 0.032000 +0.950000 -0.451900 -0.300000 0.488000 0.464000 -0.728000 +0.950000 -0.433400 -0.243900 0.528000 0.832000 0.152000 +0.900000 -0.451900 -0.272400 0.368000 0.408000 -0.824000 +0.900000 -0.412700 -0.243900 0.520000 0.640000 -0.552000 +0.850000 -0.451900 -0.293100 0.448000 0.248000 -0.848000 +0.890600 -0.401700 -0.243900 0.576000 0.616000 -0.528000 +0.850000 -0.401700 -0.268600 0.504000 0.432000 -0.744000 +0.850000 -0.375700 -0.243900 0.544000 0.616000 -0.552000 +0.800000 -0.401700 -0.291400 0.440000 0.456000 -0.760000 +0.829500 -0.351500 -0.243900 0.648000 0.640000 -0.400000 +0.800000 -0.351500 -0.277300 0.568000 0.408000 -0.704000 +0.800000 -0.328800 -0.243900 0.640000 0.656000 -0.384000 +0.800000 -0.328800 -0.243900 0.640000 0.656000 -0.384000 +1.000000 -0.503200 -0.182900 0.400000 0.704000 0.576000 +1.000000 -0.503200 -0.182900 0.400000 0.704000 0.576000 +0.998000 -0.502100 -0.182900 0.528000 0.664000 0.520000 +1.000000 -0.502100 -0.189300 0.760000 0.568000 0.296000 +1.000000 -0.502100 -0.189300 0.760000 0.568000 0.296000 +-0.891000 -0.451900 -0.304800 0.528000 0.824000 -0.192000 +-0.891000 -0.451900 -0.304800 0.528000 0.824000 -0.192000 +-0.896800 -0.451900 -0.243900 0.600000 0.776000 0.136000 +-0.850000 -0.473200 -0.304800 0.272000 0.896000 -0.336000 +-0.850000 -0.480800 -0.243900 0.376000 0.912000 0.152000 +-0.800000 -0.473000 -0.304800 -0.736000 0.648000 -0.168000 +-0.800000 -0.496000 -0.243900 0.424000 0.840000 0.320000 +-0.787800 -0.451900 -0.304800 -0.984000 0.136000 -0.040000 +-0.769800 -0.451900 -0.243900 -0.952000 -0.080000 0.272000 +-0.769800 -0.451900 -0.243900 -0.952000 -0.080000 0.272000 +-0.900000 -0.551700 -0.243900 -0.808000 -0.568000 -0.120000 +-0.900000 -0.551700 -0.243900 -0.808000 -0.568000 -0.120000 +-0.900000 -0.539600 -0.304800 -0.720000 -0.488000 -0.480000 +-0.899500 -0.552300 -0.243900 -0.800000 -0.592000 -0.072000 +-0.891900 -0.552300 -0.304800 -0.800000 -0.568000 -0.136000 +-0.851300 -0.602500 -0.243900 -0.680000 -0.720000 -0.008000 +-0.850000 -0.602000 -0.304800 -0.640000 -0.736000 -0.184000 +-0.850000 -0.602500 -0.285600 -0.672000 -0.728000 -0.024000 +-0.849200 -0.602500 -0.304800 -0.536000 -0.720000 -0.432000 +-0.850000 -0.603800 -0.243900 -0.656000 -0.744000 0.064000 +-0.800000 -0.636000 -0.304800 -0.536000 -0.792000 -0.272000 +-0.800000 -0.632800 -0.243900 -0.432000 -0.896000 0.072000 +-0.750000 -0.652200 -0.304800 -0.040000 -0.952000 -0.288000 +-0.750000 -0.646000 -0.243900 -0.088000 -0.984000 0.144000 +-0.750000 -0.646000 -0.243900 -0.088000 -0.984000 0.144000 +-0.850000 -0.603800 -0.243900 -0.656000 -0.744000 0.064000 +-0.850000 -0.603800 -0.243900 -0.656000 -0.744000 0.064000 +-0.850000 -0.602500 -0.285600 -0.672000 -0.728000 -0.024000 +-0.851300 -0.602500 -0.243900 -0.680000 -0.720000 -0.008000 +-0.851300 -0.602500 -0.243900 -0.680000 -0.720000 -0.008000 +-0.800000 0.108800 -0.243900 0.352000 0.608000 -0.704000 +-0.800000 0.108800 -0.243900 0.352000 0.608000 -0.704000 +-0.800000 0.100400 -0.252800 0.360000 0.584000 -0.720000 +-0.785800 0.100400 -0.243900 0.360000 0.584000 -0.720000 +-0.785800 0.100400 -0.243900 0.360000 0.584000 -0.720000 +-0.750000 0.077000 -0.243900 0.368000 0.552000 -0.744000 +-0.750000 0.077000 -0.243900 0.368000 0.552000 -0.744000 +-0.750000 0.050200 -0.267100 0.368000 0.432000 -0.816000 +-0.711800 0.050200 -0.243900 0.416000 0.432000 -0.792000 +-0.711800 0.050200 -0.243900 0.416000 0.432000 -0.792000 +-0.731900 -0.150600 -0.304800 0.424000 0.400000 -0.808000 +-0.731900 -0.150600 -0.304800 0.424000 0.400000 -0.808000 +-0.700000 -0.175200 -0.304800 0.352000 0.528000 -0.768000 +-0.700000 -0.150600 -0.284500 0.376000 0.392000 -0.832000 +-0.700000 -0.150600 -0.284500 0.376000 0.392000 -0.832000 +-0.650000 -0.200800 -0.303800 0.136000 0.680000 -0.712000 +-0.650000 -0.200800 -0.303800 0.136000 0.680000 -0.712000 +-0.651700 -0.200800 -0.304800 0.320000 0.544000 -0.768000 +-0.650000 -0.201600 -0.304800 0.104000 0.688000 -0.704000 +-0.700000 -0.200800 -0.326900 0.208000 0.528000 -0.816000 +-0.650000 -0.251000 -0.354800 0.152000 0.632000 -0.752000 +-0.700000 -0.251000 -0.364900 0.104000 0.560000 -0.816000 +-0.650000 -0.261300 -0.365800 0.088000 0.568000 -0.808000 +-0.700000 -0.252100 -0.365800 0.096000 0.552000 -0.824000 +-0.700000 -0.251000 -0.364900 0.104000 0.560000 -0.816000 +-0.707800 -0.251000 -0.365800 0.064000 0.432000 -0.896000 +-0.700000 -0.200800 -0.326900 0.208000 0.528000 -0.816000 +-0.750000 -0.240500 -0.365800 0.056000 0.272000 -0.952000 +-0.750000 -0.200800 -0.348300 0.272000 0.384000 -0.872000 +-0.800000 -0.234100 -0.365800 -0.112000 0.264000 -0.952000 +-0.800000 -0.200800 -0.355700 0.080000 0.256000 -0.960000 +-0.800000 -0.200800 -0.355700 0.080000 0.256000 -0.960000 +-0.650000 -0.035200 -0.243900 0.544000 0.264000 -0.792000 +-0.650000 -0.035200 -0.243900 0.544000 0.264000 -0.792000 +-0.650000 -0.050200 -0.249300 0.496000 0.208000 -0.840000 +-0.642900 -0.050200 -0.243900 0.560000 0.208000 -0.792000 +-0.642900 -0.050200 -0.243900 0.560000 0.208000 -0.792000 +-0.544700 -0.200800 -0.304800 -0.080000 0.824000 -0.552000 +-0.544700 -0.200800 -0.304800 -0.080000 0.824000 -0.552000 +-0.550000 -0.200800 -0.303600 -0.040000 0.880000 -0.464000 +-0.550000 -0.201300 -0.304800 -0.032000 0.864000 -0.488000 +-0.550000 -0.201300 -0.304800 -0.032000 0.864000 -0.488000 +-0.354400 -0.100400 -0.243900 -0.584000 0.448000 -0.664000 +-0.354400 -0.100400 -0.243900 -0.584000 0.448000 -0.664000 +-0.350000 -0.100400 -0.248500 -0.576000 0.440000 -0.680000 +-0.350000 -0.093900 -0.243900 -0.600000 0.408000 -0.680000 +-0.350000 -0.093900 -0.243900 -0.600000 0.408000 -0.680000 +-0.363900 -0.552300 -0.243900 0.816000 -0.480000 0.304000 +-0.363900 -0.552300 -0.243900 0.816000 -0.480000 0.304000 +-0.350000 -0.535600 -0.243900 0.360000 -0.840000 0.384000 +-0.350000 -0.552300 -0.283400 -0.096000 -0.680000 0.720000 +-0.317500 -0.552300 -0.243900 -0.600000 -0.648000 0.448000 +-0.317500 -0.552300 -0.243900 -0.600000 -0.648000 0.448000 +-0.300000 -0.050200 -0.270300 -0.824000 0.232000 -0.512000 +-0.300000 -0.050200 -0.270300 -0.824000 0.232000 -0.512000 +-0.266700 -0.050200 -0.304800 -0.504000 0.288000 -0.808000 +-0.300000 -0.100400 -0.298100 -0.480000 0.288000 -0.824000 +-0.288100 -0.100400 -0.304800 -0.408000 0.240000 -0.872000 +-0.300000 -0.118900 -0.304800 -0.376000 0.264000 -0.880000 +-0.300000 -0.118900 -0.304800 -0.376000 0.264000 -0.880000 +-0.256000 -0.703000 -0.243900 0.696000 -0.392000 0.584000 +-0.256000 -0.703000 -0.243900 0.696000 -0.392000 0.584000 +-0.250000 -0.679700 -0.243900 0.728000 -0.208000 0.640000 +-0.250000 -0.703000 -0.252700 0.704000 -0.368000 0.600000 +-0.250000 -0.703000 -0.252700 0.704000 -0.368000 0.600000 +-0.213400 0.000000 -0.304800 -0.304000 0.448000 -0.832000 +-0.213400 0.000000 -0.304800 -0.304000 0.448000 -0.832000 +-0.250000 0.000000 -0.286200 -0.320000 0.712000 -0.616000 +-0.250000 -0.028200 -0.304800 -0.400000 0.416000 -0.808000 +-0.250000 -0.028200 -0.304800 -0.400000 0.416000 -0.808000 +-0.196100 -0.200800 -0.304800 0.360000 -0.200000 -0.904000 +-0.196100 -0.200800 -0.304800 0.360000 -0.200000 -0.904000 +-0.150000 -0.200800 -0.284500 0.024000 -0.216000 -0.968000 +-0.150000 -0.159100 -0.304800 0.152000 -0.400000 -0.896000 +-0.108400 -0.200800 -0.304800 -0.496000 -0.048000 -0.856000 +-0.108400 -0.200800 -0.304800 -0.496000 -0.048000 -0.856000 +-0.172800 -0.552300 -0.243900 0.592000 -0.568000 0.560000 +-0.172800 -0.552300 -0.243900 0.592000 -0.568000 0.560000 +-0.150000 -0.530700 -0.243900 0.632000 -0.664000 0.392000 +-0.150000 -0.552300 -0.270100 0.544000 -0.504000 0.656000 +-0.150000 -0.552300 -0.270100 0.544000 -0.504000 0.656000 +-0.126800 0.150600 -0.243900 -0.208000 0.496000 -0.832000 +-0.126800 0.150600 -0.243900 -0.208000 0.496000 -0.832000 +-0.100000 0.150600 -0.251000 -0.024000 0.408000 -0.904000 +-0.100000 0.164100 -0.243900 -0.032000 0.432000 -0.896000 +-0.077600 0.150600 -0.243900 0.320000 0.328000 -0.880000 +-0.077600 0.150600 -0.243900 0.320000 0.328000 -0.880000 +-0.150000 0.100400 -0.267100 -0.312000 0.440000 -0.832000 +-0.150000 0.100400 -0.267100 -0.312000 0.440000 -0.832000 +-0.100000 0.100400 -0.276400 0.032000 0.376000 -0.920000 +-0.150000 0.050200 -0.299600 -0.080000 0.408000 -0.904000 +-0.100000 0.050200 -0.292200 0.304000 0.312000 -0.896000 +-0.150000 0.040500 -0.304800 -0.136000 0.416000 -0.896000 +-0.100000 0.022400 -0.304800 0.184000 0.304000 -0.928000 +-0.150000 0.000000 -0.322200 0.064000 0.240000 -0.968000 +-0.100000 0.000000 -0.309600 0.168000 0.152000 -0.968000 +-0.150000 -0.050200 -0.328000 0.128000 0.064000 -0.984000 +-0.100000 -0.050200 -0.318600 0.080000 0.144000 -0.984000 +-0.150000 -0.100400 -0.338700 0.056000 -0.088000 -0.992000 +-0.100000 -0.100400 -0.323700 -0.040000 -0.152000 -0.984000 +-0.150000 -0.150600 -0.309500 -0.032000 -0.400000 -0.912000 +-0.100000 -0.150600 -0.315000 -0.456000 -0.064000 -0.880000 +-0.100000 -0.150600 -0.315000 -0.456000 -0.064000 -0.880000 +-0.077600 0.000000 -0.304800 0.248000 0.344000 -0.896000 +-0.077600 0.000000 -0.304800 0.248000 0.344000 -0.896000 +-0.050000 -0.015100 -0.304800 0.280000 0.536000 -0.784000 +-0.050000 0.000000 -0.288000 0.256000 0.560000 -0.776000 +-0.050000 0.000000 -0.288000 0.256000 0.560000 -0.776000 +-0.013800 -0.351500 -0.243900 0.552000 -0.808000 -0.168000 +-0.013800 -0.351500 -0.243900 0.552000 -0.808000 -0.168000 +-0.050000 -0.380500 -0.243900 0.664000 -0.736000 -0.104000 +-0.026900 -0.351500 -0.304800 0.608000 -0.688000 -0.384000 +-0.050000 -0.374600 -0.304800 0.584000 -0.672000 -0.448000 +-0.050000 -0.351500 -0.336900 0.024000 -0.576000 -0.808000 +-0.050000 -0.351500 -0.336900 0.024000 -0.576000 -0.808000 +0.050000 -0.050200 -0.279200 0.280000 0.320000 -0.896000 +0.050000 -0.050200 -0.279200 0.280000 0.320000 -0.896000 +0.004800 -0.050200 -0.304800 0.368000 0.176000 -0.904000 +0.050000 -0.100400 -0.298100 0.360000 0.248000 -0.896000 +0.039400 -0.100400 -0.304800 0.408000 0.224000 -0.880000 +0.039400 -0.100400 -0.304800 0.408000 0.224000 -0.880000 +0.113100 0.000000 -0.243900 -0.392000 0.768000 -0.496000 +0.113100 0.000000 -0.243900 -0.392000 0.768000 -0.496000 +0.150000 0.000000 -0.257100 -0.208000 0.552000 -0.800000 +0.150000 0.015400 -0.243900 -0.208000 0.728000 -0.640000 +0.150000 0.015400 -0.243900 -0.208000 0.728000 -0.640000 +0.200000 -0.100400 -0.298900 0.088000 0.040000 -0.992000 +0.200000 -0.100400 -0.298900 0.088000 0.040000 -0.992000 +0.185500 -0.100400 -0.304800 0.296000 0.104000 -0.944000 +0.200000 -0.139100 -0.304800 0.208000 0.104000 -0.968000 +0.150000 -0.100400 -0.322200 0.000000 0.224000 -0.968000 +0.200000 -0.150600 -0.306400 0.192000 0.112000 -0.968000 +0.150000 -0.150600 -0.323600 -0.232000 0.464000 -0.848000 +0.200000 -0.200800 -0.335700 -0.120000 0.200000 -0.968000 +0.150000 -0.200800 -0.325200 0.160000 0.176000 -0.968000 +0.200000 -0.251000 -0.346500 -0.184000 0.088000 -0.976000 +0.150000 -0.251000 -0.336000 0.080000 -0.336000 -0.928000 +0.150000 -0.251000 -0.336000 0.080000 -0.336000 -0.928000 +0.211400 -0.050200 -0.304800 0.152000 0.184000 -0.968000 +0.211400 -0.050200 -0.304800 0.152000 0.184000 -0.968000 +0.200000 -0.061600 -0.304800 0.000000 -0.144000 -0.984000 +0.250000 -0.050200 -0.297000 0.000000 0.040000 -0.992000 +0.200000 -0.100400 -0.298900 0.088000 0.040000 -0.992000 +0.250000 -0.100400 -0.298400 -0.088000 0.216000 -0.968000 +0.200000 -0.139100 -0.304800 0.208000 0.104000 -0.968000 +0.250000 -0.114900 -0.304800 -0.104000 0.280000 -0.952000 +0.200000 -0.150600 -0.306400 0.192000 0.112000 -0.968000 +0.250000 -0.150600 -0.317700 0.024000 0.336000 -0.936000 +0.200000 -0.200800 -0.335700 -0.120000 0.200000 -0.968000 +0.250000 -0.200800 -0.343100 0.104000 0.232000 -0.960000 +0.200000 -0.251000 -0.346500 -0.184000 0.088000 -0.976000 +0.250000 -0.251000 -0.353900 0.064000 0.384000 -0.920000 +0.250000 -0.251000 -0.353900 0.064000 0.384000 -0.920000 +0.250000 -0.050200 -0.297000 0.000000 0.040000 -0.992000 +0.250000 -0.050200 -0.297000 0.000000 0.040000 -0.992000 +0.266500 -0.050200 -0.304800 -0.280000 0.064000 -0.952000 +0.250000 -0.100400 -0.298400 -0.088000 0.216000 -0.968000 +0.278900 -0.100400 -0.304800 -0.176000 0.256000 -0.944000 +0.250000 -0.114900 -0.304800 -0.104000 0.280000 -0.952000 +0.250000 -0.114900 -0.304800 -0.104000 0.280000 -0.952000 +0.350000 -0.127600 -0.304800 0.032000 -0.600000 -0.792000 +0.350000 -0.127600 -0.304800 0.032000 -0.600000 -0.792000 +0.313400 -0.150600 -0.304800 0.400000 -0.360000 -0.840000 +0.350000 -0.150600 -0.283600 -0.064000 -0.424000 -0.896000 +0.320800 -0.200800 -0.304800 0.496000 0.328000 -0.800000 +0.350000 -0.200800 -0.271400 0.216000 0.224000 -0.944000 +0.350000 -0.228300 -0.304800 0.616000 0.528000 -0.576000 +0.350000 -0.228300 -0.304800 0.616000 0.528000 -0.576000 +0.300000 -0.357600 -0.243900 -0.288000 -0.920000 0.248000 +0.300000 -0.357600 -0.243900 -0.288000 -0.920000 0.248000 +0.343800 -0.401700 -0.243900 -0.728000 -0.584000 0.344000 +0.300000 -0.355300 -0.304800 -0.272000 -0.752000 -0.592000 +0.344100 -0.401700 -0.304800 -0.784000 -0.512000 -0.336000 +0.344100 -0.401700 -0.304800 -0.784000 -0.512000 -0.336000 +0.350000 -0.127600 -0.304800 0.032000 -0.600000 -0.792000 +0.350000 -0.127600 -0.304800 0.032000 -0.600000 -0.792000 +0.350000 -0.150600 -0.283600 -0.064000 -0.424000 -0.896000 +0.380400 -0.150600 -0.304800 -0.424000 -0.456000 -0.776000 +0.380400 -0.150600 -0.304800 -0.424000 -0.456000 -0.776000 +0.419200 0.050200 -0.304800 -0.224000 0.736000 -0.632000 +0.419200 0.050200 -0.304800 -0.224000 0.736000 -0.632000 +0.400000 0.050200 -0.294000 -0.352000 0.672000 -0.640000 +0.400000 0.041200 -0.304800 -0.352000 0.672000 -0.648000 +0.400000 0.041200 -0.304800 -0.352000 0.672000 -0.648000 +0.400000 -0.168700 -0.304800 -0.504000 -0.464000 -0.720000 +0.400000 -0.168700 -0.304800 -0.504000 -0.464000 -0.720000 +0.400000 -0.200800 -0.276700 0.448000 -0.472000 -0.752000 +0.424400 -0.200800 -0.304800 -0.552000 -0.520000 -0.648000 +0.400000 -0.249400 -0.243900 0.760000 -0.472000 -0.424000 +0.450000 -0.217600 -0.304800 -0.352000 -0.736000 -0.560000 +0.450000 -0.248400 -0.243900 -0.224000 -0.888000 -0.384000 +0.450000 -0.248400 -0.243900 -0.224000 -0.888000 -0.384000 +0.550000 -0.150600 -0.287800 0.352000 0.528000 -0.768000 +0.550000 -0.150600 -0.287800 0.352000 0.528000 -0.768000 +0.523400 -0.150600 -0.304800 0.376000 0.592000 -0.704000 +0.550000 -0.162200 -0.304800 0.376000 0.720000 -0.576000 +0.500000 -0.150600 -0.319100 0.336000 0.504000 -0.792000 +0.550000 -0.194000 -0.365800 0.224000 0.896000 -0.368000 +0.500000 -0.200800 -0.334200 -0.376000 -0.448000 -0.800000 +0.535800 -0.200800 -0.365800 -0.736000 0.208000 -0.632000 +0.500000 -0.222600 -0.304800 -0.320000 -0.704000 -0.624000 +0.550000 -0.216200 -0.365800 -0.080000 -0.576000 -0.808000 +0.535300 -0.251000 -0.304800 -0.648000 -0.480000 -0.576000 +0.550000 -0.251000 -0.326800 -0.648000 -0.504000 -0.560000 +0.550000 -0.216200 -0.365800 -0.080000 -0.576000 -0.808000 +0.573000 -0.251000 -0.365800 -0.696000 0.544000 -0.464000 +0.559600 -0.200800 -0.365800 0.680000 0.504000 -0.520000 +0.600000 -0.231600 -0.365800 0.072000 0.640000 -0.760000 +0.594200 -0.200800 -0.304800 0.544000 0.576000 -0.600000 +0.600000 -0.206100 -0.304800 0.488000 0.616000 -0.608000 +0.600000 -0.200800 -0.298700 0.448000 0.592000 -0.656000 +0.650000 -0.208600 -0.304800 0.024000 0.680000 -0.728000 +0.650000 -0.200800 -0.297000 0.088000 0.616000 -0.776000 +0.600000 -0.200800 -0.298700 0.448000 0.592000 -0.656000 +0.650000 -0.150600 -0.274900 0.544000 0.464000 -0.688000 +0.600000 -0.150600 -0.265200 0.248000 0.032000 -0.960000 +0.600000 -0.200800 -0.298700 0.448000 0.592000 -0.656000 +0.550000 -0.150600 -0.287800 0.352000 0.528000 -0.768000 +0.594200 -0.200800 -0.304800 0.544000 0.576000 -0.600000 +0.550000 -0.162200 -0.304800 0.376000 0.720000 -0.576000 +0.559600 -0.200800 -0.365800 0.680000 0.504000 -0.520000 +0.550000 -0.194000 -0.365800 0.224000 0.896000 -0.368000 +0.550000 -0.200800 -0.388300 0.280000 0.584000 -0.752000 +0.535800 -0.200800 -0.365800 -0.736000 0.208000 -0.632000 +0.550000 -0.216200 -0.365800 -0.080000 -0.576000 -0.808000 +0.550000 -0.200800 -0.388300 0.280000 0.584000 -0.752000 +0.559600 -0.200800 -0.365800 0.680000 0.504000 -0.520000 +0.559600 -0.200800 -0.365800 0.680000 0.504000 -0.520000 +0.500000 -0.222600 -0.304800 -0.320000 -0.704000 -0.624000 +0.500000 -0.222600 -0.304800 -0.320000 -0.704000 -0.624000 +0.500000 -0.251000 -0.264200 -0.272000 -0.744000 -0.600000 +0.535300 -0.251000 -0.304800 -0.648000 -0.480000 -0.576000 +0.535300 -0.251000 -0.304800 -0.648000 -0.480000 -0.576000 +0.800000 -0.401700 -0.291400 0.440000 0.456000 -0.760000 +0.800000 -0.401700 -0.291400 0.440000 0.456000 -0.760000 +0.800000 -0.418300 -0.304800 0.408000 0.496000 -0.760000 +0.850000 -0.401700 -0.268600 0.504000 0.432000 -0.744000 +0.837100 -0.451900 -0.304800 0.528000 0.264000 -0.800000 +0.850000 -0.451900 -0.293100 0.448000 0.248000 -0.848000 +0.800000 -0.493800 -0.304800 0.032000 -0.688000 -0.720000 +0.850000 -0.490600 -0.304800 0.216000 0.112000 -0.968000 +0.800000 -0.502100 -0.293400 -0.120000 -0.840000 -0.520000 +0.832800 -0.502100 -0.304800 -0.104000 -0.544000 -0.824000 +0.832800 -0.502100 -0.304800 -0.104000 -0.544000 -0.824000 +0.858900 0.050200 -0.243900 -0.424000 0.568000 -0.696000 +0.858900 0.050200 -0.243900 -0.424000 0.568000 -0.696000 +0.900000 0.050200 -0.268900 0.208000 0.672000 -0.696000 +0.900000 0.070800 -0.243900 -0.096000 0.744000 -0.656000 +0.900000 0.070800 -0.243900 -0.096000 0.744000 -0.656000 +0.981700 -0.050200 -0.304800 0.528000 0.432000 -0.720000 +0.981700 -0.050200 -0.304800 0.528000 0.432000 -0.720000 +1.000000 -0.073100 -0.304800 0.536000 0.424000 -0.720000 +1.000000 -0.050200 -0.288900 0.520000 0.432000 -0.728000 +1.000000 -0.050200 -0.288900 0.520000 0.432000 -0.728000 +-0.900000 0.104600 -0.304800 0.304000 0.568000 -0.760000 +-0.900000 0.104600 -0.304800 0.304000 0.568000 -0.760000 +-0.900000 0.100400 -0.308600 0.312000 0.536000 -0.776000 +-0.892300 0.100400 -0.304800 0.320000 0.536000 -0.776000 +-0.892300 0.100400 -0.304800 0.320000 0.536000 -0.776000 +-0.850000 -0.301200 -0.321900 -0.728000 -0.616000 -0.280000 +-0.850000 -0.301200 -0.321900 -0.728000 -0.616000 -0.280000 +-0.850000 -0.251000 -0.359600 -0.320000 0.248000 -0.912000 +-0.826000 -0.301200 -0.365800 -0.648000 -0.448000 -0.600000 +-0.828000 -0.251000 -0.365800 -0.248000 0.216000 -0.936000 +-0.800000 -0.301200 -0.380800 -0.264000 0.104000 -0.952000 +-0.800000 -0.251000 -0.370300 -0.064000 0.200000 -0.976000 +-0.750000 -0.301200 -0.392900 -0.104000 0.352000 -0.928000 +-0.750000 -0.251000 -0.369800 0.056000 0.280000 -0.952000 +-0.750000 -0.251000 -0.369800 0.056000 0.280000 -0.952000 +-0.800000 -0.066700 -0.304800 0.296000 0.144000 -0.936000 +-0.800000 -0.066700 -0.304800 0.296000 0.144000 -0.936000 +-0.800000 -0.100400 -0.313000 0.368000 0.216000 -0.896000 +-0.785000 -0.100400 -0.304800 0.328000 0.224000 -0.912000 +-0.785000 -0.100400 -0.304800 0.328000 0.224000 -0.912000 +-0.750000 -0.129200 -0.304800 0.392000 0.376000 -0.832000 +-0.750000 -0.129200 -0.304800 0.392000 0.376000 -0.832000 +-0.750000 -0.150600 -0.317800 0.416000 0.384000 -0.816000 +-0.731900 -0.150600 -0.304800 0.424000 0.400000 -0.808000 +-0.731900 -0.150600 -0.304800 0.424000 0.400000 -0.808000 +-0.576800 -0.251000 -0.365800 -0.136000 0.624000 -0.760000 +-0.576800 -0.251000 -0.365800 -0.136000 0.624000 -0.760000 +-0.600000 -0.251000 -0.360600 -0.120000 0.624000 -0.760000 +-0.600000 -0.256300 -0.365800 -0.112000 0.608000 -0.776000 +-0.600000 -0.256300 -0.365800 -0.112000 0.608000 -0.776000 +-0.500000 -0.637800 -0.304800 -0.208000 -0.976000 -0.032000 +-0.500000 -0.637800 -0.304800 -0.208000 -0.976000 -0.032000 +-0.455200 -0.652700 -0.304800 -0.280000 -0.952000 0.040000 +-0.500000 -0.633000 -0.365800 -0.088000 -0.968000 -0.200000 +-0.450000 -0.652700 -0.319500 -0.256000 -0.952000 -0.136000 +-0.450000 -0.645700 -0.365800 -0.144000 -0.904000 -0.392000 +-0.405700 -0.652700 -0.365800 -0.144000 -0.920000 -0.344000 +-0.405700 -0.652700 -0.365800 -0.144000 -0.920000 -0.344000 +-0.350000 -0.585900 -0.365800 0.168000 -0.792000 -0.576000 +-0.350000 -0.585900 -0.365800 0.168000 -0.792000 -0.576000 +-0.350000 -0.594300 -0.304800 0.520000 -0.800000 0.280000 +-0.357100 -0.602500 -0.365800 0.904000 0.256000 -0.312000 +-0.351600 -0.602500 -0.304800 0.944000 0.304000 0.024000 +-0.350000 -0.629600 -0.365800 0.056000 0.640000 -0.760000 +-0.350000 -0.605300 -0.304800 0.248000 0.960000 -0.032000 +-0.328400 -0.602500 -0.365800 -0.832000 -0.248000 -0.488000 +-0.344900 -0.602500 -0.304800 -0.744000 0.664000 -0.032000 +-0.350000 -0.585900 -0.365800 0.168000 -0.792000 -0.576000 +-0.350000 -0.594300 -0.304800 0.520000 -0.800000 0.280000 +-0.350000 -0.594300 -0.304800 0.520000 -0.800000 0.280000 +-0.350000 -0.747900 -0.304800 -0.512000 -0.832000 -0.184000 +-0.350000 -0.747900 -0.304800 -0.512000 -0.832000 -0.184000 +-0.350000 -0.703000 -0.357000 -0.336000 -0.496000 -0.792000 +-0.371300 -0.703000 -0.304800 -0.816000 -0.552000 -0.144000 +-0.371300 -0.703000 -0.304800 -0.816000 -0.552000 -0.144000 +-0.331500 -0.150600 -0.304800 -0.256000 0.464000 -0.840000 +-0.331500 -0.150600 -0.304800 -0.256000 0.464000 -0.840000 +-0.300000 -0.150600 -0.319300 -0.256000 0.480000 -0.832000 +-0.300000 -0.118900 -0.304800 -0.376000 0.264000 -0.880000 +-0.300000 -0.118900 -0.304800 -0.376000 0.264000 -0.880000 +-0.250000 -0.639500 -0.365800 0.216000 -0.224000 -0.944000 +-0.250000 -0.639500 -0.365800 0.216000 -0.224000 -0.944000 +-0.282800 -0.652700 -0.365800 0.080000 -0.160000 -0.976000 +-0.250000 -0.652700 -0.361600 0.240000 -0.216000 -0.944000 +-0.250000 -0.652700 -0.361600 0.240000 -0.216000 -0.944000 +-0.250000 -0.150600 -0.327500 -0.120000 0.152000 -0.976000 +-0.250000 -0.150600 -0.327500 -0.120000 0.152000 -0.976000 +-0.200000 -0.150600 -0.333300 0.216000 -0.272000 -0.936000 +-0.250000 -0.200800 -0.333200 0.168000 0.080000 -0.976000 +-0.200000 -0.200800 -0.306700 0.368000 -0.184000 -0.904000 +-0.250000 -0.251000 -0.337900 0.384000 0.112000 -0.912000 +-0.200000 -0.251000 -0.307600 0.408000 0.096000 -0.904000 +-0.250000 -0.301200 -0.349000 0.296000 0.272000 -0.912000 +-0.200000 -0.301200 -0.313400 0.328000 0.152000 -0.928000 +-0.200000 -0.301200 -0.313400 0.328000 0.152000 -0.928000 +-0.200000 -0.602500 -0.345500 0.488000 -0.272000 -0.824000 +-0.200000 -0.602500 -0.345500 0.488000 -0.272000 -0.824000 +-0.200000 -0.558000 -0.365800 0.448000 -0.240000 -0.856000 +-0.229500 -0.602500 -0.365800 0.408000 -0.240000 -0.872000 +-0.200000 -0.552300 -0.367100 0.360000 -0.232000 -0.896000 +-0.250000 -0.602500 -0.376000 0.360000 -0.328000 -0.872000 +-0.250000 -0.552300 -0.402600 0.504000 -0.312000 -0.792000 +-0.250000 -0.552300 -0.402600 0.504000 -0.312000 -0.792000 +-0.150000 -0.602500 -0.307600 0.456000 -0.280000 -0.840000 +-0.150000 -0.602500 -0.307600 0.456000 -0.280000 -0.840000 +-0.150000 -0.552300 -0.337600 0.424000 -0.304000 -0.840000 +-0.200000 -0.602500 -0.345500 0.488000 -0.272000 -0.824000 +-0.196100 -0.552300 -0.365800 0.320000 -0.272000 -0.904000 +-0.200000 -0.558000 -0.365800 0.448000 -0.240000 -0.856000 +-0.200000 -0.552300 -0.367100 0.360000 -0.232000 -0.896000 +-0.200000 -0.552300 -0.367100 0.360000 -0.232000 -0.896000 +-0.147100 -0.502100 -0.365800 0.472000 -0.192000 -0.848000 +-0.147100 -0.502100 -0.365800 0.472000 -0.192000 -0.848000 +-0.145700 -0.451900 -0.365800 0.464000 0.040000 -0.880000 +-0.100000 -0.502100 -0.325200 0.520000 -0.368000 -0.760000 +-0.100000 -0.451900 -0.336100 0.496000 -0.048000 -0.856000 +-0.074100 -0.502100 -0.304800 0.864000 -0.480000 0.112000 +-0.061500 -0.451900 -0.304800 0.928000 -0.352000 0.088000 +-0.061500 -0.451900 -0.304800 0.928000 -0.352000 0.088000 +-0.100000 -0.200800 -0.311700 -0.496000 0.128000 -0.856000 +-0.100000 -0.200800 -0.311700 -0.496000 0.128000 -0.856000 +-0.050000 -0.200800 -0.320900 -0.056000 0.280000 -0.952000 +-0.100000 -0.251000 -0.333700 -0.512000 0.248000 -0.816000 +-0.050000 -0.251000 -0.364300 -0.216000 0.352000 -0.904000 +-0.100000 -0.301200 -0.349000 -0.368000 0.264000 -0.888000 +-0.050000 -0.266900 -0.365800 -0.288000 0.088000 -0.944000 +-0.058500 -0.301200 -0.365800 -0.384000 -0.288000 -0.872000 +-0.050000 -0.301200 -0.370400 -0.392000 -0.264000 -0.872000 +-0.050000 -0.309800 -0.365800 -0.336000 -0.416000 -0.840000 +-0.058500 -0.301200 -0.365800 -0.384000 -0.288000 -0.872000 +-0.050000 -0.351500 -0.336900 0.024000 -0.576000 -0.808000 +-0.100000 -0.301200 -0.349000 -0.368000 0.264000 -0.888000 +-0.100000 -0.351500 -0.338800 0.024000 -0.312000 -0.944000 +-0.100000 -0.351500 -0.338800 0.024000 -0.312000 -0.944000 +0.050000 -0.119800 -0.304800 0.416000 0.264000 -0.864000 +0.050000 -0.119800 -0.304800 0.416000 0.264000 -0.864000 +0.050000 -0.150600 -0.318000 0.352000 0.312000 -0.872000 +0.096000 -0.150600 -0.304800 0.176000 0.336000 -0.920000 +0.096000 -0.150600 -0.304800 0.176000 0.336000 -0.920000 +0.301400 0.000000 -0.304800 -0.584000 0.656000 -0.464000 +0.301400 0.000000 -0.304800 -0.584000 0.656000 -0.464000 +0.350000 0.000000 -0.339100 -0.264000 0.552000 -0.784000 +0.350000 0.024300 -0.304800 -0.456000 0.784000 -0.408000 +0.400000 0.000000 -0.343200 -0.216000 0.592000 -0.768000 +0.400000 0.041200 -0.304800 -0.352000 0.672000 -0.648000 +0.400000 0.041200 -0.304800 -0.352000 0.672000 -0.648000 +0.383500 -0.050200 -0.365800 0.200000 -0.288000 -0.928000 +0.383500 -0.050200 -0.365800 0.200000 -0.288000 -0.928000 +0.400000 -0.050200 -0.360800 0.184000 -0.432000 -0.872000 +0.350000 -0.037900 -0.365800 -0.440000 0.432000 -0.776000 +0.400000 0.000000 -0.343200 -0.216000 0.592000 -0.768000 +0.350000 0.000000 -0.339100 -0.264000 0.552000 -0.784000 +0.350000 0.000000 -0.339100 -0.264000 0.552000 -0.784000 +0.355700 -0.351500 -0.365800 0.360000 -0.072000 -0.928000 +0.355700 -0.351500 -0.365800 0.360000 -0.072000 -0.928000 +0.400000 -0.351500 -0.338800 0.360000 -0.568000 -0.728000 +0.350000 -0.334300 -0.365800 -0.304000 0.096000 -0.944000 +0.400000 -0.301200 -0.307300 0.704000 0.496000 -0.496000 +0.350000 -0.301200 -0.360500 0.376000 0.184000 -0.904000 +0.350000 -0.301200 -0.360500 0.376000 0.184000 -0.904000 +0.376800 -0.401700 -0.304800 0.336000 -0.848000 -0.392000 +0.376800 -0.401700 -0.304800 0.336000 -0.848000 -0.392000 +0.350000 -0.401700 -0.317400 -0.608000 -0.560000 -0.544000 +0.350000 -0.410700 -0.304800 -0.592000 -0.664000 -0.440000 +0.350000 -0.410700 -0.304800 -0.592000 -0.664000 -0.440000 +0.400000 -0.050200 -0.360800 0.184000 -0.432000 -0.872000 +0.400000 -0.050200 -0.360800 0.184000 -0.432000 -0.872000 +0.450000 -0.050200 -0.325200 -0.120000 -0.568000 -0.808000 +0.400000 -0.100400 -0.340000 -0.040000 -0.360000 -0.928000 +0.450000 -0.100400 -0.322200 0.392000 -0.360000 -0.840000 +0.400000 -0.150600 -0.318400 -0.432000 -0.416000 -0.792000 +0.450000 -0.150600 -0.321300 -0.008000 0.120000 -0.992000 +0.400000 -0.168700 -0.304800 -0.504000 -0.464000 -0.720000 +0.450000 -0.200800 -0.331300 -0.472000 -0.400000 -0.776000 +0.424400 -0.200800 -0.304800 -0.552000 -0.520000 -0.648000 +0.450000 -0.217600 -0.304800 -0.352000 -0.736000 -0.560000 +0.450000 -0.217600 -0.304800 -0.352000 -0.736000 -0.560000 +0.450000 0.055500 -0.304800 0.064000 0.864000 -0.496000 +0.450000 0.055500 -0.304800 0.064000 0.864000 -0.496000 +0.450000 0.050200 -0.314200 0.064000 0.744000 -0.656000 +0.496000 0.050200 -0.304800 0.104000 0.800000 -0.576000 +0.496000 0.050200 -0.304800 0.104000 0.800000 -0.576000 +0.500000 -0.333600 -0.304800 -0.408000 0.824000 -0.376000 +0.500000 -0.333600 -0.304800 -0.408000 0.824000 -0.376000 +0.458900 -0.351500 -0.304800 -0.472000 0.360000 -0.792000 +0.500000 -0.351500 -0.354900 -0.384000 -0.472000 -0.784000 +0.500000 -0.400200 -0.304800 -0.176000 -0.672000 -0.712000 +0.500000 -0.400200 -0.304800 -0.176000 -0.672000 -0.712000 +0.450000 -0.380500 -0.304800 -0.144000 0.256000 -0.952000 +0.450000 -0.380500 -0.304800 -0.144000 0.256000 -0.952000 +0.450000 -0.401700 -0.316200 -0.184000 -0.360000 -0.904000 +0.492100 -0.401700 -0.304800 0.152000 -0.576000 -0.792000 +0.492100 -0.401700 -0.304800 0.152000 -0.576000 -0.792000 +0.500000 -0.127100 -0.304800 0.480000 0.456000 -0.744000 +0.500000 -0.127100 -0.304800 0.480000 0.456000 -0.744000 +0.500000 -0.150600 -0.319100 0.336000 0.504000 -0.792000 +0.523400 -0.150600 -0.304800 0.376000 0.592000 -0.704000 +0.523400 -0.150600 -0.304800 0.376000 0.592000 -0.704000 +0.600000 -0.086300 -0.304800 0.440000 0.312000 -0.832000 +0.600000 -0.086300 -0.304800 0.440000 0.312000 -0.832000 +0.589400 -0.100400 -0.304800 -0.440000 -0.424000 -0.784000 +0.600000 -0.100400 -0.312700 0.376000 -0.472000 -0.792000 +0.600000 -0.105700 -0.304800 0.312000 -0.728000 -0.600000 +0.604900 -0.100400 -0.304800 0.744000 -0.360000 -0.552000 +0.600000 -0.100400 -0.312700 0.376000 -0.472000 -0.792000 +0.600000 -0.086300 -0.304800 0.440000 0.312000 -0.832000 +0.600000 -0.086300 -0.304800 0.440000 0.312000 -0.832000 +0.600000 -0.206100 -0.304800 0.488000 0.616000 -0.608000 +0.600000 -0.206100 -0.304800 0.488000 0.616000 -0.608000 +0.650000 -0.208600 -0.304800 0.024000 0.680000 -0.728000 +0.600000 -0.231600 -0.365800 0.072000 0.640000 -0.760000 +0.650000 -0.245700 -0.365800 0.168000 0.856000 -0.480000 +0.600000 -0.249700 -0.426800 -0.344000 0.872000 -0.328000 +0.650000 -0.251000 -0.378600 0.328000 0.752000 -0.560000 +0.604800 -0.251000 -0.426800 0.544000 0.248000 -0.792000 +0.650000 -0.267900 -0.365800 0.280000 -0.440000 -0.848000 +0.600000 -0.252700 -0.426800 -0.416000 -0.736000 -0.520000 +0.600000 -0.288400 -0.365800 -0.376000 -0.712000 -0.584000 +0.598300 -0.251000 -0.426800 -0.848000 0.144000 -0.496000 +0.573000 -0.251000 -0.365800 -0.696000 0.544000 -0.464000 +0.600000 -0.249700 -0.426800 -0.344000 0.872000 -0.328000 +0.600000 -0.231600 -0.365800 0.072000 0.640000 -0.760000 +0.600000 -0.231600 -0.365800 0.072000 0.640000 -0.760000 +0.700000 -0.211400 -0.304800 0.288000 0.624000 -0.720000 +0.700000 -0.211400 -0.304800 0.288000 0.624000 -0.720000 +0.700000 -0.251000 -0.357800 0.296000 0.496000 -0.808000 +0.728900 -0.251000 -0.304800 0.720000 0.440000 -0.528000 +0.700000 -0.301200 -0.354900 0.160000 -0.240000 -0.952000 +0.744500 -0.301200 -0.304800 0.640000 0.104000 -0.760000 +0.744500 -0.301200 -0.304800 0.640000 0.104000 -0.760000 +0.750000 -0.334300 -0.304800 0.512000 0.112000 -0.840000 +0.750000 -0.334300 -0.304800 0.512000 0.112000 -0.840000 +0.750000 -0.351500 -0.307800 0.512000 0.128000 -0.840000 +0.754800 -0.351500 -0.304800 0.424000 0.136000 -0.888000 +0.750000 -0.401700 -0.321600 0.336000 0.000000 -0.936000 +0.779200 -0.401700 -0.304800 0.400000 0.336000 -0.848000 +0.779200 -0.401700 -0.304800 0.400000 0.336000 -0.848000 +0.800000 -0.418300 -0.304800 0.408000 0.496000 -0.760000 +0.800000 -0.418300 -0.304800 0.408000 0.496000 -0.760000 +0.800000 -0.451900 -0.330300 0.328000 0.200000 -0.920000 +0.837100 -0.451900 -0.304800 0.528000 0.264000 -0.800000 +0.800000 -0.493800 -0.304800 0.032000 -0.688000 -0.720000 +0.800000 -0.493800 -0.304800 0.032000 -0.688000 -0.720000 +0.856800 -0.502100 -0.304800 0.288000 0.144000 -0.944000 +0.856800 -0.502100 -0.304800 0.288000 0.144000 -0.944000 +0.850000 -0.502100 -0.307100 0.032000 -0.240000 -0.968000 +0.850000 -0.504700 -0.304800 -0.096000 -0.664000 -0.736000 +0.850000 -0.504700 -0.304800 -0.096000 -0.664000 -0.736000 +0.900000 0.016700 -0.304800 -0.152000 0.720000 -0.664000 +0.900000 0.016700 -0.304800 -0.152000 0.720000 -0.664000 +0.900000 0.000000 -0.329500 -0.080000 0.648000 -0.744000 +0.927400 0.000000 -0.304800 0.400000 0.560000 -0.720000 +0.927400 0.000000 -0.304800 0.400000 0.560000 -0.720000 +-0.850000 -0.496800 -0.365800 -0.176000 0.616000 -0.760000 +-0.850000 -0.496800 -0.365800 -0.176000 0.616000 -0.760000 +-0.864000 -0.502100 -0.365800 -0.304000 0.480000 -0.816000 +-0.850000 -0.502100 -0.370900 -0.184000 0.560000 -0.800000 +-0.860100 -0.552300 -0.365800 -0.680000 -0.432000 -0.584000 +-0.850000 -0.552300 -0.378600 -0.568000 -0.344000 -0.736000 +-0.850000 -0.564700 -0.365800 -0.608000 -0.528000 -0.584000 +-0.800000 -0.552300 -0.401000 -0.552000 -0.288000 -0.776000 +-0.806700 -0.602500 -0.365800 -0.520000 -0.656000 -0.536000 +-0.800000 -0.602500 -0.372400 -0.488000 -0.592000 -0.624000 +-0.800000 -0.607700 -0.365800 -0.488000 -0.640000 -0.584000 +-0.750000 -0.602500 -0.401000 -0.336000 -0.696000 -0.624000 +-0.750000 -0.628000 -0.365800 -0.232000 -0.808000 -0.528000 +-0.714100 -0.602500 -0.426800 -0.368000 -0.680000 -0.624000 +-0.700000 -0.639000 -0.365800 -0.040000 -0.920000 -0.376000 +-0.700000 -0.609100 -0.426800 -0.336000 -0.744000 -0.568000 +-0.650000 -0.641900 -0.365800 -0.024000 -0.952000 -0.280000 +-0.650000 -0.621300 -0.426800 -0.080000 -0.904000 -0.400000 +-0.650000 -0.621300 -0.426800 -0.080000 -0.904000 -0.400000 +-0.850000 -0.496800 -0.365800 -0.176000 0.616000 -0.760000 +-0.850000 -0.496800 -0.365800 -0.176000 0.616000 -0.760000 +-0.800000 -0.496400 -0.365800 -0.664000 0.416000 -0.608000 +-0.850000 -0.502100 -0.370900 -0.184000 0.560000 -0.800000 +-0.800000 -0.502100 -0.369300 -0.768000 0.256000 -0.576000 +-0.850000 -0.552300 -0.378600 -0.568000 -0.344000 -0.736000 +-0.800000 -0.552300 -0.401000 -0.552000 -0.288000 -0.776000 +-0.800000 -0.502100 -0.369300 -0.768000 0.256000 -0.576000 +-0.750000 -0.552300 -0.422100 -0.552000 -0.096000 -0.824000 +-0.750000 -0.502100 -0.424900 -0.848000 -0.112000 -0.512000 +-0.744500 -0.552300 -0.426800 -0.560000 -0.080000 -0.816000 +-0.748800 -0.502100 -0.426800 -0.584000 -0.048000 -0.800000 +-0.750000 -0.502100 -0.424900 -0.848000 -0.112000 -0.512000 +-0.750000 -0.498100 -0.426800 -0.864000 -0.184000 -0.448000 +-0.800000 -0.502100 -0.369300 -0.768000 0.256000 -0.576000 +-0.764100 -0.451900 -0.426800 -0.880000 -0.256000 -0.384000 +-0.800000 -0.496400 -0.365800 -0.664000 0.416000 -0.608000 +-0.786000 -0.451900 -0.365800 -0.872000 0.080000 -0.472000 +-0.764100 -0.451900 -0.426800 -0.880000 -0.256000 -0.384000 +-0.796500 -0.401700 -0.365800 -0.952000 -0.168000 -0.232000 +-0.777800 -0.401700 -0.426800 -0.928000 0.040000 -0.360000 +-0.777800 -0.401700 -0.426800 -0.928000 0.040000 -0.360000 +-0.800000 -0.602500 -0.372400 -0.488000 -0.592000 -0.624000 +-0.800000 -0.602500 -0.372400 -0.488000 -0.592000 -0.624000 +-0.800000 -0.552300 -0.401000 -0.552000 -0.288000 -0.776000 +-0.750000 -0.602500 -0.401000 -0.336000 -0.696000 -0.624000 +-0.750000 -0.552300 -0.422100 -0.552000 -0.096000 -0.824000 +-0.714100 -0.602500 -0.426800 -0.368000 -0.680000 -0.624000 +-0.744500 -0.552300 -0.426800 -0.560000 -0.080000 -0.816000 +-0.744500 -0.552300 -0.426800 -0.560000 -0.080000 -0.816000 +-0.350000 -0.248400 -0.365800 0.184000 0.424000 -0.880000 +-0.350000 -0.248400 -0.365800 0.184000 0.424000 -0.880000 +-0.350000 -0.251000 -0.367200 0.240000 0.168000 -0.952000 +-0.345700 -0.251000 -0.365800 0.320000 0.336000 -0.880000 +-0.345700 -0.251000 -0.365800 0.320000 0.336000 -0.880000 +-0.250000 -0.342900 -0.365800 0.504000 0.512000 -0.680000 +-0.250000 -0.342900 -0.365800 0.504000 0.512000 -0.680000 +-0.250000 -0.351500 -0.379700 0.552000 0.712000 -0.416000 +-0.241400 -0.351500 -0.365800 0.488000 0.640000 -0.576000 +-0.241400 -0.351500 -0.365800 0.488000 0.640000 -0.576000 +-0.200000 -0.365300 -0.365800 0.504000 0.768000 -0.376000 +-0.200000 -0.365300 -0.365800 0.504000 0.768000 -0.376000 +-0.200000 -0.393200 -0.426800 0.696000 0.632000 -0.328000 +-0.151700 -0.401700 -0.365800 0.568000 0.104000 -0.808000 +-0.194300 -0.401700 -0.426800 0.792000 0.416000 -0.432000 +-0.194300 -0.401700 -0.426800 0.792000 0.416000 -0.432000 +-0.044700 -0.251000 -0.365800 -0.216000 0.376000 -0.896000 +-0.044700 -0.251000 -0.365800 -0.216000 0.376000 -0.896000 +0.000000 -0.251000 -0.386300 -0.352000 0.496000 -0.792000 +0.000000 -0.238800 -0.365800 -0.192000 0.648000 -0.728000 +0.000000 -0.238800 -0.365800 -0.192000 0.648000 -0.728000 +0.100000 -0.224900 -0.365800 0.352000 0.456000 -0.808000 +0.100000 -0.224900 -0.365800 0.352000 0.456000 -0.808000 +0.100000 -0.251000 -0.380100 0.472000 -0.384000 -0.784000 +0.118000 -0.251000 -0.365800 0.536000 -0.224000 -0.808000 +0.100000 -0.263400 -0.365800 0.480000 -0.672000 -0.544000 +0.100000 -0.263400 -0.365800 0.480000 -0.672000 -0.544000 +0.350000 -0.354600 -0.365800 -0.264000 -0.632000 -0.720000 +0.350000 -0.354600 -0.365800 -0.264000 -0.632000 -0.720000 +0.350000 -0.351500 -0.368100 -0.440000 0.096000 -0.888000 +0.348000 -0.351500 -0.365800 -0.720000 -0.032000 -0.680000 +0.348000 -0.351500 -0.365800 -0.720000 -0.032000 -0.680000 +0.450000 0.007700 -0.365800 -0.264000 0.744000 -0.600000 +0.450000 0.007700 -0.365800 -0.264000 0.744000 -0.600000 +0.431500 0.000000 -0.365800 -0.424000 0.312000 -0.840000 +0.450000 0.000000 -0.377000 -0.360000 0.400000 -0.840000 +0.450000 -0.014200 -0.365800 -0.336000 -0.568000 -0.744000 +0.450000 -0.014200 -0.365800 -0.336000 -0.568000 -0.744000 +0.650000 -0.245700 -0.365800 0.168000 0.856000 -0.480000 +0.650000 -0.245700 -0.365800 0.168000 0.856000 -0.480000 +0.650000 -0.251000 -0.378600 0.328000 0.752000 -0.560000 +0.678000 -0.251000 -0.365800 0.264000 0.520000 -0.808000 +0.650000 -0.267900 -0.365800 0.280000 -0.440000 -0.848000 diff --git a/xc/extras/Mesa/demos/lodbias.c b/xc/extras/Mesa/demos/lodbias.c new file mode 100644 index 000000000..1d01502d9 --- /dev/null +++ b/xc/extras/Mesa/demos/lodbias.c @@ -0,0 +1,229 @@ +/* + * GL_EXT_texture_lod_bias demo + * + * Thanks to Michael Vance for implementing this extension in Mesa. + * + * Brian Paul + * 20 March 2000 + * + * Copyright (C) 2000 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. + */ + + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <GL/glut.h> +#include <GL/glext.h> + +#include "../util/readtex.c" /* I know, this is a hack. */ + +#define TEXTURE_FILE "../images/girl.rgb" + +static GLfloat Xrot = 0, Yrot = -30, Zrot = 0; +static GLboolean Anim = GL_TRUE; +static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */ +static GLint BiasMin = -200, BiasMax = 500; + + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + +static void Idle( void ) +{ + static int lastTime = 0; + int time = glutGet(GLUT_ELAPSED_TIME); + int step; + + if (lastTime == 0) + lastTime = time; + else if (time - lastTime < 10) + return; + + step = (time - lastTime) / 10 * BiasStepSign; + lastTime = time; + + Bias += step; + if (Bias < BiasMin) { + Bias = BiasMin; + BiasStepSign = +1; + } + else if (Bias > BiasMax) { + Bias = BiasMax; + BiasStepSign = -1; + } + + glutPostRedisplay(); +} + + +static void Display( void ) +{ + char str[100]; + + glClear( GL_COLOR_BUFFER_BIT ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(-1, 1, -1, 1, -1, 1); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + glDisable(GL_TEXTURE_2D); + glColor3f(1,1,1); + glRasterPos3f(-0.9, -0.9, 0.0); + sprintf(str, "Texture LOD Bias = %4.1f", Bias * 0.01); + PrintString(str); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -8.0 ); + + glPushMatrix(); + glRotatef(Xrot, 1, 0, 0); + glRotatef(Yrot, 0, 1, 0); + glRotatef(Zrot, 0, 0, 1); + + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.01 * Bias); + + glBegin(GL_POLYGON); + glTexCoord2f(0, 0); glVertex2f(-1, -1); + glTexCoord2f(2, 0); glVertex2f( 1, -1); + glTexCoord2f(2, 2); glVertex2f( 1, 1); + glTexCoord2f(0, 2); glVertex2f(-1, 1); + glEnd(); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + const GLfloat step = 3.0; + (void) x; + (void) y; + switch (key) { + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'z': + Zrot -= step; + break; + case 'Z': + Zrot += step; + break; + case 'b': + Bias -= 10; + break; + case 'B': + Bias += 10; + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + const GLfloat step = 3.0; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + Xrot -= step; + break; + case GLUT_KEY_DOWN: + Xrot += step; + break; + case GLUT_KEY_LEFT: + Yrot -= step; + break; + case GLUT_KEY_RIGHT: + Yrot += step; + break; + } + glutPostRedisplay(); +} + + +static void Init( void ) +{ + const char *exten = (const char *) glGetString(GL_EXTENSIONS); + if (!strstr(exten, "GL_EXT_texture_lod_bias")) { + printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n"); + exit(1); + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { + printf("Error: could not load texture image %s\n", TEXTURE_FILE); + exit(1); + } + + /* mipmapping required for this extension */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 350, 350 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0]); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + if (Anim) + glutIdleFunc(Idle); + Init(); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/morph3d.c b/xc/extras/Mesa/demos/morph3d.c new file mode 100644 index 000000000..954d9bb53 --- /dev/null +++ b/xc/extras/Mesa/demos/morph3d.c @@ -0,0 +1,906 @@ +/* $Id: morph3d.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * $Log: morph3d.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.4 2000/06/27 17:04:43 brianp + * fixed compiler warnings + * + * Revision 1.3 1999/12/15 13:00:45 brianp + * moved #define to column 0 + * + * Revision 1.2 1999/09/17 12:27:01 brianp + * silenced some warnings + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.1 1998/06/29 02:37:30 brianp + * minor changes for Windows (Ted Jump) + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +/*- + * morph3d.c - Shows 3D morphing objects + * + * Converted to GLUT by brianp on 1/1/98 + * + * This program was inspired on a WindowsNT(R)'s screen saver. It was written + * from scratch and it was not based on any other source code. + * + * Porting it to xlock (the final objective of this code since the moment I + * decided to create it) was possible by comparing the original Mesa's gear + * demo with it's ported version, so thanks for Danny Sung for his indirect + * help (look at gear.c in xlock source tree). NOTE: At the moment this code + * was sent to Brian Paul for package inclusion, the XLock Version was not + * available. In fact, I'll wait it to appear on the next Mesa release (If you + * are reading this, it means THIS release) to send it for xlock package + * inclusion). It will probably there be a GLUT version too. + * + * Thanks goes also to Brian Paul for making it possible and inexpensive + * to use OpenGL at home. + * + * Since I'm not a native english speaker, my apologies for any gramatical + * mistake. + * + * My e-mail addresses are + * + * vianna@cat.cbpf.br + * and + * marcelo@venus.rdc.puc-rio.br + * + * Marcelo F. Vianna (Feb-13-1997) + */ + +/* +This document is VERY incomplete, but tries to describe the mathematics used +in the program. At this moment it just describes how the polyhedra are +generated. On futhurer versions, this document will be probabbly improved. + +Since I'm not a native english speaker, my apologies for any gramatical +mistake. + +Marcelo Fernandes Vianna +- Undergraduate in Computer Engeneering at Catholic Pontifical University +- of Rio de Janeiro (PUC-Rio) Brasil. +- e-mail: vianna@cat.cbpf.br or marcelo@venus.rdc.puc-rio.br +- Feb-13-1997 + +POLYHEDRA GENERATION + +For the purpose of this program it's not sufficient to know the polyhedra +vertexes coordinates. Since the morphing algorithm applies a nonlinear +transformation over the surfaces (faces) of the polyhedron, each face has +to be divided into smaller ones. The morphing algorithm needs to transform +each vertex of these smaller faces individually. It's a very time consoming +task. + +In order to reduce calculation overload, and since all the macro faces of +the polyhedron are transformed by the same way, the generation is made by +creating only one face of the polyhedron, morphing it and then rotating it +around the polyhedron center. + +What we need to know is the face radius of the polyhedron (the radius of +the inscribed sphere) and the angle between the center of two adjacent +faces using the center of the sphere as the angle's vertex. + +The face radius of the regular polyhedra are known values which I decided +to not waste my time calculating. Following is a table of face radius for +the regular polyhedra with edge length = 1: + + TETRAHEDRON : 1/(2*sqrt(2))/sqrt(3) + CUBE : 1/2 + OCTAHEDRON : 1/sqrt(6) + DODECAHEDRON : T^2 * sqrt((T+2)/5) / 2 -> where T=(sqrt(5)+1)/2 + ICOSAHEDRON : (3*sqrt(3)+sqrt(15))/12 + +I've not found any reference about the mentioned angles, so I needed to +calculate them, not a trivial task until I figured out how :) +Curiously these angles are the same for the tetrahedron and octahedron. +A way to obtain this value is inscribing the tetrahedron inside the cube +by matching their vertexes. So you'll notice that the remaining unmatched +vertexes are in the same straight line starting in the cube/tetrahedron +center and crossing the center of each tetrahedron's face. At this point +it's easy to obtain the bigger angle of the isosceles triangle formed by +the center of the cube and two opposite vertexes on the same cube face. +The edges of this triangle have the following lenghts: sqrt(2) for the base +and sqrt(3)/2 for the other two other edges. So the angle we want is: + +-----------------------------------------------------------+ + | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees | + +-----------------------------------------------------------+ +For the cube this angle is obvious, but just for formality it can be +easily obtained because we also know it's isosceles edge lenghts: +sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we +want is: + +-----------------------------------------------------------+ + | 2*ARCSIN((sqrt(2)/2)/1) = 90.000000000000000000 degrees | + +-----------------------------------------------------------+ +For the octahedron we use the same idea used for the tetrahedron, but now +we inscribe the cube inside the octahedron so that all cubes's vertexes +matches excatly the center of each octahedron's face. It's now clear that +this angle is the same of the thetrahedron one: + +-----------------------------------------------------------+ + | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees | + +-----------------------------------------------------------+ +For the dodecahedron it's a little bit harder because it's only relationship +with the cube is useless to us. So we need to solve the problem by another +way. The concept of Face radius also exists on 2D polygons with the name +Edge radius: + Edge Radius For Pentagon (ERp) + ERp = (1/2)/TAN(36 degrees) * VRp = 0.6881909602355867905 + (VRp is the pentagon's vertex radio). + Face Radius For Dodecahedron + FRd = T^2 * sqrt((T+2)/5) / 2 = 1.1135163644116068404 +Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle, +completing this triangle, the lesser angle is a half of the angle we are +looking for, so this angle is: + +-----------------------------------------------------------+ + | 2*ARCTAN(ERp/FRd) = 63.434948822922009981 degrees | + +-----------------------------------------------------------+ +For the icosahedron we can use the same method used for dodecahedron (well +the method used for dodecahedron may be used for all regular polyhedra) + Edge Radius For Triangle (this one is well known: 1/3 of the triangle height) + ERt = sin(60)/3 = sqrt(3)/6 = 0.2886751345948128655 + Face Radius For Icosahedron + FRi= (3*sqrt(3)+sqrt(15))/12 = 0.7557613140761707538 +So the angle is: + +-----------------------------------------------------------+ + | 2*ARCTAN(ERt/FRi) = 41.810314895778596167 degrees | + +-----------------------------------------------------------+ + +*/ + + +#include <stdio.h> +#include <stdlib.h> +#ifndef _WIN32 +#include <unistd.h> +#endif +#include <GL/glut.h> +#include <math.h> +#include <string.h> + +#define Scale 0.3 + +#define VectMul(X1,Y1,Z1,X2,Y2,Z2) (Y1)*(Z2)-(Z1)*(Y2),(Z1)*(X2)-(X1)*(Z2),(X1)*(Y2)-(Y1)*(X2) +#define sqr(A) ((A)*(A)) + +/* Increasing this values produces better image quality, the price is speed. */ +/* Very low values produces erroneous/incorrect plotting */ +#define tetradivisions 23 +#define cubedivisions 20 +#define octadivisions 21 +#define dodecadivisions 10 +#define icodivisions 15 + +#define tetraangle 109.47122063449069174 +#define cubeangle 90.000000000000000000 +#define octaangle 109.47122063449069174 +#define dodecaangle 63.434948822922009981 +#define icoangle 41.810314895778596167 + +#ifndef Pi +#define Pi 3.1415926535897932385 +#endif +#define SQRT2 1.4142135623730951455 +#define SQRT3 1.7320508075688771932 +#define SQRT5 2.2360679774997898051 +#define SQRT6 2.4494897427831778813 +#define SQRT15 3.8729833462074170214 +#define cossec36_2 0.8506508083520399322 +#define cos72 0.3090169943749474241 +#define sin72 0.9510565162951535721 +#define cos36 0.8090169943749474241 +#define sin36 0.5877852522924731292 + +/*************************************************************************/ + +static int mono=0; +static int smooth=1; +static GLint WindH, WindW; +static GLfloat step=0; +static GLfloat seno; +static int object; +static int edgedivisions; +static void (*draw_object)( void ); +static float Magnitude; +static float *MaterialColor[20]; + +static float front_shininess[] = {60.0}; +static float front_specular[] = { 0.7, 0.7, 0.7, 1.0 }; +static float ambient[] = { 0.0, 0.0, 0.0, 1.0 }; +static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; +static float position0[] = { 1.0, 1.0, 1.0, 0.0 }; +static float position1[] = {-1.0,-1.0, 1.0, 0.0 }; +static float lmodel_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; +static float lmodel_twoside[] = {GL_TRUE}; + +static float MaterialRed[] = { 0.7, 0.0, 0.0, 1.0 }; +static float MaterialGreen[] = { 0.1, 0.5, 0.2, 1.0 }; +static float MaterialBlue[] = { 0.0, 0.0, 0.7, 1.0 }; +static float MaterialCyan[] = { 0.2, 0.5, 0.7, 1.0 }; +static float MaterialYellow[] = { 0.7, 0.7, 0.0, 1.0 }; +static float MaterialMagenta[] = { 0.6, 0.2, 0.5, 1.0 }; +static float MaterialWhite[] = { 0.7, 0.7, 0.7, 1.0 }; +static float MaterialGray[] = { 0.2, 0.2, 0.2, 1.0 }; + +#define TRIANGLE(Edge, Amp, Divisions, Z) \ +{ \ + GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \ + GLfloat Factor,Factor1,Factor2; \ + GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \ + GLfloat Ax,Ay,Bx; \ + int Ri,Ti; \ + GLfloat Vr=(Edge)*SQRT3/3; \ + GLfloat AmpVr2=(Amp)/sqr(Vr); \ + GLfloat Zf=(Edge)*(Z); \ + \ + Ax=(Edge)*(+0.5/(Divisions)), Ay=(Edge)*(-SQRT3/(2*Divisions)); \ + Bx=(Edge)*(-0.5/(Divisions)); \ + \ + for (Ri=1; Ri<=(Divisions); Ri++) { \ + glBegin(GL_TRIANGLE_STRIP); \ + for (Ti=0; Ti<Ri; Ti++) { \ + Xf=(float)(Ri-Ti)*Ax + (float)Ti*Bx; \ + Yf=Vr+(float)(Ri-Ti)*Ay + (float)Ti*Ay; \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + \ + Xf=(float)(Ri-Ti-1)*Ax + (float)Ti*Bx; \ + Yf=Vr+(float)(Ri-Ti-1)*Ay + (float)Ti*Ay; \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + \ + } \ + Xf=(float)Ri*Bx; \ + Yf=Vr+(float)Ri*Ay; \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + glEnd(); \ + } \ +} + +#define SQUARE(Edge, Amp, Divisions, Z) \ +{ \ + int Xi,Yi; \ + GLfloat Xf,Yf,Y,Xf2,Yf2,Y2,Xa,Yb; \ + GLfloat Factor,Factor1,Factor2; \ + GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \ + GLfloat Zf=(Edge)*(Z); \ + GLfloat AmpVr2=(Amp)/sqr((Edge)*SQRT2/2); \ + \ + for (Yi=0; Yi<(Divisions); Yi++) { \ + Yf=-((Edge)/2.0) + ((float)Yi)/(Divisions)*(Edge); \ + Yf2=sqr(Yf); \ + Y=Yf+1.0/(Divisions)*(Edge); \ + Y2=sqr(Y); \ + glBegin(GL_QUAD_STRIP); \ + for (Xi=0; Xi<=(Divisions); Xi++) { \ + Xf=-((Edge)/2.0) + ((float)Xi)/(Divisions)*(Edge); \ + Xf2=sqr(Xf); \ + \ + Xa=Xf+0.001; Yb=Y+0.001; \ + Factor=1-((Xf2+Y2)*AmpVr2); \ + Factor1=1-((sqr(Xa)+Y2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Y; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Y-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-((Xf2+Yf2)*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + } \ + glEnd(); \ + } \ +} + +#define PENTAGON(Edge, Amp, Divisions, Z) \ +{ \ + int Ri,Ti,Fi; \ + GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \ + GLfloat x[6],y[6]; \ + GLfloat Factor,Factor1,Factor2; \ + GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \ + GLfloat Zf=(Edge)*(Z); \ + GLfloat AmpVr2=(Amp)/sqr((Edge)*cossec36_2); \ + \ + for(Fi=0;Fi<6;Fi++) { \ + x[Fi]=-cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \ + y[Fi]=sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \ + } \ + \ + for (Ri=1; Ri<=(Divisions); Ri++) { \ + for (Fi=0; Fi<5; Fi++) { \ + glBegin(GL_TRIANGLE_STRIP); \ + for (Ti=0; Ti<Ri; Ti++) { \ + Xf=(float)(Ri-Ti)*x[Fi] + (float)Ti*x[Fi+1]; \ + Yf=(float)(Ri-Ti)*y[Fi] + (float)Ti*y[Fi+1]; \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + \ + Xf=(float)(Ri-Ti-1)*x[Fi] + (float)Ti*x[Fi+1]; \ + Yf=(float)(Ri-Ti-1)*y[Fi] + (float)Ti*y[Fi+1]; \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + \ + } \ + Xf=(float)Ri*x[Fi+1]; \ + Yf=(float)Ri*y[Fi+1]; \ + Xa=Xf+0.001; Yb=Yf+0.001; \ + Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \ + Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \ + Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \ + VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \ + NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \ + NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \ + glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \ + glVertex3f(VertX, VertY, VertZ); \ + glEnd(); \ + } \ + } \ +} + +static void draw_tetra( void ) +{ + GLuint list; + + list = glGenLists( 1 ); + glNewList( list, GL_COMPILE ); + TRIANGLE(2,seno,edgedivisions,0.5/SQRT6); + glEndList(); + + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,0,1); + glRotatef(-tetraangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+tetraangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+tetraangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]); + glCallList(list); + + glDeleteLists(list,1); +} + +static void draw_cube( void ) +{ + GLuint list; + + list = glGenLists( 1 ); + glNewList( list, GL_COMPILE ); + SQUARE(2, seno, edgedivisions, 0.5) + glEndList(); + + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]); + glCallList(list); + glRotatef(cubeangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]); + glCallList(list); + glRotatef(cubeangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]); + glCallList(list); + glRotatef(cubeangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]); + glCallList(list); + glRotatef(cubeangle,0,1,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]); + glCallList(list); + glRotatef(2*cubeangle,0,1,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]); + glCallList(list); + + glDeleteLists(list,1); +} + +static void draw_octa( void ) +{ + GLuint list; + + list = glGenLists( 1 ); + glNewList( list, GL_COMPILE ); + TRIANGLE(2,seno,edgedivisions,1/SQRT6); + glEndList(); + + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,0,1); + glRotatef(-180+octaangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-octaangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-octaangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]); + glCallList(list); + glPopMatrix(); + glRotatef(180,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,0,1); + glRotatef(-180+octaangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-octaangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,1,0); + glRotatef(-octaangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]); + glCallList(list); + + glDeleteLists(list,1); +} + +static void draw_dodeca( void ) +{ + GLuint list; + +#define TAU ((SQRT5+1)/2) + + list = glGenLists( 1 ); + glNewList( list, GL_COMPILE ); + PENTAGON(1,seno,edgedivisions,sqr(TAU) * sqrt((TAU+2)/5) / 2); + glEndList(); + + glPushMatrix(); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]); + glCallList(list); + glRotatef(180,0,0,1); + glPushMatrix(); + glRotatef(-dodecaangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(-dodecaangle,cos72,sin72,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(-dodecaangle,cos72,-sin72,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(dodecaangle,cos36,-sin36,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]); + glCallList(list); + glPopMatrix(); + glRotatef(dodecaangle,cos36,sin36,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]); + glCallList(list); + glPopMatrix(); + glRotatef(180,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]); + glCallList(list); + glRotatef(180,0,0,1); + glPushMatrix(); + glRotatef(-dodecaangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(-dodecaangle,cos72,sin72,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(-dodecaangle,cos72,-sin72,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(dodecaangle,cos36,-sin36,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]); + glCallList(list); + glPopMatrix(); + glRotatef(dodecaangle,cos36,sin36,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]); + glCallList(list); + + glDeleteLists(list,1); +} + +static void draw_ico( void ) +{ + GLuint list; + + list = glGenLists( 1 ); + glNewList( list, GL_COMPILE ); + TRIANGLE(1.5,seno,edgedivisions,(3*SQRT3+SQRT15)/12); + glEndList(); + + glPushMatrix(); + + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,0,1); + glRotatef(-icoangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,0,1); + glRotatef(-icoangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,0,1); + glRotatef(-icoangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]); + glCallList(list); + glPopMatrix(); + glRotatef(180,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,0,1); + glRotatef(-icoangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[12]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[13]); + glCallList(list); + glPopMatrix(); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[14]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[15]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,0,1); + glRotatef(-icoangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[16]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[17]); + glCallList(list); + glPushMatrix(); + glRotatef(180,0,1,0); + glRotatef(-180+icoangle,0.5,-SQRT3/2,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[18]); + glCallList(list); + glPopMatrix(); + glRotatef(180,0,0,1); + glRotatef(-icoangle,1,0,0); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[19]); + glCallList(list); + + glDeleteLists(list,1); +} + +static void draw ( void ) { + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glPushMatrix(); + + glTranslatef( 0.0, 0.0, -10.0 ); + glScalef( Scale*WindH/WindW, Scale, Scale ); + glTranslatef(2.5*WindW/WindH*sin(step*1.11),2.5*cos(step*1.25*1.11),0); + glRotatef(step*100,1,0,0); + glRotatef(step*95,0,1,0); + glRotatef(step*90,0,0,1); + + seno=(sin(step)+1.0/3.0)*(4.0/5.0)*Magnitude; + + draw_object(); + + glPopMatrix(); + + glFlush(); + + glutSwapBuffers(); + + step+=0.05; +} + +static void idle_( void ) +{ + glutPostRedisplay(); +} + +static void reshape( int width, int height ) +{ + glViewport(0, 0, WindW=(GLint)width, WindH=(GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); + glMatrixMode(GL_MODELVIEW); +} + +static void pinit(void); + +static void key( unsigned char k, int x, int y ) +{ + (void) x; + (void) y; + switch (k) { + case '1': object=1; break; + case '2': object=2; break; + case '3': object=3; break; + case '4': object=4; break; + case '5': object=5; break; + case ' ': mono^=1; break; + case 13: smooth^=1; break; + case 27: + exit(0); + } + pinit(); +} + +static void pinit(void) +{ + switch(object) { + case 1: + draw_object=draw_tetra; + MaterialColor[0]=MaterialRed; + MaterialColor[1]=MaterialGreen; + MaterialColor[2]=MaterialBlue; + MaterialColor[3]=MaterialWhite; + edgedivisions=tetradivisions; + Magnitude=2.5; + break; + case 2: + draw_object=draw_cube; + MaterialColor[0]=MaterialRed; + MaterialColor[1]=MaterialGreen; + MaterialColor[2]=MaterialCyan; + MaterialColor[3]=MaterialMagenta; + MaterialColor[4]=MaterialYellow; + MaterialColor[5]=MaterialBlue; + edgedivisions=cubedivisions; + Magnitude=2.0; + break; + case 3: + draw_object=draw_octa; + MaterialColor[0]=MaterialRed; + MaterialColor[1]=MaterialGreen; + MaterialColor[2]=MaterialBlue; + MaterialColor[3]=MaterialWhite; + MaterialColor[4]=MaterialCyan; + MaterialColor[5]=MaterialMagenta; + MaterialColor[6]=MaterialGray; + MaterialColor[7]=MaterialYellow; + edgedivisions=octadivisions; + Magnitude=2.5; + break; + case 4: + draw_object=draw_dodeca; + MaterialColor[ 0]=MaterialRed; + MaterialColor[ 1]=MaterialGreen; + MaterialColor[ 2]=MaterialCyan; + MaterialColor[ 3]=MaterialBlue; + MaterialColor[ 4]=MaterialMagenta; + MaterialColor[ 5]=MaterialYellow; + MaterialColor[ 6]=MaterialGreen; + MaterialColor[ 7]=MaterialCyan; + MaterialColor[ 8]=MaterialRed; + MaterialColor[ 9]=MaterialMagenta; + MaterialColor[10]=MaterialBlue; + MaterialColor[11]=MaterialYellow; + edgedivisions=dodecadivisions; + Magnitude=2.0; + break; + case 5: + draw_object=draw_ico; + MaterialColor[ 0]=MaterialRed; + MaterialColor[ 1]=MaterialGreen; + MaterialColor[ 2]=MaterialBlue; + MaterialColor[ 3]=MaterialCyan; + MaterialColor[ 4]=MaterialYellow; + MaterialColor[ 5]=MaterialMagenta; + MaterialColor[ 6]=MaterialRed; + MaterialColor[ 7]=MaterialGreen; + MaterialColor[ 8]=MaterialBlue; + MaterialColor[ 9]=MaterialWhite; + MaterialColor[10]=MaterialCyan; + MaterialColor[11]=MaterialYellow; + MaterialColor[12]=MaterialMagenta; + MaterialColor[13]=MaterialRed; + MaterialColor[14]=MaterialGreen; + MaterialColor[15]=MaterialBlue; + MaterialColor[16]=MaterialCyan; + MaterialColor[17]=MaterialYellow; + MaterialColor[18]=MaterialMagenta; + MaterialColor[19]=MaterialGray; + edgedivisions=icodivisions; + Magnitude=2.5; + break; + } + if (mono) { + int loop; + for (loop=0; loop<20; loop++) MaterialColor[loop]=MaterialGray; + } + if (smooth) { + glShadeModel( GL_SMOOTH ); + } else { + glShadeModel( GL_FLAT ); + } + +} + +static void INIT(void) +{ + printf("Morph 3D - Shows morphing platonic polyhedra\n"); + printf("Author: Marcelo Fernandes Vianna (vianna@cat.cbpf.br)\n\n"); + printf(" [1] - Tetrahedron\n"); + printf(" [2] - Hexahedron (Cube)\n"); + printf(" [3] - Octahedron\n"); + printf(" [4] - Dodecahedron\n"); + printf(" [5] - Icosahedron\n"); + printf("[SPACE] - Toggle colored faces\n"); + printf("[RETURN] - Toggle smooth/flat shading\n"); + printf(" [ESC] - Quit\n"); + + object=1; + + glutInitWindowPosition(0,0); + glutInitWindowSize(640,480); + + glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); + + if (glutCreateWindow("Morph 3D - Shows morphing platonic polyhedra") <= 0) { + exit(0); + } + + glClearDepth(1.0); + glClearColor( 0.0, 0.0, 0.0, 1.0 ); + glColor3f( 1.0, 1.0, 1.0 ); + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + glFlush(); + glutSwapBuffers(); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position0); + glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT1, GL_POSITION, position1); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHT1); + glEnable(GL_DEPTH_TEST); + glEnable(GL_NORMALIZE); + + glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular); + + glHint(GL_FOG_HINT, GL_FASTEST); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST); + + pinit(); + + glutReshapeFunc( reshape ); + glutKeyboardFunc( key ); + glutIdleFunc( idle_ ); + glutDisplayFunc( draw ); + glutMainLoop(); + +} + +int main(int argc, char **argv) +{ + INIT(); + return(0); +} diff --git a/xc/extras/Mesa/demos/multiarb.c b/xc/extras/Mesa/demos/multiarb.c new file mode 100644 index 000000000..0105b3110 --- /dev/null +++ b/xc/extras/Mesa/demos/multiarb.c @@ -0,0 +1,350 @@ +/* $Id: multiarb.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * GL_ARB_multitexture demo + * + * Command line options: + * -info print GL implementation information + * + * + * Brian Paul November 1998 This program is in the public domain. + */ + +/* + * $Log: multiarb.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.6 2000/05/23 23:21:00 brianp + * set default window pos + * + * Revision 1.5 2000/02/02 17:31:45 brianp + * changed > to >= + * + * Revision 1.4 2000/02/02 01:07:21 brianp + * limit Drift to [0, 1] + * + * Revision 1.3 1999/10/21 16:40:32 brianp + * added -info command line option + * + * Revision 1.2 1999/10/13 12:02:13 brianp + * use texture objects now + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 1.3 1999/03/28 18:20:49 brianp + * minor clean-up + * + * Revision 1.2 1998/11/05 04:34:04 brianp + * moved image files to ../images/ directory + * + * Revision 1.1 1998/11/03 01:36:33 brianp + * Initial revision + * + */ + + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <GL/glut.h> + +#include "../util/readtex.c" /* I know, this is a hack. */ + +#define TEXTURE_1_FILE "../images/girl.rgb" +#define TEXTURE_2_FILE "../images/reflect.rgb" + +#define TEX0 1 +#define TEX1 2 +#define TEXBOTH 3 +#define ANIMATE 10 +#define QUIT 100 + +static GLboolean Animate = GL_TRUE; + +static GLfloat Drift = 0.0; +static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0; + + + +static void Idle( void ) +{ + if (Animate) { + Drift += 0.05; + if (Drift >= 1.0) + Drift = 0.0; + +#ifdef GL_ARB_multitexture + glActiveTextureARB(GL_TEXTURE0_ARB); +#endif + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glTranslatef(Drift, 0.0, 0.0); + glMatrixMode(GL_MODELVIEW); + +#ifdef GL_ARB_multitexture + glActiveTextureARB(GL_TEXTURE1_ARB); +#endif + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glTranslatef(0.0, Drift, 0.0); + glMatrixMode(GL_MODELVIEW); + + glutPostRedisplay(); + } +} + + +static void DrawObject(void) +{ + glBegin(GL_QUADS); + +#ifdef GL_ARB_multitexture + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 0.0); + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0); + glVertex2f(-1.0, -1.0); + + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 0.0); + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0); + glVertex2f(1.0, -1.0); + + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 2.0); + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0); + glVertex2f(1.0, 1.0); + + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 2.0); + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0); + glVertex2f(-1.0, 1.0); +#else + glTexCoord2f(0.0, 0.0); + glVertex2f(-1.0, -1.0); + + glTexCoord2f(1.0, 0.0); + glVertex2f(1.0, -1.0); + + glTexCoord2f(1.0, 1.0); + glVertex2f(1.0, 1.0); + + glTexCoord2f(0.0, 1.0); + glVertex2f(-1.0, 1.0); +#endif + + glEnd(); +} + + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(Xrot, 1.0, 0.0, 0.0); + glRotatef(Yrot, 0.0, 1.0, 0.0); + glRotatef(Zrot, 0.0, 0.0, 1.0); + glScalef(5.0, 5.0, 5.0); + DrawObject(); + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); + /*glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );*/ + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -70.0 ); +} + + +static void ModeMenu(int entry) +{ + GLboolean enable0 = GL_FALSE, enable1 = GL_FALSE; + if (entry==TEX0) { + enable0 = GL_TRUE; + } + else if (entry==TEX1) { + enable1 = GL_TRUE; + } + else if (entry==TEXBOTH) { + enable0 = GL_TRUE; + enable1 = GL_TRUE; + } + else if (entry==ANIMATE) { + Animate = !Animate; + } + else if (entry==QUIT) { + exit(0); + } + + if (entry != ANIMATE) { +#ifdef GL_ARB_multitexture + glActiveTextureARB(GL_TEXTURE0_ARB); +#endif + if (enable0) { + glEnable(GL_TEXTURE_2D); + } + else + glDisable(GL_TEXTURE_2D); + +#ifdef GL_ARB_multitexture + glActiveTextureARB(GL_TEXTURE1_ARB); +#endif + if (enable1) { + glEnable(GL_TEXTURE_2D); + } + else + glDisable(GL_TEXTURE_2D); + } + + glutPostRedisplay(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + float step = 3.0; + (void) x; + (void) y; + + switch (key) { + case GLUT_KEY_UP: + Xrot += step; + break; + case GLUT_KEY_DOWN: + Xrot -= step; + break; + case GLUT_KEY_LEFT: + Yrot += step; + break; + case GLUT_KEY_RIGHT: + Yrot -= step; + break; + } + glutPostRedisplay(); +} + + +static void Init( int argc, char *argv[] ) +{ + GLuint texObj[2]; + + const char *exten = (const char *) glGetString(GL_EXTENSIONS); + if (!strstr(exten, "GL_ARB_multitexture")) { + printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n"); + exit(1); + } + + /* allocate two texture objects */ + glGenTextures(2, texObj); + + /* setup texture obj 0 */ + glBindTexture(GL_TEXTURE_2D, texObj[0]); +#ifdef LINEAR_FILTER + /* linear filtering looks much nicer but is much slower for Mesa */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +#else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +#endif + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if (!LoadRGBMipmaps(TEXTURE_1_FILE, GL_RGB)) { + printf("Error: couldn't load texture image\n"); + exit(1); + } + + + /* setup texture obj 1 */ + glBindTexture(GL_TEXTURE_2D, texObj[1]); +#ifdef LINEAR_FILTER + /* linear filtering looks much nicer but is much slower for Mesa */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +#else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +#endif + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + if (!LoadRGBMipmaps(TEXTURE_2_FILE, GL_RGB)) { + printf("Error: couldn't load texture image\n"); + exit(1); + } + + + /* now bind the texture objects to the respective texture units */ +#ifdef GL_ARB_multitexture + glActiveTextureARB(GL_TEXTURE0_ARB); + glBindTexture(GL_TEXTURE_2D, texObj[0]); + glActiveTextureARB(GL_TEXTURE1_ARB); + glBindTexture(GL_TEXTURE_2D, texObj[1]); +#endif + + glShadeModel(GL_FLAT); + glClearColor(0.3, 0.3, 0.4, 1.0); + + ModeMenu(TEXBOTH); + + if (argc > 1 && strcmp(argv[1], "-info")==0) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowSize( 300, 300 ); + glutInitWindowPosition( 0, 0 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0] ); + + Init( argc, argv ); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutCreateMenu(ModeMenu); + glutAddMenuEntry("Texture 0", TEX0); + glutAddMenuEntry("Texture 1", TEX1); + glutAddMenuEntry("Multi-texture", TEXBOTH); + glutAddMenuEntry("Toggle Animation", ANIMATE); + glutAddMenuEntry("Quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/occlude.c b/xc/extras/Mesa/demos/occlude.c new file mode 100644 index 000000000..e26446059 --- /dev/null +++ b/xc/extras/Mesa/demos/occlude.c @@ -0,0 +1,226 @@ +/* + * GL_HP_occlustion_test demo + * + * Brian Paul + * 31 March 2000 + * + * Copyright (C) 2000 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. + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <GL/glut.h> +#include <GL/glext.h> + + +static GLfloat Xpos = 0; + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + + +static void Idle(void) +{ + static int lastTime = 0; + static int sign = +1; + int time = glutGet(GLUT_ELAPSED_TIME); + float step; + + if (lastTime == 0) + lastTime = time; + else if (time - lastTime < 20) /* 50Hz update */ + return; + + step = (time - lastTime) / 1000.0 * sign; + lastTime = time; + + Xpos += step; + + if (Xpos > 2.5) { + Xpos = 2.5; + sign = -1; + } + else if (Xpos < -2.5) { + Xpos = -2.5; + sign = +1; + } + glutPostRedisplay(); +} + + +static void Display( void ) +{ + GLboolean result; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -15.0 ); + + /* draw the occluding polygons */ + glColor3f(0, 0.6, 0.8); + glBegin(GL_QUADS); + glVertex2f(-1.6, -1.5); + glVertex2f(-0.4, -1.5); + glVertex2f(-0.4, 1.5); + glVertex2f(-1.6, 1.5); + + glVertex2f( 0.4, -1.5); + glVertex2f( 1.6, -1.5); + glVertex2f( 1.6, 1.5); + glVertex2f( 0.4, 1.5); + glEnd(); + + /* draw the test polygon with occlusion testing */ + glPushMatrix(); + glTranslatef(Xpos, 0, -0.5); + glScalef(0.3, 0.3, 1.0); + glRotatef(-90.0 * Xpos, 0, 0, 1); + + glEnable(GL_OCCLUSION_TEST_HP); /* NOTE: enabling the occlusion test */ + /* doesn't clear the result flag! */ + glColorMask(0, 0, 0, 0); + glDepthMask(GL_FALSE); + /* this call clear's the result flag. Not really needed for this demo. */ + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result); + + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result); + /* turn off occlusion testing */ + glDisable(GL_OCCLUSION_TEST_HP); + glColorMask(1, 1, 1, 1); + glDepthMask(GL_TRUE); + + /* draw the green rect, so we can see what's going on */ + glColor3f(0.8, 0.5, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glPopMatrix(); + + + /* Print result message */ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + glColor3f(1, 1, 1); + glRasterPos3f(-0.25, -0.7, 0); + + if (result) + PrintString(" Visible"); + else + PrintString("Fully Occluded"); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + const GLfloat step = 0.1; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_LEFT: + Xpos -= step; + break; + case GLUT_KEY_RIGHT: + Xpos += step; + break; + } + glutPostRedisplay(); +} + + +static void Init( void ) +{ + const char *ext = (const char *) glGetString(GL_EXTENSIONS); + if (!strstr(ext, "GL_HP_occlusion_test")) { + printf("Sorry, this demo requires the GL_HP_occlusion_test extension\n"); + exit(-1); + } + + glEnable(GL_DEPTH_TEST); +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 400, 400 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + glutCreateWindow(argv[0]); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutIdleFunc( Idle ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/osdemo.c b/xc/extras/Mesa/demos/osdemo.c new file mode 100644 index 000000000..1147ecb3e --- /dev/null +++ b/xc/extras/Mesa/demos/osdemo.c @@ -0,0 +1,257 @@ +/* $Id: osdemo.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Demo of off-screen Mesa rendering + * + * See Mesa/include/GL/osmesa.h for documentation of the OSMesa functions. + * + * If you want to render BIG images you'll probably have to increase + * MAX_WIDTH and MAX_HEIGHT in src/config.h. + * + * This program is in the public domain. + * + * Brian Paul + * + * PPM output provided by Joerg Schmalzl. + * ASCII PPM output added by Brian Paul. + */ + + +#include <stdio.h> +#include <stdlib.h> +#include "GL/osmesa.h" +#include "GL/glut.h" + + +#define SAVE_TARGA + + +#define WIDTH 400 +#define HEIGHT 400 + + + +static void render_image( void ) +{ + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + GLfloat red_mat[] = { 1.0, 0.2, 0.2, 1.0 }; + GLfloat green_mat[] = { 0.2, 1.0, 0.2, 1.0 }; + GLfloat blue_mat[] = { 0.2, 0.2, 1.0, 1.0 }; + + + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-2.5, 2.5, -2.5, 2.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(20.0, 1.0, 0.0, 0.0); + + glPushMatrix(); + glTranslatef(-0.75, 0.5, 0.0); + glRotatef(90.0, 1.0, 0.0, 0.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red_mat ); + glutSolidTorus(0.275, 0.85, 20, 20); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(-0.75, -0.5, 0.0); + glRotatef(270.0, 1.0, 0.0, 0.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green_mat ); + glutSolidCone(1.0, 2.0, 16, 1); + glPopMatrix(); + +#ifdef GL_HP_occlusion_test + { + GLboolean bRet; + glDepthMask(GL_FALSE); + glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE); + glEnable(GL_OCCLUSION_TEST_HP); + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet); + + glPushMatrix(); + glTranslatef(0.75, 0.0, -1.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat ); + glutSolidSphere(1.0, 20, 20); + glPopMatrix(); + + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet); + printf("Occlusion test 1 (result should be 1): %d\n",bRet); + + glDepthMask(GL_TRUE); + glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); + glDisable(GL_OCCLUSION_TEST_HP); + } +#endif + + glPushMatrix(); + glTranslatef(0.75, 0.0, -1.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat ); + glutSolidSphere(1.0, 20, 20); + glPopMatrix(); + +#ifdef GL_HP_occlusion_test + { + GLboolean bRet; + + glDepthMask(GL_FALSE); + glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE); + glEnable(GL_OCCLUSION_TEST_HP); + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet); + + /* draw a sphere inside the previous sphere */ + glPushMatrix(); + glTranslatef(0.75, 0.0, -1.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat ); + glutSolidSphere(0.5, 20, 20); + glPopMatrix(); + + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet); + printf("Occlusion test 2 (result should be 0): %d\n",bRet); + + glDepthMask(GL_TRUE); + glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); + glDisable(GL_OCCLUSION_TEST_HP); + } +#endif + + glPopMatrix(); +} + + + +static void +write_targa(const char *filename, const GLubyte *buffer, int width, int height) +{ + FILE *f = fopen( filename, "w" ); + if (f) { + int i, x, y; + const GLubyte *ptr = buffer; + printf ("osdemo, writing tga file \n"); + fputc (0x00, f); /* ID Length, 0 => No ID */ + fputc (0x00, f); /* Color Map Type, 0 => No color map included */ + fputc (0x02, f); /* Image Type, 2 => Uncompressed, True-color Image */ + fputc (0x00, f); /* Next five bytes are about the color map entries */ + fputc (0x00, f); /* 2 bytes Index, 2 bytes length, 1 byte size */ + fputc (0x00, f); + fputc (0x00, f); + fputc (0x00, f); + fputc (0x00, f); /* X-origin of Image */ + fputc (0x00, f); + fputc (0x00, f); /* Y-origin of Image */ + fputc (0x00, f); + fputc (WIDTH & 0xff, f); /* Image Width */ + fputc ((WIDTH>>8) & 0xff, f); + fputc (HEIGHT & 0xff, f); /* Image Height */ + fputc ((HEIGHT>>8) & 0xff, f); + fputc (0x18, f); /* Pixel Depth, 0x18 => 24 Bits */ + fputc (0x20, f); /* Image Descriptor */ + fclose(f); + f = fopen( filename, "ab" ); /* reopen in binary append mode */ + for (y=height-1; y>=0; y--) { + for (x=0; x<width; x++) { + i = (y*width + x) * 4; + fputc(ptr[i+2], f); /* write blue */ + fputc(ptr[i+1], f); /* write green */ + fputc(ptr[i], f); /* write red */ + } + } + } +} + + +static void +write_ppm(const char *filename, const GLubyte *buffer, int width, int height) +{ + const int binary = 0; + FILE *f = fopen( filename, "w" ); + if (f) { + int i, x, y; + const GLubyte *ptr = buffer; + if (binary) { + fprintf(f,"P6\n"); + fprintf(f,"# ppm-file created by osdemo.c\n"); + fprintf(f,"%i %i\n", width,height); + fprintf(f,"255\n"); + fclose(f); + f = fopen( filename, "ab" ); /* reopen in binary append mode */ + for (y=height-1; y>=0; y--) { + for (x=0; x<width; x++) { + i = (y*width + x) * 4; + fputc(ptr[i], f); /* write red */ + fputc(ptr[i+1], f); /* write green */ + fputc(ptr[i+2], f); /* write blue */ + } + } + } + else { + /*ASCII*/ + int counter = 0; + fprintf(f,"P3\n"); + fprintf(f,"# ascii ppm file created by osdemo.c\n"); + fprintf(f,"%i %i\n", width, height); + fprintf(f,"255\n"); + for (y=height-1; y>=0; y--) { + for (x=0; x<width; x++) { + i = (y*width + x) * 4; + fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]); + counter++; + if (counter % 5 == 0) + fprintf(f, "\n"); + } + } + } + fclose(f); + } +} + + + +int main( int argc, char *argv[] ) +{ + /* Create an RGBA-mode context */ + OSMesaContext ctx = OSMesaCreateContext( GL_RGBA, NULL ); + + /* Allocate the image buffer */ + void *buffer = malloc( WIDTH * HEIGHT * 4 ); + + /* Bind the buffer to the context and make it current */ + OSMesaMakeCurrent( ctx, buffer, GL_UNSIGNED_BYTE, WIDTH, HEIGHT ); + + render_image(); + + if (argc>1) { +#ifdef SAVE_TARGA + write_targa(argv[1], buffer, WIDTH, HEIGHT); +#else + write_ppm(argv[1], buffer, WIDTH, HEIGHT); +#endif + } + else { + printf("Specify a filename if you want to make an image file\n"); + } + + printf("all done\n"); + + /* free the image buffer */ + free( buffer ); + + /* destroy the context */ + OSMesaDestroyContext( ctx ); + + return 0; +} diff --git a/xc/extras/Mesa/demos/paltex.c b/xc/extras/Mesa/demos/paltex.c new file mode 100644 index 000000000..df94beeb9 --- /dev/null +++ b/xc/extras/Mesa/demos/paltex.c @@ -0,0 +1,169 @@ +/* $Id: paltex.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Paletted texture demo. Written by Brian Paul. + * This program is in the public domain. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#define GL_GLEXT_LEGACY +#include <GL/glut.h> + + +static float Rot = 0.0; + + +static void Idle( void ) +{ + Rot += 5.0; + glutPostRedisplay(); +} + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(Rot, 0, 0, 1); + + glBegin(GL_POLYGON); + glTexCoord2f(0, 1); glVertex2f(-1, -0.5); + glTexCoord2f(1, 1); glVertex2f( 1, -0.5); + glTexCoord2f(1, 0); glVertex2f( 1, 0.5); + glTexCoord2f(0, 0); glVertex2f(-1, 0.5); + glEnd(); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -7.0 ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void Init( void ) +{ +#define HEIGHT 8 +#define WIDTH 32 + static char texture[HEIGHT][WIDTH] = { + " ", + " MMM EEEE SSS AAA ", + " M M M E S S A A ", + " M M M EEEE SS A A ", + " M M M E SS AAAAA ", + " M M E S S A A ", + " M M EEEE SSS A A ", + " " + }; + GLubyte table[256][4]; + + if (!glutExtensionSupported("GL_EXT_paletted_texture")) { + printf("Sorry, GL_EXT_paletted_texture not supported\n"); + exit(0); + } + + /* load the color table for each texel-index */ + table[' '][0] = 50; + table[' '][1] = 50; + table[' '][2] = 50; + table[' '][3] = 50; + table['M'][0] = 255; + table['M'][1] = 0; + table['M'][2] = 0; + table['M'][3] = 0; + table['E'][0] = 0; + table['E'][1] = 255; + table['E'][2] = 0; + table['E'][3] = 0; + table['S'][0] = 40; + table['S'][1] = 40; + table['S'][2] = 255; + table['S'][3] = 0; + table['A'][0] = 255; + table['A'][1] = 255; + table['A'][2] = 0; + table['A'][3] = 0; + +#ifdef GL_EXT_paletted_texture + +#if defined(GL_EXT_shared_texture_palette) && defined(USE_SHARED_PALETTE) + printf("Using shared palette\n"); + glColorTableEXT(GL_SHARED_TEXTURE_PALETTE_EXT, /* target */ + GL_RGBA, /* internal format */ + 256, /* table size */ + GL_RGBA, /* table format */ + GL_UNSIGNED_BYTE, /* table type */ + table); /* the color table */ + glEnable(GL_SHARED_TEXTURE_PALETTE_EXT); +#else + glColorTableEXT(GL_TEXTURE_2D, /* target */ + GL_RGBA, /* internal format */ + 256, /* table size */ + GL_RGBA, /* table format */ + GL_UNSIGNED_BYTE, /* table type */ + table); /* the color table */ +#endif + + glTexImage2D(GL_TEXTURE_2D, /* target */ + 0, /* level */ + GL_COLOR_INDEX8_EXT, /* internal format */ + WIDTH, HEIGHT, /* width, height */ + 0, /* border */ + GL_COLOR_INDEX, /* texture format */ + GL_UNSIGNED_BYTE, /* texture type */ + texture); /* teh texture */ +#endif + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glEnable(GL_TEXTURE_2D); +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 400, 400 ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + + glutCreateWindow(argv[0]); + + Init(); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/particles.cxx b/xc/extras/Mesa/demos/particles.cxx new file mode 100644 index 000000000..b88c318e0 --- /dev/null +++ b/xc/extras/Mesa/demos/particles.cxx @@ -0,0 +1,219 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (humanware@plus.it) + * Humanware s.r.l. + */ + +#include <stdlib.h> + +#include "particles.h" + +#define vinit(a,i,j,k) {\ + (a)[0]=i;\ + (a)[1]=j;\ + (a)[2]=k;\ +} + +#define vadds(a,dt,b) {\ + (a)[0]+=(dt)*(b)[0];\ + (a)[1]+=(dt)*(b)[1];\ + (a)[2]+=(dt)*(b)[2];\ +} + +#define vequ(a,b) {\ + (a)[0]=(b)[0];\ + (a)[1]=(b)[1];\ + (a)[2]=(b)[2];\ +} + +#define vinter(a,dt,b,c) {\ + (a)[0]=(dt)*(b)[0]+(1.0-dt)*(c)[0];\ + (a)[1]=(dt)*(b)[1]+(1.0-dt)*(c)[1];\ + (a)[2]=(dt)*(b)[2]+(1.0-dt)*(c)[2];\ +} + +#define clamp(a) ((a) < 0.0 ? 0.0 : ((a) < 1.0 ? (a) : 1.0)) + +#define vclamp(v) {\ + (v)[0]=clamp((v)[0]);\ + (v)[1]=clamp((v)[1]);\ + (v)[2]=clamp((v)[2]);\ +} + + +float rainParticle::min[3]; +float rainParticle::max[3]; +float rainParticle::partLength=0.2f; + + +static float vrnd(void) +{ + return(((float)rand())/RAND_MAX); +} + + +particle::particle() +{ + age=0.0f; + + vinit(acc,0.0f,0.0f,0.0f); + vinit(vel,0.0f,0.0f,0.0f); + vinit(pos,0.0f,0.0f,0.0f); +} + +void particle::elapsedTime(float dt) +{ + age+=dt; + + vadds(vel,dt,acc); + + vadds(pos,dt,vel); +} + +///////////////////////////////////////// +// Particle System +///////////////////////////////////////// + +particleSystem::particleSystem() +{ + t=0.0f; + + part=NULL; + + particleNum=0; +} + +particleSystem::~particleSystem() +{ + if(part) + free(part); +} + +void particleSystem::addParticle(particle *p) +{ + if(!part) { + part=(particle **)calloc(1,sizeof(particle *)); + part[0]=p; + particleNum=1; + } else { + particleNum++; + part=(particle **)realloc(part,sizeof(particle *)*particleNum); + part[particleNum-1]=p; + } +} + +void particleSystem::reset(void) +{ + if(part) + free(part); + + t=0.0f; + + part=NULL; + + particleNum=0; +} + +void particleSystem::draw(void) +{ + if(!part) + return; + + part[0]->beginDraw(); + for(unsigned int i=0;i<particleNum;i++) + part[i]->draw(); + part[0]->endDraw(); +} + +void particleSystem::addTime(float dt) +{ + if(!part) + return; + + for(unsigned int i=0;i<particleNum;i++) { + part[i]->elapsedTime(dt); + part[i]->checkAge(); + } +} + +///////////////////////////////////////// +// Rain +///////////////////////////////////////// + +void rainParticle::init(void) +{ + age=0.0f; + + acc[0]=0.0f; + acc[1]=-0.98f; + acc[2]=0.0f; + + vel[0]=0.0f; + vel[1]=0.0f; + vel[2]=0.0f; + + oldpos[0]=pos[0]=min[0]+(max[0]-min[0])*vrnd(); + oldpos[1]=pos[1]=max[1]+0.2f*max[1]*vrnd(); + oldpos[2]=pos[2]=min[2]+(max[2]-min[2])*vrnd(); + + vadds(oldpos,-partLength,vel); +} + +rainParticle::rainParticle() +{ + init(); +} + +void rainParticle::setRainingArea(float minx, float miny, float minz, + float maxx, float maxy, float maxz) +{ + vinit(min,minx,miny,minz); + vinit(max,maxx,maxy,maxz); +} + +void rainParticle::setLength(float l) +{ + partLength=l; +} + +void rainParticle::draw(void) +{ + glColor4f(0.7f,0.95f,1.0f,0.0f); + glVertex3fv(oldpos); + + glColor4f(0.3f,0.7f,1.0f,1.0f); + glVertex3fv(pos); +} + +void rainParticle::checkAge(void) +{ + if(pos[1]<min[1]) + init(); +} + +void rainParticle::elapsedTime(float dt) +{ + particle::elapsedTime(dt); + + if(pos[0]<min[0]) + pos[0]=max[0]-(min[0]-pos[0]); + if(pos[2]<min[2]) + pos[2]=max[2]-(min[2]-pos[2]); + + if(pos[0]>max[0]) + pos[0]=min[0]+(pos[0]-max[0]); + if(pos[2]>max[2]) + pos[2]=min[2]+(pos[2]-max[2]); + + vequ(oldpos,pos); + vadds(oldpos,-partLength,vel); +} + +void rainParticle::randomHeight(void) +{ + pos[1]=(max[1]-min[1])*vrnd()+min[1]; + + oldpos[1]=pos[1]-partLength*vel[1]; +} diff --git a/xc/extras/Mesa/demos/particles.h b/xc/extras/Mesa/demos/particles.h new file mode 100644 index 000000000..a49dd691e --- /dev/null +++ b/xc/extras/Mesa/demos/particles.h @@ -0,0 +1,81 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (humanware@plus.it) + * Humanware s.r.l. + */ + +#ifndef PARTICLES_H +#define PARTICLES_H + +#include <GL/gl.h> + +class particle { + protected: + float age; // in seconds + float acc[3]; + float vel[3]; + float pos[3]; + + public: + particle(); + virtual ~particle() {}; + + virtual void beginDraw(void) {}; + virtual void draw(void)=0; + virtual void endDraw(void) {}; + + virtual void elapsedTime(float); + virtual void checkAge(void) {}; +}; + +class particleSystem { + protected: + particle **part; + + float t; + + unsigned long particleNum; + public: + particleSystem(); + ~particleSystem(); + + void addParticle(particle *); + + void reset(void); + + void draw(void); + + void addTime(float); +}; + +class rainParticle : public particle { + protected: + static float min[3]; + static float max[3]; + static float partLength; + + float oldpos[3]; + + void init(void); + public: + rainParticle(); + + static void setRainingArea(float, float, float, + float, float, float); + static void setLength(float); + static float getLength(void) { return partLength; }; + + void beginDraw(void) { glBegin(GL_LINES); }; + void draw(void); + void endDraw(void) { glEnd(); }; + + void elapsedTime(float); + + void checkAge(void); + + void randomHeight(void); +}; + +#endif diff --git a/xc/extras/Mesa/demos/pixeltex.c b/xc/extras/Mesa/demos/pixeltex.c new file mode 100644 index 000000000..4516b3f86 --- /dev/null +++ b/xc/extras/Mesa/demos/pixeltex.c @@ -0,0 +1,210 @@ +/* + * GL_SGIS_pixel_texture demo + * + * Brian Paul + * 6 Apr 2000 + * + * Copyright (C) 2000 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. + */ + + +/* + * How this works: + * 1. We load the image into a 2D texture. + * 2. We generate a sequence of RGB images in which the R component + * is really the S texture coordinate and the G component is really + * the T texture coordinate. + * By warping the mapping from R to S and G to T we can get non-linear + * distortions. + * 3. Draw the warped image (a 2-D warping function) with pixel texgen + * enabled. + * 4. Loop over the warped images to animate. + * + * The pixel texgen extension can also be used to do color-space + * conversions. For example, we could convert YCR to RGB with a + * 3D texture map which takes YCR as the S,T,R texture coordinate and + * returns RGB texel values. + * + * You can use this extension in (at least) two ways: + * 1. glDrawPixels w/ color space conversion/warping + * 2. glDrawPixels to spatially warp another image in texture memory + * + * We're basically using glDrawPixels to draw a texture coordinate image. + */ + + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <GL/glut.h> +#include <GL/glext.h> +#include "../util/readtex.c" /* I know, this is a hack. */ + +#define TEXTURE_FILE "../images/girl.rgb" + +static int ImgWidth = 300, ImgHeight = 300; +#define FRAMES 20 +static GLubyte *ImgData[FRAMES]; +static GLint Frame = 0; + +static GLboolean TextureFlag = GL_TRUE; + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + if (TextureFlag) { + glEnable(GL_PIXEL_TEXTURE_SGIS); + glEnable(GL_TEXTURE_2D); + } + else { + glDisable(GL_PIXEL_TEXTURE_SGIS); + glDisable(GL_TEXTURE_2D); + } + + glColor3f(1, 1, 1); + glRasterPos2f(10, 10); + glDrawPixels(ImgWidth, ImgHeight, GL_RGB, GL_UNSIGNED_BYTE, ImgData[Frame]); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(0, width, 0, height, -1, 1); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case ' ': + TextureFlag = !TextureFlag; + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void Idle(void) +{ + Frame++; + if (Frame >= FRAMES) + Frame = 0; + glutPostRedisplay(); +} + + +static GLubyte warp(GLfloat s, int frame) +{ + static const GLfloat PI = 3.14159265; + static int halfFrame = FRAMES / 2; + GLfloat y, weight, v; + if (frame >= halfFrame) + frame = halfFrame - (frame - halfFrame); + y = sin(s * PI); + weight = (float) frame / (FRAMES-1); + v = y * (0.8 * weight + 0.2); + return (GLint) (v * 255.0F); +} + + +static void InitImage(void) +{ + int i, j, frame; + for (frame = 0; frame < FRAMES; frame++) { + ImgData[frame] = (GLubyte *) malloc(ImgWidth * ImgHeight * 3); + for (i = 0; i < ImgHeight; i++) { + for (j = 0; j < ImgWidth; j++) { + GLubyte *pixel = ImgData[frame] + (i * ImgWidth + j) * 3; + pixel[0] = warp((float) j / (ImgWidth - 0), frame); + pixel[1] = warp((float) i / (ImgHeight - 0), frame); + pixel[2] = 0.0; + } + } + } +} + + +static void Init( int argc, char *argv[] ) +{ + const char *exten = (const char *) glGetString(GL_EXTENSIONS); + if (!strstr(exten, "GL_SGIS_pixel_texture")) { + printf("Sorry, GL_SGIS_pixel_texture not supported by this renderer.\n"); + exit(1); + } + + /* linear filtering looks nicer, but it's slower, since it's in software */ +#if 1 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +#else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +#endif + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { + printf("Error: couldn't load texture image\n"); + exit(1); + } + + glClearColor(0.3, 0.3, 0.4, 1.0); + + InitImage(); + + printf("Hit SPACE to toggle pixel texgen\n"); +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowSize( 330, 330 ); + glutInitWindowPosition( 0, 0 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0] ); + + Init( argc, argv ); + + glutKeyboardFunc( Key ); + glutReshapeFunc( Reshape ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/pointblast.c b/xc/extras/Mesa/demos/pointblast.c new file mode 100644 index 000000000..f45381bf6 --- /dev/null +++ b/xc/extras/Mesa/demos/pointblast.c @@ -0,0 +1,513 @@ + +/* Copyright (c) Mark J. Kilgard, 1997. */ + +/* 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. */ + +/* This example demonstrates how to render particle effects + with OpenGL. A cloud of pinkish/orange particles explodes with the + particles bouncing off the ground. When the EXT_point_parameters + is present , the particle size is attenuated based on eye distance. */ + + +/* + * $Log: pointblast.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 2000/06/27 17:04:43 brianp + * fixed compiler warnings + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.3 1998/07/26 01:24:27 brianp + * removed include of gl.h + * + * Revision 3.2 1998/02/14 18:51:46 brianp + * fixed a small compiler warning + * + * Revision 3.1 1998/02/14 18:45:25 brianp + * optimized to use flat shading, don't blend ground polygon + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> /* for cos(), sin(), and sqrt() */ +#define GL_GLEXT_LEGACY +#include <GL/glut.h> + +/* Some <math.h> files do not define M_PI... */ +#ifndef M_PI +#define M_PI 3.14159265 +#endif + +#if 0 /* For debugging. */ +#undef GL_EXT_point_parameters +#endif + +static GLfloat angle = -150; /* in degrees */ +static int spin = 0; +static int moving, begin; +static int newModel = 1; +static float theTime; +static int repeat = 1; +static int blend = 1; +int useMipmaps = 1; +int linearFiltering = 1; + +static GLfloat constant[3] = { 1/5.0, 0.0, 0.0 }; +static GLfloat linear[3] = { 0.0, 1/5.0, 0.0 }; +static GLfloat theQuad[3] = { 0.25, 0.0, 1/60.0 }; + +#define MAX_POINTS 2000 + +static int numPoints = 200; + +static GLfloat pointList[MAX_POINTS][3]; +static GLfloat pointTime[MAX_POINTS]; +static GLfloat pointVelocity[MAX_POINTS][2]; +static GLfloat pointDirection[MAX_POINTS][2]; +static int colorList[MAX_POINTS]; +static int animate = 1, motion = 0; + +static GLfloat colorSet[][4] = { + /* Shades of red. */ + { 0.7, 0.2, 0.4, 0.5 }, + { 0.8, 0.0, 0.7, 0.5 }, + { 1.0, 0.0, 0.0, 0.5 }, + { 0.9, 0.3, 0.6, 0.5 }, + { 1.0, 0.4, 0.0, 0.5 }, + { 1.0, 0.0, 0.5, 0.5 }, +}; + +#define NUM_COLORS (sizeof(colorSet)/sizeof(colorSet[0])) + +#define DEAD (NUM_COLORS+1) + + +#if 0 /* drand48 might be better on Unix machines */ +#define RANDOM_RANGE(lo, hi) ((lo) + (hi - lo) * drand48()) +#else +static float float_rand(void) { return rand() / (float) RAND_MAX; } +#define RANDOM_RANGE(lo, hi) ((lo) + (hi - lo) * float_rand()) +#endif + +#define MEAN_VELOCITY 3.0 +#define GRAVITY 2.0 +#define TIME_DELTA 0.025 /* The speed of time. */ + +/* Modeling units of ground extent in each X and Z direction. */ +#define EDGE 12 + +static void +makePointList(void) +{ + float angle, velocity, direction; + int i; + + motion = 1; + for (i=0; i<numPoints; i++) { + pointList[i][0] = 0.0; + pointList[i][1] = 0.0; + pointList[i][2] = 0.0; + pointTime[i] = 0.0; + angle = (RANDOM_RANGE(60.0, 70.0)) * M_PI/180.0; + direction = RANDOM_RANGE(0.0, 360.0) * M_PI/180.0; + pointDirection[i][0] = cos(direction); + pointDirection[i][1] = sin(direction); + velocity = MEAN_VELOCITY + RANDOM_RANGE(-0.8, 1.0); + pointVelocity[i][0] = velocity * cos(angle); + pointVelocity[i][1] = velocity * sin(angle); + colorList[i] = rand() % NUM_COLORS; + } + theTime = 0.0; +} + +static void +updatePointList(void) +{ + float distance; + int i; + + motion = 0; + for (i=0; i<numPoints; i++) { + distance = pointVelocity[i][0] * theTime; + + /* X and Z */ + pointList[i][0] = pointDirection[i][0] * distance; + pointList[i][2] = pointDirection[i][1] * distance; + + /* Z */ + pointList[i][1] = + (pointVelocity[i][1] - 0.5 * GRAVITY * pointTime[i])*pointTime[i]; + + /* If we hit the ground, bounce the point upward again. */ + if (pointList[i][1] <= 0.0) { + if (distance > EDGE) { + /* Particle has hit ground past the distance duration of + the particles. Mark particle as dead. */ + colorList[i] = NUM_COLORS; /* Not moving. */ + continue; + } + + pointVelocity[i][1] *= 0.8; /* 80% of previous up velocity. */ + pointTime[i] = 0.0; /* Reset the particles sense of up time. */ + } + motion = 1; + pointTime[i] += TIME_DELTA; + } + theTime += TIME_DELTA; + if (!motion && !spin) { + if (repeat) { + makePointList(); + } else { + glutIdleFunc(NULL); + } + } +} + +static void +idle(void) +{ + updatePointList(); + if (spin) { + angle += 0.3; + newModel = 1; + } + glutPostRedisplay(); +} + +static void +visible(int vis) +{ + if (vis == GLUT_VISIBLE) { + if (animate && (motion || spin)) { + glutIdleFunc(idle); + } + } else { + glutIdleFunc(NULL); + } +} + +static void +recalcModelView(void) +{ + glPopMatrix(); + glPushMatrix(); + glRotatef(angle, 0.0, 1.0, 0.0); + newModel = 0; +} + +static void +redraw(void) +{ + int i; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + if (newModel) + recalcModelView(); + + glDepthMask(GL_FALSE); + + /* Draw the floor. */ +/* glEnable(GL_TEXTURE_2D);*/ + glColor3f(0.5, 1.0, 0.5); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); + glVertex3f(-EDGE, -0.05, -EDGE); + glTexCoord2f(20.0, 0.0); + glVertex3f(EDGE, -0.05, -EDGE); + glTexCoord2f(20.0, 20.0); + glVertex3f(EDGE, -0.05, EDGE); + glTexCoord2f(0.0, 20.0); + glVertex3f(-EDGE, -0.05, EDGE); + glEnd(); + + /* Allow particles to blend with each other. */ + glDepthMask(GL_TRUE); + + if (blend) + glEnable(GL_BLEND); + + glDisable(GL_TEXTURE_2D); + glBegin(GL_POINTS); + for (i=0; i<numPoints; i++) { + /* Draw alive particles. */ + if (colorList[i] != DEAD) { + glColor4fv(colorSet[colorList[i]]); + glVertex3fv(pointList[i]); + } + } + glEnd(); + + glDisable(GL_BLEND); + + glutSwapBuffers(); +} + +/* ARGSUSED2 */ +static void +mouse(int button, int state, int x, int y) +{ + /* Scene can be spun around Y axis using left + mouse button movement. */ + if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { + moving = 1; + begin = x; + } + if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { + moving = 0; + } +} + +/* ARGSUSED1 */ +static void +mouseMotion(int x, int y) +{ + if (moving) { + angle = angle + (x - begin); + begin = x; + newModel = 1; + glutPostRedisplay(); + } +} + +static void +menu(int option) +{ + switch (option) { + case 0: + makePointList(); + break; +#if GL_EXT_point_parameters + case 1: + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, constant); + break; + case 2: + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, linear); + break; + case 3: + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad); + break; +#endif + case 4: + blend = 1; + break; + case 5: + blend = 0; + break; +#if GL_EXT_point_parameters + case 6: + glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 1.0); + break; + case 7: + glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 10.0); + break; +#endif + case 8: + glEnable(GL_POINT_SMOOTH); + break; + case 9: + glDisable(GL_POINT_SMOOTH); + break; + case 10: + glPointSize(2.0); + break; + case 11: + glPointSize(4.0); + break; + case 12: + glPointSize(8.0); + break; + case 13: + spin = 1 - spin; + if (animate && (spin || motion)) { + glutIdleFunc(idle); + } else { + glutIdleFunc(NULL); + } + break; + case 14: + numPoints = 200; + break; + case 15: + numPoints = 500; + break; + case 16: + numPoints = 1000; + break; + case 17: + numPoints = 2000; + break; + case 666: + exit(0); + } + glutPostRedisplay(); +} + +/* ARGSUSED1 */ +static void +key(unsigned char c, int x, int y) +{ + switch (c) { + case 13: + animate = 1 - animate; /* toggle. */ + if (animate && (motion || spin)) { + glutIdleFunc(idle); + } else { + glutIdleFunc(NULL); + } + break; + case ' ': + animate = 1; + makePointList(); + glutIdleFunc(idle); + break; + case 27: + exit(0); + } +} + +/* Nice floor texture tiling pattern. */ +static char *circles[] = { + "....xxxx........", + "..xxxxxxxx......", + ".xxxxxxxxxx.....", + ".xxx....xxx.....", + "xxx......xxx....", + "xxx......xxx....", + "xxx......xxx....", + "xxx......xxx....", + ".xxx....xxx.....", + ".xxxxxxxxxx.....", + "..xxxxxxxx......", + "....xxxx........", + "................", + "................", + "................", + "................", +}; + +static void +makeFloorTexture(void) +{ + GLubyte floorTexture[16][16][3]; + GLubyte *loc; + int s, t; + + /* Setup RGB image for the texture. */ + loc = (GLubyte*) floorTexture; + for (t = 0; t < 16; t++) { + for (s = 0; s < 16; s++) { + if (circles[t][s] == 'x') { + /* Nice blue. */ + loc[0] = 0x1f; + loc[1] = 0x1f; + loc[2] = 0x8f; + } else { + /* Light gray. */ + loc[0] = 0xca; + loc[1] = 0xca; + loc[2] = 0xca; + } + loc += 3; + } + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if (useMipmaps) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16, + GL_RGB, GL_UNSIGNED_BYTE, floorTexture); + } else { + if (linearFiltering) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0, + GL_RGB, GL_UNSIGNED_BYTE, floorTexture); + } +} + +int +main(int argc, char **argv) +{ + int i; + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); + + for (i=1; i<argc; i++) { + if(!strcmp("-noms", argv[i])) { + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + printf("forcing no multisampling\n"); + } else if(!strcmp("-nomipmaps", argv[i])) { + useMipmaps = 0; + } else if(!strcmp("-nearest", argv[i])) { + linearFiltering = 0; + } + } + + glutCreateWindow("point burst"); + glutDisplayFunc(redraw); + glutMouseFunc(mouse); + glutMotionFunc(mouseMotion); + glutVisibilityFunc(visible); + glutKeyboardFunc(key); + glutCreateMenu(menu); + glutAddMenuEntry("Reset time", 0); + glutAddMenuEntry("Constant", 1); + glutAddMenuEntry("Linear", 2); + glutAddMenuEntry("Quadratic", 3); + glutAddMenuEntry("Blend on", 4); + glutAddMenuEntry("Blend off", 5); + glutAddMenuEntry("Threshold 1", 6); + glutAddMenuEntry("Threshold 10", 7); + glutAddMenuEntry("Point smooth on", 8); + glutAddMenuEntry("Point smooth off", 9); + glutAddMenuEntry("Point size 2", 10); + glutAddMenuEntry("Point size 4", 11); + glutAddMenuEntry("Point size 8", 12); + glutAddMenuEntry("Toggle spin", 13); + glutAddMenuEntry("200 points ", 14); + glutAddMenuEntry("500 points ", 15); + glutAddMenuEntry("1000 points ", 16); + glutAddMenuEntry("2000 points ", 17); + glutAddMenuEntry("Quit", 666); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + glEnable(GL_POINT_SMOOTH); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glPointSize(8.0); +#if GL_EXT_point_parameters + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad); +#endif + glMatrixMode(GL_PROJECTION); + gluPerspective( /* field of view in degree */ 40.0, + /* aspect ratio */ 1.0, + /* Z near */ 0.5, /* Z far */ 40.0); + glMatrixMode(GL_MODELVIEW); + gluLookAt(0.0, 1.0, 8.0, /* eye location */ + 0.0, 1.0, 0.0, /* center is at (0,0,0) */ + 0.0, 1.0, 0.); /* up is in postivie Y direction */ + glPushMatrix(); /* dummy push so we can pop on model + recalc */ + + makePointList(); + makeFloorTexture(); + + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/xc/extras/Mesa/demos/rain.cxx b/xc/extras/Mesa/demos/rain.cxx new file mode 100644 index 000000000..4a7ecde3c --- /dev/null +++ b/xc/extras/Mesa/demos/rain.cxx @@ -0,0 +1,388 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (humanware@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> +#include <GL/glut.h> + +#include "particles.h" +extern "C" { +#include "image.h" +} + +#ifdef WIN32 +#include <windows.h> +#include <mmsystem.h> +#endif + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen=1; +#endif + +static int WIDTH=640; +static int HEIGHT=480; +static int NUMPART=7500; + +#define FRAME 50 + +static float fogcolor[4]={1.0,1.0,1.0,1.0}; + +#define DIMP 40.0 +#define DIMTP 32.0 + +static float q[4][3]={ + {-DIMP,0.0,-DIMP}, + {DIMP,0.0,-DIMP}, + {DIMP,0.0,DIMP}, + {-DIMP,0.0,DIMP} +}; + +static float qt[4][2]={ + {-DIMTP,-DIMTP}, + {DIMTP,-DIMTP}, + {DIMTP,DIMTP}, + {-DIMTP,DIMTP} +}; + +static int win=0; + +static int fog=1; +static int help=1; + +static GLuint groundid; + +static float obs[3]={2.0,1.0,0.0}; +static float dir[3]; +static float v=0.0; +static float alpha=-90.0; +static float beta=90.0; + +static particleSystem *ps; + +static float gettime() +{ + static clock_t told=0; + clock_t tnew,ris; + + tnew=clock(); + + ris=tnew-told; + + told=tnew; + + return(ris/(float)CLOCKS_PER_SEC); +} + +static float gettimerain() +{ + static clock_t told=0; + clock_t tnew,ris; + + tnew=clock(); + + ris=tnew-told; + + told=tnew; + + return(ris/(float)CLOCKS_PER_SEC); +} + +static void calcposobs(void) +{ + dir[0]=sin(alpha*M_PI/180.0); + dir[2]=cos(alpha*M_PI/180.0)*sin(beta*M_PI/180.0); + dir[1]=cos(beta*M_PI/180.0); + + obs[0]+=v*dir[0]; + obs[1]+=v*dir[1]; + obs[2]+=v*dir[2]; + + rainParticle::setRainingArea(obs[0]-7.0f,-0.2f,obs[2]-7.0f,obs[0]+7.0f,8.0f,obs[2]+7.0f); +} + +static void printstring(void *font, char *string) +{ + int len,i; + + len=(int)strlen(string); + for(i=0;i<len;i++) + glutBitmapCharacter(font,string[i]); +} + +static void reshape(int width, int height) +{ + WIDTH=width; + HEIGHT=height; + glViewport(0,0,(GLint)width,(GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(70.0,width/(float)height,0.1,30.0); + + glMatrixMode(GL_MODELVIEW); +} + +static void printhelp(void) +{ + glEnable(GL_BLEND); + glColor4f(0.0,0.0,0.0,0.5); + glRecti(40,40,600,440); + glDisable(GL_BLEND); + + glColor3f(1.0,0.0,0.0); + glRasterPos2i(300,420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help"); + + glRasterPos2i(60,390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help"); + + glRasterPos2i(60,360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog"); + glRasterPos2i(60,330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate"); + glRasterPos2i(60,300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity"); + glRasterPos2i(60,270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity"); + glRasterPos2i(60,240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"l - Increase rain length"); + glRasterPos2i(60,210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"k - Increase rain length"); +} + +static void drawrain(void) +{ + static int count=0; + static char frbuf[80]; + float fr; + + glEnable(GL_DEPTH_TEST); + + if(fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glDepthMask(GL_TRUE); + glClearColor(1.0,1.0,1.0,1.0); + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + calcposobs(); + gluLookAt(obs[0],obs[1],obs[2], + obs[0]+dir[0],obs[1]+dir[1],obs[2]+dir[2], + 0.0,1.0,0.0); + + glColor4f(1.0,1.0,1.0,1.0); + + glEnable(GL_TEXTURE_2D); + + glBindTexture(GL_TEXTURE_2D,groundid); + glBegin(GL_QUADS); + glTexCoord2fv(qt[0]); + glVertex3fv(q[0]); + glTexCoord2fv(qt[1]); + glVertex3fv(q[1]); + glTexCoord2fv(qt[2]); + glVertex3fv(q[2]); + glTexCoord2fv(qt[3]); + glVertex3fv(q[3]); + glEnd(); + + // Particle System + + glDisable(GL_TEXTURE_2D); + glShadeModel(GL_SMOOTH); + glEnable(GL_BLEND); + + ps->draw(); + ps->addTime(gettimerain()); + + glShadeModel(GL_FLAT); + + + if((count % FRAME)==0) { + fr=gettime(); + sprintf(frbuf,"Frame rate: %f",FRAME/fr); + } + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_FOG); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5,639.5,-0.5,479.5,-1.0,1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0,0.0,0.0); + glRasterPos2i(10,10); + printstring(GLUT_BITMAP_HELVETICA_18,frbuf); + glRasterPos2i(350,470); + printstring(GLUT_BITMAP_HELVETICA_10,"Rain V1.0 Written by David Bucciarelli (humanware@plus.it)"); + + if(help) + printhelp(); + + reshape(WIDTH,HEIGHT); + glPopMatrix(); + + glutSwapBuffers(); + + count++; +} + + +static void special(int key, int x, int y) +{ + switch (key) { + case GLUT_KEY_LEFT: + alpha+=2.0; + break; + case GLUT_KEY_RIGHT: + alpha-=2.0; + break; + case GLUT_KEY_DOWN: + beta-=2.0; + break; + case GLUT_KEY_UP: + beta+=2.0; + break; + } +} + +static void key(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(0); + break; + + case 'a': + v+=0.01; + break; + case 'z': + v-=0.01; + break; + + case 'l': + rainParticle::setLength(rainParticle::getLength()+0.025f); + break; + case 'k': + rainParticle::setLength(rainParticle::getLength()-0.025f); + break; + + case 'h': + help=(!help); + break; + case 'f': + fog=(!fog); + break; +#ifdef XMESA + case ' ': + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + fullscreen=(!fullscreen); + break; +#endif + } +} + +static void inittextures(void) +{ + IMAGE *img; + GLenum gluerr; + + glGenTextures(1,&groundid); + glBindTexture(GL_TEXTURE_2D,groundid); + + if(!(img=ImageLoad("s128.rgb"))) { + fprintf(stderr,"Error reading a texture.\n"); + exit(-1); + } + + glPixelStorei(GL_UNPACK_ALIGNMENT,4); + if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, img->sizeX, img->sizeY, GL_RGB, + GL_UNSIGNED_BYTE, (GLvoid *)(img->data)))) { + fprintf(stderr,"GLULib%s\n",gluErrorString(gluerr)); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL); +} + +static void initparticle(void) +{ + ps=new particleSystem; + + rainParticle::setRainingArea(-7.0f,-0.2f,-7.0f,7.0f,8.0f,7.0f); + + for(int i=0;i<NUMPART;i++) { + rainParticle *p=new rainParticle; + p->randomHeight(); + + ps->addParticle((particle *)p); + } +} + +int main(int ac,char **av) +{ + fprintf(stderr,"Rain V1.0\nWritten by David Bucciarelli (humanware@plus.it)\n"); + + /* Default settings */ + + WIDTH=640; + HEIGHT=480; + + glutInitWindowPosition(0,0); + glutInitWindowSize(WIDTH,HEIGHT); + glutInit(&ac,av); + + glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE); + + if(!(win=glutCreateWindow("Rain"))) { + fprintf(stderr,"Error opening a window.\n"); + exit(-1); + } + + reshape(WIDTH,HEIGHT); + + inittextures(); + + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE,GL_EXP); + glFogfv(GL_FOG_COLOR,fogcolor); + glFogf(GL_FOG_DENSITY,0.1); +#ifdef FX + glHint(GL_FOG_HINT,GL_NICEST); +#endif + + initparticle(); + + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutDisplayFunc(drawrain); + glutIdleFunc(drawrain); + glutReshapeFunc(reshape); + glutMainLoop(); + + return(0); +} diff --git a/xc/extras/Mesa/demos/ray.c b/xc/extras/Mesa/demos/ray.c new file mode 100644 index 000000000..24f27a053 --- /dev/null +++ b/xc/extras/Mesa/demos/ray.c @@ -0,0 +1,908 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +#ifdef WIN32 +#include <windows.h> +#endif + +#include <GL/glut.h> + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen = 1; +#endif + +static int WIDTH = 640; +static int HEIGHT = 480; + +#define FRAME 50 + +#define BASESIZE 7.5f +#define SPHERE_RADIUS 0.75f + +#define TEX_CHECK_WIDTH 256 +#define TEX_CHECK_HEIGHT 256 +#define TEX_CHECK_SLOT_SIZE (TEX_CHECK_HEIGHT/16) +#define TEX_CHECK_NUMSLOT (TEX_CHECK_HEIGHT/TEX_CHECK_SLOT_SIZE) + +#define TEX_REFLECT_WIDTH 256 +#define TEX_REFLECT_HEIGHT 256 +#define TEX_REFLECT_SLOT_SIZE (TEX_REFLECT_HEIGHT/16) +#define TEX_REFLECT_NUMSLOT (TEX_REFLECT_HEIGHT/TEX_REFLECT_SLOT_SIZE) + +#ifndef M_PI +#define M_PI 3.1415926535 +#endif + +#define EPSILON 0.0001 + +#define clamp255(a) ( (a)<(0.0f) ? (0.0f) : ((a)>(255.0f) ? (255.0f) : (a)) ) + +#define fabs(x) ((x)<0.0f?-(x):(x)) + +#define vequ(a,b) { (a)[0]=(b)[0]; (a)[1]=(b)[1]; (a)[2]=(b)[2]; } +#define vsub(a,b,c) { (a)[0]=(b)[0]-(c)[0]; (a)[1]=(b)[1]-(c)[1]; (a)[2]=(b)[2]-(c)[2]; } +#define dprod(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]) +#define vnormalize(a,b) { \ + register float m_norm; \ + m_norm=sqrt((double)dprod((a),(a))); \ + (a)[0] /=m_norm; \ + (a)[1] /=m_norm; \ + (a)[2] /=m_norm; } + +static GLubyte checkmap[TEX_CHECK_HEIGHT][TEX_CHECK_WIDTH][3]; +static GLuint checkid; +static int checkmap_currentslot = 0; + +static GLubyte reflectmap[TEX_REFLECT_HEIGHT][TEX_REFLECT_WIDTH][3]; +static GLuint reflectid; +static int reflectmap_currentslot = 0; + +static GLuint lightdlist; +static GLuint objdlist; + +static float lightpos[3] = { 2.1, 2.1, 2.8 }; +static float objpos[3] = { 0.0, 0.0, 1.0 }; + +static float sphere_pos[TEX_CHECK_HEIGHT][TEX_REFLECT_WIDTH][3]; + +static int win = 0; + +static float fogcolor[4] = { 0.05, 0.05, 0.05, 1.0 }; + +static float obs[3] = { 7.0, 0.0, 2.0 }; +static float dir[3]; +static float v = 0.0; +static float alpha = -90.0; +static float beta = 90.0; + +static int fog = 1; +static int bfcull = 1; +static int poutline = 0; +static int help = 1; +static int showcheckmap = 1; +static int showreflectmap = 1; +static int joyavailable = 0; +static int joyactive = 0; + +static float +gettime(void) +{ + static float told = 0.0f; + float tnew, ris; + + tnew = glutGet(GLUT_ELAPSED_TIME); + + ris = tnew - told; + + told = tnew; + + return ris / 1000.0; +} + +static void +calcposobs(void) +{ + dir[0] = sin(alpha * M_PI / 180.0); + dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); + dir[2] = cos(beta * M_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; +} + +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_LEFT: + alpha -= 2.0; + break; + case GLUT_KEY_RIGHT: + alpha += 2.0; + break; + case GLUT_KEY_DOWN: + beta -= 2.0; + break; + case GLUT_KEY_UP: + beta += 2.0; + break; + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: + exit(0); + break; + + case 's': + lightpos[1] -= 0.1; + break; + case 'd': + lightpos[1] += 0.1; + break; + case 'e': + lightpos[0] -= 0.1; + break; + case 'x': + lightpos[0] += 0.1; + break; + case 'w': + lightpos[2] -= 0.1; + break; + case 'r': + lightpos[2] += 0.1; + break; + + case 'j': + objpos[1] -= 0.1; + break; + case 'k': + objpos[1] += 0.1; + break; + case 'i': + objpos[0] -= 0.1; + break; + case 'm': + objpos[0] += 0.1; + break; + case 'u': + objpos[2] -= 0.1; + break; + case 'o': + objpos[2] += 0.1; + break; + + case 'a': + v += 0.005; + break; + case 'z': + v -= 0.005; + break; + + case 'g': + joyactive = (!joyactive); + break; + case 'h': + help = (!help); + break; + case 'f': + fog = (!fog); + break; + + case '1': + showcheckmap = (!showcheckmap); + break; + case '2': + showreflectmap = (!showreflectmap); + break; + + case 'b': + if (bfcull) { + glDisable(GL_CULL_FACE); + bfcull = 0; + } + else { + glEnable(GL_CULL_FACE); + bfcull = 1; + } + break; + case 'p': + if (poutline) { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + poutline = 0; + } + else { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + poutline = 1; + } + break; +#ifdef XMESA + case ' ': + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + fullscreen = (!fullscreen); + break; +#endif + } +} + +static void +reshape(int w, int h) +{ + WIDTH = w; + HEIGHT = h; + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45.0, w / (float) h, 0.8, 40.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void +printstring(void *font, char *string) +{ + int len, i; + + len = (int) strlen(string); + for (i = 0; i < len; i++) + glutBitmapCharacter(font, string[i]); +} + +static void +printhelp(void) +{ + glEnable(GL_BLEND); + glColor4f(0.5, 0.5, 0.5, 0.5); + glRecti(40, 40, 600, 440); + glDisable(GL_BLEND); + + glColor3f(0.0, 0.0, 1.0); + glRasterPos2i(300, 420); + printstring(GLUT_BITMAP_HELVETICA_18, "Help"); + + glRasterPos2i(60, 390); + printstring(GLUT_BITMAP_HELVETICA_12, "h - Togle Help"); + glRasterPos2i(60, 370); + printstring(GLUT_BITMAP_HELVETICA_12, "f - Togle Fog"); + glRasterPos2i(60, 350); + printstring(GLUT_BITMAP_HELVETICA_12, "b - Togle Back face culling"); + glRasterPos2i(60, 330); + printstring(GLUT_BITMAP_HELVETICA_12, "p - Togle Wire frame"); + glRasterPos2i(60, 310); + printstring(GLUT_BITMAP_HELVETICA_12, "Arrow Keys - Rotate"); + glRasterPos2i(60, 290); + printstring(GLUT_BITMAP_HELVETICA_12, "a - Increase velocity"); + glRasterPos2i(60, 270); + printstring(GLUT_BITMAP_HELVETICA_12, "z - Decrease velocity"); + + glRasterPos2i(60, 250); + if (joyavailable) + printstring(GLUT_BITMAP_HELVETICA_12, + "j - Togle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_HELVETICA_12, + "(No Joystick control available)"); + + glRasterPos2i(60, 230); + printstring(GLUT_BITMAP_HELVETICA_12, + "To move the light source: s - left, d - right, e - far, x - near, w - down r - up"); + glRasterPos2i(60, 210); + printstring(GLUT_BITMAP_HELVETICA_12, + "To move the mirror sphere: j - left, k - right, i - far, m - near, u - down o - up"); + + glRasterPos2i(60, 190); + printstring(GLUT_BITMAP_HELVETICA_12, + "1 - Togle the plane texture map window"); + + glRasterPos2i(60, 170); + printstring(GLUT_BITMAP_HELVETICA_12, + "2 - Togle the sphere texture map window"); +} + +static GLboolean +seelight(float p[3], float dir[3]) +{ + float c[3], b, a, d, t, dist[3]; + + vsub(c, p, objpos); + b = -dprod(c, dir); + a = dprod(c, c) - SPHERE_RADIUS * SPHERE_RADIUS; + + if ((d = b * b - a) < 0.0 || (b < 0.0 && a > 0.0)) + return GL_FALSE; + + d = sqrt(d); + + t = b - d; + + if (t < EPSILON) { + t = b + d; + if (t < EPSILON) + return GL_FALSE; + } + + vsub(dist, lightpos, p); + if (dprod(dist, dist) < t * t) + return GL_FALSE; + + return GL_TRUE; +} + +static int +colorcheckmap(float ppos[3], float c[3]) +{ + static float norm[3] = { 0.0f, 0.0f, 1.0f }; + float ldir[3], vdir[3], h[3], dfact, kfact, r, g, b; + int x, y; + + x = (int) ((ppos[0] + BASESIZE / 2) * (10.0f / BASESIZE)); + if ((x < 0) || (x > 10)) + return GL_FALSE; + + y = (int) ((ppos[1] + BASESIZE / 2) * (10.0f / BASESIZE)); + if ((y < 0) || (y > 10)) + return GL_FALSE; + + r = 255.0f; + if (y & 1) { + if (x & 1) + g = 255.0f; + else + g = 0.0f; + } + else { + if (x & 1) + g = 0.0f; + else + g = 255.0f; + } + b = 0.0f; + + vsub(ldir, lightpos, ppos); + vnormalize(ldir, ldir); + + if (seelight(ppos, ldir)) { + c[0] = r * 0.05f; + c[1] = g * 0.05f; + c[2] = b * 0.05f; + + return GL_TRUE; + } + + dfact = dprod(ldir, norm); + if (dfact < 0.0f) + dfact = 0.0f; + + vsub(vdir, obs, ppos); + vnormalize(vdir, vdir); + h[0] = 0.5f * (vdir[0] + ldir[0]); + h[1] = 0.5f * (vdir[1] + ldir[1]); + h[2] = 0.5f * (vdir[2] + ldir[2]); + kfact = dprod(h, norm); + kfact = + kfact * kfact * kfact * kfact * kfact * kfact * kfact * 7.0f * 255.0f; + + r = r * dfact + kfact; + g = g * dfact + kfact; + b = b * dfact + kfact; + + c[0] = clamp255(r); + c[1] = clamp255(g); + c[2] = clamp255(b); + + return GL_TRUE; +} + +static void +updatecheckmap(int slot) +{ + float c[3], ppos[3]; + int x, y; + + glBindTexture(GL_TEXTURE_2D, checkid); + + ppos[2] = 0.0f; + for (y = slot * TEX_CHECK_SLOT_SIZE; y < (slot + 1) * TEX_CHECK_SLOT_SIZE; + y++) { + ppos[1] = (y / (float) TEX_CHECK_HEIGHT) * BASESIZE - BASESIZE / 2; + + for (x = 0; x < TEX_CHECK_WIDTH; x++) { + ppos[0] = (x / (float) TEX_CHECK_WIDTH) * BASESIZE - BASESIZE / 2; + + colorcheckmap(ppos, c); + checkmap[y][x][0] = (GLubyte) c[0]; + checkmap[y][x][1] = (GLubyte) c[1]; + checkmap[y][x][2] = (GLubyte) c[2]; + } + } + + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, slot * TEX_CHECK_SLOT_SIZE, + TEX_CHECK_WIDTH, TEX_CHECK_SLOT_SIZE, GL_RGB, + GL_UNSIGNED_BYTE, + &checkmap[slot * TEX_CHECK_SLOT_SIZE][0][0]); + +} + +static void +updatereflectmap(int slot) +{ + float rf, r, g, b, t, dfact, kfact, rdir[3]; + float rcol[3], ppos[3], norm[3], ldir[3], h[3], vdir[3], planepos[3]; + int x, y; + + glBindTexture(GL_TEXTURE_2D, reflectid); + + for (y = slot * TEX_REFLECT_SLOT_SIZE; + y < (slot + 1) * TEX_REFLECT_SLOT_SIZE; y++) + for (x = 0; x < TEX_REFLECT_WIDTH; x++) { + ppos[0] = sphere_pos[y][x][0] + objpos[0]; + ppos[1] = sphere_pos[y][x][1] + objpos[1]; + ppos[2] = sphere_pos[y][x][2] + objpos[2]; + + vsub(norm, ppos, objpos); + vnormalize(norm, norm); + + vsub(ldir, lightpos, ppos); + vnormalize(ldir, ldir); + vsub(vdir, obs, ppos); + vnormalize(vdir, vdir); + + rf = 2.0f * dprod(norm, vdir); + if (rf > EPSILON) { + rdir[0] = rf * norm[0] - vdir[0]; + rdir[1] = rf * norm[1] - vdir[1]; + rdir[2] = rf * norm[2] - vdir[2]; + + t = -objpos[2] / rdir[2]; + + if (t > EPSILON) { + planepos[0] = objpos[0] + t * rdir[0]; + planepos[1] = objpos[1] + t * rdir[1]; + planepos[2] = 0.0f; + + if (!colorcheckmap(planepos, rcol)) + rcol[0] = rcol[1] = rcol[2] = 0.0f; + } + else + rcol[0] = rcol[1] = rcol[2] = 0.0f; + } + else + rcol[0] = rcol[1] = rcol[2] = 0.0f; + + dfact = 0.1f * dprod(ldir, norm); + + if (dfact < 0.0f) { + dfact = 0.0f; + kfact = 0.0f; + } + else { + h[0] = 0.5f * (vdir[0] + ldir[0]); + h[1] = 0.5f * (vdir[1] + ldir[1]); + h[2] = 0.5f * (vdir[2] + ldir[2]); + kfact = dprod(h, norm); + kfact *= kfact; + kfact *= kfact; + kfact *= kfact; + kfact *= kfact; + kfact *= 10.0f; + } + + r = dfact + kfact; + g = dfact + kfact; + b = dfact + kfact; + + r *= 255.0f; + g *= 255.0f; + b *= 255.0f; + + r += rcol[0]; + g += rcol[1]; + b += rcol[2]; + + r = clamp255(r); + g = clamp255(g); + b = clamp255(b); + + reflectmap[y][x][0] = (GLubyte) r; + reflectmap[y][x][1] = (GLubyte) g; + reflectmap[y][x][2] = (GLubyte) b; + } + + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, slot * TEX_REFLECT_SLOT_SIZE, + TEX_REFLECT_WIDTH, TEX_REFLECT_SLOT_SIZE, GL_RGB, + GL_UNSIGNED_BYTE, + &reflectmap[slot * TEX_REFLECT_SLOT_SIZE][0][0]); +} + +static void +drawbase(void) +{ + glColor3f(0.0, 0.0, 0.0); + glBindTexture(GL_TEXTURE_2D, checkid); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(-BASESIZE / 2.0f, -BASESIZE / 2.0f, 0.0f); + + glTexCoord2f(1.0f, 0.0f); + glVertex3f(BASESIZE / 2.0f, -BASESIZE / 2.0f, 0.0f); + + glTexCoord2f(1.0f, 1.0f); + glVertex3f(BASESIZE / 2.0f, BASESIZE / 2.0f, 0.0f); + + glTexCoord2f(0.0f, 1.0f); + glVertex3f(-BASESIZE / 2.0f, BASESIZE / 2.0f, 0.0f); + + glEnd(); +} + +static void +drawobj(void) +{ + glColor3f(0.0, 0.0, 0.0); + glBindTexture(GL_TEXTURE_2D, reflectid); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glPushMatrix(); + glTranslatef(objpos[0], objpos[1], objpos[2]); + glCallList(objdlist); + glPopMatrix(); +} + +static void +dojoy(void) +{ +#ifdef WIN32 + static UINT max[2] = { 0, 0 }; + static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2]; + MMRESULT res; + JOYINFO joy; + + res = joyGetPos(JOYSTICKID1, &joy); + + if (res == JOYERR_NOERROR) { + joyavailable = 1; + + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2; + + if (joyactive) { + if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0])) + alpha -= + 2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]); + if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1])) + beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]); + + if (joy.wButtons & JOY_BUTTON1) + v += 0.005; + if (joy.wButtons & JOY_BUTTON2) + v -= 0.005; + } + } + else + joyavailable = 0; +#endif +} + +static void +updatemaps(void) +{ + updatecheckmap(checkmap_currentslot); + checkmap_currentslot = (checkmap_currentslot + 1) % TEX_CHECK_NUMSLOT; + + updatereflectmap(reflectmap_currentslot); + reflectmap_currentslot = + (reflectmap_currentslot + 1) % TEX_REFLECT_NUMSLOT; +} + +static void +draw(void) +{ + static int count = 0; + static char frbuf[80]; + float fr; + + dojoy(); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); + if (fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glPushMatrix(); + calcposobs(); + + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 0.0, 1.0); + + drawbase(); + drawobj(); + + glColor3f(1.0, 1.0, 1.0); + glDisable(GL_TEXTURE_2D); + + glPushMatrix(); + glTranslatef(lightpos[0], lightpos[1], lightpos[2]); + glCallList(lightdlist); + glPopMatrix(); + + glPopMatrix(); + + if ((count % FRAME) == 0) { + fr = gettime(); + sprintf(frbuf, "Frame rate: %f", FRAME / fr); + } + + glDisable(GL_DEPTH_TEST); + glDisable(GL_FOG); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + + glColor3f(0.0f, 0.3f, 1.0f); + + if (showcheckmap) { + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, checkid); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glBegin(GL_QUADS); + glTexCoord2f(1.0f, 0.0f); + glVertex2i(10, 30); + glTexCoord2f(1.0f, 1.0f); + glVertex2i(10 + 90, 30); + glTexCoord2f(0.0f, 1.0f); + glVertex2i(10 + 90, 30 + 90); + glTexCoord2f(0.0f, 0.0f); + glVertex2i(10, 30 + 90); + glEnd(); + + glDisable(GL_TEXTURE_2D); + glBegin(GL_LINE_LOOP); + glVertex2i(10, 30); + glVertex2i(10 + 90, 30); + glVertex2i(10 + 90, 30 + 90); + glVertex2i(10, 30 + 90); + glEnd(); + glRasterPos2i(105, 65); + printstring(GLUT_BITMAP_HELVETICA_18, "Plane Texture Map"); + } + + if (showreflectmap) { + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, reflectid); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glBegin(GL_QUADS); + glTexCoord2f(1.0f, 0.0f); + glVertex2i(540, 30); + glTexCoord2f(1.0f, 1.0f); + glVertex2i(540 + 90, 30); + glTexCoord2f(0.0f, 1.0f); + glVertex2i(540 + 90, 30 + 90); + glTexCoord2f(0.0f, 0.0f); + glVertex2i(540, 30 + 90); + glEnd(); + + glDisable(GL_TEXTURE_2D); + glBegin(GL_LINE_LOOP); + glVertex2i(540, 30); + glVertex2i(540 + 90, 30); + glVertex2i(540 + 90, 30 + 90); + glVertex2i(540, 30 + 90); + glEnd(); + glRasterPos2i(360, 65); + printstring(GLUT_BITMAP_HELVETICA_18, "Sphere Texture Map"); + } + + glDisable(GL_TEXTURE_2D); + + glRasterPos2i(10, 10); + printstring(GLUT_BITMAP_HELVETICA_18, frbuf); + glRasterPos2i(360, 470); + printstring(GLUT_BITMAP_HELVETICA_10, + "Ray V1.0 Written by David Bucciarelli (tech.hmw@plus.it)"); + + if (help) + printhelp(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + updatemaps(); + + glutSwapBuffers(); + + count++; +} + +static void +inittextures(void) +{ + int y; + + glGenTextures(1, &checkid); + glBindTexture(GL_TEXTURE_2D, checkid); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, 3, TEX_CHECK_WIDTH, TEX_CHECK_HEIGHT, + 0, GL_RGB, GL_UNSIGNED_BYTE, checkmap); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + for (y = 0; y < TEX_CHECK_NUMSLOT; y++) + updatecheckmap(y); + + + + glGenTextures(1, &reflectid); + glBindTexture(GL_TEXTURE_2D, reflectid); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, 3, TEX_REFLECT_WIDTH, TEX_REFLECT_HEIGHT, + 0, GL_RGB, GL_UNSIGNED_BYTE, reflectmap); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + for (y = 0; y < TEX_REFLECT_NUMSLOT; y++) + updatereflectmap(y); + + +} + +static void +initspherepos(void) +{ + float alpha, beta, sa, ca, sb, cb; + int x, y; + + for (y = 0; y < TEX_REFLECT_HEIGHT; y++) { + beta = M_PI - y * (M_PI / TEX_REFLECT_HEIGHT); + + for (x = 0; x < TEX_REFLECT_WIDTH; x++) { + alpha = -x * (2.0f * M_PI / TEX_REFLECT_WIDTH); + + sa = sin(alpha); + ca = cos(alpha); + + sb = sin(beta); + cb = cos(beta); + + sphere_pos[y][x][0] = SPHERE_RADIUS * sa * sb; + sphere_pos[y][x][1] = SPHERE_RADIUS * ca * sb; + sphere_pos[y][x][2] = SPHERE_RADIUS * cb; + } + } +} + +static void +initdlists(void) +{ + GLUquadricObj *obj; + + obj = gluNewQuadric(); + + lightdlist = glGenLists(1); + glNewList(lightdlist, GL_COMPILE); + gluQuadricDrawStyle(obj, GLU_FILL); + gluQuadricNormals(obj, GLU_NONE); + gluQuadricTexture(obj, GL_TRUE); + gluSphere(obj, 0.25f, 6, 6); + glEndList(); + + objdlist = glGenLists(1); + glNewList(objdlist, GL_COMPILE); + gluQuadricDrawStyle(obj, GLU_FILL); + gluQuadricNormals(obj, GLU_NONE); + gluQuadricTexture(obj, GL_TRUE); + gluSphere(obj, SPHERE_RADIUS, 16, 16); + glEndList(); +} + +int +main(int ac, char **av) +{ + fprintf(stderr, + "Ray V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); + + /* + if(!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS)) { + fprintf(stderr,"Error setting the process class.\n"); + return 0; + } + + if(!SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)) { + fprintf(stderr,"Error setting the process priority.\n"); + return 0; + } + */ + + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit(&ac, av); + + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + + if (!(win = glutCreateWindow("Ray"))) { + fprintf(stderr, "Error, couldn't open window\n"); + return -1; + } + + reshape(WIDTH, HEIGHT); + + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP2); + glFogfv(GL_FOG_COLOR, fogcolor); + + glFogf(GL_FOG_DENSITY, 0.01); +#ifdef FX + glHint(GL_FOG_HINT, GL_NICEST); +#endif + + calcposobs(); + + initspherepos(); + + inittextures(); + initdlists(); + + glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]); + + glutReshapeFunc(reshape); + glutDisplayFunc(draw); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutIdleFunc(draw); + + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/readpix.c b/xc/extras/Mesa/demos/readpix.c new file mode 100644 index 000000000..a389256d6 --- /dev/null +++ b/xc/extras/Mesa/demos/readpix.c @@ -0,0 +1,273 @@ +/* $Id: readpix.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * glReadPixels and glCopyPixels test + * + * Brian Paul March 1, 2000 This file is in the public domain. + */ + +/* + * $Log: readpix.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.3 2000/03/31 01:01:31 brianp + * tweaks to allow different read formats/types + * + * Revision 1.2 2000/03/23 19:47:25 brianp + * added benchmarking + * + * Revision 1.1 2000/03/01 16:23:14 brianp + * test glDraw/Read/CopyPixels() + * + */ + + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + +#include "../util/readtex.c" /* a hack, I know */ + +#define IMAGE_FILE "../images/girl.rgb" + +static int ImgWidth, ImgHeight; +static GLenum ImgFormat; +static GLubyte *Image = NULL; + +static int APosX, APosY; /* simple drawpixels */ +static int BPosX, BPosY; /* read/draw pixels */ +static int CPosX, CPosY; /* copypixels */ + +static GLboolean DrawFront = GL_FALSE; +static GLboolean ScaleAndBias = GL_FALSE; +static GLboolean Benchmark = GL_FALSE; +static GLubyte *TempImage = NULL; + +#if 1 +#define ReadFormat ImgFormat +#define ReadType GL_UNSIGNED_BYTE +#endif +#if 0 +static GLenum ReadFormat = GL_RGBA; +static GLenum ReadType = GL_UNSIGNED_BYTE; +#endif +#if 0 +static GLenum ReadFormat = GL_RGB; +static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5; +#endif + + +static void +Reset( void ) +{ + APosX = 5; APosY = 20; + BPosX = APosX + ImgWidth + 5; BPosY = 20; + CPosX = BPosX + ImgWidth + 5; CPosY = 20; +} + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + +static void +SetupPixelTransfer(GLboolean invert) +{ + if (invert) { + glPixelTransferf(GL_RED_SCALE, -1.0); + glPixelTransferf(GL_RED_BIAS, 1.0); + glPixelTransferf(GL_GREEN_SCALE, -1.0); + glPixelTransferf(GL_GREEN_BIAS, 1.0); + glPixelTransferf(GL_BLUE_SCALE, -1.0); + glPixelTransferf(GL_BLUE_BIAS, 1.0); + } + else { + glPixelTransferf(GL_RED_SCALE, 1.0); + glPixelTransferf(GL_RED_BIAS, 0.0); + glPixelTransferf(GL_GREEN_SCALE, 1.0); + glPixelTransferf(GL_GREEN_BIAS, 0.0); + glPixelTransferf(GL_BLUE_SCALE, 1.0); + glPixelTransferf(GL_BLUE_BIAS, 0.0); + } +} + + +static void +Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + glRasterPos2i(5, ImgHeight+25); + PrintString("f = toggle front/back s = toggle scale/bias b = benchmark"); + + /* draw original image */ + glRasterPos2i(APosX, 5); + PrintString("Original"); + glRasterPos2i(APosX, APosY); + glEnable(GL_DITHER); + SetupPixelTransfer(GL_FALSE); + glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); + + /* do readpixels, drawpixels */ + glRasterPos2i(BPosX, 5); + PrintString("Read/DrawPixels"); + SetupPixelTransfer(ScaleAndBias); + if (Benchmark) { + GLint reads = 0; + GLint endTime; + GLint startTime = glutGet(GLUT_ELAPSED_TIME); + GLdouble seconds, pixelsPerSecond; + printf("Benchmarking...\n"); + do { + glReadPixels(APosX, APosY, ImgWidth, ImgHeight, + ReadFormat, ReadType, TempImage); + reads++; + endTime = glutGet(GLUT_ELAPSED_TIME); + } while (endTime - startTime < 4000); /* 4 seconds */ + seconds = (double) (endTime - startTime) / 1000.0; + pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds; + printf("Result: %d reads in %f seconds = %f pixels/sec\n", + reads, seconds, pixelsPerSecond); + Benchmark = GL_FALSE; + } + else { + glReadPixels(APosX, APosY, ImgWidth, ImgHeight, + ReadFormat, ReadType, TempImage); + } + glRasterPos2i(BPosX, BPosY); + glDisable(GL_DITHER); + SetupPixelTransfer(GL_FALSE); + glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, TempImage); + + /* do copypixels */ + glRasterPos2i(CPosX, 5); + PrintString("CopyPixels"); + glRasterPos2i(CPosX, CPosY); + glDisable(GL_DITHER); + SetupPixelTransfer(ScaleAndBias); + glCopyPixels(APosX, APosY, ImgWidth, ImgHeight, GL_COLOR); + + if (!DrawFront) + glutSwapBuffers(); +} + + +static void +Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + +static void +Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 'b': + Benchmark = GL_TRUE; + break; + case 's': + ScaleAndBias = !ScaleAndBias; + break; + case 'f': + DrawFront = !DrawFront; + if (DrawFront) { + glDrawBuffer(GL_FRONT); + glReadBuffer(GL_FRONT); + } + else { + glDrawBuffer(GL_BACK); + glReadBuffer(GL_BACK); + } + printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK"); + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +Init( GLboolean ciMode ) +{ + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat ); + if (!Image) { + printf("Couldn't read %s\n", IMAGE_FILE); + exit(0); + } + + if (ciMode) { + /* Convert RGB image to grayscale */ + GLubyte *indexImage = malloc( ImgWidth * ImgHeight ); + GLint i; + for (i=0; i<ImgWidth*ImgHeight; i++) { + int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2]; + indexImage[i] = gray / 3; + } + free(Image); + Image = indexImage; + ImgFormat = GL_COLOR_INDEX; + + for (i=0;i<255;i++) { + float g = i / 255.0; + glutSetColor(i, g, g, g); + } + } + + printf("Loaded %d by %d image\n", ImgWidth, ImgHeight ); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth); + + Reset(); + + TempImage = (GLubyte *) malloc(ImgWidth * ImgHeight * 4 * sizeof(GLubyte)); + assert(TempImage); +} + + +int +main( int argc, char *argv[] ) +{ + GLboolean ciMode = GL_FALSE; + if (argc > 1 && strcmp(argv[1], "-ci")==0) { + ciMode = GL_TRUE; + } + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 750, 250 ); + if (ciMode) + glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); + else + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0]); + Init(ciMode); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/reflect.c b/xc/extras/Mesa/demos/reflect.c new file mode 100644 index 000000000..5820b2f88 --- /dev/null +++ b/xc/extras/Mesa/demos/reflect.c @@ -0,0 +1,372 @@ +/* $Id: reflect.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Demo of a reflective, texture-mapped surface with OpenGL. + * Brian Paul August 14, 1995 This file is in the public domain. + * + * Hardware texture mapping is highly recommended! + * + * The basic steps are: + * 1. Render the reflective object (a polygon) from the normal viewpoint, + * setting the stencil planes = 1. + * 2. Render the scene from a special viewpoint: the viewpoint which + * is on the opposite side of the reflective plane. Only draw where + * stencil = 1. This draws the objects in the reflective surface. + * 3. Render the scene from the original viewpoint. This draws the + * objects in the normal fashion. Use blending when drawing + * the reflective, textured surface. + * + * This is a very crude demo. It could be much better. + */ + +/* + * Authors: + * Brian Paul + * Dirk Reiners (reiners@igd.fhg.de) made some modifications to this code. + * Mark Kilgard (April 1997) + * Brian Paul (April 2000 - added keyboard d/s options) + */ + + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "GL/glut.h" +#include "../util/showbuffer.c" +#include "../util/readtex.c" + + +#define DEG2RAD (3.14159/180.0) + +#define TABLE_TEXTURE "../images/tile.rgb" + +static GLint ImgWidth, ImgHeight; +static GLenum ImgFormat; +static GLubyte *Image = NULL; + +#define MAX_OBJECTS 2 +static GLint table_list; +static GLint objects_list[MAX_OBJECTS]; + +static GLfloat xrot, yrot; +static GLfloat spin; + +static GLint Width = 400, Height = 300; +static GLenum ShowBuffer = GL_NONE; + + + +static void make_table( void ) +{ + static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 }; + static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 }; + + table_list = glGenLists(1); + glNewList( table_list, GL_COMPILE ); + + /* load table's texture */ + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, table_mat ); +/* glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/ + glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat ); + glMaterialfv( GL_FRONT, GL_AMBIENT, gray ); + + /* draw textured square for the table */ + glPushMatrix(); + glScalef( 4.0, 4.0, 4.0 ); + glBegin( GL_POLYGON ); + glNormal3f( 0.0, 1.0, 0.0 ); + glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 0.0, 1.0 ); + glTexCoord2f( 1.0, 0.0 ); glVertex3f( 1.0, 0.0, 1.0 ); + glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, 0.0, -1.0 ); + glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, 0.0, -1.0 ); + glEnd(); + glPopMatrix(); + + glDisable( GL_TEXTURE_2D ); + + glEndList(); +} + + +static void make_objects( void ) +{ + GLUquadricObj *q; + + static GLfloat cyan[] = { 0.0, 1.0, 1.0, 1.0 }; + static GLfloat green[] = { 0.2, 1.0, 0.2, 1.0 }; + static GLfloat black[] = { 0.0, 0.0, 0.0, 0.0 }; + + q = gluNewQuadric(); + gluQuadricDrawStyle( q, GLU_FILL ); + gluQuadricNormals( q, GLU_SMOOTH ); + + objects_list[0] = glGenLists(1); + glNewList( objects_list[0], GL_COMPILE ); + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, cyan ); + glMaterialfv( GL_FRONT, GL_EMISSION, black ); + gluCylinder( q, 0.5, 0.5, 1.0, 15, 1 ); + glEndList(); + + objects_list[1] = glGenLists(1); + glNewList( objects_list[1], GL_COMPILE ); + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green ); + glMaterialfv( GL_FRONT, GL_EMISSION, black ); + gluCylinder( q, 1.5, 0.0, 2.5, 15, 1 ); + glEndList(); +} + + +static void init( void ) +{ + make_table(); + make_objects(); + + Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat ); + if (!Image) { + printf("Couldn't read %s\n", TABLE_TEXTURE); + exit(0); + } + + gluBuild2DMipmaps(GL_TEXTURE_2D, 3, ImgWidth, ImgHeight, + ImgFormat, GL_UNSIGNED_BYTE, Image); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); + + xrot = 30.0; + yrot = 50.0; + spin = 0.0; + + glShadeModel( GL_FLAT ); + + glEnable( GL_LIGHT0 ); + glEnable( GL_LIGHTING ); + + glClearColor( 0.5, 0.5, 0.9, 1.0 ); + + glEnable( GL_NORMALIZE ); +} + + + +static void reshape(int w, int h) +{ + GLfloat yAspect = 2.5; + GLfloat xAspect = yAspect * (float) w / (float) h; + Width = w; + Height = h; + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 ); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + + +static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez ) +{ + (void) eyex; + (void) eyey; + (void) eyez; +#ifndef USE_ZBUFFER + if (eyex<0.5) { +#endif + glPushMatrix(); + glTranslatef( 1.0, 1.5, 0.0 ); + glRotatef( spin, 1.0, 0.5, 0.0 ); + glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); + glCallList( objects_list[0] ); + glPopMatrix(); + + glPushMatrix(); + glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 ); + glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); + glRotatef( spin, 1.0, 0.5, 0.0 ); + glScalef( 0.5, 0.5, 0.5 ); + glCallList( objects_list[1] ); + glPopMatrix(); +#ifndef USE_ZBUFFER + } + else { + glPushMatrix(); + glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 ); + glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); + glRotatef( spin, 1.0, 0.5, 0.0 ); + glScalef( 0.5, 0.5, 0.5 ); + glCallList( objects_list[1] ); + glPopMatrix(); + + glPushMatrix(); + glTranslatef( 1.0, 1.5, 0.0 ); + glRotatef( spin, 1.0, 0.5, 0.0 ); + glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); + glCallList( objects_list[0] ); + glPopMatrix(); + } +#endif +} + + + +static void draw_table( void ) +{ + glCallList( table_list ); +} + + + +static void draw_scene( void ) +{ + static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 }; + GLfloat dist = 20.0; + GLfloat eyex, eyey, eyez; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + + + eyex = dist * cos(yrot*DEG2RAD) * cos(xrot*DEG2RAD); + eyez = dist * sin(yrot*DEG2RAD) * cos(xrot*DEG2RAD); + eyey = dist * sin(xrot*DEG2RAD); + + /* view from top */ + glPushMatrix(); + gluLookAt( eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ); + + glLightfv( GL_LIGHT0, GL_POSITION, light_pos ); + + /* draw table into stencil planes */ + glDisable( GL_DEPTH_TEST ); + glEnable( GL_STENCIL_TEST ); + glStencilFunc( GL_ALWAYS, 1, 0xffffffff ); + glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE ); + glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); + draw_table(); + glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); + + glEnable( GL_DEPTH_TEST ); + + /* render view from below (reflected viewport) */ + /* only draw where stencil==1 */ + if (eyey>0.0) { + glPushMatrix(); + + glStencilFunc( GL_EQUAL, 1, 0xffffffff ); /* draw if ==1 */ + glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); + glScalef( 1.0, -1.0, 1.0 ); + + /* Reposition light in reflected space. */ + glLightfv(GL_LIGHT0, GL_POSITION, light_pos); + + draw_objects(eyex, eyey, eyez); + glPopMatrix(); + + /* Restore light's original unreflected position. */ + glLightfv(GL_LIGHT0, GL_POSITION, light_pos); + } + + glDisable( GL_STENCIL_TEST ); + + glEnable( GL_BLEND ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + + glEnable( GL_TEXTURE_2D ); + draw_table(); + glDisable( GL_TEXTURE_2D ); + glDisable( GL_BLEND ); + + /* view from top */ + glPushMatrix(); + + draw_objects(eyex, eyey, eyez); + + glPopMatrix(); + + glPopMatrix(); + + if (ShowBuffer == GL_DEPTH) { + ShowDepthBuffer(Width, Height, 1.0, 0.0); + } + else if (ShowBuffer == GL_STENCIL) { + ShowStencilBuffer(Width, Height, 255.0, 0.0); + } + + glutSwapBuffers(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + if (key == 'd') { + ShowBuffer = GL_DEPTH; + } + else if (key == 's') { + ShowBuffer = GL_STENCIL; + } + else if (key==27) { + exit(0); + } + else { + ShowBuffer = GL_NONE; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + xrot += 3.0; + if ( xrot > 85 ) + xrot = 85; + break; + case GLUT_KEY_DOWN: + xrot -= 3.0; + if ( xrot < 5 ) + xrot = 5; + break; + case GLUT_KEY_LEFT: + yrot += 3.0; + break; + case GLUT_KEY_RIGHT: + yrot -= 3.0; + break; + } + glutPostRedisplay(); +} + + + +static void idle( void ) +{ + spin += 2.0; + yrot += 3.0; + glutPostRedisplay(); +} + + + +int main( int argc, char *argv[] ) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( Width, Height ); + glutCreateWindow(argv[0]); + glutReshapeFunc(reshape); + glutDisplayFunc(draw_scene); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutIdleFunc(idle); + init(); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/renormal.c b/xc/extras/Mesa/demos/renormal.c new file mode 100644 index 000000000..e5c5e03b2 --- /dev/null +++ b/xc/extras/Mesa/demos/renormal.c @@ -0,0 +1,138 @@ +/* $Id: renormal.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Test GL_EXT_rescale_normal extension + * Brian Paul January 1998 This program is in the public domain. + */ + +/* + * $Id: renormal.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + + +static GLfloat Phi = 0.0; + + +static void Idle(void) +{ + Phi += 0.1; + glutPostRedisplay(); +} + + +static void Display( void ) +{ + GLfloat scale = 0.6 + 0.5 * sin(Phi); + glClear( GL_COLOR_BUFFER_BIT ); + glPushMatrix(); + glScalef(scale, scale, scale); + glutSolidSphere(2.0, 20, 20); + glPopMatrix(); + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -15.0 ); +} + + + +static void Init( void ) +{ + static GLfloat mat[4] = { 0.8, 0.8, 0.0, 1.0 }; + static GLfloat pos[4] = { -1.0, 1.0, 1.0, 0.0 }; + + /* setup lighting, etc */ + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat); + glLightfv(GL_LIGHT0, GL_POSITION, pos); + + glEnable(GL_CULL_FACE); + + glDisable(GL_RESCALE_NORMAL_EXT); + glDisable(GL_NORMALIZE); +} + + +#define UNSCALED 1 +#define NORMALIZE 2 +#define RESCALE 3 +#define QUIT 4 + + +static void ModeMenu(int entry) +{ + if (entry==UNSCALED) { + glDisable(GL_RESCALE_NORMAL_EXT); + glDisable(GL_NORMALIZE); + } + else if (entry==NORMALIZE) { + glEnable(GL_NORMALIZE); + glDisable(GL_RESCALE_NORMAL_EXT); + } + else if (entry==RESCALE) { + glDisable(GL_NORMALIZE); + glEnable(GL_RESCALE_NORMAL_EXT); + } + else if (entry==QUIT) { + exit(0); + } + glutPostRedisplay(); +} + +static void +key(unsigned char k, int x, int y) +{ + (void) x; + (void) y; + switch (k) { + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowSize( 400, 400 ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + + glutCreateWindow(argv[0]); + + Init(); + + glutIdleFunc( Idle ); + glutReshapeFunc( Reshape ); + glutDisplayFunc( Display ); + glutKeyboardFunc(key); + + glutCreateMenu(ModeMenu); + glutAddMenuEntry("Unscaled", UNSCALED); + glutAddMenuEntry("Normalize", NORMALIZE); + glutAddMenuEntry("Rescale EXT", RESCALE); + glutAddMenuEntry("Quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/shadow.c b/xc/extras/Mesa/demos/shadow.c new file mode 100644 index 000000000..0f66b538d --- /dev/null +++ b/xc/extras/Mesa/demos/shadow.c @@ -0,0 +1,119 @@ +/** +(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. +*/ + +/* Taken from the projshadow.c - by Tom McReynolds, SGI */ + +/* Modified by David Bucciarelli */ + +/* Rendering shadows using projective shadows. */ + +#include <GL/glut.h> +#include "shadow.h" + + +enum { + X, Y, Z, W +}; +enum { + A, B, C, D +}; + +/* create a matrix that will project the desired shadow */ +void +shadowmatrix(GLfloat shadowMat[4][4], + GLfloat groundplane[4], + GLfloat lightpos[4]) +{ + GLfloat dot; + + /* find dot product between light position vector and ground plane normal */ + dot = groundplane[X] * lightpos[X] + + groundplane[Y] * lightpos[Y] + + groundplane[Z] * lightpos[Z] + + groundplane[W] * lightpos[W]; + + shadowMat[0][0] = dot - lightpos[X] * groundplane[X]; + shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y]; + shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z]; + shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W]; + + shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X]; + shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y]; + shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z]; + shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W]; + + shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X]; + shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y]; + shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z]; + shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W]; + + shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X]; + shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y]; + shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z]; + shadowMat[3][3] = dot - lightpos[W] * groundplane[W]; + +} + +/* find the plane equation given 3 points */ +void +findplane(GLfloat plane[4], + GLfloat v0[3], GLfloat v1[3], GLfloat v2[3]) +{ + GLfloat vec0[3], vec1[3]; + + /* need 2 vectors to find cross product */ + vec0[X] = v1[X] - v0[X]; + vec0[Y] = v1[Y] - v0[Y]; + vec0[Z] = v1[Z] - v0[Z]; + + vec1[X] = v2[X] - v0[X]; + vec1[Y] = v2[Y] - v0[Y]; + vec1[Z] = v2[Z] - v0[Z]; + + /* find cross product to get A, B, and C of plane equation */ + plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y]; + plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]); + plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X]; + + plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]); +} diff --git a/xc/extras/Mesa/demos/shadow.h b/xc/extras/Mesa/demos/shadow.h new file mode 100644 index 000000000..b19dd4348 --- /dev/null +++ b/xc/extras/Mesa/demos/shadow.h @@ -0,0 +1,18 @@ +#ifndef SHADOW_H +#define SHADOW_H + + +extern void +shadowmatrix(GLfloat shadowMat[4][4], + GLfloat groundplane[4], + GLfloat lightpos[4]); + + +extern void +findplane(GLfloat plane[4], + GLfloat v0[3], GLfloat v1[3], GLfloat v2[3]); + + +#endif + + diff --git a/xc/extras/Mesa/demos/spectex.c b/xc/extras/Mesa/demos/spectex.c new file mode 100644 index 000000000..5a2d5f182 --- /dev/null +++ b/xc/extras/Mesa/demos/spectex.c @@ -0,0 +1,280 @@ +/* $Id: spectex.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * GLUT demonstration of texturing with specular highlights. + * + * When drawing a lit, textured surface one usually wants the specular + * highlight to override the texture colors. However, OpenGL applies + * texturing after lighting so the specular highlight is modulated by + * the texture. + * + * The solution here shown here is a two-pass algorithm: + * 1. Draw the textured surface without specular lighting. + * 2. Enable blending to add the next pass: + * 3. Redraw the surface with a matte white material and only the + * specular components of light sources enabled. + * + * Brian Paul February 1997 + */ + + +/* + * $Log: spectex.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.2 1999/03/28 18:22:05 brianp + * minor clean-up + * + * Revision 3.1 1998/02/14 18:47:48 brianp + * added OpenGL 1.2 separate specular interpolation support + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + + +static GLUquadricObj *Quadric; +static GLuint Sphere; +static GLfloat LightPos[4] = {10.0, 10.0, 10.0, 1.0}; +static GLfloat Delta = 1.0; +static GLint Mode = 0; + +/*static GLfloat Blue[4] = {0.0, 0.0, 1.0, 1.0};*/ +/*static GLfloat Gray[4] = {0.5, 0.5, 0.5, 1.0};*/ +static GLfloat Black[4] = {0.0, 0.0, 0.0, 1.0}; +static GLfloat White[4] = {1.0, 1.0, 1.0, 1.0}; + + + +static void Idle( void ) +{ + LightPos[0] += Delta; + if (LightPos[0]>15.0) + Delta = -1.0; + else if (LightPos[0]<-15.0) + Delta = 1.0; + + glutPostRedisplay(); +} + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glLightfv(GL_LIGHT0, GL_POSITION, LightPos); + + glPushMatrix(); + glRotatef(90.0, 1.0, 0.0, 0.0); + + if (Mode==0) { + /* Typical method: diffuse + specular + texture */ + glEnable(GL_TEXTURE_2D); + glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */ + glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */ +#ifdef GL_VERSION_1_2 + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR); +#endif + glCallList(Sphere); + } + else if (Mode==1) { + /* just specular highlight */ + glDisable(GL_TEXTURE_2D); + glLightfv(GL_LIGHT0, GL_DIFFUSE, Black); /* disable diffuse */ + glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */ +#ifdef GL_VERSION_1_2 + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR); +#endif + glCallList(Sphere); + } + else if (Mode==2) { + /* diffuse textured */ + glEnable(GL_TEXTURE_2D); + glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */ + glLightfv(GL_LIGHT0, GL_SPECULAR, Black); /* disable specular */ +#ifdef GL_VERSION_1_2 + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR); +#endif + glCallList(Sphere); + } + else if (Mode==3) { + /* 2-pass: diffuse textured then add specular highlight*/ + glEnable(GL_TEXTURE_2D); + glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */ + glLightfv(GL_LIGHT0, GL_SPECULAR, Black); /* disable specular */ +#ifdef GL_VERSION_1_2 + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR); +#endif + glCallList(Sphere); + /* specular highlight */ + glDepthFunc(GL_EQUAL); /* redraw same pixels */ + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); /* add */ + glLightfv(GL_LIGHT0, GL_DIFFUSE, Black); /* disable diffuse */ + glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */ + glCallList(Sphere); + glDepthFunc(GL_LESS); + glDisable(GL_BLEND); + } + else if (Mode==4) { + /* OpenGL 1.2's separate diffuse and specular color */ + glEnable(GL_TEXTURE_2D); + glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */ + glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */ +#ifdef GL_VERSION_1_2 + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); +#endif + glCallList(Sphere); + } + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -12.0 ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + break; + case GLUT_KEY_DOWN: + break; + } + glutPostRedisplay(); +} + + +static void Init( void ) +{ + int i, j; + GLubyte texImage[64][64][3]; + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Black); + + glMaterialfv(GL_FRONT, GL_DIFFUSE, White); + glMaterialfv(GL_FRONT, GL_SPECULAR, White); + glMaterialf(GL_FRONT, GL_SHININESS, 20.0); + + /* Actually, these are set again later */ + glLightfv(GL_LIGHT0, GL_DIFFUSE, White); + glLightfv(GL_LIGHT0, GL_SPECULAR, White); + + Quadric = gluNewQuadric(); + gluQuadricTexture( Quadric, GL_TRUE ); + + Sphere= glGenLists(1); + glNewList( Sphere, GL_COMPILE ); + gluSphere( Quadric, 1.0, 24, 24 ); + glEndList(); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + for (i=0;i<64;i++) { + for (j=0;j<64;j++) { + int k = ((i>>3)&1) ^ ((j>>3)&1); + texImage[i][j][0] = 255*k; + texImage[i][j][1] = 255*(1-k); + texImage[i][j][2] = 0; + } + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D( GL_TEXTURE_2D, + 0, + 3, + 64, 64, + 0, + GL_RGB, GL_UNSIGNED_BYTE, + texImage ); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glEnable(GL_TEXTURE_2D); + + glBlendFunc(GL_ONE, GL_ONE); +} + + +static void ModeMenu(int entry) +{ + if (entry==99) + exit(0); + Mode = entry; +} + + +int main( int argc, char *argv[] ) +{ + + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 300, 300 ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + + glutCreateWindow( "spectex" ); + + Init(); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutCreateMenu( ModeMenu ); + glutAddMenuEntry("1-pass lighting + texturing", 0); + glutAddMenuEntry("specular lighting", 1); + glutAddMenuEntry("diffuse lighting + texturing", 2); + glutAddMenuEntry("2-pass lighting + texturing", 3); +#ifdef GL_VERSION_1_2 + glutAddMenuEntry("OpenGL 1.2 separate specular", 4); +#endif + glutAddMenuEntry("Quit", 99); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/stex3d.c b/xc/extras/Mesa/demos/stex3d.c new file mode 100644 index 000000000..16bddfd9f --- /dev/null +++ b/xc/extras/Mesa/demos/stex3d.c @@ -0,0 +1,578 @@ +/* $Id: stex3d.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/*----------------------------- + * stex3d.c GL example of the mesa 3d-texture extention to simulate procedural + * texturing, it uses a perlin noise and turbulence functions. + * + * Author: Daniel Barrero + * barrero@irit.fr + * dbarrero@pegasus.uniandes.edu.co + * + * Converted to GLUT by brianp on 1/1/98 + * + * + * cc stex3d.c -o stex3d -lglut -lMesaGLU -lMesaGL -lX11 -lXext -lm + * + *---------------------------- */ + +/* + * $Log: stex3d.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.5 2000/06/27 17:04:43 brianp + * fixed compiler warnings + * + * Revision 1.4 2000/03/22 19:48:57 brianp + * converted from GL_EXT_texture3D to GL 1.2 + * + * Revision 1.3 1999/12/16 08:54:22 brianp + * added a cast to malloc call + * + * Revision 1.2 1999/09/17 12:27:01 brianp + * silenced some warnings + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.1 1998/06/09 01:53:49 brianp + * main() should return an int + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/gl.h> +#include <GL/glut.h> +/* function declarations */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +void init(void), + printHelp(void), + create3Dtexture(void), + setDefaults(void), + drawScene(void), + resize(int w, int h), + buildFigure(void), + initNoise(void); +float turbulence(float point[3], float lofreq, float hifreq); + +void KeyHandler( unsigned char key, int x, int y ); +GLenum parseCmdLine(int argc, char **argv); +float noise3(float vec[3]); + +/* global variables */ +GLenum rgb, doubleBuffer, directRender, windType; /* visualization state*/ +float tex_width,tex_height,tex_depth; /* texture volume dimensions */ +unsigned char *voxels; /* texture data ptr */ +int angx,angy,angz; +GLuint figure; + +/*function definitions */ +int main(int argc, char **argv) +{ + + if (parseCmdLine(argc, argv) == GL_FALSE) { + exit(0); + } + + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 400); + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + windType |= GLUT_DEPTH; + glutInitDisplayMode(windType); + + if (glutCreateWindow("stex3d") <= 0) { + exit(0); + } + /* init all */ + init(); + + glutReshapeFunc(resize); + glutKeyboardFunc(KeyHandler); + glutDisplayFunc(drawScene); + glutMainLoop(); + return 0; +} + +void init() +{ + /* init light */ + GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat mat_shininess[] = { 25.0 }; + GLfloat gray[] = { 0.6, 0.6, 0.6, 0.0 }; + GLfloat white[] = { 1.0, 1.0, 1.0, 0.0 }; + GLfloat light_position[] = { 0.0, 1.0, 1.0, 0.0 }; + + glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); + glLightfv(GL_LIGHT1, GL_POSITION, light_position); + glLightfv(GL_LIGHT1, GL_AMBIENT, gray); + glLightfv(GL_LIGHT1, GL_DIFFUSE, white); + glLightfv(GL_LIGHT1, GL_SPECULAR, white); + glColorMaterial(GL_FRONT, GL_DIFFUSE); + glEnable(GL_COLOR_MATERIAL); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT1); + + /* create torus for texturing */ + figure=glGenLists(1); + buildFigure(); +/* tkSolidTorus(figure,0.3,1.2);*/ + + /* start the noise function variables */ + initNoise(); + + /* see if we have OpenGL 1.2 or later, for 3D texturing */ + { + const char *version = (const char *) glGetString(GL_VERSION); + if (strncmp(version, "1.0", 3) == 0 || + strncmp(version, "1.1", 3) == 0) { + printf("Sorry, OpenGL 1.2 or later is required\n"); + exit(1); + } + } + + /* if texture is supported then generate the texture */ + create3Dtexture(); + + glEnable(GL_TEXTURE_3D); + /* + glBlendFunc(GL_SRC_COLOR, GL_SRC_ALPHA); + glEnable(GL_BLEND); + */ + glEnable(GL_DEPTH_TEST); + + glShadeModel(GL_FLAT); + glColor3f(0.6,0.7,0.8); +} + +void buildFigure(void) +{ GLint i, j; + float theta1, phi1, theta2, phi2, rings, sides; + float v0[03], v1[3], v2[3], v3[3]; + float t0[03], t1[3], t2[3], t3[3]; + float n0[3], n1[3], n2[3], n3[3]; + float innerRadius=0.4; + float outerRadius=0.8; + float scalFac; + + rings = 8; + sides = 10; + scalFac=1/(outerRadius*2); + + glNewList(figure, GL_COMPILE); + for (i = 0; i < rings; i++) { + theta1 = (float)i * 2.0 * M_PI / rings; + theta2 = (float)(i + 1) * 2.0 * M_PI / rings; + for (j = 0; j < sides; j++) { + phi1 = (float)j * 2.0 * M_PI / sides; + phi2 = (float)(j + 1) * 2.0 * M_PI / sides; + + v0[0] = cos(theta1) * (outerRadius + innerRadius * cos(phi1)); + v0[1] = -sin(theta1) * (outerRadius + innerRadius * cos(phi1)); + v0[2] = innerRadius * sin(phi1); + + v1[0] = cos(theta2) * (outerRadius + innerRadius * cos(phi1)); + v1[1] = -sin(theta2) * (outerRadius + innerRadius * cos(phi1)); + v1[2] = innerRadius * sin(phi1); + v2[0] = cos(theta2) * (outerRadius + innerRadius * cos(phi2)); + v2[1] = -sin(theta2) * (outerRadius + innerRadius * cos(phi2)); + v2[2] = innerRadius * sin(phi2); + + v3[0] = cos(theta1) * (outerRadius + innerRadius * cos(phi2)); + v3[1] = -sin(theta1) * (outerRadius + innerRadius * cos(phi2)); + v3[2] = innerRadius * sin(phi2); + + n0[0] = cos(theta1) * (cos(phi1)); + n0[1] = -sin(theta1) * (cos(phi1)); + n0[2] = sin(phi1); + + n1[0] = cos(theta2) * (cos(phi1)); + n1[1] = -sin(theta2) * (cos(phi1)); + n1[2] = sin(phi1); + + n2[0] = cos(theta2) * (cos(phi2)); + n2[1] = -sin(theta2) * (cos(phi2)); + n2[2] = sin(phi2); + + n3[0] = cos(theta1) * (cos(phi2)); + n3[1] = -sin(theta1) * (cos(phi2)); + n3[2] = sin(phi2); + + t0[0] = v0[0]*scalFac + 0.5; + t0[1] = v0[1]*scalFac + 0.5; + t0[2] = v0[2]*scalFac + 0.5; + + t1[0] = v1[0]*scalFac + 0.5; + t1[1] = v1[1]*scalFac + 0.5; + t1[2] = v1[2]*scalFac + 0.5; + + t2[0] = v2[0]*scalFac + 0.5; + t2[1] = v2[1]*scalFac + 0.5; + t2[2] = v2[2]*scalFac + 0.5; + + t3[0] = v3[0]*scalFac + 0.5; + t3[1] = v3[1]*scalFac + 0.5; + t3[2] = v3[2]*scalFac + 0.5; + + glBegin(GL_POLYGON); + glNormal3fv(n3); glTexCoord3fv(t3); glVertex3fv(v3); + glNormal3fv(n2); glTexCoord3fv(t2); glVertex3fv(v2); + glNormal3fv(n1); glTexCoord3fv(t1); glVertex3fv(v1); + glNormal3fv(n0); glTexCoord3fv(t0); glVertex3fv(v0); + glEnd(); + } + } + glEndList(); +} + +void create3Dtexture() +{ + int i,j,k; + unsigned char *vp; + float vec[3]; + int tmp; + + printf("creating 3d textures...\n"); + voxels = (unsigned char *) malloc((size_t)(4*tex_width*tex_height*tex_depth)); + vp=voxels; + for (i=0;i<tex_width;i++){ + vec[0]=i; + for (j=0;j<tex_height;j++) { + vec[1]=j; + for (k=0;k<tex_depth;k++) { + vec[2]=k; + tmp=(sin(k*i*j+turbulence(vec,0.01,1))+1)*127.5; + *vp++=0; + *vp++=0; + *vp++=tmp; + *vp++=tmp+128; + } + } + } + + printf("setting up 3d texture...\n"); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + + glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, + tex_width, tex_height, tex_depth, + 0, GL_RGBA, GL_UNSIGNED_BYTE, voxels); + + printf("finished setting up 3d texture image...\n"); +} + +void printHelp() +{ + printf("\nUsage: stex3d <cmd line options>\n"); + printf(" cmd line options:\n"); + printf(" -help print this help!\n"); + printf(" -rgb RGBA mode. (Default)\n"); + printf(" -ci Color index mode.\n"); + printf(" -sb Single buffer mode. (Default)\n"); + printf(" -db Double buffer mode. \n"); + printf(" -dr Direct render mode.\n"); + printf(" -ir Indirect render mode. (Default)\n"); + printf(" -wxxx Width of the texture (Default=64)\n"); + printf(" -hxxx Height of the texture (Default=64)\n"); + printf(" -dxxx Depth of the texture (Default=64)\n"); + printf(" Keyboard Options:\n"); + printf(" 1 Object Texture coordinates (Default)\n"); + printf(" 2 Eye Texture coordinates \n"); + printf(" x rotate around x clockwise\n"); + printf(" X rotate around x counter clockwise\n"); + printf(" y rotate around y clockwise\n"); + printf(" Y rotate around y counter clockwise\n"); + printf(" z rotate around z clockwise\n"); + printf(" Z rotate around z counter clockwise\n"); + printf(" t enable 3-D texuring (Default)\n"); + printf(" T disable 3-D texuring\n"); + printf(" s smooth shading \n"); + printf(" S flat shading (Default)\n"); +} + +void setDefaults() +{ + /* visualization defaults */ + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + directRender = GL_TRUE; + angx=130; + angy=30; + angz=0; + /* texture values */ + tex_width=64; + tex_height=64; + tex_depth=64; +} + +GLenum parseCmdLine(int argc, char **argv) +{ + GLint i; + + setDefaults(); + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-dr") == 0) { + directRender = GL_TRUE; + } else if (strcmp(argv[i], "-ir") == 0) { + directRender = GL_FALSE; + } else if (strstr(argv[i], "-w") == 0) { + tex_width=atoi((argv[i])+2); + } else if (strstr(argv[i], "-h") == 0) { + tex_height=atoi((argv[i])+2); + } else if (strstr(argv[i], "-d") == 0) { + tex_depth=atoi((argv[i])+2); + } else if (strcmp(argv[i], "-help") == 0) { + printHelp(); + return GL_FALSE; + } else { + printf("%s (Bad option).\n", argv[i]); + printHelp(); + return GL_FALSE; + } + } + if(tex_width==0 || tex_height==0 || tex_depth==0) { + printf("%s (Bad option).\n", "size parameters can't be 0"); + printHelp(); + return GL_FALSE; + } + return GL_TRUE; +} + +void drawScene() +{ + /* clear background, z buffer etc */ + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + glPushMatrix(); + glRotatef(angx,1.0,0.0,0.0); + glRotatef(angy,0.0,1.0,0.0); + glRotatef(angz,0.0,0.0,1.0); + + glCallList(figure); + glPopMatrix(); + glFlush(); + if(doubleBuffer) + glutSwapBuffers(); + ; +} + +void resize(int w, int h) +{ + glViewport(0, 0, (GLint)w, (GLint)h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-2,2,-2,2,-5,10); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0,0,-5); +} + +static void cleanEverything(void) +{ +/* free(voxels); */ +} + + +void KeyHandler( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch(key) { + case 27: + case 'q': + case 'Q': /* quit game. */ + cleanEverything(); + exit(0); + break; + case 'x': + angx+=10; + break; + case 'X': + angx-=10; + break; + case 'y': + angy+=10; + break; + case 'Y': + angy-=10; + break; + case 'z': + angz+=10; + break; + case 'Z': + angz-=10; + break; + case 't': + glEnable(GL_TEXTURE_3D); + break; + case 'T': + glDisable(GL_TEXTURE_3D); + break; + case 's': + glShadeModel(GL_SMOOTH); + break; + case 'S': + glShadeModel(GL_FLAT); + break; + case '1': + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_R); + break; + case '2': + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_R); + break; + default: + break; + } + glutPostRedisplay(); +} + +/*-------------------------------------------------------------------- + noise function over R3 - implemented by a pseudorandom tricubic spline + EXCERPTED FROM SIGGRAPH 92, COURSE 23 + PROCEDURAL MODELING + Ken Perlin + New York University +----------------------------------------------------------------------*/ + + +#define DOT(a,b) (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) +#define B 256 +static int p[B + B + 2]; +static float g[B + B + 2][3]; +#define setup(i,b0,b1,r0,r1) \ + t = vec[i] + 10000.; \ + b0 = ((int)t) & (B-1); \ + b1 = (b0+1) & (B-1); \ + r0 = t - (int)t; \ + r1 = r0 - 1.; + +float noise3(float vec[3]) +{ + int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; + float rx0, rx1, ry0, ry1, rz0, rz1, *q, sx, sy, sz, a, b, c, d, t, u, v; + register int i, j; + + setup(0, bx0,bx1, rx0,rx1); + setup(1, by0,by1, ry0,ry1); + setup(2, bz0,bz1, rz0,rz1); + + i = p[ bx0 ]; + j = p[ bx1 ]; + + b00 = p[ i + by0 ]; + b10 = p[ j + by0 ]; + b01 = p[ i + by1 ]; + b11 = p[ j + by1 ]; + +#define at(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] ) +#define surve(t) ( t * t * (3. - 2. * t) ) +#define lerp(t, a, b) ( a + t * (b - a) ) + + sx = surve(rx0); + sy = surve(ry0); + sz = surve(rz0); + + q = g[ b00 + bz0 ] ; u = at(rx0,ry0,rz0); + q = g[ b10 + bz0 ] ; v = at(rx1,ry0,rz0); + a = lerp(sx, u, v); + + q = g[ b01 + bz0 ] ; u = at(rx0,ry1,rz0); + q = g[ b11 + bz0 ] ; v = at(rx1,ry1,rz0); + b = lerp(sx, u, v); + + c = lerp(sy, a, b); /* interpolate in y at lo x */ + + q = g[ b00 + bz1 ] ; u = at(rx0,ry0,rz1); + q = g[ b10 + bz1 ] ; v = at(rx1,ry0,rz1); + a = lerp(sx, u, v); + + q = g[ b01 + bz1 ] ; u = at(rx0,ry1,rz1); + q = g[ b11 + bz1 ] ; v = at(rx1,ry1,rz1); + b = lerp(sx, u, v); + + d = lerp(sy, a, b); /* interpolate in y at hi x */ + + return 1.5 * lerp(sz, c, d); /* interpolate in z */ +} + +void initNoise() +{ + /*long random();*/ + int i, j, k; + float v[3], s; + +/* Create an array of random gradient vectors uniformly on the unit sphere */ + /*srandom(1);*/ + srand(1); + for (i = 0 ; i < B ; i++) { + do { /* Choose uniformly in a cube */ for (j=0 ; j<3 ; j++) + v[j] = (float)((rand() % (B + B)) - B) / B; + s = DOT(v,v); + } while (s > 1.0); /* If not in sphere try again */ s = sqrt(s); + for (j = 0 ; j < 3 ; j++) /* Else normalize */ + g[i][j] = v[j] / s; + } + +/* Create a pseudorandom permutation of [1..B] */ + for (i = 0 ; i < B ; i++) + p[i] = i; + for (i = B ; i > 0 ; i -= 2) { + k = p[i]; + p[i] = p[j = rand() % B]; + p[j] = k; + } + +/* Extend g and p arrays to allow for faster indexing */ + for (i = 0 ; i < B + 2 ; i++) { + p[B + i] = p[i]; + for (j = 0 ; j < 3 ; j++) + g[B + i][j] = g[i][j]; + } +} + +float turbulence(float point[3], float lofreq, float hifreq) +{ + float freq, t, p[3]; + + p[0] = point[0] + 123.456; + p[1] = point[1]; + p[2] = point[2]; + + t = 0; + for (freq = lofreq ; freq < hifreq ; freq *= 2.) { + t += fabs(noise3(p)) / freq; + p[0] *= 2.; + p[1] *= 2.; + p[2] *= 2.; + } + return t - 0.3; /* readjust to make mean value = 0.0 */ +} + diff --git a/xc/extras/Mesa/demos/teapot.c b/xc/extras/Mesa/demos/teapot.c new file mode 100644 index 000000000..c36865f4b --- /dev/null +++ b/xc/extras/Mesa/demos/teapot.c @@ -0,0 +1,573 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#ifdef WIN32 +#include <windows.h> +#endif + +#include <GL/glut.h> +#include "../util/readtex.c" +#include "shadow.c" + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen=1; +#endif + +static int WIDTH=640; +static int HEIGHT=480; + +#define FRAME 50 + +#define BASESIZE 10.0 + +#define BASERES 12 +#define TEAPOTRES 3 + +#ifndef M_PI +#define M_PI 3.1415926535 +#endif + +extern void shadowmatrix(GLfloat [4][4], GLfloat [4], GLfloat [4]); +extern void findplane(GLfloat [4], GLfloat [3], GLfloat [3], GLfloat [3]); + + +static int win=0; + +static float obs[3]={5.0,0.0,1.0}; +static float dir[3]; +static float v=0.0; +static float alpha=-90.0; +static float beta=90.0; + +static GLfloat baseshadow[4][4]; +static GLfloat lightpos[4]={2.3,0.0,3.0,1.0}; +static GLfloat lightdir[3]={-2.3,0.0,-3.0}; +static GLfloat lightalpha=0.0; + +static int fog=1; +static int bfcull=1; +static int usetex=1; +static int help=1; +static int joyavailable=0; +static int joyactive=0; + +static GLuint t1id,t2id; +static GLuint teapotdlist,basedlist,lightdlist; + +static float gettime(void) +{ + static clock_t told=0; + clock_t tnew,ris; + + tnew=clock(); + + ris=tnew-told; + + told=tnew; + + return(ris/(float)CLOCKS_PER_SEC); +} + +static void calcposobs(void) +{ + dir[0]=sin(alpha*M_PI/180.0); + dir[1]=cos(alpha*M_PI/180.0)*sin(beta*M_PI/180.0); + dir[2]=cos(beta*M_PI/180.0); + + obs[0]+=v*dir[0]; + obs[1]+=v*dir[1]; + obs[2]+=v*dir[2]; +} + +static void special(int k, int x, int y) +{ + switch(k) { + case GLUT_KEY_LEFT: + alpha-=2.0; + break; + case GLUT_KEY_RIGHT: + alpha+=2.0; + break; + case GLUT_KEY_DOWN: + beta-=2.0; + break; + case GLUT_KEY_UP: + beta+=2.0; + break; + } +} + +static void key(unsigned char k, int x, int y) +{ + switch(k) { + case 27: + exit(0); + break; + + case 'a': + v+=0.005; + break; + case 'z': + v-=0.005; + break; + + case 'j': + joyactive=(!joyactive); + break; + case 'h': + help=(!help); + break; + case 'f': + fog=(!fog); + break; + case 't': + usetex=(!usetex); + break; + case 'b': + if(bfcull) { + glDisable(GL_CULL_FACE); + bfcull=0; + } else { + glEnable(GL_CULL_FACE); + bfcull=1; + } + break; +#ifdef XMESA + case ' ': + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + fullscreen=(!fullscreen); + break; +#endif + } +} + +static void reshape(int w, int h) +{ + WIDTH=w; + HEIGHT=h; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45.0,w/(float)h,0.2,40.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0,0,w,h); +} + +static void printstring(void *font, char *string) +{ + int len,i; + + len=(int)strlen(string); + for(i=0;i<len;i++) + glutBitmapCharacter(font,string[i]); +} + +static void printhelp(void) +{ + glEnable(GL_BLEND); + glColor4f(0.5,0.5,0.5,0.5); + glRecti(40,40,600,440); + glDisable(GL_BLEND); + + glColor3f(1.0,0.0,0.0); + glRasterPos2i(300,420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help"); + + glRasterPos2i(60,390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help"); + glRasterPos2i(60,360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Togle Textures"); + glRasterPos2i(60,330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog"); + glRasterPos2i(60,300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Togle Back face culling"); + glRasterPos2i(60,270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate"); + glRasterPos2i(60,240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity"); + glRasterPos2i(60,210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity"); + + glRasterPos2i(60,180); + if(joyavailable) + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Togle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_TIMES_ROMAN_24,"(No Joystick control available)"); +} + +static void drawbase(void) +{ + int i,j; + float x,y,dx,dy; + + glBindTexture(GL_TEXTURE_2D,t1id); + + dx=BASESIZE/BASERES; + dy=-BASESIZE/BASERES; + for(y=BASESIZE/2.0,j=0;j<BASERES;y+=dy,j++) { + glBegin(GL_QUAD_STRIP); + glColor3f(1.0,1.0,1.0); + glNormal3f(0.0,0.0,1.0); + for(x=-BASESIZE/2.0,i=0;i<BASERES;x+=dx,i++) { + glTexCoord2f(x,y); + glVertex3f(x,y,0.0); + + glTexCoord2f(x,y+dy); + glVertex3f(x,y+dy,0.0); + } + glEnd(); + } +} + +static void drawteapot(void) +{ + static float xrot=0.0; + static float zrot=0.0; + + glPushMatrix(); + glRotatef(lightalpha,0.0,0.0,1.0); + glMultMatrixf((GLfloat *)baseshadow); + glRotatef(-lightalpha,0.0,0.0,1.0); + + glTranslatef(0.0,0.0,1.0); + glRotatef(xrot,1.0,0.0,0.0); + glRotatef(zrot,0.0,0.0,1.0); + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + + glColor3f(0.0,0.0,0.0); + glCallList(teapotdlist); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_LIGHTING); + if(usetex) + glEnable(GL_TEXTURE_2D); + + glPopMatrix(); + + glPushMatrix(); + glTranslatef(0.0,0.0,1.0); + glRotatef(xrot,1.0,0.0,0.0); + glRotatef(zrot,0.0,0.0,1.0); + + glCallList(teapotdlist); + glPopMatrix(); + + xrot+=2.0; + zrot+=1.0; +} + +static void drawlight1(void) +{ + glPushMatrix(); + glRotatef(lightalpha,0.0,0.0,1.0); + glLightfv(GL_LIGHT0,GL_POSITION,lightpos); + glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,lightdir); + + glPopMatrix(); +} + +static void drawlight2(void) +{ + glPushMatrix(); + glRotatef(lightalpha,0.0,0.0,1.0); + glTranslatef(lightpos[0],lightpos[1],lightpos[2]); + + glDisable(GL_TEXTURE_2D); + glCallList(lightdlist); + if(usetex) + glEnable(GL_TEXTURE_2D); + + glPopMatrix(); + + lightalpha+=1.0; +} + +static void dojoy(void) +{ +#ifdef WIN32 + static UINT max[2]={0,0}; + static UINT min[2]={0xffffffff,0xffffffff},center[2]; + MMRESULT res; + JOYINFO joy; + + res=joyGetPos(JOYSTICKID1,&joy); + + if(res==JOYERR_NOERROR) { + joyavailable=1; + + if(max[0]<joy.wXpos) + max[0]=joy.wXpos; + if(min[0]>joy.wXpos) + min[0]=joy.wXpos; + center[0]=(max[0]+min[0])/2; + + if(max[1]<joy.wYpos) + max[1]=joy.wYpos; + if(min[1]>joy.wYpos) + min[1]=joy.wYpos; + center[1]=(max[1]+min[1])/2; + + if(joyactive) { + if(fabs(center[0]-(float)joy.wXpos)>0.1*(max[0]-min[0])) + alpha-=2.5*(center[0]-(float)joy.wXpos)/(max[0]-min[0]); + if(fabs(center[1]-(float)joy.wYpos)>0.1*(max[1]-min[1])) + beta+=2.5*(center[1]-(float)joy.wYpos)/(max[1]-min[1]); + + if(joy.wButtons & JOY_BUTTON1) + v+=0.005; + if(joy.wButtons & JOY_BUTTON2) + v-=0.005; + } + } else + joyavailable=0; +#endif +} + +static void draw(void) +{ + static int count=0; + static char frbuf[80]; + float fr; + + dojoy(); + + glEnable(GL_DEPTH_TEST); + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + if(usetex) + glEnable(GL_TEXTURE_2D); + else + glDisable(GL_TEXTURE_2D); + + if(fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glEnable(GL_LIGHTING); + + glShadeModel(GL_SMOOTH); + + glPushMatrix(); + calcposobs(); + + gluLookAt(obs[0],obs[1],obs[2], + obs[0]+dir[0],obs[1]+dir[1],obs[2]+dir[2], + 0.0,0.0,1.0); + + drawlight1(); + glCallList(basedlist); + drawteapot(); + drawlight2(); + glPopMatrix(); + + if((count % FRAME)==0) { + fr=gettime(); + sprintf(frbuf,"Frame rate: %f",FRAME/fr); + } + + glDisable(GL_LIGHTING); + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_FOG); + glShadeModel(GL_FLAT); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5,639.5,-0.5,479.5,-1.0,1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0,0.0,0.0); + glRasterPos2i(10,10); + printstring(GLUT_BITMAP_HELVETICA_18,frbuf); + glRasterPos2i(350,470); + printstring(GLUT_BITMAP_HELVETICA_10,"Teapot V1.2 Written by David Bucciarelli (tech.hmw@plus.it)"); + + if(help) + printhelp(); + + reshape(WIDTH,HEIGHT); + + glutSwapBuffers(); + + count++; +} + +static void inittextures(void) +{ + glGenTextures(1,&t1id); + glBindTexture(GL_TEXTURE_2D,t1id); + + glPixelStorei(GL_UNPACK_ALIGNMENT,4); + if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) { + fprintf(stderr,"Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); + + glGenTextures(1,&t2id); + glBindTexture(GL_TEXTURE_2D,t2id); + + if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) { + fprintf(stderr,"Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); +} + +static void initlight(void) +{ + float lamb[4]={0.2,0.2,0.2,1.0}; + float lspec[4]={1.0,1.0,1.0,1.0}; + + glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,70.0); + glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,20.0); + glLightfv(GL_LIGHT0,GL_AMBIENT,lamb); + glLightfv(GL_LIGHT0,GL_SPECULAR,lspec); + + glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,20.0); + glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,lspec); + + glEnable(GL_LIGHT0); +} + +static void initdlists(void) +{ + GLUquadricObj *lcone,*lbase; + GLfloat plane[4]; + GLfloat v0[3]={0.0,0.0,0.0}; + GLfloat v1[3]={1.0,0.0,0.0}; + GLfloat v2[3]={0.0,1.0,0.0}; + + findplane(plane,v0,v1,v2); + shadowmatrix(baseshadow,plane,lightpos); + + teapotdlist=glGenLists(1); + glNewList(teapotdlist,GL_COMPILE); + glRotatef(90.0,1.0,0.0,0.0); + glCullFace(GL_FRONT); + glBindTexture(GL_TEXTURE_2D,t2id); + glutSolidTeapot(0.75); + glCullFace(GL_BACK); + glEndList(); + + basedlist=glGenLists(1); + glNewList(basedlist,GL_COMPILE); + drawbase(); + glEndList(); + + lightdlist=glGenLists(1); + glNewList(lightdlist,GL_COMPILE); + glDisable(GL_LIGHTING); + + lcone=gluNewQuadric(); + lbase=gluNewQuadric(); + glRotatef(45.0,0.0,1.0,0.0); + + glColor3f(1.0,1.0,1.0); + glCullFace(GL_FRONT); + gluDisk(lbase,0.0,0.2,12.0,1.0); + glCullFace(GL_BACK); + + glColor3f(0.5,0.0,0.0); + gluCylinder(lcone,0.2,0.0,0.5,12,1); + + gluDeleteQuadric(lcone); + gluDeleteQuadric(lbase); + + glEnable(GL_LIGHTING); + glEndList(); +} + +int main(int ac, char **av) +{ + float fogcolor[4]={0.025,0.025,0.025,1.0}; + + fprintf(stderr,"Teapot V1.2\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); + + /* + if(!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS)) { + fprintf(stderr,"Error setting the process class.\n"); + return 0; + } + + if(!SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)) { + fprintf(stderr,"Error setting the process priority.\n"); + return 0; + } + */ + + glutInitWindowPosition(0,0); + glutInitWindowSize(WIDTH,HEIGHT); + glutInit(&ac,av); + + glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE); + + if(!(win=glutCreateWindow("Teapot"))) { + fprintf(stderr,"Error, couldn't open window\n"); + return -1; + } + + reshape(WIDTH,HEIGHT); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE,GL_EXP2); + glFogfv(GL_FOG_COLOR,fogcolor); + + glFogf(GL_FOG_DENSITY,0.04); + glHint(GL_FOG_HINT,GL_NICEST); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + + calcposobs(); + + inittextures(); + initlight(); + + initdlists(); + + glClearColor(fogcolor[0],fogcolor[1],fogcolor[2],fogcolor[3]); + + glutReshapeFunc(reshape); + glutDisplayFunc(draw); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutIdleFunc(draw); + + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/terrain.c b/xc/extras/Mesa/demos/terrain.c new file mode 100644 index 000000000..fbc880390 --- /dev/null +++ b/xc/extras/Mesa/demos/terrain.c @@ -0,0 +1,653 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + * + * based on a Mikael SkiZoWalker's (MoDEL) / France (Skizo@Hol.Fr) demo + */ + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> +#include <time.h> + +#ifdef WIN32 +#include <windows.h> +#endif + +#include <GL/glut.h> + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen = 1; +#endif + +#ifndef M_PI +#define M_PI 3.14159265 +#endif + +#define heightMnt 450 +#define lenghtXmnt 62 +#define lenghtYmnt 62 + +#define stepXmnt 96.0 +#define stepYmnt 96.0 + +#define WIDTH 640 +#define HEIGHT 480 + +#define TSCALE 4 + +#define FRAME 50 + +#define FOV 85 + +static GLfloat terrain[256 * 256]; +static GLfloat terraincolor[256 * 256][3]; + +static int win = 0; + +static int fog = 1; +static int bfcull = 1; +static int usetex = 1; +static int poutline = 0; +static int help = 1; +static int joyavailable = 0; +static int joyactive = 0; +static float ModZMnt; +static long GlobalMnt = 0; + +static int scrwidth = WIDTH; +static int scrheight = HEIGHT; + +#define OBSSTARTX 992.0 +#define OBSSTARTY 103.0 + +static float obs[3] = { OBSSTARTX, heightMnt * 1.3, OBSSTARTY }; +static float dir[3], v1[2], v2[2]; +static float v = 15.0; +static float alpha = 75.0; +static float beta = 90.0; + +static float +gettime(void) +{ + static clock_t told = 0; + clock_t tnew, ris; + + tnew = clock(); + + ris = tnew - told; + + told = tnew; + + return (ris / (float) CLOCKS_PER_SEC); +} + +static void +calcposobs(void) +{ + float alpha1, alpha2; + + dir[0] = sin(alpha * M_PI / 180.0); + dir[2] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); + dir[1] = cos(beta * M_PI / 180.0); + + alpha1 = alpha + FOV / 2.0; + v1[0] = sin(alpha1 * M_PI / 180.0); + v1[1] = cos(alpha1 * M_PI / 180.0); + + alpha2 = alpha - FOV / 2.0; + v2[0] = sin(alpha2 * M_PI / 180.0); + v2[1] = cos(alpha2 * M_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; + + if (obs[1] < 0.0) + obs[1] = 0.0; +} + +static void +reshape(int width, int height) +{ + scrwidth = width; + scrheight = height; + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(50.0, ((GLfloat) width / (GLfloat) height), + lenghtXmnt * stepYmnt * 0.01, lenghtXmnt * stepYmnt * 0.7); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static int +clipstrip(float y, float *start, float *end) +{ + float x1, x2, t1, t2, tmp; + + if (v1[1] == 0.0) { + t1 = 0.0; + x1 = -HUGE_VAL; + } + else { + t1 = y / v1[1]; + x1 = t1 * v1[0]; + } + + if (v2[1] == 0.0) { + t2 = 0.0; + x2 = HUGE_VAL; + } + else { + t2 = y / v2[1]; + x2 = t2 * v2[0]; + } + + if (((x1 < -(lenghtXmnt * stepXmnt) / 2) && (t2 <= 0.0)) || + ((t1 <= 0.0) && (x2 > (lenghtXmnt * stepXmnt) / 2)) || + ((t1 < 0.0) && (t2 < 0.0))) + return 0; + + if ((t1 == 0.0) && (t2 == 0.0)) { + if ((v1[0] < 0.0) && (v1[1] > 0.0) && (v2[0] < 0.0) && (v2[1] < 0.0)) { + *start = -(lenghtXmnt * stepXmnt) / 2; + *end = stepXmnt; + return 1; + } + else { + if ((v1[0] > 0.0) && (v1[1] < 0.0) && (v2[0] > 0.0) && (v2[1] > 0.0)) { + *start = -stepXmnt; + *end = (lenghtXmnt * stepXmnt) / 2; + return 1; + } + else + return 0; + } + } + else { + if (t2 < 0.0) { + if (x1 < 0.0) + x2 = -(lenghtXmnt * stepXmnt) / 2; + else + x2 = (lenghtXmnt * stepXmnt) / 2; + } + + if (t1 < 0.0) { + if (x2 < 0.0) + x1 = -(lenghtXmnt * stepXmnt) / 2; + else + x1 = (lenghtXmnt * stepXmnt) / 2; + } + } + + if (x1 > x2) { + tmp = x1; + x1 = x2; + x2 = tmp; + } + + x1 -= stepXmnt; + if (x1 < -(lenghtXmnt * stepXmnt) / 2) + x1 = -(lenghtXmnt * stepXmnt) / 2; + + x2 += stepXmnt; + if (x2 > (lenghtXmnt * stepXmnt) / 2) + x2 = (lenghtXmnt * stepXmnt) / 2; + + *start = ((int) (x1 / stepXmnt)) * stepXmnt; + *end = ((int) (x2 / stepXmnt)) * stepXmnt; + + return 1; +} + +static void +printstring(void *font, char *string) +{ + int len, i; + + len = (int) strlen(string); + for (i = 0; i < len; i++) + glutBitmapCharacter(font, string[i]); +} + +static void +printhelp(void) +{ + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.0, 0.0, 0.0, 0.5); + glRecti(40, 40, 600, 440); + glDisable(GL_BLEND); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(300, 420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); + + glRasterPos2i(60, 390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); + glRasterPos2i(60, 360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); + glRasterPos2i(60, 330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); + glRasterPos2i(60, 300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Wire frame"); + glRasterPos2i(60, 270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); + glRasterPos2i(60, 240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); + glRasterPos2i(60, 210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); + glRasterPos2i(60, 180); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); + + glRasterPos2i(60, 150); + if (joyavailable) + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "j - Togle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "(No Joystick control available)"); +} + +static void +drawterrain(void) +{ + int h, i, idx, ox, oy; + float j, k, start, end; + + ox = (int) (obs[0] / stepXmnt); + oy = (int) (obs[2] / stepYmnt); + GlobalMnt = ((ox * TSCALE) & 255) + ((oy * TSCALE) & 255) * 256; + + glPushMatrix(); + glTranslatef((float) ox * stepXmnt, 0, (float) oy * stepYmnt); + + for (h = 0, k = -(lenghtYmnt * stepYmnt) / 2; h < lenghtYmnt; + k += stepYmnt, h++) { + if (!clipstrip(k, &start, &end)) + continue; + + glBegin(GL_TRIANGLE_STRIP); /* I hope that the optimizer will be able to improve this code */ + for (i = (int) (lenghtXmnt / 2 + start / stepXmnt), j = start; j <= end; + j += stepXmnt, i++) { + idx = (i * TSCALE + h * 256 * TSCALE + GlobalMnt) & 65535; + glColor3fv(terraincolor[idx]); + glTexCoord2f((ox + i) / 8.0, (oy + h) / 8.0); + glVertex3f(j, terrain[idx], k); + + idx = + (i * TSCALE + h * 256 * TSCALE + 256 * TSCALE + + GlobalMnt) & 65535; + glColor3fv(terraincolor[idx]); + glTexCoord2f((ox + i) / 8.0, (oy + h + 1) / 8.0); + glVertex3f(j, terrain[idx], k + stepYmnt); + } + glEnd(); + } + + glDisable(GL_CULL_FACE); + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glColor4f(0.1, 0.7, 1.0, 0.4); + glVertex3f(-(lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6, + -(lenghtYmnt * stepYmnt) / 2.0); + glVertex3f(-(lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6, + (lenghtYmnt * stepYmnt) / 2.0); + glVertex3f((lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6, + (lenghtYmnt * stepYmnt) / 2.0); + glVertex3f((lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6, + -(lenghtYmnt * stepYmnt) / 2.0); + glEnd(); + glDisable(GL_BLEND); + if (bfcull) + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + + glPopMatrix(); + +} + +static void +dojoy(void) +{ +#ifdef WIN32 + static UINT max[2] = { 0, 0 }; + static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2]; + MMRESULT res; + JOYINFO joy; + + res = joyGetPos(JOYSTICKID1, &joy); + + if (res == JOYERR_NOERROR) { + joyavailable = 1; + + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2; + + if (joyactive) { + if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0])) + alpha += + 2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]); + if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1])) + beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]); + + if (joy.wButtons & JOY_BUTTON1) + v += 0.5; + if (joy.wButtons & JOY_BUTTON2) + v -= 0.5; + } + } + else + joyavailable = 0; +#endif +} + +static void +drawscene(void) +{ + static int count = 0; + static char frbuf[80]; + float fr; + + dojoy(); + + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + + if (usetex) + glEnable(GL_TEXTURE_2D); + else + glDisable(GL_TEXTURE_2D); + + if (fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + + calcposobs(); + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 1.0, 0.0); + + drawterrain(); + glPopMatrix(); + + if ((count % FRAME) == 0) { + fr = gettime(); + sprintf(frbuf, "Frame rate: %.3f", FRAME / fr); + } + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_FOG); + glShadeModel(GL_FLAT); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(10, 10); + printstring(GLUT_BITMAP_HELVETICA_18, frbuf); + glRasterPos2i(350, 470); + printstring(GLUT_BITMAP_HELVETICA_10, + "Terrain V1.2 Written by David Bucciarelli (tech.hmw@plus.it)"); + glRasterPos2i(434, 457); + printstring(GLUT_BITMAP_HELVETICA_10, + "Based on a Mickael's demo (Skizo@Hol.Fr)"); + + if (help) + printhelp(); + + reshape(scrwidth, scrheight); + + glutSwapBuffers(); + + count++; +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: + exit(0); + break; + case 'a': + v += 0.5; + break; + case 'z': + v -= 0.5; + break; + case 'p': + if (poutline) { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + poutline = 0; + } + else { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + poutline = 1; + } + break; + case 'j': + joyactive = (!joyactive); + break; + case 'h': + help = (!help); + break; + case 'f': + fog = (!fog); + break; + case 't': + usetex = (!usetex); + break; + case 'b': + if (bfcull) { + glDisable(GL_CULL_FACE); + bfcull = 0; + } + else { + glEnable(GL_CULL_FACE); + bfcull = 1; + } + break; +#ifdef XMESA + case ' ': + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + fullscreen = (!fullscreen); + break; +#endif + } +} + +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_LEFT: + alpha += 2.0; + break; + case GLUT_KEY_RIGHT: + alpha -= 2.0; + break; + case GLUT_KEY_DOWN: + beta -= 2.0; + break; + case GLUT_KEY_UP: + beta += 2.0; + break; + } +} + +static void +calccolor(GLfloat height, GLfloat c[3]) +{ + GLfloat color[4][3] = { + {1.0, 1.0, 1.0}, + {0.0, 0.8, 0.0}, + {1.0, 1.0, 0.3}, + {0.0, 0.0, 0.8} + }; + GLfloat fact; + + height = height * (1.0 / 255.0); + + if (height >= 0.9) { + c[0] = color[0][0]; + c[1] = color[0][1]; + c[2] = color[0][2]; + return; + } + + if ((height < 0.9) && (height >= 0.7)) { + fact = (height - 0.7) * 5.0; + c[0] = fact * color[0][0] + (1.0 - fact) * color[1][0]; + c[1] = fact * color[0][1] + (1.0 - fact) * color[1][1]; + c[2] = fact * color[0][2] + (1.0 - fact) * color[1][2]; + return; + } + + if ((height < 0.7) && (height >= 0.6)) { + fact = (height - 0.6) * 10.0; + c[0] = fact * color[1][0] + (1.0 - fact) * color[2][0]; + c[1] = fact * color[1][1] + (1.0 - fact) * color[2][1]; + c[2] = fact * color[1][2] + (1.0 - fact) * color[2][2]; + return; + } + + if ((height < 0.6) && (height >= 0.5)) { + fact = (height - 0.5) * 10.0; + c[0] = fact * color[2][0] + (1.0 - fact) * color[3][0]; + c[1] = fact * color[2][1] + (1.0 - fact) * color[3][1]; + c[2] = fact * color[2][2] + (1.0 - fact) * color[3][2]; + return; + } + + c[0] = color[3][0]; + c[1] = color[3][1]; + c[2] = color[3][2]; +} + +static void +loadpic(void) +{ + GLubyte bufferter[256 * 256], terrainpic[256 * 256]; + FILE *FilePic; + int i, tmp; + GLenum gluerr; + + if ((FilePic = fopen("terrain.dat", "r")) == NULL) { + fprintf(stderr, "Error loading Mnt.bin\n"); + exit(-1); + } + fread(bufferter, 256 * 256, 1, FilePic); + fclose(FilePic); + + for (i = 0; i < (256 * 256); i++) { + terrain[i] = (bufferter[i] * (heightMnt / 255.0f)); + calccolor((GLfloat) bufferter[i], terraincolor[i]); + tmp = (((int) bufferter[i]) + 96); + terrainpic[i] = (tmp > 255) ? 255 : tmp; + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 1, 256, 256, GL_LUMINANCE, + GL_UNSIGNED_BYTE, + (GLvoid *) (&terrainpic[0])))) { + fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr)); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glEnable(GL_TEXTURE_2D); +} + +static void +init(void) +{ + float fogcolor[4] = { 0.6, 0.7, 0.7, 1.0 }; + + glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]); + glClearDepth(1.0); + glDepthFunc(GL_LEQUAL); + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + glDisable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP2); + glFogfv(GL_FOG_COLOR, fogcolor); + glFogf(GL_FOG_DENSITY, 0.0007); +#ifdef FX + glHint(GL_FOG_HINT, GL_NICEST); +#endif + + reshape(scrwidth, scrheight); +} + + +int +main(int ac, char **av) +{ + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit(&ac, av); + + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + + if (!(win = glutCreateWindow("Terrain"))) { + fprintf(stderr, "Error, couldn't open window\n"); + return -1; + } + + ModZMnt = 0.0f; + loadpic(); + + init(); + +#ifndef FX + glDisable(GL_TEXTURE_2D); + usetex = 0; +#endif + + glutReshapeFunc(reshape); + glutDisplayFunc(drawscene); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutIdleFunc(drawscene); + + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/tessdemo.c b/xc/extras/Mesa/demos/tessdemo.c new file mode 100644 index 000000000..d11616e01 --- /dev/null +++ b/xc/extras/Mesa/demos/tessdemo.c @@ -0,0 +1,422 @@ +/* $Id: tessdemo.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * A demo of the GLU polygon tesselation functions written by Bogdan Sikorski. + */ + + +#include <GL/glut.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define MAX_POINTS 200 +#define MAX_CONTOURS 50 + +static int menu; +typedef enum +{ QUIT, TESSELATE, CLEAR } +menu_entries; + +typedef enum +{ DEFINE, TESSELATED } +mode_type; + +struct +{ + GLint p[MAX_POINTS][2]; + GLuint point_cnt; +} +contours[MAX_CONTOURS]; + +static GLuint contour_cnt; +static GLsizei width, height; +static mode_type mode; + +struct +{ + GLsizei no; + GLfloat color[3]; + GLint p[3][2]; + GLclampf p_color[3][3]; +} +triangle; + + +static void GLCALLBACK +my_error(GLenum err) +{ + int len, i; + char const *str; + + glColor3f(0.9, 0.9, 0.9); + glRasterPos2i(5, 5); + str = (const char *) gluErrorString(err); + len = strlen(str); + for (i = 0; i < len; i++) + glutBitmapCharacter(GLUT_BITMAP_9_BY_15, str[i]); +} + + +static void GLCALLBACK +begin_callback(GLenum mode) +{ + triangle.no = 0; +} + + +static void GLCALLBACK +edge_callback(GLenum flag) +{ + if (flag == GL_TRUE) { + triangle.color[0] = 1.0; + triangle.color[1] = 1.0; + triangle.color[2] = 0.5; + } + else { + triangle.color[0] = 1.0; + triangle.color[1] = 0.0; + triangle.color[2] = 0.0; + } +} + + +static void GLCALLBACK +end_callback() +{ + glBegin(GL_LINES); + glColor3f(triangle.p_color[0][0], triangle.p_color[0][1], + triangle.p_color[0][2]); + glVertex2i(triangle.p[0][0], triangle.p[0][1]); + glVertex2i(triangle.p[1][0], triangle.p[1][1]); + glColor3f(triangle.p_color[1][0], triangle.p_color[1][1], + triangle.p_color[1][2]); + glVertex2i(triangle.p[1][0], triangle.p[1][1]); + glVertex2i(triangle.p[2][0], triangle.p[2][1]); + glColor3f(triangle.p_color[2][0], triangle.p_color[2][1], + triangle.p_color[2][2]); + glVertex2i(triangle.p[2][0], triangle.p[2][1]); + glVertex2i(triangle.p[0][0], triangle.p[0][1]); + glEnd(); +} + + +static void GLCALLBACK +vertex_callback(void *data) +{ + GLsizei no; + GLint *p; + + p = (GLint *) data; + no = triangle.no; + triangle.p[no][0] = p[0]; + triangle.p[no][1] = p[1]; + triangle.p_color[no][0] = triangle.color[0]; + triangle.p_color[no][1] = triangle.color[1]; + triangle.p_color[no][2] = triangle.color[2]; + ++(triangle.no); +} + + +static void +set_screen_wh(GLsizei w, GLsizei h) +{ + width = w; + height = h; +} + + +static void +tesse(void) +{ + GLUtriangulatorObj *tobj; + GLdouble data[3]; + GLuint i, j, point_cnt; + + tobj = gluNewTess(); + if (tobj != NULL) { + glClear(GL_COLOR_BUFFER_BIT); + glColor3f(0.7, 0.7, 0.0); + gluTessCallback(tobj, GLU_BEGIN, glBegin); + gluTessCallback(tobj, GLU_END, glEnd); + gluTessCallback(tobj, GLU_ERROR, my_error); + gluTessCallback(tobj, GLU_VERTEX, glVertex2iv); + gluBeginPolygon(tobj); + for (j = 0; j <= contour_cnt; j++) { + point_cnt = contours[j].point_cnt; + gluNextContour(tobj, GLU_UNKNOWN); + for (i = 0; i < point_cnt; i++) { + data[0] = (GLdouble) (contours[j].p[i][0]); + data[1] = (GLdouble) (contours[j].p[i][1]); + data[2] = 0.0; + gluTessVertex(tobj, data, contours[j].p[i]); + } + } + gluEndPolygon(tobj); + glLineWidth(2.0); + gluTessCallback(tobj, GLU_BEGIN, begin_callback); + gluTessCallback(tobj, GLU_END, end_callback); + gluTessCallback(tobj, GLU_VERTEX, vertex_callback); + gluTessCallback(tobj, GLU_EDGE_FLAG, edge_callback); + gluBeginPolygon(tobj); + for (j = 0; j <= contour_cnt; j++) { + point_cnt = contours[j].point_cnt; + gluNextContour(tobj, GLU_UNKNOWN); + for (i = 0; i < point_cnt; i++) { + data[0] = (GLdouble) (contours[j].p[i][0]); + data[1] = (GLdouble) (contours[j].p[i][1]); + data[2] = 0.0; + gluTessVertex(tobj, data, contours[j].p[i]); + } + } + gluEndPolygon(tobj); + gluDeleteTess(tobj); + glutMouseFunc(NULL); + glColor3f(1.0, 1.0, 0.0); + glLineWidth(1.0); + mode = TESSELATED; + } +} + + +static void +left_down(int x1, int y1) +{ + GLint P[2]; + GLuint point_cnt; + + /* translate GLUT into GL coordinates */ + P[0] = x1; + P[1] = height - y1; + point_cnt = contours[contour_cnt].point_cnt; + contours[contour_cnt].p[point_cnt][0] = P[0]; + contours[contour_cnt].p[point_cnt][1] = P[1]; + glBegin(GL_LINES); + if (point_cnt) { + glVertex2iv(contours[contour_cnt].p[point_cnt - 1]); + glVertex2iv(P); + } + else { + glVertex2iv(P); + glVertex2iv(P); + } + glEnd(); + glFinish(); + ++(contours[contour_cnt].point_cnt); +} + + +static void +middle_down(int x1, int y1) +{ + GLuint point_cnt; + + point_cnt = contours[contour_cnt].point_cnt; + if (point_cnt > 2) { + glBegin(GL_LINES); + glVertex2iv(contours[contour_cnt].p[0]); + glVertex2iv(contours[contour_cnt].p[point_cnt - 1]); + contours[contour_cnt].p[point_cnt][0] = -1; + glEnd(); + glFinish(); + contour_cnt++; + contours[contour_cnt].point_cnt = 0; + } +} + + +static void +mouse_clicked(int button, int state, int x, int y) +{ + x -= x % 10; + y -= y % 10; + switch (button) { + case GLUT_LEFT_BUTTON: + if (state == GLUT_DOWN) + left_down(x, y); + break; + case GLUT_MIDDLE_BUTTON: + if (state == GLUT_DOWN) + middle_down(x, y); + break; + } +} + + +static void +display(void) +{ + GLuint i, j; + GLuint point_cnt; + + glClear(GL_COLOR_BUFFER_BIT); + switch (mode) { + case DEFINE: + /* draw grid */ + glColor3f(0.6, 0.5, 0.5); + glBegin(GL_LINES); + for (i = 0; i < width; i += 10) + for (j = 0; j < height; j += 10) { + glVertex2i(0, j); + glVertex2i(width, j); + glVertex2i(i, height); + glVertex2i(i, 0); + } + glEnd(); + glColor3f(1.0, 1.0, 0.0); + for (i = 0; i <= contour_cnt; i++) { + point_cnt = contours[i].point_cnt; + glBegin(GL_LINES); + switch (point_cnt) { + case 0: + break; + case 1: + glVertex2iv(contours[i].p[0]); + glVertex2iv(contours[i].p[0]); + break; + case 2: + glVertex2iv(contours[i].p[0]); + glVertex2iv(contours[i].p[1]); + break; + default: + --point_cnt; + for (j = 0; j < point_cnt; j++) { + glVertex2iv(contours[i].p[j]); + glVertex2iv(contours[i].p[j + 1]); + } + if (contours[i].p[j + 1][0] == -1) { + glVertex2iv(contours[i].p[0]); + glVertex2iv(contours[i].p[j]); + } + break; + } + glEnd(); + } + glFinish(); + break; + case TESSELATED: + /* draw lines */ + tesse(); + break; + } + + glColor3f(1.0, 1.0, 0.0); +} + + +static void +clear(void) +{ + contour_cnt = 0; + contours[0].point_cnt = 0; + glutMouseFunc(mouse_clicked); + mode = DEFINE; + display(); +} + + +static void +quit(void) +{ + exit(0); +} + + +static void +menu_selected(int entry) +{ + switch (entry) { + case CLEAR: + clear(); + break; + case TESSELATE: + tesse(); + break; + case QUIT: + quit(); + break; + } +} + + +static void +key_pressed(unsigned char key, int x, int y) +{ + switch (key) { + case 't': + case 'T': + tesse(); + glFinish(); + break; + case 'q': + case 'Q': + quit(); + break; + case 'c': + case 'C': + clear(); + break; + } +} + + +static void +myinit(void) +{ +/* clear background to gray */ + glClearColor(0.4, 0.4, 0.4, 0.0); + glShadeModel(GL_FLAT); + + menu = glutCreateMenu(menu_selected); + glutAddMenuEntry("clear", CLEAR); + glutAddMenuEntry("tesselate", TESSELATE); + glutAddMenuEntry("quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + glutMouseFunc(mouse_clicked); + glutKeyboardFunc(key_pressed); + contour_cnt = 0; + glPolygonMode(GL_FRONT, GL_FILL); + mode = DEFINE; +} + + +static void +reshape(GLsizei w, GLsizei h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, (GLdouble) w, 0.0, (GLdouble) h, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + set_screen_wh(w, h); +} + + +static void +usage(void) +{ + printf("Use left mouse button to place vertices.\n"); + printf("Press middle mouse button when done.\n"); + printf("Select tesselate from the pop-up menu.\n"); +} + + +/* Main Loop + * Open window with initial window size, title bar, + * RGBA display mode, and handle input events. + */ +int +main(int argc, char **argv) +{ + usage(); + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(400, 400); + glutCreateWindow(argv[0]); + myinit(); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/texcyl.c b/xc/extras/Mesa/demos/texcyl.c new file mode 100644 index 000000000..0de6365ec --- /dev/null +++ b/xc/extras/Mesa/demos/texcyl.c @@ -0,0 +1,279 @@ +/* $Id: texcyl.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Textured cylinder demo: lighting, texturing, reflection mapping. + * + * Command line options: + * -info print GL implementation information + * + * + * Brian Paul May 1997 This program is in the public domain. + */ + +/* + * $Log: texcyl.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 1999/10/21 16:39:06 brianp + * added -info command line option + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.3 1999/03/28 18:24:37 brianp + * minor clean-up + * + * Revision 3.2 1998/11/05 04:34:04 brianp + * moved image files to ../images/ directory + * + * Revision 3.1 1998/06/23 03:16:51 brianp + * added Point/Linear sampling menu items + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + +#include "../util/readtex.c" /* I know, this is a hack. */ + +#define TEXTURE_FILE "../images/reflect.rgb" + +#define LIT 1 +#define TEXTURED 2 +#define REFLECT 3 +#define ANIMATE 10 +#define POINT_FILTER 20 +#define LINEAR_FILTER 21 +#define QUIT 100 + +static GLuint CylinderObj = 0; +static GLboolean Animate = GL_TRUE; + +static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; +static GLfloat DXrot = 1.0, DYrot = 2.5; + + +static void Idle( void ) +{ + if (Animate) { + Xrot += DXrot; + Yrot += DYrot; + glutPostRedisplay(); + } +} + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(Xrot, 1.0, 0.0, 0.0); + glRotatef(Yrot, 0.0, 1.0, 0.0); + glRotatef(Zrot, 0.0, 0.0, 1.0); + glScalef(5.0, 5.0, 5.0); + glCallList(CylinderObj); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -70.0 ); +} + + +static void SetMode(GLuint m) +{ + /* disable everything */ + glDisable(GL_LIGHTING); + glDisable(GL_TEXTURE_2D); + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + + /* enable what's needed */ + if (m==LIT) { + glEnable(GL_LIGHTING); + } + else if (m==TEXTURED) { + glEnable(GL_TEXTURE_2D); + } + else if (m==REFLECT) { + glEnable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + } +} + + +static void ModeMenu(int entry) +{ + if (entry==ANIMATE) { + Animate = !Animate; + } + else if (entry==POINT_FILTER) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + else if (entry==LINEAR_FILTER) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else if (entry==QUIT) { + exit(0); + } + else { + SetMode(entry); + } + glutPostRedisplay(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + float step = 3.0; + (void) x; + (void) y; + + switch (key) { + case GLUT_KEY_UP: + Xrot += step; + break; + case GLUT_KEY_DOWN: + Xrot -= step; + break; + case GLUT_KEY_LEFT: + Yrot += step; + break; + case GLUT_KEY_RIGHT: + Yrot -= step; + break; + } + glutPostRedisplay(); +} + + +static void Init( int argc, char *argv[] ) +{ + GLUquadricObj *q = gluNewQuadric(); + CylinderObj = glGenLists(1); + glNewList(CylinderObj, GL_COMPILE); + + glTranslatef(0.0, 0.0, -1.0); + + /* cylinder */ + gluQuadricNormals(q, GL_SMOOTH); + gluQuadricTexture(q, GL_TRUE); + gluCylinder(q, 0.6, 0.6, 2.0, 24, 1); + + /* end cap */ + glTranslatef(0.0, 0.0, 2.0); + gluDisk(q, 0.0, 0.6, 24, 1); + + /* other end cap */ + glTranslatef(0.0, 0.0, -2.0); + gluQuadricOrientation(q, GLU_INSIDE); + gluDisk(q, 0.0, 0.6, 24, 1); + + glEndList(); + gluDeleteQuadric(q); + + /* lighting */ + glEnable(GL_LIGHTING); + { + GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0}; + GLfloat white[4] = {1.0, 1.0, 1.0, 1.0}; + GLfloat teal[4] = { 0.0, 1.0, 0.8, 1.0 }; + glMaterialfv(GL_FRONT, GL_DIFFUSE, teal); + glLightfv(GL_LIGHT0, GL_AMBIENT, gray); + glLightfv(GL_LIGHT0, GL_DIFFUSE, white); + glEnable(GL_LIGHT0); + } + + /* fitering = nearest, initially */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + + if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { + printf("Error: couldn't load texture image\n"); + exit(1); + } + + glEnable(GL_CULL_FACE); /* don't need Z testing for convex objects */ + + SetMode(LIT); + + if (argc > 1 && strcmp(argv[1], "-info")==0) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowSize( 400, 400 ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + + glutCreateWindow(argv[0] ); + + Init(argc, argv); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutCreateMenu(ModeMenu); + glutAddMenuEntry("Lit", LIT); + glutAddMenuEntry("Textured", TEXTURED); + glutAddMenuEntry("Reflect", REFLECT); + glutAddMenuEntry("Point Filtered", POINT_FILTER); + glutAddMenuEntry("Linear Filtered", LINEAR_FILTER); + glutAddMenuEntry("Toggle Animation", ANIMATE); + glutAddMenuEntry("Quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/texdown.c b/xc/extras/Mesa/demos/texdown.c new file mode 100644 index 000000000..1b82d402e --- /dev/null +++ b/xc/extras/Mesa/demos/texdown.c @@ -0,0 +1,387 @@ +/* $Id: texdown.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * 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. + */ + + +/* + * texdown + * + * Measure texture download speed. + * Use keyboard to change texture size, format, datatype, scale/bias, + * subimageload, etc. + * + * Brian Paul 28 January 2000 + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + + +static GLsizei MaxSize = 1024; +static GLsizei TexWidth = 256, TexHeight = 256, TexBorder = 0; +static GLboolean ScaleAndBias = GL_FALSE; +static GLboolean SubImage = GL_FALSE; +static GLdouble DownloadRate = 0.0; /* texels/sec */ + +static GLuint Mode = 0; + + +#define NUM_FORMATS 4 +struct FormatRec { + GLenum Format; + GLenum Type; + GLenum IntFormat; + GLint TexelSize; +}; + + +static const struct FormatRec FormatTable[NUM_FORMATS] = { + /* Format Type IntFormat TexelSize */ + { GL_RGB, GL_UNSIGNED_BYTE, GL_RGB, 3 }, + { GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA, 4 }, + { GL_RGBA, GL_UNSIGNED_BYTE, GL_RGB, 4 }, + { GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB, 2 }, +}; +static GLint Format; + + +static int +BytesPerTexel(GLint format) +{ + return FormatTable[format].TexelSize; +} + + +static const char * +FormatStr(GLenum format) +{ + switch (format) { + case GL_RGB: + return "GL_RGB"; + case GL_RGBA: + return "GL_RGBA"; + default: + return ""; + } +} + + +static const char * +TypeStr(GLenum type) +{ + switch (type) { + case GL_UNSIGNED_BYTE: + return "GL_UNSIGNED_BYTE"; + case GL_UNSIGNED_SHORT: + return "GL_UNSIGNED_SHORT"; + case GL_UNSIGNED_SHORT_5_6_5: + return "GL_UNSIGNED_SHORT_5_6_5"; + case GL_UNSIGNED_SHORT_5_6_5_REV: + return "GL_UNSIGNED_SHORT_5_6_5_REV"; + default: + return ""; + } +} + + +static void +MeasureDownloadRate(void) +{ + const int w = TexWidth + 2 * TexBorder; + const int h = TexHeight + 2 * TexBorder; + const int bytes = w * h * BytesPerTexel(Format); + GLubyte *texImage, *getImage; + GLdouble t0, t1, time; + int count; + int i; + + texImage = (GLubyte *) malloc(bytes); + getImage = (GLubyte *) malloc(bytes); + if (!texImage || !getImage) { + DownloadRate = 0.0; + return; + } + + for (i = 0; i < bytes; i++) { + texImage[i] = i & 0xff; + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + if (ScaleAndBias) { + glPixelTransferf(GL_RED_SCALE, 0.5); + glPixelTransferf(GL_GREEN_SCALE, 0.5); + glPixelTransferf(GL_BLUE_SCALE, 0.5); + glPixelTransferf(GL_RED_BIAS, 0.5); + glPixelTransferf(GL_GREEN_BIAS, 0.5); + glPixelTransferf(GL_BLUE_BIAS, 0.5); + } + else { + glPixelTransferf(GL_RED_SCALE, 1.0); + glPixelTransferf(GL_GREEN_SCALE, 1.0); + glPixelTransferf(GL_BLUE_SCALE, 1.0); + glPixelTransferf(GL_RED_BIAS, 0.0); + glPixelTransferf(GL_GREEN_BIAS, 0.0); + glPixelTransferf(GL_BLUE_BIAS, 0.0); + } + + count = 0; + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + do { + if (SubImage && count > 0) { + glTexSubImage2D(GL_TEXTURE_2D, 0, -TexBorder, -TexBorder, w, h, + FormatTable[Format].Format, + FormatTable[Format].Type, texImage); + } + else { + glTexImage2D(GL_TEXTURE_2D, 0, + FormatTable[Format].IntFormat, w, h, TexBorder, + FormatTable[Format].Format, + FormatTable[Format].Type, texImage); + } + + if (count == 0) { + /* draw a tiny polygon to force texture into texram */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glEnable(GL_TEXTURE_2D); + glBegin(GL_TRIANGLES); + glTexCoord2f(0, 0); glVertex2f(1, 1); + glTexCoord2f(1, 0); glVertex2f(3, 1); + glTexCoord2f(0.5, 1); glVertex2f(2, 3); + glEnd(); + glDisable(GL_TEXTURE_2D); + } + + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + time = t1 - t0; + count++; + } while (time < 3.0); + + printf("w*h=%d count=%d time=%f\n", w*h, count, time); + DownloadRate = w * h * count / time; + +#if 0 + if (!ScaleAndBias) { + /* verify texture readback */ + glGetTexImage(GL_TEXTURE_2D, 0, + FormatTable[Format].Format, + FormatTable[Format].Type, getImage); + for (i = 0; i < w * h; i++) { + if (texImage[i] != getImage[i]) { + printf("[%d] %d != %d\n", i, texImage[i], getImage[i]); + } + } + } +#endif + + free(texImage); + free(getImage); + + { + GLint err = glGetError(); + if (err) + printf("GL error %d\n", err); + } +} + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + +static void +Display(void) +{ + const int w = TexWidth + 2 * TexBorder; + const int h = TexHeight + 2 * TexBorder; + char s[1000]; + + glClear(GL_COLOR_BUFFER_BIT); + + glRasterPos2i(10, 80); + sprintf(s, "Texture size[cursor]: %d x %d Border[b]: %d", w, h, TexBorder); + PrintString(s); + + glRasterPos2i(10, 65); + sprintf(s, "Format[f]: %s Type: %s IntFormat: %s", + FormatStr(FormatTable[Format].Format), + TypeStr( FormatTable[Format].Type), + FormatStr(FormatTable[Format].IntFormat)); + PrintString(s); + + glRasterPos2i(10, 50); + sprintf(s, "Pixel Scale&Bias[p]: %s TexSubImage[s]: %s", + ScaleAndBias ? "Yes" : "No", + SubImage ? "Yes" : "No"); + PrintString(s); + + if (Mode == 0) { + glRasterPos2i(200, 10); + sprintf(s, "...Measuring..."); + PrintString(s); + glutSwapBuffers(); + glutPostRedisplay(); + Mode++; + } + else if (Mode == 1) { + MeasureDownloadRate(); + glutPostRedisplay(); + Mode++; + } + else { + /* show results */ + glRasterPos2i(10, 10); + sprintf(s, "Download rate: %g Mtexels/second %g MB/second", + DownloadRate / 1000000.0, + DownloadRate * BytesPerTexel(Format) / 1000000.0); + PrintString(s); + { + GLint r, g, b, a, l, i; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); + sprintf(s, "TexelBits: R=%d G=%d B=%d A=%d L=%d I=%d", r, g, b, a, l, i); + glRasterPos2i(10, 25); + PrintString(s); + } + + glutSwapBuffers(); + } +} + + +static void +Reshape(int width, int height) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(0, width, 0, height, -1, 1); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case ' ': + Mode = 0; + break; + case 'b': + /* toggle border */ + TexBorder = 1 - TexBorder; + Mode = 0; + break; + case 'f': + /* change format */ + Format = (Format + 1) % NUM_FORMATS; + Mode = 0; + break; + case 'p': + /* toggle border */ + ScaleAndBias = !ScaleAndBias; + Mode = 0; + break; + case 's': + SubImage = !SubImage; + Mode = 0; + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + if (TexHeight < MaxSize) + TexHeight *= 2; + break; + case GLUT_KEY_DOWN: + if (TexHeight > 1) + TexHeight /= 2; + break; + case GLUT_KEY_LEFT: + if (TexWidth > 1) + TexWidth /= 2; + break; + case GLUT_KEY_RIGHT: + if (TexWidth < MaxSize) + TexWidth *= 2; + break; + } + Mode = 0; + glutPostRedisplay(); +} + + +static void +Init(void) +{ + printf("GL_VENDOR = %s\n", (const char *) glGetString(GL_VENDOR)); + printf("GL_VERSION = %s\n", (const char *) glGetString(GL_VERSION)); + printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER)); +} + + +int +main(int argc, char *argv[]) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 600, 100 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + glutCreateWindow(argv[0]); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/texenv.c b/xc/extras/Mesa/demos/texenv.c new file mode 100644 index 000000000..bae311754 --- /dev/null +++ b/xc/extras/Mesa/demos/texenv.c @@ -0,0 +1,774 @@ + +/* 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. + */ + +/* + * Demonstrates texture environment modes and internal image formats. + */ + +/* + * Hacked on, updated by Gareth Hughes <gareth@valinux.com> + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <GL/glut.h> + +#undef max +#undef min +#define max( a, b ) ((a) >= (b) ? (a) : (b)) +#define min( a, b ) ((a) <= (b) ? (a) : (b)) + +GLfloat lightCheck[4] = { 0.7, 0.7, 0.7, 1.0 }; +GLfloat darkCheck[4] = { 0.3, 0.3, 0.3, 1.0 }; + +GLfloat labelColor0[4] = { 1.0, 1.0, 1.0, 1.0 }; +GLfloat labelColor1[4] = { 1.0, 1.0, 0.4, 1.0 }; +GLfloat *labelInfoColor = labelColor0; +GLfloat labelLevelColor0[4] = { 0.8, 0.8, 0.1, 1.0 }; +GLfloat labelLevelColor1[4] = { 0.0, 0.0, 0.0, 1.0 }; + +GLboolean doubleBuffered = GL_FALSE; +GLboolean drawBackground = GL_FALSE; +GLboolean drawBlended = GL_TRUE; +GLboolean drawSmooth = GL_FALSE; +GLboolean drawTextured = GL_TRUE; +GLboolean displayLevelInfo = GL_FALSE; + +int textureWidth = 64; +int textureHeight = 64; + +int winWidth = 580, winHeight = 720; + +struct formatInfo { + GLenum baseFormat; + GLenum internalFormat; + char *name; +}; + +#define NUM_LUMINANCE_FORMATS (sizeof(luminanceFormats) / sizeof(luminanceFormats[0])) +struct formatInfo luminanceFormats[] = +{ + { GL_LUMINANCE, GL_LUMINANCE, "LUMINANCE" }, + { GL_LUMINANCE, GL_LUMINANCE4, "LUMINANCE4" }, + { GL_LUMINANCE, GL_LUMINANCE8, "LUMINANCE8" }, + { GL_LUMINANCE, GL_LUMINANCE12, "LUMINANCE12" }, + { GL_LUMINANCE, GL_LUMINANCE16, "LUMINANCE16" }, +}; + +#define NUM_ALPHA_FORMATS (sizeof(alphaFormats) / sizeof(alphaFormats[0])) +struct formatInfo alphaFormats[] = +{ + { GL_ALPHA, GL_ALPHA, "ALPHA" }, + { GL_ALPHA, GL_ALPHA4, "ALPHA4" }, + { GL_ALPHA, GL_ALPHA8, "ALPHA8" }, + { GL_ALPHA, GL_ALPHA12, "ALPHA12" }, + { GL_ALPHA, GL_ALPHA16, "ALPHA16" }, +}; + +#define NUM_INTENSITY_FORMATS (sizeof(intensityFormats) / sizeof(intensityFormats[0])) +struct formatInfo intensityFormats[] = +{ + { GL_INTENSITY, GL_INTENSITY, "INTENSITY" }, + { GL_INTENSITY, GL_INTENSITY4, "INTENSITY4" }, + { GL_INTENSITY, GL_INTENSITY8, "INTENSITY8" }, + { GL_INTENSITY, GL_INTENSITY12, "INTENSITY12" }, + { GL_INTENSITY, GL_INTENSITY16, "INTENSITY16" }, +}; + +#define NUM_LUMINANCE_ALPHA_FORMATS (sizeof(luminanceAlphaFormats) / sizeof(luminanceAlphaFormats[0])) +struct formatInfo luminanceAlphaFormats[] = +{ + { GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, "LUMINANCE_ALPHA" }, + { GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, "LUMINANCE4_ALPHA4" }, + { GL_LUMINANCE_ALPHA, GL_LUMINANCE6_ALPHA2, "LUMINANCE6_ALPHA2" }, + { GL_LUMINANCE_ALPHA, GL_LUMINANCE8_ALPHA8, "LUMINANCE8_ALPHA8" }, + { GL_LUMINANCE_ALPHA, GL_LUMINANCE12_ALPHA4, "LUMINANCE12_ALPHA4" }, + { GL_LUMINANCE_ALPHA, GL_LUMINANCE12_ALPHA12, "LUMINANCE12_ALPHA12" }, + { GL_LUMINANCE_ALPHA, GL_LUMINANCE16_ALPHA16, "LUMINANCE16_ALPHA16" }, +}; + +#define NUM_RGB_FORMATS (sizeof(rgbFormats) / sizeof(rgbFormats[0])) +struct formatInfo rgbFormats[] = +{ + { GL_RGB, GL_RGB, "RGB" }, + { GL_RGB, GL_R3_G3_B2, "R3_G3_B2" }, + { GL_RGB, GL_RGB4, "RGB4" }, + { GL_RGB, GL_RGB5, "RGB5" }, + { GL_RGB, GL_RGB8, "RGB8" }, + { GL_RGB, GL_RGB10, "RGB10" }, + { GL_RGB, GL_RGB12, "RGB12" }, + { GL_RGB, GL_RGB16, "RGB16" }, +}; + +#define NUM_RGBA_FORMATS (sizeof(rgbaFormats) / sizeof(rgbaFormats[0])) +struct formatInfo rgbaFormats[] = +{ + { GL_RGBA, 4, "RGBA" }, + { GL_RGBA, GL_RGBA2, "RGBA2" }, + { GL_RGBA, GL_RGBA4, "RGBA4" }, + { GL_RGBA, GL_RGB5_A1, "RGB5_A1" }, + { GL_RGBA, GL_RGBA8, "RGBA8" }, + { GL_RGBA, GL_RGB10_A2, "RGB10_A2" }, + { GL_RGBA, GL_RGBA12, "RGBA12" }, + { GL_RGBA, GL_RGBA16, "RGBA16" }, +}; + +struct baseFormatInfo { + struct formatInfo *format; + int current, number; +}; + +#define NUM_BASE_FORMATS (sizeof(baseFormats) / sizeof(baseFormats[0])) +int baseFormat; +struct baseFormatInfo baseFormats[] = +{ + { luminanceFormats, 0, NUM_LUMINANCE_FORMATS }, + { alphaFormats, 0, NUM_ALPHA_FORMATS }, + { intensityFormats, 0, NUM_INTENSITY_FORMATS }, + { luminanceAlphaFormats, 0, NUM_LUMINANCE_ALPHA_FORMATS }, + { rgbFormats, 0, NUM_RGB_FORMATS }, + { rgbaFormats, 0, NUM_RGBA_FORMATS }, +}; + +#define NUM_ENV_COLORS (sizeof(envColors) / sizeof(envColors[0])) +int envColor; +GLfloat envColors[][4] = +{ + { 0.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + { 0.0, 1.0, 0.0, 1.0 }, + { 0.0, 0.0, 1.0, 1.0 }, + { 1.0, 1.0, 1.0, 1.0 }, +}; + +struct envModeInfo { + GLenum mode; + char *name; +}; + +/* allow for run-time check for GL_EXT_texture_env_add */ +int NUM_ENV_MODES = 5; +struct envModeInfo envModes[] = +{ + { GL_REPLACE, "REPLACE" }, + { GL_MODULATE, "MODULATE" }, + { GL_BLEND, "BLEND" }, + { GL_DECAL, "DECAL" }, +#if GL_EXT_texture_env_add + { GL_ADD, "ADD" }, +#endif +}; + +static void checkErrors( void ) +{ + GLenum error; + + return; + + while ( (error = glGetError()) != GL_NO_ERROR ) { + fprintf( stderr, "Error: %s\n", (char *) gluErrorString( error ) ); + } +} + +static void drawString( char *string, GLfloat x, GLfloat y, GLfloat color[4] ) +{ + glColor4fv( color ); + glRasterPos2f( x, y ); + + while ( *string ) { + glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string ); + string++; + } +} + +static void drawStringOutline( char *string, GLfloat x, GLfloat y, + GLfloat color[4], GLfloat outline[4] ) +{ + drawString( string, x - 1, y, outline ); + drawString( string, x + 1, y, outline ); + drawString( string, x, y - 1, outline ); + drawString( string, x, y + 1, outline ); + drawString( string, x, y, color ); +} + +static void begin2D( int width, int height ) +{ + glMatrixMode( GL_PROJECTION ); + + glPushMatrix(); + glLoadIdentity(); + + glOrtho( 0, width, 0, height, -1, 1 ); + glMatrixMode( GL_MODELVIEW ); + + glPushMatrix(); + glLoadIdentity(); +} + +static void end2D( void ) +{ + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); + glPopMatrix(); +} + +static void initialize( void ) +{ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + + glOrtho( -1.5, 1.5, -1.5, 1.5, -1.5, 1.5 ); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glShadeModel( GL_FLAT ); +} + +/* ARGSUSED1 */ +static void keyboard( unsigned char c, int x, int y ) +{ + switch ( c ) { + case 'c': + envColor = ++envColor % (int) NUM_ENV_COLORS; + break; + case 'g': + drawBackground = !drawBackground; + break; + case 'b': + drawBlended = !drawBlended; + break; + case 's': + drawSmooth = !drawSmooth; + break; + case 't': + drawTextured = !drawTextured; + break; + case 'i': + displayLevelInfo = !displayLevelInfo; + break; + case 27: /* Escape key should force exit. */ + exit(0); + break; + default: + break; + } + glutPostRedisplay(); +} + +/* ARGSUSED1 */ +static void special( int key, int x, int y ) +{ + switch ( key ) { + case GLUT_KEY_DOWN: + if ( ++baseFormat > NUM_BASE_FORMATS - 1 ) { + baseFormat = 0; + } + break; + case GLUT_KEY_UP: + if ( --baseFormat < 0 ) { + baseFormat = NUM_BASE_FORMATS - 1; + } + break; + case GLUT_KEY_LEFT: + --baseFormats[baseFormat].current; + if ( baseFormats[baseFormat].current < 0 ) { + baseFormats[baseFormat].current = baseFormats[baseFormat].number - 1; + } + break; + case GLUT_KEY_RIGHT: + ++baseFormats[baseFormat].current; + if ( baseFormats[baseFormat].current > baseFormats[baseFormat].number - 1 ) { + baseFormats[baseFormat].current = 0; + } + break; + default: + break; + } + glutPostRedisplay(); +} + +static void +reshape( int w, int h ) +{ + winWidth = w; + winHeight = h; + /* No need to call glViewPort here since "draw" calls it! */ +} + +static void loadTexture( int width, int height, struct formatInfo *format ) +{ + int luminanceSize = 0; + int alphaSize = 0; + int rgbSize = 0; + GLenum textureFormat; + GLubyte *texImage, *p; + int elementsPerGroup, elementSize, groupSize, rowSize; + int i, j; + + switch ( format->baseFormat ) { + case GL_LUMINANCE: + luminanceSize = 1; + textureFormat = GL_LUMINANCE; + break; + case GL_INTENSITY: + luminanceSize = 1; + textureFormat = GL_INTENSITY; + break; + case GL_ALPHA: + alphaSize = 1; + textureFormat = GL_ALPHA; + break; + case GL_LUMINANCE_ALPHA: + luminanceSize = 1; + alphaSize = 1; + textureFormat = GL_LUMINANCE_ALPHA; + break; + case GL_RGB: + rgbSize = 3; + textureFormat = GL_RGB; + break; + case GL_RGBA: + rgbSize = 3; + alphaSize = 1; + textureFormat = GL_RGBA; + break; + default: + fprintf(stderr, "bad internal format info\n"); + return; + } + + elementsPerGroup = luminanceSize + alphaSize + rgbSize; + elementSize = sizeof(GLubyte); + groupSize = elementsPerGroup * elementSize; + rowSize = width * groupSize; + + if ( (texImage = (GLubyte *) malloc( height * rowSize ) ) == NULL ) { + fprintf( stderr, "texture malloc failed\n" ); + return; + } + + for ( i = 0 ; i < height ; i++ ) + { + p = texImage + i * rowSize; + + for ( j = 0 ; j < width ; j++ ) + { + if ( luminanceSize > 0 ) + { + /** + ** +-----+-----+ + ** | | | + ** | W | LG | + ** | | | + ** +-----+-----+ + ** | | | + ** | DG | B | + ** | | | + ** +-----+-----+ + **/ + if ( i > height / 2 ) { + if ( j < width / 2 ) { + p[0] = 0xff; + } else { + p[0] = 0xaa; + } + } else { + if ( j < width / 2 ) { + p[0] = 0x55; + } else { + p[0] = 0x00; + } + } + p += elementSize; + } + + if ( rgbSize > 0 ) + { + /** + ** +-----+-----+ + ** | | | + ** | R | G | + ** | | | + ** +-----+-----+ + ** | | | + ** | Y | B | + ** | | | + ** +-----+-----+ + **/ + if ( i > height / 2 ) { + if ( j < width / 2 ) { + p[0] = 0xff; + p[1] = 0x00; + p[2] = 0x00; + } else { + p[0] = 0x00; + p[1] = 0xff; + p[2] = 0x00; + } + } else { + if ( j < width / 2 ) { + p[0] = 0xff; + p[1] = 0xff; + p[2] = 0x00; + } else { + p[0] = 0x00; + p[1] = 0x00; + p[2] = 0xff; + } + } + p += 3 * elementSize; + } + + if ( alphaSize > 0 ) + { + /** + ** +-----------+ + ** | W | + ** | +-----+ | + ** | | | | + ** | | B | | + ** | | | | + ** | +-----+ | + ** | | + ** +-----------+ + **/ + int i2 = i - height / 2; + int j2 = j - width / 2; + int h8 = height / 8; + int w8 = width / 8; + if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) { + p[0] = 0x00; + } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) { + p[0] = 0x55; + } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) { + p[0] = 0xaa; + } else { + p[0] = 0xff; + } + p += elementSize; + } + } + } + + glTexImage2D( GL_TEXTURE_2D, 0, + format->internalFormat, width, height, 0, + textureFormat, GL_UNSIGNED_BYTE, texImage ); + + free( texImage ); +} + +static void drawCheck( int w, int h, GLfloat lightCheck[4], GLfloat darkCheck[4] ) +{ + float dw = 2.0 / w; + float dh = 2.0 / h; + int i, j; + + for ( i = 0 ; i < w ; i++ ) { + GLfloat x0 = -1.0 + i * dw; + GLfloat x1 = x0 + dw; + + glBegin( GL_QUAD_STRIP ); + + for ( j = 0 ; j <= h ; j++ ) { + GLfloat y = -1.0 + j * dh; + + if ( (i ^ j) & 1 ) { + glColor4fv( lightCheck ); + } else { + glColor4fv( darkCheck ); + } + + glVertex2f( x0, y ); + glVertex2f( x1, y ); + } + + glEnd(); + } +} + +static void drawSample( int x, int y, int w, int h, + struct formatInfo *format, struct envModeInfo *envMode ) +{ + glViewport( x, y, w, h ); + glScissor( x, y, w, h ); + + glClearColor( 0.1, 0.1, 0.1, 1.0 ); + glClear( GL_COLOR_BUFFER_BIT ); + + begin2D( w, h ); + drawString( format->name, 10, h - 15, labelInfoColor ); + drawString( envMode->name, 10, 5, labelInfoColor ); + end2D(); + + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, envMode->mode ); + glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, envColors[envColor] ); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + + loadTexture( textureWidth, textureHeight, format ); + + if ( drawBackground ) { + drawCheck( 15, 15, lightCheck, darkCheck ); + } + if ( drawBlended ) { + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + glEnable( GL_BLEND ); + } + if ( drawSmooth ) { + glShadeModel( GL_SMOOTH ); + } + else { + glShadeModel( GL_FLAT ); + glColor4f(1, 1, 1, 1); + } + if ( drawTextured ) { + glEnable( GL_TEXTURE_2D ); + } + + glBegin( GL_QUADS ); + if ( drawSmooth ) glColor4f( 1.0, 0.0, 1.0, 1.0 ); + glTexCoord2f( 0.0, 0.0 ); + glVertex2f( -0.8, -0.8 ); + + if ( drawSmooth ) glColor4f( 1.0, 0.0, 1.0, 1.0 ); + glTexCoord2f( 1.0, 0.0 ); + glVertex2f( 0.8, -0.8 ); + + if ( drawSmooth ) glColor4f( 0.0, 1.0, 0.0, 1.0 ); + glTexCoord2f( 1.0, 1.0 ); + glVertex2f( 0.8, 0.8 ); + + if ( drawSmooth ) glColor4f( 0.0, 1.0, 0.0, 1.0 ); + glTexCoord2f( 0.0, 1.0 ); + glVertex2f( -0.8, 0.8 ); + glEnd(); + + glDisable( GL_BLEND ); + glShadeModel( GL_FLAT ); + glDisable( GL_TEXTURE_2D ); + + if ( envMode->mode == GL_DECAL && + (format->baseFormat == GL_ALPHA || + format->baseFormat == GL_LUMINANCE || + format->baseFormat == GL_LUMINANCE_ALPHA || + format->baseFormat == GL_INTENSITY)) { + /* undefined format/mode combination */ + begin2D( w, h ); + drawStringOutline( "UNDEFINED MODE", 15, h / 2, + labelLevelColor0, labelLevelColor1 ); + end2D(); + } + else if ( displayLevelInfo ) { + GLint width, height, border, components; + GLint redSize, greenSize, blueSize, alphaSize; + GLint luminanceSize, intensitySize; + char buf[255]; + + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER, &border ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_COMPONENTS, &components ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &redSize ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &greenSize ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &blueSize ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &alphaSize ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &luminanceSize ); + glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &intensitySize ); + + begin2D( w, h ); + sprintf( buf, "dimensions: %d x %d", width, height ); + drawStringOutline( buf, 15, h / 2 + 20, labelLevelColor0, labelLevelColor1 ); + + sprintf( buf, "border: %d", border ); + drawStringOutline( buf, 15, h / 2 + 10, labelLevelColor0, labelLevelColor1 ); + + sprintf( buf, "components: 0x%04X", components ); + drawStringOutline( buf, 15, h / 2, labelLevelColor0, labelLevelColor1 ); + + sprintf( buf, "sizes:" ); + drawStringOutline( buf, 15, h / 2 - 10, labelLevelColor0, labelLevelColor1 ); + + sprintf( buf, " %d / %d / %d / %d / %d / %d", + redSize, greenSize, blueSize, alphaSize, + luminanceSize, intensitySize ); + drawStringOutline( buf, 15, h / 2 - 20, labelLevelColor0, labelLevelColor1 ); + + end2D(); + } +} + +static void display( void ) +{ + int numX = NUM_ENV_MODES, numY = NUM_BASE_FORMATS; + float xBase = (float) winWidth * 0.01; + float xOffset = (winWidth - xBase) / numX; + float xSize = max( xOffset - xBase, 1 ); + float yBase = (float) winHeight * 0.01; + float yOffset = (winHeight - yBase) / numY; + float ySize = max( yOffset - yBase, 1 ); + float x, y; + int i, j; + + glViewport( 0, 0, winWidth, winHeight ); + glDisable( GL_SCISSOR_TEST ); + glClearColor( 0.0, 0.0, 0.0, 0.0 ); + glClear( GL_COLOR_BUFFER_BIT ); + glEnable( GL_SCISSOR_TEST ); + + x = xBase; + y = (winHeight - 1) - yOffset; + + for ( i = 0 ; i < NUM_BASE_FORMATS ; i++ ) + { + struct formatInfo *format; + + if ( i == baseFormat ) { + labelInfoColor = labelColor1; + } else { + labelInfoColor = labelColor0; + } + + format = &baseFormats[i].format[baseFormats[i].current]; + + for ( j = 0 ; j < NUM_ENV_MODES ; j++ ) { + struct envModeInfo *envMode; + + envMode = &envModes[j]; + drawSample( x, y, xSize, ySize, format, envMode ); + x += xOffset; + } + + x = xBase; + y -= yOffset; + } + + if ( doubleBuffered ) { + glutSwapBuffers(); + } else { + glFlush(); + } + + checkErrors(); +} + +static void usage( char *name ) +{ + fprintf( stderr, "usage: %s [ options ]\n", name ); + fprintf( stderr, "\n" ); + fprintf( stderr, "options:\n" ); + fprintf( stderr, " -sb single buffered\n" ); + fprintf( stderr, " -db double buffered\n" ); + fprintf( stderr, " -info print OpenGL driver info\n" ); +} + +static void instructions( void ) +{ + fprintf( stderr, "texenv - texture environment and internal format test\n" ); + fprintf( stderr, "\n" ); + fprintf( stderr, " [c] - cycle through background colors\n" ); + fprintf( stderr, " [g] - toggle background\n" ); + fprintf( stderr, " [b] - toggle blend\n" ); + fprintf( stderr, " [s] - toggle smooth shading\n" ); + fprintf( stderr, " [t] - toggle texturing\n" ); + fprintf( stderr, " [i] - toggle information display\n" ); +} + +int main( int argc, char *argv[] ) +{ + GLboolean info = GL_FALSE; + int i; + + glutInit( &argc, argv ); + + for ( i = 1 ; i < argc ; i++ ) { + if ( !strcmp( "-sb", argv[i] ) ) { + doubleBuffered = GL_FALSE; + } else if ( !strcmp( "-db", argv[i] ) ) { + doubleBuffered = GL_TRUE; + } else if ( !strcmp( "-info", argv[i] ) ) { + info = GL_TRUE; + } else { + usage( argv[0] ); + exit( 1 ); + } + } + + if ( doubleBuffered ) { + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + } else { + glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); + } + + glutInitWindowSize( winWidth, winHeight ); + glutCreateWindow( "Texture Environment Test" ); + + initialize(); + instructions(); + + if ( info ) { + printf( "\n" ); + printf( "GL_RENDERER = %s\n", (char *) glGetString( GL_RENDERER ) ); + printf( "GL_VERSION = %s\n", (char *) glGetString( GL_VERSION ) ); + printf( "GL_VENDOR = %s\n", (char *) glGetString( GL_VENDOR ) ) ; + printf( "GL_EXTENSIONS = %s\n", (char *) glGetString( GL_EXTENSIONS ) ); + } + +#if GL_EXT_texture_env_add + if ( !glutExtensionSupported( "GL_EXT_texture_env_add" ) ) { + fprintf( stderr, "missing extension: GL_EXT_texture_env_add\n" ); + NUM_ENV_MODES--; + } +#endif + + glutDisplayFunc( display ); + glutReshapeFunc( reshape ); + glutKeyboardFunc( keyboard ); + glutSpecialFunc( special ); + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/texobj.c b/xc/extras/Mesa/demos/texobj.c new file mode 100644 index 000000000..ee38d6644 --- /dev/null +++ b/xc/extras/Mesa/demos/texobj.c @@ -0,0 +1,276 @@ +/* $Id: texobj.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Example of using the 1.1 texture object functions. + * Also, this demo utilizes Mesa's fast texture map path. + * + * Brian Paul June 1996 This file is in the public domain. + */ + +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include "GL/glut.h" + +static GLuint Window = 0; + +static GLuint TexObj[2]; +static GLfloat Angle = 0.0f; +static GLboolean UseObj = GL_FALSE; + + +#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2) +# define TEXTURE_OBJECT 1 +#elif defined(GL_EXT_texture_object) +# define TEXTURE_OBJECT 1 +# define glBindTexture(A,B) glBindTextureEXT(A,B) +# define glGenTextures(A,B) glGenTexturesEXT(A,B) +# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B) +#endif + + + + +static void draw( void ) +{ + glDepthFunc(GL_EQUAL); + /* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/ + glClear( GL_COLOR_BUFFER_BIT ); + + glColor3f( 1.0, 1.0, 1.0 ); + + /* draw first polygon */ + glPushMatrix(); + glTranslatef( -1.0, 0.0, 0.0 ); + glRotatef( Angle, 0.0, 0.0, 1.0 ); + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[0] ); +#endif + } + else { + glCallList( TexObj[0] ); + } + glBegin( GL_POLYGON ); + glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); + glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); + glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); + glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); + glEnd(); + glPopMatrix(); + + /* draw second polygon */ + glPushMatrix(); + glTranslatef( 1.0, 0.0, 0.0 ); + glRotatef( Angle-90.0, 0.0, 1.0, 0.0 ); + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[1] ); +#endif + } + else { + glCallList( TexObj[1] ); + } + glBegin( GL_POLYGON ); + glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); + glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); + glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); + glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); + glEnd(); + glPopMatrix(); + + glutSwapBuffers(); +} + + + +static void idle( void ) +{ + Angle += 2.0; + glutPostRedisplay(); +} + + + +/* change view Angle, exit upon ESC */ +static void key(unsigned char k, int x, int y) +{ + (void) x; + (void) y; + switch (k) { + case 27: +#ifdef TEXTURE_OBJECT + glDeleteTextures( 2, TexObj ); +#endif + glutDestroyWindow(Window); + exit(0); + } +} + + + +/* new window size or exposure */ +static void reshape( int width, int height ) +{ + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/ + glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 ); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -8.0 ); +} + + +static void init( void ) +{ + static int width=8, height=8; + static GLubyte tex1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, + 0, 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, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + static GLubyte tex2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 2, 0, 0, 0, + 0, 0, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 2, 2, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + GLubyte tex[64][3]; + GLint i, j; + + + glDisable( GL_DITHER ); + + /* Setup texturing */ + glEnable( GL_TEXTURE_2D ); + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); + glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); + + + /* generate texture object IDs */ + if (UseObj) { +#ifdef TEXTURE_OBJECT + glGenTextures( 2, TexObj ); +#endif + } + else { + TexObj[0] = glGenLists(2); + TexObj[1] = TexObj[0]+1; + } + + /* setup first texture object */ + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[0] ); +#endif + } + else { + glNewList( TexObj[0], GL_COMPILE ); + } + /* red on white */ + for (i=0;i<height;i++) { + for (j=0;j<width;j++) { + int p = i*width+j; + if (tex1[(height-i-1)*width+j]) { + tex[p][0] = 255; tex[p][1] = 0; tex[p][2] = 0; + } + else { + tex[p][0] = 255; tex[p][1] = 255; tex[p][2] = 255; + } + } + } + + glTexImage2D( GL_TEXTURE_2D, 0, 3, width, height, 0, + GL_RGB, GL_UNSIGNED_BYTE, tex ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + if (!UseObj) { + glEndList(); + } + /* end of texture object */ + + /* setup second texture object */ + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[1] ); +#endif + } + else { + glNewList( TexObj[1], GL_COMPILE ); + } + /* green on blue */ + for (i=0;i<height;i++) { + for (j=0;j<width;j++) { + int p = i*width+j; + if (tex2[(height-i-1)*width+j]) { + tex[p][0] = 0; tex[p][1] = 255; tex[p][2] = 0; + } + else { + tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 255; + } + } + } + glTexImage2D( GL_TEXTURE_2D, 0, 3, width, height, 0, + GL_RGB, GL_UNSIGNED_BYTE, tex ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + if (!UseObj) { + glEndList(); + } + /* end texture object */ + +} + + + +int main( int argc, char *argv[] ) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(300, 300); + glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); + + Window = glutCreateWindow("Texture Objects"); + if (!Window) { + exit(1); + } + + /* check that renderer has the GL_EXT_texture_object extension + * or supports OpenGL 1.1 + */ +#ifdef TEXTURE_OBJECT + { + char *exten = (char *) glGetString( GL_EXTENSIONS ); + char *version = (char *) glGetString( GL_VERSION ); + if ( strstr( exten, "GL_EXT_texture_object" ) + || strncmp( version, "1.1", 3 )==0 + || strncmp( version, "1.2", 3 )==0 ) { + UseObj = GL_TRUE; + } + } +#endif + + init(); + + glutReshapeFunc( reshape ); + glutKeyboardFunc( key ); + glutIdleFunc( idle ); + glutDisplayFunc( draw ); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/trispd.c b/xc/extras/Mesa/demos/trispd.c new file mode 100644 index 000000000..aa69bb683 --- /dev/null +++ b/xc/extras/Mesa/demos/trispd.c @@ -0,0 +1,284 @@ +/* $Id: trispd.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Simple GLUT program to measure triangle strip rendering speed. + * Brian Paul February 15, 1997 This file is in the public domain. + */ + +/* + * $Log: trispd.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.1.1.1.6.1 2000/10/26 15:26:27 brianp + * added a glFinish() call + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.4 1999/03/28 18:24:37 brianp + * minor clean-up + * + * Revision 3.3 1999/03/18 08:16:52 joukj + * + * cmpstr needs string.h to included to avoid warnings + * + * Revision 3.2 1998/07/08 03:02:00 brianp + * added Marten Stromberg's texture options + * + * Revision 3.1 1998/06/29 02:36:58 brianp + * removed unneeded includes + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include <GL/glut.h> + + +static float MinPeriod = 2.0; /* 2 seconds */ +static float Width = 400.0; +static float Height = 400.0; +static int Loops = 1; +static int Size = 50; +static int Texture = 0; + + + +static void Idle( void ) +{ + glutPostRedisplay(); +} + + +static void Display( void ) +{ + float x, y; + float xStep; + float yStep; + double t0, t1; + double triRate; + double pixelRate; + int triCount; + int i; + float red[3] = { 1.0, 0.0, 0.0 }; + float blue[3] = { 0.0, 0.0, 1.0 }; + + xStep = yStep = sqrt( 2.0 * Size ); + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + triCount = 0; + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + if (Texture) { + float uStep = xStep / Width; + float vStep = yStep / Height; + float u, v; + for (i=0; i<Loops; i++) { + for (y=1.0, v=0.0f; y<Height-yStep; y+=yStep, v+=vStep) { + glBegin(GL_TRIANGLE_STRIP); + for (x=1.0, u=0.0f; x<Width; x+=xStep, u+=uStep) { + glColor3fv(red); + glTexCoord2f(u, v); + glVertex2f(x, y); + glColor3fv(blue); + glTexCoord2f(u, v+vStep); + glVertex2f(x, y+yStep); + triCount += 2; + } + glEnd(); + triCount -= 2; + } + } + } + else { + for (i=0; i<Loops; i++) { + for (y=1.0; y<Height-yStep; y+=yStep) { + glBegin(GL_TRIANGLE_STRIP); + for (x=1.0; x<Width; x+=xStep) { + glColor3fv(red); + glVertex2f(x, y); + glColor3fv(blue); + glVertex2f(x, y+yStep); + triCount += 2; + } + glEnd(); + triCount -= 2; + } + } + } + glFinish(); + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + + if (t1-t0 < MinPeriod) { + /* Next time draw more triangles to get longer elapsed time */ + Loops *= 2; + return; + } + + triRate = triCount / (t1-t0); + pixelRate = triRate * Size; + printf("Rate: %d tri in %gs = %g tri/s %d pixels/s\n", + triCount, t1-t0, triRate, (int)pixelRate); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + Width = width; + Height = height; + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(0.0, width, 0.0, height, -1.0, 1.0); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void LoadTex(int comp, int filter) +{ + GLubyte *pixels; + int x, y; + pixels = malloc(4*256*256); + for (y = 0; y < 256; ++y) + for (x = 0; x < 256; ++x) { + pixels[(y*256+x)*4+0] = (int)(128.5 + 127.0 * cos(0.024544 * x)); + pixels[(y*256+x)*4+1] = 255; + pixels[(y*256+x)*4+2] = (int)(128.5 + 127.0 * cos(0.024544 * y)); + pixels[(y*256+x)*4+3] = 255; + } + glEnable(GL_TEXTURE_2D); + glTexImage2D(GL_TEXTURE_2D, 0, comp, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + printf("Texture: GL_MODULATE, %d comps, %s\n", comp, filter == GL_NEAREST ? "GL_NEAREST" : "GL_LINEAR"); +} + + +static void Init( int argc, char *argv[] ) +{ + GLint shade; + GLint rBits, gBits, bBits; + int filter = GL_NEAREST, comp = 3; + + int i; + for (i=1; i<argc; i++) { + if (strcmp(argv[i],"-dither")==0) + glDisable(GL_DITHER); + else if (strcmp(argv[i],"+dither")==0) + glEnable(GL_DITHER); + else if (strcmp(argv[i],"+smooth")==0) + glShadeModel(GL_SMOOTH); + else if (strcmp(argv[i],"+flat")==0) + glShadeModel(GL_FLAT); + else if (strcmp(argv[i],"+depth")==0) + glEnable(GL_DEPTH_TEST); + else if (strcmp(argv[i],"-depth")==0) + glDisable(GL_DEPTH_TEST); + else if (strcmp(argv[i],"-size")==0) { + Size = atoi(argv[i+1]); + i++; + } + else if (strcmp(argv[i],"-texture")==0) + Texture = 0; + else if (strcmp(argv[i],"+texture")==0) + Texture = 1; + else if (strcmp(argv[i],"-linear")==0) + filter = GL_NEAREST; + else if (strcmp(argv[i],"+linear")==0) + filter = GL_LINEAR; + else if (strcmp(argv[i],"-persp")==0) + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + else if (strcmp(argv[i],"+persp")==0) + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + else if (strcmp(argv[i],"-comp")==0) { + comp = atoi(argv[i+1]); + i++; + } + else + printf("Unknown option: %s\n", argv[i]); + } + + glGetIntegerv(GL_SHADE_MODEL, &shade); + + printf("Dither: %s\n", glIsEnabled(GL_DITHER) ? "on" : "off"); + printf("ShadeModel: %s\n", (shade==GL_FLAT) ? "flat" : "smooth"); + printf("DepthTest: %s\n", glIsEnabled(GL_DEPTH_TEST) ? "on" : "off"); + printf("Size: %d pixels\n", Size); + + if (Texture) + LoadTex(comp, filter); + + glGetIntegerv(GL_RED_BITS, &rBits); + glGetIntegerv(GL_GREEN_BITS, &gBits); + glGetIntegerv(GL_BLUE_BITS, &bBits); + printf("RedBits: %d GreenBits: %d BlueBits: %d\n", rBits, gBits, bBits); +} + + +static void Help( const char *program ) +{ + printf("%s options:\n", program); + printf(" +/-dither enable/disable dithering\n"); + printf(" +/-depth enable/disable depth test\n"); + printf(" +flat flat shading\n"); + printf(" +smooth smooth shading\n"); + printf(" -size pixels specify pixels/triangle\n"); + printf(" +/-texture enable/disable texture\n"); + printf(" -comp n texture format\n"); + printf(" +/-linear bilinear texture filter\n"); + printf(" +/-persp perspective correction hint\n"); +} + + +int main( int argc, char *argv[] ) +{ + printf("For options: %s -help\n", argv[0]); + glutInit( &argc, argv ); + glutInitWindowSize( (int) Width, (int) Height ); + glutInitWindowPosition( 0, 0 ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + + glutCreateWindow( argv[0] ); + + if (argc==2 && strcmp(argv[1],"-help")==0) { + Help(argv[0]); + return 0; + } + + Init( argc, argv ); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/demos/tunnel.c b/xc/extras/Mesa/demos/tunnel.c new file mode 100644 index 000000000..431d28660 --- /dev/null +++ b/xc/extras/Mesa/demos/tunnel.c @@ -0,0 +1,510 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#ifdef WIN32 +#include <windows.h> +#endif + +#include <GL/glut.h> +#include "../util/readtex.c" +#include "tunneldat.c" + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen = 1; +#endif + +static int WIDTH = 640; +static int HEIGHT = 480; + +static GLint T0 = 0; +static GLint Frames = 0; + +#define NUMBLOC 5 + +#ifndef M_PI +#define M_PI 3.1415926535 +#endif + +extern int striplength_skin_13[]; +extern float stripdata_skin_13[]; + +extern int striplength_skin_12[]; +extern float stripdata_skin_12[]; + +extern int striplength_skin_11[]; +extern float stripdata_skin_11[]; + +extern int striplength_skin_9[]; +extern float stripdata_skin_9[]; + + +static int win = 0; + +static float obs[3] = { 1000.0, 0.0, 2.0 }; +static float dir[3]; +static float v = 0.5; +static float alpha = 90.0; +static float beta = 90.0; + +static int fog = 1; +static int bfcull = 1; +static int usetex = 1; +static int cstrip = 0; +static int help = 1; +static int joyavailable = 0; +static int joyactive = 0; + +static GLuint t1id, t2id; + +static void +inittextures(void) +{ + glGenTextures(1, &t1id); + glBindTexture(GL_TEXTURE_2D, t1id); + + if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glGenTextures(1, &t2id); + glBindTexture(GL_TEXTURE_2D, t2id); + + if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +} + +static void +drawobjs(int *l, float *f) +{ + int mend, j; + + if (cstrip) { + float r = 0.33, g = 0.33, b = 0.33; + + for (; (*l) != 0;) { + mend = *l++; + + r += 0.33; + if (r > 1.0) { + r = 0.33; + g += 0.33; + if (g > 1.0) { + g = 0.33; + b += 0.33; + if (b > 1.0) + b = 0.33; + } + } + + glColor3f(r, g, b); + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j < mend; j++) { + f += 4; + glTexCoord2fv(f); + f += 2; + glVertex3fv(f); + f += 3; + } + glEnd(); + } + } + else + for (; (*l) != 0;) { + mend = *l++; + + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j < mend; j++) { + glColor4fv(f); + f += 4; + glTexCoord2fv(f); + f += 2; + glVertex3fv(f); + f += 3; + } + glEnd(); + } +} + +static void +calcposobs(void) +{ + dir[0] = sin(alpha * M_PI / 180.0); + dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); + dir[2] = cos(beta * M_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; +} + +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_LEFT: + alpha -= 2.0; + break; + case GLUT_KEY_RIGHT: + alpha += 2.0; + break; + case GLUT_KEY_DOWN: + beta -= 2.0; + break; + case GLUT_KEY_UP: + beta += 2.0; + break; + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: + exit(0); + break; + + case 'a': + v += 0.01; + break; + case 'z': + v -= 0.01; + break; + +#ifdef XMESA + case ' ': + fullscreen = (!fullscreen); + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + break; +#endif + case 'j': + joyactive = (!joyactive); + break; + case 'h': + help = (!help); + break; + case 'f': + fog = (!fog); + break; + case 't': + usetex = (!usetex); + break; + case 'b': + if (bfcull) { + glDisable(GL_CULL_FACE); + bfcull = 0; + } + else { + glEnable(GL_CULL_FACE); + bfcull = 1; + } + break; + case 'm': + cstrip = (!cstrip); + break; + + case 'd': + fprintf(stderr, "Deleting textures...\n"); + glDeleteTextures(1, &t1id); + glDeleteTextures(1, &t2id); + fprintf(stderr, "Loading textures...\n"); + inittextures(); + fprintf(stderr, "Done.\n"); + break; + } + glutPostRedisplay(); +} + +static void +reshape(int w, int h) +{ + WIDTH = w; + HEIGHT = h; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(80.0, w / (float) h, 1.0, 50.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, w, h); +} + +static void +printstring(void *font, char *string) +{ + int len, i; + + len = (int) strlen(string); + for (i = 0; i < len; i++) + glutBitmapCharacter(font, string[i]); +} + +static void +printhelp(void) +{ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.0, 0.0, 0.0, 0.5); + glRecti(40, 40, 600, 440); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(300, 420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); + + glRasterPos2i(60, 390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); + glRasterPos2i(60, 360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); + glRasterPos2i(60, 330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); + glRasterPos2i(60, 300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips"); + glRasterPos2i(60, 270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); + glRasterPos2i(60, 240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); + glRasterPos2i(60, 210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); + glRasterPos2i(60, 180); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); + + glRasterPos2i(60, 150); + if (joyavailable) + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "j - Togle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "(No Joystick control available)"); +} + +static void +dojoy(void) +{ +#ifdef WIN32 + static UINT max[2] = { 0, 0 }; + static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2]; + MMRESULT res; + JOYINFO joy; + + res = joyGetPos(JOYSTICKID1, &joy); + + if (res == JOYERR_NOERROR) { + joyavailable = 1; + + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2; + + if (joyactive) { + if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0])) + alpha -= + 2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]); + if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1])) + beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]); + + if (joy.wButtons & JOY_BUTTON1) + v += 0.01; + if (joy.wButtons & JOY_BUTTON2) + v -= 0.01; + } + } + else + joyavailable = 0; +#endif +} + +static void +draw(void) +{ + static char frbuf[80] = ""; + int i; + float base, offset; + + dojoy(); + + glClear(GL_COLOR_BUFFER_BIT); + + if (usetex) + glEnable(GL_TEXTURE_2D); + else + glDisable(GL_TEXTURE_2D); + + if (fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glShadeModel(GL_SMOOTH); + + glPushMatrix(); + calcposobs(); + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 0.0, 1.0); + + if (dir[0] > 0) { + offset = 8.0; + base = obs[0] - fmod(obs[0], 8.0); + } + else { + offset = -8.0; + base = obs[0] + (8.0 - fmod(obs[0], 8.0)); + } + + glPushMatrix(); + glTranslatef(base - offset / 2.0, 0.0, 0.0); + for (i = 0; i < NUMBLOC; i++) { + glTranslatef(offset, 0.0, 0.0); + glBindTexture(GL_TEXTURE_2D, t1id); + drawobjs(striplength_skin_11, stripdata_skin_11); + glBindTexture(GL_TEXTURE_2D, t2id); + drawobjs(striplength_skin_12, stripdata_skin_12); + drawobjs(striplength_skin_9, stripdata_skin_9); + drawobjs(striplength_skin_13, stripdata_skin_13); + } + glPopMatrix(); + glPopMatrix(); + + glDisable(GL_TEXTURE_2D); + glDisable(GL_FOG); + glShadeModel(GL_FLAT); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(10, 10); + printstring(GLUT_BITMAP_HELVETICA_18, frbuf); + glRasterPos2i(350, 470); + printstring(GLUT_BITMAP_HELVETICA_10, + "Tunnel V1.5 Written by David Bucciarelli (tech.hmw@plus.it)"); + + if (help) + printhelp(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + glutSwapBuffers(); + + Frames++; + { + GLint t = glutGet(GLUT_ELAPSED_TIME); + if (t - T0 >= 2000) { + GLfloat seconds = (t - T0) / 1000.0; + GLfloat fps = Frames / seconds; + sprintf(frbuf, "Frame rate: %f", fps); + T0 = t; + Frames = 0; + } + } +} + +static void +idle(void) +{ + glutPostRedisplay(); +} + + + +int +main(int ac, char **av) +{ + float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 }; + + fprintf(stderr, + "Tunnel V1.5\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); + + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit(&ac, av); + + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + + if (!(win = glutCreateWindow("Tunnel"))) { + fprintf(stderr, "Error, couldn't open window\n"); + return -1; + } + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(80.0, WIDTH / (float) HEIGHT, 1.0, 50.0); + + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_SMOOTH); + glDisable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP2); + glFogfv(GL_FOG_COLOR, fogcolor); + + glFogf(GL_FOG_DENSITY, 0.06); + glHint(GL_FOG_HINT, GL_NICEST); + + inittextures(); + + glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]); + glClear(GL_COLOR_BUFFER_BIT); + + calcposobs(); + + glutReshapeFunc(reshape); + glutDisplayFunc(draw); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutIdleFunc(idle); + + glEnable(GL_BLEND); + /*glBlendFunc(GL_SRC_ALPHA_SATURATE,GL_ONE); */ + /*glEnable(GL_POLYGON_SMOOTH); */ + + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/tunnel2.c b/xc/extras/Mesa/demos/tunnel2.c new file mode 100644 index 000000000..cc660374e --- /dev/null +++ b/xc/extras/Mesa/demos/tunnel2.c @@ -0,0 +1,616 @@ +/* + * This program is under the GNU GPL. + * Use at your own risk. + * + * You need TWO Voodoo Graphics boards in order to run + * this demo ! + * + * written by David Bucciarelli (tech.hmw@plus.it) + * Humanware s.r.l. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#ifdef WIN32 +#include <windows.h> +#endif + +#include <GL/glut.h> +#include "../util/readtex.c" +#include "tunneldat.c" + +#ifdef FX +#endif + +#ifdef XMESA +#include "GL/xmesa.h" +static int fullscreen = 1; +#endif + +#ifdef FX +GLboolean fxMesaSelectCurrentBoard(int); +#endif + +static int WIDTHC0 = 640; +static int HEIGHTC0 = 480; + +static int WIDTHC1 = 640; +static int HEIGHTC1 = 480; + +#define FRAME 50 + +#define NUMBLOC 5 + +#ifndef M_PI +#define M_PI 3.1415926535 +#endif + +extern int striplength_skin_13[]; +extern float stripdata_skin_13[]; + +extern int striplength_skin_12[]; +extern float stripdata_skin_12[]; + +extern int striplength_skin_11[]; +extern float stripdata_skin_11[]; + +extern int striplength_skin_9[]; +extern float stripdata_skin_9[]; + + +static float obs[3] = { 1000.0, 0.0, 2.0 }; +static float dir[3]; +static float v = 0.5; +static float alpha = 90.0; +static float beta = 90.0; + +static int fog = 0; +static int bfcull = 1; +static int usetex = 1; +static int cstrip = 0; +static int help = 1; +static int joyavailable = 0; +static int joyactive = 0; + +static int channel[2]; + +static GLuint t1id, t2id; + +static void +inittextures(void) +{ + glGenTextures(1, &t1id); + glBindTexture(GL_TEXTURE_2D, t1id); + + if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glGenTextures(1, &t2id); + glBindTexture(GL_TEXTURE_2D, t2id); + + if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) { + fprintf(stderr, "Error reading a texture.\n"); + exit(-1); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +} + +static void +drawobjs(int *l, float *f) +{ + int mend, j; + + if (cstrip) { + float r = 0.33, g = 0.33, b = 0.33; + + for (; (*l) != 0;) { + mend = *l++; + + r += 0.33; + if (r > 1.0) { + r = 0.33; + g += 0.33; + if (g > 1.0) { + g = 0.33; + b += 0.33; + if (b > 1.0) + b = 0.33; + } + } + + glColor3f(r, g, b); + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j < mend; j++) { + f += 4; + glTexCoord2fv(f); + f += 2; + glVertex3fv(f); + f += 3; + } + glEnd(); + } + } + else + for (; (*l) != 0;) { + mend = *l++; + + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j < mend; j++) { + glColor4fv(f); + f += 4; + glTexCoord2fv(f); + f += 2; + glVertex3fv(f); + f += 3; + } + glEnd(); + } +} + +static float +gettime(void) +{ + static clock_t told = 0; + clock_t tnew, ris; + + tnew = clock(); + + ris = tnew - told; + + told = tnew; + + return (ris / (float) CLOCKS_PER_SEC); +} + +static void +calcposobs(void) +{ + dir[0] = sin(alpha * M_PI / 180.0); + dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); + dir[2] = cos(beta * M_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; +} + +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_LEFT: + alpha -= 2.0; + break; + case GLUT_KEY_RIGHT: + alpha += 2.0; + break; + case GLUT_KEY_DOWN: + beta -= 2.0; + break; + case GLUT_KEY_UP: + beta += 2.0; + break; + } +} + +static void +key(unsigned char k, int x, int y) +{ + switch (k) { + case 27: + exit(0); + break; + + case 'a': + v += 0.01; + break; + case 'z': + v -= 0.01; + break; + +#ifdef XMESA + case ' ': + fullscreen = (!fullscreen); + + glutSetWindow(channel[0]); + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + + glutSetWindow(channel[1]); + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + break; +#endif + + case 'j': + joyactive = (!joyactive); + break; + case 'h': + help = (!help); + break; + case 'f': + fog = (!fog); + break; + case 't': + usetex = (!usetex); + break; + case 'b': + if (bfcull) { + glDisable(GL_CULL_FACE); + bfcull = 0; + } + else { + glEnable(GL_CULL_FACE); + bfcull = 1; + } + break; + case 'm': + cstrip = (!cstrip); + break; + + case 'd': + fprintf(stderr, "Deleting textures...\n"); + glDeleteTextures(1, &t1id); + glDeleteTextures(1, &t2id); + fprintf(stderr, "Loading textures...\n"); + inittextures(); + fprintf(stderr, "Done.\n"); + break; + } +} + +static void +reshapechannel0(int w, int h) +{ + float ratio; + + WIDTHC0 = w; + HEIGHTC0 = h; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + ratio = 0.5f * w / (float) h; + + glFrustum(-2.0, 0.0, -1.0 * ratio, 1.0 * ratio, 1.0, 60.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, w, h); +} + +static void +reshapechannel1(int w, int h) +{ + float ratio; + + WIDTHC1 = w; + HEIGHTC1 = h; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + ratio = 0.5f * w / (float) h; + + glFrustum(0.0, 2.0, -1.0 * ratio, 1.0 * ratio, 1.0, 60.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, w, h); +} + +static void +printstring(void *font, char *string) +{ + int len, i; + + len = (int) strlen(string); + for (i = 0; i < len; i++) + glutBitmapCharacter(font, string[i]); +} + +static void +printhelp(void) +{ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.0, 0.0, 0.0, 0.5); + glRecti(40, 40, 600, 440); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(300, 420); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); + + glRasterPos2i(60, 390); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); + glRasterPos2i(60, 360); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); + glRasterPos2i(60, 330); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); + glRasterPos2i(60, 300); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips"); + glRasterPos2i(60, 270); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); + glRasterPos2i(60, 240); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); + glRasterPos2i(60, 210); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); + glRasterPos2i(60, 180); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); + + glRasterPos2i(60, 150); + if (joyavailable) + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "j - Togle jostick control (Joystick control available)"); + else + printstring(GLUT_BITMAP_TIMES_ROMAN_24, + "(No Joystick control available)"); +} + +static void +dojoy(void) +{ +#ifdef WIN32 + static UINT max[2] = { 0, 0 }; + static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2]; + MMRESULT res; + JOYINFO joy; + + res = joyGetPos(JOYSTICKID1, &joy); + + if (res == JOYERR_NOERROR) { + joyavailable = 1; + + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2; + + if (joyactive) { + if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0])) + alpha -= + 2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]); + if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1])) + beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]); + + if (joy.wButtons & JOY_BUTTON1) + v += 0.01; + if (joy.wButtons & JOY_BUTTON2) + v -= 0.01; + } + } + else + joyavailable = 0; +#endif +} + +static void +draw(void) +{ + static int count = 0; + static char frbuf[80]; + int i; + float fr, base, offset; + + dojoy(); + + glClear(GL_COLOR_BUFFER_BIT); + + glClear(GL_COLOR_BUFFER_BIT); + + if (usetex) + glEnable(GL_TEXTURE_2D); + else + glDisable(GL_TEXTURE_2D); + + if (fog) + glEnable(GL_FOG); + else + glDisable(GL_FOG); + + glShadeModel(GL_SMOOTH); + + glPushMatrix(); + calcposobs(); + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 0.0, 1.0); + + if (dir[0] > 0) { + offset = 8.0; + base = obs[0] - fmod(obs[0], 8.0); + } + else { + offset = -8.0; + base = obs[0] + (8.0 - fmod(obs[0], 8.0)); + } + + glPushMatrix(); + glTranslatef(base - offset / 2.0, 0.0, 0.0); + for (i = 0; i < NUMBLOC; i++) { + glTranslatef(offset, 0.0, 0.0); + glBindTexture(GL_TEXTURE_2D, t1id); + drawobjs(striplength_skin_11, stripdata_skin_11); + glBindTexture(GL_TEXTURE_2D, t2id); + drawobjs(striplength_skin_12, stripdata_skin_12); + drawobjs(striplength_skin_9, stripdata_skin_9); + drawobjs(striplength_skin_13, stripdata_skin_13); + } + glPopMatrix(); + glPopMatrix(); + + if ((count % FRAME) == 0) { + fr = gettime(); + sprintf(frbuf, "Frame rate: %f", FRAME / fr); + } + + glDisable(GL_TEXTURE_2D); + glDisable(GL_FOG); + glShadeModel(GL_FLAT); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1.0, 0.0, 0.0); + glRasterPos2i(10, 10); + printstring(GLUT_BITMAP_HELVETICA_18, frbuf); + glRasterPos2i(350, 470); + printstring(GLUT_BITMAP_HELVETICA_10, + "Tunnel2 V1.0 Written by David Bucciarelli (tech.hmw@plus.it)"); + + if (help) + printhelp(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + count++; +} + +static void +drawchannel0(void) +{ + glutSetWindow(channel[0]); + draw(); + glutSwapBuffers(); +} + +static void +drawchannel1(void) +{ + glutSetWindow(channel[1]); + draw(); + glutSwapBuffers(); +} + +static void +drawall(void) +{ + glutSetWindow(channel[0]); + draw(); + glutSetWindow(channel[1]); + draw(); + + glutSetWindow(channel[0]); + glutSwapBuffers(); + glutSetWindow(channel[1]); + glutSwapBuffers(); +} + +static void +init(void) +{ + float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 }; + + glShadeModel(GL_SMOOTH); + glDisable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP2); + glFogfv(GL_FOG_COLOR, fogcolor); + + glFogf(GL_FOG_DENSITY, 0.06); + glHint(GL_FOG_HINT, GL_NICEST); + + glEnable(GL_BLEND); + /* + glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE); + glEnable(GL_POLYGON_SMOOTH); + */ + + glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]); + glClear(GL_COLOR_BUFFER_BIT); +} + +int +main(int ac, char **av) +{ + fprintf(stderr, + "Tunnel2 V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); + fprintf(stderr, + "You need TWO Voodoo Graphics boards in order to run this demo !\n"); + + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTHC0, HEIGHTC0); + glutInit(&ac, av); + + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA); + +#ifdef FX + if (!fxMesaSelectCurrentBoard(0)) { + fprintf(stderr, "The first Voodoo Graphics board is missing !?!?\n"); + return -1; + } +#endif + if (!(channel[0] = glutCreateWindow("Channel 0"))) { + fprintf(stderr, "Error, couldn't open window\n"); + return -1; + } + + reshapechannel0(WIDTHC0, HEIGHTC0); + init(); + inittextures(); + glutDisplayFunc(drawchannel0); + glutReshapeFunc(reshapechannel0); + glutKeyboardFunc(key); + glutSpecialFunc(special); + +#ifdef FX + if (!fxMesaSelectCurrentBoard(1)) { + fprintf(stderr, "The second Voodoo Graphics board is missing !\n"); + exit(-1); + } +#endif + glutInitWindowPosition(WIDTHC0, 0); + glutInitWindowSize(WIDTHC1, HEIGHTC1); + if (!(channel[1] = glutCreateWindow("Channel 1"))) { + fprintf(stderr, "Error, couldn't open window\n"); + exit(-1); + } + + reshapechannel1(WIDTHC1, HEIGHTC1); + init(); + inittextures(); + glutDisplayFunc(drawchannel1); + glutReshapeFunc(reshapechannel1); + glutKeyboardFunc(key); + glutSpecialFunc(special); + + glutIdleFunc(drawall); + + calcposobs(); + + glutMainLoop(); + + return 0; +} diff --git a/xc/extras/Mesa/demos/tunneldat.c b/xc/extras/Mesa/demos/tunneldat.c new file mode 100644 index 000000000..a4506694b --- /dev/null +++ b/xc/extras/Mesa/demos/tunneldat.c @@ -0,0 +1,83 @@ +/* Object: skin_13 */ + +#if defined(_MSC_VER) && defined(_WIN32) +#pragma warning( disable : 4305 ) /* 'initializing' : truncation from 'const double' to 'float' */ +#endif + +int striplength_skin_13[]={ +10,7,3,5,5,4,4,4,4,5,3,4,5,4,4,4,4,4,4,6, +6,3,6,3,3,3,3,0}; + +float stripdata_skin_13[]={ +0.415686,0.415686,0.415686,1.000000,0.000000,1.500000,2.000000,4.000000,0.000000,0.341176,0.341176,0.341176,1.000000,-0.500000,1.500000,4.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.435294,0.435294,0.435294,1.000000,-0.500000,1.000000,4.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.450980,0.450980,0.450980,1.000000,-0.500000,0.500000,4.000000,4.000000,4.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.388235,0.388235,0.388235,1.000000,-0.500000,0.000000,4.000000,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,0.000000,-0.500000,2.000000,4.000000,8.000000,0.333333,0.333333,0.333333,1.000000,-0.500000,-0.500000,4.000000,4.000000,8.000000, +0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.415686,0.415686,0.415686,1.000000,1.000000,1.500000,-2.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.450980,0.450980,0.450980,1.000000,0.500000,1.500000,0.000000,4.000000,0.000000,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.415686,0.415686,0.415686,1.000000,0.000000,1.500000,2.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000, +0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.341176,0.341176,0.341176,1.000000,1.500000,1.500000,-4.000000,4.000000,0.000000,0.415686,0.415686,0.415686,1.000000,1.000000,1.500000,-2.000000,4.000000,0.000000, +0.356863,0.356863,0.356863,1.000000,0.000000,-0.500000,2.000000,4.000000,8.000000,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.415686,0.415686,0.415686,1.000000,0.395020,-0.133318,0.420032,4.000000,6.533272,0.423529,0.423529,0.423529,1.000000,0.388550,-0.103582,0.445932,4.000000,6.414327, +0.423529,0.423529,0.423529,1.000000,0.388550,-0.103582,0.445932,4.000000,6.414327,0.427451,0.427451,0.427451,1.000000,0.383423,-0.069344,0.466541,4.000000,6.277375,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.435294,0.435294,0.435294,1.000000,0.380371,-0.034595,0.478689,4.000000,6.138380,0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000, +0.407843,0.407843,0.407843,1.000000,0.414673,-0.191394,0.341301,4.000000,6.765576,0.411765,0.411765,0.411765,1.000000,0.403687,-0.162957,0.385368,4.000000,6.651829,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.415686,0.415686,0.415686,1.000000,0.395020,-0.133318,0.420032,4.000000,6.533272, +0.400000,0.400000,0.400000,1.000000,0.438232,-0.232438,0.247284,4.000000,6.929754,0.403922,0.403922,0.403922,1.000000,0.425171,-0.212276,0.299425,4.000000,6.849104,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.407843,0.407843,0.407843,1.000000,0.414673,-0.191394,0.341301,4.000000,6.765576, +0.396078,0.396078,0.396078,1.000000,0.467285,-0.260554,0.130636,4.000000,7.042214,0.400000,0.400000,0.400000,1.000000,0.453857,-0.250068,0.184711,4.000000,7.000273,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.400000,0.400000,0.400000,1.000000,0.438232,-0.232438,0.247284,4.000000,6.929754, +0.396078,0.396078,0.396078,1.000000,0.500000,-0.270672,0.000000,4.000000,7.082688,0.396078,0.396078,0.396078,1.000000,0.482788,-0.267902,0.068730,4.000000,7.071609,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.396078,0.396078,0.396078,1.000000,0.467285,-0.260554,0.130636,4.000000,7.042214, +0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,0.474510,0.474510,0.474510,1.000000,0.379272,0.180448,0.482673,4.000000,5.278208,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.513726,0.513726,0.513726,1.000000,0.379272,0.360896,0.482673,4.000000,4.556417,0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000, +0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000, +0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.552941,0.552941,0.552941,1.000000,0.379272,0.541344,0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000, +0.552941,0.552941,0.552941,1.000000,0.379272,0.541344,0.482673,4.000000,3.834625,0.556863,0.556863,0.556863,1.000000,0.459717,0.541344,0.160891,4.000000,3.834625,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.556863,0.556863,0.556863,1.000000,0.500000,0.541344,0.000000,4.000000,3.834625,0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625, +0.396078,0.396078,0.396078,1.000000,0.517212,-0.267902,-0.068730,4.000000,7.071609,0.396078,0.396078,0.396078,1.000000,0.500000,-0.270672,0.000000,4.000000,7.082688,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000, +0.400000,0.400000,0.400000,1.000000,0.546143,-0.250068,-0.184711,4.000000,7.000273,0.396078,0.396078,0.396078,1.000000,0.532715,-0.260554,-0.130636,4.000000,7.042214,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.396078,0.396078,0.396078,1.000000,0.517212,-0.267902,-0.068730,4.000000,7.071609, +0.403922,0.403922,0.403922,1.000000,0.574829,-0.212276,-0.299425,4.000000,6.849104,0.400000,0.400000,0.400000,1.000000,0.561768,-0.232438,-0.247284,4.000000,6.929754,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.400000,0.400000,0.400000,1.000000,0.546143,-0.250068,-0.184711,4.000000,7.000273, +0.411765,0.411765,0.411765,1.000000,0.596313,-0.162957,-0.385368,4.000000,6.651829,0.407843,0.407843,0.407843,1.000000,0.585327,-0.191394,-0.341301,4.000000,6.765576,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.403922,0.403922,0.403922,1.000000,0.574829,-0.212276,-0.299425,4.000000,6.849104, +0.423529,0.423529,0.423529,1.000000,0.611450,-0.103582,-0.445931,4.000000,6.414327,0.415686,0.415686,0.415686,1.000000,0.604980,-0.133318,-0.420033,4.000000,6.533272,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.411765,0.411765,0.411765,1.000000,0.596313,-0.162957,-0.385368,4.000000,6.651829, +0.435294,0.435294,0.435294,1.000000,0.619629,-0.034595,-0.478689,4.000000,6.138380,0.427451,0.427451,0.427451,1.000000,0.616577,-0.069344,-0.466541,4.000000,6.277375,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.423529,0.423529,0.423529,1.000000,0.611450,-0.103582,-0.445931,4.000000,6.414327, +0.513726,0.513726,0.513726,1.000000,0.620728,0.360896,-0.482673,4.000000,4.556417,0.474510,0.474510,0.474510,1.000000,0.620728,0.180448,-0.482673,4.000000,5.278208,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.439216,0.439216,0.439216,1.000000,0.620728,0.000000,-0.482673,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.435294,0.435294,0.435294,1.000000,0.619629,-0.034595,-0.478689,4.000000,6.138380, +0.333333,0.333333,0.333333,1.000000,1.500000,-0.500000,-4.000000,4.000000,8.000000,0.388235,0.388235,0.388235,1.000000,1.500000,0.000000,-4.000000,4.000000,6.000000,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.513726,0.513726,0.513726,1.000000,0.620728,0.360896,-0.482673,4.000000,4.556417,0.545098,0.545098,0.545098,1.000000,0.620728,0.500000,-0.482673,4.000000,4.000000, +0.333333,0.333333,0.333333,1.000000,1.500000,-0.500000,-4.000000,4.000000,8.000000,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000, +0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,0.552941,0.552941,0.552941,1.000000,0.620728,0.541344,-0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.450980,0.450980,0.450980,1.000000,1.500000,0.500000,-4.000000,4.000000,4.000000,0.388235,0.388235,0.388235,1.000000,1.500000,0.000000,-4.000000,4.000000,6.000000, +0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.552941,0.552941,0.552941,1.000000,0.620728,0.541344,-0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,0.620728,0.500000,-0.482673,4.000000,4.000000, +0.450980,0.450980,0.450980,1.000000,1.500000,0.500000,-4.000000,4.000000,4.000000,0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000, +0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000, +0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000 + +}; + + +/* Object: skin_12 */ + +int striplength_skin_12[]={ +12,12,12,12,12,0}; + +float stripdata_skin_12[]={ +0.498039,0.498039,0.498039,1.000000,-0.099976,1.500000,-2.400000,-4.000000,-0.000002,0.337255,0.337255,0.337255,1.000000,-0.500000,1.500000,-4.000000,-4.000000,-0.000002,0.568627,0.568627,0.568627,1.000000,-0.099976,1.100000,-2.400000,-4.000000,1.599999,0.341176,0.341176,0.341176,1.000000,-0.500000,1.100000,-4.000000,-4.000000,1.599999,0.498039,0.498039,0.498039,1.000000,-0.099976,0.700000,-2.400000,-4.000000,3.200000,0.325490,0.325490,0.325490,1.000000,-0.500000,0.700000,-4.000000,-4.000000,3.199999,0.352941,0.352941,0.352941,1.000000,-0.099976,0.300000,-2.400000,-4.000000,4.800000,0.282353,0.282353,0.282353,1.000000,-0.500000,0.300000,-4.000000,-4.000000,4.800000,0.282353,0.282353,0.282353,1.000000,-0.099976,-0.100000,-2.400000,-4.000000,6.400001,0.254902,0.254902,0.254902,1.000000,-0.500000,-0.100000,-4.000000,-4.000000,6.400000,0.239216,0.239216,0.239216,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,8.000000,0.227451,0.227451,0.227451,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,8.000000, +0.239216,0.239216,0.239216,1.000000,1.099976,-0.500000,2.400001,-4.000000,8.000000,0.227451,0.227451,0.227451,1.000000,1.500000,-0.500000,4.000002,-4.000000,8.000000,0.282353,0.282353,0.282353,1.000000,1.099976,-0.100000,2.400001,-4.000000,6.400001,0.254902,0.254902,0.254902,1.000000,1.500000,-0.100000,4.000002,-4.000000,6.400001,0.352941,0.352941,0.352941,1.000000,1.099976,0.300000,2.400002,-4.000000,4.800001,0.282353,0.282353,0.282353,1.000000,1.500000,0.300000,4.000002,-4.000000,4.800001,0.498039,0.498039,0.498039,1.000000,1.099976,0.700000,2.400002,-4.000000,3.200000,0.321569,0.321569,0.321569,1.000000,1.500000,0.700000,4.000003,-4.000000,3.200000,0.568627,0.568627,0.568627,1.000000,1.099976,1.100000,2.400002,-4.000000,1.599999,0.341176,0.341176,0.341176,1.000000,1.500000,1.100000,4.000003,-4.000000,1.599999,0.494118,0.494118,0.494118,1.000000,1.099976,1.500000,2.400003,-4.000000,-0.000002,0.337255,0.337255,0.337255,1.000000,1.500000,1.500000,4.000004,-4.000000,-0.000002, +0.639216,0.639216,0.639216,1.000000,0.300049,1.500000,-0.799999,-4.000000,-0.000002,0.498039,0.498039,0.498039,1.000000,-0.099976,1.500000,-2.400000,-4.000000,-0.000002,0.858824,0.858824,0.858824,1.000000,0.300049,1.100000,-0.799999,-4.000000,1.599999,0.568627,0.568627,0.568627,1.000000,-0.099976,1.100000,-2.400000,-4.000000,1.599999,0.686275,0.686275,0.686275,1.000000,0.300049,0.700000,-0.799999,-4.000000,3.200000,0.498039,0.498039,0.498039,1.000000,-0.099976,0.700000,-2.400000,-4.000000,3.200000,0.419608,0.419608,0.419608,1.000000,0.300049,0.300000,-0.800000,-4.000000,4.800000,0.352941,0.352941,0.352941,1.000000,-0.099976,0.300000,-2.400000,-4.000000,4.800000,0.298039,0.298039,0.298039,1.000000,0.300049,-0.100000,-0.800000,-4.000000,6.400001,0.282353,0.282353,0.282353,1.000000,-0.099976,-0.100000,-2.400000,-4.000000,6.400001,0.247059,0.247059,0.247059,1.000000,0.300049,-0.500000,-0.800000,-4.000000,8.000000,0.239216,0.239216,0.239216,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,8.000000, +0.639216,0.639216,0.639216,1.000000,0.699951,1.500000,0.800002,-4.000000,-0.000002,0.639216,0.639216,0.639216,1.000000,0.300049,1.500000,-0.799999,-4.000000,-0.000002,0.858824,0.858824,0.858824,1.000000,0.699951,1.100000,0.800001,-4.000000,1.599999,0.858824,0.858824,0.858824,1.000000,0.300049,1.100000,-0.799999,-4.000000,1.599999,0.686275,0.686275,0.686275,1.000000,0.699951,0.700000,0.800001,-4.000000,3.200000,0.686275,0.686275,0.686275,1.000000,0.300049,0.700000,-0.799999,-4.000000,3.200000,0.419608,0.419608,0.419608,1.000000,0.699951,0.300000,0.800001,-4.000000,4.800001,0.419608,0.419608,0.419608,1.000000,0.300049,0.300000,-0.800000,-4.000000,4.800000,0.298039,0.298039,0.298039,1.000000,0.699951,-0.100000,0.800001,-4.000000,6.400001,0.298039,0.298039,0.298039,1.000000,0.300049,-0.100000,-0.800000,-4.000000,6.400001,0.247059,0.247059,0.247059,1.000000,0.699951,-0.500000,0.800000,-4.000000,8.000000,0.247059,0.247059,0.247059,1.000000,0.300049,-0.500000,-0.800000,-4.000000,8.000000, +0.494118,0.494118,0.494118,1.000000,1.099976,1.500000,2.400003,-4.000000,-0.000002,0.639216,0.639216,0.639216,1.000000,0.699951,1.500000,0.800002,-4.000000,-0.000002,0.568627,0.568627,0.568627,1.000000,1.099976,1.100000,2.400002,-4.000000,1.599999,0.858824,0.858824,0.858824,1.000000,0.699951,1.100000,0.800001,-4.000000,1.599999,0.498039,0.498039,0.498039,1.000000,1.099976,0.700000,2.400002,-4.000000,3.200000,0.686275,0.686275,0.686275,1.000000,0.699951,0.700000,0.800001,-4.000000,3.200000,0.352941,0.352941,0.352941,1.000000,1.099976,0.300000,2.400002,-4.000000,4.800001,0.419608,0.419608,0.419608,1.000000,0.699951,0.300000,0.800001,-4.000000,4.800001,0.282353,0.282353,0.282353,1.000000,1.099976,-0.100000,2.400001,-4.000000,6.400001,0.298039,0.298039,0.298039,1.000000,0.699951,-0.100000,0.800001,-4.000000,6.400001,0.239216,0.239216,0.239216,1.000000,1.099976,-0.500000,2.400001,-4.000000,8.000000,0.247059,0.247059,0.247059,1.000000,0.699951,-0.500000,0.800000,-4.000000,8.000000 + +}; + + +/* Object: skin_11 */ + +int striplength_skin_11[]={ +12,12,12,12,12,0}; + +float stripdata_skin_11[]={ +0.145098,0.145098,0.145098,1.000000,-0.099976,1.500000,-2.400000,4.000002,0.000000,0.141176,0.141176,0.141176,1.000000,-0.500000,1.500000,-4.000000,4.000002,0.000000,0.176471,0.176471,0.176471,1.000000,-0.099976,1.100000,-2.400000,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,-0.500000,1.100000,-4.000000,2.400001,0.000000,0.341176,0.341176,0.341176,1.000000,-0.099976,0.700000,-2.400000,0.800000,0.000000,0.188235,0.188235,0.188235,1.000000,-0.500000,0.700000,-4.000000,0.800000,0.000000,0.450980,0.450980,0.450980,1.000000,-0.099976,0.300000,-2.400000,-0.800000,0.000000,0.247059,0.247059,0.247059,1.000000,-0.500000,0.300000,-4.000000,-0.800000,0.000000,0.439216,0.439216,0.439216,1.000000,-0.099976,-0.100000,-2.400000,-2.400000,0.000000,0.270588,0.270588,0.270588,1.000000,-0.500000,-0.100000,-4.000000,-2.400000,0.000000,0.364706,0.364706,0.364706,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,0.000000,0.258824,0.258824,0.258824,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,0.000000, +0.364706,0.364706,0.364706,1.000000,1.099976,-0.500000,2.400001,-4.000000,0.000000,0.258824,0.258824,0.258824,1.000000,1.500000,-0.500000,4.000002,-4.000000,0.000000,0.439216,0.439216,0.439216,1.000000,1.099976,-0.100000,2.400001,-2.400001,0.000000,0.270588,0.270588,0.270588,1.000000,1.500000,-0.100000,4.000002,-2.400001,0.000000,0.454902,0.454902,0.454902,1.000000,1.099976,0.300000,2.400002,-0.800000,0.000000,0.247059,0.247059,0.247059,1.000000,1.500000,0.300000,4.000002,-0.800000,0.000000,0.341176,0.341176,0.341176,1.000000,1.099976,0.700000,2.400002,0.800000,0.000000,0.184314,0.184314,0.184314,1.000000,1.500000,0.700000,4.000003,0.800000,0.000000,0.176471,0.176471,0.176471,1.000000,1.099976,1.100000,2.400002,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,1.500000,1.100000,4.000003,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,1.099976,1.500000,2.400003,4.000003,0.000000,0.141176,0.141176,0.141176,1.000000,1.500000,1.500000,4.000004,4.000002,0.000000, +0.145098,0.145098,0.145098,1.000000,0.300049,1.500000,-0.799999,4.000002,0.000000,0.145098,0.145098,0.145098,1.000000,-0.099976,1.500000,-2.400000,4.000002,0.000000,0.262745,0.262745,0.262745,1.000000,0.300049,1.100000,-0.799999,2.400001,0.000000,0.176471,0.176471,0.176471,1.000000,-0.099976,1.100000,-2.400000,2.400001,0.000000,0.580392,0.580392,0.580392,1.000000,0.300049,0.700000,-0.799999,0.800000,0.000000,0.341176,0.341176,0.341176,1.000000,-0.099976,0.700000,-2.400000,0.800000,0.000000,0.709804,0.709804,0.709804,1.000000,0.300049,0.300000,-0.800000,-0.800000,0.000000,0.450980,0.450980,0.450980,1.000000,-0.099976,0.300000,-2.400000,-0.800000,0.000000,0.627451,0.627451,0.627451,1.000000,0.300049,-0.100000,-0.800000,-2.400001,0.000000,0.439216,0.439216,0.439216,1.000000,-0.099976,-0.100000,-2.400000,-2.400000,0.000000,0.458824,0.458824,0.458824,1.000000,0.300049,-0.500000,-0.800000,-4.000000,0.000000,0.364706,0.364706,0.364706,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,0.000000, +0.145098,0.145098,0.145098,1.000000,0.699951,1.500000,0.800002,4.000002,0.000000,0.145098,0.145098,0.145098,1.000000,0.300049,1.500000,-0.799999,4.000002,0.000000,0.262745,0.262745,0.262745,1.000000,0.699951,1.100000,0.800001,2.400001,0.000000,0.262745,0.262745,0.262745,1.000000,0.300049,1.100000,-0.799999,2.400001,0.000000,0.580392,0.580392,0.580392,1.000000,0.699951,0.700000,0.800001,0.800000,0.000000,0.580392,0.580392,0.580392,1.000000,0.300049,0.700000,-0.799999,0.800000,0.000000,0.713726,0.713726,0.713726,1.000000,0.699951,0.300000,0.800001,-0.800000,0.000000,0.709804,0.709804,0.709804,1.000000,0.300049,0.300000,-0.800000,-0.800000,0.000000,0.631373,0.631373,0.631373,1.000000,0.699951,-0.100000,0.800001,-2.400001,0.000000,0.627451,0.627451,0.627451,1.000000,0.300049,-0.100000,-0.800000,-2.400001,0.000000,0.458824,0.458824,0.458824,1.000000,0.699951,-0.500000,0.800000,-4.000000,0.000000,0.458824,0.458824,0.458824,1.000000,0.300049,-0.500000,-0.800000,-4.000000,0.000000, +0.145098,0.145098,0.145098,1.000000,1.099976,1.500000,2.400003,4.000003,0.000000,0.145098,0.145098,0.145098,1.000000,0.699951,1.500000,0.800002,4.000002,0.000000,0.176471,0.176471,0.176471,1.000000,1.099976,1.100000,2.400002,2.400001,0.000000,0.262745,0.262745,0.262745,1.000000,0.699951,1.100000,0.800001,2.400001,0.000000,0.341176,0.341176,0.341176,1.000000,1.099976,0.700000,2.400002,0.800000,0.000000,0.580392,0.580392,0.580392,1.000000,0.699951,0.700000,0.800001,0.800000,0.000000,0.454902,0.454902,0.454902,1.000000,1.099976,0.300000,2.400002,-0.800000,0.000000,0.713726,0.713726,0.713726,1.000000,0.699951,0.300000,0.800001,-0.800000,0.000000,0.439216,0.439216,0.439216,1.000000,1.099976,-0.100000,2.400001,-2.400001,0.000000,0.631373,0.631373,0.631373,1.000000,0.699951,-0.100000,0.800001,-2.400001,0.000000,0.364706,0.364706,0.364706,1.000000,1.099976,-0.500000,2.400001,-4.000000,0.000000,0.458824,0.458824,0.458824,1.000000,0.699951,-0.500000,0.800000,-4.000000,0.000000 + +}; + + +/* Object: skin_9 */ + +int striplength_skin_9[]={ +18,0}; + +float stripdata_skin_9[]={ +0.384314,0.384314,0.384314,1.000000,-0.500000,1.500000,-4.000000,4.000000,8.000000,0.384314,0.384314,0.384314,1.000000,1.500000,1.500000,4.000000,4.000000,8.000000,0.376471,0.376471,0.376471,1.000000,-0.500000,1.250000,-4.000000,3.695518,9.530733,0.403922,0.403922,0.403922,1.000000,1.500000,1.250000,4.000000,3.695518,9.530733,0.415686,0.415686,0.415686,1.000000,-0.500000,1.000000,-4.000000,2.828427,10.828427,0.431373,0.431373,0.431373,1.000000,1.500000,1.000000,4.000000,2.828427,10.828427,0.435294,0.435294,0.435294,1.000000,-0.500000,0.750000,-4.000000,1.530734,11.695518,0.443137,0.443137,0.443137,1.000000,1.500000,0.750000,4.000000,1.530734,11.695518,0.439216,0.439216,0.439216,1.000000,-0.500000,0.500000,-4.000000,0.000000,12.000000,0.435294,0.435294,0.435294,1.000000,1.500000,0.500000,4.000000,0.000000,12.000000,0.427451,0.427451,0.427451,1.000000,-0.500000,0.250000,-4.000000,-1.530734,11.695518,0.411765,0.411765,0.411765,1.000000,1.500000,0.250000,4.000000,-1.530734,11.695518,0.396078,0.396078,0.396078,1.000000,-0.500000,0.000000,-4.000000,-2.828427,10.828427,0.368627,0.368627,0.368627,1.000000,1.500000,0.000000,4.000000,-2.828427,10.828427,0.341176,0.341176,0.341176,1.000000,-0.500000,-0.250000,-4.000000,-3.695518,9.530733,0.301961,0.301961,0.301961,1.000000,1.500000,-0.250000,4.000000,-3.695518,9.530733,0.294118,0.294118,0.294118,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,8.000000,0.294118,0.294118,0.294118,1.000000,1.500000,-0.500000,4.000000,-4.000000,8.000000 + +}; + + diff --git a/xc/extras/Mesa/demos/winpos.c b/xc/extras/Mesa/demos/winpos.c new file mode 100644 index 000000000..0a7ef60f3 --- /dev/null +++ b/xc/extras/Mesa/demos/winpos.c @@ -0,0 +1,135 @@ +/* $Id: winpos.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Example of how to use the GL_MESA_window_pos extension. + * Brian Paul This file is in the public domain. + */ + + +/* + * $Log: winpos.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:38 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 2000/06/27 17:04:43 brianp + * fixed compiler warnings + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources + * + * Revision 3.3 1999/03/28 18:24:37 brianp + * minor clean-up + * + * Revision 3.2 1998/11/05 04:34:04 brianp + * moved image files to ../images/ directory + * + * Revision 3.1 1998/02/22 16:36:10 brianp + * changed image file and set unpack alignment to 1 + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include <math.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#define GL_GLEXT_LEGACY +#include "GL/glut.h" + +#include "../util/readtex.c" /* a hack, I know */ + +#define IMAGE_FILE "../images/girl.rgb" + + +#ifndef M_PI +# define M_PI 3.14159265 +#endif + + + +static GLubyte *Image; +static int ImgWidth, ImgHeight; +static GLenum ImgFormat; + + + +static void draw( void ) +{ + 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 ); + + for (angle = -45.0; angle <= 135.0; angle += 10.0) { + GLfloat x = 50.0 + 200.0 * cos( 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!!! */ +#ifdef GL_MESA_window_pos + glWindowPos2fMESA( x, y ); +#endif + glDrawPixels( ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image ); + } +} + + + + +static void key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + } +} + + + +/* new window size or exposure */ +static void reshape( int width, int height ) +{ + glViewport(0, 0, (GLint)width, (GLint)height); +} + + +static void init( void ) +{ + Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat ); + if (!Image) { + printf("Couldn't read %s\n", IMAGE_FILE); + exit(0); + } + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); +} + + + +int main( int argc, char *argv[] ) +{ + glutInitWindowPosition(0, 0); + glutInitWindowSize(500, 500); + glutInitDisplayMode( GLUT_RGB ); + + if (glutCreateWindow("winpos") <= 0) { + exit(0); + } + + init(); + + glutReshapeFunc( reshape ); + glutKeyboardFunc( key ); + glutDisplayFunc( draw ); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/docs/VERSIONS b/xc/extras/Mesa/docs/VERSIONS index 15deb82c5..c503de8a6 100644 --- a/xc/extras/Mesa/docs/VERSIONS +++ b/xc/extras/Mesa/docs/VERSIONS @@ -1,4 +1,4 @@ -$Id: VERSIONS,v 1.1.1.1 2000/11/30 17:31:36 dawes Exp $ +$Id: VERSIONS,v 1.1.1.2 2000/12/05 16:38:42 dawes Exp $ Mesa Version History @@ -775,3 +775,17 @@ Mesa Version History Changes: - finished internal support for compressed textures for DRI + +3.4.1 December ??, 2000 + New: + - fixed some Linux build problems + - fixed some Windows build problems + Bug fixes: + - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI + - various state-update code changes needed for DRI bugs + - disabled pixel transfer ops in glColorTable commands, not needed + - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter + - updated sources and fixed compile problems in widgets-mesa/ + - GLX_PBUFFER enum value was wrong in glx.h + - fixed a glColorMaterial lighting bug + - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function diff --git a/xc/extras/Mesa/fixam b/xc/extras/Mesa/fixam new file mode 100755 index 000000000..bd9757c5d --- /dev/null +++ b/xc/extras/Mesa/fixam @@ -0,0 +1,51 @@ +#! /bin/sh + +# (c) Copyright 1999, Thomas Tanner <tanner@ffii.org> +# Disables/enables automake's automatic dependency tracking +# since automake 1.4 doesn't support this feature on non-GNU systems. +# Developers using a non-GNU system (no GNU make and GCC installed) +# must execute +# fixam +# before running bootstrap and +# fixam -r +# before doing a CVS checkin. +# Normally, on GNU systems (both GCC and GNU make installed) +# this script has no effect. However, you can force it to assume +# a non-GNU system using the -f argument. + +undo=no +force=no +while test $# -gt 0 +do + arg="$1" + shift + case "$arg" in + -f) force=yes ;; + -r) undo=yes ;; + esac +done + +if test $force = no && (cc -v 2>&1 | grep gcc > /dev/null) && + (make -v 2>&1 | grep GNU > /dev/null); then + # GCC and GNU make installed + echo "nothing to do." + exit 0 +fi + +files=`find -name "Makefile.am"` +for file in $files; do + if grep "AUTOMAKE_OPTIONS = no-dependencies" $file > /dev/null; then + echo "fixing $file" + if test $undo = no; then + # uncomment it -> disable automatic dependency tracking + sed -e "s/^\#AUTOMAKE_OPTIONS/AUTOMAKE_OPTIONS/g" $file > $file.tmp + else + # comment it out -> enable automatic dependency tracking + sed -e "s/^AUTOMAKE_OPTIONS/\#AUTOMAKE_OPTIONS/g" $file > $file.tmp + fi + mv -f $file.tmp $file + fi +done +echo "done." + +exit 0 diff --git a/xc/extras/Mesa/include/GL/glut.h b/xc/extras/Mesa/include/GL/glut.h new file mode 100644 index 000000000..3b5cbb2f4 --- /dev/null +++ b/xc/extras/Mesa/include/GL/glut.h @@ -0,0 +1,766 @@ +#ifndef __glut_h__ +#define __glut_h__ + +/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */ + +/* 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 <GL/gl.h> +#include <GL/glu.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) + +/* GLUT 3.7 now tries to avoid including <windows.h> + to avoid name space pollution, but Win32's <GL/gl.h> + needs APIENTRY and WINGDIAPI defined properly. + + tjump@spgs.com contributes: + If users are building glut code on MS Windows, then they should + make sure they include windows.h early, let's not get into a + header definitions war since MS has proven it's capability to + change header dependencies w/o publishing they have done so. + + So, let's not include windows.h here, as it's not really required and + MS own gl/gl.h *should* include it if the dependency is there. */ + +/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA + in your compile preprocessor options. */ +# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) +# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */ +/* To enable automatic SGI OpenGL for Windows library usage for GLUT, + define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */ +# ifdef GLUT_USE_SGI_OPENGL +# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */ +# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */ +# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */ +# else +# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */ +# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */ +# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */ +# endif +# endif + +/* To disable supression of annoying warnings about floats being promoted + to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor + options. */ +# ifndef GLUT_NO_WARNING_DISABLE +# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */ +# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ +# endif + +/* Win32 has an annoying issue where there are multiple C run-time + libraries (CRTs). If the executable is linked with a different CRT + from the GLUT DLL, the GLUT DLL will not share the same CRT static + data seen by the executable. In particular, atexit callbacks registered + in the executable will not be called if GLUT calls its (different) + exit routine). GLUT is typically built with the + "/MD" option (the CRT with multithreading DLL support), but the Visual + C++ linker default is "/ML" (the single threaded CRT). + + One workaround to this issue is requiring users to always link with + the same CRT as GLUT is compiled with. That requires users supply a + non-standard option. GLUT 3.7 has its own built-in workaround where + the executable's "exit" function pointer is covertly passed to GLUT. + GLUT then calls the executable's exit function pointer to ensure that + any "atexit" calls registered by the application are called if GLUT + needs to exit. + + Note that the __glut*WithExit routines should NEVER be called directly. + To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */ + +/* XXX This is from Win32's <process.h> */ +# if !defined(_MSC_VER) && !defined(__cdecl) + /* Define __cdecl for non-Microsoft compilers. */ +# define __cdecl +# define GLUT_DEFINED___CDECL +# endif +# ifndef _CRTIMP +# ifdef _NTSDK + /* Definition compatible with NT SDK */ +# define _CRTIMP +# else + /* Current definition */ +# ifdef _DLL +# define _CRTIMP __declspec(dllimport) +# else +# define _CRTIMP +# endif +# endif +# define GLUT_DEFINED__CRTIMP +# endif +# ifndef GLUT_BUILDING_LIB +extern _CRTIMP void __cdecl exit(int); +# endif + +/* GLUT callback calling convention for Win32. */ +# define GLUTCALLBACK __cdecl + +/* for callback/function pointer defs */ +# define GLUTAPIENTRYV __cdecl + +/* glut-win32 specific macros, defined to prevent collision with + and redifinition of Windows system defs, also removes requirement of + pretty much any standard windows header from this file */ + +#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__) +# define GLUTAPIENTRY __stdcall +#else +# define GLUTAPIENTRY +#endif + +/* GLUT API entry point declarations for Win32. */ +#if defined(GLUT_BUILDING_LIB) && defined(_DLL) +# define GLUTAPI __declspec(dllexport) +#elif defined(_DLL) +# define GLUTAPI __declspec(dllimport) +#else +# define GLUTAPI extern +#endif + +#if defined(_WIN32) && !defined(_WINDEF_) && !defined(MESA) +# if !defined(MESA_MINWARN) +# pragma message( "note: WINDOWS.H not included, providing Mesa definition of CALLBACK macro" ) +# pragma message( "----: and PROC typedef. If you receive compiler warnings about either ") +# pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" ) +# endif +# define CALLBACK __stdcall +typedef int (GLUTAPIENTRY *PROC)(); +typedef void *HGLRC; +typedef void *HDC; +typedef unsigned long COLORREF; +#endif + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(MESA) +# if !defined(MESA_MINWARN) +# pragma message( "note: WINDOWS.H not included, providing Mesa definition of wgl functions" ) +# pragma message( "----: and macros. If you receive compiler warnings about any being multiply ") +# pragma message( "----: defined you should include WINDOWS.H priot to gl/glut.h" ) +# endif +# define WGL_FONT_LINES 0 +# define WGL_FONT_POLYGONS 1 +# ifdef UNICODE +# define wglUseFontBitmaps wglUseFontBitmapsW +# define wglUseFontOutlines wglUseFontOutlinesW +# else +# define wglUseFontBitmaps wglUseFontBitmapsA +# define wglUseFontOutlines wglUseFontOutlinesA +# endif /* !UNICODE */ +typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; +typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; +# pragma warning( push ) +# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */ +# define WGLAPI __declspec(dllimport) +WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); +WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC); +WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc); +WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void); +WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); +WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); +WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void); +WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*); +WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); +WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); +WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR); +WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); +WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *); +WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); +WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC); +WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int); +WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *); +WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC); +WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int); +WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long); +WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); +WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); +WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); +WGLAPI int GLAPIENTRY SwapBuffers(HDC); +WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR); +WGLAPI int GLAPIENTRY GetPixelFormat(HDC); +WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); +# undef WGLAPI +# pragma warning( pop ) +#endif + +#else /* _WIN32 not defined */ + +/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */ +# define GLUTAPIENTRY +# define GLUTAPIENTRYV +# define GLUT_APIENTRY_DEFINED +# define GLUTCALLBACK +# define GLUTAPI extern +/* Prototype exit for the non-Win32 case (see above). */ +/*extern void exit(int); this screws up gcc -ansi -pedantic! */ +#endif + + +/** + GLUT API revision history: + + GLUT_API_VERSION is updated to reflect incompatible GLUT + API changes (interface changes, semantic changes, deletions, + or additions). + + GLUT_API_VERSION=1 First public release of GLUT. 11/29/94 + + GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling, + extension. Supports new input devices like tablet, dial and button + box, and Spaceball. Easy to query OpenGL extensions. + + GLUT_API_VERSION=3 glutMenuStatus added. + + GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer, + glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic + video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc, + glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat, + glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). +**/ +#ifndef GLUT_API_VERSION /* allow this to be overriden */ +#define GLUT_API_VERSION 3 +#endif + +/** + GLUT implementation revision history: + + GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT + API revisions and implementation revisions (ie, bug fixes). + + GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of + GLUT Xlib-based implementation. 11/29/94 + + GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of + GLUT Xlib-based implementation providing GLUT version 2 + interfaces. + + GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95 + + GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95 + + GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95 + + GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96 + + GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner + and video resize. 1/3/97 + + GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines. + + GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release. + + GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling. + + GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support. + + GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface. + + GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h> +**/ +#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */ +#define GLUT_XLIB_IMPLEMENTATION 15 +#endif + +/* Display mode bit masks. */ +#define GLUT_RGB 0 +#define GLUT_RGBA GLUT_RGB +#define GLUT_INDEX 1 +#define GLUT_SINGLE 0 +#define GLUT_DOUBLE 2 +#define GLUT_ACCUM 4 +#define GLUT_ALPHA 8 +#define GLUT_DEPTH 16 +#define GLUT_STENCIL 32 +#if (GLUT_API_VERSION >= 2) +#define GLUT_MULTISAMPLE 128 +#define GLUT_STEREO 256 +#endif +#if (GLUT_API_VERSION >= 3) +#define GLUT_LUMINANCE 512 +#endif + +/* Mouse buttons. */ +#define GLUT_LEFT_BUTTON 0 +#define GLUT_MIDDLE_BUTTON 1 +#define GLUT_RIGHT_BUTTON 2 + +/* Mouse button state. */ +#define GLUT_DOWN 0 +#define GLUT_UP 1 + +#if (GLUT_API_VERSION >= 2) +/* function keys */ +#define GLUT_KEY_F1 1 +#define GLUT_KEY_F2 2 +#define GLUT_KEY_F3 3 +#define GLUT_KEY_F4 4 +#define GLUT_KEY_F5 5 +#define GLUT_KEY_F6 6 +#define GLUT_KEY_F7 7 +#define GLUT_KEY_F8 8 +#define GLUT_KEY_F9 9 +#define GLUT_KEY_F10 10 +#define GLUT_KEY_F11 11 +#define GLUT_KEY_F12 12 +/* directional keys */ +#define GLUT_KEY_LEFT 100 +#define GLUT_KEY_UP 101 +#define GLUT_KEY_RIGHT 102 +#define GLUT_KEY_DOWN 103 +#define GLUT_KEY_PAGE_UP 104 +#define GLUT_KEY_PAGE_DOWN 105 +#define GLUT_KEY_HOME 106 +#define GLUT_KEY_END 107 +#define GLUT_KEY_INSERT 108 +#endif + +/* Entry/exit state. */ +#define GLUT_LEFT 0 +#define GLUT_ENTERED 1 + +/* Menu usage state. */ +#define GLUT_MENU_NOT_IN_USE 0 +#define GLUT_MENU_IN_USE 1 + +/* Visibility state. */ +#define GLUT_NOT_VISIBLE 0 +#define GLUT_VISIBLE 1 + +/* Window status state. */ +#define GLUT_HIDDEN 0 +#define GLUT_FULLY_RETAINED 1 +#define GLUT_PARTIALLY_RETAINED 2 +#define GLUT_FULLY_COVERED 3 + +/* Color index component selection values. */ +#define GLUT_RED 0 +#define GLUT_GREEN 1 +#define GLUT_BLUE 2 + +/* Layers for use. */ +#define GLUT_NORMAL 0 +#define GLUT_OVERLAY 1 + +#if defined(_WIN32) +/* Stroke font constants (use these in GLUT program). */ +#define GLUT_STROKE_ROMAN ((void*)0) +#define GLUT_STROKE_MONO_ROMAN ((void*)1) + +/* Bitmap font constants (use these in GLUT program). */ +#define GLUT_BITMAP_9_BY_15 ((void*)2) +#define GLUT_BITMAP_8_BY_13 ((void*)3) +#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4) +#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5) +#if (GLUT_API_VERSION >= 3) +#define GLUT_BITMAP_HELVETICA_10 ((void*)6) +#define GLUT_BITMAP_HELVETICA_12 ((void*)7) +#define GLUT_BITMAP_HELVETICA_18 ((void*)8) +#endif +#else +/* Stroke font opaque addresses (use constants instead in source code). */ +GLUTAPI void *glutStrokeRoman; +GLUTAPI void *glutStrokeMonoRoman; + +/* Stroke font constants (use these in GLUT program). */ +#define GLUT_STROKE_ROMAN (&glutStrokeRoman) +#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) + +/* Bitmap font opaque addresses (use constants instead in source code). */ +GLUTAPI void *glutBitmap9By15; +GLUTAPI void *glutBitmap8By13; +GLUTAPI void *glutBitmapTimesRoman10; +GLUTAPI void *glutBitmapTimesRoman24; +GLUTAPI void *glutBitmapHelvetica10; +GLUTAPI void *glutBitmapHelvetica12; +GLUTAPI void *glutBitmapHelvetica18; + +/* Bitmap font constants (use these in GLUT program). */ +#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) +#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) +#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) +#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) +#if (GLUT_API_VERSION >= 3) +#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) +#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) +#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) +#endif +#endif + +/* glutGet parameters. */ +#define GLUT_WINDOW_X 100 +#define GLUT_WINDOW_Y 101 +#define GLUT_WINDOW_WIDTH 102 +#define GLUT_WINDOW_HEIGHT 103 +#define GLUT_WINDOW_BUFFER_SIZE 104 +#define GLUT_WINDOW_STENCIL_SIZE 105 +#define GLUT_WINDOW_DEPTH_SIZE 106 +#define GLUT_WINDOW_RED_SIZE 107 +#define GLUT_WINDOW_GREEN_SIZE 108 +#define GLUT_WINDOW_BLUE_SIZE 109 +#define GLUT_WINDOW_ALPHA_SIZE 110 +#define GLUT_WINDOW_ACCUM_RED_SIZE 111 +#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112 +#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113 +#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114 +#define GLUT_WINDOW_DOUBLEBUFFER 115 +#define GLUT_WINDOW_RGBA 116 +#define GLUT_WINDOW_PARENT 117 +#define GLUT_WINDOW_NUM_CHILDREN 118 +#define GLUT_WINDOW_COLORMAP_SIZE 119 +#if (GLUT_API_VERSION >= 2) +#define GLUT_WINDOW_NUM_SAMPLES 120 +#define GLUT_WINDOW_STEREO 121 +#endif +#if (GLUT_API_VERSION >= 3) +#define GLUT_WINDOW_CURSOR 122 +#endif +#define GLUT_SCREEN_WIDTH 200 +#define GLUT_SCREEN_HEIGHT 201 +#define GLUT_SCREEN_WIDTH_MM 202 +#define GLUT_SCREEN_HEIGHT_MM 203 +#define GLUT_MENU_NUM_ITEMS 300 +#define GLUT_DISPLAY_MODE_POSSIBLE 400 +#define GLUT_INIT_WINDOW_X 500 +#define GLUT_INIT_WINDOW_Y 501 +#define GLUT_INIT_WINDOW_WIDTH 502 +#define GLUT_INIT_WINDOW_HEIGHT 503 +#define GLUT_INIT_DISPLAY_MODE 504 +#if (GLUT_API_VERSION >= 2) +#define GLUT_ELAPSED_TIME 700 +#endif +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +#define GLUT_WINDOW_FORMAT_ID 123 +#endif + +#if (GLUT_API_VERSION >= 2) +/* glutDeviceGet parameters. */ +#define GLUT_HAS_KEYBOARD 600 +#define GLUT_HAS_MOUSE 601 +#define GLUT_HAS_SPACEBALL 602 +#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603 +#define GLUT_HAS_TABLET 604 +#define GLUT_NUM_MOUSE_BUTTONS 605 +#define GLUT_NUM_SPACEBALL_BUTTONS 606 +#define GLUT_NUM_BUTTON_BOX_BUTTONS 607 +#define GLUT_NUM_DIALS 608 +#define GLUT_NUM_TABLET_BUTTONS 609 +#endif +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610 +#define GLUT_DEVICE_KEY_REPEAT 611 +#define GLUT_HAS_JOYSTICK 612 +#define GLUT_OWNS_JOYSTICK 613 +#define GLUT_JOYSTICK_BUTTONS 614 +#define GLUT_JOYSTICK_AXES 615 +#define GLUT_JOYSTICK_POLL_RATE 616 +#endif + +#if (GLUT_API_VERSION >= 3) +/* glutLayerGet parameters. */ +#define GLUT_OVERLAY_POSSIBLE 800 +#define GLUT_LAYER_IN_USE 801 +#define GLUT_HAS_OVERLAY 802 +#define GLUT_TRANSPARENT_INDEX 803 +#define GLUT_NORMAL_DAMAGED 804 +#define GLUT_OVERLAY_DAMAGED 805 + +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +/* glutVideoResizeGet parameters. */ +#define GLUT_VIDEO_RESIZE_POSSIBLE 900 +#define GLUT_VIDEO_RESIZE_IN_USE 901 +#define GLUT_VIDEO_RESIZE_X_DELTA 902 +#define GLUT_VIDEO_RESIZE_Y_DELTA 903 +#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904 +#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905 +#define GLUT_VIDEO_RESIZE_X 906 +#define GLUT_VIDEO_RESIZE_Y 907 +#define GLUT_VIDEO_RESIZE_WIDTH 908 +#define GLUT_VIDEO_RESIZE_HEIGHT 909 +#endif + +/* glutUseLayer parameters. */ +#define GLUT_NORMAL 0 +#define GLUT_OVERLAY 1 + +/* glutGetModifiers return mask. */ +#define GLUT_ACTIVE_SHIFT 1 +#define GLUT_ACTIVE_CTRL 2 +#define GLUT_ACTIVE_ALT 4 + +/* glutSetCursor parameters. */ +/* Basic arrows. */ +#define GLUT_CURSOR_RIGHT_ARROW 0 +#define GLUT_CURSOR_LEFT_ARROW 1 +/* Symbolic cursor shapes. */ +#define GLUT_CURSOR_INFO 2 +#define GLUT_CURSOR_DESTROY 3 +#define GLUT_CURSOR_HELP 4 +#define GLUT_CURSOR_CYCLE 5 +#define GLUT_CURSOR_SPRAY 6 +#define GLUT_CURSOR_WAIT 7 +#define GLUT_CURSOR_TEXT 8 +#define GLUT_CURSOR_CROSSHAIR 9 +/* Directional cursors. */ +#define GLUT_CURSOR_UP_DOWN 10 +#define GLUT_CURSOR_LEFT_RIGHT 11 +/* Sizing cursors. */ +#define GLUT_CURSOR_TOP_SIDE 12 +#define GLUT_CURSOR_BOTTOM_SIDE 13 +#define GLUT_CURSOR_LEFT_SIDE 14 +#define GLUT_CURSOR_RIGHT_SIDE 15 +#define GLUT_CURSOR_TOP_LEFT_CORNER 16 +#define GLUT_CURSOR_TOP_RIGHT_CORNER 17 +#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18 +#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19 +/* Inherit from parent window. */ +#define GLUT_CURSOR_INHERIT 100 +/* Blank cursor. */ +#define GLUT_CURSOR_NONE 101 +/* Fullscreen crosshair (if available). */ +#define GLUT_CURSOR_FULL_CROSSHAIR 102 +#endif + +/* GLUT initialization sub-API. */ +GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv); +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) +GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)); +#ifndef GLUT_BUILDING_LIB +static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); } +#define glutInit glutInit_ATEXIT_HACK +#endif +#endif +GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string); +#endif +GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y); +GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height); +GLUTAPI void GLUTAPIENTRY glutMainLoop(void); + +/* GLUT window sub-API. */ +GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title); +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) +GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)); +#ifndef GLUT_BUILDING_LIB +static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); } +#define glutCreateWindow glutCreateWindow_ATEXIT_HACK +#endif +#endif +GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height); +GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win); +GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) +GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win); +#endif +GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void); +GLUTAPI int GLUTAPIENTRY glutGetWindow(void); +GLUTAPI void GLUTAPIENTRY glutSetWindow(int win); +GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title); +GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title); +GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y); +GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height); +GLUTAPI void GLUTAPIENTRY glutPopWindow(void); +GLUTAPI void GLUTAPIENTRY glutPushWindow(void); +GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void); +GLUTAPI void GLUTAPIENTRY glutShowWindow(void); +GLUTAPI void GLUTAPIENTRY glutHideWindow(void); +#if (GLUT_API_VERSION >= 3) +GLUTAPI void GLUTAPIENTRY glutFullScreen(void); +GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y); +#endif + +/* GLUT overlay sub-API. */ +GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void); +GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void); +GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer); +GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) +GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win); +#endif +GLUTAPI void GLUTAPIENTRY glutShowOverlay(void); +GLUTAPI void GLUTAPIENTRY glutHideOverlay(void); +#endif + +/* GLUT menu sub-API. */ +GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int)); +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) +GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int)); +#ifndef GLUT_BUILDING_LIB +static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); } +#define glutCreateMenu glutCreateMenu_ATEXIT_HACK +#endif +#endif +GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu); +GLUTAPI int GLUTAPIENTRY glutGetMenu(void); +GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu); +GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value); +GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu); +GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value); +GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu); +GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item); +GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button); +GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button); + +/* GLUT window callback sub-API. */ +GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void)); +GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height)); +GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); +GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); +GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); +GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); +GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state)); +GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state)); +GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void)); +GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value); +GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state)); +#if (GLUT_API_VERSION >= 2) +GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); +GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); +GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); +GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state)); +GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state)); +GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value)); +GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); +GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); +#if (GLUT_API_VERSION >= 3) +GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y)); +GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void)); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state)); +#endif +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); +GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); +GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval); +#endif +#endif +#endif + +/* GLUT color index sub-API. */ +GLUTAPI void GLUTAPIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue); +GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component); +GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win); + +/* GLUT state retrieval sub-API. */ +GLUTAPI int GLUTAPIENTRY glutGet(GLenum type); +GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type); +#if (GLUT_API_VERSION >= 2) +/* GLUT extension support sub-API */ +GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name); +#endif +#if (GLUT_API_VERSION >= 3) +GLUTAPI int GLUTAPIENTRY glutGetModifiers(void); +GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type); +#endif + +/* GLUT font sub-API */ +GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character); +GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character); +GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character); +GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string); +GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string); +#endif + +/* GLUT pre-built models sub-API */ +GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks); +GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); +GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); +GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); +GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size); +GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size); +GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); +GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); +GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void); +GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void); +GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size); +GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size); +GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void); +GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void); +GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void); +GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void); +GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void); +GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void); + +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +/* GLUT video resize sub-API. */ +GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param); +GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void); +GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void); +GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height); +GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height); + +/* GLUT debugging sub-API. */ +GLUTAPI void GLUTAPIENTRY glutReportErrors(void); +#endif + +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +/* GLUT device control sub-API. */ +/* glutSetKeyRepeat modes. */ +#define GLUT_KEY_REPEAT_OFF 0 +#define GLUT_KEY_REPEAT_ON 1 +#define GLUT_KEY_REPEAT_DEFAULT 2 + +/* Joystick button masks. */ +#define GLUT_JOYSTICK_BUTTON_A 1 +#define GLUT_JOYSTICK_BUTTON_B 2 +#define GLUT_JOYSTICK_BUTTON_C 4 +#define GLUT_JOYSTICK_BUTTON_D 8 + +GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore); +GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode); +GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void); + +/* GLUT game mode sub-API. */ +/* glutGameModeGet. */ +#define GLUT_GAME_MODE_ACTIVE 0 +#define GLUT_GAME_MODE_POSSIBLE 1 +#define GLUT_GAME_MODE_WIDTH 2 +#define GLUT_GAME_MODE_HEIGHT 3 +#define GLUT_GAME_MODE_PIXEL_DEPTH 4 +#define GLUT_GAME_MODE_REFRESH_RATE 5 +#define GLUT_GAME_MODE_DISPLAY_CHANGED 6 + +GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string); +GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void); +GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void); +GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode); +#endif + +#ifdef __cplusplus +} +#endif + +#if 0 +#ifdef GLUT_APIENTRY_DEFINED +# undef GLUT_APIENTRY_DEFINED +# undef APIENTRY +#endif + +#ifdef GLUT_WINGDIAPI_DEFINED +# undef GLUT_WINGDIAPI_DEFINED +# undef WINGDIAPI +#endif + +#ifdef GLUT_DEFINED___CDECL +# undef GLUT_DEFINED___CDECL +# undef __cdecl +#endif + +#ifdef GLUT_DEFINED__CRTIMP +# undef GLUT_DEFINED__CRTIMP +# undef _CRTIMP +#endif +#endif + +#endif /* __glut_h__ */ diff --git a/xc/extras/Mesa/include/GL/glutf90.h b/xc/extras/Mesa/include/GL/glutf90.h new file mode 100644 index 000000000..46f19796a --- /dev/null +++ b/xc/extras/Mesa/include/GL/glutf90.h @@ -0,0 +1,81 @@ +#ifndef __glutf90_h__ +#define __glutf90_h__ + +/* Copyright (c) Mark J. Kilgard & Willam F. Mitchell, 1998. */ + +/* 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. */ + +/* This header provides the binding interface for William Mitchell's + f90gl Fortran 90 GLUT binding. Other GLUT language bindings + can and should use this interace. */ + +/* I appreciate the guidance from William Mitchell + (mitchell@cam.nist.gov) in developing this friend interface + for use by the f90gl package. See ../../README.fortran */ + +#include <GL/glut.h> + +/* Which callback enumerants for the __glutSetFCB/__glutGetFCB routines. */ +/* NOTE These values are part of a binary interface for the f90gl Fortran + 90 binding and so must NOT changes (additions are allowed). */ + +/* GLUTwindow callbacks. */ +#define GLUT_FCB_DISPLAY 0 /* GLUTdisplayFCB */ +#define GLUT_FCB_RESHAPE 1 /* GLUTreshapeFCB */ +#define GLUT_FCB_MOUSE 2 /* GLUTmouseFCB */ +#define GLUT_FCB_MOTION 3 /* GLUTmotionFCB */ +#define GLUT_FCB_PASSIVE 4 /* GLUTpassiveFCB */ +#define GLUT_FCB_ENTRY 5 /* GLUTentryFCB */ +#define GLUT_FCB_KEYBOARD 6 /* GLUTkeyboardFCB */ +#define GLUT_FCB_KEYBOARD_UP 7 /* GLUTkeyboardFCB */ +#define GLUT_FCB_WINDOW_STATUS 8 /* GLUTwindowStatusFCB */ +#define GLUT_FCB_VISIBILITY 9 /* GLUTvisibilityFCB */ +#define GLUT_FCB_SPECIAL 10 /* GLUTspecialFCB */ +#define GLUT_FCB_SPECIAL_UP 11 /* GLUTspecialFCB */ +#define GLUT_FCB_BUTTON_BOX 12 /* GLUTbuttonBoxFCB */ +#define GLUT_FCB_DIALS 13 /* GLUTdialsFCB */ +#define GLUT_FCB_SPACE_MOTION 14 /* GLUTspaceMotionFCB */ +#define GLUT_FCB_SPACE_ROTATE 15 /* GLUTspaceRotateFCB */ +#define GLUT_FCB_SPACE_BUTTON 16 /* GLUTspaceButtonFCB */ +#define GLUT_FCB_TABLET_MOTION 17 /* GLUTtabletMotionFCB */ +#define GLUT_FCB_TABLET_BUTTON 18 /* GLUTtabletButtonFCB */ +#define GLUT_FCB_JOYSTICK 19 /* GLUTjoystickFCB */ +/* Non-GLUTwindow callbacks. */ +#define GLUT_FCB_OVERLAY_DISPLAY 100 /* GLUTdisplayFCB */ +#define GLUT_FCB_SELECT 101 /* GLUTselectFCB */ +#define GLUT_FCB_TIMER 102 /* GLUTtimerFCB */ + +/* GLUT Fortran callback function types. */ +typedef void (GLUTCALLBACK *GLUTdisplayFCB) (void); +typedef void (GLUTCALLBACK *GLUTreshapeFCB) (int *, int *); +/* NOTE the pressed key is int, not unsigned char for Fortran! */ +typedef void (GLUTCALLBACK *GLUTkeyboardFCB) (int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTmouseFCB) (int *, int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTmotionFCB) (int *, int *); +typedef void (GLUTCALLBACK *GLUTpassiveFCB) (int *, int *); +typedef void (GLUTCALLBACK *GLUTentryFCB) (int *); +typedef void (GLUTCALLBACK *GLUTwindowStatusFCB) (int *); +typedef void (GLUTCALLBACK *GLUTvisibilityFCB) (int *); +typedef void (GLUTCALLBACK *GLUTspecialFCB) (int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTbuttonBoxFCB) (int *, int *); +typedef void (GLUTCALLBACK *GLUTdialsFCB) (int *, int *); +typedef void (GLUTCALLBACK *GLUTspaceMotionFCB) (int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTspaceRotateFCB) (int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTspaceButtonFCB) (int *, int *); +typedef void (GLUTCALLBACK *GLUTtabletMotionFCB) (int *, int *); +typedef void (GLUTCALLBACK *GLUTtabletButtonFCB) (int *, int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z); + +typedef void (GLUTCALLBACK *GLUTselectFCB) (int *); +typedef void (GLUTCALLBACK *GLUTtimerFCB) (int *); +typedef void (GLUTCALLBACK *GLUTmenuStateFCB) (int *); /* DEPRICATED. */ +typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *); +typedef void (GLUTCALLBACK *GLUTidleFCB) (void); + +/* Functions that set and return Fortran callback functions. */ +extern void* GLUTAPIENTRY __glutGetFCB(int which); +extern void GLUTAPIENTRY __glutSetFCB(int which, void *func); + +#endif /* __glutf90_h__ */ diff --git a/xc/extras/Mesa/include/GL/mesa_wgl.h b/xc/extras/Mesa/include/GL/mesa_wgl.h index ac3086e51..1176f6656 100644 --- a/xc/extras/Mesa/include/GL/mesa_wgl.h +++ b/xc/extras/Mesa/include/GL/mesa_wgl.h @@ -1,4 +1,4 @@ -/* $Id: mesa_wgl.h,v 1.1.1.1 2000/11/30 17:31:30 dawes Exp $ */
+/* $Id: mesa_wgl.h,v 1.1.1.2 2000/12/05 16:38:37 dawes Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,6 +32,7 @@ #define _mesa_wgl_h_
+#include <windows.h>
#include <gl/gl.h>
#ifdef __cplusplus
diff --git a/xc/extras/Mesa/macos/include-glide/Glide2/README b/xc/extras/Mesa/macos/include-glide/Glide2/README new file mode 100755 index 000000000..e8ed15aaa --- /dev/null +++ b/xc/extras/Mesa/macos/include-glide/Glide2/README @@ -0,0 +1,8 @@ +Glide Headers: +--------------- +You should put Glide3 headers to include-glide/Glide3 +and Glide2 headers to include-glide/Glide2. + +Glide2 headers are available from http://www.3dfx.com/ in the Glide2.x MacOS SDK. +Glide3 headers are available from http://www.3dfx.com/ only in Win95 SDK. +To compile you should remove the __stdcall parameter. (The compiler will show you it :) ) diff --git a/xc/extras/Mesa/macos/include-glide/Glide3/README b/xc/extras/Mesa/macos/include-glide/Glide3/README new file mode 100755 index 000000000..e8ed15aaa --- /dev/null +++ b/xc/extras/Mesa/macos/include-glide/Glide3/README @@ -0,0 +1,8 @@ +Glide Headers: +--------------- +You should put Glide3 headers to include-glide/Glide3 +and Glide2 headers to include-glide/Glide2. + +Glide2 headers are available from http://www.3dfx.com/ in the Glide2.x MacOS SDK. +Glide3 headers are available from http://www.3dfx.com/ only in Win95 SDK. +To compile you should remove the __stdcall parameter. (The compiler will show you it :) ) diff --git a/xc/extras/Mesa/macos/src-agl/Makefile b/xc/extras/Mesa/macos/src-agl/Makefile new file mode 100755 index 000000000..8c854e958 --- /dev/null +++ b/xc/extras/Mesa/macos/src-agl/Makefile @@ -0,0 +1,27 @@ +AGL_SRC_DIR = ":" +OBJ_DIR = "::Binaries.MPW:" +OPENGL_INC_DIR = ":::Headers:" +GLI_INC_DIR = ":::Headers:GLI:" + +OBJECTS = {OBJ_DIR}maglContext.o ¶ + {OBJ_DIR}maglError.o ¶ + {OBJ_DIR}maglFont.o ¶ + {OBJ_DIR}maglMemory.o ¶ + {OBJ_DIR}maglPixelFormat.o ¶ + {OBJ_DIR}maglRendererInfo.o ¶ + {OBJ_DIR}maglRenderersMesa.o ¶ + {OBJ_DIR}maglVirtualSrceen.o + + +COptions = -i {OPENGL_INC_DIR},{GLI_INC_DIR} -enum int -typecheck relaxed -opt speed -inline 1 + +MakeDepend = -make depend.mpw + +######## RULES ############ + +{OBJ_DIR} Ä {AGL_SRC_DIR} + +.o Ä .c Makefile + MrC4 {depDir}{default}.c -o {targDir}{default}.o {COptions} {MakeDepend} + +All Ä {OBJECTS}
\ No newline at end of file diff --git a/xc/extras/Mesa/macos/src-agl/depend.mpw b/xc/extras/Mesa/macos/src-agl/depend.mpw new file mode 100755 index 000000000..2db6916ea --- /dev/null +++ b/xc/extras/Mesa/macos/src-agl/depend.mpw @@ -0,0 +1,16 @@ +"::Binaries.MPW:maglVirtualSrceen.o" Ä ¶ + ":maglConfig.h" ¶ + ":maglMemory.h" ¶ + ":maglError.h" ¶ + ":maglConfig.h" ¶ + ":::Headers:gl.h" ¶ + "Code Warrior:Metrowerks:CodeWarrior MPW:MPW::Interfaces&Libraries:Interfaces:CIncludes:assert.h" ¶ + ":maglRenderers.h" ¶ + ":::Headers:GLI:gli.h" ¶ + ":::Headers:GLI:gliConstants.h" ¶ + ":::Headers:GLI:gliContext.h" ¶ + ":::Headers:GLI:gliDispatch.h" ¶ + ":::Headers:GLI:gliRenderer.h" ¶ + ":::Headers:GLI:gliAttribute.h" ¶ + ":::Headers:GLI:gliPixelFormat.h" ¶ + ":maglValidate.h" diff --git a/xc/extras/Mesa/mtdemos/Makefile.X11 b/xc/extras/Mesa/mtdemos/Makefile.X11 new file mode 100644 index 000000000..9c879b7ae --- /dev/null +++ b/xc/extras/Mesa/mtdemos/Makefile.X11 @@ -0,0 +1,56 @@ +# $Id: Makefile.X11,v 1.1.1.1 2000/12/05 16:38:42 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.1 +# Copyright (C) 1995-1999 Brian Paul + +# Makefile for multi-threaded demos + + +##### MACROS ##### + +INCDIR = ../include + +GL_LIBS = -L../lib -lglut -lGLU -lGL -lm $(XLIBS) + +LIB_DEP = ../lib/$(GL_LIB) ../lib/$(GLU_LIB) ../lib/$(GLUT_LIB) + +PROGS = mt_osdemo + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config + diff --git a/xc/extras/Mesa/mtdemos/README b/xc/extras/Mesa/mtdemos/README new file mode 100644 index 000000000..d02975f42 --- /dev/null +++ b/xc/extras/Mesa/mtdemos/README @@ -0,0 +1,24 @@ + +Mesa Multithreaded Demos README +------------------------------- + + This directory contains demos programs which can be used to verify +proper operation of an MT-safe build of Mesa. Some of these demos +are non-portable at present, but will be more generally useful in +future versions of Mesa. + + To build the demo(s), just type "make" in conjunction with the same +build target you used to build the MT-safe Mesa lib. + +Examples: + make -f Makefile.X11 sunos5-pthread (for Solaris 2.[56] with POSIX threads) + make -f Makefile.X11 linux-386-pthread (for Linux 2.x systems with Linux threads) + + +If you have questions or problems with these demo programs, send email +to John Stone or Cristoph Poliwoda. (see README.THREADS in top level +Mesa directory) + +mt_osdemo.c -- Renders using multiple threads, and one ore more osmesa + rendering contexts. Requires pthreads currently. + diff --git a/xc/extras/Mesa/mtdemos/mt_osdemo.c b/xc/extras/Mesa/mtdemos/mt_osdemo.c new file mode 100644 index 000000000..59ee03368 --- /dev/null +++ b/xc/extras/Mesa/mtdemos/mt_osdemo.c @@ -0,0 +1,211 @@ +/* + * mt_osdemo.c + * + * Demo of off-screen Mesa rendering with multithreading support . + * + * IMPORTANT NOTE: The code in this file is in alpha stage. It is used + * as an example how multithreaded programming with Mesa could look + * like. YOU MUST HAVE COMPILED THE MESA WITH POSIX THREADS SUPPORT TO + * COMPILE AND RUN THIS DEMO! - poliwoda@volumegraphics.com + * + * The original "osdemo" by Brian Paul can be found in "../demos" + * + * See Mesa/include/GL/osmesa.h for documentation of the OSMesa functions. + * + * If you want to render BIG images you'll probably have to increase + * MAX_WIDTH and MAX_HEIGHT in src/config.h. + * + * This program is in the public domain. + * + * Brian Paul + * + * modified for multithread usage by Christop Poliwoda (poliwoda@volumegraphics.com) + * PPM output provided by Joerg Schmalzl. + * ASCII PPM output added by Brian Paul. + * + */ + +#ifndef THREADS +#ifndef PTHREADS +#error This code compiles and runs with POSIX threads support only. \ +Compile the Mesa and this demo as threaded version. +#endif +#endif + +#include <stdio.h> +#include <stdlib.h> +#include "GL/osmesa.h" +#include "GL/glut.h" + +#include <pthread.h> /* POSIX thread interface */ + + +#define WIDTH 512 +#define HEIGHT 512 +#define REPETITIONS 4 +#define MAXTHREADS 4 + +void * buffers[MAXTHREADS]; /* these are the different result buffers */ +OSMesaContext ctx[MAXTHREADS]; /* and these the used contexts */ + + + +/* + * renders an image with 3 teapots, colorized in red, green, blue + */ +static void render_image( void ) { + GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; + GLfloat red_mat[] = { 1.0, 0.2, 0.2, 1.0 }; + GLfloat green_mat[] = { 0.2, 1.0, 0.2, 1.0 }; + GLfloat blue_mat[] = { 0.2, 0.2, 1.0, 1.0 }; + + glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-2.5, 2.5, -2.5, 2.5, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + + glPushMatrix(); + glRotatef(20.0, 1.0, 0.0, 0.0); + + glPushMatrix(); + glTranslatef(-0.75, 0.5, 0.0); + glRotatef(90.0, 1.0, 0.0, 0.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red_mat ); + glutSolidTeapot(1.5); + glPopMatrix(); + glPopMatrix(); + + glPushMatrix(); + glRotatef(20.0, 1.0, 0.0, 0.0); + + glPushMatrix(); + glTranslatef(-0.75, -0.5, 0.0); + glRotatef(270.0, 1.0, 0.0, 0.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green_mat ); + glutSolidTeapot(1.0); + glPopMatrix(); + glPopMatrix(); + + glPushMatrix(); + glRotatef(20.0, 1.0, 0.0, 0.0); + + glPushMatrix(); + glTranslatef(0.75, 0.0, -1.0); + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat ); + glutSolidTeapot(1.0); + glPopMatrix(); + glPopMatrix(); + + glFinish(); +} + + +/* + * Do rendering for a thread. + */ +static void * thread_function(void * threadNr) { + + int i = (int)threadNr; + + OSMesaMakeCurrent(ctx[i], buffers[i], GL_UNSIGNED_BYTE, WIDTH, HEIGHT); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + render_image(); + + return NULL; +} + + + +int main( int argc, char *argv[] ) { + pthread_t threads[MAXTHREADS]; + int i, k; + int p, x, y; + int t0, t1; + FILE *f; + GLubyte *ptr; + +#ifdef __sun + thr_setconcurrency(MAXTHREADS); +#endif + + for (i=0; i<MAXTHREADS; i++) { + /* create the OS Mesa contexts and result buffers */ + ctx[i] = OSMesaCreateContext( GL_RGBA, NULL ); + buffers[i] = malloc(WIDTH * HEIGHT * 4); + } + + /* to compare rendering time, we do a single threaded rendering pass */ + printf("Main thread rendering %d %dx%d-images (no threads)...\n", + MAXTHREADS*REPETITIONS, WIDTH, HEIGHT); + fflush(stdout); + + t0 = glutGet(GLUT_ELAPSED_TIME); + for (k=0; k<REPETITIONS; k++) { + for (i=0; i<MAXTHREADS; i++) { + thread_function((void*)i); + } + } + t1 = glutGet(GLUT_ELAPSED_TIME); + printf("Single thread runtime: %6.2f seconds\n\n", (t1 - t0) * 0.001); + + + /* now we run the multithreaded code */ + printf("%d threads rendering %d %dx%d-images (multithreaded)...\n", + MAXTHREADS, MAXTHREADS*REPETITIONS, WIDTH, HEIGHT); + fflush(stdout); + + t0 = glutGet(GLUT_ELAPSED_TIME); + for (k=0; k<REPETITIONS; k++) { + for (i=0; i<MAXTHREADS; i++) { + pthread_create(&threads[i], NULL, thread_function, (void*)i); + } + for (i=0; i<MAXTHREADS; i++) { + pthread_join(threads[i], NULL); /* wait for threads to finish */ + } + } + t1 = glutGet(GLUT_ELAPSED_TIME); + printf("Multithreaded runtime: %6.2f seconds\n\n", (t1 - t0) * 0.001); + + for (i=0; i<MAXTHREADS; i++) { + /* write PPM (binary) file */ + if ((argc>i+1) && + (f = fopen( argv[i+1], "w" ))) { + printf("write buffer #%d to file %s\n", i, argv[i+1]); + ptr = (GLubyte *) buffers[i]; + fprintf(f,"P6\n"); + fprintf(f,"# ppm-file created by %s\n", argv[0]); + fprintf(f,"%i %i\n", WIDTH,HEIGHT); + fprintf(f,"255\n"); + fclose(f); + f = fopen( argv[i+1], "ab" ); /* reopen in binary append mode */ + for (y=HEIGHT-1; y>=0; y--) { + for (x=0; x<WIDTH; x++) { + p = (y*WIDTH + x) * 4; + fputc(ptr[p], f); /* write red */ + fputc(ptr[p+1], f); /* write green */ + fputc(ptr[p+2], f); /* write blue */ + } + } + fclose(f); + } + /* destroy OS Mesa contexts and result buffers */ + OSMesaDestroyContext(ctx[i]); + free(buffers[i]); + } + + printf("\nall done.\n"); + + return 0; +} diff --git a/xc/extras/Mesa/samples/.cvsignore b/xc/extras/Mesa/samples/.cvsignore new file mode 100644 index 000000000..5be74f4c1 --- /dev/null +++ b/xc/extras/Mesa/samples/.cvsignore @@ -0,0 +1,35 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +accum +bitmap1 +bitmap2 +blendeq +blendxor +copy +cursor +depth +eval +fog +font +line +logo +nurb +oglinfo +olympic +overlay +point +prim +quad +select +shape +sphere +star +stencil +stretch +texture +tri +wave diff --git a/xc/extras/Mesa/samples/Imakefile b/xc/extras/Mesa/samples/Imakefile new file mode 100644 index 000000000..948a97835 --- /dev/null +++ b/xc/extras/Mesa/samples/Imakefile @@ -0,0 +1,101 @@ +LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\glut.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
+
+INCLUDES = -I$(TOP)\include
+
+SRCS = accum.c \
+ bitmap1.c \
+ bitmap2.c \
+ blendeq.c \
+ blendxor.c \
+ copy.c \
+ cursor.c \
+ depth.c \
+ eval.c \
+ fog.c \
+ font.c \
+ line.c \
+ logo.c \
+ nurb.c \
+ oglinfo.c \
+ olympic.c \
+ overlay.c \
+ point.c \
+ prim.c \
+ quad.c \
+ select.c \
+ shape.c \
+ speed.c \
+ sphere.c \
+ star.c \
+ stencil.c \
+ stretch.c \
+ texture.c \
+ tri.c \
+ wave.c
+
+PROGRAMS = ProgramTargetName(accum) \
+ ProgramTargetName(bitmap1) \
+ ProgramTargetName(bitmap2) \
+ ProgramTargetName(blendeq) \
+ ProgramTargetName(blendxor) \
+ ProgramTargetName(copy) \
+ ProgramTargetName(cursor) \
+ ProgramTargetName(depth) \
+ ProgramTargetName(eval) \
+ ProgramTargetName(fog) \
+ ProgramTargetName(font) \
+ ProgramTargetName(line) \
+ ProgramTargetName(logo) \
+ ProgramTargetName(nurb) \
+ ProgramTargetName(oglinfo) \
+ ProgramTargetName(olympic) \
+ ProgramTargetName(overlay) \
+ ProgramTargetName(point) \
+ ProgramTargetName(prim) \
+ ProgramTargetName(quad) \
+ ProgramTargetName(select) \
+ ProgramTargetName(shape) \
+ ProgramTargetName(speed) \
+ ProgramTargetName(sphere) \
+ ProgramTargetName(star) \
+ ProgramTargetName(stencil) \
+ ProgramTargetName(stretch) \
+ ProgramTargetName(texture) \
+ ProgramTargetName(tri) \
+ ProgramTargetName(wave)
+
+AllTarget($(PROGRAMS))
+
+NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bitmap1,bitmap1.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bitmap2,bitmap2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(blendeq,blendeq.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(blendxor,blendxor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(copy,copy.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(cursor,cursor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(depth,depth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(eval,eval.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(line,line.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(logo,logo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(nurb,nurb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(oglinfo,oglinfo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(olympic,olympic.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(overlay,overlay.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(point,point.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(prim,prim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(quad,quad.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(shape,shape.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(speed,speed.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(star,star.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(stretch,stretch.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(texture,texture.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(tri,tri.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(wave,wave.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+
+DependTarget()
+
diff --git a/xc/extras/Mesa/samples/Makefile.BeOS-R4 b/xc/extras/Mesa/samples/Makefile.BeOS-R4 new file mode 100644 index 000000000..48e5cf9f8 --- /dev/null +++ b/xc/extras/Mesa/samples/Makefile.BeOS-R4 @@ -0,0 +1,64 @@ +# $Id: Makefile.BeOS-R4,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.1 +# Copyright (C) 1995-1999 Brian Paul +# +# This file is in the public domain. + + +# Makefile for sample programs for BeOS R4 + + + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \ + font line logo olympic overlay point prim select \ + shape sphere star stencil stretch texture tri wave + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config + diff --git a/xc/extras/Mesa/samples/Makefile.DJ b/xc/extras/Mesa/samples/Makefile.DJ new file mode 100644 index 000000000..956a895d1 --- /dev/null +++ b/xc/extras/Mesa/samples/Makefile.DJ @@ -0,0 +1,36 @@ +# $Id: Makefile.DJ,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + +# Makefile for sample programs for MS-DOS with DJGPP + +##### MACROS ##### + +INCDIR = ../include + +GL_LIBS = ../lib/dosglut.a ../lib/dosglub.a ../lib/dosmesa.a + +LIB_DEP = $(GL_LIBS) + +PROGS = accum bitmap1 bitmap2 blendeq blendxor copy depth \ + eval fog font line logo nurb olympic \ + point prim quad select shape \ + sphere star stencil stretch texture \ + tri wave + +##### RULES ##### + +.c: $(LIB_DEP) + gcc -I$(INCDIR) $(CFLAGS) $< $(LIB_DEP) -o $@ + + +##### TARGETS ##### + +default: $(PROGS) + +clean: + del *. + +realclean: clean + del *.exe + + + diff --git a/xc/extras/Mesa/samples/Makefile.X11 b/xc/extras/Mesa/samples/Makefile.X11 new file mode 100644 index 000000000..ccfbcd591 --- /dev/null +++ b/xc/extras/Mesa/samples/Makefile.X11 @@ -0,0 +1,58 @@ +# $Id: Makefile.X11,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# Copyright (C) 1995-1999 Brian Paul + +# Makefile for assorted SGI OpenGL demos + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(APP_LIB_DEPS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \ + font line logo nurb oglinfo olympic overlay point prim quad select \ + shape sphere star stencil stretch texture tri wave + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + ./$$prog; \ + echo ; \ + done + + +include ../Make-config diff --git a/xc/extras/Mesa/samples/Makefile.am b/xc/extras/Mesa/samples/Makefile.am new file mode 100644 index 000000000..e2e4e8958 --- /dev/null +++ b/xc/extras/Mesa/samples/Makefile.am @@ -0,0 +1,45 @@ +## Process this file with automake to produce Makefile.in + +#AUTOMAKE_OPTIONS = no-dependencies + +INCLUDES = -I$(top_srcdir)/include $(GLUT_CFLAGS) + +check_PROGRAMS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth \ + eval fog font line logo nurb oglinfo olympic overlay point prim \ + quad select shape sphere star stencil stretch texture tri wave + +EXTRA_PROGRAMS = rgbtoppm + +EXTRA_DIST = tkmap.c loadppm.c + +LDADD = $(GLUT_LIBS) $(top_builddir)/src-glu/libGLU.la \ + $(top_builddir)/src/libGL.la -lm +LDFLAGS = -no-install + +# default image +IMAGE = girl + +# use double buffering if possible +BUFFER = -db + +CLEANFILES = rgbtoppm $(IMAGE).ppm + +# execute all programs +exec: $(check_PROGRAMS) $(IMAGE).ppm + @for prog in $(check_PROGRAMS); \ + do \ + echo -n "Running $$prog ..." ; \ + case "$$prog" in \ + copy) \ + ./$$prog -f $(IMAGE).ppm ;; \ + quad | sphere | stretch | texture) \ + ./$$prog $(BUFFER) -f $(IMAGE).ppm ;; \ + bitmap* | blend* | font | select | shape | stencil) \ + ./$$prog ;; \ + *) ./$$prog $(BUFFER) ;; \ + esac ; \ + echo ; \ + done + +$(IMAGE).ppm: rgbtoppm + ./rgbtoppm $(top_srcdir)/images/$(IMAGE).rgb > $(IMAGE).ppm diff --git a/xc/extras/Mesa/samples/Makefile.dja b/xc/extras/Mesa/samples/Makefile.dja new file mode 100644 index 000000000..ef0520dbc --- /dev/null +++ b/xc/extras/Mesa/samples/Makefile.dja @@ -0,0 +1,26 @@ +# $Id: Makefile.dja,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ + +# Makefile for sample programs for MS-DOS with DJGPP and ALLEGRO + + + +INCDIR = ../include +LIBDIR = ../lib +include ../common.dja + + _PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth \ + eval fog font line logo nurb oglinfo olympic overlay point \ + prim quad select shape sphere star stencil stretch texture \ + tri wave + + PROGS = $(_PROGS:=.exe) + + +default: $(PROGS) + +clean: + del *. + +realclean: clean + del *.exe + diff --git a/xc/extras/Mesa/samples/README b/xc/extras/Mesa/samples/README new file mode 100644 index 000000000..853158873 --- /dev/null +++ b/xc/extras/Mesa/samples/README @@ -0,0 +1,520 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +accum - Accumulation test. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit + 1 Use filled polygon mode. + 2 Use outlined polygon mode. + +bitmap1 - Bitmap test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + +bitmap2 - Bitmap test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + 1 Toggle display list mode. + 2 Toggle color animation mode. + +copy - Pixel copy test. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + -dr Direct render mode. + -ir Indirect render mode. + -f <file name> RGB image file. + - keys: + ESC Quit. + Z Increase zoom factor. + z Decrease zoom factor. + - mouse input: + Left Copy location. + +cursor - Cursor test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + SPACE switch cursor color. + +depth - Z buffer test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + 1 Toggle anti-aliased mode. + 2 Toggle stipple mode. + +eval - Evaluator test. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate. + UP Rotate. + DOWN Rotate. + 1 Toggle dimensions. + 2 Toggle dimensions. + e Use eval mode. + m Use mesh mode. + f Toggle polygon mode. + p Toggle point mode. + c Toggle color mode. + t Toggle texture mode. + l Toggle lighting mode. + +fog - Fog test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate. + UP Rotate. + DOWN Rotate. + D Increase fog density. + d Decrease fog density. + +font - font test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + Left Shift left. + Right Shift right. + Up Shift up. + Down Shift down. + n Shift in. + m Shift out. + q Scale up x. + w Scale down x. + a Scale up y. + s Scale down y. + z Scale up z. + x Scale down z. + e Rotate clockwise x. + r Rotate counter-clockwise x. + d Rotate clockwise y. + f Rotate counter-clockwise y. + c Rotate clockwise z. + v Rotate counter-clockwise z. + +line - Line test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + W Increase line width. + w Decrease line width. + 1 Toggle stipple mode. + 2 Toggle anti-aliased mode. + +logo - Demo. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate + UP Move clipping plane. + DOWN Move clipping plane. + Z Translate. + z Translate. + 1 Use GL_POINT polygon mode. + 2 Use GL_LINE polygon mode. + 3 Use GL_FILL polygon mode. + p Toggle polygon fill modes. + 4 Use GL_NICEST for GL_POLYGON_SMOOTH_HINT. + 5 Use anti-aliased polygon mode. + 6 Use aliased polygon mode. + 8 Toggle dither mode. + 9 Toggle stipple polygon mode. + 0 Toggle flat/smooth shading mode. + q Disable cull mode. + w Use front face cull mode. + e Use back face cull mode. + r Use clockwise front face mode. + t Use counter-clockwise front face mode. + y Use MSB first stipple pattern. + u Use LSB first stipple pattern. + a Use brick texture map. + s Use checker texture map. + d Disable texture map. + f Use decal texture environment mode. + g Use modulate texture environment mode. + +nurb - Nurb test. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate. + UP Rotate. + DOWN Rotate. + +olympic - Olymipic rings demo. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + SPACE Restart demo. + +overlay - Overlay plane demo. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + SPACE Toggle star weird movement mode. + t Toggle star turbo mode. + +point - Point test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + LEFT Translate. + RIGHT Translate. + UP Translate. + DOWN Translate. + W Increase point width. + w Decrease point width. + 1 Toggle anti-aliased mode. + +prim - Primitive test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + 1 Toggle flat/smooth shade mode. + 2 Toggle outlined/filled polygon mode. + 3 Toggle color mask mode. + +quad - Quadric test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + -dr Direct render mode. + -ir Indirect render mode. + -f <file name> texture file. + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate. + UP Rotate. + DOWN Rotate. + X Rotate. + x Rotate. + 1 Use GLU_FILL draw style. + 2 Use GLU_POINT draw style. + 3 Use GLU_LINE draw style. + 4 Use GLU_SILHOUETTE draw style. + 0 Toggle flat/smooth shade mode. + f Cylce through quadrics. + d Toggle orientation. + A Increase number of stacks. + a Decrease number of stacks. + S Increase number of slices. + s Decrease number of slices. + G Increase radius1. + g Decrease radius1. + J Increase radius2. + j Decrease radius2. + H Increase height. + h Decrease height. + K Increase angle1. + k Decrease angle1. + L Increase angle2. + l Decrease angle2. + z Toggle texture mode. + q Disable cull mode. + w Use front face cull mode. + e Use back face cull mode. + r Use clockwise front face mode. + t Use counter-clockwise front face mode. + y Toggle dither mode. + +select - Selection test. + - RGBA, SB. + - cmd line options: + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate. + Z Increase zoom factor. + z Decrease zoom factor. + d Zoom at current mouse location. + f Print feedback information. + l Toggle outlined/filled polygon mode. + - mouse: + Left Recolor selected triangle. + Center Enlarge selected triangle. + Right Delete selected triangle. + +shape - shape test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + Left Shift left. + Right Shift right. + Up Shift up. + Down Shift down. + n Shift in. + m Shift out. + q Scale up x. + w Scale down x. + a Scale up y. + s Scale down y. + z Scale up z. + x Scale down z. + e Rotate clockwise x. + r Rotate counter-clockwise x. + d Rotate clockwise y. + f Rotate counter-clockwise y. + c Rotate clockwise z. + v Rotate counter-clockwise z. + SPACE switch shapes. + +speed - Speed test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + a Toggle anti-aliased mode. + d Toggle z buffering mode. + f Toggle fog mode. + F Toggle fog hint mode. + s Toggle flat/smooth shading mode. + t Toggle texturing mode. + +sphere - Spheremap test. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + -dr Direct render mode. + -ir Indirect render mode. + -f <file name> texture file. + -3 Use RGB components. + -4 Use RGBA components. + - keys: + ESC Quit. + LEFT Rotate about the y axis. + RIGHT Rotate about the y axis. + UP Rotate about the x axis. + DOWN Rotate about the x axis. + a Toggle auto rotate mode. + c toggle between cylinder or cube object. + t Use torus object. + d Use decal texture mode. + m Use modulate texture mode. + l Toggle lighted mode. + f Toggle fog mode. + 0 Use nearest magification filter. + 1 Use linear magification. + 2 Use nearest minification filter. + 3 Use linear minification filter. + 4 Use nearest-mipmap-nearest minification filter. + 5 Use nearest-mipmap-linear minification filter. + 6 Use linear-mipmap-nearest minification filter. + 7 Use linear-mipmap-linear minification filter. + +star - Demo. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + SPACE Toggle weird movement mode. + t Toggle turbo mode. + +stencil - Stencil test. + - RGBA, SB. + - cmd line options: + +stretch - Texture test. + - RGBA, SB. + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + -dr Direct render mode. + -ir Indirect render mode. + -f <file name> texture file. + - keys: + ESC Quit. + SPACE Start animation. + - mouse: + Left Added stretch point. + +texture - Texture test. + - RGBA, SB/DB (SB default). + - cmd line options: + -sb Single buffer mode. + -db Double buffer mode. + -dr Direct render mode. + -ir Indirect render mode. + -f <file name> texture file. + - keys: + ESC Quit. + LEFT Rotate. + RIGHT Rotate. + UP Rotate. + DOWN Rotate. + T Translate. + t Translate. + s Toggle sphere map mode. + 0 Use nearest magification filter. + 1 Use linear magification filter. + 2 Use nearest minification filter. + 3 Use linear minification filter. + 4 Use nearest-mipmap-nearest minification filter. + 5 Use nearest-mipmap-linear minification filter. + 6 Use linear-mipmap-nearest minification filter. + 7 Use linear-mipmap-linear minification filter. + +tri - Triangle test. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + - keys: + ESC Quit. + LEFT Translate. + RIGHT Translate. + Z Increase zoom factor. + z Decrease zoom factor. + 1 Use point polygon mode. + 2 Use line polygon mode. + 3 Use filled polygon mode. + 4 Use point primitive. + 5 Use line-loop primitive. + 6 Use polygon primitive. + 7 Toggle cull mode. + 8 Use clockwise/counter-clockwise front face mode. + 9 Toggle front/back face cull mode. + v Toggle show verticies mode. + s Toggle flat/smooth shade mode. + h Toggle hide bottom triangle mode. + o Toggle outline mode. + m Toggle dither mode. + 0 Toggle anti-aliased mode. + +wave - Demo. + - RGBA/CI (RGBA default), SB/DB (SB default). + - cmd line options: + -rgb RGBA mode. + -ci Color index mode. + -sb Single buffer mode. + -db Double buffer mode. + -dr Direct render mode. + -ir Indirect render mode. + -grid <x> <y> Number of grids. + -size <number> Size of grid. + -wave <number> Height of wave (floating point number). + -frames <count> Number of frames. + - keys: + ESC Quit. + c Toggle contouring mode. + s Toggle flat/smooth shade mode. + l Toggle lighting mode. + d Toggle depth checking mode. + SPACE Toggle step/animation mode. + n Single step in step mode. + a Toggle spin mode. diff --git a/xc/extras/Mesa/samples/accum.c b/xc/extras/Mesa/samples/accum.c new file mode 100644 index 000000000..24dfc07d2 --- /dev/null +++ b/xc/extras/Mesa/samples/accum.c @@ -0,0 +1,157 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +GLenum doubleBuffer; +GLint thing1, thing2; + + +static void Init(void) +{ + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearAccum(0.0, 0.0, 0.0, 0.0); + + thing1 = glGenLists(1); + glNewList(thing1, GL_COMPILE); + glColor3f(1.0, 0.0, 0.0); + glRectf(-1.0, -1.0, 1.0, 0.0); + glEndList(); + + thing2 = glGenLists(1); + glNewList(thing2, GL_COMPILE); + glColor3f(0.0, 1.0, 0.0); + glRectf(0.0, -1.0, 1.0, 1.0); + glEndList(); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +static void Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(1); + case '1': + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + break; + case '2': + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glPushMatrix(); + + glScalef(0.8, 0.8, 1.0); + + glClear(GL_COLOR_BUFFER_BIT); + glCallList(thing1); + glAccum(GL_LOAD, 0.5); + + glClear(GL_COLOR_BUFFER_BIT); + glCallList(thing2); + glAccum(GL_ACCUM, 0.5); + + glAccum(GL_RETURN, 1.0); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); + glutInitWindowSize( 300, 300); + + type = GLUT_RGB | GLUT_ACCUM; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Accum Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/bitmap1.c b/xc/extras/Mesa/samples/bitmap1.c new file mode 100644 index 000000000..517d584e2 --- /dev/null +++ b/xc/extras/Mesa/samples/bitmap1.c @@ -0,0 +1,250 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define OPENGL_WIDTH 24 +#define OPENGL_HEIGHT 13 + + +GLenum rgb, doubleBuffer, windType; + +float boxA[3] = { + 0, 0, 0 +}; +float boxB[3] = { + -100, 0, 0 +}; +float boxC[3] = { + 100, 0, 0 +}; +float boxD[3] = { + 0, 95, 0 +}; +float boxE[3] = { + 0, -105, 0 +}; +GLubyte OpenGL_bits1[] = { + 0x00, 0x03, 0x00, + 0x7f, 0xfb, 0xff, + 0x7f, 0xfb, 0xff, + 0x00, 0x03, 0x00, + 0x3e, 0x8f, 0xb7, + 0x63, 0xdb, 0xb0, + 0x63, 0xdb, 0xb7, + 0x63, 0xdb, 0xb6, + 0x63, 0x8f, 0xf3, + 0x63, 0x00, 0x00, + 0x63, 0x00, 0x00, + 0x63, 0x00, 0x00, + 0x3e, 0x00, 0x00, +}; +GLubyte OpenGL_bits2[] = { + 0x00, 0x00, 0x00, + 0xff, 0xff, 0x01, + 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, + 0xf9, 0xfc, 0x01, + 0x8d, 0x0d, 0x00, + 0x8d, 0x0d, 0x00, + 0x8d, 0x0d, 0x00, + 0xcc, 0x0d, 0x00, + 0x0c, 0x4c, 0x0a, + 0x0c, 0x4c, 0x0e, + 0x8c, 0xed, 0x0e, + 0xf8, 0x0c, 0x00, +}; +GLubyte logo_bits[] = { + 0x00, 0x66, 0x66, + 0xff, 0x66, 0x66, + 0x00, 0x00, 0x00, + 0xff, 0x3c, 0x3c, + 0x00, 0x42, 0x40, + 0xff, 0x42, 0x40, + 0x00, 0x41, 0x40, + 0xff, 0x21, 0x20, + 0x00, 0x2f, 0x20, + 0xff, 0x20, 0x20, + 0x00, 0x10, 0x90, + 0xff, 0x10, 0x90, + 0x00, 0x0f, 0x10, + 0xff, 0x00, 0x00, + 0x00, 0x66, 0x66, + 0xff, 0x66, 0x66, +}; + +#include "tkmap.c" + +static void Init(void) +{ + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearIndex(0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + } +} + +static void Draw(void) +{ + float mapI[2], mapIA[2], mapIR[2]; + + glClear(GL_COLOR_BUFFER_BIT); + + mapI[0] = 0.0; + mapI[1] = 1.0; + mapIR[0] = 0.0; + mapIR[1] = 0.0; + mapIA[0] = 1.0; + mapIA[1] = 1.0; + + glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 2, mapIR); + glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 2, mapI); + glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 2, mapI); + glPixelMapfv(GL_PIXEL_MAP_I_TO_A, 2, mapIA); + glPixelTransferi(GL_MAP_COLOR, GL_TRUE); + + SetColor(COLOR_WHITE); + glRasterPos3fv(boxA); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 24); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 8); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 2); + glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glBitmap(16, 12, 8.0, 0.0, 0.0, 0.0, logo_bits); + + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + SetColor(COLOR_WHITE); + glRasterPos3fv(boxB); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits1); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits2); + + SetColor(COLOR_YELLOW); + glRasterPos3fv(boxC); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits1); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits2); + + SetColor(COLOR_CYAN); + glRasterPos3fv(boxD); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits1); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits2); + + SetColor(COLOR_RED); + glRasterPos3fv(boxE); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits1); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, + OpenGL_bits2); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Bitmap Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/bitmap2.c b/xc/extras/Mesa/samples/bitmap2.c new file mode 100644 index 000000000..5faac8416 --- /dev/null +++ b/xc/extras/Mesa/samples/bitmap2.c @@ -0,0 +1,787 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define EXP_WIDTH 80 +#define EXP_HEIGHT 80 + + +GLenum rgb, doubleBuffer, windType; + +#include "tkmap.c" + +GLenum useLists, abuse; +GLubyte exp_bits[7][800] = { + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x81, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbe, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf6, 0x4f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0x7d, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xea, 0xef, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x55, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0xae, 0x22, 0x36, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xdb, 0xf7, 0x3f, 0x1e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x50, 0xbf, 0xbf, 0x85, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xee, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x4b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x49, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x91, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0xf1, 0x53, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x97, 0x5c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xa0, 0x0c, 0x8c, 0x1b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc4, 0x01, 0x00, 0xc8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x88, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x00, 0x02, 0x40, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, 0xe0, 0x0d, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x72, 0xc8, 0x07, 0x40, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x02, 0x78, 0x2f, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x02, 0xb0, 0x0a, 0x20, 0x77, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x13, 0x10, 0x33, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x02, 0x78, 0xbb, 0x81, 0x09, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0xdc, 0xe7, 0x00, 0x09, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xac, 0x78, 0x00, 0x31, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x03, 0x74, 0x4b, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x02, 0xe8, 0x3e, 0x00, 0x01, 0x10, 0x00, + 0x00, 0x00, 0x80, 0x00, 0xf8, 0x49, 0x80, 0x09, 0x1c, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x40, 0x07, 0x00, 0x05, 0x1c, 0x00, + 0x00, 0x00, 0x80, 0x09, 0x04, 0x80, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x1d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x80, 0xe3, 0x0b, 0x00, 0x22, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x8f, 0x10, 0x00, 0xa0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x4f, 0x20, 0x78, 0x60, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x80, 0x79, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0xc0, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x84, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x60, 0x06, 0x0c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x07, 0x64, 0x3a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x72, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x33, 0x00, 0x00, + 0x00, 0x00, 0xa0, 0x1b, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00, + 0x00, 0x00, 0xd0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x30, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x80, 0x03, 0x03, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0xe2, 0x82, 0x03, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, + 0x00, 0x0e, 0x80, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x0e, 0x80, 0x03, 0xec, 0x10, 0x00, 0x00, 0x60, 0x00, + 0x00, 0x12, 0x00, 0x00, 0x05, 0x93, 0x01, 0x00, 0x20, 0x00, + 0x00, 0x12, 0x00, 0x00, 0x00, 0x5c, 0x0c, 0x00, 0x60, 0x00, + 0x00, 0x30, 0x00, 0xc0, 0x05, 0x81, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x2c, 0x00, 0x00, 0xcc, 0x06, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x30, 0x00, 0x00, 0x28, 0x20, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x30, 0x80, 0x80, 0x22, 0x00, 0x02, 0x00, 0x00, 0x02, + 0x00, 0x20, 0x00, 0x80, 0x02, 0x20, 0x08, 0x00, 0x20, 0x02, + 0x00, 0x38, 0x00, 0x00, 0x00, 0x11, 0x28, 0x00, 0x20, 0x06, + 0x00, 0x20, 0x00, 0x80, 0x0e, 0xc0, 0x21, 0x00, 0x5c, 0x00, + 0x00, 0x24, 0x00, 0x90, 0x40, 0x58, 0x04, 0x00, 0x20, 0x01, + 0x00, 0x24, 0x00, 0x10, 0x22, 0x02, 0x05, 0x00, 0x20, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x28, 0xb6, 0x00, 0x00, 0x20, 0x01, + 0x00, 0x70, 0x00, 0x00, 0x18, 0xc1, 0x00, 0x00, 0xc0, 0x01, + 0x00, 0xc0, 0x00, 0x00, 0x40, 0x83, 0x04, 0x00, 0xc0, 0x01, + 0x00, 0x00, 0x01, 0x80, 0xfc, 0x41, 0x02, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x03, 0x30, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x10, 0x02, 0x00, 0x40, 0x1d, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x30, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, + 0x00, 0x00, 0x38, 0x00, 0x81, 0x0f, 0x00, 0x00, 0x2a, 0x00, + 0x00, 0x00, 0xf8, 0x02, 0x80, 0x0f, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0xf8, 0x02, 0x80, 0x0f, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x06, 0xc0, 0x01, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x14, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x70, 0x00, 0x00, 0x85, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x00, 0x30, 0x00, 0x20, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x80, 0x00, 0x0b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x79, 0x83, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x19, 0x22, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x28, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x02, 0x90, 0x00, 0x00, 0x00, 0x40, + 0x02, 0x02, 0x00, 0x80, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x20, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x28, 0x90, 0x05, 0x00, 0x00, 0x40, + 0x00, 0x00, 0x00, 0x48, 0x05, 0x00, 0x21, 0x00, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x84, 0x00, 0x54, 0x05, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x40, 0x05, 0x80, 0x41, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x01, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x08, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x84, 0x82, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x48, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, + 0x04, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x90, 0x40, 0x40, 0x04, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x41, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x40, 0xa0, 0x00, 0x00, 0x00, 0x50, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x40, 0x02, 0x04, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x80, 0x84, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc2, 0x20, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0xc0, 0x05, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, 0x02, 0x00, 0x00, 0x10, + 0x08, 0x00, 0x00, 0x80, 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, + 0x10, 0x02, 0x00, 0x00, 0x21, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x08, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3a, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x40, 0x04, + 0x00, 0x60, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, + 0x00, 0xb8, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x08, 0x00, 0x00, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x60, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x01, 0x00, 0x01, 0x10, 0x04, 0x00, 0x00, + 0x00, 0x40, 0x00, 0x02, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x05, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xc4, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x42, 0x00, 0x00, 0x04, 0x20, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x81, 0x07, 0x01, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x02, 0x80, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0xc0, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x0d, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, + 0x02, 0x02, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0x00, 0x40, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, + 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + } +}; +GLint exp_lists[7]; + + +static void Init(void) +{ + GLint i; + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearIndex(0.0); + + glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + for (i = 0; i < 7; i++) { + exp_lists[i] = glGenLists(1); + glNewList(exp_lists[i], GL_COMPILE); + glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]); + glEndList(); + } + + abuse = GL_FALSE; + useLists = GL_TRUE; +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case '1': + useLists = !useLists; + break; + case '2': + abuse = !abuse; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + GLint i, j; + + glClear(GL_COLOR_BUFFER_BIT); + + for (i = 0; i < 7; i++) { + for (j = 0; j < 40; j++) { + switch (j % 7) { + case 0: + SetColor(COLOR_YELLOW); + break; + case 1: + SetColor(COLOR_GREEN); + break; + case 2: + SetColor(COLOR_BLUE); + break; + case 3: + SetColor(COLOR_MAGENTA); + break; + case 4: + SetColor(COLOR_CYAN); + break; + case 5: + SetColor(COLOR_WHITE); + break; + case 6: + SetColor(COLOR_RED); + break; + } + glRasterPos3i((j*3)%5, (j*3)%8, 0); + + if (useLists) { + glCallList(exp_lists[i]); + } else { + glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]); + } + if (!abuse) { + break; + } + } + + if (i == 6) { + break; + } + + for (j = 0; j < 40; j++) { + SetColor(COLOR_BLACK); + glRasterPos3i((j*3)%5, (j*3)%8, 0); + if (useLists) { + glCallList(exp_lists[i]); + } else { + glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]); + } + if (!abuse) { + break; + } + } + } + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Bitmap Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/blendeq.c b/xc/extras/Mesa/samples/blendeq.c new file mode 100644 index 000000000..7be52073a --- /dev/null +++ b/xc/extras/Mesa/samples/blendeq.c @@ -0,0 +1,295 @@ +/* +** blendeq.c - Demonstrates the use of the blend_minmax, blend_subtract, +** and blend_logic_op extensions using glBlendEquationEXT. +** +** Over a two-color backround, draw rectangles using twelve blend +** options. The values are read back as UNSIGNED_BYTE and printed +** in hex over each value. These values are useful for logic +** op comparisons when channels are 8 bits deep. +*/ + +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <GL/glut.h> + + +GLenum doubleBuffer; +static int dithering = 0; +static int doPrint = 1; +static int deltaY; +GLint windW, windH; + +static void DrawString(const char *string) +{ + int i; + + for (i = 0; string[i]; i++) + glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]); +} + +static void Init(void) +{ + + glDisable(GL_DITHER); + glShadeModel(GL_FLAT); +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; + + glViewport(0, 0, (GLint)width, (GLint)height); + deltaY = windH /16; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0, windW, 0, windH); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 'd': + dithering = !dithering; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void PrintColorStrings( void ) +{ + GLubyte ubbuf[3]; + int i, xleft, xright; + char colorString[18]; + + xleft = 5 + windW/4; + xright = 5 + windW/2; + + for (i = windH - deltaY + 4; i > 0; i-=deltaY) { + glReadPixels(xleft, i+10, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, ubbuf); + sprintf(colorString, "(0x%x, 0x%x, 0x%x)", + ubbuf[0], ubbuf[1], ubbuf[2]); + glRasterPos2f(xleft, i); + DrawString(colorString); + glReadPixels(xright, i+10, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, ubbuf); + sprintf(colorString, "(0x%x, 0x%x, 0x%x)", + ubbuf[0], ubbuf[1], ubbuf[2]); + glRasterPos2f(xright, i); + DrawString(colorString); + } +} + +static void Draw(void) +{ + int stringOffset = 5, stringx = 8; + int x1, x2, xleft, xright; + int i; + + (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER); + glDisable(GL_BLEND); + + glClearColor(0.5, 0.6, 0.1, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* Draw background */ + glColor3f(0.1, 0.1, 1.0); + glRectf(0.0, 0.0, windW/2, windH); + + /* Draw labels */ + glColor3f(0.8, 0.8, 0.0); + i = windH - deltaY + stringOffset; + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("SOURCE"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("DEST"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("min"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("max"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("subtract"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("reverse_subtract"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("clear"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("set"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("copy"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("noop"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("and"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("invert"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("or"); + glRasterPos2f(stringx, i); i -= deltaY; + DrawString("xor"); + + + i = windH - deltaY; + x1 = windW/4; + x2 = 3 * windW/4; + xleft = 5 + windW/4; + xright = 5 + windW/2; + + /* Draw foreground color for comparison */ + glColor3f(0.9, 0.2, 0.8); + glRectf(x1, i, x2, i+deltaY); + + /* Leave one rectangle of background color */ + + /* Begin test cases */ + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + + i -= 2*deltaY; + glBlendEquationEXT(GL_MIN_EXT); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_MAX_EXT); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_FUNC_SUBTRACT_EXT); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); + glRectf(x1, i, x2, i+deltaY); + + glBlendFunc(GL_ONE, GL_ZERO); + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_CLEAR); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_SET); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_COPY); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_NOOP); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_AND); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_INVERT); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_OR); + glRectf(x1, i, x2, i+deltaY); + + i -= deltaY; + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_XOR); + glRectf(x1, i, x2, i+deltaY); + glRectf(x1, i+10, x2, i+5); + + if (doPrint) { + glDisable(GL_BLEND); + glColor3f(1.0, 1.0, 1.0); + PrintColorStrings(); + } + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } + +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + char *s; + char *extName1 = "GL_EXT_blend_logic_op"; + char *extName2 = "GL_EXT_blend_minmax"; + char *extName3 = "GL_EXT_blend_subtract"; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Blend Equation") == GL_FALSE) { + exit(1); + } + + /* Make sure blend_logic_op extension is there. */ + s = (char *) glGetString(GL_EXTENSIONS); + if (!s) + exit(1); + if (strstr(s,extName1) == 0) { + printf("Blend_logic_op extension is not present.\n"); + exit(1); + } + if (strstr(s,extName2) == 0) { + printf("Blend_minmax extension is not present.\n"); + exit(1); + } + if (strstr(s,extName3) == 0) { + printf("Blend_subtract extension is not present.\n"); + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/blendxor.c b/xc/extras/Mesa/samples/blendxor.c new file mode 100644 index 000000000..a46920d23 --- /dev/null +++ b/xc/extras/Mesa/samples/blendxor.c @@ -0,0 +1,174 @@ +/* +** blendxor.c - Demonstrates the use of the blend_logic_op +** extension to draw hilights. Using XOR to draw the same +** image twice restores the background to its original value. +*/ + +#include <stdio.h> +#include <string.h> +#ifndef _WIN32 +#include <unistd.h> +#endif +#include <stdlib.h> +#include <GL/glut.h> + + +GLenum doubleBuffer; +int dithering = 0; +GLint windW, windH; + +static void Init(void) +{ + glDisable(GL_DITHER); + glShadeModel(GL_FLAT); +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0, 400, 0, 400); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 'd': + dithering = !dithering; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + int i; + + glDisable(GL_BLEND); + + (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER); + + glClearColor(0.5, 0.6, 0.1, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* Draw background prims */ + glColor3f(0.1, 0.1, 1.0); + glBegin(GL_TRIANGLES); + glVertex2i(5, 5); + glVertex2i(130, 50); + glVertex2i(100, 300); + glEnd(); + glColor3f(0.5, 0.2, 0.9); + glBegin(GL_TRIANGLES); + glVertex2i(200, 100); + glVertex2i(330, 50); + glVertex2i(340, 400); + glEnd(); + + glEnable(GL_BLEND); + glBlendEquationEXT(GL_LOGIC_OP); + glLogicOp(GL_XOR); + + /* Draw a set of rectangles across the window */ + glColor3f(0.9, 0.2, 0.8); + for(i = 0; i < 400; i+=60) { + glBegin(GL_POLYGON); + glVertex2i(i, 100); + glVertex2i(i+50, 100); + glVertex2i(i+50, 200); + glVertex2i(i, 200); + glEnd(); + } + glFlush(); /* Added by Brian Paul */ +#ifndef _WIN32 + sleep(2); +#endif + + /* Redraw the rectangles, which should erase them */ + for(i = 0; i < 400; i+=60) { + glBegin(GL_POLYGON); + glVertex2i(i, 100); + glVertex2i(i+50, 100); + glVertex2i(i+50, 200); + glVertex2i(i, 200); + glEnd(); + } + glFlush(); + + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + char *s; + char *extName = "GL_EXT_blend_logic_op"; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 400); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Blend XOR") == GL_FALSE) { + exit(1); + } + + /* Make sure blend_logic_op extension is there. */ + s = (char *) glGetString(GL_EXTENSIONS); + if (!s) + exit(1); + if (strstr(s,extName) == 0) { + printf("Blend_logic_op extension is not present.\n"); + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/copy.c b/xc/extras/Mesa/samples/copy.c new file mode 100644 index 000000000..391c637d6 --- /dev/null +++ b/xc/extras/Mesa/samples/copy.c @@ -0,0 +1,193 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#include "loadppm.c" + +GLenum doubleBuffer; +GLint windW, windH; + +char *fileName = 0; +PPMImage *image; +float point[3]; +float zoom; +GLint x, y; + +static void Init(void) +{ + + glClearColor(0.0, 0.0, 0.0, 0.0); + + x = 0; + y = windH; + zoom = 1.8; +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; + + glViewport(0, 0, windW, windH); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0, windW, 0, windH); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 'Z': + zoom += 0.2; + break; + case 'z': + zoom -= 0.2; + if (zoom < 0.2) { + zoom = 0.2; + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Mouse(int button, int state, int mouseX, int mouseY) +{ + if (state != GLUT_DOWN) + return; + x = (GLint)mouseX; + y = (GLint)mouseY; + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + point[0] = (windW / 2) - (image->sizeX / 2); + point[1] = (windH / 2) - (image->sizeY / 2); + point[2] = 0; + glRasterPos3fv(point); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelZoom(1.0, 1.0); + glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, + image->data); + + point[0] = (float)x; + point[1] = windH - (float)y; + point[2] = 0.0; + glRasterPos3fv(point); + + glPixelZoom(zoom, zoom); + glCopyPixels((windW/2)-(image->sizeX/2), + (windH/2)-(image->sizeY/2), + image->sizeX, image->sizeY, GL_COLOR); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-f") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-f (No file name).\n"); + return GL_FALSE; + } else { + fileName = argv[++i]; + } + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + if (fileName == 0) { + printf("No image file.\n"); + exit(1); + } + + image = LoadPPM(fileName); + + windW = 300; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Copy Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutMouseFunc(Mouse); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/cursor.c b/xc/extras/Mesa/samples/cursor.c new file mode 100644 index 000000000..de8fc5855 --- /dev/null +++ b/xc/extras/Mesa/samples/cursor.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +GLenum rgb, doubleBuffer, windType; +int windX, windY; +int cursor; + + +#include "tkmap.c" + +static void Init(void) +{ + cursor = 0; + glutSetCursor(cursor); + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearIndex(0.0); +} + +static void Reshape(int width, int height) +{ + + windX = width; + windY = height; + glViewport(0, 0, windX, windY); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0, windX, 0, windY); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 32: + cursor++; + if (cursor > 19) { + cursor = 0; + } + glutSetCursor(cursor); + } +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + glBegin(GL_POLYGON); + SetColor(COLOR_BLACK); + glVertex2i(0, 0); + SetColor(COLOR_RED); + glVertex2i(windX, 0); + SetColor(COLOR_GREEN); + glVertex2i(windX, windY); + SetColor(COLOR_BLUE); + glVertex2i(0, windY); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + windX = 300; + windY = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( windX, windY); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Cursor Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/depth.c b/xc/extras/Mesa/samples/depth.c new file mode 100644 index 000000000..afe2ec17a --- /dev/null +++ b/xc/extras/Mesa/samples/depth.c @@ -0,0 +1,209 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define CI_OFFSET_1 16 +#define CI_OFFSET_2 32 + + +GLenum rgb, doubleBuffer; + +GLenum antiAlias, stipple; +GLubyte stippleBits[32*4] = { + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +}; + + +#include "tkmap.c" + +static void Init(void) +{ + GLint i; + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearIndex(0.0); + + if (!rgb) { + for (i = 0; i < 16; i++) { + glutSetColor(i+CI_OFFSET_1, 0.0, 0.0, i/15.0); + glutSetColor(i+CI_OFFSET_2, 0.0, i/15.0, 0.0); + } + } + + glPolygonStipple(stippleBits); + + antiAlias = GL_FALSE; + stipple = GL_FALSE; +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case '1': + antiAlias = !antiAlias; + break; + case '2': + stipple = !stipple; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + GLint ci1, ci2; + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + if (antiAlias) { + ci1 = CI_OFFSET_1; + ci2 = CI_OFFSET_2; + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glEnable(GL_BLEND); + glEnable(GL_POLYGON_SMOOTH); + glDisable(GL_DEPTH_TEST); + } else { + ci1 = COLOR_BLUE; + ci2 = COLOR_GREEN; + glDisable(GL_BLEND); + glDisable(GL_POLYGON_SMOOTH); + glEnable(GL_DEPTH_TEST); + } + + if (stipple) { + glEnable(GL_POLYGON_STIPPLE); + } else { + glDisable(GL_POLYGON_STIPPLE); + } + + glBegin(GL_TRIANGLES); + (rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexi(ci1); + glVertex3f( 0.9, -0.9, -30.0); + glVertex3f( 0.9, 0.9, -30.0); + glVertex3f(-0.9, 0.0, -30.0); + (rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexi(ci2); + glVertex3f(-0.9, -0.9, -40.0); + glVertex3f(-0.9, 0.9, -40.0); + glVertex3f( 0.9, 0.0, -25.0); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_DEPTH; + type |= (rgb) ? GLUT_RGB : GLUT_INDEX; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Depth Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/eval.c b/xc/extras/Mesa/samples/eval.c new file mode 100644 index 000000000..3ad9c5468 --- /dev/null +++ b/xc/extras/Mesa/samples/eval.c @@ -0,0 +1,472 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + + +#define VORDER 10 +#define CORDER 10 +#define TORDER 3 + +#define VMAJOR_ORDER 2 +#define VMINOR_ORDER 3 + +#define CMAJOR_ORDER 2 +#define CMINOR_ORDER 2 + +#define TMAJOR_ORDER 2 +#define TMINOR_ORDER 2 + +#define VDIM 4 +#define CDIM 4 +#define TDIM 2 + +#define ONE_D 1 +#define TWO_D 2 + +#define EVAL 3 +#define MESH 4 + + +GLenum doubleBuffer; + +float rotX = 0.0, rotY = 0.0, translateZ = -1.0; + +GLenum arrayType = ONE_D; +GLenum colorType = GL_FALSE; +GLenum textureType = GL_FALSE; +GLenum polygonFilled = GL_FALSE; +GLenum lighting = GL_FALSE; +GLenum mapPoint = GL_FALSE; +GLenum mapType = EVAL; + +double point1[10*4] = { + -0.5, 0.0, 0.0, 1.0, + -0.4, 0.5, 0.0, 1.0, + -0.3,-0.5, 0.0, 1.0, + -0.2, 0.5, 0.0, 1.0, + -0.1,-0.5, 0.0, 1.0, + 0.0, 0.5, 0.0, 1.0, + 0.1,-0.5, 0.0, 1.0, + 0.2, 0.5, 0.0, 1.0, + 0.3,-0.5, 0.0, 1.0, + 0.4, 0.0, 0.0, 1.0, +}; +double cpoint1[10*4] = { + 0.0, 0.0, 1.0, 1.0, + 0.3, 0.0, 0.7, 1.0, + 0.6, 0.0, 0.3, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.3, 0.0, 1.0, + 1.0, 0.6, 0.0, 1.0, + 1.0, 1.0, 0.0, 1.0, + 1.0, 1.0, 0.5, 1.0, + 1.0, 1.0, 1.0, 1.0, +}; +double tpoint1[11*4] = { + 0.0, 0.0, 0.0, 1.0, + 0.0, 0.1, 0.0, 1.0, + 0.0, 0.2, 0.0, 1.0, + 0.0, 0.3, 0.0, 1.0, + 0.0, 0.4, 0.0, 1.0, + 0.0, 0.5, 0.0, 1.0, + 0.0, 0.6, 0.0, 1.0, + 0.0, 0.7, 0.0, 1.0, + 0.0, 0.8, 0.0, 1.0, + 0.0, 0.9, 0.0, 1.0, +}; +double point2[2*3*4] = { + -0.5, -0.5, 0.5, 1.0, + 0.0, 1.0, 0.5, 1.0, + 0.5, -0.5, 0.5, 1.0, + -0.5, 0.5, -0.5, 1.0, + 0.0, -1.0, -0.5, 1.0, + 0.5, 0.5, -0.5, 1.0, +}; +double cpoint2[2*2*4] = { + 0.0, 0.0, 0.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + 0.0, 1.0, 0.0, 1.0, + 1.0, 1.0, 1.0, 1.0, +}; +double tpoint2[2*2*2] = { + 0.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 1.0, 1.0, +}; +float textureImage[4*2*4] = { + 1.0, 1.0, 1.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 1.0, 1.0, 1.0, +}; + + +static void Init(void) +{ + static float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float diffuse[] = {1.0, 1.0, 1.0, 1.0}; + static float position[] = {0.0, 0.0, -150.0, 0.0}; + static float front_mat_diffuse[] = {1.0, 0.2, 1.0, 1.0}; + static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; + static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; + static float lmodel_twoside[] = {GL_TRUE}; + static float decal[] = {GL_DECAL}; + static float repeat[] = {GL_REPEAT}; + static float nr[] = {GL_NEAREST}; + + glFrontFace(GL_CCW); + + glEnable(GL_DEPTH_TEST); + + glMap1d(GL_MAP1_VERTEX_4, 0.0, 1.0, VDIM, VORDER, point1); + glMap1d(GL_MAP1_COLOR_4, 0.0, 1.0, CDIM, CORDER, cpoint1); + + glMap2d(GL_MAP2_VERTEX_4, 0.0, 1.0, VMINOR_ORDER*VDIM, VMAJOR_ORDER, 0.0, + 1.0, VDIM, VMINOR_ORDER, point2); + glMap2d(GL_MAP2_COLOR_4, 0.0, 1.0, CMINOR_ORDER*CDIM, CMAJOR_ORDER, 0.0, + 1.0, CDIM, CMINOR_ORDER, cpoint2); + glMap2d(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, TMINOR_ORDER*TDIM, + TMAJOR_ORDER, 0.0, 1.0, TDIM, TMINOR_ORDER, tpoint2); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + + glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse); + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nr); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nr); + glTexImage2D(GL_TEXTURE_2D, 0, 4, 2, 4, 0, GL_RGBA, GL_FLOAT, + (GLvoid *)textureImage); +} + +static void DrawPoints1(void) +{ + GLint i; + + glColor3f(0.0, 1.0, 0.0); + glPointSize(2); + glBegin(GL_POINTS); + for (i = 0; i < VORDER; i++) { + glVertex4dv(&point1[i*4]); + } + glEnd(); +} + +static void DrawPoints2(void) +{ + GLint i, j; + + glColor3f(1.0, 0.0, 1.0); + glPointSize(2); + glBegin(GL_POINTS); + for (i = 0; i < VMAJOR_ORDER; i++) { + for (j = 0; j < VMINOR_ORDER; j++) { + glVertex4dv(&point2[i*4*VMINOR_ORDER+j*4]); + } + } + glEnd(); +} + +static void DrawMapEval1(float du) +{ + float u; + + glColor3f(1.0, 0.0, 0.0); + glBegin(GL_LINE_STRIP); + for (u = 0.0; u < 1.0; u += du) { + glEvalCoord1d(u); + } + glEvalCoord1d(1.0); + glEnd(); +} + +static void DrawMapEval2(float du, float dv) +{ + float u, v, tmp; + + glColor3f(1.0, 0.0, 0.0); + for (v = 0.0; v < 1.0; v += dv) { + glBegin(GL_QUAD_STRIP); + for (u = 0.0; u <= 1.0; u += du) { + glEvalCoord2d(u,v); + tmp = (v + dv < 1.0) ? (v + dv) : 1.0; + glEvalCoord2d(u, tmp); + } + glEvalCoord2d(1.0, v); + glEvalCoord2d(1.0, v+dv); + glEnd(); + } +} + +static void RenderEval(void) +{ + + if (colorType) { + glEnable(GL_MAP1_COLOR_4); + glEnable(GL_MAP2_COLOR_4); + } else { + glDisable(GL_MAP1_COLOR_4); + glDisable(GL_MAP2_COLOR_4); + } + + if (textureType) { + glEnable(GL_TEXTURE_2D); + glEnable(GL_MAP2_TEXTURE_COORD_2); + } else { + glDisable(GL_TEXTURE_2D); + glDisable(GL_MAP2_TEXTURE_COORD_2); + } + + if (polygonFilled) { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } else { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } + + glShadeModel(GL_SMOOTH); + + switch (mapType) { + case EVAL: + switch (arrayType) { + case ONE_D: + glDisable(GL_MAP2_VERTEX_4); + glEnable(GL_MAP1_VERTEX_4); + DrawPoints1(); + DrawMapEval1(0.1/VORDER); + break; + case TWO_D: + glDisable(GL_MAP1_VERTEX_4); + glEnable(GL_MAP2_VERTEX_4); + DrawPoints2(); + DrawMapEval2(0.1/VMAJOR_ORDER,0.1/VMINOR_ORDER); + break; + default: + break; + } + break; + case MESH: + switch (arrayType) { + case ONE_D: + DrawPoints1(); + glDisable(GL_MAP2_VERTEX_4); + glEnable (GL_MAP1_VERTEX_4); + glColor3f(0.0, 0.0, 1.0); + glMapGrid1d(40, 0.0, 1.0); + if (mapPoint) { + glPointSize(2); + glEvalMesh1(GL_POINT, 0, 40); + } else { + glEvalMesh1(GL_LINE, 0, 40); + } + break; + case TWO_D: + DrawPoints2(); + glDisable(GL_MAP1_VERTEX_4); + glEnable(GL_MAP2_VERTEX_4); + glColor3f(0.0, 0.0, 1.0); + glMapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0); + if (mapPoint) { + glPointSize(2); + glEvalMesh2(GL_POINT, 0, 20, 0, 20); + } else if (polygonFilled) { + glEvalMesh2(GL_FILL, 0, 20, 0, 20); + } else { + glEvalMesh2(GL_LINE, 0, 20, 0, 20); + } + break; + default: + break; + } + break; + default: + break; + } +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 10.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + switch (key) { + case GLUT_KEY_LEFT: + rotY -= 30; + break; + case GLUT_KEY_RIGHT: + rotY += 30; + break; + case GLUT_KEY_UP: + rotX -= 30; + break; + case GLUT_KEY_DOWN: + rotX += 30; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(1); + case '1': + arrayType = ONE_D; + break; + case '2': + arrayType = TWO_D; + break; + case 'e': + mapType = EVAL; + break; + case 'm': + mapType = MESH; + break; + case 'f': + polygonFilled = !polygonFilled; + break; + case 'p': + mapPoint = !mapPoint; + break; + case 'c': + colorType = !colorType; + break; + case 't': + textureType = !textureType; + break; + case 'l': + lighting =! lighting; + if (lighting) { + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_AUTO_NORMAL); + } else { + glDisable(GL_LIGHTING); + glDisable(GL_LIGHT0); + glDisable(GL_AUTO_NORMAL); + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + + glTranslatef(0.0, 0.0 , translateZ); + glRotatef(rotX, 1, 0, 0); + glRotatef(rotY, 0, 1, 0); + RenderEval(); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_RGB | GLUT_DEPTH; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Evaluator Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/fog.c b/xc/extras/Mesa/samples/fog.c new file mode 100644 index 000000000..3f3ffdbcc --- /dev/null +++ b/xc/extras/Mesa/samples/fog.c @@ -0,0 +1,311 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + +GLenum rgb, doubleBuffer; + +#include "tkmap.c" + +double plane[4] = { + 1.0, 0.0, -1.0, 0.0 +}; +float rotX = 5.0, rotY = -5.0, zTranslate = -65.0; +float fogDensity = 0.02; +GLint cubeList = 1; + +float scp[18][3] = { + { + 1.000000, 0.000000, 0.000000 + }, + { + 1.000000, 0.000000, 5.000000 + }, + { + 0.707107, 0.707107, 0.000000 + }, + { + 0.707107, 0.707107, 5.000000 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + 0.000000, 1.000000, 5.000000 + }, + { + -0.707107, 0.707107, 0.000000 + }, + { + -0.707107, 0.707107, 5.000000 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -1.000000, 0.000000, 5.000000 + }, + { + -0.707107, -0.707107, 0.000000 + }, + { + -0.707107, -0.707107, 5.000000 + }, + { + 0.000000, -1.000000, 0.000000 + }, + { + 0.000000, -1.000000, 5.000000 + }, + { + 0.707107, -0.707107, 0.000000 + }, + { + 0.707107, -0.707107, 5.000000 + }, + { + 1.000000, 0.000000, 0.000000 + }, + { + 1.000000, 0.000000, 5.000000 + }, +}; + + +static void Build_lists(void) +{ + + glNewList(cubeList, GL_COMPILE); + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(scp[0]); glVertex3fv(scp[0]); + glNormal3fv(scp[0]); glVertex3fv(scp[1]); + glNormal3fv(scp[2]); glVertex3fv(scp[2]); + glNormal3fv(scp[2]); glVertex3fv(scp[3]); + glNormal3fv(scp[4]); glVertex3fv(scp[4]); + glNormal3fv(scp[4]); glVertex3fv(scp[5]); + glNormal3fv(scp[6]); glVertex3fv(scp[6]); + glNormal3fv(scp[6]); glVertex3fv(scp[7]); + glNormal3fv(scp[8]); glVertex3fv(scp[8]); + glNormal3fv(scp[8]); glVertex3fv(scp[9]); + glNormal3fv(scp[10]); glVertex3fv(scp[10]); + glNormal3fv(scp[10]); glVertex3fv(scp[11]); + glNormal3fv(scp[12]); glVertex3fv(scp[12]); + glNormal3fv(scp[12]); glVertex3fv(scp[13]); + glNormal3fv(scp[14]); glVertex3fv(scp[14]); + glNormal3fv(scp[14]); glVertex3fv(scp[15]); + glNormal3fv(scp[16]); glVertex3fv(scp[16]); + glNormal3fv(scp[16]); glVertex3fv(scp[17]); + glEnd(); + glEndList(); +} + +static void Init(void) +{ + static float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float diffuse[] = {1.0, 1.0, 1.0, 1.0}; + static float position[] = {90.0, 90.0, 0.0, 0.0}; + static float front_mat_shininess[] = {30.0}; + static float front_mat_specular[] = {0.0, 0.0, 0.0, 1.0}; + static float front_mat_diffuse[] = {0.0, 1.0, 0.0, 1.0}; + static float back_mat_shininess[] = {50.0}; + static float back_mat_specular[] = {0.0, 0.0, 1.0, 1.0}; + static float back_mat_diffuse[] = {1.0, 0.0, 0.0, 1.0}; + static float lmodel_ambient[] = {0.0, 0.0, 0.0, 1.0}; + static float fog_color[] = {0.8, 0.8, 0.8, 1.0}; + + glFrontFace(GL_CW); + + glEnable(GL_DEPTH_TEST); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess); + glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular); + glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess); + glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular); + glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP); + glFogf(GL_FOG_DENSITY, fogDensity); + if (rgb) { + glFogfv(GL_FOG_COLOR, fog_color); + glClearColor(0.8, 0.8, 0.8, 1.0); + } else { + glFogi(GL_FOG_INDEX, 1<<5); + SetFogRamp(5, 3); + glClearIndex(128); + } + + Build_lists(); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45.0, 1.0, 1.0, 200.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_UP: + rotX -= 5; + break; + case GLUT_KEY_DOWN: + rotX += 5; + break; + case GLUT_KEY_LEFT: + rotY -= 5; + break; + case GLUT_KEY_RIGHT: + rotY += 5; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 'D': + if (rgb) { + fogDensity *= 1.10; + glFogf(GL_FOG_DENSITY, fogDensity); + } + break; + case 'd': + if (rgb) { + fogDensity /= 1.10; + glFogf(GL_FOG_DENSITY, fogDensity); + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + + glTranslatef(0, 0, zTranslate); + glRotatef(rotY, 0,1,0); + glRotatef(rotX, 1,0,0); + glScalef(1.0, 1.0, 10.0); + + glCallList(cubeList); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_TRUE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_DEPTH; + type |= (rgb) ? GLUT_RGB : GLUT_INDEX; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Fog Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/font.c b/xc/extras/Mesa/samples/font.c new file mode 100644 index 000000000..a0091a65d --- /dev/null +++ b/xc/extras/Mesa/samples/font.c @@ -0,0 +1,273 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define OPENGL_WIDTH 24 +#define OPENGL_HEIGHT 13 + + +char string[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"; +GLenum rgb, doubleBuffer, windType; +float angleX = 0.0, angleY = 0.0, angleZ = 0.0; +float scaleX = 1.0, scaleY = 1.0, scaleZ = 1.0; +float shiftX = 0.0, shiftY = 0.0, shiftZ = 0.0; + + +#include "tkmap.c" + + +static void DrawBitmapString(void *font, const char *string) +{ + int i; + + for (i = 0; string[i]; i++) + glutBitmapCharacter(font, string[i]); +} + +static void DrawStrokeString(void *font, const char *string) +{ + int i; + + for (i = 0; string[i]; i++) + glutStrokeCharacter(font, string[i]); +} + +static void Init(void) +{ + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearIndex(0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-400.0, 400.0, -200.0, 200.0, -400.0, 400.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + shiftX -= 20.0; + break; + case GLUT_KEY_RIGHT: + shiftX += 20.0; + break; + case GLUT_KEY_UP: + shiftY += 20.0; + break; + case GLUT_KEY_DOWN: + shiftY -= 20.0; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + + case 'n': + shiftZ += 20.0; + break; + case 'm': + shiftZ -= 20.0; + break; + + case 'q': + scaleX -= 0.1; + if (scaleX < 0.1) { + scaleX = 0.1; + } + break; + case 'w': + scaleX += 0.1; + break; + case 'a': + scaleY -= 0.1; + if (scaleY < 0.1) { + scaleY = 0.1; + } + break; + case 's': + scaleY += 0.1; + break; + case 'z': + scaleZ -= 0.1; + if (scaleZ < 0.1) { + scaleZ = 0.1; + } + break; + case 'x': + scaleZ += 0.1; + break; + + case 'e': + angleX -= 5.0; + if (angleX < 0.0) { + angleX = 360.0 + angleX; + } + break; + case 'r': + angleX += 5.0; + if (angleX > 360.0) { + angleX = angleX - 360.0; + } + break; + case 'd': + angleY -= 5.0; + if (angleY < 0.0) { + angleY = 360.0 + angleY; + } + break; + case 'f': + angleY += 5.0; + if (angleY > 360.0) { + angleY = angleY - 360.0; + } + break; + case 'c': + angleZ -= 5.0; + if (angleZ < 0.0) { + angleZ = 360.0 + angleZ; + } + break; + case 'v': + angleZ += 5.0; + if (angleZ > 360.0) { + angleZ = angleZ - 360.0; + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + SetColor(COLOR_WHITE); + + glPushMatrix(); + + glTranslatef(shiftX, shiftY, shiftZ); + glRotatef(angleX, 1.0, 0.0, 0.0); + glRotatef(angleY, 0.0, 1.0, 0.0); + glRotatef(angleZ, 0.0, 0.0, 1.0); + glScalef(scaleX, scaleY, scaleZ); + + glPushMatrix(); + glRasterPos2f(-390.5, 0.5); + DrawBitmapString(GLUT_BITMAP_9_BY_15, string); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(-390.5, -30.5, 0.0); + DrawStrokeString(GLUT_STROKE_ROMAN, string); + glPopMatrix(); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Font Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/line.c b/xc/extras/Mesa/samples/line.c new file mode 100644 index 000000000..83f70cb3a --- /dev/null +++ b/xc/extras/Mesa/samples/line.c @@ -0,0 +1,219 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define CI_OFFSET 16 + + +GLenum rgb, doubleBuffer, windType; + +GLenum mode1, mode2; +GLint size; +float pntA[3] = { + -160.0, 0.0, 0.0 +}; +float pntB[3] = { + -130.0, 0.0, 0.0 +}; +float pntC[3] = { + -40.0, -50.0, 0.0 +}; +float pntD[3] = { + 30.0, 60.0, 0.0 +}; + + +#include "tkmap.c" + +static void Init(void) +{ + GLint i; + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glLineStipple(1, 0xF0E0); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + + if (!rgb) { + for (i = 0; i < 16; i++) { + glutSetColor(i+CI_OFFSET, i/15.0, i/15.0, 0.0); + } + } + + mode1 = GL_FALSE; + mode2 = GL_FALSE; + size = 1; +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case '1': + mode1 = !mode1; + break; + case '2': + mode2 = !mode2; + break; + case 'W': + size++; + break; + case 'w': + size--; + if (size < 1) { + size = 1; + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + GLint ci, i; + + glClear(GL_COLOR_BUFFER_BIT); + + glLineWidth(size); + + if (mode1) { + glEnable(GL_LINE_STIPPLE); + } else { + glDisable(GL_LINE_STIPPLE); + } + + if (mode2) { + ci = CI_OFFSET; + glEnable(GL_LINE_SMOOTH); + glEnable(GL_BLEND); + } else { + ci = COLOR_YELLOW; + glDisable(GL_LINE_SMOOTH); + glDisable(GL_BLEND); + } + + glPushMatrix(); + + glShadeModel( GL_FLAT ); + + for (i = 0; i < 360; i += 5) { + glRotatef(5.0, 0,0,1); + + (rgb) ? glColor3f(1.0, 1.0, 0.0) : glIndexi(ci); + glBegin(GL_LINE_STRIP); + glVertex3fv(pntA); + glVertex3fv(pntB); + glEnd(); + + glPointSize(1); + + SetColor(COLOR_GREEN); + glBegin(GL_POINTS); + glVertex3fv(pntA); + glVertex3fv(pntB); + glEnd(); + } + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_TRUE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Line Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/loadppm.c b/xc/extras/Mesa/samples/loadppm.c new file mode 100644 index 000000000..bf7c8dd1e --- /dev/null +++ b/xc/extras/Mesa/samples/loadppm.c @@ -0,0 +1,72 @@ + +typedef struct { + int sizeX, sizeY; + GLubyte *data; +} PPMImage; + +static PPMImage *LoadPPM(const char *filename) +{ + char buff[16]; + PPMImage *result; + FILE *fp; + int maxval; + + fp = fopen(filename, "rb"); + if (!fp) + { + fprintf(stderr, "Unable to open file `%s'\n", filename); + exit(1); + } + + if (!fgets(buff, sizeof(buff), fp)) + { + perror(filename); + exit(1); + } + + if (buff[0] != 'P' || buff[1] != '6') + { + fprintf(stderr, "Invalid image format (must be `P6')\n"); + exit(1); + } + + result = malloc(sizeof(PPMImage)); + if (!result) + { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } + + if (fscanf(fp, "%d %d", &result->sizeX, &result->sizeY) != 2) + { + fprintf(stderr, "Error loading image `%s'\n", filename); + exit(1); + } + + if (fscanf(fp, "%d", &maxval) != 1) + { + fprintf(stderr, "Error loading image `%s'\n", filename); + exit(1); + } + + while (fgetc(fp) != '\n') + ; + + result->data = malloc(3 * result->sizeX * result->sizeY); + if (!result) + { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } + + if (fread(result->data, 3 * result->sizeX, result->sizeY, fp) != result->sizeY) + { + fprintf(stderr, "Error loading image `%s'\n", filename); + exit(1); + } + + fclose(fp); + + return result; +} + diff --git a/xc/extras/Mesa/samples/logo.c b/xc/extras/Mesa/samples/logo.c new file mode 100644 index 000000000..afb96b70c --- /dev/null +++ b/xc/extras/Mesa/samples/logo.c @@ -0,0 +1,1630 @@ +/* $Id: logo.c,v 1.1.1.1 2000/12/05 16:38:38 dawes Exp $ */ + +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define PI 3.141592654 + +#define BLACK 0 +#define GRAY 128 +#define WHITE 255 +#define BL 0x00 +#define WH 0xFF +#define RD 0xA4,0x00,0x00,0xFF +#define WT 0xFF,0xFF,0xFF,0xFF + +#define CHECKIMAGEWIDTH 8 +#define CHECKIMAGEHEIGHT 8 +#define BRICKIMAGEWIDTH 16 +#define BRICKIMAGEHEIGHT 16 + + +GLenum rgb, doubleBuffer; + +#include "tkmap.c" + +float black[3] = {0.0, 0.0, 0.0}; +float white[3] = {1.0, 1.0, 1.0}; +float gray[3] = {0.5, 0.5, 0.5}; +float blue[3] = {0.0, 0.0, 1.0}; +GLint colorIndexes[3] = {0, 200, 255}; + +GLenum polyMode; +GLboolean dithering; +GLboolean shade; +GLboolean doStipple; +GLboolean noDraw = 0; +GLboolean LineSmooth = GL_FALSE; + +double plane[4] = {1.0, 0.0, -1.0, 0.0}; +float xRotation = 30.0, yRotation = 30.0; +float zTranslation = -15.0; + +GLint singleCylinder; +GLint doubleCylinder; +GLint elbow, logo; + +GLubyte checkImage[3*CHECKIMAGEWIDTH*CHECKIMAGEHEIGHT] = { + BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, + WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH, + WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, + BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, + WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH, + WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, + BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, + WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH, + WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, + BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, + WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH, + WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, +}; +GLubyte brickImage[4*BRICKIMAGEWIDTH*BRICKIMAGEHEIGHT] = { + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, + RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD +}; + +GLubyte *image = checkImage; +GLint imageHeight = CHECKIMAGEHEIGHT; +GLint imageWidth = CHECKIMAGEWIDTH; + +static float decal[] = { + GL_DECAL, +}; +static float modulate[] = { + GL_MODULATE, +}; +static float repeat[] = { + GL_REPEAT, +}; +static float nearest[] = { + GL_NEAREST, +}; + +GLubyte stipple[4*32] = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + 0x00, 0x0F, 0xF0, 0x00, + + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, +}; + +float tscp[18][2] = { + { + 0.0, 0.0 + }, + { + 1.0, 0.0 + }, + { + 0.0, 0.125 + }, + { + 1.0, 0.125 + }, + { + 0.0, 0.250 + }, + { + 1.0, 0.25 + }, + { + 0.0, 0.375 + }, + { + 1.0, 0.375 + }, + { + 0.0, 0.50 + }, + { + 1.0, 0.50 + }, + { + 0.0, 0.625 + }, + { + 1.0, 0.625 + }, + { + 0.0, 0.75 + }, + { + 1.0, 0.75 + }, + { + 0.0, 0.875 + }, + { + 1.0, 0.875 + }, + { + 0.0, 1.0 + }, + { + 1.0, 1.0 + } +}; +float scp[18][3] = { + { + 1.000000, 0.000000, 0.000000 + }, + { + 1.000000, 0.000000, 5.000000 + }, + { + 0.707107, 0.707107, 0.000000 + }, + { + 0.707107, 0.707107, 5.000000 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + 0.000000, 1.000000, 5.000000 + }, + { + -0.707107, 0.707107, 0.000000 + }, + { + -0.707107, 0.707107, 5.000000 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -1.000000, 0.000000, 5.000000 + }, + { + -0.707107, -0.707107, 0.000000 + }, + { + -0.707107, -0.707107, 5.000000 + }, + { + 0.000000, -1.000000, 0.000000 + }, + { + 0.000000, -1.000000, 5.000000 + }, + { + 0.707107, -0.707107, 0.000000 + }, + { + 0.707107, -0.707107, 5.000000 + }, + { + 1.000000, 0.000000, 0.000000 + }, + { + 1.000000, 0.000000, 5.000000 + } +}; +float dcp[18][3] = { + { + 1.000000, 0.000000, 0.000000 + }, + { + 1.000000, 0.000000, 7.000000 + }, + { + 0.707107, 0.707107, 0.000000 + }, + { + 0.707107, 0.707107, 7.000000 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + 0.000000, 1.000000, 7.000000 + }, + { + -0.707107, 0.707107, 0.000000 + }, + { + -0.707107, 0.707107, 7.000000 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -1.000000, 0.000000, 7.000000 + }, + { + -0.707107, -0.707107, 0.000000 + }, + { + -0.707107, -0.707107, 7.000000 + }, + { + 0.000000, -1.000000, 0.000000 + }, + { + 0.000000, -1.000000, 7.000000 + }, + { + 0.707107, -0.707107, 0.000000 + }, + { + 0.707107, -0.707107, 7.000000 + }, + { + 1.000000, 0.000000, 0.000000 + }, + { + 1.000000, 0.000000, 7.000000 + } +}; +float ep[7][9][3] = { + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.707107, 0.000000 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.707107, 0.000000 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.707107, 0.000000 + }, + { + 0.000000, -1.000000, 0.000000 + }, + { + 0.707107, -0.707107, 0.000000 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.034074, 0.258819 + }, + { + 0.707107, 0.717087, 0.075806 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.717087, 0.075806 + }, + { + -1.000000, 0.034074, 0.258819 + }, + { + -0.707107, -0.648939, 0.441832 + }, + { + 0.000000, -0.931852, 0.517638 + }, + { + 0.707107, -0.648939, 0.441832 + }, + { + 1.000000, 0.034074, 0.258819 + } + }, + { + { + 1.000000, 0.133975, 0.500000 + }, + { + 0.707107, 0.746347, 0.146447 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.746347, 0.146447 + }, + { + -1.000000, 0.133975, 0.500000 + }, + { + -0.707107, -0.478398, 0.853553 + }, + { + 0.000000, -0.732051, 1.000000 + }, + { + 0.707107, -0.478398, 0.853553 + }, + { + 1.000000, 0.133975, 0.500000 + } + }, + { + { + 1.000000, 0.292893, 0.707107 + }, + { + 0.707107, 0.792893, 0.207107 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.792893, 0.207107 + }, + { + -1.000000, 0.292893, 0.707107 + }, + { + -0.707107, -0.207107, 1.207107 + }, + { + 0.000000, -0.414214, 1.414214 + }, + { + 0.707107, -0.207107, 1.207107 + }, + { + 1.000000, 0.292893, 0.707107 + } + }, + { + { + 1.000000, 0.500000, 0.866025 + }, + { + 0.707107, 0.853553, 0.253653 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.853553, 0.253653 + }, + { + -1.000000, 0.500000, 0.866025 + }, + { + -0.707107, 0.146447, 1.478398 + }, + { + 0.000000, 0.000000, 1.732051 + }, + { + 0.707107, 0.146447, 1.478398 + }, + { + 1.000000, 0.500000, 0.866025 + } + }, + { + { + 1.000000, 0.741181, 0.965926 + }, + { + 0.707107, 0.924194, 0.282913 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.924194, 0.282913 + }, + { + -1.000000, 0.741181, 0.965926 + }, + { + -0.707107, 0.558168, 1.648939 + }, + { + 0.000000, 0.482362, 1.931852 + }, + { + 0.707107, 0.558168, 1.648939 + }, + { + 1.000000, 0.741181, 0.965926 + } + }, + { + { + 1.000000, 1.000000, 1.000000 + }, + { + 0.707107, 1.000000, 0.292893 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 1.000000, 0.292893 + }, + { + -1.000000, 1.000000, 1.000000 + }, + { + -0.707107, 1.000000, 1.707107 + }, + { + 0.000000, 1.000000, 2.000000 + }, + { + 0.707107, 1.000000, 1.707107 + }, + { + 1.000000, 1.000000, 1.000000 + } + } +}; +float en[7][9][3] = { + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.707107, 0.000000 + }, + { + 0.000000, 1.000000, 0.000000 + }, + { + -0.707107, 0.707107, 0.000000 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.707107, 0.000000 + }, + { + 0.000000, -1.000000, 0.000000 + }, + { + 0.707107, -0.707107, 0.000000 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.683013, -0.183013 + }, + { + 0.000000, 0.965926, -0.258819 + }, + { + -0.707107, 0.683013, -0.183013 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.683013, 0.183013 + }, + { + 0.000000, -0.965926, 0.258819 + }, + { + 0.707107, -0.683013, 0.183013 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.612372, -0.353553 + }, + { + 0.000000, 0.866025, -0.500000 + }, + { + -0.707107, 0.612372, -0.353553 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.612372, 0.353553 + }, + { + 0.000000, -0.866025, 0.500000 + }, + { + 0.707107, -0.612372, 0.353553 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.000000, 0.000000 + }, + { + /* These 3 lines added by BEP */ + 0.707107, 0.500000, -0.500000 + }, + { + 0.000000, 0.707107, -0.707107 + }, + { + -0.707107, 0.500000, -0.500000 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.500000, 0.500000 + }, + { + 0.000000, -0.707107, 0.707107 + }, + { + 0.707107, -0.500000, 0.500000 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.353553, -0.612372 + }, + { + 0.000000, 0.500000, -0.866025 + }, + { + -0.707107, 0.353553, -0.612372 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.353553, 0.612372 + }, + { + 0.000000, -0.500000, 0.866025 + }, + { + 0.707107, -0.353553, 0.612372 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.183013, -0.683013 + }, + { + 0.000000, 0.258819, -0.965926 + }, + { + -0.707107, 0.183013, -0.683013 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, -0.183013, 0.683013 + }, + { + 0.000000, -0.258819, 0.965926 + }, + { + 0.707107, -0.183013, 0.683013 + }, + { + 1.000000, 0.000000, 0.000000 + } + }, + { + { + 1.000000, 0.000000, 0.000000 + }, + { + 0.707107, 0.000000, -0.707107 + }, + { + 0.000000, 0.000000, -1.000000 + }, + { + -0.707107, 0.000000, -0.707107 + }, + { + -1.000000, 0.000000, 0.000000 + }, + { + -0.707107, 0.000000, 0.707107 + }, + { + 0.000000, 0.000000, 1.000000 + }, + { + 0.707107, 0.000000, 0.707107 + }, + { + 1.000000, 0.000000, 0.000000 + } + } +}; +float tep[7][9][2] = { + { + { + 0, 0.0 + }, + { + 0.125, 0.0 + }, + { + 0.25, 0.0 + }, + { + 0.375, 0.0 + }, + { + 0.5, 0.0 + }, + { + 0.625, 0.0 + }, + { + 0.75, 0.0 + }, + { + 0.875, 0.0 + }, + { + 1.0, 0.0 + } + }, + { + { + 0, 0.16667 + }, + { + 0.125, 0.16667 + }, + { + 0.25, 0.16667 + }, + { + 0.375, 0.16667 + }, + { + 0.5, 0.16667 + }, + { + 0.625, 0.16667 + }, + { + 0.75, 0.16667 + }, + { + 0.875, 0.16667 + }, + { + 1.0, 0.16667 + } + }, + { + { + 0, 0.33333 + }, + { + 0.125, 0.33333 + }, + { + 0.25, 0.33333 + }, + { + 0.375, 0.33333 + }, + { + 0.5, 0.33333 + }, + { + 0.625, 0.33333 + }, + { + 0.75, 0.33333 + }, + { + 0.875, 0.33333 + }, + { + 1.0, 0.33333 + } + }, + { + { + 0, 0.5 + }, + { + 0.125, 0.5 + }, + { + 0.25, 0.5 + }, + { + 0.375, 0.5 + }, + { + 0.5, 0.5 + }, + { + 0.625, 0.5 + }, + { + 0.75, 0.5 + }, + { + 0.875, 0.5 + }, + { + 1.0, 0.5 + } + }, + { + { + 0, 0.6667 + }, + { + 0.125, 0.6667 + }, + { + 0.25, 0.6667 + }, + { + 0.375, 0.6667 + }, + { + 0.5, 0.6667 + }, + { + 0.625, 0.6667 + }, + { + 0.75, 0.6667 + }, + { + 0.875, 0.6667 + }, + { + 1.0, 0.6667 + } + }, + { + { + 0, 0.83333 + }, + { + 0.125, 0.83333 + }, + { + 0.25, 0.83333 + }, + { + 0.375, 0.83333 + }, + { + 0.5, 0.83333 + }, + { + 0.625, 0.83333 + }, + { + 0.75, 0.83333 + }, + { + 0.875, 0.83333 + }, + { + 1.0, 0.83333 + } + }, + { + { + 0, 1.0 + }, + { + 0.125, 1.0 + }, + { + 0.25, 1.0 + }, + { + 0.375, 1.0 + }, + { + 0.5, 1.0 + }, + { + 0.625, 1.0 + }, + { + 0.75, 1.0 + }, + { + 0.875, 1.0 + }, + { + 1.0, 1.0 + } + } +}; + + +static void SetUpAntiAliasedGrayScale(void) +{ + float color; + GLint i, j; + + for (i = 0; i < 16; i++) { + color = (2 * i + 1) / 32.0; + for (j = 0; j < 16; j++) { + glutSetColor(i*16+j, color*j/15.0, color*j/15.0, color*j/15.0); + } + } +} + +static void BendForward(void) +{ + + glTranslatef(0.0, 1.0, 0.0); + glRotatef(90.0, 1, 0, 0); + glTranslatef(0.0, -1.0, 0.0); +} + +static void BendLeft(void) +{ + + glRotatef(-90.0, 0, 0, 1); + glTranslatef(0.0, 1.0, 0.0); + glRotatef(90.0, 1, 0, 0); + glTranslatef(0.0, -1.0, 0.0); +} + +static void BendRight(void) +{ + + glRotatef(90.0, 0, 0, 1); + glTranslatef(0.0, 1.0, 0.0); + glRotatef(90.0, 1, 0, 0); + glTranslatef(0.0, -1.0, 0.0); +} + +static void BuildSingleCylinder(void) +{ + + glNewList(singleCylinder, GL_COMPILE); + + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(scp[0]); glTexCoord2fv(tscp[0]); glVertex3fv(scp[0]); + glNormal3fv(scp[0]); glTexCoord2fv(tscp[1]); glVertex3fv(scp[1]); + glNormal3fv(scp[2]); glTexCoord2fv(tscp[2]); glVertex3fv(scp[2]); + glNormal3fv(scp[2]); glTexCoord2fv(tscp[3]); glVertex3fv(scp[3]); + glNormal3fv(scp[4]); glTexCoord2fv(tscp[4]); glVertex3fv(scp[4]); + glNormal3fv(scp[4]); glTexCoord2fv(tscp[5]); glVertex3fv(scp[5]); + glNormal3fv(scp[6]); glTexCoord2fv(tscp[6]); glVertex3fv(scp[6]); + glNormal3fv(scp[6]); glTexCoord2fv(tscp[7]); glVertex3fv(scp[7]); + glNormal3fv(scp[8]); glTexCoord2fv(tscp[8]); glVertex3fv(scp[8]); + glNormal3fv(scp[8]); glTexCoord2fv(tscp[9]); glVertex3fv(scp[9]); + glNormal3fv(scp[10]); glTexCoord2fv(tscp[10]); glVertex3fv(scp[10]); + glNormal3fv(scp[10]); glTexCoord2fv(tscp[11]); glVertex3fv(scp[11]); + glNormal3fv(scp[12]); glTexCoord2fv(tscp[12]); glVertex3fv(scp[12]); + glNormal3fv(scp[12]); glTexCoord2fv(tscp[13]); glVertex3fv(scp[13]); + glNormal3fv(scp[14]); glTexCoord2fv(tscp[14]); glVertex3fv(scp[14]); + glNormal3fv(scp[14]); glTexCoord2fv(tscp[15]); glVertex3fv(scp[15]); + glNormal3fv(scp[16]); glTexCoord2fv(tscp[16]); glVertex3fv(scp[16]); + glNormal3fv(scp[16]); glTexCoord2fv(tscp[17]); glVertex3fv(scp[17]); + glEnd(); + + glEndList(); +} + +static void BuildDoubleCylinder(void) +{ + + glNewList(doubleCylinder, GL_COMPILE); + + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(dcp[0]); glTexCoord2fv(tscp[0]); glVertex3fv(dcp[0]); + glNormal3fv(dcp[0]); glTexCoord2fv(tscp[1]); glVertex3fv(dcp[1]); + glNormal3fv(dcp[2]); glTexCoord2fv(tscp[2]); glVertex3fv(dcp[2]); + glNormal3fv(dcp[2]); glTexCoord2fv(tscp[3]); glVertex3fv(dcp[3]); + glNormal3fv(dcp[4]); glTexCoord2fv(tscp[4]); glVertex3fv(dcp[4]); + glNormal3fv(dcp[4]); glTexCoord2fv(tscp[5]); glVertex3fv(dcp[5]); + glNormal3fv(dcp[6]); glTexCoord2fv(tscp[6]); glVertex3fv(dcp[6]); + glNormal3fv(dcp[6]); glTexCoord2fv(tscp[7]); glVertex3fv(dcp[7]); + glNormal3fv(dcp[8]); glTexCoord2fv(tscp[8]); glVertex3fv(dcp[8]); + glNormal3fv(dcp[8]); glTexCoord2fv(tscp[9]); glVertex3fv(dcp[9]); + glNormal3fv(dcp[10]); glTexCoord2fv(tscp[10]); glVertex3fv(dcp[10]); + glNormal3fv(dcp[10]); glTexCoord2fv(tscp[11]); glVertex3fv(dcp[11]); + glNormal3fv(dcp[12]); glTexCoord2fv(tscp[12]); glVertex3fv(dcp[12]); + glNormal3fv(dcp[12]); glTexCoord2fv(tscp[13]); glVertex3fv(dcp[13]); + glNormal3fv(dcp[14]); glTexCoord2fv(tscp[14]); glVertex3fv(dcp[14]); + glNormal3fv(dcp[14]); glTexCoord2fv(tscp[15]); glVertex3fv(dcp[15]); + glNormal3fv(dcp[16]); glTexCoord2fv(tscp[16]); glVertex3fv(dcp[16]); + glNormal3fv(dcp[16]); glTexCoord2fv(tscp[17]); glVertex3fv(dcp[17]); + glEnd(); + + glEndList(); +} + +static void BuildElbow(void) +{ + + glNewList(elbow, GL_COMPILE); + + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(en[0][0]); glTexCoord2fv(tep[0][0]); glVertex3fv(ep[0][0]); + glNormal3fv(en[1][0]); glTexCoord2fv(tep[1][0]); glVertex3fv(ep[1][0]); + glNormal3fv(en[0][1]); glTexCoord2fv(tep[0][1]); glVertex3fv(ep[0][1]); + glNormal3fv(en[1][1]); glTexCoord2fv(tep[1][1]); glVertex3fv(ep[1][1]); + glNormal3fv(en[0][2]); glTexCoord2fv(tep[0][2]); glVertex3fv(ep[0][2]); + glNormal3fv(en[1][2]); glTexCoord2fv(tep[1][2]); glVertex3fv(ep[1][2]); + glNormal3fv(en[0][3]); glTexCoord2fv(tep[0][3]); glVertex3fv(ep[0][3]); + glNormal3fv(en[1][3]); glTexCoord2fv(tep[1][3]); glVertex3fv(ep[1][3]); + glNormal3fv(en[0][4]); glTexCoord2fv(tep[0][4]); glVertex3fv(ep[0][4]); + glNormal3fv(en[1][4]); glTexCoord2fv(tep[1][4]); glVertex3fv(ep[1][4]); + glNormal3fv(en[0][5]); glTexCoord2fv(tep[0][5]); glVertex3fv(ep[0][5]); + glNormal3fv(en[1][5]); glTexCoord2fv(tep[1][5]); glVertex3fv(ep[1][5]); + glNormal3fv(en[0][6]); glTexCoord2fv(tep[0][6]); glVertex3fv(ep[0][6]); + glNormal3fv(en[1][6]); glTexCoord2fv(tep[1][6]); glVertex3fv(ep[1][6]); + glNormal3fv(en[0][7]); glTexCoord2fv(tep[0][7]); glVertex3fv(ep[0][7]); + glNormal3fv(en[1][7]); glTexCoord2fv(tep[1][7]); glVertex3fv(ep[1][7]); + glNormal3fv(en[0][8]); glTexCoord2fv(tep[0][8]); glVertex3fv(ep[0][8]); + glNormal3fv(en[1][8]); glTexCoord2fv(tep[1][8]); glVertex3fv(ep[1][8]); + glEnd(); + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(en[1][0]); glTexCoord2fv(tep[1][0]); glVertex3fv(ep[1][0]); + glNormal3fv(en[2][0]); glTexCoord2fv(tep[2][0]); glVertex3fv(ep[2][0]); + glNormal3fv(en[1][1]); glTexCoord2fv(tep[1][1]); glVertex3fv(ep[1][1]); + glNormal3fv(en[2][1]); glTexCoord2fv(tep[2][1]); glVertex3fv(ep[2][1]); + glNormal3fv(en[1][2]); glTexCoord2fv(tep[1][2]); glVertex3fv(ep[1][2]); + glNormal3fv(en[2][2]); glTexCoord2fv(tep[2][2]); glVertex3fv(ep[2][2]); + glNormal3fv(en[1][3]); glTexCoord2fv(tep[1][3]); glVertex3fv(ep[1][3]); + glNormal3fv(en[2][3]); glTexCoord2fv(tep[2][3]); glVertex3fv(ep[2][3]); + glNormal3fv(en[1][4]); glTexCoord2fv(tep[1][4]); glVertex3fv(ep[1][4]); + glNormal3fv(en[2][4]); glTexCoord2fv(tep[2][4]); glVertex3fv(ep[2][4]); + glNormal3fv(en[1][5]); glTexCoord2fv(tep[1][5]); glVertex3fv(ep[1][5]); + glNormal3fv(en[2][5]); glTexCoord2fv(tep[2][5]); glVertex3fv(ep[2][5]); + glNormal3fv(en[1][6]); glTexCoord2fv(tep[1][6]); glVertex3fv(ep[1][6]); + glNormal3fv(en[2][6]); glTexCoord2fv(tep[2][6]); glVertex3fv(ep[2][6]); + glNormal3fv(en[1][7]); glTexCoord2fv(tep[1][7]); glVertex3fv(ep[1][7]); + glNormal3fv(en[2][7]); glTexCoord2fv(tep[2][7]); glVertex3fv(ep[2][7]); + glNormal3fv(en[1][8]); glTexCoord2fv(tep[1][8]); glVertex3fv(ep[1][8]); + glNormal3fv(en[2][8]); glTexCoord2fv(tep[2][8]); glVertex3fv(ep[2][8]); + glEnd(); + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(en[2][0]); glTexCoord2fv(tep[2][0]); glVertex3fv(ep[2][0]); + glNormal3fv(en[3][0]); glTexCoord2fv(tep[3][0]); glVertex3fv(ep[3][0]); + glNormal3fv(en[2][1]); glTexCoord2fv(tep[2][1]); glVertex3fv(ep[2][1]); + glNormal3fv(en[3][1]); glTexCoord2fv(tep[3][1]); glVertex3fv(ep[3][1]); + glNormal3fv(en[2][2]); glTexCoord2fv(tep[2][2]); glVertex3fv(ep[2][2]); + glNormal3fv(en[3][2]); glTexCoord2fv(tep[3][2]); glVertex3fv(ep[3][2]); + glNormal3fv(en[2][3]); glTexCoord2fv(tep[2][3]); glVertex3fv(ep[2][3]); + glNormal3fv(en[3][3]); glTexCoord2fv(tep[3][3]); glVertex3fv(ep[3][3]); + glNormal3fv(en[2][4]); glTexCoord2fv(tep[2][4]); glVertex3fv(ep[2][4]); + glNormal3fv(en[3][4]); glTexCoord2fv(tep[3][4]); glVertex3fv(ep[3][4]); + glNormal3fv(en[2][5]); glTexCoord2fv(tep[2][5]); glVertex3fv(ep[2][5]); + glNormal3fv(en[3][5]); glTexCoord2fv(tep[3][5]); glVertex3fv(ep[3][5]); + glNormal3fv(en[2][6]); glTexCoord2fv(tep[2][6]); glVertex3fv(ep[2][6]); + glNormal3fv(en[3][6]); glTexCoord2fv(tep[3][6]); glVertex3fv(ep[3][6]); + glNormal3fv(en[2][7]); glTexCoord2fv(tep[2][7]); glVertex3fv(ep[2][7]); + glNormal3fv(en[3][7]); glTexCoord2fv(tep[3][7]); glVertex3fv(ep[3][7]); + glNormal3fv(en[2][8]); glTexCoord2fv(tep[2][8]); glVertex3fv(ep[2][8]); + glNormal3fv(en[3][8]); glTexCoord2fv(tep[3][8]); glVertex3fv(ep[3][8]); + glEnd(); + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(en[3][0]); glTexCoord2fv(tep[3][0]); glVertex3fv(ep[3][0]); + glNormal3fv(en[4][0]); glTexCoord2fv(tep[4][0]); glVertex3fv(ep[4][0]); + glNormal3fv(en[3][1]); glTexCoord2fv(tep[3][1]); glVertex3fv(ep[3][1]); + glNormal3fv(en[4][1]); glTexCoord2fv(tep[4][1]); glVertex3fv(ep[4][1]); + glNormal3fv(en[3][2]); glTexCoord2fv(tep[3][2]); glVertex3fv(ep[3][2]); + glNormal3fv(en[4][2]); glTexCoord2fv(tep[4][2]); glVertex3fv(ep[4][2]); + glNormal3fv(en[3][3]); glTexCoord2fv(tep[3][3]); glVertex3fv(ep[3][3]); + glNormal3fv(en[4][3]); glTexCoord2fv(tep[4][3]); glVertex3fv(ep[4][3]); + glNormal3fv(en[3][4]); glTexCoord2fv(tep[3][4]); glVertex3fv(ep[3][4]); + glNormal3fv(en[4][4]); glTexCoord2fv(tep[4][4]); glVertex3fv(ep[4][4]); + glNormal3fv(en[3][5]); glTexCoord2fv(tep[3][5]); glVertex3fv(ep[3][5]); + glNormal3fv(en[4][5]); glTexCoord2fv(tep[4][5]); glVertex3fv(ep[4][5]); + glNormal3fv(en[3][6]); glTexCoord2fv(tep[3][6]); glVertex3fv(ep[3][6]); + glNormal3fv(en[4][6]); glTexCoord2fv(tep[4][6]); glVertex3fv(ep[4][6]); + glNormal3fv(en[3][7]); glTexCoord2fv(tep[3][7]); glVertex3fv(ep[3][7]); + glNormal3fv(en[4][7]); glTexCoord2fv(tep[4][7]); glVertex3fv(ep[4][7]); + glNormal3fv(en[3][8]); glTexCoord2fv(tep[3][8]); glVertex3fv(ep[3][8]); + glNormal3fv(en[4][8]); glTexCoord2fv(tep[4][8]); glVertex3fv(ep[4][8]); + glEnd(); + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(en[4][0]); glTexCoord2fv(tep[4][0]); glVertex3fv(ep[4][0]); + glNormal3fv(en[5][0]); glTexCoord2fv(tep[5][0]); glVertex3fv(ep[5][0]); + glNormal3fv(en[4][1]); glTexCoord2fv(tep[4][1]); glVertex3fv(ep[4][1]); + glNormal3fv(en[5][1]); glTexCoord2fv(tep[5][1]); glVertex3fv(ep[5][1]); + glNormal3fv(en[4][2]); glTexCoord2fv(tep[4][2]); glVertex3fv(ep[4][2]); + glNormal3fv(en[5][2]); glTexCoord2fv(tep[5][2]); glVertex3fv(ep[5][2]); + glNormal3fv(en[4][3]); glTexCoord2fv(tep[4][3]); glVertex3fv(ep[4][3]); + glNormal3fv(en[5][3]); glTexCoord2fv(tep[5][3]); glVertex3fv(ep[5][3]); + glNormal3fv(en[4][4]); glTexCoord2fv(tep[4][4]); glVertex3fv(ep[4][4]); + glNormal3fv(en[5][4]); glTexCoord2fv(tep[5][4]); glVertex3fv(ep[5][4]); + glNormal3fv(en[4][5]); glTexCoord2fv(tep[4][5]); glVertex3fv(ep[4][5]); + glNormal3fv(en[5][5]); glTexCoord2fv(tep[5][5]); glVertex3fv(ep[5][5]); + glNormal3fv(en[4][6]); glTexCoord2fv(tep[4][6]); glVertex3fv(ep[4][6]); + glNormal3fv(en[5][6]); glTexCoord2fv(tep[5][6]); glVertex3fv(ep[5][6]); + glNormal3fv(en[4][7]); glTexCoord2fv(tep[4][7]); glVertex3fv(ep[4][7]); + glNormal3fv(en[5][7]); glTexCoord2fv(tep[5][7]); glVertex3fv(ep[5][7]); + glNormal3fv(en[4][8]); glTexCoord2fv(tep[4][8]); glVertex3fv(ep[4][8]); + glNormal3fv(en[5][8]); glTexCoord2fv(tep[5][8]); glVertex3fv(ep[5][8]); + glEnd(); + glBegin(GL_TRIANGLE_STRIP); + glNormal3fv(en[5][0]); glTexCoord2fv(tep[5][0]); glVertex3fv(ep[5][0]); + glNormal3fv(en[6][0]); glTexCoord2fv(tep[6][0]); glVertex3fv(ep[6][0]); + glNormal3fv(en[5][1]); glTexCoord2fv(tep[5][1]); glVertex3fv(ep[5][1]); + glNormal3fv(en[6][1]); glTexCoord2fv(tep[6][1]); glVertex3fv(ep[6][1]); + glNormal3fv(en[5][2]); glTexCoord2fv(tep[5][2]); glVertex3fv(ep[5][2]); + glNormal3fv(en[6][2]); glTexCoord2fv(tep[6][2]); glVertex3fv(ep[6][2]); + glNormal3fv(en[5][3]); glTexCoord2fv(tep[5][3]); glVertex3fv(ep[5][3]); + glNormal3fv(en[6][3]); glTexCoord2fv(tep[6][3]); glVertex3fv(ep[6][3]); + glNormal3fv(en[5][4]); glTexCoord2fv(tep[5][4]); glVertex3fv(ep[5][4]); + glNormal3fv(en[6][4]); glTexCoord2fv(tep[6][4]); glVertex3fv(ep[6][4]); + glNormal3fv(en[5][5]); glTexCoord2fv(tep[5][5]); glVertex3fv(ep[5][5]); + glNormal3fv(en[6][5]); glTexCoord2fv(tep[6][5]); glVertex3fv(ep[6][5]); + glNormal3fv(en[5][6]); glTexCoord2fv(tep[5][6]); glVertex3fv(ep[5][6]); + glNormal3fv(en[6][6]); glTexCoord2fv(tep[6][6]); glVertex3fv(ep[6][6]); + glNormal3fv(en[5][7]); glTexCoord2fv(tep[5][7]); glVertex3fv(ep[5][7]); + glNormal3fv(en[6][7]); glTexCoord2fv(tep[6][7]); glVertex3fv(ep[6][7]); + glNormal3fv(en[5][8]); glTexCoord2fv(tep[5][8]); glVertex3fv(ep[5][8]); + glNormal3fv(en[6][8]); glTexCoord2fv(tep[6][8]); glVertex3fv(ep[6][8]); + glEnd(); + + glEndList(); +} + +static void BuildLogo(void) +{ + + glNewList(logo, GL_COMPILE); + + glTranslatef(5.5, -3.5, 4.5); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -5.0); + glCallList(singleCylinder); + BendRight(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -5.0); + glCallList(singleCylinder); + BendLeft(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -5.0); + glCallList(singleCylinder); + BendRight(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -5.0); + glCallList(singleCylinder); + BendLeft(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -5.0); + glCallList(singleCylinder); + BendRight(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -7.0); + glCallList(doubleCylinder); + BendForward(); + glCallList(elbow); + glTranslatef(0.0, 0.0, -5.0); + glCallList(singleCylinder); + BendLeft(); + glCallList(elbow); + + glEndList(); +} + +static void BuildLists(void) +{ + + singleCylinder = glGenLists(1); + doubleCylinder = glGenLists(1); + elbow = glGenLists(1); + logo = glGenLists(1); + + BuildSingleCylinder(); + BuildDoubleCylinder(); + BuildElbow(); + BuildLogo(); +} + +static void Init(void) +{ + static float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float diffuse[] = {0.5, 1.0, 1.0, 1.0}; + static float position[] = {90.0, 90.0, 150.0, 0.0}; + static float front_mat_shininess[] = {30.0}; + static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0}; + static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0}; + static float back_mat_shininess[] = {50.0}; + static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0}; + static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; + static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; + static float lmodel_twoside[] = {GL_TRUE}; + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glFrontFace(GL_CW); + + glEnable(GL_DEPTH_TEST); + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess); + glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular); + glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess); + glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular); + glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse); + + glEnable(GL_CLIP_PLANE0); + + if (rgb) { + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest); + glTexImage2D(GL_TEXTURE_2D, 0, 3, CHECKIMAGEWIDTH, CHECKIMAGEHEIGHT, 0, + GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *)checkImage); + glEnable(GL_TEXTURE_2D); + + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + } else { + SetGreyRamp(); + /* commented out by BrianP because it's the wrong way to handle a 4-bit visual! + if (doubleBuffer) { + colorIndexes[1] = 10; + colorIndexes[2] = 15; + } + */ + glMaterialiv(GL_FRONT_AND_BACK, GL_COLOR_INDEXES, colorIndexes); + } + + BuildLists(); + + dithering = GL_TRUE; + shade = GL_TRUE; + doStipple = GL_FALSE; + polyMode = GL_BACK; +} + +static void Reshape(int width, int height) +{ + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90, 1.0, 1.0, 200.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_LEFT: + yRotation += 0.5; + break; + case GLUT_KEY_RIGHT: + yRotation -= 0.5; + break; + case GLUT_KEY_UP: + plane[3] += 2.0; + break; + case GLUT_KEY_DOWN: + plane[3] -= 2.0; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(1); + + case 'Z': + zTranslation -= 1.0; + break; + case 'z': + zTranslation += 1.0; + break; + + case '1': + glPolygonMode(polyMode, GL_POINT); + break; + case '2': + glPolygonMode(polyMode, GL_LINE); + break; + case '3': + glPolygonMode(polyMode, GL_FILL); + break; + case 'p': + switch (polyMode) { + case GL_BACK: + polyMode = GL_FRONT; + break; + case GL_FRONT: + polyMode = GL_FRONT_AND_BACK; + break; + case GL_FRONT_AND_BACK: + polyMode = GL_BACK; + break; + default: + break; + } + break; + + case '4': + glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); + break; + case '5': + glEnable(GL_POLYGON_SMOOTH); + if (rgb) { + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glEnable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + } else { + SetUpAntiAliasedGrayScale(); + } + break; + case '6': + glDisable(GL_POLYGON_SMOOTH); + if (rgb) { + glBlendFunc(GL_ONE, GL_ZERO); + glDisable(GL_BLEND); + glEnable(GL_DEPTH_TEST); + } else { + SetGreyRamp(); + } + break; + + case '8': + dithering = !dithering; + (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER); + break; + + case '9': + doStipple = !doStipple; + if (doStipple) { + glPolygonStipple(stipple); + glEnable(GL_POLYGON_STIPPLE); + } else { + glDisable(GL_POLYGON_STIPPLE); + } + break; + + case '0': + shade = !shade; + (shade) ? glShadeModel(GL_SMOOTH) : glShadeModel(GL_FLAT); + break; + + case 'q': + glDisable(GL_CULL_FACE); + break; + case 'w': + glEnable(GL_CULL_FACE); + glCullFace(GL_FRONT); + break; + case 'e': + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + break; + + case 'r': + glFrontFace(GL_CW); + break; + case 't': + glFrontFace(GL_CCW); + break; + case 'y': + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_LSB_FIRST, 0); + glPolygonStipple(stipple); + break; + case 'u': + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_LSB_FIRST, 1); + glPolygonStipple(stipple); + break; + + case 'a': + glEnable(GL_TEXTURE_2D); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest); + glTexImage2D(GL_TEXTURE_2D, 0, 4, BRICKIMAGEWIDTH, + BRICKIMAGEHEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, + (GLvoid *)brickImage); + break; + case 's': + glEnable(GL_TEXTURE_2D); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest); + glTexImage2D(GL_TEXTURE_2D, 0, 3, CHECKIMAGEWIDTH, + CHECKIMAGEHEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, + (GLvoid *)checkImage); + break; + case 'd': + glDisable(GL_TEXTURE_2D); + break; + + case 'f': + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); + break; + case 'g': + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, modulate); + break; + + case 'n': + /* added by BrianP */ + noDraw = !noDraw; + if (noDraw) { + glDrawBuffer( GL_NONE ); + } + else { + if (doubleBuffer) { + glDrawBuffer( GL_BACK ); + } + else { + glDrawBuffer( GL_FRONT ); + } + } + break; + + case 'l': + /* Line Smooth - added by BrianP */ + LineSmooth = !LineSmooth; + if (LineSmooth) { + glEnable(GL_LINE_SMOOTH); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + } + else { + glDisable(GL_LINE_SMOOTH); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_BLEND); + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + + glTranslatef(0, 0, zTranslation); + glRotatef(30.0, 1, 0, 0); + glRotatef(yRotation, 0, 1, 0); + glClipPlane(GL_CLIP_PLANE0, plane); + glCallList(logo); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + unsigned int type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_DEPTH; + type |= (rgb) ? GLUT_RGB : GLUT_INDEX; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Logo Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/nurb.c b/xc/extras/Mesa/samples/nurb.c new file mode 100644 index 000000000..f90c6ee91 --- /dev/null +++ b/xc/extras/Mesa/samples/nurb.c @@ -0,0 +1,355 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <GL/glut.h> + + +#ifndef CALLBACK +#define CALLBACK +#endif + + +#define INREAL float + +#define S_NUMPOINTS 13 +#define S_ORDER 3 +#define S_NUMKNOTS (S_NUMPOINTS + S_ORDER) +#define T_NUMPOINTS 3 +#define T_ORDER 3 +#define T_NUMKNOTS (T_NUMPOINTS + T_ORDER) +#define SQRT_TWO 1.41421356237309504880 + + +typedef INREAL Point[4]; + + +GLenum doubleBuffer; + +GLenum expectedError; +GLint rotX = 40, rotY = 40; +INREAL sknots[S_NUMKNOTS] = { + -1.0, -1.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, + 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 9.0, 9.0 +}; +INREAL tknots[T_NUMKNOTS] = { + 1.0, 1.0, 1.0, 2.0, 2.0, 2.0 +}; +Point ctlpoints[S_NUMPOINTS][T_NUMPOINTS] = { + { + { + 4.0, 2.0, 2.0, 1.0 + }, + { + 4.0, 1.6, 2.5, 1.0 + }, + { + 4.0, 2.0, 3.0, 1.0 + } + }, + { + { + 5.0, 4.0, 2.0, 1.0 + }, + { + 5.0, 4.0, 2.5, 1.0 + }, + { + 5.0, 4.0, 3.0, 1.0 + } + }, + { + { + 6.0, 5.0, 2.0, 1.0 + }, + { + 6.0, 5.0, 2.5, 1.0 + }, + { + 6.0, 5.0, 3.0, 1.0 + } + }, + { + { + SQRT_TWO*6.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO + }, + { + SQRT_TWO*6.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO + }, + { + SQRT_TWO*6.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO + } + }, + { + { + 5.2, 6.7, 2.0, 1.0 + }, + { + 5.2, 6.7, 2.5, 1.0 + }, + { + 5.2, 6.7, 3.0, 1.0 + } + }, + { + { + SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO + }, + { + SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO + }, + { + SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO + } + }, + { + { + 4.0, 5.2, 2.0, 1.0 + }, + { + 4.0, 4.6, 2.5, 1.0 + }, + { + 4.0, 5.2, 3.0, 1.0 + } + }, + { + { + SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO + }, + { + SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO + }, + { + SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO + } + }, + { + { + 2.8, 6.7, 2.0, 1.0 + }, + { + 2.8, 6.7, 2.5, 1.0 + }, + { + 2.8, 6.7, 3.0, 1.0 + } + }, + { + { + SQRT_TWO*2.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO + }, + { + SQRT_TWO*2.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO + }, + { + SQRT_TWO*2.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO + } + }, + { + { + 2.0, 5.0, 2.0, 1.0 + }, + { + 2.0, 5.0, 2.5, 1.0 + }, + { + 2.0, 5.0, 3.0, 1.0 + } + }, + { + { + 3.0, 4.0, 2.0, 1.0 + }, + { + 3.0, 4.0, 2.5, 1.0 + }, + { + 3.0, 4.0, 3.0, 1.0 + } + }, + { + { + 4.0, 2.0, 2.0, 1.0 + }, + { + 4.0, 1.6, 2.5, 1.0 + }, + { + 4.0, 2.0, 3.0, 1.0 + } + } +}; +GLUnurbsObj *theNurbs; + + +static void CALLBACK ErrorCallback(GLenum which) +{ + + if (which != expectedError) { + fprintf(stderr, "Unexpected error occured (%d):\n", which); + fprintf(stderr, " %s\n", (char *) gluErrorString(which)); + } +} + +static void Init(void) +{ + + theNurbs = gluNewNurbsRenderer(); + gluNurbsCallback(theNurbs, GLU_ERROR, ErrorCallback); + + gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0); + gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH); + + expectedError = GLU_INVALID_ENUM; + gluNurbsProperty(theNurbs, ~0, 15.0); + expectedError = GLU_NURBS_ERROR13; + gluEndSurface(theNurbs); + expectedError = 0; + + glColor3f(1.0, 1.0, 1.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-2.0, 2.0, -2.0, 2.0, 0.8, 10.0); + gluLookAt(7.0, 4.5, 4.0, 4.5, 4.5, 2.5, 6.0, -3.0, 2.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_DOWN: + rotX -= 5; + break; + case GLUT_KEY_UP: + rotX += 5; + break; + case GLUT_KEY_LEFT: + rotY -= 5; + break; + case GLUT_KEY_RIGHT: + rotY += 5; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + } +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + glPushMatrix(); + + glTranslatef(4.0, 4.5, 2.5); + glRotatef(rotY, 1, 0, 0); + glRotatef(rotX, 0, 1, 0); + glTranslatef(-4.0, -4.5, -2.5); + + gluBeginSurface(theNurbs); + gluNurbsSurface(theNurbs, S_NUMKNOTS, sknots, T_NUMKNOTS, tknots, + 4*T_NUMPOINTS, 4, &ctlpoints[0][0][0], S_ORDER, + T_ORDER, GL_MAP2_VERTEX_4); + gluEndSurface(theNurbs); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("NURBS Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/oglinfo.c b/xc/extras/Mesa/samples/oglinfo.c new file mode 100644 index 000000000..4fe51efb3 --- /dev/null +++ b/xc/extras/Mesa/samples/oglinfo.c @@ -0,0 +1,218 @@ +/* oglinfo.c */ + +/* This demo modified by BrianP to accomodate Mesa and test + * the GLX 1.1 functions. + */ + + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <GL/glu.h> +#include <stdio.h> +#include <string.h> + +int visual_request0[] = { None }; /* don't need much of a visual */ +int visual_request1[] = { GLX_RGBA, None }; /* in case CI failed */ + +int main(int argc, char **argv) +{ + char *display_name = NULL; + char *string; + Display *dpy; + int screen_num; + int major, minor; + XVisualInfo *vis; + GLXContext ctx; + Window root, win; + Colormap cmap; + XSetWindowAttributes swa; + int dontcare; + + /* parse arguments */ + if(argc > 1) { + if(!strcmp(argv[1],"-display")) + display_name = argv[2]; + else { + fprintf(stderr, "Usage: %s [-display <display>]\n",argv[0]); + return 0; + } + } + + /* get display */ + if (!(dpy = XOpenDisplay(display_name))) { + fprintf(stderr,"Error: XOpenDisplay() failed.\n"); + return 1; + } + + /* does the server know about OpenGL & GLX? */ +#ifndef MESA + if(!XQueryExtension(dpy, "GLX", &dontcare, &dontcare, &dontcare)) { + fprintf(stderr,"This system doesn't appear to support OpenGL\n"); + return 1; + } +#else + (void) dontcare; +#endif + + /* find the glx version */ + if(glXQueryVersion(dpy, &major, &minor)) + printf("GLX Version: %d.%d\n", major, minor); + else { + fprintf(stderr, "Error: glXQueryVersion() failed.\n"); + return 1; + } + + /* get screen number */ + screen_num = DefaultScreen(dpy); + +/* This #ifdef isn't redundant. It keeps the build from breaking +** if you are building on a machine that has an old (1.0) version +** of glx. +** +** This program could still be *run* on a machine that has an old +** version of glx, even if it was *compiled* on a version that has +** a new version. +** +** If compiled on a system with an old version of glx, then it will +** never recognize glx extensions, since that code would have been +** #ifdef'ed out. +*/ +#ifdef GLX_VERSION_1_1 + + /* + ** This test guarantees that glx, on the display you are inquiring, + ** suppports glXQueryExtensionsString(). + */ + if(minor > 0 || major > 1) + string = (char *) glXQueryExtensionsString(dpy, screen_num); + else + string = ""; + + if(string) + printf("GLX Extensions (client & server): %s\n", + string); + else { + fprintf(stderr, "Error: glXQueryExtensionsString() failed.\n"); + return 1; + } + + if (minor>0 || major>1) { + printf("glXGetClientString(GLX_VENDOR): %s\n", glXGetClientString(dpy,GLX_VENDOR)); + printf("glXGetClientString(GLX_VERSION): %s\n", glXGetClientString(dpy,GLX_VERSION)); + printf("glXGetClientString(GLX_EXTENSIONS): %s\n", glXGetClientString(dpy,GLX_EXTENSIONS)); + printf("glXQueryServerString(GLX_VENDOR): %s\n", glXQueryServerString(dpy,screen_num,GLX_VENDOR)); + printf("glXQueryServerString(GLX_VERSION): %s\n", glXQueryServerString(dpy,screen_num,GLX_VERSION)); + printf("glXQueryServerString(GLX_EXTENSIONS): %s\n", glXQueryServerString(dpy,screen_num,GLX_EXTENSIONS)); + } + + +#endif + + /* get any valid OpenGL visual */ + if (!(vis = glXChooseVisual(dpy, screen_num, visual_request0))) { + if (!(vis = glXChooseVisual(dpy, screen_num, visual_request1))) { + fprintf(stderr,"Error: glXChooseVisual() failed.\n"); + return 1; + } + } + + /* get context */ + ctx = glXCreateContext(dpy,vis,0,GL_TRUE); + + /* root window */ + root = RootWindow(dpy,vis->screen); + + /* get RGBA colormap */ + cmap = XCreateColormap(dpy, root, vis->visual, AllocNone); + + /* get window */ + swa.colormap = cmap; + swa.border_pixel = 0; + swa.event_mask = StructureNotifyMask; + win = XCreateWindow(dpy, root, 0, 0, 1, 1, 0, vis->depth, + InputOutput,vis->visual, + CWBorderPixel|CWColormap|CWEventMask, + &swa); + + glXMakeCurrent(dpy,win,ctx); + + string = (char *) glGetString(GL_VERSION); + if(string) +#ifdef MESA + printf("Mesa Version: %s\n", string); +#else + printf("OpenGL Version: %s\n", string); +#endif + else { + fprintf(stderr, "Error: glGetString(GL_VERSION) failed.\n"); + return 1; + } + + string = (char *) glGetString(GL_EXTENSIONS); + + if(string) +#ifdef MESA + printf("Mesa Extensions: %s\n", string); +#else + printf("OpenGL Extensions: %s\n", string); +#endif + else { + fprintf(stderr, "Error: glGetString(GL_EXTENSIONS) failed.\n"); + return 1; + } + + string = (char *) glGetString(GL_RENDERER); + + if(string) +#ifdef MESA + printf("Mesa Renderer: %s\n", string); +#else + printf("OpenGL renderer: %s\n", string); +#endif + else { + fprintf(stderr, "Error: glGetString(GL_RENDERER) failed.\n"); + return 1; + } + +/* +** This #ifdef prevents a build failure if you compile on an a +** machine with an old GLU library. +** +** If you build on a pre GLU 1.1 machine, you will never be able +** to get glu info, even if you run on a GLU 1.1 or latter machine, +** since the code has been #ifdef'ed out. +*/ +#ifdef GLU_VERSION_1_1 + + /* + ** If the glx version is 1.1 or latter, gluGetString() is guaranteed + ** to exist. + */ + if(minor > 0 || major > 1) + string = (char *) gluGetString(GLU_VERSION); + else + string = "1.0"; + + if(string) + printf("GLU Version: %s\n", string); + else { + fprintf(stderr, "Error: gluGetString(GLU_VERSION) failed.\n"); + return 1; + } + + if(minor > 0 || major > 1) + string = (char *) gluGetString(GLU_EXTENSIONS); + else + string = ""; + + if(string) + printf("GLU Extensions: %s\n", string); + else { + fprintf(stderr, "Error: gluGetString(GLU_EXTENSIONS) failed.\n"); + return 1; + } + +#endif + return 0; +} diff --git a/xc/extras/Mesa/samples/olympic.c b/xc/extras/Mesa/samples/olympic.c new file mode 100644 index 000000000..d1cfa7250 --- /dev/null +++ b/xc/extras/Mesa/samples/olympic.c @@ -0,0 +1,375 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* + * Nov 20, 1995 use stdlib's rand()/srand() instead of random()/srand48(), etc. + */ + +/* + * Modified by Li Wei(liwei@aiar.xjtu.edu.cn) to be able to run in Windows + * 6/13 + * + * Modified by Brian Paul to compile with Windows OR Unix. 7/23/97 + */ + + +#define _HPUX_SOURCE + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <GL/glut.h> + +#ifndef RAND_MAX +# define RAND_MAX 32767 +#endif + + +#define XSIZE 100 +#define YSIZE 75 + +#define RINGS 5 +#define BLUERING 0 +#define BLACKRING 1 +#define REDRING 2 +#define YELLOWRING 3 +#define GREENRING 4 + +#define BACKGROUND 8 + + +GLenum rgb, doubleBuffer; + +#include "tkmap.c" + +unsigned char rgb_colors[RINGS][3]; +int mapped_colors[RINGS]; +float dests[RINGS][3]; +float offsets[RINGS][3]; +float angs[RINGS]; +float rotAxis[RINGS][3]; +int iters[RINGS]; +GLuint theTorus; + + +void FillTorus(float rc, int numc, float rt, int numt) +{ + int i, j, k; + double s, t; + double x, y, z; + double pi, twopi; + + pi = 3.14159265358979323846; + twopi = 2 * pi; + + for (i = 0; i < numc; i++) { + glBegin(GL_QUAD_STRIP); + for (j = 0; j <= numt; j++) { + for (k = 1; k >= 0; k--) { + s = (i + k) % numc + 0.5; + t = j % numt; + + x = cos(t*twopi/numt) * cos(s*twopi/numc); + y = sin(t*twopi/numt) * cos(s*twopi/numc); + z = sin(s*twopi/numc); + glNormal3f(x, y, z); + + x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt); + y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt); + z = rc * sin(s*twopi/numc); + glVertex3f(x, y, z); + } + } + glEnd(); + } +} + +float Clamp(int iters_left, float t) +{ + + if (iters_left < 3) { + return 0.0; + } + return (iters_left-2)*t/iters_left; +} + +void DrawScene(void) +{ + int i, j; + GLboolean goIdle; + + goIdle = GL_TRUE; + for (i = 0; i < RINGS; i++) { + if (iters[i]) { + for (j = 0; j < 3; j++) { + offsets[i][j] = Clamp(iters[i], offsets[i][j]); + } + angs[i] = Clamp(iters[i], angs[i]); + iters[i]--; + goIdle = GL_FALSE; + } + } + if (goIdle) { + glutIdleFunc(NULL); + } + + glPushMatrix(); + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + gluLookAt(0,0,10, 0,0,0, 0,1,0); + + for (i = 0; i < RINGS; i++) { + if (rgb) { + glColor3ubv(rgb_colors[i]); + } else { + glIndexi(mapped_colors[i]); + } + glPushMatrix(); + glTranslatef(dests[i][0]+offsets[i][0], dests[i][1]+offsets[i][1], + dests[i][2]+offsets[i][2]); + glRotatef(angs[i], rotAxis[i][0], rotAxis[i][1], rotAxis[i][2]); + glCallList(theTorus); + glPopMatrix(); + } + + glPopMatrix(); + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +float MyRand(void) +{ + return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 ); +} + +void GLUTCALLBACK glut_post_redisplay_p(void) +{ + glutPostRedisplay(); +} + +void ReInit(void) +{ + int i; + float deviation; + + deviation = MyRand() / 2; + deviation = deviation * deviation; + for (i = 0; i < RINGS; i++) { + offsets[i][0] = MyRand(); + offsets[i][1] = MyRand(); + offsets[i][2] = MyRand(); + angs[i] = 260.0 * MyRand(); + rotAxis[i][0] = MyRand(); + rotAxis[i][1] = MyRand(); + rotAxis[i][2] = MyRand(); + iters[i] = (deviation * MyRand() + 60.0); + } + glutIdleFunc(glut_post_redisplay_p); +} + +void Init(void) +{ + float base, height; + float aspect, x, y; + int i; + + float top_y = 1.0; + float bottom_y = 0.0; + float top_z = 0.15; + float bottom_z = 0.69; + float spacing = 2.5; + static float lmodel_ambient[] = {0.0, 0.0, 0.0, 0.0}; + static float lmodel_twoside[] = {GL_FALSE}; + static float lmodel_local[] = {GL_FALSE}; + static float light0_ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float light0_diffuse[] = {1.0, 1.0, 1.0, 0.0}; + static float light0_position[] = {0.8660254, 0.5, 1, 0}; + static float light0_specular[] = {1.0, 1.0, 1.0, 0.0}; + static float bevel_mat_ambient[] = {0.0, 0.0, 0.0, 1.0}; + static float bevel_mat_shininess[] = {40.0}; + static float bevel_mat_specular[] = {1.0, 1.0, 1.0, 0.0}; + static float bevel_mat_diffuse[] = {1.0, 0.0, 0.0, 0.0}; + + srand( (unsigned int) glutGet(GLUT_ELAPSED_TIME) ); + + ReInit(); + for (i = 0; i < RINGS; i++) { + rgb_colors[i][0] = rgb_colors[i][1] = rgb_colors[i][2] = 0; + } + rgb_colors[BLUERING][2] = 255; + rgb_colors[REDRING][0] = 255; + rgb_colors[GREENRING][1] = 255; + rgb_colors[YELLOWRING][0] = 255; + rgb_colors[YELLOWRING][1] = 255; + mapped_colors[BLUERING] = COLOR_BLUE; + mapped_colors[REDRING] = COLOR_RED; + mapped_colors[GREENRING] = COLOR_GREEN; + mapped_colors[YELLOWRING] = COLOR_YELLOW; + mapped_colors[BLACKRING] = COLOR_BLACK; + + dests[BLUERING][0] = -spacing; + dests[BLUERING][1] = top_y; + dests[BLUERING][2] = top_z; + + dests[BLACKRING][0] = 0.0; + dests[BLACKRING][1] = top_y; + dests[BLACKRING][2] = top_z; + + dests[REDRING][0] = spacing; + dests[REDRING][1] = top_y; + dests[REDRING][2] = top_z; + + dests[YELLOWRING][0] = -spacing / 2.0; + dests[YELLOWRING][1] = bottom_y; + dests[YELLOWRING][2] = bottom_z; + + dests[GREENRING][0] = spacing / 2.0; + dests[GREENRING][1] = bottom_y; + dests[GREENRING][2] = bottom_z; + + base = 2.0; + height = 2.0; + theTorus = glGenLists(1); + glNewList(theTorus, GL_COMPILE); + FillTorus(0.1, 8, 1.0, 25); + glEndList(); + + x = (float)XSIZE; + y = (float)YSIZE; + aspect = x / y; + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + glEnable(GL_DEPTH_TEST); + glClearDepth(1.0); + + if (rgb) { + glClearColor(0.5, 0.5, 0.5, 0.0); + glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular); + glLightfv(GL_LIGHT0, GL_POSITION, light0_position); + glEnable(GL_LIGHT0); + + glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_local); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glEnable(GL_LIGHTING); + + glMaterialfv(GL_FRONT, GL_AMBIENT, bevel_mat_ambient); + glMaterialfv(GL_FRONT, GL_SHININESS, bevel_mat_shininess); + glMaterialfv(GL_FRONT, GL_SPECULAR, bevel_mat_specular); + glMaterialfv(GL_FRONT, GL_DIFFUSE, bevel_mat_diffuse); + + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable(GL_COLOR_MATERIAL); + glShadeModel(GL_SMOOTH); + } else { + glClearIndex(BACKGROUND); + glShadeModel(GL_FLAT); + } + + glMatrixMode(GL_PROJECTION); + gluPerspective(45, 1.33, 0.1, 100.0); + glMatrixMode(GL_MODELVIEW); +} + +void Reshape(int width, int height) +{ + + glViewport(0, 0, width, height); +} + +void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 32: + ReInit(); + break; + } +} + +GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_TRUE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 300); + + type = GLUT_DEPTH; + type |= (rgb) ? GLUT_RGB : GLUT_INDEX; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Olympic") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(DrawScene); + glutIdleFunc(glut_post_redisplay_p); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/overlay.c b/xc/extras/Mesa/samples/overlay.c new file mode 100644 index 000000000..23b5a4793 --- /dev/null +++ b/xc/extras/Mesa/samples/overlay.c @@ -0,0 +1,378 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> +#include <GL/glut.h> + + +#ifndef PI +#define PI 3.141592657 +#endif + + +enum { + NORMAL = 0, + WEIRD = 1 +}; + +enum { + STREAK = 0, + CIRCLE = 1 +}; + +#define MAXSTARS 400 +#define MAXPOS 10000 +#define MAXWARP 10 +#define MAXANGLES 6000 + + +typedef struct _starRec { + GLint type; + float x[2], y[2], z[2]; + float offsetX, offsetY, offsetR, rotation; +} starRec; + + +GLenum doubleBuffer; +GLint windW, windH; + +GLenum flag = NORMAL, overlayInit = GL_FALSE; +GLint starCount = MAXSTARS / 2; +float speed = 1.0; +GLint nitro = 0; +starRec stars[MAXSTARS]; +float sinTable[MAXANGLES]; + + +float Sin(float angle) +{ + + return (sinTable[(GLint)angle]); +} + +float Cos(float angle) +{ + + return (sinTable[((GLint)angle+(MAXANGLES/4))%MAXANGLES]); +} + +void NewStar(GLint n, GLint d) +{ + + if (rand()%4 == 0) { + stars[n].type = CIRCLE; + } else { + stars[n].type = STREAK; + } + stars[n].x[0] = (float)(rand() % MAXPOS - MAXPOS / 2); + stars[n].y[0] = (float)(rand() % MAXPOS - MAXPOS / 2); + stars[n].z[0] = (float)(rand() % MAXPOS + d); + if (rand()%4 == 0 && flag == WEIRD) { + stars[n].offsetX = (float)(rand() % 100 - 100 / 2); + stars[n].offsetY = (float)(rand() % 100 - 100 / 2); + stars[n].offsetR = (float)(rand() % 25 - 25 / 2); + } else { + stars[n].offsetX = 0.0; + stars[n].offsetY = 0.0; + stars[n].offsetR = 0.0; + } +} + +void RotatePoint(float *x, float *y, float rotation) +{ + float tmpX, tmpY; + + tmpX = *x * Cos(rotation) - *y * Sin(rotation); + tmpY = *y * Cos(rotation) + *x * Sin(rotation); + *x = tmpX; + *y = tmpY; +} + +void MoveStars(void) +{ + float offset; + GLint n; + + offset = speed * 60.0; + + for (n = 0; n < starCount; n++) { + stars[n].x[1] = stars[n].x[0]; + stars[n].y[1] = stars[n].y[0]; + stars[n].z[1] = stars[n].z[0]; + stars[n].x[0] += stars[n].offsetX; + stars[n].y[0] += stars[n].offsetY; + stars[n].z[0] -= offset; + stars[n].rotation += stars[n].offsetR; + if (stars[n].rotation > MAXANGLES) { + stars[n].rotation = 0.0; + } + } +} + +GLenum StarPoint(GLint n) +{ + float x0, y0, x1, y1, width; + GLint i; + + x0 = stars[n].x[0] * windW / stars[n].z[0]; + y0 = stars[n].y[0] * windH / stars[n].z[0]; + RotatePoint(&x0, &y0, stars[n].rotation); + x0 += windW / 2.0; + y0 += windH / 2.0; + + if (x0 >= 0.0 && x0 < windW && y0 >= 0.0 && y0 < windH) { + if (stars[n].type == STREAK) { + x1 = stars[n].x[1] * windW / stars[n].z[1]; + y1 = stars[n].y[1] * windH / stars[n].z[1]; + RotatePoint(&x1, &y1, stars[n].rotation); + x1 += windW / 2.0; + y1 += windH / 2.0; + + glLineWidth(MAXPOS/100.0/stars[n].z[0]+1.0); + glColor3f(1.0, (MAXWARP-speed)/MAXWARP, (MAXWARP-speed)/MAXWARP); + if (fabs(x0-x1) < 1.0 && fabs(y0-y1) < 1.0) { + glBegin(GL_POINTS); + glVertex2f(x0, y0); + glEnd(); + } else { + glBegin(GL_LINES); + glVertex2f(x0, y0); + glVertex2f(x1, y1); + glEnd(); + } + } else { + width = MAXPOS / 10.0 / stars[n].z[0] + 1.0; + glColor3f(1.0, 0.0, 0.0); + glBegin(GL_POLYGON); + for (i = 0; i < 8; i++) { + float x = x0 + width * Cos((float)i*MAXANGLES/8.0); + float y = y0 + width * Sin((float)i*MAXANGLES/8.0); + glVertex2f(x, y); + }; + glEnd(); + } + return GL_TRUE; + } else { + return GL_FALSE; + } +} + +void ShowStars(void) +{ + GLint n; + + glClear(GL_COLOR_BUFFER_BIT); + + for (n = 0; n < starCount; n++) { + if (stars[n].z[0] > speed || (stars[n].z[0] > 0.0 && speed < MAXWARP)) { + if (StarPoint(n) == GL_FALSE) { + NewStar(n, MAXPOS); + } + } else { + NewStar(n, MAXPOS); + } + } +} + +static void Init(void) +{ + float angle; + GLint n; + + srand((unsigned int)time(NULL)); + + for (n = 0; n < MAXSTARS; n++) { + NewStar(n, 100); + } + + angle = 0.0; + for (n = 0; n < MAXANGLES ; n++) { + sinTable[n] = sin(angle); + angle += PI / (MAXANGLES / 2.0); + } + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glDisable(GL_DITHER); +} + +void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; + + glutUseLayer(GLUT_OVERLAY); + + glViewport(0, 0, windW, windH); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-0.5, windW+0.5, -0.5, windH+0.5); + glMatrixMode(GL_MODELVIEW); + overlayInit = GL_FALSE; + + glutUseLayer(GLUT_NORMAL); + + glViewport(0, 0, windW, windH); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-0.5, windW+0.5, -0.5, windH+0.5); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 32: + flag = (flag == NORMAL) ? WEIRD : NORMAL; + break; + case 't': + nitro = 1; + break; + default: + return; + } +} + +void Idle(void) +{ + + if (overlayInit == GL_FALSE) { + glutUseLayer(GLUT_OVERLAY); + glClear(GL_COLOR_BUFFER_BIT); +/* glColor3f(1.0, 0.0, 0.0);*/ + + glIndexf( 2.0 ); + glBegin(GL_POLYGON); + glVertex2i(windW/4-10, windH/4-10); + glVertex2i(windW/2-10, windH/4-10); + glVertex2i(windW/2-10, windH/2-10); + glVertex2i(windW/4-10, windH/2-10); + glEnd(); + + glIndexf( 0.0 ); + glBegin(GL_POLYGON); + glVertex2i(windW/4, windH/4); + glVertex2i(windW/2, windH/4); + glVertex2i(windW/2, windH/2); + glVertex2i(windW/4, windH/2); + glEnd(); + + glIndexf( 1.0 ); + glBegin(GL_POLYGON); + glVertex2i(windW/4+10, windH/4+10); + glVertex2i(windW/2+10, windH/4+10); + glVertex2i(windW/2+10, windH/2+10); + glVertex2i(windW/4+10, windH/2+10); + glEnd(); + + glutUseLayer(GLUT_NORMAL); + overlayInit = GL_TRUE; + } + + MoveStars(); + ShowStars(); + if (nitro > 0) { + speed = (float)(nitro / 10) + 1.0; + if (speed > MAXWARP) { + speed = MAXWARP; + } + if (++nitro > MAXWARP*10) { + nitro = -nitro; + } + } else if (nitro < 0) { + nitro++; + speed = (float)(-nitro / 10) + 1.0; + if (speed > MAXWARP) { + speed = MAXWARP; + } + } + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_TRUE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (!glutLayerGet(GLUT_OVERLAY_POSSIBLE)) + { + fprintf(stderr, "Overlay not available\n"); + return(1); + } + + if (Args(argc, argv) == GL_FALSE) { + return(1); + } + + windW = 300; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Overlay Test") == GL_FALSE) { + return(1); + } + + glutEstablishOverlay(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutIdleFunc(Idle); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/point.c b/xc/extras/Mesa/samples/point.c new file mode 100644 index 000000000..4cb6ad7d5 --- /dev/null +++ b/xc/extras/Mesa/samples/point.c @@ -0,0 +1,234 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define CI_RED COLOR_RED +#define CI_ANTI_ALIAS_GREEN 16 +#define CI_ANTI_ALIAS_YELLOW 32 +#define CI_ANTI_ALIAS_RED 48 + + +GLenum rgb, doubleBuffer, windType; +GLint windW, windH; + +#include "tkmap.c" + +GLenum mode; +GLint size; +float point[3] = { + 1.0, 1.0, 0.0 +}; + + +static void Init(void) +{ + GLint i; + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glBlendFunc(GL_SRC_ALPHA, GL_ZERO); + + if (!rgb) { + for (i = 0; i < 16; i++) { + glutSetColor(i+CI_ANTI_ALIAS_RED, i/15.0, 0.0, 0.0); + glutSetColor(i+CI_ANTI_ALIAS_YELLOW, i/15.0, i/15.0, 0.0); + glutSetColor(i+CI_ANTI_ALIAS_GREEN, 0.0, i/15.0, 0.0); + } + } + + mode = GL_FALSE; + size = 1; +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; + + glViewport(0, 0, width, height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-windW/2, windW/2, -windH/2, windH/2); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + point[0] -= 0.25; + break; + case GLUT_KEY_RIGHT: + point[0] += 0.25; + break; + case GLUT_KEY_UP: + point[1] += 0.25; + break; + case GLUT_KEY_DOWN: + point[1] -= 0.25; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case '1': + mode = !mode; + break; + case 'W': + size++; + break; + case 'w': + size--; + if (size < 1) { + size = 1; + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + SetColor(COLOR_YELLOW); + glBegin(GL_LINE_STRIP); + glVertex2f(-windW/2, 0); + glVertex2f(windW/2, 0); + glEnd(); + glBegin(GL_LINE_STRIP); + glVertex2f(0, -windH/2); + glVertex2f(0, windH/2); + glEnd(); + + if (mode) { + glEnable(GL_BLEND); + glEnable(GL_POINT_SMOOTH); + } else { + glDisable(GL_BLEND); + glDisable(GL_POINT_SMOOTH); + } + + glPointSize(size); + if (mode) { + (rgb) ? glColor3f(1.0, 0.0, 0.0) : glIndexf(CI_ANTI_ALIAS_RED); + } else { + (rgb) ? glColor3f(1.0, 0.0, 0.0) : glIndexf(CI_RED); + } + glBegin(GL_POINTS); + glVertex3fv(point); + glEnd(); + + glDisable(GL_POINT_SMOOTH); + glDisable(GL_BLEND); + + glPointSize(1); + SetColor(COLOR_GREEN); + glBegin(GL_POINTS); + glVertex3fv(point); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + windW = 300; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Point Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/prim.c b/xc/extras/Mesa/samples/prim.c new file mode 100644 index 000000000..388e0153b --- /dev/null +++ b/xc/extras/Mesa/samples/prim.c @@ -0,0 +1,546 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define PIXEL_CENTER(x) ((long)(x) + 0.5) + +#define GAP 10 +#define ROWS 3 +#define COLS 4 + +#define OPENGL_WIDTH 48 +#define OPENGL_HEIGHT 13 + + +GLenum rgb, doubleBuffer, windType; +GLint windW, windH; + +GLenum mode1, mode2; +GLint boxW, boxH; +GLubyte OpenGL_bits[] = { + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01, + 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01, + 0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00, + 0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00, + 0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00, + 0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00, + 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a, + 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e, + 0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e, + 0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00, +}; + + +#include "tkmap.c" + +static void Init(void) +{ + + mode1 = GL_TRUE; + mode2 = GL_TRUE; +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; +} + +static void RotateColorMask(void) +{ + static GLint rotation = 0; + + rotation = (rotation + 1) & 0x3; + switch (rotation) { + case 0: + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glIndexMask( 0xff ); + break; + case 1: + glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); + glIndexMask(0xFE); + break; + case 2: + glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE); + glIndexMask(0xFD); + break; + case 3: + glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE); + glIndexMask(0xFB); + break; + } +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case '1': + mode1 = !mode1; + break; + case '2': + mode2 = !mode2; + break; + case '3': + RotateColorMask(); + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Viewport(GLint row, GLint column) +{ + GLint x, y; + + boxW = (windW - (COLS + 1) * GAP) / COLS; + boxH = (windH - (ROWS + 1) * GAP) / ROWS; + + x = GAP + column * (boxW + GAP); + y = GAP + row * (boxH + GAP); + + glViewport(x, y, boxW, boxH); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0); + glMatrixMode(GL_MODELVIEW); + + glEnable(GL_SCISSOR_TEST); + glScissor(x, y, boxW, boxH); +} + +static void Point(void) +{ + GLint i; + + glBegin(GL_POINTS); + SetColor(COLOR_WHITE); + glVertex2i(0, 0); + for (i = 1; i < 8; i++) { + GLint j = i * 2; + SetColor(COLOR_BLACK+i); + glVertex2i(-j, -j); + glVertex2i(-j, 0); + glVertex2i(-j, j); + glVertex2i(0, j); + glVertex2i(j, j); + glVertex2i(j, 0); + glVertex2i(j, -j); + glVertex2i(0, -j); + } + glEnd(); +} + +static void Lines(void) +{ + GLint i; + + glPushMatrix(); + + glTranslatef(-12, 0, 0); + for (i = 1; i < 8; i++) { + SetColor(COLOR_BLACK+i); + glBegin(GL_LINES); + glVertex2i(-boxW/4, -boxH/4); + glVertex2i(boxW/4, boxH/4); + glEnd(); + glTranslatef(4, 0, 0); + } + + glPopMatrix(); + + glBegin(GL_LINES); + glVertex2i(0, 0); + glEnd(); +} + +static void LineStrip(void) +{ + + glBegin(GL_LINE_STRIP); + SetColor(COLOR_RED); + glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4)); + SetColor(COLOR_GREEN); + glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4)); + SetColor(COLOR_BLUE); + glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4)); + SetColor(COLOR_WHITE); + glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4)); + glEnd(); + + glBegin(GL_LINE_STRIP); + glVertex2i(0, 0); + glEnd(); +} + +static void LineLoop(void) +{ + + glBegin(GL_LINE_LOOP); + SetColor(COLOR_RED); + glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4)); + SetColor(COLOR_GREEN); + glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4)); + SetColor(COLOR_BLUE); + glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4)); + SetColor(COLOR_WHITE); + glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4)); + glEnd(); + + glEnable(GL_LOGIC_OP); + glLogicOp(GL_XOR); + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + + SetColor(COLOR_MAGENTA); + glBegin(GL_LINE_LOOP); + glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8)); + glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8)); + glEnd(); + glBegin(GL_LINE_LOOP); + glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5)); + glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5)); + glEnd(); + glDisable(GL_LOGIC_OP); + glDisable(GL_BLEND); + + SetColor(COLOR_GREEN); + glBegin(GL_POINTS); + glVertex2i(0, 0); + glEnd(); + + glBegin(GL_LINE_LOOP); + glVertex2i(0, 0); + glEnd(); +} + +static void Bitmap(void) +{ + + glBegin(GL_LINES); + SetColor(COLOR_GREEN); + glVertex2i(-boxW/2, 0); + glVertex2i(boxW/2, 0); + glVertex2i(0, -boxH/2); + glVertex2i(0, boxH/2); + SetColor(COLOR_RED); + glVertex2i(0, -3); + glVertex2i(0, -3+OPENGL_HEIGHT); + SetColor(COLOR_BLUE); + glVertex2i(0, -3); + glVertex2i(OPENGL_WIDTH, -3); + glEnd(); + + SetColor(COLOR_GREEN); + + glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glRasterPos2i(0, 0); + glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits); +} + +static void Triangles(void) +{ + + glBegin(GL_TRIANGLES); + SetColor(COLOR_GREEN); + glVertex2i(-boxW/4, -boxH/4); + SetColor(COLOR_RED); + glVertex2i(-boxW/8, -boxH/16); + SetColor(COLOR_BLUE); + glVertex2i(boxW/8, -boxH/16); + + SetColor(COLOR_GREEN); + glVertex2i(-boxW/4, boxH/4); + SetColor(COLOR_RED); + glVertex2i(-boxW/8, boxH/16); + SetColor(COLOR_BLUE); + glVertex2i(boxW/8, boxH/16); + glEnd(); + + glBegin(GL_TRIANGLES); + glVertex2i(0, 0); + glVertex2i(-100, 100); + glEnd(); +} + +static void TriangleStrip(void) +{ + + glBegin(GL_TRIANGLE_STRIP); + SetColor(COLOR_GREEN); + glVertex2i(-boxW/4, -boxH/4); + SetColor(COLOR_RED); + glVertex2i(-boxW/4, boxH/4); + SetColor(COLOR_BLUE); + glVertex2i(0, -boxH/4); + SetColor(COLOR_WHITE); + glVertex2i(0, boxH/4); + SetColor(COLOR_CYAN); + glVertex2i(boxW/4, -boxH/4); + SetColor(COLOR_YELLOW); + glVertex2i(boxW/4, boxH/4); + glEnd(); + + glBegin(GL_TRIANGLE_STRIP); + glVertex2i(0, 0); + glVertex2i(-100, 100); + glEnd(); +} + +static void TriangleFan(void) +{ + GLint vx[8][2]; + GLint x0, y0, x1, y1, x2, y2, x3, y3; + GLint i; + + y0 = -boxH/4; + y1 = y0 + boxH/2/3; + y2 = y1 + boxH/2/3; + y3 = boxH/4; + x0 = -boxW/4; + x1 = x0 + boxW/2/3; + x2 = x1 + boxW/2/3; + x3 = boxW/4; + + vx[0][0] = x0; vx[0][1] = y1; + vx[1][0] = x0; vx[1][1] = y2; + vx[2][0] = x1; vx[2][1] = y3; + vx[3][0] = x2; vx[3][1] = y3; + vx[4][0] = x3; vx[4][1] = y2; + vx[5][0] = x3; vx[5][1] = y1; + vx[6][0] = x2; vx[6][1] = y0; + vx[7][0] = x1; vx[7][1] = y0; + + glBegin(GL_TRIANGLE_FAN); + SetColor(COLOR_WHITE); + glVertex2i(0, 0); + for (i = 0; i < 8; i++) { + SetColor(COLOR_WHITE-i); + glVertex2iv(vx[i]); + } + glEnd(); + + glBegin(GL_TRIANGLE_FAN); + glVertex2i(0, 0); + glVertex2i(-100, 100); + glEnd(); +} + +static void Rect(void) +{ + + SetColor(COLOR_GREEN); + glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4); +} + +static void PolygonFunc(void) +{ + GLint vx[8][2]; + GLint x0, y0, x1, y1, x2, y2, x3, y3; + GLint i; + + y0 = -boxH/4; + y1 = y0 + boxH/2/3; + y2 = y1 + boxH/2/3; + y3 = boxH/4; + x0 = -boxW/4; + x1 = x0 + boxW/2/3; + x2 = x1 + boxW/2/3; + x3 = boxW/4; + + vx[0][0] = x0; vx[0][1] = y1; + vx[1][0] = x0; vx[1][1] = y2; + vx[2][0] = x1; vx[2][1] = y3; + vx[3][0] = x2; vx[3][1] = y3; + vx[4][0] = x3; vx[4][1] = y2; + vx[5][0] = x3; vx[5][1] = y1; + vx[6][0] = x2; vx[6][1] = y0; + vx[7][0] = x1; vx[7][1] = y0; + + glBegin(GL_POLYGON); + for (i = 0; i < 8; i++) { + SetColor(COLOR_WHITE-i); + glVertex2iv(vx[i]); + } + glEnd(); + + glBegin(GL_POLYGON); + glVertex2i(0, 0); + glVertex2i(100, 100); + glEnd(); +} + +static void Quads(void) +{ + + glBegin(GL_QUADS); + SetColor(COLOR_GREEN); + glVertex2i(-boxW/4, -boxH/4); + SetColor(COLOR_RED); + glVertex2i(-boxW/8, -boxH/16); + SetColor(COLOR_BLUE); + glVertex2i(boxW/8, -boxH/16); + SetColor(COLOR_WHITE); + glVertex2i(boxW/4, -boxH/4); + + SetColor(COLOR_GREEN); + glVertex2i(-boxW/4, boxH/4); + SetColor(COLOR_RED); + glVertex2i(-boxW/8, boxH/16); + SetColor(COLOR_BLUE); + glVertex2i(boxW/8, boxH/16); + SetColor(COLOR_WHITE); + glVertex2i(boxW/4, boxH/4); + glEnd(); + + glBegin(GL_QUADS); + glVertex2i(0, 0); + glVertex2i(100, 100); + glVertex2i(-100, 100); + glEnd(); +} + +static void QuadStrip(void) +{ + + glBegin(GL_QUAD_STRIP); + SetColor(COLOR_GREEN); + glVertex2i(-boxW/4, -boxH/4); + SetColor(COLOR_RED); + glVertex2i(-boxW/4, boxH/4); + SetColor(COLOR_BLUE); + glVertex2i(0, -boxH/4); + SetColor(COLOR_WHITE); + glVertex2i(0, boxH/4); + SetColor(COLOR_CYAN); + glVertex2i(boxW/4, -boxH/4); + SetColor(COLOR_YELLOW); + glVertex2i(boxW/4, boxH/4); + glEnd(); + + glBegin(GL_QUAD_STRIP); + glVertex2i(0, 0); + glVertex2i(100, 100); + glVertex2i(-100, 100); + glEnd(); +} + +static void Draw(void) +{ + + glViewport(0, 0, windW, windH); + glDisable(GL_SCISSOR_TEST); + + glPushAttrib(GL_COLOR_BUFFER_BIT); + + glColorMask(1, 1, 1, 1); + glIndexMask(~0); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + glPopAttrib(); + + if (mode1) { + glShadeModel(GL_SMOOTH); + } else { + glShadeModel(GL_FLAT); + } + + if (mode2) { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } else { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } + + Viewport(0, 0); Point(); + Viewport(0, 1); Lines(); + Viewport(0, 2); LineStrip(); + Viewport(0, 3); LineLoop(); + + Viewport(1, 0); Bitmap(); + + Viewport(1, 1); TriangleFan(); + Viewport(1, 2); Triangles(); + Viewport(1, 3); TriangleStrip(); + + Viewport(2, 0); Rect(); + Viewport(2, 1); PolygonFunc(); + Viewport(2, 2); Quads(); + Viewport(2, 3); QuadStrip(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + windW = 600; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Primitive Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/quad.c b/xc/extras/Mesa/samples/quad.c new file mode 100644 index 000000000..8dec28b6b --- /dev/null +++ b/xc/extras/Mesa/samples/quad.c @@ -0,0 +1,455 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#ifndef CALLBACK +#define CALLBACK +#endif + + +#define PI 3.141592654 +#define BLACK 0 +#define GRAY 128 +#define WHITE 255 +#define RD 0xA4,0x00,0x00,0xFF +#define WT 0xFF,0xFF,0xFF,0xFF +#define brickImageWidth 16 +#define brickImageHeight 16 + + +#include "loadppm.c" + +GLenum rgb, doubleBuffer; + +#include "tkmap.c" + +float black[3] = { + 0.0, 0.0, 0.0 +}; +float blue[3] = { + 0.0, 0.0, 1.0 +}; +float gray[3] = { + 0.5, 0.5, 0.5 +}; +float white[3] = { + 1.0, 1.0, 1.0 +}; + +GLenum doDither = GL_TRUE; +GLenum shade = GL_TRUE; +GLenum texture = GL_TRUE; + +float xRotation = 30.0, yRotation = 30.0, zRotation = 0.0; +GLint radius1, radius2; +GLdouble angle1, angle2; +GLint slices, stacks; +GLint height; +GLint orientation = GLU_OUTSIDE; +GLint whichQuadric=0; +GLUquadricObj *quadObj; + +GLubyte brickImage[4*brickImageWidth*brickImageHeight] = { + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, + WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, + WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, + WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, + RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD +}; +char *texFileName = 0; + + +static void CALLBACK ErrorHandler(GLenum which) +{ + + fprintf(stderr, "Quad Error: %s\n", gluErrorString(which)); +} + +static void Init(void) +{ + static GLint colorIndexes[3] = {0, 200, 255}; + static float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float diffuse[] = {0.5, 1.0, 1.0, 1.0}; + static float position[] = {90.0, 90.0, 150.0, 0.0}; + static float front_mat_shininess[] = {30.0}; + static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0}; + static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0}; + static float back_mat_shininess[] = {50.0}; + static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0}; + static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; + static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; + static float lmodel_twoside[] = {GL_TRUE}; + static float decal[] = {GL_DECAL}; + static float repeat[] = {GL_REPEAT}; + static float nearest[] = {GL_NEAREST}; + static PPMImage *image; + + if (!rgb) { + SetGreyRamp(); + } + glClearColor(0.0, 0.0, 0.0, 0.0); + + glEnable(GL_DEPTH_TEST); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess); + glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular); + glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess); + glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular); + glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse); + if (!rgb) { + glMaterialiv( GL_FRONT_AND_BACK, GL_COLOR_INDEXES, colorIndexes); + } + + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest); + if (texFileName) { + image = LoadPPM(texFileName); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, + GL_RGB, GL_UNSIGNED_BYTE, image->data); + } else { + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, 4, brickImageWidth, brickImageHeight, + 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)brickImage); + } + + quadObj = gluNewQuadric(); + gluQuadricCallback(quadObj, GLU_ERROR, ErrorHandler); + + radius1 = 10; + radius2 = 5; + angle1 = 90; + angle2 = 180; + slices = 16; + stacks = 10; + height = 20; +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1, 1, -1, 1, 1, 10); + gluLookAt(2, 2, 2, 0, 0, 0, 0, 0, 1); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + yRotation += 5; + break; + case GLUT_KEY_RIGHT: + yRotation -= 5; + break; + case GLUT_KEY_UP: + xRotation += 5; + break; + case GLUT_KEY_DOWN: + xRotation -= 5; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + + case 'X': + zRotation += 5; + break; + case 'x': + zRotation -= 5; + break; + + case '1': + gluQuadricDrawStyle(quadObj, GLU_FILL); + break; + case '2': + gluQuadricDrawStyle(quadObj, GLU_POINT); + break; + case '3': + gluQuadricDrawStyle(quadObj, GLU_LINE); + break; + case '4': + gluQuadricDrawStyle(quadObj, GLU_SILHOUETTE); + break; + + case '0': + shade = !shade; + if (shade) { + glShadeModel(GL_SMOOTH); + gluQuadricNormals(quadObj, GLU_SMOOTH); + } else { + glShadeModel(GL_FLAT); + gluQuadricNormals(quadObj, GLU_FLAT); + } + break; + + case 'A': + stacks++; + break; + case 'a': + stacks--; + break; + + case 'S': + slices++; + break; + case 's': + slices--; + break; + + case 'd': + switch(orientation) { + case GLU_OUTSIDE: + orientation = GLU_INSIDE; + break; + case GLU_INSIDE: + default: + orientation = GLU_OUTSIDE; + break; + } + gluQuadricOrientation(quadObj, orientation); + break; + + case 'f': + whichQuadric = (whichQuadric + 1) % 4; + break; + + case 'G': + radius1 += 1; + break; + case 'g': + radius1 -= 1; + break; + + case 'J': + radius2 += 1; + break; + case 'j': + radius2 -= 1; + break; + + case 'H': + height += 2; + break; + case 'h': + height -= 2; + break; + + case 'K': + angle1 += 5; + break; + case 'k': + angle1 -= 5; + break; + + case 'L': + angle2 += 5; + break; + case 'l': + angle2 -= 5; + break; + + case 'z': + texture = !texture; + if (texture) { + gluQuadricTexture(quadObj, GL_TRUE); + glEnable(GL_TEXTURE_2D); + } else { + gluQuadricTexture(quadObj, GL_FALSE); + glDisable(GL_TEXTURE_2D); + } + break; + + case 'q': + glDisable(GL_CULL_FACE); + break; + case 'w': + glEnable(GL_CULL_FACE); + glCullFace(GL_FRONT); + break; + case 'e': + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + break; + + case 'r': + glFrontFace(GL_CW); + break; + case 't': + glFrontFace(GL_CCW); + break; + + case 'y': + doDither = !doDither; + (doDither) ? glEnable(GL_DITHER) : glDisable(GL_DITHER); + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glLoadIdentity(); + glRotatef(xRotation, 1, 0, 0); + glRotatef(yRotation, 0, 1, 0); + glRotatef(zRotation, 0, 0, 1); + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + glColor3f(1.0, 1.0, 1.0); + switch (whichQuadric) { + case 0: + glTranslatef(0, 0, -height/20.0); + gluCylinder(quadObj, radius1/10.0, radius2/10.0, height/10.0, + slices, stacks); + break; + case 1: + gluSphere(quadObj, radius1/10.0, slices, stacks); + break; + case 2: + gluPartialDisk(quadObj, radius2/10.0, radius1/10.0, slices, + stacks, angle1, angle2); + break; + case 3: + gluDisk(quadObj, radius2/10.0, radius1/10.0, slices, stacks); + break; + } + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-f") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-f (No file name).\n"); + return GL_FALSE; + } else { + texFileName = argv[++i]; + } + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_DEPTH; + type |= (rgb) ? GLUT_RGB : GLUT_INDEX; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Quad Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/rgbtoppm.c b/xc/extras/Mesa/samples/rgbtoppm.c new file mode 100644 index 000000000..0bc73487b --- /dev/null +++ b/xc/extras/Mesa/samples/rgbtoppm.c @@ -0,0 +1,273 @@ + +/* texture.c - by David Blythe, SGI */ + +/* texload is a simplistic routine for reading an SGI .rgb image file. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <GL/glut.h> + +typedef struct _ImageRec { + unsigned short imagic; + unsigned short type; + unsigned short dim; + unsigned short xsize, ysize, zsize; + unsigned int min, max; + unsigned int wasteBytes; + char name[80]; + unsigned long colorMap; + FILE *file; + unsigned char *tmp; + unsigned long rleEnd; + unsigned int *rowStart; + int *rowSize; +} ImageRec; + +void +rgbtorgb(unsigned char *r,unsigned char *g,unsigned char *b,unsigned char *l,int n) { + while(n--) { + l[0] = r[0]; + l[1] = g[0]; + l[2] = b[0]; + l += 3; r++; g++; b++; + } +} + +static void +ConvertShort(unsigned short *array, unsigned int length) { + unsigned short b1, b2; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + *array++ = (b1 << 8) | (b2); + } +} + +static void +ConvertUint(unsigned *array, unsigned int length) { + unsigned int b1, b2, b3, b4; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + b3 = *ptr++; + b4 = *ptr++; + *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); + } +} + +static ImageRec *ImageOpen(char *fileName) +{ + union { + int testWord; + char testByte[4]; + } endianTest; + ImageRec *image; + int swapFlag; + int x; + + endianTest.testWord = 1; + if (endianTest.testByte[0] == 1) { + swapFlag = 1; + } else { + swapFlag = 0; + } + + image = (ImageRec *)malloc(sizeof(ImageRec)); + if (image == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(1); + } + if ((image->file = fopen(fileName, "rb")) == NULL) { + return NULL; + } + + fread(image, 1, 12, image->file); + + if (swapFlag) { + ConvertShort(&image->imagic, 6); + } + + image->tmp = (unsigned char *)malloc(image->xsize*256); + if (image->tmp == NULL) { + fprintf(stderr, "\nOut of memory!\n"); + exit(1); + } + + if ((image->type & 0xFF00) == 0x0100) { + x = image->ysize * image->zsize * (int) sizeof(unsigned); + image->rowStart = (unsigned *)malloc(x); + image->rowSize = (int *)malloc(x); + if (image->rowStart == NULL || image->rowSize == NULL) { + fprintf(stderr, "\nOut of memory!\n"); + exit(1); + } + image->rleEnd = 512 + (2 * x); + fseek(image->file, 512, SEEK_SET); + fread(image->rowStart, 1, x, image->file); + fread(image->rowSize, 1, x, image->file); + if (swapFlag) { + ConvertUint(image->rowStart, x/(int) sizeof(unsigned)); + ConvertUint((unsigned *)image->rowSize, x/(int) sizeof(int)); + } + } + return image; +} + +static void +ImageClose(ImageRec *image) { + fclose(image->file); + free(image->tmp); + free(image); +} + +static void +ImageGetRow(ImageRec *image, unsigned char *buf, int y, int z) { + unsigned char *iPtr, *oPtr, pixel; + int count; + + if ((image->type & 0xFF00) == 0x0100) { + fseek(image->file, (long) image->rowStart[y+z*image->ysize], SEEK_SET); + fread(image->tmp, 1, (unsigned int)image->rowSize[y+z*image->ysize], + image->file); + + iPtr = image->tmp; + oPtr = buf; + for (;;) { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if (!count) { + return; + } + if (pixel & 0x80) { + while (count--) { + *oPtr++ = *iPtr++; + } + } else { + pixel = *iPtr++; + while (count--) { + *oPtr++ = pixel; + } + } + } + } else { + fseek(image->file, 512+(y*image->xsize)+(z*image->xsize*image->ysize), + SEEK_SET); + fread(buf, 1, image->xsize, image->file); + } +} + +GLubyte * +read_alpha_texture(char *name, int *width, int *height) +{ + unsigned char *base, *lptr; + ImageRec *image; + int y; + + image = ImageOpen(name); + if(!image) { + return NULL; + } + + (*width)=image->xsize; + (*height)=image->ysize; + if (image->zsize != 1) { + ImageClose(image); + return NULL; + } + + base = (unsigned char *)malloc(image->xsize*image->ysize*sizeof(unsigned char)); + lptr = base; + for(y=0; y<image->ysize; y++) { + ImageGetRow(image,lptr,y,0); + lptr += image->xsize; + } + ImageClose(image); + + return (unsigned char *) base; +} + +GLubyte * +read_rgb_texture(char *name, int *width, int *height) +{ + unsigned char *base, *ptr; + unsigned char *rbuf, *gbuf, *bbuf, *abuf; + ImageRec *image; + int y; + + image = ImageOpen(name); + + if(!image) + return NULL; + (*width)=image->xsize; + (*height)=image->ysize; + if (image->zsize != 3 && image->zsize != 4) { + ImageClose(image); + return NULL; + } + + base = (unsigned char*)malloc(image->xsize*image->ysize*sizeof(unsigned int)*3); + rbuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char)); + gbuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char)); + bbuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char)); + abuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char)); + if(!base || !rbuf || !gbuf || !bbuf || !abuf) { + if (base) free(base); + if (rbuf) free(rbuf); + if (gbuf) free(gbuf); + if (bbuf) free(bbuf); + if (abuf) free(abuf); + return NULL; + } + ptr = base; + for(y=0; y<image->ysize; y++) { + if(image->zsize == 4) { + ImageGetRow(image,rbuf,y,0); + ImageGetRow(image,gbuf,y,1); + ImageGetRow(image,bbuf,y,2); + ImageGetRow(image,abuf,y,3); /* Discard. */ + rgbtorgb(rbuf,gbuf,bbuf,ptr,image->xsize); + ptr += (image->xsize * 3); + } else { + ImageGetRow(image,rbuf,y,0); + ImageGetRow(image,gbuf,y,1); + ImageGetRow(image,bbuf,y,2); + rgbtorgb(rbuf,gbuf,bbuf,ptr,image->xsize); + ptr += (image->xsize * 3); + } + } + ImageClose(image); + free(rbuf); + free(gbuf); + free(bbuf); + free(abuf); + + return (GLubyte *) base; +} + +int main(int argc, char **argv) +{ + int width, height; + GLubyte *data; + + if (argc != 2) + { + fprintf(stderr, "usage: %s <filename>\n", argv[0]); + return 1; + } + + data = read_rgb_texture(argv[1], &width, &height); + + printf("P6\n%d %d\n255\n", width, height); + fwrite(data, width * 3, height, stdout); + + return 0; +} + diff --git a/xc/extras/Mesa/samples/select.c b/xc/extras/Mesa/samples/select.c new file mode 100644 index 000000000..5a73a457a --- /dev/null +++ b/xc/extras/Mesa/samples/select.c @@ -0,0 +1,456 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include <time.h> +#include <GL/glut.h> + + +#define MAXOBJS 10000 +#define MAXSELECT 100 +#define MAXFEED 300 +#define SOLID 1 +#define LINE 2 +#define POINT 3 + + +GLint windW, windH; + +GLuint selectBuf[MAXSELECT]; +GLfloat feedBuf[MAXFEED]; +GLint vp[4]; +float zRotation = 90.0; +float zoom = 1.0; +GLint objectCount; +GLint numObjects; +struct object { + float v1[2]; + float v2[2]; + float v3[2]; + float color[3]; +} objects[MAXOBJS]; +GLenum linePoly = GL_FALSE; + + +static void InitObjects(GLint num) +{ + GLint i; + float x, y; + + if (num > MAXOBJS) { + num = MAXOBJS; + } + if (num < 1) { + num = 1; + } + objectCount = num; + + srand((unsigned int)time(NULL)); + for (i = 0; i < num; i++) { + x = (rand() % 300) - 150; + y = (rand() % 300) - 150; + + objects[i].v1[0] = x + (rand() % 50) - 25; + objects[i].v2[0] = x + (rand() % 50) - 25; + objects[i].v3[0] = x + (rand() % 50) - 25; + objects[i].v1[1] = y + (rand() % 50) - 25; + objects[i].v2[1] = y + (rand() % 50) - 25; + objects[i].v3[1] = y + (rand() % 50) - 25; + objects[i].color[0] = ((rand() % 100) + 50) / 150.0; + objects[i].color[1] = ((rand() % 100) + 50) / 150.0; + objects[i].color[2] = ((rand() % 100) + 50) / 150.0; + } +} + +static void Init(void) +{ + + numObjects = 10; + InitObjects(numObjects); + glGetIntegerv(GL_VIEWPORT, vp); +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; +} + +static void Render(GLenum mode) +{ + GLint i; + + for (i = 0; i < objectCount; i++) { + if (mode == GL_SELECT) { + glLoadName(i); + } + glColor3fv(objects[i].color); + glBegin(GL_POLYGON); + glVertex2fv(objects[i].v1); + glVertex2fv(objects[i].v2); + glVertex2fv(objects[i].v3); + glEnd(); + } +} + +static GLint DoSelect(GLint x, GLint y) +{ + GLint hits; + + glSelectBuffer(MAXSELECT, selectBuf); + (void)glRenderMode(GL_SELECT); + glInitNames(); + glPushName(~0); + + glPushMatrix(); + + glViewport(0, 0, windW, windH); + glGetIntegerv(GL_VIEWPORT, vp); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPickMatrix(x, windH-y, 4, 4, vp); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + glScalef(zoom, zoom, zoom); + glRotatef(zRotation, 0, 0, 1); + + Render(GL_SELECT); + + glPopMatrix(); + + hits = glRenderMode(GL_RENDER); + if (hits <= 0) { + return -1; + } + + return selectBuf[(hits-1)*4+3]; +} + +static void RecolorTri(GLint h) +{ + + objects[h].color[0] = ((rand() % 100) + 50) / 150.0; + objects[h].color[1] = ((rand() % 100) + 50) / 150.0; + objects[h].color[2] = ((rand() % 100) + 50) / 150.0; +} + +static void DeleteTri(GLint h) +{ + + objects[h] = objects[objectCount-1]; + objectCount--; +} + +static void GrowTri(GLint h) +{ + float v[2]; + float *oldV; + GLint i; + + v[0] = objects[h].v1[0] + objects[h].v2[0] + objects[h].v3[0]; + v[1] = objects[h].v1[1] + objects[h].v2[1] + objects[h].v3[1]; + v[0] /= 3; + v[1] /= 3; + + for (i = 0; i < 3; i++) { + switch (i) { + case 0: + oldV = objects[h].v1; + break; + case 1: + oldV = objects[h].v2; + break; + case 2: + oldV = objects[h].v3; + break; + } + oldV[0] = 1.5 * (oldV[0] - v[0]) + v[0]; + oldV[1] = 1.5 * (oldV[1] - v[1]) + v[1]; + } +} + +static void Mouse(int button, int state, int mouseX, int mouseY) +{ + GLint hit; + + if (state != GLUT_DOWN) + return; + + hit = DoSelect((GLint)mouseX, (GLint)mouseY); + if (hit != -1) { + if (button == GLUT_LEFT_BUTTON) { + RecolorTri(hit); + } + if (button == GLUT_MIDDLE_BUTTON) { + GrowTri(hit); + } + if (button == GLUT_RIGHT_BUTTON) { + DeleteTri(hit); + } + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glPushMatrix(); + + glViewport(0, 0, windW, windH); + glGetIntegerv(GL_VIEWPORT, vp); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + glScalef(zoom, zoom, zoom); + glRotatef(zRotation, 0, 0, 1); + + Render(GL_RENDER); + + glPopMatrix(); + + glFlush(); +} + +static void DrawZoom(GLint x, GLint y) +{ + + glPushMatrix(); + + glViewport(0, 0, windW, windH); + glGetIntegerv(GL_VIEWPORT, vp); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPickMatrix(x, windH-y, 4, 4, vp); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + glScalef(zoom, zoom, zoom); + glRotatef(zRotation, 0, 0, 1); + + Render(GL_RENDER); + + glPopMatrix(); +} + +static void DumpFeedbackVert(GLint *i, GLint n) +{ + GLint index; + + index = *i; + if (index+7 > n) { + *i = n; + printf(" ???\n"); + return; + } + printf(" (%g %g %g), color = (%4.2f %4.2f %4.2f)\n", + feedBuf[index], + feedBuf[index+1], + feedBuf[index+2], + feedBuf[index+3], + feedBuf[index+4], + feedBuf[index+5]); + index += 7; + *i = index; +} + +static void DrawFeedback(GLint n) +{ + GLint i; + GLint verts; + + printf("Feedback results (%d floats):\n", n); + for (i = 0; i < n; i++) { + switch ((GLint)feedBuf[i]) { + case GL_POLYGON_TOKEN: + printf("Polygon"); + i++; + if (i < n) { + verts = (GLint)feedBuf[i]; + i++; + printf(": %d vertices", verts); + } else { + verts = 0; + } + printf("\n"); + while (verts) { + DumpFeedbackVert(&i, n); + verts--; + } + i--; + break; + case GL_LINE_TOKEN: + printf("Line:\n"); + i++; + DumpFeedbackVert(&i, n); + DumpFeedbackVert(&i, n); + i--; + break; + case GL_LINE_RESET_TOKEN: + printf("Line Reset:\n"); + i++; + DumpFeedbackVert(&i, n); + DumpFeedbackVert(&i, n); + i--; + break; + default: + printf("%9.2f\n", feedBuf[i]); + break; + } + } + if (i == MAXFEED) { + printf("...\n"); + } + printf("\n"); +} + +static void DoFeedback(void) +{ + GLint x; + + glFeedbackBuffer(MAXFEED, GL_3D_COLOR, feedBuf); + (void)glRenderMode(GL_FEEDBACK); + + glPushMatrix(); + + glViewport(0, 0, windW, windH); + glGetIntegerv(GL_VIEWPORT, vp); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + glScalef(zoom, zoom, zoom); + glRotatef(zRotation, 0, 0, 1); + + Render(GL_FEEDBACK); + + glPopMatrix(); + + x = glRenderMode(GL_RENDER); + if (x == -1) { + x = MAXFEED; + } + + DrawFeedback((GLint)x); +} + +static void Key2(int key, int x, int y) +{ + switch (key) { + case GLUT_KEY_LEFT: + zRotation += 0.5; + break; + case GLUT_KEY_RIGHT: + zRotation -= 0.5; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + switch (key) { + case 27: + exit(1); + case 'Z': + zoom /= 0.75; + break; + case 'z': + zoom *= 0.75; + break; + case 'f': + DoFeedback(); + break; + case 'd': + DrawZoom(x, y); + break; + case 'l': + linePoly = !linePoly; + if (linePoly) { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } else { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + windW = 300; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH); + + type = GLUT_RGB | GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Select Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutMouseFunc(Mouse); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/shape.c b/xc/extras/Mesa/samples/shape.c new file mode 100644 index 000000000..d342ee5b0 --- /dev/null +++ b/xc/extras/Mesa/samples/shape.c @@ -0,0 +1,345 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define OPENGL_WIDTH 24 +#define OPENGL_HEIGHT 13 + + +GLenum rgb, doubleBuffer, windType; +GLint objectIndex = 0; +GLuint bases[20]; +float angleX = 0.0, angleY = 0.0, angleZ = 0.0; +float scaleX = 1.0, scaleY = 1.0, scaleZ = 1.0; +float shiftX = 0.0, shiftY = 0.0, shiftZ = 0.0; + + +#include "tkmap.c" + +static void Init(void) +{ + + bases[0] = glGenLists(1); + glNewList(bases[0], GL_COMPILE); + glutWireSphere(1.0, 20, 10); + glEndList(); + + bases[1] = glGenLists(1); + glNewList(bases[1], GL_COMPILE); + glutSolidSphere(1.0, 20, 10); + glEndList(); + + bases[2] = glGenLists(1); + glNewList(bases[2], GL_COMPILE); + glutWireCube(1.0); + glEndList(); + + bases[3] = glGenLists(1); + glNewList(bases[3], GL_COMPILE); + glutSolidCube(1.0); + glEndList(); + + bases[4] = glGenLists(1); + glNewList(bases[4], GL_COMPILE); + glutWireTorus(1.0, 1.0, 10, 20); + glEndList(); + + bases[5] = glGenLists(1); + glNewList(bases[5], GL_COMPILE); + glutSolidTorus(1.0, 1.0, 10, 20); + glEndList(); + + bases[6] = glGenLists(1); + glNewList(bases[6], GL_COMPILE); + glutWireIcosahedron(); + glEndList(); + + bases[7] = glGenLists(1); + glNewList(bases[7], GL_COMPILE); + glutSolidIcosahedron(); + glEndList(); + + bases[8] = glGenLists(1); + glNewList(bases[8], GL_COMPILE); + glutWireOctahedron(); + glEndList(); + + bases[9] = glGenLists(1); + glNewList(bases[9], GL_COMPILE); + glutSolidOctahedron(); + glEndList(); + + bases[10] = glGenLists(1); + glNewList(bases[10], GL_COMPILE); + glutWireTetrahedron(); + glEndList(); + + bases[11] = glGenLists(1); + glNewList(bases[11], GL_COMPILE); + glutSolidTetrahedron(); + glEndList(); + + bases[12] = glGenLists(1); + glNewList(bases[12], GL_COMPILE); + glutWireDodecahedron(); + glEndList(); + + bases[13] = glGenLists(1); + glNewList(bases[13], GL_COMPILE); + glutSolidDodecahedron(); + glEndList(); + + bases[14] = glGenLists(1); + glNewList(bases[14], GL_COMPILE); + glutWireCone(5.0, 5.0, 20, 10); + glEndList(); + + bases[15] = glGenLists(1); + glNewList(bases[15], GL_COMPILE); + glutSolidCone(5.0, 5.0, 20, 10); + glEndList(); + + bases[16] = glGenLists(1); + glNewList(bases[16], GL_COMPILE); + glutWireTeapot(1.0); + glEndList(); + + bases[17] = glGenLists(1); + glNewList(bases[17], GL_COMPILE); + glutSolidTeapot(1.0); + glEndList(); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glClearIndex(0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-400.0, 400.0, -200.0, 200.0, -400.0, 400.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + shiftX -= 20.0; + break; + case GLUT_KEY_RIGHT: + shiftX += 20.0; + break; + case GLUT_KEY_UP: + shiftY += 20.0; + break; + case GLUT_KEY_DOWN: + shiftY -= 20.0; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + + case 32: + objectIndex++; + if (objectIndex > 17) { + objectIndex = 0; + } + break; + + case 'n': + shiftZ += 20.0; + break; + case 'm': + shiftZ -= 20.0; + break; + + case 'q': + scaleX -= 0.1; + if (scaleX < 0.1) { + scaleX = 0.1; + } + break; + case 'w': + scaleX += 0.1; + break; + case 'a': + scaleY -= 0.1; + if (scaleY < 0.1) { + scaleY = 0.1; + } + break; + case 's': + scaleY += 0.1; + break; + case 'z': + scaleZ -= 0.1; + if (scaleZ < 0.1) { + scaleZ = 0.1; + } + break; + case 'x': + scaleZ += 0.1; + break; + + case 'e': + angleX -= 5.0; + if (angleX < 0.0) { + angleX = 360.0 + angleX; + } + break; + case 'r': + angleX += 5.0; + if (angleX > 360.0) { + angleX = angleX - 360.0; + } + break; + case 'd': + angleY -= 5.0; + if (angleY < 0.0) { + angleY = 360.0 + angleY; + } + break; + case 'f': + angleY += 5.0; + if (angleY > 360.0) { + angleY = angleY - 360.0; + } + break; + case 'c': + angleZ -= 5.0; + if (angleZ < 0.0) { + angleZ = 360.0 + angleZ; + } + break; + case 'v': + angleZ += 5.0; + if (angleZ > 360.0) { + angleZ = angleZ - 360.0; + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + SetColor(COLOR_WHITE); + + glPushMatrix(); + + glTranslatef(shiftX, shiftY, shiftZ); + glRotatef(angleX, 1.0, 0.0, 0.0); + glRotatef(angleY, 0.0, 1.0, 0.0); + glRotatef(angleZ, 0.0, 0.0, 1.0); + glScalef(scaleX, scaleY, scaleZ); + + glCallList(bases[objectIndex]); + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 400); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Font Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/sphere.c b/xc/extras/Mesa/samples/sphere.c new file mode 100644 index 000000000..a2d3e43ee --- /dev/null +++ b/xc/extras/Mesa/samples/sphere.c @@ -0,0 +1,1034 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* BEP: renamed "nearest" as "nnearest" to avoid math.h collision on AIX */ + +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define FALSE 0 +#define TRUE 1 +#ifndef PI +#define PI 3.14159265358979323846 +#endif + + +#include "loadppm.c" + +int rgb; /* unused */ + +#include "tkmap.c" + +GLenum doubleBuffer; +int W = 400, H = 400; + +char *imageFileName = 0; +PPMImage *image; + +int numComponents; + +float *minFilter, *magFilter, *sWrapMode, *tWrapMode; +float decal[] = {GL_DECAL}; +float modulate[] = {GL_MODULATE}; +float repeat[] = {GL_REPEAT}; +float clamp[] = {GL_CLAMP}; +float nnearest[] = {GL_NEAREST}; +float linear[] = {GL_LINEAR}; +float nearest_mipmap_nearest[] = {GL_NEAREST_MIPMAP_NEAREST}; +float nearest_mipmap_linear[] = {GL_NEAREST_MIPMAP_LINEAR}; +float linear_mipmap_nearest[] = {GL_LINEAR_MIPMAP_NEAREST}; +float linear_mipmap_linear[] = {GL_LINEAR_MIPMAP_LINEAR}; +GLint sphereMap[] = {GL_SPHERE_MAP}; + +float xRotation = 0.0, yRotation = 0.0; +float zTranslate = -4.0; +GLenum autoRotate = TRUE; +GLenum deepestColor = COLOR_GREEN; +GLenum isLit = TRUE; +GLenum isFogged = FALSE; +float *textureEnvironment = modulate; + +struct MipMap { + int width, height; + unsigned char *data; +}; + +int cube, cage, cylinder, torus, genericObject; + +float c[6][4][4][3] = { + { + { + { + 1.0, 1.0, -1.0 + }, + { + 0.0, 1.0, -1.0 + }, + { + 0.0, 0.0, -1.0 + }, + { + 1.0, 0.0, -1.0 + }, + }, + { + { + 0.0, 1.0, -1.0 + }, + { + -1.0, 1.0, -1.0 + }, + { + -1.0, 0.0, -1.0 + }, + { + 0.0, 0.0, -1.0 + }, + }, + { + { + 0.0, 0.0, -1.0 + }, + { + -1.0, 0.0, -1.0 + }, + { + -1.0, -1.0, -1.0 + }, + { + 0.0, -1.0, -1.0 + }, + }, + { + { + 1.0, 0.0, -1.0 + }, + { + 0.0, 0.0, -1.0 + }, + { + 0.0, -1.0, -1.0 + }, + { + 1.0, -1.0, -1.0 + }, + }, + }, + { + { + { + 1.0, 1.0, 1.0 + }, + { + 1.0, 1.0, 0.0 + }, + { + 1.0, 0.0, 0.0 + }, + { + 1.0, 0.0, 1.0 + }, + }, + { + { + 1.0, 1.0, 0.0 + }, + { + 1.0, 1.0, -1.0 + }, + { + 1.0, 0.0, -1.0 + }, + { + 1.0, 0.0, 0.0 + }, + }, + { + { + 1.0, 0.0, -1.0 + }, + { + 1.0, -1.0, -1.0 + }, + { + 1.0, -1.0, 0.0 + }, + { + 1.0, 0.0, 0.0 + }, + }, + { + { + 1.0, 0.0, 0.0 + }, + { + 1.0, -1.0, 0.0 + }, + { + 1.0, -1.0, 1.0 + }, + { + 1.0, 0.0, 1.0 + }, + }, + }, + { + { + { + -1.0, 1.0, 1.0 + }, + { + 0.0, 1.0, 1.0 + }, + { + 0.0, 0.0, 1.0 + }, + { + -1.0, 0.0, 1.0 + }, + }, + { + { + 0.0, 1.0, 1.0 + }, + { + 1.0, 1.0, 1.0 + }, + { + 1.0, 0.0, 1.0 + }, + { + 0.0, 0.0, 1.0 + }, + }, + { + { + 1.0, 0.0, 1.0 + }, + { + 1.0, -1.0, 1.0 + }, + { + 0.0, -1.0, 1.0 + }, + { + 0.0, 0.0, 1.0 + }, + }, + { + { + 0.0, -1.0, 1.0 + }, + { + -1.0, -1.0, 1.0 + }, + { + -1.0, 0.0, 1.0 + }, + { + 0.0, 0.0, 1.0 + }, + }, + }, + { + { + { + -1.0, 1.0, -1.0 + }, + { + -1.0, 1.0, 0.0 + }, + { + -1.0, 0.0, 0.0 + }, + { + -1.0, 0.0, -1.0 + }, + }, + { + { + -1.0, 1.0, 0.0 + }, + { + -1.0, 1.0, 1.0 + }, + { + -1.0, 0.0, 1.0 + }, + { + -1.0, 0.0, 0.0 + }, + }, + { + { + -1.0, 0.0, 1.0 + }, + { + -1.0, -1.0, 1.0 + }, + { + -1.0, -1.0, 0.0 + }, + { + -1.0, 0.0, 0.0 + }, + }, + { + { + -1.0, -1.0, 0.0 + }, + { + -1.0, -1.0, -1.0 + }, + { + -1.0, 0.0, -1.0 + }, + { + -1.0, 0.0, 0.0 + }, + }, + }, + { + { + { + -1.0, 1.0, 1.0 + }, + { + -1.0, 1.0, 0.0 + }, + { + 0.0, 1.0, 0.0 + }, + { + 0.0, 1.0, 1.0 + }, + }, + { + { + -1.0, 1.0, 0.0 + }, + { + -1.0, 1.0, -1.0 + }, + { + 0.0, 1.0, -1.0 + }, + { + 0.0, 1.0, 0.0 + }, + }, + { + { + 0.0, 1.0, -1.0 + }, + { + 1.0, 1.0, -1.0 + }, + { + 1.0, 1.0, 0.0 + }, + { + 0.0, 1.0, 0.0 + }, + }, + { + { + 1.0, 1.0, 0.0 + }, + { + 1.0, 1.0, 1.0 + }, + { + 0.0, 1.0, 1.0 + }, + { + 0.0, 1.0, 0.0 + }, + }, + }, + { + { + { + -1.0, -1.0, -1.0 + }, + { + -1.0, -1.0, 0.0 + }, + { + 0.0, -1.0, 0.0 + }, + { + 0.0, -1.0, -1.0 + }, + }, + { + { + -1.0, -1.0, 0.0 + }, + { + -1.0, -1.0, 1.0 + }, + { + 0.0, -1.0, 1.0 + }, + { + 0.0, -1.0, 0.0 + }, + }, + { + { + 0.0, -1.0, 1.0 + }, + { + 1.0, -1.0, 1.0 + }, + { + 1.0, -1.0, 0.0 + }, + { + 0.0, -1.0, 0.0 + }, + }, + { + { + 1.0, -1.0, 0.0 + }, + { + 1.0, -1.0, -1.0 + }, + { + 0.0, -1.0, -1.0 + }, + { + 0.0, -1.0, 0.0 + }, + }, + } +}; + +float n[6][3] = { + { + 0.0, 0.0, -1.0 + }, + { + 1.0, 0.0, 0.0 + }, + { + 0.0, 0.0, 1.0 + }, + { + -1.0, 0.0, 0.0 + }, + { + 0.0, 1.0, 0.0 + }, + { + 0.0, -1.0, 0.0 + } +}; + +GLfloat identity[16] = { + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, +}; + + +void BuildCylinder(int numEdges) +{ + int i, top = 1.0, bottom = -1.0; + float x[100], y[100], angle; + + for (i = 0; i <= numEdges; i++) { + angle = i * 2.0 * PI / numEdges; + x[i] = cos(angle); /* was cosf() */ + y[i] = sin(angle); /* was sinf() */ + } + + glNewList(cylinder, GL_COMPILE); + glBegin(GL_TRIANGLE_STRIP); + for (i = 0; i <= numEdges; i++) { + glNormal3f(x[i], y[i], 0.0); + glVertex3f(x[i], y[i], bottom); + glVertex3f(x[i], y[i], top); + } + glEnd(); + glBegin(GL_TRIANGLE_FAN); + glNormal3f(0.0, 0.0, 1.0); + glVertex3f(0.0, 0.0, top); + for (i = 0; i <= numEdges; i++) { + glVertex3f(x[i], -y[i], top); + } + glEnd(); + glBegin(GL_TRIANGLE_FAN); + glNormal3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, bottom); + for (i = 0; i <= numEdges; i++) { + glVertex3f(x[i], y[i], bottom); + } + glEnd(); + glEndList(); +} + +void BuildTorus(float rc, int numc, float rt, int numt) +{ + int i, j, k; + double s, t; + double x, y, z; + double pi, twopi; + + pi = 3.14159265358979323846; + twopi = 2.0 * pi; + + glNewList(torus, GL_COMPILE); + for (i = 0; i < numc; i++) { + glBegin(GL_QUAD_STRIP); + for (j = 0; j <= numt; j++) { + for (k = 0; k <= 1; k++) { + s = (i + k) % numc + 0.5; + t = j % numt; + + x = cos(t*twopi/numt) * cos(s*twopi/numc); + y = sin(t*twopi/numt) * cos(s*twopi/numc); + z = sin(s*twopi/numc); + glNormal3f(x, y, z); + + x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt); + y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt); + z = rc * sin(s*twopi/numc); + glVertex3f(x, y, z); + } + } + glEnd(); + } + glEndList(); +} + +void BuildCage(void) +{ + int i; + float inc; + float right, left, top, bottom, front, back; + + front = 0.0; + back = -8.0; + + left = -4.0; + bottom = -4.0; + right = 4.0; + top = 4.0; + + inc = 2.0 * 4.0 * 0.1; + + glNewList(cage, GL_COMPILE); + for (i = 0; i < 10; i++) { + + /* + ** Back + */ + glBegin(GL_LINES); + glVertex3f(left+i*inc, top, back); + glVertex3f(left+i*inc, bottom, back); + glEnd(); + glBegin(GL_LINES); + glVertex3f(right, bottom+i*inc, back); + glVertex3f(left, bottom+i*inc, back); + glEnd(); + + /* + ** Front + */ + glBegin(GL_LINES); + glVertex3f(left+i*inc, top, front); + glVertex3f(left+i*inc, bottom, front); + glEnd(); + glBegin(GL_LINES); + glVertex3f(right, bottom+i*inc, front); + glVertex3f(left, bottom+i*inc, front); + glEnd(); + + /* + ** Left + */ + glBegin(GL_LINES); + glVertex3f(left, bottom+i*inc, front); + glVertex3f(left, bottom+i*inc, back); + glEnd(); + glBegin(GL_LINES); + glVertex3f(left, top, back+i*inc); + glVertex3f(left, bottom, back+i*inc); + glEnd(); + + /* + ** Right + */ + glBegin(GL_LINES); + glVertex3f(right, top-i*inc, front); + glVertex3f(right, top-i*inc, back); + glEnd(); + glBegin(GL_LINES); + glVertex3f(right, top, back+i*inc); + glVertex3f(right, bottom, back+i*inc); + glEnd(); + + /* + ** Top + */ + glBegin(GL_LINES); + glVertex3f(left+i*inc, top, front); + glVertex3f(left+i*inc, top, back); + glEnd(); + glBegin(GL_LINES); + glVertex3f(right, top, back+i*inc); + glVertex3f(left, top, back+i*inc); + glEnd(); + + /* + ** Bottom + */ + glBegin(GL_LINES); + glVertex3f(right-i*inc, bottom, front); + glVertex3f(right-i*inc, bottom, back); + glEnd(); + glBegin(GL_LINES); + glVertex3f(right, bottom, back+i*inc); + glVertex3f(left, bottom, back+i*inc); + glEnd(); + } + glEndList(); +} + +void BuildCube(void) +{ + int i, j; + + glNewList(cube, GL_COMPILE); + for (i = 0; i < 6; i++) { + for (j = 0; j < 4; j++) { + glNormal3fv(n[i]); + glBegin(GL_POLYGON); + glVertex3fv(c[i][j][0]); + glVertex3fv(c[i][j][1]); + glVertex3fv(c[i][j][2]); + glVertex3fv(c[i][j][3]); + glEnd(); + } + } + glEndList(); +} + +void BuildLists(void) +{ + + cube = glGenLists(1); + BuildCube(); + + cage = glGenLists(2); + BuildCage(); + + cylinder = glGenLists(3); + BuildCylinder(60); + + torus = glGenLists(4); + BuildTorus(0.65, 20, .85, 65); + + genericObject = torus; +} + +void SetDeepestColor(void) +{ + GLint redBits, greenBits, blueBits; + + glGetIntegerv(GL_RED_BITS, &redBits); + glGetIntegerv(GL_GREEN_BITS, &greenBits); + glGetIntegerv(GL_BLUE_BITS, &blueBits); + + deepestColor = (redBits >= greenBits) ? COLOR_RED : COLOR_GREEN; + deepestColor = (deepestColor >= blueBits) ? deepestColor : COLOR_BLUE; +} + +void SetDefaultSettings(void) +{ + + magFilter = nnearest; + minFilter = nnearest; + sWrapMode = repeat; + tWrapMode = repeat; + textureEnvironment = modulate; + autoRotate = TRUE; +} + +unsigned char *AlphaPadImage(int bufSize, unsigned char *inData, int alpha) +{ + unsigned char *outData, *out_ptr, *in_ptr; + int i; + + outData = (unsigned char *) malloc(bufSize * 4); + out_ptr = outData; + in_ptr = inData; + + for (i = 0; i < bufSize; i++) { + *out_ptr++ = *in_ptr++; + *out_ptr++ = *in_ptr++; + *out_ptr++ = *in_ptr++; + *out_ptr++ = alpha; + } + + free (inData); + return outData; +} + +void Init(void) +{ + float ambient[] = {0.0, 0.0, 0.0, 1.0}; + float diffuse[] = {0.0, 1.0, 0.0, 1.0}; + float specular[] = {1.0, 1.0, 1.0, 1.0}; + float position[] = {2.0, 2.0, 0.0, 1.0}; + float fog_color[] = {0.0, 0.0, 0.0, 1.0}; + float mat_ambient[] = {0.0, 0.0, 0.0, 1.0}; + float mat_shininess[] = {90.0}; + float mat_specular[] = {1.0, 1.0, 1.0, 1.0}; + float mat_diffuse[] = {1.0, 1.0, 1.0, 1.0}; + float lmodel_ambient[] = {0.0, 0.0, 0.0, 1.0}; + float lmodel_twoside[] = {GL_TRUE}; + + SetDeepestColor(); + SetDefaultSettings(); + + if (numComponents == 4) { + image = LoadPPM(imageFileName); + image->data = AlphaPadImage(image->sizeX*image->sizeY, + image->data, 128); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + gluBuild2DMipmaps(GL_TEXTURE_2D, numComponents, + image->sizeX, image->sizeY, + GL_RGBA, GL_UNSIGNED_BYTE, image->data); + } else { + image = LoadPPM(imageFileName); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + gluBuild2DMipmaps(GL_TEXTURE_2D, numComponents, + image->sizeX, image->sizeY, + GL_RGB, GL_UNSIGNED_BYTE, image->data); + } + + glFogf(GL_FOG_DENSITY, 0.125); + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogf(GL_FOG_START, 4.0); + glFogf(GL_FOG_END, 9.0); + glFogfv(GL_FOG_COLOR, fog_color); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_SPECULAR, specular); + glLightfv(GL_LIGHT0, GL_POSITION, position); + + glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient); + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + glShadeModel(GL_SMOOTH); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glClearColor(0.0, 0.0, 0.0, 0.0); + glViewport(0, 0, W, H); + glEnable(GL_DEPTH_TEST); + + glFrontFace(GL_CW); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + + glEnable(GL_TEXTURE_2D); + glTexGeniv(GL_S, GL_TEXTURE_GEN_MODE, sphereMap); + glTexGeniv(GL_T, GL_TEXTURE_GEN_MODE, sphereMap); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, sWrapMode); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, tWrapMode); + + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, textureEnvironment); + + BuildLists(); +} + +void ReInit(void) +{ + + if (genericObject == torus) { + glEnable(GL_DEPTH_TEST); + } else { + glDisable(GL_DEPTH_TEST); + } + if (isFogged) { + textureEnvironment = modulate; + } + + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, textureEnvironment); +} + +void Draw(void) +{ + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-0.2, 0.2, -0.2, 0.2, 0.15, 9.0); + glMatrixMode(GL_MODELVIEW); + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + if (isFogged) { + glEnable(GL_FOG); + glColor3fv(RGBMap[deepestColor]); + } else { + glColor3fv(RGBMap[COLOR_WHITE]); + } + glDisable(GL_LIGHTING); + glDisable(GL_LIGHT0); + glDisable(GL_TEXTURE_2D); + glCallList(cage); + + glPushMatrix(); + glTranslatef(0.0, 0.0, zTranslate); + glRotatef(xRotation, 1, 0, 0); + glRotatef(yRotation, 0, 1, 0); + + if (isLit == TRUE) { + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + } + + glEnable(GL_TEXTURE_2D); + if (isFogged) { + glDisable(GL_FOG); + } + glPolygonMode(GL_FRONT, GL_FILL); + glColor3fv(RGBMap[deepestColor]); + glCallList(genericObject); + + glPopMatrix(); + glFlush(); + + if (autoRotate) { + xRotation += .75; + yRotation += .375; + } + glutSwapBuffers(); +} + +void Reshape(int width, int height) +{ + + W = width; + H = height; + ReInit(); + glViewport( 0, 0, width, height ); /*new*/ +} + +void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + yRotation -= 0.5; + autoRotate = FALSE; + ReInit(); + break; + case GLUT_KEY_RIGHT: + yRotation += 0.5; + autoRotate = FALSE; + ReInit(); + break; + case GLUT_KEY_UP: + xRotation -= 0.5; + autoRotate = FALSE; + ReInit(); + break; + case GLUT_KEY_DOWN: + xRotation += 0.5; + autoRotate = FALSE; + ReInit(); + break; + default: + return; + } +} + +void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + free(image->data); + exit(1); + + case 'a': + autoRotate = !autoRotate; + ReInit(); + break; + case 'c': + genericObject = (genericObject == cube) ? cylinder : cube; + ReInit(); + break; + case 'd': + textureEnvironment = decal; + ReInit(); + break; + case 'm': + textureEnvironment = modulate; + ReInit(); + break; + case 'l': + isLit = !isLit; + ReInit(); + break; + case 'f': + isFogged = !isFogged; + ReInit(); + break; + case 't': + genericObject = torus; + ReInit(); + break; + case '0': + magFilter = nnearest; + ReInit(); + break; + case '1': + magFilter = linear; + ReInit(); + break; + case '2': + minFilter = nnearest; + ReInit(); + break; + case '3': + minFilter = linear; + ReInit(); + break; + case '4': + minFilter = nearest_mipmap_nearest; + ReInit(); + break; + case '5': + minFilter = nearest_mipmap_linear; + ReInit(); + break; + case '6': + minFilter = linear_mipmap_nearest; + ReInit(); + break; + case '7': + minFilter = linear_mipmap_linear; + ReInit(); + break; + default: + return; + } +} + +GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_TRUE; + numComponents = 4; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-f") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-f (No file name).\n"); + return GL_FALSE; + } else { + imageFileName = argv[++i]; + } + } else if (strcmp(argv[i], "-4") == 0) { + numComponents = 4; + } else if (strcmp(argv[i], "-3") == 0) { + numComponents = 3; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +void GLUTCALLBACK glut_post_redisplay_p(void) +{ + glutPostRedisplay(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + if (imageFileName == 0) { + printf("No image file.\n"); + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( W, H); + + type = GLUT_RGB | GLUT_DEPTH; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Texture Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutIdleFunc(glut_post_redisplay_p); + + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/star.c b/xc/extras/Mesa/samples/star.c new file mode 100644 index 000000000..62d7d8548 --- /dev/null +++ b/xc/extras/Mesa/samples/star.c @@ -0,0 +1,331 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + + +#ifndef PI +#define PI 3.141592657 +#endif + +enum { + NORMAL = 0, + WEIRD = 1 +}; + +enum { + STREAK = 0, + CIRCLE = 1 +}; + +#define MAXSTARS 400 +#define MAXPOS 10000 +#define MAXWARP 10 +#define MAXANGLES 6000 + + +typedef struct _starRec { + GLint type; + float x[2], y[2], z[2]; + float offsetX, offsetY, offsetR, rotation; +} starRec; + + +GLenum doubleBuffer; +GLint windW, windH; + +GLenum flag = NORMAL; +GLint starCount = MAXSTARS / 2; +float speed = 1.0; +GLint nitro = 0; +starRec stars[MAXSTARS]; +float sinTable[MAXANGLES]; + + +float Sin(float angle) +{ + + return (sinTable[(GLint)angle]); +} + +float Cos(float angle) +{ + + return (sinTable[((GLint)angle+(MAXANGLES/4))%MAXANGLES]); +} + +void NewStar(GLint n, GLint d) +{ + + if (rand()%4 == 0) { + stars[n].type = CIRCLE; + } else { + stars[n].type = STREAK; + } + stars[n].x[0] = (float)(rand() % MAXPOS - MAXPOS / 2); + stars[n].y[0] = (float)(rand() % MAXPOS - MAXPOS / 2); + stars[n].z[0] = (float)(rand() % MAXPOS + d); + if (rand()%4 == 0 && flag == WEIRD) { + stars[n].offsetX = (float)(rand() % 100 - 100 / 2); + stars[n].offsetY = (float)(rand() % 100 - 100 / 2); + stars[n].offsetR = (float)(rand() % 25 - 25 / 2); + } else { + stars[n].offsetX = 0.0; + stars[n].offsetY = 0.0; + stars[n].offsetR = 0.0; + } +} + +void RotatePoint(float *x, float *y, float rotation) +{ + float tmpX, tmpY; + + tmpX = *x * Cos(rotation) - *y * Sin(rotation); + tmpY = *y * Cos(rotation) + *x * Sin(rotation); + *x = tmpX; + *y = tmpY; +} + +void MoveStars(void) +{ + float offset; + GLint n; + + offset = speed * 60.0; + + for (n = 0; n < starCount; n++) { + stars[n].x[1] = stars[n].x[0]; + stars[n].y[1] = stars[n].y[0]; + stars[n].z[1] = stars[n].z[0]; + stars[n].x[0] += stars[n].offsetX; + stars[n].y[0] += stars[n].offsetY; + stars[n].z[0] -= offset; + stars[n].rotation += stars[n].offsetR; + if (stars[n].rotation > MAXANGLES) { + stars[n].rotation = 0.0; + } + } +} + +GLenum StarPoint(GLint n) +{ + float x0, y0, x1, y1, width; + GLint i; + + x0 = stars[n].x[0] * windW / stars[n].z[0]; + y0 = stars[n].y[0] * windH / stars[n].z[0]; + RotatePoint(&x0, &y0, stars[n].rotation); + x0 += windW / 2.0; + y0 += windH / 2.0; + + if (x0 >= 0.0 && x0 < windW && y0 >= 0.0 && y0 < windH) { + if (stars[n].type == STREAK) { + x1 = stars[n].x[1] * windW / stars[n].z[1]; + y1 = stars[n].y[1] * windH / stars[n].z[1]; + RotatePoint(&x1, &y1, stars[n].rotation); + x1 += windW / 2.0; + y1 += windH / 2.0; + + glLineWidth(MAXPOS/100.0/stars[n].z[0]+1.0); + glColor3f(1.0, (MAXWARP-speed)/MAXWARP, (MAXWARP-speed)/MAXWARP); + if (fabs(x0-x1) < 1.0 && fabs(y0-y1) < 1.0) { + glBegin(GL_POINTS); + glVertex2f(x0, y0); + glEnd(); + } else { + glBegin(GL_LINES); + glVertex2f(x0, y0); + glVertex2f(x1, y1); + glEnd(); + } + } else { + width = MAXPOS / 10.0 / stars[n].z[0] + 1.0; + glColor3f(1.0, 0.0, 0.0); + glBegin(GL_POLYGON); + for (i = 0; i < 8; i++) { + float x = x0 + width * Cos((float)i*MAXANGLES/8.0); + float y = y0 + width * Sin((float)i*MAXANGLES/8.0); + glVertex2f(x, y); + }; + glEnd(); + } + return GL_TRUE; + } else { + return GL_FALSE; + } +} + +void ShowStars(void) +{ + GLint n; + + glClear(GL_COLOR_BUFFER_BIT); + + for (n = 0; n < starCount; n++) { + if (stars[n].z[0] > speed || (stars[n].z[0] > 0.0 && speed < MAXWARP)) { + if (StarPoint(n) == GL_FALSE) { + NewStar(n, MAXPOS); + } + } else { + NewStar(n, MAXPOS); + } + } +} + +static void Init(void) +{ + float angle; + GLint n; + + srand((unsigned int) glutGet(GLUT_ELAPSED_TIME) ); + + for (n = 0; n < MAXSTARS; n++) { + NewStar(n, 100); + } + + angle = 0.0; + for (n = 0; n < MAXANGLES ; n++) { + sinTable[n] = sin(angle); + angle += PI / (MAXANGLES / 2.0); + } + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glDisable(GL_DITHER); +} + +void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; + + glViewport(0, 0, windW, windH); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-0.5, windW+0.5, -0.5, windH+0.5); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 32: + flag = (flag == NORMAL) ? WEIRD : NORMAL; + break; + case 't': + nitro = 1; + break; + default: + return; + } +} + +void Draw(void) +{ + + MoveStars(); + ShowStars(); + if (nitro > 0) { + speed = (float)(nitro / 10) + 1.0; + if (speed > MAXWARP) { + speed = MAXWARP; + } + if (++nitro > MAXWARP*10) { + nitro = -nitro; + } + } else if (nitro < 0) { + nitro++; + speed = (float)(-nitro / 10) + 1.0; + if (speed > MAXWARP) { + speed = MAXWARP; + } + } + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_TRUE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } + } + return GL_TRUE; +} + +void GLUTCALLBACK glut_post_redisplay_p(void) +{ + glutPostRedisplay(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + windW = 300; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Stars") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutIdleFunc(glut_post_redisplay_p); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/stencil.c b/xc/extras/Mesa/samples/stencil.c new file mode 100644 index 000000000..e00bbb61b --- /dev/null +++ b/xc/extras/Mesa/samples/stencil.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <GL/glut.h> + + +static void Init(void) +{ + glShadeModel(GL_FLAT); + glClearColor(0.0, 0.0, 0.0, 0.0); + + glClearStencil(0); + glStencilMask(1); + glEnable(GL_STENCIL_TEST); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + } +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); + + glStencilFunc(GL_ALWAYS, 1, 1); + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + + glColor3ub(200, 0, 0); + glBegin(GL_POLYGON); + glVertex3i(-4, -4, 0); + glVertex3i( 4, -4, 0); + glVertex3i( 0, 4, 0); + glEnd(); + + glStencilFunc(GL_EQUAL, 1, 1); + glStencilOp(GL_INCR, GL_KEEP, GL_DECR); + + glColor3ub(0, 200, 0); + glBegin(GL_POLYGON); + glVertex3i(3, 3, 0); + glVertex3i(-3, 3, 0); + glVertex3i(-3, -3, 0); + glVertex3i(3, -3, 0); + glEnd(); + + glStencilFunc(GL_EQUAL, 1, 1); + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + + glColor3ub(0, 0, 200); + glBegin(GL_POLYGON); + glVertex3i(3, 3, 0); + glVertex3i(-3, 3, 0); + glVertex3i(-3, -3, 0); + glVertex3i(3, -3, 0); + glEnd(); + + glFlush(); +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-dr") == 0) { + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_RGB | GLUT_SINGLE | GLUT_STENCIL; + glutInitDisplayMode(type); + + if (glutCreateWindow("Stencil Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/stretch.c b/xc/extras/Mesa/samples/stretch.c new file mode 100644 index 000000000..9efa8e187 --- /dev/null +++ b/xc/extras/Mesa/samples/stretch.c @@ -0,0 +1,375 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <GL/glut.h> + + +#define STEPCOUNT 40 +#define FALSE 0 +#define TRUE 1 +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + + +enum { + OP_NOOP = 0, + OP_STRETCH, + OP_DRAWPOINT, + OP_DRAWIMAGE +}; + + +typedef struct _cRec { + float x, y; +} cRec; + +typedef struct _vertexRec { + float x, y; + float dX, dY; + float tX, tY; +} vertexRec; + + +#include "loadppm.c" + +GLenum doubleBuffer; +int imageSizeX, imageSizeY; +char *fileName = 0; +PPMImage *image; +cRec cList[50]; +vertexRec vList[5]; +int cCount, cIndex[2], cStep; +GLenum op = OP_NOOP; + + +void DrawImage(void) +{ + + glRasterPos2i(0, 0); + glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, + image->data); + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } + + glRasterPos2i(0, 0); + glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, + image->data); +} + +void DrawPoint(void) +{ + int i; + + glColor3f(1.0, 0.0, 1.0); + glPointSize(3.0); + glBegin(GL_POINTS); + for (i = 0; i < cCount; i++) { + glVertex2f(cList[i].x, cList[i].y); + } + glEnd(); + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +void InitVList(void) +{ + + vList[0].x = 0.0; + vList[0].y = 0.0; + vList[0].dX = 0.0; + vList[0].dY = 0.0; + vList[0].tX = 0.0; + vList[0].tY = 0.0; + + vList[1].x = (float)imageSizeX; + vList[1].y = 0.0; + vList[1].dX = 0.0; + vList[1].dY = 0.0; + vList[1].tX = 1.0; + vList[1].tY = 0.0; + + vList[2].x = (float)imageSizeX; + vList[2].y = (float)imageSizeY; + vList[2].dX = 0.0; + vList[2].dY = 0.0; + vList[2].tX = 1.0; + vList[2].tY = 1.0; + + vList[3].x = 0.0; + vList[3].y = (float)imageSizeY; + vList[3].dX = 0.0; + vList[3].dY = 0.0; + vList[3].tX = 0.0; + vList[3].tY = 1.0; + + vList[4].x = cList[0].x; + vList[4].y = cList[0].y; + vList[4].dX = (cList[1].x - cList[0].x) / STEPCOUNT; + vList[4].dY = (cList[1].y - cList[0].y) / STEPCOUNT; + vList[4].tX = cList[0].x / (float)imageSizeX; + vList[4].tY = cList[0].y / (float)imageSizeY; +} + +void ScaleImage(int sizeX, int sizeY) +{ + GLubyte *buf; + + buf = (GLubyte *)malloc(3*sizeX*sizeY); + gluScaleImage(GL_RGB, image->sizeX, image->sizeY, GL_UNSIGNED_BYTE, + image->data, sizeX, sizeY, GL_UNSIGNED_BYTE, buf); + free(image->data); + image->data = buf; + image->sizeX = sizeX; + image->sizeY = sizeY; +} + +void SetPoint(int x, int y) +{ + + cList[cCount].x = (float)x; + cList[cCount].y = (float)y; + cCount++; +} + +void Stretch(void) +{ + + glBegin(GL_TRIANGLES); + glTexCoord2f(vList[0].tX, vList[0].tY); + glVertex2f(vList[0].x, vList[0].y); + glTexCoord2f(vList[1].tX, vList[1].tY); + glVertex2f(vList[1].x, vList[1].y); + glTexCoord2f(vList[4].tX, vList[4].tY); + glVertex2f(vList[4].x, vList[4].y); + glEnd(); + + glBegin(GL_TRIANGLES); + glTexCoord2f(vList[1].tX, vList[1].tY); + glVertex2f(vList[1].x, vList[1].y); + glTexCoord2f(vList[2].tX, vList[2].tY); + glVertex2f(vList[2].x, vList[2].y); + glTexCoord2f(vList[4].tX, vList[4].tY); + glVertex2f(vList[4].x, vList[4].y); + glEnd(); + + glBegin(GL_TRIANGLES); + glTexCoord2f(vList[2].tX, vList[2].tY); + glVertex2f(vList[2].x, vList[2].y); + glTexCoord2f(vList[3].tX, vList[3].tY); + glVertex2f(vList[3].x, vList[3].y); + glTexCoord2f(vList[4].tX, vList[4].tY); + glVertex2f(vList[4].x, vList[4].y); + glEnd(); + + glBegin(GL_TRIANGLES); + glTexCoord2f(vList[3].tX, vList[3].tY); + glVertex2f(vList[3].x, vList[3].y); + glTexCoord2f(vList[0].tX, vList[0].tY); + glVertex2f(vList[0].x, vList[0].y); + glTexCoord2f(vList[4].tX, vList[4].tY); + glVertex2f(vList[4].x, vList[4].y); + glEnd(); + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } + + if (++cStep < STEPCOUNT) { + vList[4].x += vList[4].dX; + vList[4].y += vList[4].dY; + } else { + cIndex[0] = cIndex[1]; + cIndex[1] = cIndex[1] + 1; + if (cIndex[1] == cCount) { + cIndex[1] = 0; + } + vList[4].dX = (cList[cIndex[1]].x - cList[cIndex[0]].x) / STEPCOUNT; + vList[4].dY = (cList[cIndex[1]].y - cList[cIndex[0]].y) / STEPCOUNT; + cStep = 0; + } +} + +void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + free(image->data); + exit(1); + case 32: + if (cCount > 1) { + InitVList(); + cIndex[0] = 0; + cIndex[1] = 1; + cStep = 0; + glEnable(GL_TEXTURE_2D); + op = OP_STRETCH; + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +void Mouse(int button, int state, int mouseX, int mouseY) +{ + + if (state != GLUT_DOWN) + return; + + if (op == OP_STRETCH) { + glDisable(GL_TEXTURE_2D); + cCount = 0; + op = OP_DRAWIMAGE; + } else { + SetPoint(mouseX, imageSizeY-mouseY); + op = OP_DRAWPOINT; + } + + glutPostRedisplay(); +} + +void Animate(void) +{ + + switch (op) { + case OP_STRETCH: + Stretch(); + break; + case OP_DRAWPOINT: + DrawPoint(); + break; + case OP_DRAWIMAGE: + DrawImage(); + break; + default: + break; + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_TRUE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-f") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-f (No file name).\n"); + return GL_FALSE; + } else { + fileName = argv[++i]; + } + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +void GLUTCALLBACK glut_post_redisplay_p(void) +{ + glutPostRedisplay(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + if (fileName == 0) { + printf("No image file.\n"); + exit(1); + } + + image = LoadPPM(fileName); + + /* changed powf and logf to pow and log -Brian */ + imageSizeX = (int)pow(2.0, (float)((int)(log(image->sizeX)/log(2.0)))); + imageSizeY = (int)pow(2.0, (float)((int)(log(image->sizeY)/log(2.0)))); + + glutInitWindowPosition(0, 0); glutInitWindowSize( imageSizeX, imageSizeY); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Stretch") == GL_FALSE) { + exit(1); + } + + glViewport(0, 0, imageSizeX, imageSizeY); + gluOrtho2D(0, imageSizeX, 0, imageSizeY); + glClearColor(0.0, 0.0, 0.0, 0.0); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + ScaleImage(imageSizeX, imageSizeY); + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, 3, image->sizeX, image->sizeY, 0, + GL_RGB, GL_UNSIGNED_BYTE, (unsigned char *)image->data); + + cCount = 0; + cIndex[0] = 0; + cIndex[1] = 0; + cStep = 0; + op = OP_DRAWIMAGE; + + glutKeyboardFunc(Key); + glutMouseFunc(Mouse); + glutDisplayFunc(Animate); + glutIdleFunc(glut_post_redisplay_p); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/texture.c b/xc/extras/Mesa/samples/texture.c new file mode 100644 index 000000000..7ee41eef2 --- /dev/null +++ b/xc/extras/Mesa/samples/texture.c @@ -0,0 +1,474 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#include "loadppm.c" + +GLenum doubleBuffer; + +char *texFileName = 0; +PPMImage *image; + +float *minFilter, *magFilter, *sWrapMode, *tWrapMode; +float decal[] = {GL_DECAL}; +float modulate[] = {GL_MODULATE}; +float repeat[] = {GL_REPEAT}; +float clamp[] = {GL_CLAMP}; +float nr[] = {GL_NEAREST}; +float ln[] = {GL_LINEAR}; +float nr_mipmap_nr[] = {GL_NEAREST_MIPMAP_NEAREST}; +float nr_mipmap_ln[] = {GL_NEAREST_MIPMAP_LINEAR}; +float ln_mipmap_nr[] = {GL_LINEAR_MIPMAP_NEAREST}; +float ln_mipmap_ln[] = {GL_LINEAR_MIPMAP_LINEAR}; +GLint sphereMap[] = {GL_SPHERE_MAP}; + +GLenum doSphere = GL_FALSE; +float xRotation = 0.0, yRotation = 0.0, zTranslate = -3.125; + +GLint cube; +float c[6][4][3] = { + { + { + 1.0, 1.0, -1.0 + }, + { + -1.0, 1.0, -1.0 + }, + { + -1.0, -1.0, -1.0 + }, + { + 1.0, -1.0, -1.0 + } + }, + { + { + 1.0, 1.0, 1.0 + }, + { + 1.0, 1.0, -1.0 + }, + { + 1.0, -1.0, -1.0 + }, + { + 1.0, -1.0, 1.0 + } + }, + { + { + -1.0, 1.0, 1.0 + }, + { + 1.0, 1.0, 1.0 + }, + { + 1.0, -1.0, 1.0 + }, + { + -1.0, -1.0, 1.0 + } + }, + { + { + -1.0, 1.0, -1.0 + }, + { + -1.0, 1.0, 1.0 + }, + { + -1.0, -1.0, 1.0 + }, + { + -1.0, -1.0, -1.0 + } + }, + { + { + -1.0, 1.0, 1.0 + }, + { + -1.0, 1.0, -1.0 + }, + { + 1.0, 1.0, -1.0 + }, + { + 1.0, 1.0, 1.0 + } + }, + { + { + -1.0, -1.0, -1.0 + }, + { + -1.0, -1.0, 1.0 + }, + { + 1.0, -1.0, 1.0 + }, + { + 1.0, -1.0, -1.0 + } + } +}; +static float n[6][3] = { + { + 0.0, 0.0, -1.0 + }, + { + 1.0, 0.0, 0.0 + }, + { + 0.0, 0.0, 1.0 + }, + { + -1.0, 0.0, 0.0 + }, + { + 0.0, 1.0, 0.0 + }, + { + 0.0, -1.0, 0.0 + } +}; +static float t[6][4][2] = { + { + { + 1.1, 1.1 + }, + { + -0.1, 1.1 + }, + { + -0.1, -0.1 + }, + { + 1.1, -0.1 + } + }, + { + { + 1.1, 1.1 + }, + { + -0.1, 1.1 + }, + { + -0.1, -0.1 + }, + { + 1.1, -0.1 + } + }, + { + { + -0.1, 1.1 + }, + { + 1.1, 1.1 + }, + { + 1.1, -0.1 + }, + { + -0.1, -0.1 + } + }, + { + { + 1.1, 1.1 + }, + { + -0.1, 1.1 + }, + { + -0.1, -0.1 + }, + { + 1.1, -0.1 + } + }, + { + { + 1.1, 1.1 + }, + { + -0.1, 1.1 + }, + { + -0.1, -0.1 + }, + { + 1.1, -0.1 + } + }, + { + { + 1.1, 1.1 + }, + { + -0.1, 1.1 + }, + { + -0.1, -0.1 + }, + { + 1.1, -0.1 + } + }, +}; + +static void BuildCube(void) +{ + GLint i; + + glNewList(cube, GL_COMPILE); + for (i = 0; i < 6; i++) { + glBegin(GL_POLYGON); + glNormal3fv(n[i]); glTexCoord2fv(t[i][0]); glVertex3fv(c[i][0]); + glNormal3fv(n[i]); glTexCoord2fv(t[i][1]); glVertex3fv(c[i][1]); + glNormal3fv(n[i]); glTexCoord2fv(t[i][2]); glVertex3fv(c[i][2]); + glNormal3fv(n[i]); glTexCoord2fv(t[i][3]); glVertex3fv(c[i][3]); + glEnd(); + } + glEndList(); +} + +static void BuildLists(void) +{ + + cube = glGenLists(1); + BuildCube(); +} + +static void Init(void) +{ + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, + GL_RGB, GL_UNSIGNED_BYTE, image->data); + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); + glEnable(GL_TEXTURE_2D); + + glFrontFace(GL_CCW); + glCullFace(GL_FRONT); + glEnable(GL_CULL_FACE); + + BuildLists(); + + glClearColor(0.0, 0.0, 0.0, 0.0); + + magFilter = nr; + minFilter = nr; + sWrapMode = repeat; + tWrapMode = repeat; +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(145.0, 1.0, 0.01, 1000); + glMatrixMode(GL_MODELVIEW); +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + yRotation -= 0.5; + break; + case GLUT_KEY_RIGHT: + yRotation += 0.5; + break; + case GLUT_KEY_UP: + xRotation -= 0.5; + break; + case GLUT_KEY_DOWN: + xRotation += 0.5; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + + case 'T': + zTranslate += 0.25; + break; + case 't': + zTranslate -= 0.25; + break; + + case 's': + doSphere = !doSphere; + if (doSphere) { + glTexGeniv(GL_S, GL_TEXTURE_GEN_MODE, sphereMap); + glTexGeniv(GL_T, GL_TEXTURE_GEN_MODE, sphereMap); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + } else { + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + } + break; + + case '0': + magFilter = nr; + break; + case '1': + magFilter = ln; + break; + case '2': + minFilter = nr; + break; + case '3': + minFilter = ln; + break; + case '4': + minFilter = nr_mipmap_nr; + break; + case '5': + minFilter = nr_mipmap_ln; + break; + case '6': + minFilter = ln_mipmap_nr; + break; + case '7': + minFilter = ln_mipmap_ln; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + + glClear(GL_COLOR_BUFFER_BIT); + + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, sWrapMode); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, tWrapMode); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); + + glPushMatrix(); + + glTranslatef(0.0, 0.0, zTranslate); + glRotatef(xRotation, 1, 0, 0); + glRotatef(yRotation, 0, 1, 0); + glCallList(cube); + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-f") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-f (No file name).\n"); + return GL_FALSE; + } else { + texFileName = argv[++i]; + } + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + if (texFileName == 0) { + printf("No image file.\n"); + exit(1); + } + + image = LoadPPM(texFileName); + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Texture Test") == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/tkmap.c b/xc/extras/Mesa/samples/tkmap.c new file mode 100644 index 000000000..3ded79cac --- /dev/null +++ b/xc/extras/Mesa/samples/tkmap.c @@ -0,0 +1,71 @@ + +enum { + COLOR_BLACK = 0, + COLOR_RED, + COLOR_GREEN, + COLOR_YELLOW, + COLOR_BLUE, + COLOR_MAGENTA, + COLOR_CYAN, + COLOR_WHITE +}; + +static float RGBMap[9][3] = { + {0, 0, 0}, + {1, 0, 0}, + {0, 1, 0}, + {1, 1, 0}, + {0, 0, 1}, + {1, 0, 1}, + {0, 1, 1}, + {1, 1, 1}, + {0.5, 0.5, 0.5} +}; + +static void SetColor(int c) +{ + if (glutGet(GLUT_WINDOW_RGBA)) + glColor3fv(RGBMap[c]); + else + glIndexf(c); +} + +static void InitMap(void) +{ + int i; + + if (rgb) + return; + + for (i = 0; i < 9; i++) + glutSetColor(i, RGBMap[i][0], RGBMap[i][1], RGBMap[i][2]); +} + +static void SetFogRamp(int density, int startIndex) +{ + int fogValues, colorValues; + int i, j, k; + float intensity; + + fogValues = 1 << density; + colorValues = 1 << startIndex; + for (i = 0; i < colorValues; i++) { + for (j = 0; j < fogValues; j++) { + k = i * fogValues + j; + intensity = (i * fogValues + j * colorValues) / 255.0; + glutSetColor(k, intensity, intensity, intensity); + } + } +} + +static void SetGreyRamp(void) +{ + int i; + float intensity; + + for (i = 0; i < 255; i++) { + intensity = i / 255.0; + glutSetColor(i, intensity, intensity, intensity); + } +} + diff --git a/xc/extras/Mesa/samples/tri.c b/xc/extras/Mesa/samples/tri.c new file mode 100644 index 000000000..700325132 --- /dev/null +++ b/xc/extras/Mesa/samples/tri.c @@ -0,0 +1,403 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +#define SOLID 1 +#define LINE 2 +#define POINT 3 + + +GLenum rgb, doubleBuffer, windType; +GLint windW, windH; + +GLenum dithering = GL_TRUE; +GLenum showVerticies = GL_TRUE; +GLenum hideBottomTriangle = GL_FALSE; +GLenum outline = GL_TRUE; +GLenum culling = GL_FALSE; +GLenum winding = GL_FALSE; +GLenum face = GL_FALSE; +GLenum state = SOLID; +GLenum aaMode = GL_FALSE; +GLenum shade = GL_TRUE; + +GLint color1, color2, color3; + +float zRotation = 90.0; +float zoom = 1.0; + +float boxA[3] = {-100, -100, 0}; +float boxB[3] = { 100, -100, 0}; +float boxC[3] = { 100, 100, 0}; +float boxD[3] = {-100, 100, 0}; + +float p0[3] = {-125,-80, 0}; +float p1[3] = {-125, 80, 0}; +float p2[3] = { 172, 0, 0}; + + +#include "tkmap.c" + +static void Init(void) +{ + float r, g, b; + float percent1, percent2; + GLint i, j; + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glLineStipple(1, 0xF0F0); + + glEnable(GL_SCISSOR_TEST); + + if (!rgb) { + for (j = 0; j <= 12; j++) { + if (j <= 6) { + percent1 = j / 6.0; + r = 1.0 - 0.8 * percent1; + g = 0.2 + 0.8 * percent1; + b = 0.2; + } else { + percent1 = (j - 6) / 6.0; + r = 0.2; + g = 1.0 - 0.8 * percent1; + b = 0.2 + 0.8 * percent1; + } + glutSetColor(j+18, r, g, b); + for (i = 0; i < 16; i++) { + percent2 = i / 15.0; + glutSetColor(j*16+1+32, r*percent2, g*percent2, b*percent2); + } + } + color1 = 18; + color2 = 24; + color3 = 30; + } +} + +static void Reshape(int width, int height) +{ + + windW = (GLint)width; + windH = (GLint)height; +} + +static void Key2(int key, int x, int y) +{ + + switch (key) { + case GLUT_KEY_LEFT: + zRotation += 0.5; + break; + case GLUT_KEY_RIGHT: + zRotation -= 0.5; + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 'Z': + zoom *= 0.75; + break; + case 'z': + zoom /= 0.75; + if (zoom > 10) { + zoom = 10; + } + break; + case '1': + glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); + break; + case '2': + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + break; + case '3': + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + break; + case '4': + state = POINT; + break; + case '5': + state = LINE; + break; + case '6': + state = SOLID; + break; + case '7': + culling = !culling; + break; + case '8': + winding = !winding; + break; + case '9': + face = !face; + break; + case 'v': + showVerticies = !showVerticies; + break; + case 's': + shade = !shade; + (shade) ? glShadeModel(GL_SMOOTH) : glShadeModel(GL_FLAT); + break; + case 'h': + hideBottomTriangle = !hideBottomTriangle; + break; + case 'o': + outline = !outline; + break; + case 'm': + dithering = !dithering; + break; + case '0': + aaMode = !aaMode; + if (aaMode) { + glEnable(GL_POLYGON_SMOOTH); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + if (!rgb) { + color1 = 32; + color2 = 128; + color3 = 224; + } + } else { + glDisable(GL_POLYGON_SMOOTH); + glDisable(GL_BLEND); + if (!rgb) { + color1 = 18; + color2 = 24; + color3 = 30; + } + } + break; + default: + return; + } + + glutPostRedisplay(); +} + +static void BeginPrim(void) +{ + + switch (state) { + case SOLID: + glBegin(GL_POLYGON); + break; + case LINE: + glBegin(GL_LINE_LOOP); + break; + case POINT: + glBegin(GL_POINTS); + break; + default: + break; + } +} + +static void EndPrim(void) +{ + + glEnd(); +} + +static void Draw(void) +{ + float scaleX, scaleY; + + glViewport(0, 0, windW, windH); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-175, 175, -175, 175); + glMatrixMode(GL_MODELVIEW); + + glScissor(0, 0, windW, windH); + + (culling) ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE); + (winding) ? glFrontFace(GL_CCW) : glFrontFace(GL_CW); + (face) ? glCullFace(GL_FRONT) : glCullFace(GL_BACK); + + (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER); + + glClear(GL_COLOR_BUFFER_BIT); + + SetColor(COLOR_GREEN); + glBegin(GL_LINE_LOOP); + glVertex3fv(boxA); + glVertex3fv(boxB); + glVertex3fv(boxC); + glVertex3fv(boxD); + glEnd(); + + if (!hideBottomTriangle) { + glPushMatrix(); + + glScalef(zoom, zoom, zoom); + glRotatef(zRotation, 0, 0, 1); + + SetColor(COLOR_BLUE); + BeginPrim(); + glVertex3fv(p0); + glVertex3fv(p1); + glVertex3fv(p2); + EndPrim(); + + if (showVerticies) { + (rgb) ? glColor3fv(RGBMap[COLOR_RED]) : glIndexf(color1); + glRectf(p0[0]-2, p0[1]-2, p0[0]+2, p0[1]+2); + (rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexf(color2); + glRectf(p1[0]-2, p1[1]-2, p1[0]+2, p1[1]+2); + (rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexf(color3); + glRectf(p2[0]-2, p2[1]-2, p2[0]+2, p2[1]+2); + } + + glPopMatrix(); + } + + scaleX = (float)(windW - 20) / 2 / 175 * (175 - 100) + 10; + scaleY = (float)(windH - 20) / 2 / 175 * (175 - 100) + 10; + + glViewport(scaleX, scaleY, windW-2*scaleX, windH-2*scaleY); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-100, 100, -100, 100); + glMatrixMode(GL_MODELVIEW); + + glScissor(scaleX, scaleY, windW-2*scaleX, windH-2*scaleY); + + glPushMatrix(); + + glScalef(zoom, zoom, zoom); + glRotatef(zRotation, 0,0,1); + + glPointSize(10); + glLineWidth(5); + glEnable(GL_POINT_SMOOTH); + glEnable(GL_LINE_STIPPLE); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + SetColor(COLOR_RED); + BeginPrim(); + (rgb) ? glColor3fv(RGBMap[COLOR_RED]) : glIndexf(color1); + glVertex3fv(p0); + (rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexf(color2); + glVertex3fv(p1); + (rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexf(color3); + glVertex3fv(p2); + EndPrim(); + + glPointSize(1); + glLineWidth(1); + glDisable(GL_POINT_SMOOTH); + glDisable(GL_LINE_STIPPLE); + glBlendFunc(GL_ONE, GL_ZERO); + + if (outline) { + SetColor(COLOR_WHITE); + glBegin(GL_LINE_LOOP); + glVertex3fv(p0); + glVertex3fv(p1); + glVertex3fv(p2); + glEnd(); + } + + glPopMatrix(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + windW = 600; + windH = 300; + glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH); + + windType = (rgb) ? GLUT_RGB : GLUT_INDEX; + windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(windType); + + if (glutCreateWindow("Triangle Test") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(Key2); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/samples/wave.c b/xc/extras/Mesa/samples/wave.c new file mode 100644 index 000000000..7ded49bed --- /dev/null +++ b/xc/extras/Mesa/samples/wave.c @@ -0,0 +1,602 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "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 BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <math.h> +#include <GL/glut.h> + +#ifndef PI +#define PI 3.14159265358979323846 +#endif + +#define GETCOORD(frame, x, y) (&(theMesh.coords[frame*theMesh.numCoords+(x)+(y)*(theMesh.widthX+1)])) +#define GETFACET(frame, x, y) (&(theMesh.facets[frame*theMesh.numFacets+(x)+(y)*theMesh.widthX])) + + +GLenum rgb, doubleBuffer; + +#include "tkmap.c" + +GLint colorIndexes1[3]; +GLint colorIndexes2[3]; +GLenum clearMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT; + +GLenum smooth = GL_FALSE; +GLenum lighting = GL_TRUE; +GLenum depth = GL_TRUE; +GLenum stepMode = GL_FALSE; +GLenum spinMode = GL_FALSE; +GLint contouring = 0; + +GLint widthX, widthY; +GLint checkerSize; +float height; + +GLint frames, curFrame = 0, nextFrame = 0; + +struct facet { + float color[3]; + float normal[3]; +}; +struct coord { + float vertex[3]; + float normal[3]; +}; +struct mesh { + GLint widthX, widthY; + GLint numFacets; + GLint numCoords; + GLint frames; + struct coord *coords; + struct facet *facets; +} theMesh; + +GLubyte contourTexture1[] = { + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 127, 127, 127, 127, +}; +GLubyte contourTexture2[] = { + 255, 255, 255, 255, + 255, 127, 127, 127, + 255, 127, 127, 127, + 255, 127, 127, 127, +}; + +void GLUTCALLBACK glut_post_redisplay_p(void) +{ + glutPostRedisplay(); +} + +static void Animate(void) +{ + struct coord *coord; + struct facet *facet; + float *lastColor; + float *thisColor; + GLint i, j; + + glClear(clearMask); + + if (nextFrame || !stepMode) { + curFrame++; + } + if (curFrame >= theMesh.frames) { + curFrame = 0; + } + + if ((nextFrame || !stepMode) && spinMode) { + glRotatef(5.0, 0.0, 0.0, 1.0); + } + nextFrame = 0; + + for (i = 0; i < theMesh.widthX; i++) { + glBegin(GL_QUAD_STRIP); + lastColor = NULL; + for (j = 0; j < theMesh.widthY; j++) { + facet = GETFACET(curFrame, i, j); + if (!smooth && lighting) { + glNormal3fv(facet->normal); + } + if (lighting) { + if (rgb) { + thisColor = facet->color; + glColor3fv(facet->color); + } else { + thisColor = facet->color; + glMaterialfv(GL_FRONT_AND_BACK, GL_COLOR_INDEXES, + facet->color); + } + } else { + if (rgb) { + thisColor = facet->color; + glColor3fv(facet->color); + } else { + thisColor = facet->color; + glIndexf(facet->color[1]); + } + } + + if (!lastColor || (thisColor[0] != lastColor[0] && smooth)) { + if (lastColor) { + glEnd(); + glBegin(GL_QUAD_STRIP); + } + coord = GETCOORD(curFrame, i, j); + if (smooth && lighting) { + glNormal3fv(coord->normal); + } + glVertex3fv(coord->vertex); + + coord = GETCOORD(curFrame, i+1, j); + if (smooth && lighting) { + glNormal3fv(coord->normal); + } + glVertex3fv(coord->vertex); + } + + coord = GETCOORD(curFrame, i, j+1); + if (smooth && lighting) { + glNormal3fv(coord->normal); + } + glVertex3fv(coord->vertex); + + coord = GETCOORD(curFrame, i+1, j+1); + if (smooth && lighting) { + glNormal3fv(coord->normal); + } + glVertex3fv(coord->vertex); + + lastColor = thisColor; + } + glEnd(); + } + + glFlush(); + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static void SetColorMap(void) +{ + static float green[3] = {0.2, 1.0, 0.2}; + static float red[3] = {1.0, 0.2, 0.2}; + float *color = 0, percent; + GLint *indexes = 0, entries, i, j; + + entries = glutGet(GLUT_WINDOW_COLORMAP_SIZE); + + colorIndexes1[0] = 1; + colorIndexes1[1] = 1 + (GLint)((entries - 1) * 0.3); + colorIndexes1[2] = (GLint)((entries - 1) * 0.5); + colorIndexes2[0] = 1 + (GLint)((entries - 1) * 0.5); + colorIndexes2[1] = 1 + (GLint)((entries - 1) * 0.8); + colorIndexes2[2] = entries - 1; + + for (i = 0; i < 2; i++) { + switch (i) { + case 0: + color = green; + indexes = colorIndexes1; + break; + case 1: + color = red; + indexes = colorIndexes2; + break; + } + + for (j = indexes[0]; j < indexes[1]; j++) { + percent = 0.2 + 0.8 * (j - indexes[0]) / + (float)(indexes[1] - indexes[0]); + glutSetColor(j, percent*color[0], percent*color[1], + percent*color[2]); + } + for (j=indexes[1]; j<=indexes[2]; j++) { + percent = (j - indexes[1]) / (float)(indexes[2] - indexes[1]); + glutSetColor(j, percent*(1-color[0])+color[0], + percent*(1-color[1])+color[1], + percent*(1-color[2])+color[2]); + } + } +} + +static void InitMesh(void) +{ + struct coord *coord; + struct facet *facet; + float dp1[3], dp2[3]; + float *pt1, *pt2, *pt3; + float angle, d, x, y; + GLint numFacets, numCoords, frameNum, i, j; + + theMesh.widthX = widthX; + theMesh.widthY = widthY; + theMesh.frames = frames; + + numFacets = widthX * widthY; + numCoords = (widthX + 1) * (widthY + 1); + + theMesh.numCoords = numCoords; + theMesh.numFacets = numFacets; + + theMesh.coords = (struct coord *)malloc(frames*numCoords* + sizeof(struct coord)); + theMesh.facets = (struct facet *)malloc(frames*numFacets* + sizeof(struct facet)); + if (theMesh.coords == NULL || theMesh.facets == NULL) { + printf("Out of memory.\n"); + exit(1); + } + + for (frameNum = 0; frameNum < frames; frameNum++) { + for (i = 0; i <= widthX; i++) { + x = i / (float)widthX; + for (j = 0; j <= widthY; j++) { + y = j / (float)widthY; + + d = sqrt(x*x+y*y); + if (d == 0.0) { + d = 0.0001; + } + angle = 2 * PI * d + (2 * PI / frames * frameNum); + + coord = GETCOORD(frameNum, i, j); + + coord->vertex[0] = x - 0.5; + coord->vertex[1] = y - 0.5; + coord->vertex[2] = (height - height * d) * cos(angle); + + coord->normal[0] = -(height / d) * x * ((1 - d) * 2 * PI * + sin(angle) + cos(angle)); + coord->normal[1] = -(height / d) * y * ((1 - d) * 2 * PI * + sin(angle) + cos(angle)); + coord->normal[2] = -1; + + d = 1.0 / sqrt(coord->normal[0]*coord->normal[0]+ + coord->normal[1]*coord->normal[1]+1); + coord->normal[0] *= d; + coord->normal[1] *= d; + coord->normal[2] *= d; + } + } + for (i = 0; i < widthX; i++) { + for (j = 0; j < widthY; j++) { + facet = GETFACET(frameNum, i, j); + if (((i/checkerSize)%2)^(j/checkerSize)%2) { + if (rgb) { + facet->color[0] = 1.0; + facet->color[1] = 0.2; + facet->color[2] = 0.2; + } else { + facet->color[0] = colorIndexes1[0]; + facet->color[1] = colorIndexes1[1]; + facet->color[2] = colorIndexes1[2]; + } + } else { + if (rgb) { + facet->color[0] = 0.2; + facet->color[1] = 1.0; + facet->color[2] = 0.2; + } else { + facet->color[0] = colorIndexes2[0]; + facet->color[1] = colorIndexes2[1]; + facet->color[2] = colorIndexes2[2]; + } + } + pt1 = GETCOORD(frameNum, i, j)->vertex; + pt2 = GETCOORD(frameNum, i, j+1)->vertex; + pt3 = GETCOORD(frameNum, i+1, j+1)->vertex; + + dp1[0] = pt2[0] - pt1[0]; + dp1[1] = pt2[1] - pt1[1]; + dp1[2] = pt2[2] - pt1[2]; + + dp2[0] = pt3[0] - pt2[0]; + dp2[1] = pt3[1] - pt2[1]; + dp2[2] = pt3[2] - pt2[2]; + + facet->normal[0] = dp1[1] * dp2[2] - dp1[2] * dp2[1]; + facet->normal[1] = dp1[2] * dp2[0] - dp1[0] * dp2[2]; + facet->normal[2] = dp1[0] * dp2[1] - dp1[1] * dp2[0]; + + d = 1.0 / sqrt(facet->normal[0]*facet->normal[0]+ + facet->normal[1]*facet->normal[1]+ + facet->normal[2]*facet->normal[2]); + + facet->normal[0] *= d; + facet->normal[1] *= d; + facet->normal[2] *= d; + } + } + } +} + +static void InitMaterials(void) +{ + static float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static float diffuse[] = {0.5, 1.0, 1.0, 1.0}; + static float position[] = {90.0, 90.0, 150.0, 0.0}; + static float front_mat_shininess[] = {60.0}; + static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0}; + static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0}; + static float back_mat_shininess[] = {60.0}; + static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0}; + static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; + static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; + static float lmodel_twoside[] = {GL_TRUE}; + + glMatrixMode(GL_PROJECTION); + gluPerspective(90.0, 1.0, 0.5, 10.0); + + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); + glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess); + glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular); + glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess); + glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular); + glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse); + if (rgb) { + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + } + + if (rgb) { + glEnable(GL_COLOR_MATERIAL); + } else { + SetColorMap(); + } +} + +static void InitTexture(void) +{ + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +} + +static void Init(void) +{ + + glClearColor(0.0, 0.0, 0.0, 0.0); + + glShadeModel(GL_FLAT); + + glFrontFace(GL_CW); + + glEnable(GL_DEPTH_TEST); + + InitMaterials(); + InitTexture(); + InitMesh(); + + glMatrixMode(GL_MODELVIEW); + glTranslatef(0.0, 0.4, -1.8); + glScalef(2.0, 2.0, 2.0); + glRotatef(-35.0, 1.0, 0.0, 0.0); + glRotatef(35.0, 0.0, 0.0, 1.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + case 'c': + contouring++; + if (contouring == 1) { + static GLfloat map[4] = {0, 0, 20, 0}; + + glTexImage2D(GL_TEXTURE_2D, 0, 3, 4, 4, 0, GL_LUMINANCE, + GL_UNSIGNED_BYTE, (GLvoid *)contourTexture1); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenfv(GL_S, GL_OBJECT_PLANE, map); + glTexGenfv(GL_T, GL_OBJECT_PLANE, map); + glEnable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + } else if (contouring == 2) { + static GLfloat map[4] = {0, 0, 20, 0}; + + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTexGenfv(GL_S, GL_EYE_PLANE, map); + glTexGenfv(GL_T, GL_EYE_PLANE, map); + glPopMatrix(); + } else { + contouring = 0; + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_2D); + } + break; + case 's': + smooth = !smooth; + if (smooth) { + glShadeModel(GL_SMOOTH); + } else { + glShadeModel(GL_FLAT); + } + break; + case 'l': + lighting = !lighting; + if (lighting) { + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + if (rgb) { + glEnable(GL_COLOR_MATERIAL); + } + } else { + glDisable(GL_LIGHTING); + glDisable(GL_LIGHT0); + if (rgb) { + glDisable(GL_COLOR_MATERIAL); + } + } + break; + case 'd': + depth = !depth; + if (depth) { + glEnable(GL_DEPTH_TEST); + clearMask |= GL_DEPTH_BUFFER_BIT; + } else { + glDisable(GL_DEPTH_TEST); + clearMask &= ~GL_DEPTH_BUFFER_BIT; + } + break; + case 32: + stepMode = !stepMode; + if (stepMode) { + glutIdleFunc(0); + } else { + glutIdleFunc(glut_post_redisplay_p); + } + break; + case 'n': + if (stepMode) { + nextFrame = 1; + } + break; + case 'a': + spinMode = !spinMode; + break; + default: + return; + } + glutPostRedisplay(); +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + rgb = GL_TRUE; + doubleBuffer = GL_TRUE; + frames = 10; + widthX = 10; + widthY = 10; + checkerSize = 2; + height = 0.2; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ci") == 0) { + rgb = GL_FALSE; + } else if (strcmp(argv[i], "-rgb") == 0) { + rgb = GL_TRUE; + } else if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else if (strcmp(argv[i], "-grid") == 0) { + if (i+2 >= argc || argv[i+1][0] == '-' || argv[i+2][0] == '-') { + printf("-grid (No numbers).\n"); + return GL_FALSE; + } else { + widthX = atoi(argv[++i]); + widthY = atoi(argv[++i]); + } + } else if (strcmp(argv[i], "-size") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-checker (No number).\n"); + return GL_FALSE; + } else { + checkerSize = atoi(argv[++i]); + } + } else if (strcmp(argv[i], "-wave") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-wave (No number).\n"); + return GL_FALSE; + } else { + height = atof(argv[++i]); + } + } else if (strcmp(argv[i], "-frames") == 0) { + if (i+1 >= argc || argv[i+1][0] == '-') { + printf("-frames (No number).\n"); + return GL_FALSE; + } else { + frames = atoi(argv[++i]); + } + } else { + printf("%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); + + type = GLUT_DEPTH; + type |= (rgb) ? GLUT_RGB : GLUT_INDEX; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow("Wave Demo") == GL_FALSE) { + exit(1); + } + + InitMap(); + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Animate); + glutIdleFunc(glut_post_redisplay_p); + glutMainLoop(); + return 0; +} diff --git a/xc/extras/Mesa/src-glut.beos/Makefile b/xc/extras/Mesa/src-glut.beos/Makefile new file mode 100644 index 000000000..5ce535419 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/Makefile @@ -0,0 +1,104 @@ +## BeOS Generic Makefile v2.0 ## + + + +## Fill in this file to specify the project being created, and the referenced +## makefile-engine will do all of the hard work for you. This handles both +## Intel and PowerPC builds of the BeOS. + +## Application Specific Settings --------------------------------------------- + +# specify the name of the binary +NAME= libglut.so + +# specify the type of binary +# APP: Application +# SHARED: Shared library or add-on +# STATIC: Static library archive +# DRIVER: Kernel Driver +TYPE= SHARED + +# specify the source files to use +# full paths or paths relative to the makefile can be included +# all files, regardless of directory, will have their object +# files created in the common object directory. +# Note that this means this makefile will not work correctly +# if two source files with the same name (source.c or source.cpp) +# are included from different directories. Also note that spaces +# in folder names do not work well with this makefile. +SRCS= glut_util.cpp glutBlocker.cpp glutInit.cpp glutWindow.cpp \ +glutEvent.cpp glutCallback.cpp glutOverlay.cpp glutGet.cpp glutColor.cpp \ +glutCursor.cpp glutMenu.cpp glutDstr.cpp glut_bitmap.cpp glut_bwidth.cpp \ +glut_8x13.cpp glut_9x15.cpp glut_hel10.cpp glut_hel12.cpp glut_hel18.cpp \ +glut_tr10.cpp glut_tr24.cpp glut_mroman.cpp glut_roman.cpp glut_stroke.cpp \ +glut_swidth.cpp glut_shapes.cpp glut_teapot.cpp beos_x11.cpp + +# specify the resource files to use +# full path or a relative path to the resource file can be used. +RSRCS= + +# specify additional libraries to link against +# there are two acceptable forms of library specifications +# - if your library follows the naming pattern of: +# libXXX.so or libXXX.a you can simply specify XXX +# library: libbe.so entry: be +# +# - if your library does not follow the standard library +# naming scheme you need to specify the path to the library +# and it's name +# library: my_lib.a entry: my_lib.a or path/my_lib.a +LIBS= GL GLU be + +# specify additional paths to directories following the standard +# libXXX.so or libXXX.a naming scheme. You can specify full paths +# or paths relative to the makefile. The paths included may not +# be recursive, so include all of the paths where libraries can +# be found. Directories where source files are found are +# automatically included. +LIBPATHS= ../lib + +# additional paths to look for system headers +# thes use the form: #include <header> +# source file directories are NOT auto-included here +SYSTEM_INCLUDE_PATHS = ../../include /boot/develop/headers/be/opengl + +# additional paths to look for local headers +# thes use the form: #include "header" +# source file directories are automatically included +LOCAL_INCLUDE_PATHS = + +# specify the level of optimization that you desire +# NONE, SOME, FULL +OPTIMIZE= FULL + +# specify any preprocessor symbols to be defined. The symbols +# will be set to a value of 1. For example specify DEBUG if you want +# DEBUG=1 to be set when compiling. +DEFINES= + +# specify special warning levels +# if unspecified default warnings will be used +# NONE = supress all warnings +# ALL = enable all warnings +WARNINGS = ALL + +# specify whether image symbols will be created +# so that stack crawls in the debugger are meaningful +# if TRUE symbols will be created +SYMBOLS = + +# specify debug settings +# if TRUE will allow application to be run from +# a source-level debugger +DEBUGGER = + +# specify additional compiler flags for all files +COMPILER_FLAGS = + +# specify additional linker flags +LINKER_FLAGS = + + +## include the makefile-engine +include /boot/develop/etc/makefile-engine + diff --git a/xc/extras/Mesa/src-glut.beos/beos_x11.cpp b/xc/extras/Mesa/src-glut.beos/beos_x11.cpp new file mode 100644 index 000000000..20c75036d --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/beos_x11.cpp @@ -0,0 +1,176 @@ + +/* Copyright (c) Nate Robins, 1997. */ + +/* 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 <Screen.h> +#include <stdio.h> +#include "beos_x11.h" + +/* NOTE: These functions require a BApplication to be instantiated first */ +int DisplayWidth() { + BScreen s; + return s.Frame().IntegerWidth() + 1; +} + +int DisplayHeight() { + BScreen s; + return s.Frame().IntegerHeight() + 1; +} + +/* the following function was stolen from the X sources as indicated. */ + +/* Copyright Massachusetts Institute of Technology 1985, 1986, 1987 */ +/* $XConsortium: XParseGeom.c,v 11.18 91/02/21 17:23:05 rws Exp $ */ + +/* +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. M.I.T. makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. +*/ + +/* + *Returns pointer to first char ins search which is also in what, else NULL. + */ +static char *strscan (char *search, char *what) +{ + int i, len = strlen (what); + char c; + + while ((c = *(search++)) != (int)NULL) + for (i = 0; i < len; i++) + if (c == what [i]) + return (--search); + return (NULL); +} + +/* + * XParseGeometry parses strings of the form + * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where + * width, height, xoffset, and yoffset are unsigned integers. + * Example: "=80x24+300-49" + * The equal sign is optional. + * It returns a bitmask that indicates which of the four values + * were actually found in the string. For each value found, + * the corresponding argument is updated; for each value + * not found, the corresponding argument is left unchanged. + */ + +static int +ReadInteger(char *string, char **NextString) +{ + register int Result = 0; + int Sign = 1; + + if (*string == '+') + string++; + else if (*string == '-') + { + string++; + Sign = -1; + } + for (; (*string >= '0') && (*string <= '9'); string++) + { + Result = (Result * 10) + (*string - '0'); + } + *NextString = string; + if (Sign >= 0) + return (Result); + else + return (-Result); +} + +int XParseGeometry (char *string, int *x, int *y, + unsigned int *width, unsigned int *height) +{ + int mask = NoValue; + register char *strind; + unsigned int tempWidth=0, tempHeight=0; + int tempX=0, tempY=0; + char *nextCharacter; + + if ( (string == NULL) || (*string == '\0')) return(mask); + if (*string == '=') + string++; /* ignore possible '=' at beg of geometry spec */ + + strind = (char *)string; + if (*strind != '+' && *strind != '-' && *strind != 'x') { + tempWidth = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= WidthValue; + } + + if (*strind == 'x' || *strind == 'X') { + strind++; + tempHeight = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= HeightValue; + } + + if ((*strind == '+') || (*strind == '-')) { + if (*strind == '-') { + strind++; + tempX = -ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= XNegative; + + } + else + { strind++; + tempX = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + } + mask |= XValue; + if ((*strind == '+') || (*strind == '-')) { + if (*strind == '-') { + strind++; + tempY = -ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + mask |= YNegative; + + } + else + { + strind++; + tempY = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + } + mask |= YValue; + } + } + + /* If strind isn't at the end of the string the it's an invalid + geometry specification. */ + + if (*strind != '\0') return (0); + + if (mask & XValue) + *x = tempX; + if (mask & YValue) + *y = tempY; + if (mask & WidthValue) + *width = tempWidth; + if (mask & HeightValue) + *height = tempHeight; + return (mask); +} diff --git a/xc/extras/Mesa/src-glut.beos/beos_x11.h b/xc/extras/Mesa/src-glut.beos/beos_x11.h new file mode 100644 index 000000000..966dddd5e --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/beos_x11.h @@ -0,0 +1,33 @@ +#ifndef __beos_x11_h__ +#define __beos_x11_h__ + +/* Copyright (c) Nate Robins, 1997. */ + +/* 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. */ + +/* + * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding + * value (x, y, width, height) was found in the parsed string. +*/ +#define NoValue 0x0000 +#define XValue 0x0001 +#define YValue 0x0002 +#define WidthValue 0x0004 +#define HeightValue 0x0008 +#define AllValues 0x000F +#define XNegative 0x0010 +#define YNegative 0x0020 + +/* Function prototypes. */ + +extern int DisplayWidth(); +extern int DisplayHeight(); + +extern int XParseGeometry( + char* string, + int* x, int* y, + unsigned int* width, unsigned int* height); + +#endif /* __beos_x11_h__ */ diff --git a/xc/extras/Mesa/src-glut.beos/glutBlocker.cpp b/xc/extras/Mesa/src-glut.beos/glutBlocker.cpp new file mode 100644 index 000000000..e2cfcf7b3 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutBlocker.cpp @@ -0,0 +1,65 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutBlocker.cpp + * + * DESCRIPTION: helper class for GLUT event loop. + * if a window receives an event, wake up the event loop. + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include "glutBlocker.h" + +/*********************************************************** + * Global variable + ***********************************************************/ +GlutBlocker gBlock; + +/*********************************************************** + * Member functions + ***********************************************************/ +GlutBlocker::GlutBlocker() { + gSem = create_sem(1, "gSem"); + eSem = create_sem(0, "eSem"); + events = false; + sleeping = false; +} + +GlutBlocker::~GlutBlocker() { + delete_sem(eSem); + delete_sem(gSem); +} + +void GlutBlocker::WaitEvent() { + acquire_sem(gSem); + if(!events) { // wait for new event + sleeping = true; + release_sem(gSem); + acquire_sem(eSem); // next event will release eSem + } else { + release_sem(gSem); + } +} + +void GlutBlocker::WaitEvent(bigtime_t usecs) { + acquire_sem(gSem); + if(!events) { // wait for new event + sleeping = true; + release_sem(gSem); + acquire_sem_etc(eSem, 1, B_TIMEOUT, usecs); // wait for next event or timeout + } else { + release_sem(gSem); + } +} + +void GlutBlocker::NewEvent() { + acquire_sem(gSem); + events = true; // next call to WaitEvent returns immediately + if(sleeping) { + sleeping = false; + release_sem(eSem); // if event loop is blocking, wake it up + } + release_sem(gSem); +} diff --git a/xc/extras/Mesa/src-glut.beos/glutBlocker.h b/xc/extras/Mesa/src-glut.beos/glutBlocker.h new file mode 100644 index 000000000..e6d1f4e04 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutBlocker.h @@ -0,0 +1,43 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutBlocker.h + * + * DESCRIPTION: helper class for GLUT event loop. + * if a window receives an event, wake up the event loop. + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <kernel/OS.h> + +/*********************************************************** + * CLASS: GlutBlocker + * + * DESCRIPTION: Fairly naive, but safe implementation. + * global semaphore controls access to state + * event semaphore blocks WaitEvent() call if necessary + * (this is basically a condition variable class) + ***********************************************************/ +class GlutBlocker { +public: + GlutBlocker(); + ~GlutBlocker(); + void WaitEvent(); // wait for new event + void WaitEvent(bigtime_t usecs); // wait with timeout + void NewEvent(); // new event from a window (may need to wakeup main thread) + void QuickNewEvent() { events = true; } // new event from main thread + void ClearEvents() { events = false; } // clear counter at beginning of event loop + bool PendingEvent() { return events; } // XPending() equivalent +private: + sem_id gSem; + sem_id eSem; + bool events; // are there any new events? + bool sleeping; // is someone sleeping on eSem? +}; + +/*********************************************************** + * Global variable + ***********************************************************/ +extern GlutBlocker gBlock;
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glutCallback.cpp b/xc/extras/Mesa/src-glut.beos/glutCallback.cpp new file mode 100644 index 000000000..82707d5db --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutCallback.cpp @@ -0,0 +1,147 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutCallback.cpp + * + * DESCRIPTION: put all the callback setting routines in + * one place + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include "glutint.h" +#include "glutState.h" + +/*********************************************************** + * Window related callbacks + ***********************************************************/ +void APIENTRY +glutDisplayFunc(GLUTdisplayCB displayFunc) +{ + /* XXX Remove the warning after GLUT 3.0. */ + if (!displayFunc) + __glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code."); + gState.currentWindow->display = displayFunc; +} + +void APIENTRY +glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) +{ + gState.currentWindow->keyboard = keyboardFunc; +} + +void APIENTRY +glutSpecialFunc(GLUTspecialCB specialFunc) +{ + gState.currentWindow->special = specialFunc; +} + +void APIENTRY +glutMouseFunc(GLUTmouseCB mouseFunc) +{ + gState.currentWindow->mouse = mouseFunc; +} + +void APIENTRY +glutMotionFunc(GLUTmotionCB motionFunc) +{ + gState.currentWindow->motion = motionFunc; +} + +void APIENTRY +glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc) +{ + gState.currentWindow->passive = passiveMotionFunc; +} + +void APIENTRY +glutEntryFunc(GLUTentryCB entryFunc) +{ + gState.currentWindow->entry = entryFunc; + if (!entryFunc) { + gState.currentWindow->entryState = -1; + } +} + +void APIENTRY +glutVisibilityFunc(GLUTvisibilityCB visibilityFunc) +{ + gState.currentWindow->visibility = visibilityFunc; +} + +void APIENTRY +glutReshapeFunc(GLUTreshapeCB reshapeFunc) +{ + if (reshapeFunc) { + gState.currentWindow->reshape = reshapeFunc; + } else { + gState.currentWindow->reshape = __glutDefaultReshape; + } +} + +/*********************************************************** + * General callbacks (timer callback in glutEvent.cpp) + ***********************************************************/ +/* DEPRICATED, use glutMenuStatusFunc instead. */ +void APIENTRY +glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) +{ + gState.menuStatus = (GLUTmenuStatusCB) menuStateFunc; +} + +void APIENTRY +glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) +{ + gState.menuStatus = menuStatusFunc; +} + +void APIENTRY +glutIdleFunc(GLUTidleCB idleFunc) +{ + gState.idle = idleFunc; +} + +/*********************************************************** + * Unsupported callbacks + ***********************************************************/ +void APIENTRY +glutOverlayDisplayFunc(GLUTdisplayCB displayFunc) +{ +} + +void APIENTRY +glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) +{ +} + +void APIENTRY +glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) +{ +} + +void APIENTRY +glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc) +{ +} + +void APIENTRY +glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) +{ +} + +void APIENTRY +glutDialsFunc(GLUTdialsCB dialsFunc) +{ +} + +void APIENTRY +glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) +{ +} + +void APIENTRY +glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc) +{ +}
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glutColor.cpp b/xc/extras/Mesa/src-glut.beos/glutColor.cpp new file mode 100644 index 000000000..5979deafc --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutColor.cpp @@ -0,0 +1,27 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutColor.cpp + * + * DESCRIPTION: we don't support indexed color, so this code is + * really simple + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include "glutint.h" + +void glutSetColor(int cell, GLfloat red, GLfloat green, GLfloat blue) { + __glutWarning("glutSetColor: current window is RGBA"); +} + +GLfloat glutGetColor(int cell, int component) { + __glutWarning("glutGetColor: current window is RGBA"); + return -1.0; +} + +void glutCopyColormap(int win) { + __glutWarning("glutCopyColormap: color index not supported in BeOS"); +}
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glutCursor.cpp b/xc/extras/Mesa/src-glut.beos/glutCursor.cpp new file mode 100644 index 000000000..e8debe800 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutCursor.cpp @@ -0,0 +1,85 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutCursor.cpp + * + * DESCRIPTION: code for handling custom mouse cursors + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include "glutint.h" +#include "glutState.h" +#include "glutCursors.h" + +static const unsigned char *cursorTable[] = { + XC_arrow, /* GLUT_CURSOR_RIGHT_ARROW */ + XC_top_left_arrow, /* GLUT_CURSOR_LEFT_ARROW */ + XC_hand1, /* GLUT_CURSOR_INFO */ + XC_pirate, /* GLUT_CURSOR_DESTROY */ + XC_question_arrow, /* GLUT_CURSOR_HELP */ + XC_exchange, /* GLUT_CURSOR_CYCLE */ + XC_spraycan, /* GLUT_CURSOR_SPRAY */ + XC_watch, /* GLUT_CURSOR_WAIT */ + XC_xterm, /* GLUT_CURSOR_TEXT */ + XC_crosshair, /* GLUT_CURSOR_CROSSHAIR */ + XC_sb_v_double_arrow, /* GLUT_CURSOR_UP_DOWN */ + XC_sb_h_double_arrow, /* GLUT_CURSOR_LEFT_RIGHT */ + XC_top_side, /* GLUT_CURSOR_TOP_SIDE */ + XC_bottom_side, /* GLUT_CURSOR_BOTTOM_SIDE */ + XC_left_side, /* GLUT_CURSOR_LEFT_SIDE */ + XC_right_side, /* GLUT_CURSOR_RIGHT_SIDE */ + XC_top_left_corner, /* GLUT_CURSOR_TOP_LEFT_CORNER */ + XC_top_right_corner, /* GLUT_CURSOR_TOP_RIGHT_CORNER */ + XC_bottom_right_corner, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */ + XC_bottom_left_corner, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */ +}; + +/*********************************************************** + * FUNCTION: glutSetCursor (4.13) + * + * DESCRIPTION: set a new mouse cursor for current window + ***********************************************************/ +void glutSetCursor(int cursor) { + gState.currentWindow->Window()->Lock(); + gState.currentWindow->cursor = cursor; + __glutSetCursor(cursor); + gState.currentWindow->Window()->Unlock(); +} + +/*********************************************************** + * FUNCTION: __glutSetCursor + * + * DESCRIPTION: the actual cursor changing routine + ***********************************************************/ +void __glutSetCursor(int cursor) { + int realcursor = cursor; + if (cursor < 0 || cursor > GLUT_CURSOR_BOTTOM_LEFT_CORNER) { + switch(cursor) { + case GLUT_CURSOR_INHERIT: + return; // don't change cursor + case GLUT_CURSOR_NONE: + // this hides the cursor until the user moves the mouse + // change it to HideCursor() AT YOUR OWN RISK! + be_app->ObscureCursor(); + return; + case GLUT_CURSOR_FULL_CROSSHAIR: + realcursor = GLUT_CURSOR_CROSSHAIR; + break; + default: + __glutWarning("unknown cursor\n"); + return; + } + } + be_app->SetCursor(cursorTable[realcursor]); +} + +/*********************************************************** + * FUNCTION: glutWarpPointer (x.xx) + * + * DESCRIPTION: move the mouse pointer to a new location + * (note: can't do this in BeOS!) + ***********************************************************/ +void glutWarpPointer(int x, int y) { }
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glutCursors.h b/xc/extras/Mesa/src-glut.beos/glutCursors.h new file mode 100644 index 000000000..59f6951e2 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutCursors.h @@ -0,0 +1,3083 @@ +/* cursors.h: X Window standard cursor shapes */ +/* Generated by bdftobcursor */ + +const unsigned char XC_X_cursor[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x70, 0xe, + 0x78, 0x1e, + 0x7c, 0x3e, + 0x3e, 0x7c, + 0x1f, 0xf8, + 0xf, 0xf0, + 0x7, 0xe0, + 0x7, 0xe0, + 0xf, 0xf0, + 0x1f, 0xf8, + 0x3e, 0x7c, + 0x7c, 0x3e, + 0x78, 0x1e, + 0x70, 0xe, + 0x0, 0x0, + /* mask */ + 0xf0, 0xf, + 0xf8, 0x1f, + 0xfc, 0x3f, + 0xfe, 0x7f, + 0x7f, 0xfe, + 0x3f, 0xfc, + 0x1f, 0xf8, + 0xf, 0xf0, + 0xf, 0xf0, + 0x1f, 0xf8, + 0x3f, 0xfc, + 0x7f, 0xfe, + 0xfe, 0x7f, + 0xfc, 0x3f, + 0xf8, 0x1f, + 0xf0, 0xf, +}; + +const unsigned char XC_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 2, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x60, 0x0, + 0x78, 0x0, + 0x3e, 0x0, + 0x3f, 0x80, + 0x1f, 0xe0, + 0x1f, 0xf8, + 0xf, 0x80, + 0xf, 0xc0, + 0x6, 0xe0, + 0x6, 0x70, + 0x2, 0x38, + 0x2, 0x1c, + 0x0, 0xe, + 0x0, 0x4, + 0x0, 0x0, + /* mask */ + 0xe0, 0x0, + 0xf8, 0x0, + 0xfe, 0x0, + 0x7f, 0x80, + 0x7f, 0xe0, + 0x3f, 0xf8, + 0x3f, 0xfc, + 0x1f, 0xfc, + 0x1f, 0xe0, + 0xf, 0xf0, + 0xf, 0xf8, + 0x7, 0x7c, + 0x7, 0x3e, + 0x2, 0x1f, + 0x0, 0xe, + 0x0, 0x4, +}; + +const unsigned char XC_based_arrow_down[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 12, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0xf, 0xf0, + 0x0, 0x0, + 0xf, 0xf0, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x5, 0xa0, + 0x3, 0xc0, + 0x1, 0x80, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x3, 0xc0, + 0x3, 0xc0, + 0xf, 0xf0, + 0xf, 0xf0, + 0xf, 0xf0, + 0x7, 0xe0, + 0x3, 0xc0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_based_arrow_up[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 12, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x1, 0x80, + 0x3, 0xc0, + 0x5, 0xa0, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0xf, 0xf0, + 0x0, 0x0, + 0xf, 0xf0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x1, 0x80, + 0x3, 0xc0, + 0xf, 0xf0, + 0xf, 0xf0, + 0xf, 0xf0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_boat[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 2, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x80, + 0x3, 0xe0, + 0x6, 0x11, + 0xff, 0xff, + 0x18, 0x0, + 0x4, 0x0, + 0x2, 0x0, + 0x3, 0xff, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0xe0, + 0x3, 0xf0, + 0x7, 0xf9, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x1f, 0xff, + 0x7, 0xff, + 0x3, 0xff, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_bogosity[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x38, 0x8e, + 0x8, 0x88, + 0x8, 0x88, + 0x8, 0x88, + 0x3f, 0xfe, + 0x28, 0x8a, + 0x28, 0x8a, + 0x28, 0x8a, + 0x28, 0x8a, + 0x3f, 0xfe, + 0x8, 0x88, + 0x8, 0x88, + 0x8, 0x88, + 0x38, 0x8e, + 0x0, 0x0, + /* mask */ + 0x7d, 0xdf, + 0x7d, 0xdf, + 0x7d, 0xdf, + 0x1d, 0xdc, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7d, 0xdf, + 0x7d, 0xdf, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x1d, 0xdc, + 0x7d, 0xdf, + 0x7d, 0xdf, + 0x7d, 0xdf, +}; + +const unsigned char XC_bottom_left_corner[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 14, 15, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x6, + 0x0, 0x6, + 0x10, 0x46, + 0x8, 0x46, + 0x4, 0x46, + 0x2, 0x46, + 0x1, 0x46, + 0x0, 0xc6, + 0x1f, 0xc6, + 0x0, 0x6, + 0x0, 0x6, + 0x0, 0x6, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x0, 0x0, + /* mask */ + 0x0, 0xf, + 0x0, 0xf, + 0x30, 0xef, + 0x38, 0xef, + 0x1c, 0xef, + 0xe, 0xef, + 0x7, 0xef, + 0x3, 0xef, + 0x3f, 0xef, + 0x3f, 0xef, + 0x3f, 0xef, + 0x0, 0xf, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, +}; + +const unsigned char XC_bottom_right_corner[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 14, 2, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x60, 0x0, + 0x60, 0x0, + 0x62, 0x8, + 0x62, 0x10, + 0x62, 0x20, + 0x62, 0x40, + 0x62, 0x80, + 0x63, 0x0, + 0x63, 0xf8, + 0x60, 0x0, + 0x60, 0x0, + 0x60, 0x0, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x0, 0x0, + /* mask */ + 0xf0, 0x0, + 0xf0, 0x0, + 0xf7, 0xc, + 0xf7, 0x1c, + 0xf7, 0x38, + 0xf7, 0x70, + 0xf7, 0xe0, + 0xf7, 0xc0, + 0xf7, 0xfc, + 0xf7, 0xfc, + 0xf7, 0xfc, + 0xf0, 0x0, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, +}; + +const unsigned char XC_bottom_side[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 14, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x8, 0x88, + 0x4, 0x90, + 0x2, 0xa0, + 0x1, 0xc0, + 0x0, 0x80, + 0x0, 0x0, + 0x3f, 0xfe, + 0x3f, 0xfe, + 0x0, 0x0, + /* mask */ + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x19, 0xcc, + 0x1d, 0xdc, + 0xf, 0xf8, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, +}; + +const unsigned char XC_bottom_tee[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 12, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_box_spiral[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 7, /* y,x of hotspot */ + /* data */ + 0xff, 0xff, + 0x0, 0x1, + 0x7f, 0xfd, + 0x40, 0x5, + 0x5f, 0xf5, + 0x50, 0x15, + 0x57, 0xd5, + 0x54, 0x55, + 0x55, 0x55, + 0x55, 0xd5, + 0x54, 0x15, + 0x57, 0xf5, + 0x50, 0x5, + 0x5f, 0xfd, + 0x40, 0x1, + 0x7f, 0xff, + /* mask */ + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, +}; + +const unsigned char XC_center_ptr[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x81, 0x80, + 0x1, 0x80, + 0x3, 0xc0, + 0x3, 0xc0, + 0x7, 0xe0, + 0x7, 0xe0, + 0xf, 0xf0, + 0xf, 0xf0, + 0x19, 0x98, + 0x11, 0x88, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x0, 0x0, + /* mask */ + 0x83, 0xc0, + 0x3, 0xc0, + 0x7, 0xe0, + 0x7, 0xe0, + 0xf, 0xf0, + 0xf, 0xf0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3b, 0xdc, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, +}; + +const unsigned char XC_circle[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x3, 0xc0, + 0xf, 0xf0, + 0x1f, 0xf8, + 0x3c, 0x3c, + 0x38, 0x1c, + 0x70, 0xe, + 0x70, 0xe, + 0x70, 0xe, + 0x70, 0xe, + 0x38, 0x1c, + 0x3c, 0x3c, + 0x1f, 0xf8, + 0xf, 0xf0, + 0x3, 0xc0, + 0x0, 0x0, + /* mask */ + 0x7, 0xe0, + 0x1f, 0xf8, + 0x3f, 0xfc, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0xfc, 0x3f, + 0xf8, 0x1f, + 0xf8, 0x1f, + 0xf8, 0x1f, + 0xf8, 0x1f, + 0xfc, 0x3f, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x3f, 0xfc, + 0x1f, 0xf8, + 0x7, 0xe0, +}; + +const unsigned char XC_clock[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 3, 9, /* y,x of hotspot */ + /* data */ + 0x1f, 0xf8, + 0x33, 0xcc, + 0x66, 0x26, + 0x49, 0x92, + 0x48, 0xf2, + 0x44, 0x22, + 0x63, 0xc6, + 0x3f, 0xfc, + 0x29, 0x94, + 0x29, 0x94, + 0x29, 0x94, + 0x2b, 0xd4, + 0x69, 0x96, + 0x78, 0x1e, + 0x7f, 0xfe, + 0x7f, 0xfe, + /* mask */ + 0x1f, 0xfe, + 0x39, 0xf7, + 0x77, 0xdb, + 0x6d, 0xed, + 0x6f, 0xfd, + 0x66, 0xf9, + 0x73, 0xf3, + 0x3f, 0xff, + 0x35, 0xeb, + 0x35, 0xeb, + 0x35, 0xeb, + 0x37, 0xfb, + 0x75, 0xeb, + 0x7c, 0xcf, + 0x7f, 0xff, + 0x7f, 0xff, +}; + +const unsigned char XC_coffee_mug[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 9, 8, /* y,x of hotspot */ + /* data */ + 0x8f, 0xf8, + 0x10, 0x4, + 0x60, 0x6, + 0x58, 0xa, + 0x47, 0xf2, + 0x40, 0x3, + 0x40, 0x3, + 0x40, 0x2, + 0x40, 0x2, + 0x58, 0x9a, + 0x55, 0x56, + 0x55, 0xd7, + 0x59, 0x5b, + 0x40, 0x2, + 0x40, 0x2, + 0x3f, 0xfc, + /* mask */ + 0xf, 0xf8, + 0x1f, 0xfc, + 0xff, 0xfe, + 0xff, 0xfe, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xfe, + 0xff, 0xfe, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xfe, + 0x3f, 0xfc, +}; + +const unsigned char XC_cross[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 9, /* y,x of hotspot */ + /* data */ + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0xff, 0x7f, + 0x0, 0x0, + 0xff, 0x7f, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x0, 0x0, + /* mask */ + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, +}; + +const unsigned char XC_cross_reverse[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 9, /* y,x of hotspot */ + /* data */ + 0x21, 0x42, + 0x51, 0x45, + 0x29, 0x4a, + 0x15, 0x54, + 0xb, 0x68, + 0x5, 0x50, + 0xfe, 0xbf, + 0x1, 0x40, + 0xfe, 0xbf, + 0x5, 0x50, + 0xb, 0x68, + 0x15, 0x54, + 0x29, 0x4a, + 0x51, 0x45, + 0x21, 0x42, + 0x0, 0x0, + /* mask */ + 0x33, 0x66, + 0xdb, 0x6d, + 0x6f, 0x7b, + 0x37, 0x76, + 0x1b, 0x6c, + 0xfd, 0x5f, + 0xfe, 0x3f, + 0x0, 0x80, + 0xfe, 0x3f, + 0xfd, 0x5f, + 0x1b, 0x6c, + 0x37, 0x76, + 0x6f, 0x7b, + 0xdb, 0x6d, + 0x33, 0x66, + 0x0, 0x0, +}; + +const unsigned char XC_crosshair[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0xff, 0x7f, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x0, + /* mask */ + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, +}; + +const unsigned char XC_diamond_cross[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x81, 0x40, + 0x3, 0x60, + 0x5, 0x50, + 0x9, 0x48, + 0x11, 0x44, + 0x21, 0x42, + 0x7f, 0x7f, + 0x0, 0x0, + 0x7f, 0x7f, + 0x21, 0x42, + 0x11, 0x44, + 0x9, 0x48, + 0x5, 0x50, + 0x3, 0x60, + 0x1, 0x40, + 0x0, 0x0, + /* mask */ + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0x1d, 0xdc, + 0x39, 0xce, + 0x71, 0xc7, + 0xff, 0xff, + 0xff, 0x7f, + 0xff, 0xff, + 0x71, 0xc7, + 0x39, 0xce, + 0x1d, 0xdc, + 0xf, 0xf8, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, +}; + +const unsigned char XC_dot[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x83, 0xc0, + 0xf, 0xf0, + 0xf, 0xf0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0xf, 0xf0, + 0xf, 0xf0, + 0x3, 0xc0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x87, 0xe0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x7, 0xe0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_dotbox[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x7f, 0xfc, + 0x20, 0x4, + 0x20, 0x4, + 0x20, 0x4, + 0x20, 0x4, + 0x21, 0x84, + 0x21, 0x84, + 0x20, 0x4, + 0x20, 0x4, + 0x20, 0x4, + 0x20, 0x4, + 0x3f, 0xfc, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x70, 0xe, + 0x70, 0xe, + 0x73, 0xce, + 0x73, 0xce, + 0x73, 0xce, + 0x73, 0xce, + 0x70, 0xe, + 0x70, 0xe, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x0, 0x0, +}; + +const unsigned char XC_double_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x81, 0x80, + 0x3, 0xc0, + 0x7, 0xe0, + 0xd, 0xb0, + 0x19, 0x98, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x19, 0x98, + 0xd, 0xb0, + 0x7, 0xe0, + 0x3, 0xc0, + 0x1, 0x80, + 0x0, 0x0, + /* mask */ + 0x83, 0xc0, + 0x7, 0xe0, + 0xf, 0xf0, + 0x1f, 0xf8, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x1f, 0xf8, + 0xf, 0xf0, + 0x7, 0xe0, + 0x3, 0xc0, +}; + +const unsigned char XC_draft_large[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 1, /* y,x of hotspot */ + /* data */ + 0xc0, 0x0, + 0x30, 0x0, + 0x3c, 0x0, + 0x1f, 0x0, + 0x1f, 0xc0, + 0xf, 0xf0, + 0xf, 0xfc, + 0x7, 0x80, + 0x7, 0x40, + 0x3, 0x20, + 0x3, 0x10, + 0x1, 0x8, + 0x1, 0x4, + 0x0, 0x2, + 0x0, 0x1, + 0x0, 0x0, + /* mask */ + 0x60, 0x0, + 0x78, 0x0, + 0x7e, 0x0, + 0x3f, 0x80, + 0x1f, 0xe0, + 0x1f, 0xf8, + 0xf, 0xfe, + 0xf, 0xfe, + 0x7, 0xe0, + 0x7, 0xf0, + 0x3, 0xb8, + 0x3, 0x9c, + 0x1, 0x8e, + 0x1, 0x87, + 0x0, 0x3, + 0x0, 0x1, +}; + +const unsigned char XC_draft_small[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 1, /* y,x of hotspot */ + /* data */ + 0x40, 0x0, + 0x30, 0x0, + 0x3c, 0x0, + 0x1f, 0x0, + 0x1f, 0xc0, + 0xe, 0x0, + 0xd, 0x0, + 0x4, 0x80, + 0x4, 0x40, + 0x0, 0x20, + 0x0, 0x10, + 0x0, 0x8, + 0x0, 0x4, + 0x0, 0x2, + 0x0, 0x1, + 0x0, 0x0, + /* mask */ + 0x60, 0x0, + 0x78, 0x0, + 0x3e, 0x0, + 0x3f, 0x80, + 0x1f, 0xe0, + 0x1f, 0xe0, + 0xf, 0x80, + 0xf, 0xc0, + 0x6, 0xe0, + 0x2, 0x70, + 0x0, 0x38, + 0x0, 0x1c, + 0x0, 0xe, + 0x0, 0x7, + 0x0, 0x3, + 0x0, 0x0, +}; + +const unsigned char XC_draped_box[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x7f, 0xfc, + 0x22, 0x44, + 0x26, 0x64, + 0x2c, 0x34, + 0x38, 0x1c, + 0x21, 0x84, + 0x21, 0x84, + 0x38, 0x1c, + 0x2c, 0x34, + 0x26, 0x64, + 0x22, 0x44, + 0x3f, 0xfc, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x67, 0xe6, + 0x6f, 0xf6, + 0x7e, 0x7e, + 0x7d, 0xbe, + 0x7b, 0xde, + 0x7b, 0xde, + 0x7d, 0xbe, + 0x7e, 0x7e, + 0x6f, 0xf6, + 0x67, 0xe6, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x0, 0x0, +}; + +const unsigned char XC_exchange[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x7, 0xe2, + 0xf, 0xf6, + 0x18, 0x3e, + 0x10, 0x12, + 0x0, 0x32, + 0x0, 0x7e, + 0x0, 0x0, + 0x0, 0x0, + 0x7e, 0x0, + 0x4c, 0x0, + 0x48, 0x8, + 0x7c, 0x18, + 0x6f, 0xf0, + 0x47, 0xe0, + 0x0, 0x0, + /* mask */ + 0x7, 0xe3, + 0xf, 0xf7, + 0x1f, 0xff, + 0x3f, 0xff, + 0x38, 0x3f, + 0x30, 0xff, + 0x0, 0xff, + 0x0, 0xff, + 0xff, 0x0, + 0xff, 0x0, + 0xfe, 0xc, + 0xfc, 0x1c, + 0xff, 0xfc, + 0xff, 0xf8, + 0xef, 0xf0, + 0xc7, 0xe0, +}; + +const unsigned char XC_fleur[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x1, 0x80, + 0x3, 0xc0, + 0x7, 0xe0, + 0x1, 0x80, + 0x11, 0x88, + 0x31, 0x8c, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x31, 0x8c, + 0x11, 0x88, + 0x1, 0x80, + 0x7, 0xe0, + 0x3, 0xc0, + 0x1, 0x80, + 0x0, 0x0, + /* mask */ + 0x3, 0xc0, + 0x7, 0xc0, + 0x7, 0xe0, + 0xf, 0xf0, + 0x17, 0xe8, + 0x3b, 0xdc, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x3b, 0xdc, + 0x17, 0xe8, + 0xf, 0xf0, + 0x7, 0xe0, + 0x3, 0xc0, + 0x3, 0xc0, +}; + +const unsigned char XC_gobbler[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 2, 2, /* y,x of hotspot */ + /* data */ + 0x1e, 0x0, + 0xe, 0x0, + 0xcc, 0x1, + 0xd, 0xf9, + 0xf, 0xff, + 0xc, 0x7f, + 0xc, 0x3f, + 0x1c, 0x6, + 0xf, 0x0, + 0x7, 0xf8, + 0x0, 0x10, + 0x0, 0x10, + 0x0, 0x10, + 0x0, 0x10, + 0x0, 0x78, + 0x0, 0x0, + /* mask */ + 0x3f, 0x0, + 0x3f, 0x0, + 0xff, 0x3, + 0xff, 0xff, + 0xff, 0xff, + 0x3f, 0xff, + 0x3f, 0xff, + 0x3f, 0xff, + 0x3f, 0xff, + 0x3f, 0xff, + 0x1f, 0xfe, + 0xf, 0xf8, + 0x0, 0x38, + 0x0, 0x38, + 0x0, 0xfc, + 0x0, 0xfc, +}; + +const unsigned char XC_gumby[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 14, /* y,x of hotspot */ + /* data */ + 0x0, 0xfc, + 0x1, 0x8, + 0x2, 0x13, + 0x5, 0x57, + 0x4, 0x13, + 0x5, 0xd3, + 0x3c, 0x1f, + 0xfc, 0x1c, + 0xe4, 0x10, + 0xe4, 0x10, + 0xf4, 0x90, + 0xe4, 0x90, + 0x4, 0x90, + 0x8, 0x88, + 0x10, 0x84, + 0x1f, 0x7c, + /* mask */ + 0x0, 0xfc, + 0x1, 0xfb, + 0x3, 0xf7, + 0x7, 0xff, + 0x7, 0xf7, + 0x3f, 0xf7, + 0x7f, 0xff, + 0xff, 0xff, + 0xf7, 0xfc, + 0xf7, 0xf0, + 0xff, 0xf0, + 0xf7, 0xf0, + 0xe7, 0xf0, + 0xf, 0xf8, + 0x1f, 0xfc, + 0x1f, 0x7c, +}; + +const unsigned char XC_hand1[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 2, /* y,x of hotspot */ + /* data */ + 0x30, 0x0, + 0x3c, 0x0, + 0xf, 0x0, + 0x7, 0x80, + 0x3, 0xc0, + 0x7, 0xe0, + 0xf, 0xf0, + 0x7, 0xf4, + 0xf, 0xfe, + 0xf, 0xfa, + 0x7, 0xe0, + 0x3, 0xe0, + 0x0, 0x52, + 0x0, 0x46, + 0x0, 0x2c, + 0x0, 0x18, + /* mask */ + 0xb8, 0x0, + 0x3e, 0x0, + 0x1f, 0x80, + 0xf, 0xc0, + 0x7, 0xe0, + 0xf, 0xf0, + 0x1f, 0xfc, + 0x1f, 0xfe, + 0x1f, 0xfe, + 0x1f, 0xfe, + 0xf, 0xfe, + 0x7, 0xfe, + 0x3, 0xfe, + 0x0, 0xfe, + 0x0, 0x7e, + 0x0, 0x3c, +}; + +const unsigned char XC_hand2[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 15, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x1, 0xfe, + 0x2, 0x1, + 0x4, 0x7e, + 0x8, 0x8, + 0x8, 0x70, + 0x8, 0x8, + 0x14, 0x70, + 0x22, 0x8, + 0x41, 0x30, + 0x20, 0xc0, + 0x12, 0x40, + 0x8, 0x80, + 0x5, 0x0, + 0x2, 0x0, + 0x0, 0x0, + /* mask */ + 0x1, 0xfe, + 0x3, 0xff, + 0x7, 0xff, + 0xf, 0xff, + 0x1f, 0xfe, + 0x1f, 0xf8, + 0x1f, 0xfc, + 0x3f, 0xf8, + 0x7f, 0xfc, + 0xff, 0xf8, + 0x7f, 0xf0, + 0x3f, 0xe0, + 0x1f, 0xc0, + 0xf, 0x80, + 0x7, 0x0, + 0x2, 0x0, +}; + +const unsigned char XC_heart[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 9, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x1f, 0x7c, + 0x31, 0xc6, + 0x60, 0x83, + 0x40, 0x1, + 0x40, 0x1, + 0x40, 0x1, + 0x40, 0x1, + 0x60, 0x3, + 0x30, 0x6, + 0x18, 0xc, + 0xc, 0x18, + 0x6, 0x30, + 0x3, 0x60, + 0x1, 0xc0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x9f, 0x7c, + 0x3f, 0xfe, + 0x71, 0xc7, + 0x60, 0x83, + 0x60, 0x3, + 0x60, 0x3, + 0x61, 0x43, + 0x70, 0x87, + 0x38, 0xe, + 0x1c, 0x1c, + 0xe, 0x38, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x0, 0x0, +}; + +const unsigned char XC_icon[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0xff, 0xff, + 0xaa, 0xab, + 0xd5, 0x55, + 0xaa, 0xab, + 0xd0, 0x5, + 0xa0, 0xb, + 0xd0, 0x5, + 0xa0, 0xb, + 0xd0, 0x5, + 0xa0, 0xb, + 0xd0, 0x5, + 0xa0, 0xb, + 0xd5, 0x55, + 0xaa, 0xab, + 0xd5, 0x55, + 0xff, 0xff, + /* mask */ + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, +}; + +const unsigned char XC_iron_cross[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x3f, 0xfc, + 0x1f, 0xf8, + 0x4f, 0xf2, + 0x67, 0xe6, + 0x73, 0xce, + 0x79, 0x9e, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x79, 0x9e, + 0x73, 0xce, + 0x67, 0xe6, + 0x4f, 0xf2, + 0x1f, 0xf8, + 0x3f, 0xfc, + 0x0, 0x0, + /* mask */ + 0x3f, 0xfc, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x7f, 0xfe, + 0x7f, 0xfe, + 0x3f, 0xfc, +}; + +const unsigned char XC_left_ptr[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 12, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x10, + 0x0, 0x30, + 0x0, 0x70, + 0x0, 0xf0, + 0x1, 0xf0, + 0x3, 0xf0, + 0x7, 0xf0, + 0xf, 0xf0, + 0x1, 0xf0, + 0x1, 0xb0, + 0x3, 0x10, + 0x3, 0x0, + 0x6, 0x0, + 0x6, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x18, + 0x0, 0x38, + 0x0, 0x78, + 0x0, 0xf8, + 0x1, 0xf8, + 0x3, 0xf8, + 0x7, 0xf8, + 0xf, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x3, 0xf8, + 0x7, 0xb8, + 0x7, 0x98, + 0xf, 0x0, + 0xf, 0x0, + 0x6, 0x0, +}; + +const unsigned char XC_left_side[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 15, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x6, + 0x0, 0x6, + 0x1, 0x6, + 0x0, 0x86, + 0x0, 0x46, + 0x0, 0x26, + 0x7f, 0xf6, + 0x0, 0x26, + 0x0, 0x46, + 0x0, 0x86, + 0x1, 0x6, + 0x0, 0x6, + 0x0, 0x6, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0xf, + 0x0, 0xf, + 0x3, 0xf, + 0x3, 0x8f, + 0x1, 0xcf, + 0x0, 0xef, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x0, 0xef, + 0x1, 0xcf, + 0x3, 0x8f, + 0x3, 0xf, + 0x0, 0xf, + 0x0, 0xf, + 0x0, 0x0, +}; + +const unsigned char XC_left_tee[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 13, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x80, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x0, + /* mask */ + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, +}; + +const unsigned char XC_leftbutton[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0xc0, 0x1, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xa2, 0x22, + 0xaa, 0xa2, + 0xaa, 0xa2, + 0xaa, 0xa2, + 0xaa, 0xa2, + 0xa2, 0x22, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xc0, 0x1, + /* mask */ + 0xbf, 0xfe, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x3f, 0xfe, +}; + +const unsigned char XC_ll_angle[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 12, 13, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x80, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_lr_angle[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 12, 4, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x98, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_man[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 5, 2, /* y,x of hotspot */ + /* data */ + 0x1, 0xc0, + 0xf, 0x78, + 0x1, 0x40, + 0x0, 0x81, + 0xe1, 0xc2, + 0xd2, 0x24, + 0xe, 0xb8, + 0x2, 0xa0, + 0x2, 0x20, + 0x1, 0x40, + 0x2, 0x20, + 0x4, 0x90, + 0x9, 0x48, + 0xa, 0x28, + 0x3c, 0x1e, + 0xfc, 0x1f, + /* mask */ + 0x7, 0xf8, + 0xf, 0xfc, + 0x1f, 0xfc, + 0x41, 0xc3, + 0xe3, 0xe7, + 0xff, 0xfe, + 0xdf, 0xfc, + 0xf, 0xf8, + 0x7, 0xe0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0x1f, 0xfc, + 0x3f, 0x7e, + 0xfe, 0x3f, + 0xfe, 0x3f, +}; + +const unsigned char XC_middlebutton[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0xc0, 0x1, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xa2, 0x22, + 0xaa, 0x2a, + 0xaa, 0x2a, + 0xaa, 0x2a, + 0xaa, 0x2a, + 0xa2, 0x22, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xc0, 0x1, + /* mask */ + 0xbf, 0xfe, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x3f, 0xfe, +}; + +const unsigned char XC_mouse[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 2, 11, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0xe0, + 0x0, 0x30, + 0x0, 0x60, + 0x0, 0xc0, + 0x1f, 0xfe, + 0x20, 0x1, + 0x6c, 0xcd, + 0x6c, 0xcd, + 0x6c, 0xcd, + 0x60, 0x1, + 0x60, 0x1, + 0x38, 0x6, + 0x6, 0x18, + 0x1, 0xe0, + 0x0, 0x0, + /* mask */ + 0x1, 0xf0, + 0x0, 0x78, + 0x0, 0xf0, + 0x0, 0xe0, + 0x1f, 0xfe, + 0x3f, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xef, 0xfc, + 0x7, 0xf8, + 0x3, 0xf0, + 0x1, 0xe0, +}; + +const unsigned char XC_pencil[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 15, 3, /* y,x of hotspot */ + /* data */ + 0x40, 0x38, + 0x0, 0x44, + 0x0, 0xc4, + 0x1, 0x48, + 0x1, 0x78, + 0x2, 0x10, + 0x2, 0x20, + 0x4, 0x20, + 0x4, 0x40, + 0x8, 0xc0, + 0x8, 0x80, + 0x11, 0x0, + 0x1e, 0x0, + 0x1c, 0x0, + 0x18, 0x0, + 0x10, 0x0, + /* mask */ + 0x80, 0x7e, + 0x0, 0xfe, + 0x1, 0xfe, + 0x1, 0xfc, + 0x3, 0xf8, + 0x3, 0xf8, + 0x7, 0xf0, + 0x7, 0xe0, + 0xf, 0xe0, + 0xf, 0xc0, + 0x1f, 0xc0, + 0x3f, 0x80, + 0x3f, 0x0, + 0x3e, 0x0, + 0x3c, 0x0, + 0x38, 0x0, +}; + +const unsigned char XC_pirate[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 12, 8, /* y,x of hotspot */ + /* data */ + 0x1, 0xe0, + 0x3, 0xf0, + 0x7, 0xf8, + 0xc, 0xcc, + 0xc, 0xcc, + 0x7, 0xf8, + 0x3, 0xf0, + 0x1, 0xe0, + 0x21, 0xe1, + 0x61, 0xe1, + 0x10, 0xc2, + 0xe, 0x1c, + 0x1, 0xe0, + 0x47, 0xf8, + 0x7c, 0xf, + 0x20, 0x1, + /* mask */ + 0x3, 0xf0, + 0x7, 0xf8, + 0xf, 0xfc, + 0x1f, 0xfe, + 0x1f, 0xfe, + 0xf, 0xfc, + 0x7, 0xf8, + 0x83, 0xf1, + 0xe3, 0xf1, + 0xf3, 0xf3, + 0x39, 0xef, + 0x1e, 0x1e, + 0x1, 0xe0, + 0xc7, 0xfe, + 0xff, 0xff, + 0x7c, 0xf, +}; + +const unsigned char XC_plus[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x81, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_question_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x83, 0xe0, + 0x7, 0xf0, + 0xe, 0x38, + 0xc, 0x18, + 0xc, 0x38, + 0xe, 0x30, + 0x7, 0x0, + 0x3, 0xc0, + 0x1, 0xc0, + 0x1, 0x40, + 0x1, 0x40, + 0x7, 0x70, + 0x3, 0x60, + 0x1, 0xc0, + 0x0, 0x80, + 0x0, 0x0, + /* mask */ + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0x1f, 0xfc, + 0x1e, 0x3c, + 0x1e, 0x7c, + 0x1f, 0x78, + 0xf, 0xf0, + 0x7, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, +}; + +const unsigned char XC_right_ptr[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 5, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x8, 0x0, + 0xc, 0x0, + 0xe, 0x0, + 0xf, 0x0, + 0xf, 0x80, + 0xf, 0xc0, + 0xf, 0xe0, + 0xf, 0xf0, + 0xf, 0x80, + 0xd, 0x80, + 0x8, 0xc0, + 0x0, 0xc0, + 0x0, 0x60, + 0x0, 0x60, + 0x0, 0x0, + /* mask */ + 0x18, 0x0, + 0x1c, 0x0, + 0x1e, 0x0, + 0x1f, 0x0, + 0x1f, 0x80, + 0x1f, 0xc0, + 0x1f, 0xe0, + 0x1f, 0xf0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x1f, 0xc0, + 0x1d, 0xe0, + 0x19, 0xe0, + 0x0, 0xf0, + 0x0, 0xf0, + 0x0, 0x60, +}; + +const unsigned char XC_right_side[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 2, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x60, 0x0, + 0x60, 0x0, + 0x60, 0x80, + 0x61, 0x0, + 0x62, 0x0, + 0x64, 0x0, + 0x6f, 0xfe, + 0x64, 0x0, + 0x62, 0x0, + 0x61, 0x0, + 0x60, 0x80, + 0x60, 0x0, + 0x60, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0xf0, 0x0, + 0xf0, 0x0, + 0xf0, 0xc0, + 0xf1, 0xc0, + 0xf3, 0x80, + 0xf7, 0x0, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xf7, 0x0, + 0xf3, 0x80, + 0xf1, 0xc0, + 0xf0, 0xc0, + 0xf0, 0x0, + 0xf0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_right_tee[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 4, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x98, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x0, 0x0, + /* mask */ + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, +}; + +const unsigned char XC_rightbutton[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0xc0, 0x1, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xa2, 0x22, + 0xa2, 0xaa, + 0xa2, 0xaa, + 0xa2, 0xaa, + 0xa2, 0xaa, + 0xa2, 0x22, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xbf, 0xfe, + 0xc0, 0x1, + /* mask */ + 0xbf, 0xfe, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x3f, 0xfe, +}; + +const unsigned char XC_rtl_logo[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 9, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x7f, 0xfe, + 0x44, 0x2, + 0x44, 0x2, + 0x44, 0x2, + 0x47, 0xfe, + 0x44, 0x22, + 0x44, 0x22, + 0x44, 0x22, + 0x44, 0x22, + 0x7f, 0xe2, + 0x40, 0x22, + 0x40, 0x22, + 0x40, 0x22, + 0x7f, 0xfe, + 0x0, 0x0, + /* mask */ + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xee, 0x7, + 0xef, 0xff, + 0xef, 0xff, + 0xef, 0xff, + 0xee, 0x77, + 0xee, 0x77, + 0xff, 0xf7, + 0xff, 0xf7, + 0xff, 0xf7, + 0xe0, 0x77, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, +}; + +const unsigned char XC_sailboat[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x42, 0x0, + 0x2, 0x0, + 0x6, 0x80, + 0x6, 0x80, + 0x6, 0xc0, + 0xe, 0xc0, + 0xe, 0xe0, + 0xe, 0xe0, + 0x1e, 0xf0, + 0x1e, 0xf0, + 0x1e, 0xf8, + 0x3e, 0xf8, + 0x1c, 0x7c, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x3, 0x0, + 0x7, 0x0, + 0x7, 0x80, + 0xf, 0xc0, + 0xf, 0xc0, + 0xf, 0xe0, + 0x1f, 0xe0, + 0x1f, 0xf0, + 0x1f, 0xf0, + 0x3f, 0xf8, + 0x3f, 0xf8, + 0x3f, 0xfc, + 0xff, 0xfc, + 0xff, 0xfe, + 0x1f, 0xff, + 0x7, 0xfe, +}; + +const unsigned char XC_sb_down_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 15, 8, /* y,x of hotspot */ + /* data */ + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x0, 0x80, + 0x0, 0x0, + /* mask */ + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0xf, 0xf8, + 0xf, 0xf8, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x0, 0x80, +}; + +const unsigned char XC_sb_h_double_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x8, 0x8, + 0x18, 0xc, + 0x3f, 0xfe, + 0x78, 0xf, + 0x3f, 0xfe, + 0x18, 0xc, + 0x8, 0x8, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x8c, 0x18, + 0x1c, 0x1c, + 0x3f, 0xfe, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x3f, 0xfe, + 0x1c, 0x1c, + 0xc, 0x18, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_sb_left_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 16, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x8, + 0x0, 0xc, + 0x7f, 0xfe, + 0x0, 0xf, + 0x7f, 0xfe, + 0x0, 0xc, + 0x0, 0x8, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x30, + 0x0, 0x38, + 0xff, 0xfc, + 0xff, 0xfe, + 0xff, 0xff, + 0xff, 0xfe, + 0xff, 0xfc, + 0x0, 0x38, + 0x0, 0x30, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_sb_right_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 0, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x8, 0x0, + 0x18, 0x0, + 0x3f, 0xff, + 0x78, 0x0, + 0x3f, 0xff, + 0x18, 0x0, + 0x8, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0xc, 0x0, + 0x1c, 0x0, + 0x3f, 0xff, + 0x7f, 0xff, + 0xff, 0xff, + 0x7f, 0xff, + 0x3f, 0xff, + 0x1c, 0x0, + 0xc, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_sb_up_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x80, + 0x9, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x0, 0x0, + /* mask */ + 0x0, 0x80, + 0x1, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0xf, 0xf8, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, +}; + +const unsigned char XC_sb_v_double_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x80, + 0x9, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x0, 0x80, + 0x0, 0x0, + /* mask */ + 0x1, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0xf, 0xf8, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0x3, 0xe0, + 0xf, 0xf8, + 0xf, 0xf8, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x0, 0x0, +}; + +const unsigned char XC_shuttle[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 5, /* y,x of hotspot */ + /* data */ + 0x84, 0x0, + 0xe, 0x0, + 0x1f, 0x0, + 0x7b, 0x80, + 0x7b, 0xa0, + 0x7b, 0x90, + 0x7b, 0x88, + 0x7b, 0x88, + 0x7b, 0x88, + 0x7b, 0x88, + 0x7b, 0x8c, + 0x7b, 0x8e, + 0x7b, 0xbf, + 0x11, 0x18, + 0x1e, 0x0, + 0xc, 0x0, + /* mask */ + 0x1c, 0x0, + 0x3e, 0x0, + 0x7f, 0x0, + 0xff, 0x0, + 0xff, 0x60, + 0xff, 0x70, + 0xff, 0x78, + 0xff, 0x78, + 0xff, 0x78, + 0xff, 0x78, + 0xff, 0x7c, + 0xff, 0x7e, + 0xff, 0x7f, + 0x7f, 0x7e, + 0x7e, 0x30, + 0x3c, 0x0, +}; + +const unsigned char XC_sizing[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x81, 0xfe, + 0x0, 0x2, + 0x0, 0x2, + 0x0, 0x2, + 0x7, 0xe2, + 0x4, 0x22, + 0x44, 0x22, + 0x44, 0x22, + 0x44, 0x20, + 0x47, 0xe0, + 0x48, 0x0, + 0x50, 0x0, + 0x60, 0x0, + 0x7f, 0x80, + 0x0, 0x0, + /* mask */ + 0x3, 0xff, + 0x3, 0xff, + 0x3, 0xff, + 0x0, 0x7, + 0xf, 0xf7, + 0xf, 0xf7, + 0xef, 0xf7, + 0xee, 0x77, + 0xee, 0x77, + 0xef, 0xf7, + 0xef, 0xf0, + 0xff, 0xf0, + 0xf8, 0x0, + 0xff, 0xc0, + 0xff, 0xc0, + 0xff, 0xc0, +}; + +const unsigned char XC_spider[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 10, /* y,x of hotspot */ + /* data */ + 0x8, 0x4, + 0x4, 0x8, + 0x4, 0x8, + 0x2, 0x10, + 0x2, 0x10, + 0xe1, 0xe1, + 0x19, 0xe6, + 0x7, 0xf8, + 0x7, 0xf8, + 0x19, 0xe6, + 0xe1, 0xe1, + 0x2, 0x10, + 0x2, 0x10, + 0x4, 0x8, + 0x4, 0x8, + 0x8, 0x4, + /* mask */ + 0x18, 0x6, + 0xc, 0xc, + 0x4, 0x8, + 0x6, 0x18, + 0x83, 0xf1, + 0xf3, 0xf3, + 0x3b, 0xf6, + 0xf, 0xfc, + 0x7, 0xfc, + 0x1f, 0xf6, + 0xf3, 0xf3, + 0x83, 0xf1, + 0x2, 0x18, + 0x6, 0x18, + 0xc, 0xc, + 0x18, 0x6, +}; + +const unsigned char XC_spraycan[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 2, 4, /* y,x of hotspot */ + /* data */ + 0x98, 0x0, + 0x2, 0x0, + 0x18, 0xb0, + 0x2, 0x78, + 0x18, 0x58, + 0x0, 0xfc, + 0x0, 0x84, + 0x0, 0x9c, + 0x0, 0x94, + 0x0, 0x9c, + 0x0, 0x94, + 0x0, 0x9c, + 0x0, 0x9c, + 0x0, 0x84, + 0x0, 0x84, + 0x0, 0xfc, + /* mask */ + 0x30, 0x0, + 0x34, 0x60, + 0x35, 0xf0, + 0x35, 0xf0, + 0x35, 0xf8, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, + 0x3, 0xfc, +}; + +const unsigned char XC_star[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x80, 0x80, + 0x1, 0x40, + 0x1, 0x40, + 0x1, 0x40, + 0x2, 0x20, + 0x2, 0x20, + 0x2, 0x20, + 0x1c, 0x9c, + 0x60, 0x3, + 0x1c, 0x1c, + 0x4, 0x90, + 0x9, 0x48, + 0x12, 0x24, + 0x14, 0x14, + 0x18, 0xc, + 0x10, 0x4, + /* mask */ + 0x0, 0x80, + 0x1, 0xc0, + 0x1, 0xc0, + 0x3, 0x60, + 0x3, 0x60, + 0x6, 0x30, + 0x1e, 0x38, + 0x7c, 0x9f, + 0xe0, 0x3, + 0x7c, 0x1f, + 0x1c, 0x9c, + 0x19, 0xcc, + 0x33, 0x66, + 0x36, 0x36, + 0x3c, 0x1e, + 0x38, 0xe, +}; + +const unsigned char XC_target[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x81, 0xc0, + 0x7, 0xf0, + 0xe, 0x38, + 0x18, 0xc, + 0x30, 0x6, + 0x60, 0x83, + 0x61, 0x43, + 0x60, 0x83, + 0x30, 0x6, + 0x18, 0xc, + 0xe, 0x38, + 0x7, 0xf0, + 0x1, 0xc0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0x1e, 0x3c, + 0x38, 0xe, + 0x70, 0x87, + 0xe1, 0xc3, + 0xe3, 0x63, + 0xe1, 0xc3, + 0x70, 0x87, + 0x38, 0xe, + 0x1e, 0x3c, + 0xf, 0xf8, + 0x3, 0xe0, + 0x0, 0x0, +}; + +const unsigned char XC_tcross[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 7, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0xc0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x3f, 0xfe, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x0, 0x0, +}; + +const unsigned char XC_top_left_arrow[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 15, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x80, 0x6, + 0x0, 0x1e, + 0x0, 0x7c, + 0x1, 0xfc, + 0x7, 0xf8, + 0x1f, 0xf8, + 0x1, 0xf0, + 0x1, 0xf0, + 0x2, 0x60, + 0x4, 0x60, + 0x8, 0x40, + 0x10, 0x40, + 0x20, 0x0, + 0x40, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x7, + 0x0, 0x1f, + 0x0, 0x7f, + 0x1, 0xfe, + 0x7, 0xfe, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xf8, + 0x3, 0xf8, + 0x7, 0xf0, + 0xe, 0xf0, + 0x1c, 0xe0, + 0x38, 0xe0, + 0x70, 0xe0, + 0xe0, 0x0, + 0xc0, 0x0, +}; + +const unsigned char XC_top_left_corner[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 15, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0xff, 0xfe, + 0x7f, 0xfe, + 0x0, 0x6, + 0x0, 0x6, + 0x0, 0x6, + 0x1f, 0xc6, + 0x0, 0xc6, + 0x1, 0x46, + 0x2, 0x46, + 0x4, 0x46, + 0x8, 0x46, + 0x10, 0x46, + 0x0, 0x6, + 0x0, 0x6, + 0x0, 0x0, + /* mask */ + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x0, 0xf, + 0x3f, 0xef, + 0x3f, 0xef, + 0x3f, 0xef, + 0x3, 0xef, + 0x7, 0xef, + 0xe, 0xef, + 0x1c, 0xef, + 0x38, 0xef, + 0x30, 0xef, + 0x0, 0xf, + 0x0, 0xf, +}; + +const unsigned char XC_top_right_corner[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 2, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0xff, 0xfe, + 0x7f, 0xfe, + 0x60, 0x0, + 0x60, 0x0, + 0x60, 0x0, + 0x63, 0xf8, + 0x63, 0x0, + 0x62, 0x80, + 0x62, 0x40, + 0x62, 0x20, + 0x62, 0x10, + 0x62, 0x8, + 0x60, 0x0, + 0x60, 0x0, + 0x0, 0x0, + /* mask */ + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xf0, 0x0, + 0xf7, 0xfc, + 0xf7, 0xfc, + 0xf7, 0xfc, + 0xf7, 0xc0, + 0xf7, 0xe0, + 0xf7, 0x70, + 0xf7, 0x38, + 0xf7, 0x1c, + 0xf7, 0xc, + 0xf0, 0x0, + 0xf0, 0x0, +}; + +const unsigned char XC_top_side[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 1, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0xff, 0xfe, + 0x3f, 0xfe, + 0x0, 0x0, + 0x0, 0x80, + 0x1, 0xc0, + 0x2, 0xa0, + 0x4, 0x90, + 0x8, 0x88, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x0, + /* mask */ + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x7f, 0xff, + 0x1, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0x1d, 0xdc, + 0x19, 0xcc, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, +}; + +const unsigned char XC_top_tee[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 3, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0xff, 0xfe, + 0x7f, 0xfe, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x1, 0x80, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x3, 0xc0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_trek[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 0, 8, /* y,x of hotspot */ + /* data */ + 0x8, 0x80, + 0x8, 0x0, + 0x1, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0x7, 0x70, + 0x7, 0xf0, + 0x3, 0xe0, + 0x1, 0xc0, + 0x0, 0x80, + 0x5, 0xd0, + 0x6, 0xb0, + 0x4, 0x90, + 0x4, 0x10, + 0x4, 0x10, + 0x4, 0x10, + /* mask */ + 0x1, 0xc0, + 0x1, 0xc0, + 0x3, 0xe0, + 0x7, 0xf0, + 0xf, 0xf8, + 0xf, 0xf8, + 0xf, 0xf8, + 0x7, 0xf0, + 0x3, 0xe0, + 0x5, 0xd0, + 0xf, 0xf8, + 0xf, 0xf8, + 0xf, 0xf8, + 0xe, 0xb8, + 0xe, 0xb8, + 0xe, 0x38, +}; + +const unsigned char XC_ul_angle[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 3, 13, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x18, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x3c, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_umbrella[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 3, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x89, 0x10, + 0x14, 0x40, + 0x65, 0x92, + 0x13, 0xe4, + 0xc, 0x98, + 0x30, 0x86, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x2, 0x80, + 0x2, 0x80, + 0x1, 0x0, + 0x0, 0x0, + /* mask */ + 0x76, 0xe8, + 0xdf, 0xfb, + 0x3f, 0xfd, + 0xff, 0xfe, + 0x3f, 0xff, + 0xff, 0xff, + 0x79, 0xcf, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x7, 0xc0, + 0x7, 0xc0, + 0x7, 0xc0, + 0x7, 0xc0, + 0x3, 0x80, +}; + +const unsigned char XC_ur_angle[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 3, 4, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x1f, 0xf8, + 0x1f, 0xf8, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x18, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + /* mask */ + 0x0, 0x0, + 0x0, 0x0, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3f, 0xfc, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x3c, 0x0, + 0x0, 0x0, + 0x0, 0x0, +}; + +const unsigned char XC_watch[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 9, 1, /* y,x of hotspot */ + /* data */ + 0x7, 0xf8, + 0x7, 0xf8, + 0x7, 0xf8, + 0xf, 0xfc, + 0x18, 0x86, + 0x30, 0x83, + 0xe0, 0x81, + 0xe1, 0xc1, + 0xe1, 0xc1, + 0xe0, 0x21, + 0x30, 0x13, + 0x18, 0x6, + 0xf, 0xfc, + 0x7, 0xf8, + 0x7, 0xf8, + 0x7, 0xf8, + /* mask */ + 0xf, 0xfc, + 0xf, 0xfc, + 0xf, 0xfc, + 0x1f, 0xfe, + 0x3f, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0xff, 0xff, + 0x3f, 0xff, + 0x1f, 0xfe, + 0xf, 0xfc, + 0xf, 0xfc, + 0xf, 0xfc, +}; + +const unsigned char XC_xterm[] = { + 16, /* 16x16 size */ + 1, /* 1 bit depth */ + 8, 8, /* y,x of hotspot */ + /* data */ + 0x0, 0x0, + 0xf, 0x70, + 0x9, 0xc0, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x0, 0x80, + 0x1, 0xc0, + 0x7, 0x70, + 0x0, 0x0, + /* mask */ + 0xf, 0x78, + 0xf, 0xf8, + 0xf, 0xf8, + 0x3, 0xe0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x1, 0xc0, + 0x3, 0xe0, + 0xf, 0xf8, + 0xf, 0xf8, + 0xf, 0x78, +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glutDstr.cpp b/xc/extras/Mesa/src-glut.beos/glutDstr.cpp new file mode 100644 index 000000000..c594cfdaf --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutDstr.cpp @@ -0,0 +1,79 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutDstr.cpp + * + * DESCRIPTION: convert display string into a Be options variable + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <string.h> +#include <stdlib.h> +#include "glutint.h" +#include "glutState.h" + +/*********************************************************** + * FUNCTION: glutInitDisplayString + * + * DESCRIPTION: sets the display string variable + ***********************************************************/ +void APIENTRY +glutInitDisplayString(const char *string) +{ + if (gState.displayString) { + free(gState.displayString); + } + if (string) { + gState.displayString = strdup(string); + if (!gState.displayString) + __glutFatalError("out of memory."); + } else + gState.displayString = NULL; +} + +/*********************************************************** + * FUNCTION: __glutConvertDisplayModeFromString + * + * DESCRIPTION: converts the current display mode into a BGLView + * display mode, printing warnings as appropriate. + * + * PARAMETERS: if options is non-NULL, the current display mode is + * returned in it. + * + * RETURNS: 1 if the current display mode is possible, else 0 + ***********************************************************/ +int __glutConvertDisplayModeFromString(unsigned long *options) { + ulong newoptions = BGL_DOUBLE; + gState.swapHack = true; // assume single buffered + + char *word = strtok(gState.displayString, " \t"); + do { + char *cstr = strpbrk(word, "=><!~"); + if(cstr) + *cstr = '\0'; + // this is the most minimal possible parser. scan for + // options that we support, and add them to newoptions + // this will certainly cause it to accept things that we + // don't actually support, but if we don't support it, the + // program's probably not going to work anyway. + if(!strcmp(word, "alpha")) { + newoptions |= BGL_ALPHA; + } else if((!strcmp(word, "acc")) || (!strcmp(word, "acca"))) { + newoptions |= BGL_ACCUM; + } else if(!strcmp(word, "depth")) { + newoptions |= BGL_DEPTH; + } else if(!strcmp(word, "double")) { + gState.swapHack = false; + } else if(!strcmp(word, "stencil")) { + newoptions |= BGL_STENCIL; + } + } while((word = strtok(0, " \t")) != 0); + + if (options) + *options = newoptions; + + return 1; // assume we support it +} diff --git a/xc/extras/Mesa/src-glut.beos/glutEvent.cpp b/xc/extras/Mesa/src-glut.beos/glutEvent.cpp new file mode 100644 index 000000000..20b1cad23 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutEvent.cpp @@ -0,0 +1,721 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutEvent.cpp + * + * DESCRIPTION: here it is, the BeOS GLUT event loop + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include "glutint.h" +#include "glutState.h" +#include "glutBlocker.h" + +/*********************************************************** + * CLASS: GLUTtimer + * + * DESCRIPTION: list of timer callbacks + ***********************************************************/ +struct GLUTtimer { + GLUTtimer *next; // list of timers + bigtime_t timeout; // time to be called + GLUTtimerCB func; // function to call + int value; // value +}; + +/*********************************************************** + * Private variables + ***********************************************************/ +static GLUTtimer *__glutTimerList = 0; // list of timer callbacks +static GLUTtimer *freeTimerList = 0; + +/*********************************************************** + * FUNCTION: glutTimerFunc (7.19) + * + * DESCRIPTION: register a new timer callback + ***********************************************************/ +void APIENTRY +glutTimerFunc(unsigned int interval, GLUTtimerCB timerFunc, int value) +{ + GLUTtimer *timer, *other; + GLUTtimer **prevptr; + + if (!timerFunc) + return; + + if (freeTimerList) { + timer = freeTimerList; + freeTimerList = timer->next; + } else { + timer = new GLUTtimer(); + if (!timer) + __glutFatalError("out of memory."); + } + + timer->func = timerFunc; + timer->value = value; + timer->next = NULL; + timer->timeout = system_time() + (interval*1000); // 1000 ticks in a millisecond + prevptr = &__glutTimerList; + other = *prevptr; + while (other && (other->timeout < timer->timeout)) { + prevptr = &other->next; + other = *prevptr; + } + timer->next = other; + *prevptr = timer; +} + +/*********************************************************** + * FUNCTION: handleTimeouts + * + * DESCRIPTION: private function to handle outstanding timeouts + ***********************************************************/ +static void +handleTimeouts(void) +{ + bigtime_t now; + GLUTtimer *timer; + + /* Assumption is that __glutTimerList is already determined + to be non-NULL. */ + now = system_time(); + while (__glutTimerList->timeout <= now) { + timer = __glutTimerList; + if(gState.currentWindow) + gState.currentWindow->LockGL(); + timer->func(timer->value); + if(gState.currentWindow) + gState.currentWindow->UnlockGL(); + __glutTimerList = timer->next; + timer->next = freeTimerList; + freeTimerList = timer; + if (!__glutTimerList) + break; + } +} + + +/*********************************************************** + * FUNCTION: processEventsAndTimeouts + * + * DESCRIPTION: clear gBlock, then check all windows for events + ***********************************************************/ +static void +processEventsAndTimeouts(void) +{ + gBlock.WaitEvent(); // if there is already an event, returns + // immediately, otherwise wait forever + gBlock.ClearEvents(); + + if (gState.currentWindow) + gState.currentWindow->LockGL(); + for(int i=0; i<gState.windowListSize; i++) { + if (gState.windowList[i]) { + GlutWindow *win = gState.windowList[i]; + win->Window()->Lock(); + // NOTE: we can use win as a shortcut for gState.windowList[i] + // in callbacks, EXCEPT we need to check the original variable + // after each callback to make sure the window hasn't been destroyed + if (win->anyevents) { + win->anyevents = false; + if (win->reshapeEvent) { + win->reshapeEvent = false; + __glutSetWindow(win); + win->reshape(win->m_width, win->m_height); + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->displayEvent) { + win->displayEvent = false; + __glutSetWindow(win); + win->display(); + if (gState.windowList[i] && win->swapHack) { + // fake single buffering by swapping buffers + __glutSetWindow(win); + win->SwapBuffers(); + } + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->mouseEvent) { + win->mouseEvent = false; + __glutSetWindow(win); + if (win->mouse) { + gState.modifierKeys = win->modifierKeys; + win->mouse(win->button, win->mouseState, win->mouseX, win->mouseY); + gState.modifierKeys = ~0; + } + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->menuEvent) { + win->menuEvent = false; + __glutSetWindow(win); + GlutMenu *menu = __glutGetMenuByNum(win->menuNumber); + if (menu) { + gState.currentMenu = menu; + menu->select(win->menuValue); + } + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->statusEvent) { + win->statusEvent = false; + __glutSetWindow(win); + if (gState.menuStatus) { + gState.currentMenu = __glutGetMenuByNum(win->menuNumber); + gState.menuStatus(win->menuStatus, win->statusX, win->statusY); + } + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->motionEvent) { + win->motionEvent = false; + __glutSetWindow(win); + if (win->motion) + win->motion(win->motionX, win->motionY); + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->passiveEvent) { + win->passiveEvent = false; + __glutSetWindow(win); + if (win->passive) + win->passive(win->passiveX, win->passiveY); + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->keybEvent) { + win->keybEvent = false; + __glutSetWindow(win); + if (win->keyboard) { + gState.modifierKeys = win->modifierKeys; + win->keyboard(win->key, win->keyX, win->keyY); + gState.modifierKeys = ~0; + } + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->specialEvent) { + win->specialEvent = false; + __glutSetWindow(win); + if (win->special) { + gState.modifierKeys = win->modifierKeys; + win->special(win->specialKey, win->specialX, win->specialY); + gState.modifierKeys = ~0; + } + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->entryEvent) { + win->entryEvent = false; + __glutSetWindow(win); + if (win->entry) + win->entry(win->entryState); + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + + if (win->visEvent) { + win->visEvent = false; + __glutSetWindow(win); + if (win->visibility) + win->visibility(win->visState); + } + if (!gState.windowList[i]) + continue; // window was destroyed by callback! + } + if(gState.windowList[i]) // window hasn't been destroyed + win->Window()->Unlock(); + } + } + if (gState.currentWindow) + gState.currentWindow->UnlockGL(); + + // This code isn't necessary since BGLView automatically traps errors +#if 0 + if(gState.debug) { + for(int i=0; i<gState.windowListSize; i++) { + if (gState.windowList[i]) { + gState.windowList[i]->LockGL(); + glutReportErrors(); + gState.windowList[i]->UnlockGL(); + } + } + } +#endif + if (__glutTimerList) { + handleTimeouts(); + } +} + +/*********************************************************** + * FUNCTION: waitForSomething + * + * DESCRIPTION: use gBlock to wait for a new event or timeout + ***********************************************************/ +static void +waitForSomething(void) +{ + bigtime_t timeout = __glutTimerList->timeout; + bigtime_t now = system_time(); + + if (gBlock.PendingEvent()) + goto immediatelyHandleEvent; + + if(timeout>now) + gBlock.WaitEvent(timeout-now); + if (gBlock.PendingEvent()) { + immediatelyHandleEvent: + processEventsAndTimeouts(); + } else { + if (__glutTimerList) + handleTimeouts(); + } +} + +/*********************************************************** + * FUNCTION: idleWait + * + * DESCRIPTION: check for events, then call idle function + ***********************************************************/ +static void +idleWait(void) +{ + if (gBlock.PendingEvent()) { + processEventsAndTimeouts(); + } else { + if (__glutTimerList) + handleTimeouts(); + } + /* Make sure idle func still exists! */ + if(gState.currentWindow) + gState.currentWindow->LockGL(); + if (gState.idle) + gState.idle(); + if(gState.currentWindow) + gState.currentWindow->UnlockGL(); +} + +/*********************************************************** + * FUNCTION: glutMainLoop (3.1) + * + * DESCRIPTION: enter the event processing loop + ***********************************************************/ +void glutMainLoop() +{ + if (!gState.windowListSize) + __glutFatalUsage("main loop entered with no windows created."); + + if(gState.currentWindow) + gState.currentWindow->UnlockGL(); + + for (;;) { + if (gState.idle) { + idleWait(); + } else { + if (__glutTimerList) { + waitForSomething(); + } else { + processEventsAndTimeouts(); + } + } + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: KeyDown + * + * DESCRIPTION: handles keyboard and special events + ***********************************************************/ +void GlutWindow::KeyDown(const char *s, int32 slen) +{ + ulong aChar = s[0]; + BGLView::KeyDown(s,slen); + + BPoint p; + + switch (aChar) { + case B_FUNCTION_KEY: + switch(Window()->CurrentMessage()->FindInt32("key")) { + case B_F1_KEY: + aChar = GLUT_KEY_F1; + goto specialLabel; + case B_F2_KEY: + aChar = GLUT_KEY_F2; + goto specialLabel; + case B_F3_KEY: + aChar = GLUT_KEY_F3; + goto specialLabel; + case B_F4_KEY: + aChar = GLUT_KEY_F4; + goto specialLabel; + case B_F5_KEY: + aChar = GLUT_KEY_F5; + goto specialLabel; + case B_F6_KEY: + aChar = GLUT_KEY_F6; + goto specialLabel; + case B_F7_KEY: + aChar = GLUT_KEY_F7; + goto specialLabel; + case B_F8_KEY: + aChar = GLUT_KEY_F8; + goto specialLabel; + case B_F9_KEY: + aChar = GLUT_KEY_F9; + goto specialLabel; + case B_F10_KEY: + aChar = GLUT_KEY_F10; + goto specialLabel; + case B_F11_KEY: + aChar = GLUT_KEY_F11; + goto specialLabel; + case B_F12_KEY: + aChar = GLUT_KEY_F12; + goto specialLabel; + default: + return; + } + case B_LEFT_ARROW: + aChar = GLUT_KEY_LEFT; + goto specialLabel; + case B_UP_ARROW: + aChar = GLUT_KEY_UP; + goto specialLabel; + case B_RIGHT_ARROW: + aChar = GLUT_KEY_RIGHT; + goto specialLabel; + case B_DOWN_ARROW: + aChar = GLUT_KEY_DOWN; + goto specialLabel; + case B_PAGE_UP: + aChar = GLUT_KEY_PAGE_UP; + goto specialLabel; + case B_PAGE_DOWN: + aChar = GLUT_KEY_PAGE_DOWN; + goto specialLabel; + case B_HOME: + aChar = GLUT_KEY_HOME; + goto specialLabel; + case B_END: + aChar = GLUT_KEY_END; + goto specialLabel; + case B_INSERT: + aChar = GLUT_KEY_INSERT; +specialLabel: + if (special) { + anyevents = specialEvent = true; + GetMouse(&p,&m_buttons); + specialKey = aChar; + specialX = (int)p.x; + specialY = (int)p.y; + goto setModifiers; // set the modifier variable + } + return; + + default: + break; + } + + if (keyboard) { + anyevents = keybEvent = true; + GetMouse(&p,&m_buttons); + key = aChar; + keyX = (int)p.x; + keyY = (int)p.y; +setModifiers: + modifierKeys = 0; + uint32 beMod = Window()->CurrentMessage()->FindInt32("modifiers"); + if(beMod & B_SHIFT_KEY) + modifierKeys |= GLUT_ACTIVE_SHIFT; + if(beMod & B_CONTROL_KEY) + modifierKeys |= GLUT_ACTIVE_CTRL; + if(beMod & B_OPTION_KEY) { + // since the window traps B_COMMAND_KEY, we'll have to settle + // for the option key.. but we need to get the raw character, + // not the Unicode-enhanced version + key = Window()->CurrentMessage()->FindInt32("raw_char"); + modifierKeys |= GLUT_ACTIVE_ALT; + } + gBlock.NewEvent(); + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: MouseDown + * + * DESCRIPTION: handles mouse and menustatus events + ***********************************************************/ +void GlutWindow::MouseDown(BPoint point) +{ + BGLView::MouseDown(point); + MouseCheck(); +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: MouseCheck + * + * DESCRIPTION: checks for button state changes + ***********************************************************/ +void GlutWindow::MouseCheck() +{ + if (mouseEvent) + return; // we already have an outstanding mouse event + + BPoint point; + uint32 newButtons; + GetMouse(&point, &newButtons); + if (m_buttons != newButtons) { + if (newButtons&B_PRIMARY_MOUSE_BUTTON && !(m_buttons&B_PRIMARY_MOUSE_BUTTON)) { + button = GLUT_LEFT_BUTTON; + mouseState = GLUT_DOWN; + } else if (m_buttons&B_PRIMARY_MOUSE_BUTTON && !(newButtons&B_PRIMARY_MOUSE_BUTTON)) { + button = GLUT_LEFT_BUTTON; + mouseState = GLUT_UP; + } else if (newButtons&B_SECONDARY_MOUSE_BUTTON && !(m_buttons&B_SECONDARY_MOUSE_BUTTON)) { + button = GLUT_RIGHT_BUTTON; + mouseState = GLUT_DOWN; + } else if (m_buttons&B_SECONDARY_MOUSE_BUTTON && !(newButtons&B_SECONDARY_MOUSE_BUTTON)) { + button = GLUT_RIGHT_BUTTON; + mouseState = GLUT_UP; + } else if (newButtons&B_TERTIARY_MOUSE_BUTTON && !(m_buttons&B_TERTIARY_MOUSE_BUTTON)) { + button = GLUT_MIDDLE_BUTTON; + mouseState = GLUT_DOWN; + } else if (m_buttons&B_TERTIARY_MOUSE_BUTTON && !(newButtons&B_TERTIARY_MOUSE_BUTTON)) { + button = GLUT_MIDDLE_BUTTON; + mouseState = GLUT_UP; + } + } else { + return; // no change, return + } + m_buttons = newButtons; + + if (mouseState == GLUT_DOWN) { + BWindow *w = Window(); + GlutMenu *m = __glutGetMenuByNum(menu[button]); + if (m) { + if (gState.menuStatus) { + anyevents = statusEvent = true; + menuNumber = menu[button]; + menuStatus = GLUT_MENU_IN_USE; + statusX = (int)point.x; + statusY = (int)point.y; + gBlock.NewEvent(); + } + BRect bounds = w->Frame(); + point.x += bounds.left; + point.y += bounds.top; + GlutPopUp *bmenu = static_cast<GlutPopUp*>(m->CreateBMenu()); // start menu + bmenu->point = point; + bmenu->win = this; + thread_id menu_thread = spawn_thread(MenuThread, "menu thread", B_NORMAL_PRIORITY, bmenu); + resume_thread(menu_thread); + return; + } + } + + if (mouse) { + anyevents = mouseEvent = true; + mouseX = (int)point.x; + mouseY = (int)point.y; + modifierKeys = 0; + uint32 beMod = modifiers(); + if(beMod & B_SHIFT_KEY) + modifierKeys |= GLUT_ACTIVE_SHIFT; + if(beMod & B_CONTROL_KEY) + modifierKeys |= GLUT_ACTIVE_CTRL; + if(beMod & B_OPTION_KEY) { + modifierKeys |= GLUT_ACTIVE_ALT; + } + gBlock.NewEvent(); + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: MouseMoved + * + * DESCRIPTION: handles entry, motion, and passive events + ***********************************************************/ +void GlutWindow::MouseMoved(BPoint point, + ulong transit, const BMessage *msg) +{ + BGLView::MouseMoved(point,transit,msg); + + if(transit != B_INSIDE_VIEW) { + if (entry) { + anyevents = entryEvent = true; + gBlock.NewEvent(); + } + if (transit == B_ENTERED_VIEW) { + entryState = GLUT_ENTERED; + MakeFocus(); // make me the current focus + __glutSetCursor(cursor); + } else + entryState = GLUT_LEFT; + } + + MouseCheck(); + if(m_buttons) { + if(motion) { + anyevents = motionEvent = true; + motionX = (int)point.x; + motionY = (int)point.y; + gBlock.NewEvent(); + } + } else { + if(passive) { + anyevents = passiveEvent = true; + passiveX = (int)point.x; + passiveY = (int)point.y; + gBlock.NewEvent(); + } + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: FrameResized + * + * DESCRIPTION: handles reshape event + ***********************************************************/ +void GlutWindow::FrameResized(float width, float height) +{ + BGLView::FrameResized(width, height); + if (visState == GLUT_VISIBLE) { + anyevents = reshapeEvent = true; + m_width = (int)(width)+1; + m_height = (int)(height)+1; + gBlock.NewEvent(); + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: Draw + * + * DESCRIPTION: handles reshape and display events + ***********************************************************/ +void GlutWindow::Draw(BRect updateRect) +{ + BGLView::Draw(updateRect); + BRect frame = Frame(); + if (m_width != (frame.Width()+1) || m_height != (frame.Height()+1)) { + FrameResized(frame.Width(), frame.Height()); + } + if (visState == GLUT_VISIBLE) { + anyevents = displayEvent = true; + gBlock.NewEvent(); + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: Hide + * Show + * + * DESCRIPTION: handles visibility event + ***********************************************************/ +void GlutWindow::Hide() +{ + BGLView::Hide(); + if (visibility) { + anyevents = visEvent = true; + visState = GLUT_NOT_VISIBLE; + displayEvent = false; // display callbacks not allowed when hidden + gBlock.NewEvent(); + } +} + +void GlutWindow::Show() +{ + BGLView::Show(); + if (visibility) { + anyevents = visEvent = true; + visState = GLUT_VISIBLE; + gBlock.NewEvent(); + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: Pulse + * + * DESCRIPTION: handles mouse up event (MouseUp is broken) + ***********************************************************/ +void GlutWindow::Pulse() +{ + BGLView::Pulse(); + if (m_buttons) { // if there are buttons pressed + MouseCheck(); + } +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: ErrorCallback + * + * DESCRIPTION: handles GL error messages + ***********************************************************/ +void GlutWindow::ErrorCallback(GLenum errorCode) { + __glutWarning("GL error: %s", gluErrorString(errorCode)); +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: MenuThread + * + * DESCRIPTION: a new thread to launch popup menu, wait + * wait for response, then clean up afterwards and + * send appropriate messages + ***********************************************************/ +long GlutWindow::MenuThread(void *m) { + GlutPopUp *bmenu = static_cast<GlutPopUp*>(m); + GlutWindow *win = bmenu->win; // my window + GlutBMenuItem *result = (GlutBMenuItem*)bmenu->Go(bmenu->point); + win->Window()->Lock(); + win->anyevents = win->statusEvent = true; + win->menuStatus = GLUT_MENU_NOT_IN_USE; + win->menuNumber = bmenu->menu; + BPoint cursor; + uint32 buttons; + win->GetMouse(&cursor, &buttons); + win->statusX = (int)cursor.x; + win->statusY = (int)cursor.y; + if(result && result->menu) { + win->menuEvent = true; + win->menuNumber = result->menu; // in case it was a submenu + win->menuValue = result->value; + } + win->Window()->Unlock(); + gBlock.NewEvent(); + delete bmenu; + return 0; +} diff --git a/xc/extras/Mesa/src-glut.beos/glutGet.cpp b/xc/extras/Mesa/src-glut.beos/glutGet.cpp new file mode 100644 index 000000000..33355afb8 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutGet.cpp @@ -0,0 +1,240 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutGet.cpp + * + * DESCRIPTION: get state information from GL + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <string.h> +#include <Autolock.h> +#include "glutint.h" +#include "glutState.h" + +/*********************************************************** + * Global variables + ***********************************************************/ +// rough guess, since we don't know how big the monitor really is +const float dots_per_mm = (72/25.4); // dots per millimeter + +/*********************************************************** + * FUNCTION: glutGet (9.1) + * + * DESCRIPTION: retrieve window and GL state + ***********************************************************/ +int glutGet(GLenum state) { + switch(state) { + case GLUT_WINDOW_X: + {BAutolock winlock(gState.currentWindow->Window()); // need to lock the window + if (gState.currentWindow->parent) + return (int)gState.currentWindow->Frame().left; + else + return (int)gState.currentWindow->Window()->Frame().left; + } + case GLUT_WINDOW_Y: + {BAutolock winlock(gState.currentWindow->Window()); + if (gState.currentWindow->parent) + return (int)gState.currentWindow->Frame().top; + else + return (int)gState.currentWindow->Window()->Frame().top; + } + case GLUT_WINDOW_WIDTH: + {BAutolock winlock(gState.currentWindow->Window()); + return gState.currentWindow->m_width; + } + case GLUT_WINDOW_HEIGHT: + {BAutolock winlock(gState.currentWindow->Window()); + return gState.currentWindow->m_height; + } + case GLUT_WINDOW_PARENT: + {BAutolock winlock(gState.currentWindow->Window()); + if(gState.currentWindow->parent) + return gState.currentWindow->parent->num + 1; + else + return 0; + } + case GLUT_WINDOW_NUM_CHILDREN: + {BAutolock winlock(gState.currentWindow->Window()); + int num = 0; + GlutWindow *children = gState.currentWindow->children; + while (children) { + num++; + children = children->siblings; + } + return num; + } + case GLUT_WINDOW_BUFFER_SIZE: // best guesses + case GLUT_WINDOW_DEPTH_SIZE: + return 32; + + case GLUT_WINDOW_STENCIL_SIZE: + case GLUT_WINDOW_RED_SIZE: // always 24-bit color + case GLUT_WINDOW_GREEN_SIZE: + case GLUT_WINDOW_BLUE_SIZE: + case GLUT_WINDOW_ALPHA_SIZE: + case GLUT_WINDOW_ACCUM_RED_SIZE: + case GLUT_WINDOW_ACCUM_GREEN_SIZE: + case GLUT_WINDOW_ACCUM_BLUE_SIZE: + case GLUT_WINDOW_ACCUM_ALPHA_SIZE: + return 8; + + case GLUT_WINDOW_DOUBLEBUFFER: // always double-buffered RGBA + case GLUT_WINDOW_RGBA: + return 1; + + case GLUT_WINDOW_COLORMAP_SIZE: // don't support these + case GLUT_WINDOW_NUM_SAMPLES: + case GLUT_WINDOW_STEREO: + return 0; + + case GLUT_WINDOW_CURSOR: + return gState.currentWindow->cursor; // don't need to lock window since it won't change + + case GLUT_SCREEN_WIDTH: + return (int)(BScreen().Frame().Width()) + 1; + case GLUT_SCREEN_HEIGHT: + return (int)(BScreen().Frame().Height()) + 1; + case GLUT_SCREEN_WIDTH_MM: + return (int)((BScreen().Frame().Width() + 1) / dots_per_mm); + case GLUT_SCREEN_HEIGHT_MM: + return (int)((BScreen().Frame().Height() + 1) / dots_per_mm); + case GLUT_MENU_NUM_ITEMS: + return gState.currentMenu->num; + case GLUT_DISPLAY_MODE_POSSIBLE: + return __glutConvertDisplayMode(0); // returns 1 if possible + case GLUT_INIT_DISPLAY_MODE: + return gState.displayMode; + case GLUT_INIT_WINDOW_X: + return gState.initX; + case GLUT_INIT_WINDOW_Y: + return gState.initY; + case GLUT_INIT_WINDOW_WIDTH: + return gState.initWidth; + case GLUT_INIT_WINDOW_HEIGHT: + return gState.initHeight; + case GLUT_ELAPSED_TIME: + bigtime_t elapsed, beginning, now; + __glutInitTime(&beginning); + now = system_time(); + elapsed = now - beginning; + return (int) (elapsed / 1000); // 1000 ticks in a millisecond + default: + __glutWarning("invalid glutGet parameter: %d", state); + return -1; + } +} + +/*********************************************************** + * FUNCTION: glutLayerGet (9.2) + * + * DESCRIPTION: since we don't support layers, this is easy + ***********************************************************/ +int glutLayerGet(GLenum info) { + switch(info) { + case GLUT_OVERLAY_POSSIBLE: + case GLUT_HAS_OVERLAY: + return 0; + case GLUT_LAYER_IN_USE: + return GLUT_NORMAL; + case GLUT_TRANSPARENT_INDEX: + return -1; + case GLUT_NORMAL_DAMAGED: + return gState.currentWindow->displayEvent; + case GLUT_OVERLAY_DAMAGED: + return -1; + default: + __glutWarning("invalid glutLayerGet param: %d", info); + return -1; + } +} + +/*********************************************************** + * FUNCTION: glutDeviceGet (9.3) + * + * DESCRIPTION: get info about I/O devices we support + * easy, since BeOS only supports a keyboard and mouse now + ***********************************************************/ +int glutDeviceGet(GLenum info) { + switch(info) { + case GLUT_HAS_KEYBOARD: + case GLUT_HAS_MOUSE: + return 1; + + case GLUT_HAS_SPACEBALL: + case GLUT_HAS_DIAL_AND_BUTTON_BOX: + case GLUT_HAS_TABLET: + case GLUT_NUM_SPACEBALL_BUTTONS: + case GLUT_NUM_BUTTON_BOX_BUTTONS: + case GLUT_NUM_DIALS: + case GLUT_NUM_TABLET_BUTTONS: + return 0; + + case GLUT_NUM_MOUSE_BUTTONS: + { + int32 mouseButtons = 3; // good guess + if(get_mouse_type(&mouseButtons) != B_OK) { + __glutWarning("error getting number of mouse buttons"); + } + return mouseButtons; + } + + default: + __glutWarning("invalid glutDeviceGet parameter: %d", info); + return -1; + } +} + +/*********************************************************** + * FUNCTION: glutGetModifiers (9.4) + * + * DESCRIPTION: get the modifier key state for the current window + ***********************************************************/ +int glutGetModifiers() { + if(gState.modifierKeys == (int) ~0) { + __glutWarning( + "glutCurrentModifiers: do not call outside core input callback."); + return 0; + } + return gState.modifierKeys; +} + +/*********************************************************** + * FUNCTION: glutExtensionSupported (9.5) + * + * DESCRIPTION: is an OpenGL extension supported (from glut_ext.c) + ***********************************************************/ +int glutExtensionSupported(const char *extension) { + static const GLubyte *extensions = NULL; + const GLubyte *start; + GLubyte *where, *terminator; + + /* Extension names should not have spaces. */ + where = (GLubyte *) strchr(extension, ' '); + if (where || *extension == '\0') + return 0; + + if (!extensions) + extensions = glGetString(GL_EXTENSIONS); + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + + etc. */ + start = extensions; + for (;;) { + where = (GLubyte *) strstr((const char *) start, extension); + if (!where) + break; + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') { + if (*terminator == ' ' || *terminator == '\0') { + return 1; + } + } + start = terminator; + } + return 0; +} diff --git a/xc/extras/Mesa/src-glut.beos/glutInit.cpp b/xc/extras/Mesa/src-glut.beos/glutInit.cpp new file mode 100644 index 000000000..9aa0f4787 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutInit.cpp @@ -0,0 +1,238 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutInit.cpp + * + * DESCRIPTION: initialize GLUT state + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <string.h> +#include <stdlib.h> +#include "glutint.h" +#include "glutState.h" +#include "beos_x11.h" + +/*********************************************************** + * Global variables + ***********************************************************/ +GlutState gState; + +/*********************************************************** + * Private variables + ***********************************************************/ +static int __glutArgc; +static char **__glutArgv; + +/*********************************************************** + * FUNCTION: __glutInitTime + * + * DESCRIPTION: set up start time variable + ***********************************************************/ +void __glutInitTime(bigtime_t *beginning) +{ + static int beenhere = 0; + static bigtime_t genesis; + + if (!beenhere) { + genesis = system_time(); + beenhere = 1; + } + *beginning = genesis; +} + +/*********************************************************** + * FUNCTION: removeArgs + * + * DESCRIPTION: helper function for glutInit to remove args + * from argv variable passed in + ***********************************************************/ +static void +removeArgs(int *argcp, char **argv, int numToRemove) +{ + int i, j; + + for (i = 0, j = numToRemove; argv[j]; i++, j++) { + argv[i] = argv[j]; + } + argv[i] = NULL; + *argcp -= numToRemove; +} + +/*********************************************************** + * FUNCTION: bAppThread + * + * DESCRIPTION: starts the BApplication message loop running + ***********************************************************/ +static int32 bAppThread(void *arg) { + be_app->Lock(); + return be_app->Run(); +} + +/*********************************************************** + * FUNCTION: glutInit (2.1) + * + * DESCRIPTION: create BApplication, parse cmd-line arguments, + * and set up gState structure. + ***********************************************************/ +void glutInit(int *argcp, char **argv) { + char *str, *geometry = NULL; + int i; + + if (gState.display) { + __glutWarning("glutInit being called a second time."); + return; + } + /* Determine temporary program name. */ + str = strrchr(argv[0], '/'); + if (str == NULL) { + gState.programName = argv[0]; + } else { + gState.programName = str + 1; + } + + /* Make private copy of command line arguments. */ + __glutArgc = *argcp; + __glutArgv = (char **) malloc(__glutArgc * sizeof(char *)); + if (!__glutArgv) + __glutFatalError("out of memory."); + for (i = 0; i < __glutArgc; i++) { + __glutArgv[i] = strdup(argv[i]); + if (!__glutArgv[i]) + __glutFatalError("out of memory."); + } + + /* determine permanent program name */ + str = strrchr(__glutArgv[0], '/'); + if (str == NULL) { + gState.programName = __glutArgv[0]; + } else { + gState.programName = str + 1; + } + + /* parse arguments for standard options */ + for (i = 1; i < __glutArgc; i++) { + if (!strcmp(__glutArgv[i], "-display")) { + __glutWarning("-display option only valid for X glut."); + if (++i >= __glutArgc) { + __glutFatalError( + "follow -display option with X display name."); + } + removeArgs(argcp, &argv[1], 2); + } else if (!strcmp(__glutArgv[i], "-geometry")) { + if (++i >= __glutArgc) { + __glutFatalError( + "follow -geometry option with geometry parameter."); + } + geometry = __glutArgv[i]; + removeArgs(argcp, &argv[1], 2); + } else if (!strcmp(__glutArgv[i], "-direct")) { + __glutWarning("-direct option only valid for X glut."); + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-indirect")) { + __glutWarning("-indirect option only valid for X glut."); + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-iconic")) { + __glutWarning("-iconic option doesn't make sense in BeOS."); + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-gldebug")) { + gState.debug = true; + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-sync")) { + __glutWarning("-sync option only valid for X glut."); + removeArgs(argcp, &argv[1], 1); + } else { + /* Once unknown option encountered, stop command line + processing. */ + break; + } + } + + __glutInit(); /* Create BApplication first so DisplayWidth() works */ + if (geometry) { + int flags, x, y, width, height; + + /* Fix bogus "{width|height} may be used before set" + warning */ + width = 0; + height = 0; + + flags = XParseGeometry(geometry, &x, &y, + (unsigned int *) &width, (unsigned int *) &height); + if (WidthValue & flags) { + /* Careful because X does not allow zero or negative + width windows */ + if (width > 0) + gState.initWidth = width; + } + if (HeightValue & flags) { + /* Careful because X does not allow zero or negative + height windows */ + if (height > 0) + gState.initHeight = height; + } + if (XValue & flags) { + if (XNegative & flags) + x = DisplayWidth() + x - gState.initWidth; + /* Play safe: reject negative X locations */ + if (x >= 0) + gState.initX = x; + } + if (YValue & flags) { + if (YNegative & flags) + y = DisplayHeight() + y - gState.initHeight; + /* Play safe: reject negative Y locations */ + if (y >= 0) + gState.initY = y; + } + } +} + +/*********************************************************** + * FUNCTION: __glutInit + * + * DESCRIPTION: create BApplication, parse cmd-line arguments, + * and set up gState structure. + ***********************************************************/ +void __glutInit() { + // open BApplication + gState.display = new BApplication("application/x-glut-demo"); + be_app->Unlock(); + thread_id appthread = spawn_thread(bAppThread, "BApplication", B_NORMAL_PRIORITY, 0); + resume_thread(appthread); + + bigtime_t unused; + __glutInitTime(&unused); +} + +/*********************************************************** + * FUNCTION: glutInitWindowPosition (2.2) + * + * DESCRIPTION: set initial window position + ***********************************************************/ +void glutInitWindowPosition(int x, int y) { + gState.initX = x; + gState.initY = y; +} + +/*********************************************************** + * FUNCTION: glutInitWindowSize (2.2) + * + * DESCRIPTION: set initial window size + ***********************************************************/ +void glutInitWindowSize(int width, int height) { + gState.initWidth = width; + gState.initHeight = height; +} + +/*********************************************************** + * FUNCTION: glutInitDisplayMode (2.3) + * + * DESCRIPTION: set initial display mode + ***********************************************************/ +void glutInitDisplayMode(unsigned int mode) { + gState.displayMode = mode; +} diff --git a/xc/extras/Mesa/src-glut.beos/glutMenu.cpp b/xc/extras/Mesa/src-glut.beos/glutMenu.cpp new file mode 100644 index 000000000..1dad5970c --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutMenu.cpp @@ -0,0 +1,322 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutMenu.cpp + * + * DESCRIPTION: code for popup menu handling + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <stdlib.h> +#include <string.h> +#include "glutint.h" +#include "glutState.h" + +/*********************************************************** + * Private variables + ***********************************************************/ +static GlutMenu **menuList = 0; +static int menuListSize = 0; + +/*********************************************************** + * FUNCTION: getUnusedMenuSlot + * + * DESCRIPTION: helper function to get a new menu slot + ***********************************************************/ +GlutMenu *__glutGetMenuByNum(int menunum) +{ + if (menunum < 1 || menunum > menuListSize) { + return NULL; + } + return menuList[menunum - 1]; +} + +/*********************************************************** + * FUNCTION: getUnusedMenuSlot + * + * DESCRIPTION: helper function to get a new menu slot + ***********************************************************/ +static int +getUnusedMenuSlot(void) +{ + int i; + + /* Look for allocated, unused slot. */ + for (i = 0; i < menuListSize; i++) { + if (!menuList[i]) { + return i; + } + } + /* Allocate a new slot. */ + menuListSize++; + menuList = (GlutMenu **) + realloc(menuList, menuListSize * sizeof(GlutMenu *)); + if (!menuList) + __glutFatalError("out of memory."); + menuList[menuListSize - 1] = NULL; + return menuListSize - 1; +} + +/*********************************************************** + * FUNCTION: glutCreateMenu (6.1) + * + * DESCRIPTION: create a new menu + ***********************************************************/ +int APIENTRY +glutCreateMenu(GLUTselectCB selectFunc) +{ + GlutMenu *menu; + int menuid; + + menuid = getUnusedMenuSlot(); + menu = new GlutMenu(menuid, selectFunc); // constructor sets up members + menuList[menuid] = menu; + gState.currentMenu = menu; + return menuid + 1; +} + +/*********************************************************** + * FUNCTION: glutSetMenu (6.2) + * glutGetMenu + * + * DESCRIPTION: set and get the current menu + ***********************************************************/ +int APIENTRY +glutGetMenu(void) +{ + if (gState.currentMenu) { + return gState.currentMenu->id + 1; + } else { + return 0; + } +} + +void APIENTRY +glutSetMenu(int menuid) +{ + GlutMenu *menu; + + if (menuid < 1 || menuid > menuListSize) { + __glutWarning("glutSetMenu attempted on bogus menu."); + return; + } + menu = menuList[menuid - 1]; + if (!menu) { + __glutWarning("glutSetMenu attempted on bogus menu."); + return; + } + gState.currentMenu = menu; +} + +/*********************************************************** + * FUNCTION: glutDestroyMenu (6.3) + * + * DESCRIPTION: destroy the specified menu + ***********************************************************/ +void APIENTRY +glutDestroyMenu(int menunum) +{ + GlutMenu *menu = __glutGetMenuByNum(menunum); + menuList[menunum - 1] = 0; + if (gState.currentMenu == menu) { + gState.currentMenu = 0; + } + delete menu; +} + +/*********************************************************** + * FUNCTION: glutAddMenuEntry (6.4) + * + * DESCRIPTION: add a new menu item + ***********************************************************/ +void +glutAddMenuEntry(const char *label, int value) +{ + new GlutMenuItem(gState.currentMenu, false, value, label); +} + +/*********************************************************** + * FUNCTION: glutAddSubMenu (6.5) + * + * DESCRIPTION: add a new submenu + ***********************************************************/ +void +glutAddSubMenu(const char *label, int menu) +{ + new GlutMenuItem(gState.currentMenu, true, menu-1, label); +} + +/*********************************************************** + * FUNCTION: glutChangeToMenuEntry (6.6) + * + * DESCRIPTION: change menuitem into a menu entry + ***********************************************************/ +void +glutChangeToMenuEntry(int num, const char *label, int value) +{ + GlutMenuItem *item; + int i; + + i = gState.currentMenu->num; + item = gState.currentMenu->list; + while (item) { + if (i == num) { + free(item->label); + item->label = strdup(label); + item->isTrigger = false; + item->value = value; + return; + } + i--; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +/*********************************************************** + * FUNCTION: glutChangeToSubMenu (6.7) + * + * DESCRIPTION: change menuitem into a submenu + ***********************************************************/ +void +glutChangeToSubMenu(int num, const char *label, int menu) +{ + GlutMenuItem *item; + int i; + + i = gState.currentMenu->num; + item = gState.currentMenu->list; + while (item) { + if (i == num) { + free(item->label); + item->label = strdup(label); + item->isTrigger = true; + item->value = menu-1; + return; + } + i--; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +/*********************************************************** + * FUNCTION: glutRemoveMenuItem (6.8) + * + * DESCRIPTION: remove a menu item + ***********************************************************/ +void +glutRemoveMenuItem(int num) +{ + GlutMenuItem *item, **prev; + int i; + + i = gState.currentMenu->num; + prev = &gState.currentMenu->list; + item = gState.currentMenu->list; + + while (item) { + if (i == num) { + gState.currentMenu->num--; + + /* Patch up menu's item list. */ + *prev = item->next; + + free(item->label); + delete item; + return; + } + i--; + prev = &item->next; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +/*********************************************************** + * FUNCTION: glutAttachMenu (6.9) + * glutDetachMenu + * + * DESCRIPTION: attach and detach menu from view + ***********************************************************/ +void +glutAttachMenu(int button) +{ + gState.currentWindow->menu[button] = gState.currentMenu->id + 1; +} + +void +glutDetachMenu(int button) +{ + gState.currentWindow->menu[button] = 0; +} + +/*********************************************************** + * CLASS: GlutMenu + * + * FUNCTION: CreateBMenu + * + * DESCRIPTION: construct a BPopupMenu for this menu + ***********************************************************/ +BMenu *GlutMenu::CreateBMenu(bool toplevel) { + BMenu *bpopup; + if(toplevel) { + bpopup = new GlutPopUp(id+1); + } else { + bpopup = new BMenu(""); + } + GlutMenuItem *item = list; + while (item) { + GlutBMenuItem *bitem; + if(item->isTrigger) { + // recursively call CreateBMenu + bitem = new GlutBMenuItem(menuList[item->value]->CreateBMenu(false)); + bitem->SetLabel(item->label); + bitem->menu = 0; // real menu items start at 1 + bitem->value = 0; + } else { + bitem = new GlutBMenuItem(item->label); + bitem->menu = id + 1; + bitem->value = item->value; + } + bpopup->AddItem(bitem, 0); + item = item->next; + } + return bpopup; +} + +/*********************************************************** + * CLASS: GlutMenu + * + * FUNCTION: (destructor) + * + * DESCRIPTION: destroy the menu and its items (but not submenus!) + ***********************************************************/ +GlutMenu::~GlutMenu() { + while (list) { + GlutMenuItem *next = list->next; + delete list; + list = next; + } +} + +/*********************************************************** + * CLASS: GlutMenuItem + * + * FUNCTION: (constructor) + * + * DESCRIPTION: construct the new menu item and add to parent + ***********************************************************/ +GlutMenuItem::GlutMenuItem(GlutMenu *n_menu, bool n_trig, int n_value, const char *n_label) +{ + menu = n_menu; + isTrigger = n_trig; + value = n_value; + label = strdup(n_label); + next = menu->list; + menu->list = this; + menu->num++; +} diff --git a/xc/extras/Mesa/src-glut.beos/glutMenu.h b/xc/extras/Mesa/src-glut.beos/glutMenu.h new file mode 100644 index 000000000..f61b9aaaf --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutMenu.h @@ -0,0 +1,79 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutMenu.h + * + * DESCRIPTION: the GlutMenu class is a simple popup menu + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <Menu.h> +#include <MenuItem.h> + +/*********************************************************** + * Definitions + ***********************************************************/ +const int32 MENU_ITEM = 'menu'; + +/*********************************************************** + * CLASS: GlutMenu + ***********************************************************/ +class GlutMenuItem; +class GlutPopUp; +class GlutMenu { +public: + GlutMenu(int n_id, GLUTselectCB n_select) { + id = n_id; + select = n_select; + list = 0; + num = 0; + } + ~GlutMenu(); + BMenu *CreateBMenu(bool toplevel=true); // construct BPopUpMenu + + // public data + int id; + GLUTselectCB select; // callback function + GlutMenuItem *list; // list of menu items + int num; // number of items +}; + +/*********************************************************** + * CLASS: GlutMenuItem + ***********************************************************/ +class GlutMenuItem { +public: + GlutMenuItem(GlutMenu *n_menu, bool n_trig, int n_value, const char *n_label); + + // public data + GlutMenu *menu; // parent menu + bool isTrigger; // are we a submenu? + int value; // value to send, or submenu id if isTrigger + char *label; // strdup'ed label string + GlutMenuItem *next; // next menu entry on list +}; + +/*********************************************************** + * CLASS: GlutPopUp + ***********************************************************/ +class GlutPopUp : public BPopUpMenu { +public: + GlutPopUp(int m) : BPopUpMenu(0, false, false) { menu = m;} + + BPoint point; // point to start menu + GlutWindow *win; // pointer to my window + int menu; // my menu number +}; + +/*********************************************************** + * CLASS: GlutBMenuItem + ***********************************************************/ +class GlutBMenuItem : public BMenuItem { +public: + GlutBMenuItem(const char *name) : BMenuItem(name, 0) {} + GlutBMenuItem(BMenu* menu) : BMenuItem(menu) {} + int menu, value; +}; diff --git a/xc/extras/Mesa/src-glut.beos/glutOverlay.cpp b/xc/extras/Mesa/src-glut.beos/glutOverlay.cpp new file mode 100644 index 000000000..eaabb8373 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutOverlay.cpp @@ -0,0 +1,38 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutOverlay.cpp + * + * DESCRIPTION: we don't support overlays, so this code is + * really simple + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include "glutint.h" + +void glutEstablishOverlay() { + __glutFatalError("BeOS lacks overlay support."); +} + +void glutUseLayer(GLenum layer) { + // ignore +} + +void glutRemoveOverlay() { + // ignore +} + +void glutPostOverlayRedisplay() { + // ignore +} + +void glutShowOverlay() { + // ignore +} + +void glutHideOverlay() { + // ignore +}
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glutState.h b/xc/extras/Mesa/src-glut.beos/glutState.h new file mode 100644 index 000000000..c9a9a5212 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutState.h @@ -0,0 +1,65 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutState.h + * + * DESCRIPTION: the global state for GLUT + * (takes the place of glutint.h in the C version) + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <Application.h> +#include "glutWindow.h" +#include "glutMenu.h" + +/*********************************************************** + * CLASS: GlutState + * + * DESCRIPTION: all the global state variables + ***********************************************************/ +struct GlutState { + BApplication *display; + char *programName; // used in error messages + int initX, initY; // initial window position + int initWidth, initHeight; // initial window size + unsigned int displayMode; // initial display mode + char *displayString; // verbose display mode + + GlutWindow *currentWindow; // current window + GlutMenu *currentMenu; // current menu + + GlutWindow **windowList; // array of pointers to windows + int windowListSize; // size of window list + + GLUTidleCB idle; // idle callback + GLUTmenuStatusCB menuStatus; // menu status callback + int modifierKeys; // only valid during keyboard callback + + bool debug; // call glGetError + bool swapHack; + + GlutState() { + display = 0; + programName = 0; + initX = initY = -1; + initWidth = initHeight = 300; + displayMode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH; + displayString = 0; + currentWindow = 0; + currentMenu = 0; + windowList = 0; + windowListSize = 0; + idle = 0; + menuStatus = 0; + modifierKeys = ~0; + debug = swapHack = false; + } +}; + +/*********************************************************** + * Global variable (declared in glutInit.cpp) + ***********************************************************/ +extern GlutState gState;
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glutWindow.cpp b/xc/extras/Mesa/src-glut.beos/glutWindow.cpp new file mode 100644 index 000000000..dbdd3b84a --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutWindow.cpp @@ -0,0 +1,525 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutWindow.cpp + * + * DESCRIPTION: all the routines for dealing with GlutWindows + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <stdlib.h> +#include "glutint.h" +#include "glutState.h" +#include "glutBlocker.h" + +/*********************************************************** + * FUNCTION: getUnusedWindowSlot + * + * DESCRIPTION: helper function to get a new window slot + ***********************************************************/ +static int +getUnusedWindowSlot() +{ + int i; + + /* Look for allocated, unused slot. */ + for (i = 0; i < gState.windowListSize; i++) { + if (!gState.windowList[i]) { + return i; + } + } + /* Allocate a new slot. */ + gState.windowListSize++; + gState.windowList = (GlutWindow **) + realloc(gState.windowList, + gState.windowListSize * sizeof(GlutWindow *)); + + if (!gState.windowList) + __glutFatalError("out of memory."); + gState.windowList[gState.windowListSize - 1] = NULL; + return gState.windowListSize - 1; +} + +/*********************************************************** + * FUNCTION: __glutDefaultDisplay + * __glutDefaultReshape + * + * DESCRIPTION: default display and reshape functions + ***********************************************************/ +static void +__glutDefaultDisplay(void) +{ + /* XXX Remove the warning after GLUT 3.0. */ + __glutWarning("The following is a new check for GLUT 3.0; update your code."); + __glutFatalError( + "redisplay needed for window %d, but no display callback.", + gState.currentWindow->num + 1); +} + +void +__glutDefaultReshape(int width, int height) +{ + /* Adjust the viewport of the window */ + glViewport(0, 0, (GLsizei) width, (GLsizei) height); +} + +/*********************************************************** + * CLASS: GlutWindow + * + * FUNCTION: (constructor) + * + * DESCRIPTION: creates a new GLUT window + * note: subwindows don't resize, but top-level windows + * follow all sides + ***********************************************************/ +GlutWindow::GlutWindow(GlutWindow *nparent, char *name, + int x, int y, int width, int height, ulong options) : + BGLView( + (nparent ? BRect(x,y,x+width-1,y+height-1) : + BRect(0,0,width-1,height-1)), name, + (nparent ? B_FOLLOW_NONE : B_FOLLOW_ALL_SIDES), + B_WILL_DRAW|B_FRAME_EVENTS|B_FULL_UPDATE_ON_RESIZE|B_PULSE_NEEDED, + options) +{ + // add myself to window list + num = getUnusedWindowSlot(); + gState.windowList[num] = this; + + // set up parent/children relationships + parent = nparent; + if (parent) { + siblings = parent->children; + parent->children = this; + } else { + siblings = 0; + } + children = 0; + + // initialize variables + cursor = GLUT_CURSOR_INHERIT; // default cursor + for (int i = 0; i < GLUT_MAX_MENUS; i++) { + menu[i] = 0; + } + m_width = width; + m_height = height; + m_buttons = 0; + + // clear callbacks + display = __glutDefaultDisplay; + reshape = __glutDefaultReshape; + mouse = 0; + motion = 0; + passive = 0; + entry = 0; + keyboard = 0; + visibility = 0; + special = 0; + + // faked out single buffering + swapHack = gState.swapHack; + + // clear event counters + anyevents = 1; + displayEvent = 1; // get a reshape and a display event right away + reshapeEvent = 1; + mouseEvent = 0; + motionEvent = 0; + passiveEvent = 0; + entryEvent = 0; + keybEvent = 0; + visEvent = 1; // we also get a visibility event + visState = GLUT_VISIBLE; + specialEvent = 0; + statusEvent = 0; + menuEvent = 0; + gBlock.QuickNewEvent(); + + // if i'm a subwindow, add me to my parent view + if (parent) { + parent->Window()->Lock(); + parent->AddChild(this); + parent->Window()->Unlock(); + } else { + // if I'm a top-level window, create my BWindow + GlutBWindow *mybwindow = new GlutBWindow( + BRect(x,y,x+width-1,y+height-1), name); + mybwindow->AddChild(this); + mybwindow->Show(); + } + + // give me the keyboard focus (focus follows mouse, X style, as + // implemented in GlutWindow::MouseMoved()) + Window()->Lock(); + MakeFocus(); + Window()->Unlock(); + + // make myself the default window + __glutSetWindow(this); +} + +/*********************************************************** + * FUNCTION: glutCreateWindow (4.1) + * + * DESCRIPTION: creates a new GLUT window + ***********************************************************/ +int glutCreateWindow(const char *name) { + if (!be_app) + __glutInit(); + + ulong options; + if (!__glutConvertDisplayMode(&options)) { + __glutWarning("visual with necessary capabilities not found."); + } + + // if X or Y is negative, then start at a reasonable position + bool defaultxy = (gState.initX < 0) || (gState.initY < 0); + + GlutWindow *window = new GlutWindow(0, const_cast<char*>(name), + (defaultxy ? 50 : gState.initX), (defaultxy ? 50 : gState.initY), + gState.initWidth, gState.initHeight, options); + + return window->num + 1; +} + +/*********************************************************** + * FUNCTION: glutCreateSubWindow (4.2) + * + * DESCRIPTION: creates a new GLUT subwindow + * Note: a subwindow is a GlutWindow (which is actually + * a BGLView) without its own BWindow + ***********************************************************/ +int glutCreateSubWindow(int win, int x, int y, int width, int height) { + ulong options; + if (!__glutConvertDisplayMode(&options)) { + __glutFatalError("visual with necessary capabilities not found."); + } + + GlutWindow *window = new GlutWindow(gState.windowList[win-1], "child", + x, y, width, height, options); + + return window->num + 1; +} + +/*********************************************************** + * FUNCTION: __glutSetWindow + * + * DESCRIPTION: set the current window (utility function) + ***********************************************************/ +void +__glutSetWindow(GlutWindow * window) +{ + if (gState.currentWindow) + gState.currentWindow->UnlockGL(); + gState.currentWindow = window; + gState.currentWindow->LockGL(); +} + +/*********************************************************** + * FUNCTION: glutSetWindow (4.3) + * glutGetWindow + * + * DESCRIPTION: set and get the current window + ***********************************************************/ +void glutSetWindow(int win) { + GlutWindow *window; + + if (win < 1 || win > gState.windowListSize) { + __glutWarning("glutSetWindow attempted on bogus window."); + return; + } + window = gState.windowList[win - 1]; + if (!window) { + __glutWarning("glutSetWindow attempted on bogus window."); + return; + } + __glutSetWindow(window); +} + +int glutGetWindow() { + if (gState.currentWindow) { + return gState.currentWindow->num + 1; + } else { + return 0; + } +} + +/*********************************************************** + * FUNCTION: __glutDestroyWindow + * + * DESCRIPTION: recursively set entries to 0 + ***********************************************************/ +static void +__glutDestroyWindow(GlutWindow *window, GlutWindow *initialWindow) { + // first, find all children recursively and set their entries to 0 + GlutWindow *cur = window->children; + while (cur) { + GlutWindow *siblings = cur->siblings; + __glutDestroyWindow(cur, initialWindow); + cur = siblings; + } + + /* Remove from parent's children list (only necessary for + non-initial windows and subwindows!). */ + GlutWindow *parent = window->parent; + if (parent && parent == initialWindow->parent) { + GlutWindow **prev = &parent->children; + cur = parent->children; + while (cur) { + if (cur == window) { + *prev = cur->siblings; + break; + } + prev = &(cur->siblings); + cur = cur->siblings; + } + } + + // finally, check if we are the current window, and set to 0 + if (gState.currentWindow == window) { + gState.currentWindow = 0; + } + gState.windowList[window->num] = 0; +} + +/*********************************************************** + * FUNCTION: glutDestroyWindow (4.4) + * + * DESCRIPTION: destroy window and all its children + ***********************************************************/ +void glutDestroyWindow(int win) { + // can't destroy a window if another window has the GL context + gState.currentWindow->UnlockGL(); + + // lock the window + GlutWindow *window = gState.windowList[win-1]; + BWindow *bwindow = window->Window(); + bwindow->Lock(); + + // if win is the current window, set current window to 0 and unlock GL + if (gState.currentWindow == window) { + + gState.currentWindow = 0; + } + + // recursively set child entries to 0 + __glutDestroyWindow(window, window); + + // now, if the window was top-level, delete its BWindow + if(!window->parent) { + bwindow->Quit(); + } else { + // else, detach it from the BWindow and delete it + window->RemoveSelf(); + delete window; + bwindow->Unlock(); + } + + // relock GL if the current window is still valid + if(gState.currentWindow) + gState.currentWindow->LockGL(); +} + +/*********************************************************** + * FUNCTION: glutPostRedisplay (4.5) + * + * DESCRIPTION: mark window as needing redisplay + ***********************************************************/ +void glutPostRedisplay() { + gState.currentWindow->Window()->Lock(); + gState.currentWindow->anyevents = true; + gState.currentWindow->displayEvent = true; + gState.currentWindow->Window()->Unlock(); + gBlock.QuickNewEvent(); +} + +/*********************************************************** + * FUNCTION: glutSwapBuffers (4.6) + * + * DESCRIPTION: swap buffers + ***********************************************************/ +void glutSwapBuffers() { + gState.currentWindow->SwapBuffers(); +} + +/*********************************************************** + * FUNCTION: glutPositionWindow (4.7) + * + * DESCRIPTION: move window + ***********************************************************/ +void glutPositionWindow(int x, int y) { + gState.currentWindow->Window()->Lock(); + if (gState.currentWindow->parent) + gState.currentWindow->MoveTo(x, y); // move the child view + else + gState.currentWindow->Window()->MoveTo(x, y); // move the window + gState.currentWindow->Window()->Unlock(); +} + +/*********************************************************** + * FUNCTION: glutReshapeWindow (4.8) + * + * DESCRIPTION: reshape window (we'll catch the callback + * when the view gets a Draw() message + ***********************************************************/ +void glutReshapeWindow(int width, int height) { + gState.currentWindow->Window()->Lock(); + if (gState.currentWindow->parent) + gState.currentWindow->ResizeTo(width-1, height-1); // resize the child + else + gState.currentWindow->Window()->ResizeTo(width-1, height-1); // resize the parent + gState.currentWindow->Window()->Unlock(); +} + +/*********************************************************** + * FUNCTION: glutFullScreen (4.9) + * + * DESCRIPTION: makes the window full screen + * NOTE: we could add Game Kit support later? + ***********************************************************/ +void glutFullScreen() { + gState.currentWindow->Window()->Lock(); + BRect frame = BScreen(gState.currentWindow->Window()).Frame(); + glutPositionWindow(0, 0); + glutReshapeWindow((int)(frame.Width()) + 1, (int)(frame.Height()) + 1); + gState.currentWindow->Window()->Unlock(); +} + +/*********************************************************** + * FUNCTION: glutPopWindow (4.10) + * glutPushWindow + * + * DESCRIPTION: change the stacking order of the current window + * NOTE: I can't figure out how to do this for windows, + * and there is no concept of "stacking order" for + * subwindows, so these are currently no-ops. + ***********************************************************/ +void glutPopWindow() { } +void glutPushWindow() { } + +/*********************************************************** + * FUNCTION: glutShowWindow (4.11) + * glutHideWindow + * glutIconifyWindow + * + * DESCRIPTION: change display status of current window + ***********************************************************/ +void glutShowWindow() { + gState.currentWindow->Window()->Lock(); + if (gState.currentWindow->parent) // subwindow + gState.currentWindow->Show(); + else { + gState.currentWindow->Window()->Show(); // show the actual BWindow + gState.currentWindow->Window()->Minimize(false); + } + gState.currentWindow->Window()->Unlock(); +} + +void glutHideWindow() { + gState.currentWindow->Window()->Lock(); + if (gState.currentWindow->parent) // subwindow + gState.currentWindow->Hide(); + else + gState.currentWindow->Window()->Hide(); // show the actual BWindow + gState.currentWindow->Window()->Unlock(); +} + +void glutIconifyWindow() { + if(gState.currentWindow->parent) + __glutFatalError("can't iconify a subwindow"); + + gState.currentWindow->Window()->Lock(); + gState.currentWindow->Window()->Minimize(true); + gState.currentWindow->Window()->Unlock(); +} + +/*********************************************************** + * FUNCTION: glutSetWindowTitle (4.12) + * glutSetIconTitle + * + * DESCRIPTION: set the window title (icon title is same) + ***********************************************************/ +void glutSetWindowTitle(const char *name) { + if (gState.currentWindow->parent) + __glutFatalError("glutSetWindowTitle: isn't a top-level window"); + + gState.currentWindow->Window()->Lock(); + gState.currentWindow->Window()->SetTitle(name); + gState.currentWindow->Window()->Unlock(); +} + +void glutSetIconTitle(const char *name) { + glutSetWindowTitle(name); +} + +/*********************************************************** + * FUNCTION: __glutConvertDisplayMode + * + * DESCRIPTION: converts the current display mode into a BGLView + * display mode, printing warnings as appropriate. + * + * PARAMETERS: if options is non-NULL, the current display mode is + * returned in it. + * + * RETURNS: 1 if the current display mode is possible, else 0 + ***********************************************************/ +int __glutConvertDisplayMode(unsigned long *options) { + if (gState.displayString) { + /* __glutDisplayString should be NULL except if + glutInitDisplayString has been called to register a + different display string. Calling glutInitDisplayString + means using a string instead of an integer mask determine + the visual to use. This big ugly code is in glutDstr.cpp */ + return __glutConvertDisplayModeFromString(options); + } + + if(options) { + ulong newoptions = BGL_DOUBLE; + if(gState.displayMode & GLUT_ACCUM) + newoptions |= BGL_ACCUM; + if(gState.displayMode & GLUT_ALPHA) + newoptions |= BGL_ALPHA; + if(gState.displayMode & GLUT_DEPTH) + newoptions |= BGL_DEPTH; + if(gState.displayMode & GLUT_STENCIL) + newoptions |= BGL_STENCIL; + *options = newoptions; + } + + // if not GLUT_DOUBLE, turn on the swap hack bit + gState.swapHack = !(gState.displayMode & GLUT_DOUBLE); + + if(gState.displayMode & GLUT_INDEX) { + __glutWarning("BeOS doesn't support indexed color"); + return 0; + } + if(gState.displayMode & GLUT_MULTISAMPLE) { + return 1; // try to go without multisampling + } + if(gState.displayMode & GLUT_STEREO) { + __glutWarning("BeOS doesn't support stereo windows"); + return 0; + } + if(gState.displayMode & GLUT_LUMINANCE) { + __glutWarning("BeOS doesn't support luminance color model"); + return 0; + } + return 1; // visual supported +} + +/*********************************************************** + * CLASS: GlutBWindow + * + * DESCRIPTION: very thin wrapper around BWindow + ***********************************************************/ +GlutBWindow::GlutBWindow(BRect frame, char *name) : + BWindow(frame, name, B_TITLED_WINDOW, 0) { + SetPulseRate(100000); +} + +bool GlutBWindow::QuitRequested() { + exit(0); // exit program completely on quit + return true; // UNREACHED +} diff --git a/xc/extras/Mesa/src-glut.beos/glutWindow.h b/xc/extras/Mesa/src-glut.beos/glutWindow.h new file mode 100644 index 000000000..7a4292e73 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutWindow.h @@ -0,0 +1,109 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutWindow.h + * + * DESCRIPTION: the GlutWindow class saves all events for + * handling by main thread + ***********************************************************/ + +/*********************************************************** + * Headers + ***********************************************************/ +#include <GL/glut.h> +#include <Window.h> +#include <GLView.h> + +/*********************************************************** + * CLASS: GlutWindow + * + * INHERITS FROM: BGLView (NOT BWindow!) + * + * DESCRIPTION: all information needed for windows and + * subwindows (handled as similarly as possible) + ***********************************************************/ +class GlutWindow : public BGLView { +public: + GlutWindow(GlutWindow *nparent, char *name, int x, int y, int width, + int height, ulong options); + + void KeyDown(const char *bytes, int32 numBytes); + void MouseDown(BPoint point); + void MouseMoved(BPoint point, uint32 transit, const BMessage *message); + void FrameResized(float width, float height); + void Draw(BRect updateRect); + void Hide(); + void Show(); + void Pulse(); // needed since MouseUp() is broken + void MouseCheck(); // check for button state changes + void ErrorCallback(GLenum errorCode); + + static long MenuThread(void *menu); + + int num; // window number returned to user + int cursor; // my cursor +#define GLUT_MAX_MENUS 3 + int menu[GLUT_MAX_MENUS]; // my popup menus + int m_width, m_height; // the last width and height reported to GLUT + uint32 m_buttons; // the last mouse button state + + /* Window relationship state. */ + GlutWindow *parent; /* parent window */ + GlutWindow *children; /* first child window */ + GlutWindow *siblings; /* next sibling */ + + // leave out buttons and dials callbacks that we don't support + 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) */ + GLUTvisibilityCB visibility; /* visibility */ + GLUTspecialCB special; /* special key */ + + bool anyevents; // were any events received? + bool displayEvent; // call display + bool reshapeEvent; // call reshape + bool mouseEvent; // call mouse + bool motionEvent; // call motion + bool passiveEvent; // call passive + bool entryEvent; // call entry + bool keybEvent; // call keyboard + bool visEvent; // call visibility + bool specialEvent; // call special + bool statusEvent; // menu status changed + bool menuEvent; // menu selected + + bool swapHack; // faked out single buffering + + int button, mouseState; // for mouse callback + int mouseX, mouseY; // for mouse callback + int motionX, motionY; // for motion callback + int passiveX, passiveY; // for passive callback + int entryState; // for entry callback + unsigned char key; // for keyboard callback + int keyX, keyY; // for keyboard callback + int visState; // for visibility callback + int specialKey; // for special key callback + int specialX, specialY; // for special callback + int modifierKeys; // modifier key state + int menuStatus; // for status callback + int statusX, statusY; // for status callback + int menuNumber; // for menu and status callbacks + int menuValue; // for menu callback +}; + +/*********************************************************** + * CLASS: GlutBWindow + * + * INHERITS FROM: BWindow + * + * DESCRIPTION: basically a BWindow that won't quit + ***********************************************************/ +class GlutBWindow : public BWindow { +public: + GlutBWindow(BRect frame, char *name); + bool QuitRequested(); // exits app +};
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut.beos/glut_8x13.cpp b/xc/extras/Mesa/src-glut.beos/glut_8x13.cpp new file mode 100644 index 000000000..f0df89ddd --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_8x13.cpp @@ -0,0 +1,2072 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch0data[] = { 0x0 }; +static const BitmapCharRec ch0 = {1,1,0,0,8,ch0data}; +#else +static const BitmapCharRec ch0 = {0,0,0,0,8,0}; +#endif + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,8,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,8,0}; +#endif + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch127data[] = { 0x0 }; +static const BitmapCharRec ch127 = {1,1,0,0,8,ch127data}; +#else +static const BitmapCharRec ch127 = {0,0,0,0,8,0}; +#endif + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,8,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,8,0}; +#endif + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch255 = {6,12,-1,2,8,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {6,10,-1,2,8,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {6,12,-1,2,8,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch252 = {6,10,-1,0,8,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch251 = {6,10,-1,0,8,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch250 = {6,10,-1,0,8,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch249 = {6,10,-1,0,8,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x80,0x78,0xc4,0xa4,0x94,0x8c,0x78,0x4, +}; + +static const BitmapCharRec ch248 = {6,8,-1,1,8,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x20,0x0,0xf8,0x0,0x20,0x20, +}; + +static const BitmapCharRec ch247 = {5,7,-1,-1,8,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch246 = {6,10,-1,0,8,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {6,10,-1,0,8,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch244 = {6,10,-1,0,8,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch243 = {6,10,-1,0,8,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch242 = {6,10,-1,0,8,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x84,0x84,0x84,0x84,0xc4,0xb8,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch241 = {6,10,-1,0,8,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x8,0x50,0x30,0x48, +}; + +static const BitmapCharRec ch240 = {6,10,-1,0,8,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch239 = {5,10,-1,0,8,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x90,0x60, +}; + +static const BitmapCharRec ch238 = {5,10,-1,0,8,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch237 = {5,10,-1,0,8,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch236 = {5,10,-1,0,8,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch235 = {6,10,-1,0,8,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch234 = {6,10,-1,0,8,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch233 = {6,10,-1,0,8,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch232 = {6,10,-1,0,8,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x20,0x10,0x78,0x84,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch231 = {6,8,-1,2,8,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x6c,0x92,0x90,0x7c,0x12,0x6c, +}; + +static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x30,0x48,0x30, +}; + +static const BitmapCharRec ch229 = {6,10,-1,0,8,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch228 = {6,10,-1,0,8,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch227 = {6,10,-1,0,8,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch226 = {6,10,-1,0,8,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch225 = {6,10,-1,0,8,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch224 = {6,10,-1,0,8,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0x80,0xb8,0xc4,0x84,0x84,0xf8,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch223 = {6,9,-1,1,8,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80, +}; + +static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x20,0x20,0x20,0x20,0x50,0x88,0x88,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch221 = {5,10,-1,0,8,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch219 = {6,10,-1,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch218 = {6,10,-1,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {6,10,-1,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x78,0xc4,0xa4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, +}; + +static const BitmapCharRec ch216 = {6,11,-1,1,8,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x84,0x48,0x30,0x30,0x48,0x84, +}; + +static const BitmapCharRec ch215 = {6,6,-1,-1,8,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch214 = {7,10,0,0,8,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch213 = {7,10,0,0,8,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x24,0x18, +}; + +static const BitmapCharRec ch212 = {7,10,0,0,8,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch211 = {7,10,0,0,8,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x8,0x10, +}; + +static const BitmapCharRec ch210 = {7,10,0,0,8,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0xfc,0x42,0x42,0x42,0xe2,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch208 = {7,9,0,0,8,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch207 = {5,10,-1,0,8,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch206 = {5,10,-1,0,8,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch205 = {5,10,-1,0,8,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch204 = {5,10,-1,0,8,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch203 = {6,10,-1,0,8,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch202 = {6,10,-1,0,8,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch201 = {6,10,-1,0,8,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch200 = {6,10,-1,0,8,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x20,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch199 = {6,11,-1,2,8,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x9e,0x90,0x90,0xf0,0x9c,0x90,0x90,0x90,0x6e, +}; + +static const BitmapCharRec ch198 = {7,9,0,0,8,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x30,0x48,0x30, +}; + +static const BitmapCharRec ch197 = {6,10,-1,0,8,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch196 = {6,10,-1,0,8,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch195 = {6,10,-1,0,8,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch194 = {6,10,-1,0,8,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch193 = {6,10,-1,0,8,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {6,10,-1,0,8,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x78,0x84,0x84,0x80,0x40,0x20,0x20,0x0,0x20, +}; + +static const BitmapCharRec ch191 = {6,9,-1,0,8,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch190 = {7,10,0,0,8,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch189 = {7,10,0,0,8,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch188 = {7,10,0,0,8,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x90,0x48,0x24,0x12,0x24,0x48,0x90, +}; + +static const BitmapCharRec ch187 = {7,7,0,-1,8,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xf0,0x0,0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch186 = {4,6,-1,-3,8,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {3,6,-1,-4,8,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x40, +}; + +static const BitmapCharRec ch184 = {2,2,-3,2,8,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0, +}; + +static const BitmapCharRec ch183 = {2,1,-3,-4,8,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, +}; + +static const BitmapCharRec ch182 = {6,9,-1,0,8,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0xb4,0xcc,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch181 = {6,7,-1,1,8,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,-3,-8,8,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x60,0x90,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch179 = {4,6,-1,-4,8,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf0,0x80,0x60,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch178 = {4,6,-1,-4,8,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,-1,-1,8,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,-2,-5,8,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xfc, +}; + +static const BitmapCharRec ch175 = {6,1,-1,-8,8,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x38,0x44,0xaa,0xb2,0xaa,0xaa,0x92,0x44,0x38, +}; + +static const BitmapCharRec ch174 = {7,9,0,-1,8,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xfc, +}; + +static const BitmapCharRec ch173 = {6,1,-1,-4,8,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x4,0x4,0x4,0xfc, +}; + +static const BitmapCharRec ch172 = {6,4,-1,-1,8,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x12,0x24,0x48,0x90,0x48,0x24,0x12, +}; + +static const BitmapCharRec ch171 = {7,7,0,-1,8,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xf8,0x0,0x78,0x88,0x78,0x8,0x70, +}; + +static const BitmapCharRec ch170 = {5,7,-1,-2,8,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x38,0x44,0x92,0xaa,0xa2,0xaa,0x92,0x44,0x38, +}; + +static const BitmapCharRec ch169 = {7,9,0,-1,8,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xd8, +}; + +static const BitmapCharRec ch168 = {5,1,-1,-8,8,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x60,0x90,0x10,0x60,0x90,0x90,0x60,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch167 = {4,10,-2,0,8,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,9,-3,0,8,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch165 = {7,9,0,0,8,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x84,0x78,0x48,0x48,0x78,0x84, +}; + +static const BitmapCharRec ch164 = {6,6,-1,-1,8,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch163 = {7,9,0,0,8,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x20,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x20, +}; + +static const BitmapCharRec ch162 = {5,8,-1,-1,8,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,9,-3,0,8,ch161data}; + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x90,0xa8,0x48, +}; + +static const BitmapCharRec ch126 = {5,3,-1,-6,8,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xe0,0x10,0x10,0x20,0x18,0x20,0x10,0x10,0xe0, +}; + +static const BitmapCharRec ch125 = {5,9,-1,0,8,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,9,-3,0,8,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x38,0x40,0x40,0x20,0xc0,0x20,0x40,0x40,0x38, +}; + +static const BitmapCharRec ch123 = {5,9,-2,0,8,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xfc,0x40,0x20,0x10,0x8,0xfc, +}; + +static const BitmapCharRec ch122 = {6,6,-1,0,8,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch121 = {6,8,-1,2,8,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x84,0x48,0x30,0x30,0x48,0x84, +}; + +static const BitmapCharRec ch120 = {6,6,-1,0,8,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x44,0xaa,0x92,0x92,0x82,0x82, +}; + +static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x50,0x50,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch118 = {5,6,-1,0,8,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x74,0x88,0x88,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch117 = {6,6,-1,0,8,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x38,0x44,0x40,0x40,0x40,0xf8,0x40,0x40, +}; + +static const BitmapCharRec ch116 = {6,8,-1,0,8,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x78,0x84,0x18,0x60,0x84,0x78, +}; + +static const BitmapCharRec ch115 = {6,6,-1,0,8,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x40,0x40,0x40,0x40,0x44,0xb8, +}; + +static const BitmapCharRec ch114 = {6,6,-1,0,8,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x4,0x4,0x4,0x74,0x8c,0x84,0x8c,0x74, +}; + +static const BitmapCharRec ch113 = {6,8,-1,2,8,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0x80,0xb8,0xc4,0x84,0xc4,0xb8, +}; + +static const BitmapCharRec ch112 = {6,8,-1,2,8,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x78,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch111 = {6,6,-1,0,8,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x84,0x84,0x84,0x84,0xc4,0xb8, +}; + +static const BitmapCharRec ch110 = {6,6,-1,0,8,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x82,0x92,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, +}; + +static const BitmapCharRec ch108 = {5,9,-1,0,8,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x84,0x88,0x90,0xe0,0x90,0x88,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {6,9,-1,0,8,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x18,0x0,0x8, +}; + +static const BitmapCharRec ch106 = {5,10,-1,2,8,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x20, +}; + +static const BitmapCharRec ch105 = {5,8,-1,0,8,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x84,0x84,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {6,9,-1,0,8,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x78,0x84,0x78,0x80,0x70,0x88,0x88,0x74, +}; + +static const BitmapCharRec ch103 = {6,8,-1,2,8,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x40,0x40,0x40,0x40,0xf8,0x40,0x40,0x44,0x38, +}; + +static const BitmapCharRec ch102 = {6,9,-1,0,8,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78, +}; + +static const BitmapCharRec ch101 = {6,6,-1,0,8,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x74,0x8c,0x84,0x84,0x8c,0x74,0x4,0x4,0x4, +}; + +static const BitmapCharRec ch100 = {6,9,-1,0,8,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x78,0x84,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch99 = {6,6,-1,0,8,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {6,9,-1,0,8,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78, +}; + +static const BitmapCharRec ch97 = {6,6,-1,0,8,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x10,0x60,0xe0, +}; + +static const BitmapCharRec ch96 = {4,3,-2,-6,8,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xfe, +}; + +static const BitmapCharRec ch95 = {7,1,0,1,8,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x88,0x50,0x20, +}; + +static const BitmapCharRec ch94 = {5,3,-1,-6,8,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, +}; + +static const BitmapCharRec ch93 = {4,9,-1,0,8,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x2,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {7,9,0,0,8,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, +}; + +static const BitmapCharRec ch91 = {4,9,-2,0,8,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xfc,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0xfc, +}; + +static const BitmapCharRec ch90 = {6,9,-1,0,8,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch89 = {7,9,0,0,8,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x82,0x82,0x44,0x28,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch88 = {7,9,0,0,8,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x44,0xaa,0x92,0x92,0x92,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch87 = {7,9,0,0,8,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,9,0,0,8,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, +}; + +static const BitmapCharRec ch84 = {7,9,0,0,8,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x78,0x84,0x4,0x4,0x78,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x84,0x88,0x90,0xa0,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x4,0x78,0x94,0xa4,0x84,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch81 = {6,10,-1,1,8,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch79 = {6,9,-1,0,8,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x84,0x84,0x84,0x8c,0x94,0xa4,0xc4,0x84,0x84, +}; + +static const BitmapCharRec ch78 = {6,9,-1,0,8,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x82,0x82,0x82,0x92,0x92,0xaa,0xc6,0x82,0x82, +}; + +static const BitmapCharRec ch77 = {7,9,0,0,8,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xfc,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {6,9,-1,0,8,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x84,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x84, +}; + +static const BitmapCharRec ch75 = {6,9,-1,0,8,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x70,0x88,0x8,0x8,0x8,0x8,0x8,0x8,0x3c, +}; + +static const BitmapCharRec ch74 = {6,9,-1,0,8,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, +}; + +static const BitmapCharRec ch73 = {5,9,-1,0,8,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch72 = {6,9,-1,0,8,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x74,0x8c,0x84,0x9c,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch71 = {6,9,-1,0,8,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xfc,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch68 = {7,9,0,0,8,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch67 = {6,9,-1,0,8,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xfc,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch66 = {7,9,0,0,8,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x48,0x30, +}; + +static const BitmapCharRec ch65 = {6,9,-1,0,8,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x78,0x80,0x94,0xac,0xa4,0x9c,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch64 = {6,9,-1,0,8,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x10,0x0,0x10,0x10,0x8,0x4,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch63 = {6,9,-1,0,8,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x10,0x8,0x10,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {5,9,-1,0,8,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xfc,0x0,0x0,0xfc, +}; + +static const BitmapCharRec ch61 = {6,4,-1,-2,8,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x8,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x8, +}; + +static const BitmapCharRec ch60 = {5,9,-2,0,8,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x60,0x70,0x0,0x0,0x20,0x70,0x20, +}; + +static const BitmapCharRec ch59 = {4,8,-1,1,8,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x40,0xe0,0x40,0x0,0x0,0x40,0xe0,0x40, +}; + +static const BitmapCharRec ch58 = {3,8,-2,1,8,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x70,0x8,0x4,0x4,0x74,0x8c,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch57 = {6,9,-1,0,8,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x78,0x84,0x84,0x84,0x78,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch56 = {6,9,-1,0,8,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x10,0x10,0x8,0x4,0xfc, +}; + +static const BitmapCharRec ch55 = {6,9,-1,0,8,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x78,0x84,0x84,0xc4,0xb8,0x80,0x80,0x40,0x38, +}; + +static const BitmapCharRec ch54 = {6,9,-1,0,8,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x78,0x84,0x4,0x4,0xc4,0xb8,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch53 = {6,9,-1,0,8,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x8,0x8,0xfc,0x88,0x88,0x48,0x28,0x18,0x8, +}; + +static const BitmapCharRec ch52 = {6,9,-1,0,8,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x78,0x84,0x4,0x4,0x38,0x10,0x8,0x4,0xfc, +}; + +static const BitmapCharRec ch51 = {6,9,-1,0,8,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xfc,0x80,0x40,0x30,0x8,0x4,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch50 = {6,9,-1,0,8,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, +}; + +static const BitmapCharRec ch49 = {5,9,-1,0,8,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x48,0x30, +}; + +static const BitmapCharRec ch48 = {6,9,-1,0,8,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x2, +}; + +static const BitmapCharRec ch47 = {7,9,0,0,8,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x40,0xe0,0x40, +}; + +static const BitmapCharRec ch46 = {3,3,-2,1,8,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xfc, +}; + +static const BitmapCharRec ch45 = {6,1,-1,-4,8,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x60,0x70, +}; + +static const BitmapCharRec ch44 = {4,3,-1,1,8,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,-1,-2,8,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x48,0x30,0xfc,0x30,0x48, +}; + +static const BitmapCharRec ch42 = {6,5,-1,-2,8,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,9,-2,0,8,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,9,-3,0,8,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x60,0x70, +}; + +static const BitmapCharRec ch39 = {4,3,-1,-6,8,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x74,0x88,0x94,0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch38 = {6,7,-1,0,8,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x88,0x54,0x48,0x20,0x10,0x10,0x48,0xa4,0x44, +}; + +static const BitmapCharRec ch37 = {6,9,-1,0,8,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0xf0,0x28,0x70,0xa0,0x78,0x20, +}; + +static const BitmapCharRec ch36 = {5,7,-1,-1,8,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x48,0x48,0xfc,0x48,0xfc,0x48,0x48, +}; + +static const BitmapCharRec ch35 = {6,7,-1,-1,8,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x90,0x90,0x90, +}; + +static const BitmapCharRec ch34 = {4,3,-2,-6,8,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,9,-3,0,8,ch33data}; + +/* char: 0x1f */ + +static const GLubyte ch31data[] = { +0x80, +}; + +static const BitmapCharRec ch31 = {1,1,-3,-3,8,ch31data}; + +/* char: 0x1e */ + +static const GLubyte ch30data[] = { +0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch30 = {7,9,0,0,8,ch30data}; + +/* char: 0x1d */ + +static const GLubyte ch29data[] = { +0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, +}; + +static const BitmapCharRec ch29 = {7,7,0,0,8,ch29data}; + +/* char: 0x1c */ + +static const GLubyte ch28data[] = { +0x88,0x48,0x48,0x48,0x48,0xfc, +}; + +static const BitmapCharRec ch28 = {6,6,-1,0,8,ch28data}; + +/* char: 0x1b */ + +static const GLubyte ch27data[] = { +0xfe,0x80,0x20,0x8,0x2,0x8,0x20,0x80, +}; + +static const BitmapCharRec ch27 = {7,8,0,0,8,ch27data}; + +/* char: 0x1a */ + +static const GLubyte ch26data[] = { +0xfe,0x2,0x8,0x20,0x80,0x20,0x8,0x2, +}; + +static const BitmapCharRec ch26 = {7,8,0,0,8,ch26data}; + +/* char: 0x19 */ + +static const GLubyte ch25data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch25 = {1,13,-3,2,8,ch25data}; + +/* char: 0x18 */ + +static const GLubyte ch24data[] = { +0x10,0x10,0x10,0x10,0x10,0xff, +}; + +static const BitmapCharRec ch24 = {8,6,0,2,8,ch24data}; + +/* char: 0x17 */ + +static const GLubyte ch23data[] = { +0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch23 = {8,8,0,-3,8,ch23data}; + +/* char: 0x16 */ + +static const GLubyte ch22data[] = { +0x10,0x10,0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch22 = {4,13,0,2,8,ch22data}; + +/* char: 0x15 */ + +static const GLubyte ch21data[] = { +0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch21 = {5,13,-3,2,8,ch21data}; + +/* char: 0x14 */ + +static const GLubyte ch20data[] = { +0xff, +}; + +static const BitmapCharRec ch20 = {8,1,0,1,8,ch20data}; + +/* char: 0x13 */ + +static const GLubyte ch19data[] = { +0xff, +}; + +static const BitmapCharRec ch19 = {8,1,0,-1,8,ch19data}; + +/* char: 0x12 */ + +static const GLubyte ch18data[] = { +0xff, +}; + +static const BitmapCharRec ch18 = {8,1,0,-3,8,ch18data}; + +/* char: 0x11 */ + +static const GLubyte ch17data[] = { +0xff, +}; + +static const BitmapCharRec ch17 = {8,1,0,-5,8,ch17data}; + +/* char: 0x10 */ + +static const GLubyte ch16data[] = { +0xff, +}; + +static const BitmapCharRec ch16 = {8,1,0,-7,8,ch16data}; + +/* char: 0xf */ + +static const GLubyte ch15data[] = { +0x10,0x10,0x10,0x10,0x10,0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch15 = {8,13,0,2,8,ch15data}; + +/* char: 0xe */ + +static const GLubyte ch14data[] = { +0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch14 = {5,8,-3,-3,8,ch14data}; + +/* char: 0xd */ + +static const GLubyte ch13data[] = { +0x80,0x80,0x80,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch13 = {5,6,-3,2,8,ch13data}; + +/* char: 0xc */ + +static const GLubyte ch12data[] = { +0x10,0x10,0x10,0x10,0x10,0xf0, +}; + +static const BitmapCharRec ch12 = {4,6,0,2,8,ch12data}; + +/* char: 0xb */ + +static const GLubyte ch11data[] = { +0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch11 = {4,8,0,-3,8,ch11data}; + +/* char: 0xa */ + +static const GLubyte ch10data[] = { +0x8,0x8,0x8,0x8,0x3e,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch10 = {7,9,0,2,8,ch10data}; + +/* char: 0x9 */ + +static const GLubyte ch9data[] = { +0x3e,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, +}; + +static const BitmapCharRec ch9 = {7,9,0,2,8,ch9data}; + +/* char: 0x8 */ + +static const GLubyte ch8data[] = { +0xfe,0x10,0x10,0xfe,0x10,0x10, +}; + +static const BitmapCharRec ch8 = {7,6,0,0,8,ch8data}; + +/* char: 0x7 */ + +static const GLubyte ch7data[] = { +0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch7 = {5,4,-1,-5,8,ch7data}; + +/* char: 0x6 */ + +static const GLubyte ch6data[] = { +0x20,0x20,0x3c,0x20,0x3e,0xf8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch6 = {7,9,0,2,8,ch6data}; + +/* char: 0x5 */ + +static const GLubyte ch5data[] = { +0x22,0x22,0x3c,0x22,0x3c,0x78,0x80,0x80,0x78, +}; + +static const BitmapCharRec ch5 = {7,9,0,2,8,ch5data}; + +/* char: 0x4 */ + +static const GLubyte ch4data[] = { +0x10,0x10,0x1c,0x10,0x9e,0x80,0xe0,0x80,0xf0, +}; + +static const BitmapCharRec ch4 = {7,9,0,2,8,ch4data}; + +/* char: 0x3 */ + +static const GLubyte ch3data[] = { +0x8,0x8,0x8,0x3e,0x88,0x88,0xf8,0x88,0x88, +}; + +static const BitmapCharRec ch3 = {7,9,0,2,8,ch3data}; + +/* char: 0x2 */ + +static const GLubyte ch2data[] = { +0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, +}; + +static const BitmapCharRec ch2 = {8,12,0,2,8,ch2data}; + +/* char: 0x1 */ + +static const GLubyte ch1data[] = { +0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, +}; + +static const BitmapCharRec ch1 = {7,7,0,-1,8,ch1data}; + +static const BitmapCharRec * const chars[] = { +&ch0, +&ch1, +&ch2, +&ch3, +&ch4, +&ch5, +&ch6, +&ch7, +&ch8, +&ch9, +&ch10, +&ch11, +&ch12, +&ch13, +&ch14, +&ch15, +&ch16, +&ch17, +&ch18, +&ch19, +&ch20, +&ch21, +&ch22, +&ch23, +&ch24, +&ch25, +&ch26, +&ch27, +&ch28, +&ch29, +&ch30, +&ch31, +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +&ch127, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmap8By13 = { +"-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1", +256, +0, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_9x15.cpp b/xc/extras/Mesa/src-glut.beos/glut_9x15.cpp new file mode 100644 index 000000000..52b379fda --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_9x15.cpp @@ -0,0 +1,2074 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch0data[] = { 0x0 }; +static const BitmapCharRec ch0 = {1,1,0,0,9,ch0data}; +#else +static const BitmapCharRec ch0 = {0,0,0,0,9,0}; +#endif + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,9,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,9,0}; +#endif + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch127data[] = { 0x0 }; +static const BitmapCharRec ch127 = {1,1,0,0,9,ch127data}; +#else +static const BitmapCharRec ch127 = {0,0,0,0,9,0}; +#endif + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,9,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,9,0}; +#endif + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch255 = {6,14,-1,3,9,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {7,12,-1,3,9,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch253 = {6,14,-1,3,9,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch252 = {7,11,-1,0,9,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch251 = {7,11,-1,0,9,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch250 = {7,11,-1,0,9,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch249 = {7,11,-1,0,9,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x80,0x7c,0xa2,0xa2,0x92,0x8a,0x8a,0x7c,0x2, +}; + +static const BitmapCharRec ch248 = {7,9,-1,1,9,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x10,0x38,0x10,0x0,0xfe,0x0,0x10,0x38,0x10, +}; + +static const BitmapCharRec ch247 = {7,9,-1,0,9,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch246 = {7,11,-1,0,9,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {7,11,-1,0,9,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch244 = {7,11,-1,0,9,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch243 = {7,11,-1,0,9,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch242 = {7,11,-1,0,9,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch241 = {7,11,-1,0,9,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x8,0x50,0x30,0x48, +}; + +static const BitmapCharRec ch240 = {7,11,-1,0,9,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch239 = {5,11,-2,0,9,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x90,0x60, +}; + +static const BitmapCharRec ch238 = {5,11,-2,0,9,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60,0x10, +}; + +static const BitmapCharRec ch237 = {5,11,-2,0,9,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x30,0x40, +}; + +static const BitmapCharRec ch236 = {5,11,-2,0,9,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch235 = {7,11,-1,0,9,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch234 = {7,11,-1,0,9,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch233 = {7,11,-1,0,9,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch232 = {7,11,-1,0,9,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch231 = {7,10,-1,3,9,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x6e,0x92,0x90,0x7c,0x12,0x92,0x6c, +}; + +static const BitmapCharRec ch230 = {7,7,-1,0,9,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x18,0x24,0x18, +}; + +static const BitmapCharRec ch229 = {7,11,-1,0,9,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch228 = {7,11,-1,0,9,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch227 = {7,11,-1,0,9,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch226 = {7,11,-1,0,9,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch225 = {7,11,-1,0,9,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch224 = {7,11,-1,0,9,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0x80,0xbc,0xc2,0x82,0x82,0xfc,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch223 = {7,9,-1,1,9,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc,0x80,0x80, +}; + +static const BitmapCharRec ch222 = {7,10,-1,0,9,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch221 = {7,11,-1,0,9,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch220 = {7,11,-1,0,9,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch219 = {7,11,-1,0,9,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch218 = {7,11,-1,0,9,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch217 = {7,11,-1,0,9,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x7c,0xc2,0xa2,0xa2,0x92,0x92,0x8a,0x8a,0x86,0x7c,0x2, +}; + +static const BitmapCharRec ch216 = {7,12,-1,1,9,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x82,0x44,0x28,0x10,0x28,0x44,0x82, +}; + +static const BitmapCharRec ch215 = {7,7,-1,-1,9,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch214 = {7,11,-1,0,9,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch213 = {7,11,-1,0,9,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch212 = {7,11,-1,0,9,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch211 = {7,11,-1,0,9,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch210 = {7,11,-1,0,9,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x82,0x86,0x8a,0x92,0x92,0xa2,0xc2,0x82,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch209 = {7,11,-1,0,9,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0xfc,0x42,0x42,0x42,0x42,0xf2,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch208 = {7,10,-1,0,9,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch207 = {5,11,-2,0,9,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x88,0x70, +}; + +static const BitmapCharRec ch206 = {5,11,-2,0,9,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x60,0x10, +}; + +static const BitmapCharRec ch205 = {5,11,-2,0,9,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x30,0x40, +}; + +static const BitmapCharRec ch204 = {5,11,-2,0,9,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch203 = {7,11,-1,0,9,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch202 = {7,11,-1,0,9,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch201 = {7,11,-1,0,9,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch200 = {7,11,-1,0,9,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch199 = {7,13,-1,3,9,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x9e,0x90,0x90,0x90,0xfc,0x90,0x90,0x90,0x90,0x6e, +}; + +static const BitmapCharRec ch198 = {7,10,-1,0,9,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,11,-1,0,9,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch195 = {7,11,-1,0,9,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch194 = {7,11,-1,0,9,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch193 = {7,11,-1,0,9,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch192 = {7,11,-1,0,9,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x7c,0x82,0x82,0x80,0x40,0x20,0x10,0x10,0x0,0x10, +}; + +static const BitmapCharRec ch191 = {7,10,-1,0,9,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch190 = {7,10,-1,0,9,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch189 = {7,10,-1,0,9,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch188 = {7,10,-1,0,9,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x90,0x48,0x24,0x12,0x12,0x24,0x48,0x90, +}; + +static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xf8,0x0,0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch186 = {5,6,-1,-5,9,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {3,6,-1,-4,9,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0x60,0x90,0x30, +}; + +static const BitmapCharRec ch184 = {4,3,-2,3,9,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch183 = {2,2,-4,-4,9,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0xa,0xa,0xa,0xa,0xa,0x7a,0x8a,0x8a,0x8a,0x7e, +}; + +static const BitmapCharRec ch182 = {7,10,-1,0,9,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0xba,0xc6,0x82,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch181 = {7,9,-1,2,9,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0xc0,0x20, +}; + +static const BitmapCharRec ch180 = {3,2,-3,-9,9,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x60,0x90,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch179 = {4,6,-1,-4,9,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf0,0x80,0x60,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch178 = {4,6,-1,-4,9,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xfe,0x0,0x10,0x10,0x10,0xfe,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch177 = {7,9,-1,-1,9,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,-3,-6,9,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xfc, +}; + +static const BitmapCharRec ch175 = {6,1,-1,-9,9,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x3c,0x42,0xa5,0xa9,0xbd,0xa5,0xb9,0x42,0x3c, +}; + +static const BitmapCharRec ch174 = {8,9,0,-1,9,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xfc, +}; + +static const BitmapCharRec ch173 = {6,1,-1,-4,9,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x4,0x4,0x4,0xfc, +}; + +static const BitmapCharRec ch172 = {6,4,-1,-2,9,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x12,0x24,0x48,0x90,0x90,0x48,0x24,0x12, +}; + +static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xf8,0x0,0x78,0x90,0x70,0x90,0x60, +}; + +static const BitmapCharRec ch170 = {5,7,-3,-3,9,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x3c,0x42,0x99,0xa5,0xa1,0xa5,0x99,0x42,0x3c, +}; + +static const BitmapCharRec ch169 = {8,9,0,-1,9,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0,0xa0, +}; + +static const BitmapCharRec ch168 = {3,2,-3,-9,9,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x70,0x88,0x8,0x70,0x88,0x88,0x88,0x70,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch167 = {5,11,-2,1,9,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,11,-4,1,9,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x10,0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch165 = {7,10,-1,0,9,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x82,0x7c,0x44,0x44,0x7c,0x82, +}; + +static const BitmapCharRec ch164 = {7,6,-1,-3,9,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch163 = {7,10,-1,0,9,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x78,0xa4,0xa0,0x90,0x94,0x78,0x8, +}; + +static const BitmapCharRec ch162 = {6,8,-1,0,9,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80, +}; + +static const BitmapCharRec ch161 = {1,11,-4,0,9,ch161data}; + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x8c,0x92,0x62, +}; + +static const BitmapCharRec ch126 = {7,3,-1,-7,9,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xe0,0x10,0x10,0x10,0x20,0x18,0x18,0x20,0x10,0x10,0x10,0xe0, +}; + +static const BitmapCharRec ch125 = {5,12,-1,1,9,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,12,-4,1,9,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x38,0x40,0x40,0x40,0x20,0xc0,0xc0,0x20,0x40,0x40,0x40,0x38, +}; + +static const BitmapCharRec ch123 = {5,12,-3,1,9,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xfe,0x40,0x20,0x10,0x8,0x4,0xfe, +}; + +static const BitmapCharRec ch122 = {7,7,-1,0,9,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch121 = {6,10,-1,3,9,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x82,0x44,0x28,0x10,0x28,0x44,0x82, +}; + +static const BitmapCharRec ch120 = {7,7,-1,0,9,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x44,0xaa,0x92,0x92,0x92,0x82,0x82, +}; + +static const BitmapCharRec ch119 = {7,7,-1,0,9,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x10,0x28,0x28,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch118 = {7,7,-1,0,9,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch117 = {7,7,-1,0,9,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x1c,0x22,0x20,0x20,0x20,0x20,0xfc,0x20,0x20, +}; + +static const BitmapCharRec ch116 = {7,9,-1,0,9,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x7c,0x82,0x2,0x7c,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch115 = {7,7,-1,0,9,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x40,0x40,0x40,0x40,0x42,0x62,0x9c, +}; + +static const BitmapCharRec ch114 = {7,7,-1,0,9,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x2,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x86,0x7a, +}; + +static const BitmapCharRec ch113 = {7,10,-1,3,9,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc, +}; + +static const BitmapCharRec ch112 = {7,10,-1,3,9,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch111 = {7,7,-1,0,9,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x82,0x82,0x82,0x82,0x82,0xc2,0xbc, +}; + +static const BitmapCharRec ch110 = {7,7,-1,0,9,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x82,0x92,0x92,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0, +}; + +static const BitmapCharRec ch108 = {5,10,-2,0,9,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x82,0x8c,0xb0,0xc0,0xb0,0x8c,0x82,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {7,10,-1,0,9,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x78,0x84,0x84,0x84,0x4,0x4,0x4,0x4,0x4,0x1c,0x0,0x0,0xc, +}; + +static const BitmapCharRec ch106 = {6,13,-1,3,9,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60, +}; + +static const BitmapCharRec ch105 = {5,10,-2,0,9,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {7,10,-1,0,9,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x7c,0x82,0x82,0x7c,0x80,0x78,0x84,0x84,0x84,0x7a, +}; + +static const BitmapCharRec ch103 = {7,10,-1,3,9,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x20,0x20,0x20,0x20,0xf8,0x20,0x20,0x22,0x22,0x1c, +}; + +static const BitmapCharRec ch102 = {7,10,-1,0,9,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch101 = {7,7,-1,0,9,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x7a,0x86,0x82,0x82,0x82,0x86,0x7a,0x2,0x2,0x2, +}; + +static const BitmapCharRec ch100 = {7,10,-1,0,9,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch99 = {7,7,-1,0,9,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {7,10,-1,0,9,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c, +}; + +static const BitmapCharRec ch97 = {7,7,-1,0,9,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x10,0x20,0x40,0xc0, +}; + +static const BitmapCharRec ch96 = {4,4,-3,-6,9,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xff, +}; + +static const BitmapCharRec ch95 = {8,1,0,1,9,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x82,0x44,0x28,0x10, +}; + +static const BitmapCharRec ch94 = {7,4,-1,-6,9,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, +}; + +static const BitmapCharRec ch93 = {4,12,-2,1,9,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x2,0x4,0x4,0x8,0x10,0x10,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch92 = {7,10,-1,0,9,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, +}; + +static const BitmapCharRec ch91 = {4,12,-3,1,9,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xfe,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, +}; + +static const BitmapCharRec ch90 = {7,10,-1,0,9,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch89 = {7,10,-1,0,9,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x82,0x82,0x44,0x28,0x10,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch88 = {7,10,-1,0,9,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x44,0xaa,0x92,0x92,0x92,0x92,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch87 = {7,10,-1,0,9,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,10,-1,0,9,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch85 = {7,10,-1,0,9,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, +}; + +static const BitmapCharRec ch84 = {7,10,-1,0,9,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x7c,0x82,0x82,0x2,0xc,0x70,0x80,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch83 = {7,10,-1,0,9,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x82,0x82,0x84,0x88,0x90,0xfc,0x82,0x82,0x82,0xfc, +}; + +static const BitmapCharRec ch82 = {7,10,-1,0,9,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x6,0x8,0x7c,0x92,0xa2,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch81 = {7,12,-1,2,9,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc, +}; + +static const BitmapCharRec ch80 = {7,10,-1,0,9,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch79 = {7,10,-1,0,9,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x82,0x82,0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x82, +}; + +static const BitmapCharRec ch78 = {7,10,-1,0,9,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x82,0x82,0x82,0x92,0x92,0xaa,0xaa,0xc6,0x82,0x82, +}; + +static const BitmapCharRec ch77 = {7,10,-1,0,9,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xfe,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {7,10,-1,0,9,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x82,0x84,0x88,0x90,0xa0,0xe0,0x90,0x88,0x84,0x82, +}; + +static const BitmapCharRec ch75 = {7,10,-1,0,9,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x78,0x84,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x1e, +}; + +static const BitmapCharRec ch74 = {7,10,-1,0,9,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, +}; + +static const BitmapCharRec ch73 = {5,10,-2,0,9,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x82,0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch72 = {7,10,-1,0,9,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x7c,0x82,0x82,0x82,0x8e,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch71 = {7,10,-1,0,9,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x40,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, +}; + +static const BitmapCharRec ch70 = {7,10,-1,0,9,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xfe,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, +}; + +static const BitmapCharRec ch69 = {7,10,-1,0,9,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch68 = {7,10,-1,0,9,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch67 = {7,10,-1,0,9,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xfc,0x42,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch66 = {7,10,-1,0,9,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x44,0x28,0x10, +}; + +static const BitmapCharRec ch65 = {7,10,-1,0,9,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x7c,0x80,0x80,0x9a,0xa6,0xa2,0x9e,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch64 = {7,10,-1,0,9,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x10,0x0,0x10,0x10,0x8,0x4,0x2,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch63 = {7,10,-1,0,9,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {5,10,-2,0,9,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xfe,0x0,0x0,0xfe, +}; + +static const BitmapCharRec ch61 = {7,4,-1,-2,9,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x8,0x10,0x20,0x40,0x80,0x80,0x40,0x20,0x10,0x8, +}; + +static const BitmapCharRec ch60 = {5,10,-2,0,9,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch59 = {2,10,-4,3,9,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch58 = {2,7,-4,0,9,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x78,0x4,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch57 = {7,10,-1,0,9,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x38,0x44,0x82,0x82,0x44,0x38,0x44,0x82,0x44,0x38, +}; + +static const BitmapCharRec ch56 = {7,10,-1,0,9,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x10,0x8,0x4,0x2,0x2,0xfe, +}; + +static const BitmapCharRec ch55 = {7,10,-1,0,9,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x7c,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x40,0x3c, +}; + +static const BitmapCharRec ch54 = {7,10,-1,0,9,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x7c,0x82,0x2,0x2,0x2,0xc2,0xbc,0x80,0x80,0xfe, +}; + +static const BitmapCharRec ch53 = {7,10,-1,0,9,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x4,0x4,0x4,0xfe,0x84,0x44,0x24,0x14,0xc,0x4, +}; + +static const BitmapCharRec ch52 = {7,10,-1,0,9,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x7c,0x82,0x2,0x2,0x2,0x1c,0x8,0x4,0x2,0xfe, +}; + +static const BitmapCharRec ch51 = {7,10,-1,0,9,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xfe,0x80,0x40,0x30,0x8,0x4,0x2,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch50 = {7,10,-1,0,9,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xfe,0x10,0x10,0x10,0x10,0x10,0x90,0x50,0x30,0x10, +}; + +static const BitmapCharRec ch49 = {7,10,-1,0,9,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38, +}; + +static const BitmapCharRec ch48 = {7,10,-1,0,9,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x40,0x40,0x20,0x10,0x10,0x8,0x4,0x4,0x2, +}; + +static const BitmapCharRec ch47 = {7,10,-1,0,9,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch46 = {2,2,-4,0,9,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xfe, +}; + +static const BitmapCharRec ch45 = {7,1,-1,-4,9,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch44 = {2,5,-4,3,9,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x10,0x10,0x10,0xfe,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch43 = {7,7,-1,-1,9,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x10,0x92,0x54,0x38,0x54,0x92,0x10, +}; + +static const BitmapCharRec ch42 = {7,7,-1,-1,9,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,12,-3,1,9,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,12,-3,1,9,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0x20,0x30, +}; + +static const BitmapCharRec ch39 = {4,4,-3,-6,9,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x62,0x94,0x88,0x94,0x62,0x60,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch38 = {7,10,-1,0,9,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x84,0x4a,0x4a,0x24,0x10,0x10,0x48,0xa4,0xa4,0x42, +}; + +static const BitmapCharRec ch37 = {7,10,-1,0,9,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x10,0x7c,0x92,0x12,0x12,0x14,0x38,0x50,0x90,0x92,0x7c,0x10, +}; + +static const BitmapCharRec ch36 = {7,12,-1,1,9,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48, +}; + +static const BitmapCharRec ch35 = {6,8,-1,-1,9,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x90,0x90,0x90, +}; + +static const BitmapCharRec ch34 = {4,3,-3,-7,9,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,11,-4,0,9,ch33data}; + +/* char: 0x1f */ + +static const GLubyte ch31data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch31 = {2,2,-4,-2,9,ch31data}; + +/* char: 0x1e */ + +static const GLubyte ch30data[] = { +0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch30 = {7,10,-1,0,9,ch30data}; + +/* char: 0x1d */ + +static const GLubyte ch29data[] = { +0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, +}; + +static const BitmapCharRec ch29 = {7,7,-1,0,9,ch29data}; + +/* char: 0x1c */ + +static const GLubyte ch28data[] = { +0x44,0x24,0x24,0x24,0x24,0x24,0xfe, +}; + +static const BitmapCharRec ch28 = {7,7,-1,0,9,ch28data}; + +/* char: 0x1b */ + +static const GLubyte ch27data[] = { +0xfe,0x0,0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch27 = {7,12,-1,2,9,ch27data}; + +/* char: 0x1a */ + +static const GLubyte ch26data[] = { +0xfc,0x0,0x4,0x8,0x10,0x20,0x40,0x40,0x20,0x10,0x8,0x4, +}; + +static const BitmapCharRec ch26 = {6,12,-2,2,9,ch26data}; + +/* char: 0x19 */ + +static const GLubyte ch25data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch25 = {1,15,-4,3,9,ch25data}; + +/* char: 0x18 */ + +static const GLubyte ch24data[] = { +0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80, +}; + +static const BitmapCharRec ch24 = {9,7,0,3,9,ch24data}; + +/* char: 0x17 */ + +static const GLubyte ch23data[] = { +0xff,0x80,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, +0x8,0x0, +}; + +static const BitmapCharRec ch23 = {9,9,0,-3,9,ch23data}; + +/* char: 0x16 */ + +static const GLubyte ch22data[] = { +0x8,0x8,0x8,0x8,0x8,0x8,0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, +}; + +static const BitmapCharRec ch22 = {5,15,0,3,9,ch22data}; + +/* char: 0x15 */ + +static const GLubyte ch21data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch21 = {5,15,-4,3,9,ch21data}; + +/* char: 0x14 */ + +static const GLubyte ch20data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch20 = {9,1,0,1,9,ch20data}; + +/* char: 0x13 */ + +static const GLubyte ch19data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch19 = {9,1,0,-1,9,ch19data}; + +/* char: 0x12 */ + +static const GLubyte ch18data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch18 = {9,1,0,-3,9,ch18data}; + +/* char: 0x11 */ + +static const GLubyte ch17data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch17 = {9,1,0,-5,9,ch17data}; + +/* char: 0x10 */ + +static const GLubyte ch16data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch16 = {9,1,0,-7,9,ch16data}; + +/* char: 0xf */ + +static const GLubyte ch15data[] = { +0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80,0x8,0x0, +0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, +}; + +static const BitmapCharRec ch15 = {9,15,0,3,9,ch15data}; + +/* char: 0xe */ + +static const GLubyte ch14data[] = { +0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch14 = {5,9,-4,-3,9,ch14data}; + +/* char: 0xd */ + +static const GLubyte ch13data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch13 = {5,7,-4,3,9,ch13data}; + +/* char: 0xc */ + +static const GLubyte ch12data[] = { +0x8,0x8,0x8,0x8,0x8,0x8,0xf8, +}; + +static const BitmapCharRec ch12 = {5,7,0,3,9,ch12data}; + +/* char: 0xb */ + +static const GLubyte ch11data[] = { +0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, +}; + +static const BitmapCharRec ch11 = {5,9,0,-3,9,ch11data}; + +/* char: 0xa */ + +static const GLubyte ch10data[] = { +0x8,0x8,0x8,0x8,0x3e,0x0,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch10 = {7,10,-1,2,9,ch10data}; + +/* char: 0x9 */ + +static const GLubyte ch9data[] = { +0x3e,0x20,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, +}; + +static const BitmapCharRec ch9 = {7,10,-1,2,9,ch9data}; + +/* char: 0x8 */ + +static const GLubyte ch8data[] = { +0xfe,0x10,0x10,0xfe,0x10,0x10, +}; + +static const BitmapCharRec ch8 = {7,6,-1,0,9,ch8data}; + +/* char: 0x7 */ + +static const GLubyte ch7data[] = { +0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch7 = {5,4,-2,-6,9,ch7data}; + +/* char: 0x6 */ + +static const GLubyte ch6data[] = { +0x20,0x20,0x3c,0x20,0x3e,0x0,0xf8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch6 = {7,10,-1,2,9,ch6data}; + +/* char: 0x5 */ + +static const GLubyte ch5data[] = { +0x22,0x22,0x3c,0x22,0x3c,0x0,0x78,0x80,0x80,0x78, +}; + +static const BitmapCharRec ch5 = {7,10,-1,2,9,ch5data}; + +/* char: 0x4 */ + +static const GLubyte ch4data[] = { +0x10,0x10,0x1c,0x10,0x1e,0x80,0x80,0xe0,0x80,0xf0, +}; + +static const BitmapCharRec ch4 = {7,10,-1,2,9,ch4data}; + +/* char: 0x3 */ + +static const GLubyte ch3data[] = { +0x8,0x8,0x8,0x3e,0x0,0x88,0x88,0xf8,0x88,0x88, +}; + +static const BitmapCharRec ch3 = {7,10,-1,2,9,ch3data}; + +/* char: 0x2 */ + +static const GLubyte ch2data[] = { +0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, +}; + +static const BitmapCharRec ch2 = {8,14,0,3,9,ch2data}; + +/* char: 0x1 */ + +static const GLubyte ch1data[] = { +0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, +}; + +static const BitmapCharRec ch1 = {7,7,-1,0,9,ch1data}; + +static const BitmapCharRec * const chars[] = { +&ch0, +&ch1, +&ch2, +&ch3, +&ch4, +&ch5, +&ch6, +&ch7, +&ch8, +&ch9, +&ch10, +&ch11, +&ch12, +&ch13, +&ch14, +&ch15, +&ch16, +&ch17, +&ch18, +&ch19, +&ch20, +&ch21, +&ch22, +&ch23, +&ch24, +&ch25, +&ch26, +&ch27, +&ch28, +&ch29, +&ch30, +&ch31, +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +&ch127, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmap9By15 = { +"-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1", +256, +0, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_bitmap.cpp b/xc/extras/Mesa/src-glut.beos/glut_bitmap.cpp new file mode 100644 index 000000000..874a05e0b --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_bitmap.cpp @@ -0,0 +1,58 @@ + +/* 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 <GL/glut.h> +#include "glutint.h" +#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); + } +} diff --git a/xc/extras/Mesa/src-glut.beos/glut_bwidth.cpp b/xc/extras/Mesa/src-glut.beos/glut_bwidth.cpp new file mode 100644 index 000000000..711dfa569 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_bwidth.cpp @@ -0,0 +1,59 @@ + +/* 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 <GL/glut.h> +#include "glutint.h" +#include "glutbitmap.h" + +/* CENTRY */ +int APIENTRY +glutBitmapWidth(GLUTbitmapFont font, int c) +{ + BitmapFontPtr fontinfo; + const BitmapCharRec *ch; + +#if defined(WIN32) + fontinfo = (BitmapFontPtr) __glutFont(font); +#else + fontinfo = (BitmapFontPtr) font; +#endif + + if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars) + return 0; + ch = fontinfo->ch[c - fontinfo->first]; + if (ch) + return (int)ch->advance; + else + return 0; +} + +int APIENTRY +glutBitmapLength(GLUTbitmapFont font, const char *string) +{ + int c, length; + BitmapFontPtr fontinfo; + const BitmapCharRec *ch; + +#ifdef WIN32 + fontinfo = (BitmapFontPtr) __glutFont(font); +#else + fontinfo = (BitmapFontPtr) font; +#endif + + length = 0; + for (; *string != '\0'; string++) { + c = *string; + if (c >= fontinfo->first && c < fontinfo->first + fontinfo->num_chars) { + ch = fontinfo->ch[c - fontinfo->first]; + if (ch) + length += (int)ch->advance; + } + } + return length; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut.beos/glut_hel10.cpp b/xc/extras/Mesa/src-glut.beos/glut_hel10.cpp new file mode 100644 index 000000000..7ed306c1c --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_hel10.cpp @@ -0,0 +1,1777 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x50, +}; + +static const BitmapCharRec ch255 = {4,10,0,2,5,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {5,10,0,2,6,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {4,11,0,2,5,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50, +}; + +static const BitmapCharRec ch252 = {4,8,0,0,5,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch251 = {4,9,0,0,5,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch250 = {4,9,0,0,5,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch249 = {4,9,0,0,5,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x70,0x88,0xc8,0xa8,0x98,0x74, +}; + +static const BitmapCharRec ch248 = {6,6,0,0,6,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x0,0xf8,0x0,0x20, +}; + +static const BitmapCharRec ch247 = {5,5,0,-1,6,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch246 = {5,8,0,0,6,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {5,9,0,0,6,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch244 = {5,9,0,0,6,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch243 = {5,9,0,0,6,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch242 = {5,9,0,0,6,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x90,0x90,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch241 = {4,9,0,0,5,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x70,0x88,0x88,0x88,0x88,0x78,0x90,0x60,0x50, +}; + +static const BitmapCharRec ch240 = {5,9,0,0,6,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch239 = {3,8,0,0,2,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch238 = {3,9,1,0,2,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch237 = {2,9,0,0,2,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch236 = {2,9,1,0,2,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50, +}; + +static const BitmapCharRec ch235 = {4,8,0,0,5,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch234 = {4,9,0,0,5,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch233 = {4,9,0,0,5,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch232 = {4,9,0,0,5,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x60,0x20,0x60,0x90,0x80,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch231 = {4,8,0,2,5,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x6c,0x92,0x90,0x7e,0x12,0xec, +}; + +static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x20,0x50,0x20, +}; + +static const BitmapCharRec ch229 = {5,9,0,0,5,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50, +}; + +static const BitmapCharRec ch228 = {5,8,0,0,5,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch227 = {5,9,0,0,5,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch226 = {5,9,0,0,5,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch225 = {5,9,0,0,5,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch224 = {5,9,0,0,5,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xa0,0x90,0x90,0x90,0xa0,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch223 = {4,8,0,0,5,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0xf0,0x88,0x88,0xf0,0x80,0x80, +}; + +static const BitmapCharRec ch222 = {5,8,-1,0,7,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch221 = {7,11,0,0,7,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, +}; + +static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch219 = {6,11,-1,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch218 = {6,11,-1,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {6,11,-1,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x78,0xc4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, +}; + +static const BitmapCharRec ch216 = {6,10,-1,1,8,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch215 = {5,5,0,-1,6,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x48, +}; + +static const BitmapCharRec ch214 = {6,10,-1,0,8,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch213 = {6,11,-1,0,8,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch212 = {6,11,-1,0,8,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch211 = {6,11,-1,0,8,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch210 = {6,11,-1,0,8,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch209 = {6,11,-1,0,8,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x78,0x44,0x42,0x42,0xf2,0x42,0x44,0x78, +}; + +static const BitmapCharRec ch208 = {7,8,0,0,8,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch207 = {3,10,0,0,3,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch206 = {3,11,0,0,3,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch205 = {2,11,-1,0,3,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch204 = {2,11,0,0,3,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x50, +}; + +static const BitmapCharRec ch203 = {5,10,-1,0,7,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xf8,0x80,0x80,0xf8,0x80,0x80,0x80,0xf8,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch202 = {5,11,-1,0,7,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch201 = {5,11,-1,0,7,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch200 = {5,11,-1,0,7,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x30,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch199 = {6,10,-1,2,8,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x8f,0x80,0x88,0x0,0x78,0x0,0x48,0x0,0x2f,0x80,0x28,0x0,0x18,0x0,0x1f,0x80, +}; + +static const BitmapCharRec ch198 = {9,8,0,0,10,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,11,0,0,7,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28, +}; + +static const BitmapCharRec ch196 = {7,10,0,0,7,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch195 = {7,11,0,0,7,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch194 = {7,11,0,0,7,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch193 = {7,11,0,0,7,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {7,11,0,0,7,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x60,0x90,0x80,0x40,0x20,0x20,0x0,0x20, +}; + +static const BitmapCharRec ch191 = {4,8,-1,2,6,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0xc8,0x0,0x24,0x0,0x44,0x0,0xe2,0x0, +}; + +static const BitmapCharRec ch190 = {9,8,0,0,9,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x27,0x12,0x15,0xb,0x48,0x44,0xc4,0x42, +}; + +static const BitmapCharRec ch189 = {8,8,0,0,9,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0x48,0x0,0x44,0x0,0xc4,0x0,0x42,0x0, +}; + +static const BitmapCharRec ch188 = {9,8,0,0,9,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0xa0,0x50,0x28,0x50,0xa0, +}; + +static const BitmapCharRec ch187 = {5,5,0,0,6,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xe0,0x0,0xe0,0xa0,0xe0, +}; + +static const BitmapCharRec ch186 = {3,5,0,-3,4,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {2,4,0,-3,3,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x40, +}; + +static const BitmapCharRec ch184 = {2,2,0,2,3,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0, +}; + +static const BitmapCharRec ch183 = {2,1,0,-3,3,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, +}; + +static const BitmapCharRec ch182 = {6,10,0,2,6,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0xf0,0x90,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch181 = {4,8,0,2,5,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,0,-6,3,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0xc0,0x20,0x40,0xe0, +}; + +static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xe0,0x40,0xa0,0x60, +}; + +static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xe0, +}; + +static const BitmapCharRec ch175 = {3,1,0,-7,3,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, +}; + +static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xe0, +}; + +static const BitmapCharRec ch173 = {3,1,0,-3,4,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x8,0x8,0xf8, +}; + +static const BitmapCharRec ch172 = {5,3,-1,-2,7,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x28,0x50,0xa0,0x50,0x28, +}; + +static const BitmapCharRec ch171 = {5,5,0,0,6,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xe0,0x0,0xa0,0x20,0xe0, +}; + +static const BitmapCharRec ch170 = {3,5,0,-3,4,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, +}; + +static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0, +}; + +static const BitmapCharRec ch168 = {3,1,0,-7,3,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x70,0x88,0x18,0x70,0xc8,0x98,0x70,0xc0,0x88,0x70, +}; + +static const BitmapCharRec ch167 = {5,10,0,2,6,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,10,-1,2,3,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x20,0xf8,0x20,0xf8,0x50,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch165 = {5,8,0,0,6,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x90,0x60,0x90,0x90,0x60,0x90, +}; + +static const BitmapCharRec ch164 = {4,6,0,-1,5,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xb0,0x48,0x40,0x40,0xe0,0x40,0x48,0x30, +}; + +static const BitmapCharRec ch163 = {5,8,0,0,6,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x10, +}; + +static const BitmapCharRec ch162 = {5,8,0,1,6,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,8,-1,2,3,ch161data}; + +/* char: 0xa0 */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,3,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,3,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x98,0x64, +}; + +static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0x80,0x40,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch125 = {3,10,0,2,3,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,10,-1,2,3,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x20,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch123 = {3,10,0,2,3,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xf0,0x80,0x40,0x20,0x10,0xf0, +}; + +static const BitmapCharRec ch122 = {4,6,0,0,5,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90, +}; + +static const BitmapCharRec ch121 = {4,8,0,2,5,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x88,0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch120 = {5,6,0,0,6,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x28,0x28,0x54,0x54,0x92,0x92, +}; + +static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x20,0x50,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch118 = {5,6,0,0,6,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x70,0x90,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch117 = {4,6,0,0,5,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x60,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, +}; + +static const BitmapCharRec ch116 = {3,8,0,0,4,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x60,0x90,0x10,0x60,0x90,0x60, +}; + +static const BitmapCharRec ch115 = {4,6,0,0,5,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x80,0x80,0x80,0x80,0xc0,0xa0, +}; + +static const BitmapCharRec ch114 = {3,6,0,0,4,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x8,0x8,0x68,0x98,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch113 = {5,8,0,2,6,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch112 = {5,8,0,2,6,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x70,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch111 = {5,6,0,0,6,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x88,0x88,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch110 = {5,6,0,0,6,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x92,0x92,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch108 = {1,8,0,0,2,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x90,0x90,0xa0,0xc0,0xa0,0x90,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {4,8,0,0,5,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch106 = {1,9,0,1,2,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch105 = {1,8,0,0,2,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {5,8,0,0,6,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x70,0x8,0x68,0x98,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch103 = {5,8,0,2,6,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch102 = {4,8,0,0,4,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60, +}; + +static const BitmapCharRec ch101 = {4,6,0,0,5,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x68,0x98,0x88,0x88,0x98,0x68,0x8,0x8, +}; + +static const BitmapCharRec ch100 = {5,8,0,0,6,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x60,0x90,0x80,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch99 = {4,6,0,0,5,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {5,8,0,0,6,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0, +}; + +static const BitmapCharRec ch97 = {5,6,0,0,5,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x80,0x80,0x40, +}; + +static const BitmapCharRec ch96 = {2,3,0,-5,3,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xfc, +}; + +static const BitmapCharRec ch95 = {6,1,0,2,6,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x88,0x50,0x50,0x20,0x20, +}; + +static const BitmapCharRec ch94 = {5,5,0,-3,6,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch93 = {2,10,0,2,3,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x20,0x20,0x40,0x40,0x40,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {3,8,0,0,3,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, +}; + +static const BitmapCharRec ch91 = {2,10,-1,2,3,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xf8,0x80,0x40,0x20,0x20,0x10,0x8,0xf8, +}; + +static const BitmapCharRec ch90 = {5,8,-1,0,7,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82, +}; + +static const BitmapCharRec ch89 = {7,8,0,0,7,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch88 = {5,8,-1,0,7,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, +}; + +static const BitmapCharRec ch87 = {9,8,0,0,9,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,8,0,0,7,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch85 = {6,8,-1,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, +}; + +static const BitmapCharRec ch84 = {5,8,0,0,5,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x70,0x88,0x88,0x8,0x70,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch83 = {5,8,-1,0,7,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x88,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, +}; + +static const BitmapCharRec ch82 = {5,8,-1,0,7,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x2,0x7c,0x8c,0x94,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch81 = {7,9,-1,1,8,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0xf0,0x88,0x88,0xf0, +}; + +static const BitmapCharRec ch80 = {5,8,-1,0,7,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch79 = {6,8,-1,0,8,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4, +}; + +static const BitmapCharRec ch78 = {6,8,-1,0,8,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x92,0x92,0x92,0xaa,0xaa,0xc6,0xc6,0x82, +}; + +static const BitmapCharRec ch77 = {7,8,-1,0,9,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {4,8,-1,0,6,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x88,0x88,0x90,0x90,0xe0,0xa0,0x90,0x88, +}; + +static const BitmapCharRec ch75 = {5,8,-1,0,7,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x60,0x90,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch74 = {4,8,0,0,5,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch73 = {1,8,-1,0,3,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch72 = {6,8,-1,0,8,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x74,0x8c,0x84,0x8c,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch71 = {6,8,-1,0,8,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch70 = {5,8,-1,0,6,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch69 = {5,8,-1,0,7,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xf0,0x88,0x84,0x84,0x84,0x84,0x88,0xf0, +}; + +static const BitmapCharRec ch68 = {6,8,-1,0,8,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch67 = {6,8,-1,0,8,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, +}; + +static const BitmapCharRec ch66 = {5,8,-1,0,7,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10, +}; + +static const BitmapCharRec ch65 = {7,8,0,0,7,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3e,0x0,0x40,0x0,0x9b,0x0,0xa4,0x80,0xa4,0x80,0xa2,0x40,0x92,0x40,0x4d,0x40, +0x20,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch64 = {10,10,0,2,11,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x40,0x0,0x40,0x40,0x20,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch63 = {4,8,-1,0,6,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {3,5,-1,-1,6,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xf0,0x0,0xf0, +}; + +static const BitmapCharRec ch61 = {4,3,0,-2,5,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x20,0x40,0x80,0x40,0x20, +}; + +static const BitmapCharRec ch60 = {3,5,-1,-1,6,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, +}; + +static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x80,0x0,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch57 = {5,8,0,0,6,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch56 = {5,8,0,0,6,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x10,0x10,0x8,0xf8, +}; + +static const BitmapCharRec ch55 = {5,8,0,0,6,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x70,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch54 = {5,8,0,0,6,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x70,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch53 = {5,8,0,0,6,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x10,0x10,0xf8,0x90,0x50,0x50,0x30,0x10, +}; + +static const BitmapCharRec ch52 = {5,8,0,0,6,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x70,0x88,0x8,0x8,0x30,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch51 = {5,8,0,0,6,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xf8,0x80,0x40,0x30,0x8,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch50 = {5,8,0,0,6,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch49 = {2,8,-1,0,6,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch48 = {5,8,0,0,6,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20, +}; + +static const BitmapCharRec ch47 = {3,8,0,0,3,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x80, +}; + +static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xf8, +}; + +static const BitmapCharRec ch45 = {5,1,-1,-3,7,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40, +}; + +static const BitmapCharRec ch44 = {2,3,0,2,3,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,0,-1,6,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0xa0,0x40,0xa0, +}; + +static const BitmapCharRec ch42 = {3,3,0,-5,4,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,10,-1,2,4,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,10,0,2,4,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0x40, +}; + +static const BitmapCharRec ch39 = {2,3,-1,-5,3,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x64,0x98,0x98,0xa4,0x60,0x50,0x50,0x20, +}; + +static const BitmapCharRec ch38 = {6,8,-1,0,8,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x26,0x29,0x16,0x10,0x8,0x68,0x94,0x64, +}; + +static const BitmapCharRec ch37 = {8,8,0,0,9,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0x70,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, +}; + +static const BitmapCharRec ch36 = {5,9,0,1,6,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x50,0x50,0xf8,0x28,0x7c,0x28,0x28, +}; + +static const BitmapCharRec ch35 = {6,7,0,0,6,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0xa0,0xa0, +}; + +static const BitmapCharRec ch34 = {3,2,-1,-6,4,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,8,-1,0,3,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {0,0,0,0,3,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,3,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmapHelvetica10 = { +"-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_hel12.cpp b/xc/extras/Mesa/src-glut.beos/glut_hel12.cpp new file mode 100644 index 000000000..3866503f5 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_hel12.cpp @@ -0,0 +1,1787 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0xc0,0x20,0x20,0x20,0x30,0x50,0x50,0x48,0x88,0x88,0x0,0x50, +}; + +static const BitmapCharRec ch255 = {5,12,-1,3,7,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {5,12,-1,3,7,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {5,13,-1,3,7,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50, +}; + +static const BitmapCharRec ch252 = {5,9,-1,0,7,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch251 = {5,10,-1,0,7,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch250 = {5,10,-1,0,7,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch249 = {5,10,-1,0,7,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0xb8,0x44,0x64,0x54,0x4c,0x44,0x3a, +}; + +static const BitmapCharRec ch248 = {7,7,0,0,7,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x0,0xf8,0x0,0x20, +}; + +static const BitmapCharRec ch247 = {5,5,-1,-1,7,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch246 = {5,9,-1,0,7,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {5,10,-1,0,7,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch244 = {5,10,-1,0,7,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch243 = {5,10,-1,0,7,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch242 = {5,10,-1,0,7,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch241 = {5,10,-1,0,7,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x70,0x88,0x88,0x88,0x88,0x78,0x8,0x50,0x30,0x68, +}; + +static const BitmapCharRec ch240 = {5,10,-1,0,7,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch239 = {3,9,0,0,3,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch238 = {3,10,0,0,3,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch237 = {2,10,-1,0,3,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch236 = {2,10,0,0,3,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch235 = {5,9,-1,0,7,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch234 = {5,10,-1,0,7,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch233 = {5,10,-1,0,7,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch232 = {5,10,-1,0,7,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x60,0x10,0x20,0x70,0x88,0x80,0x80,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch231 = {5,10,-1,3,7,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x77,0x0,0x88,0x80,0x88,0x0,0x7f,0x80,0x8,0x80,0x88,0x80,0x77,0x0, +}; + +static const BitmapCharRec ch230 = {9,7,-1,0,11,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x30,0x48,0x30, +}; + +static const BitmapCharRec ch229 = {6,10,-1,0,7,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch228 = {6,9,-1,0,7,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch227 = {6,10,-1,0,7,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch226 = {6,10,-1,0,7,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch225 = {6,10,-1,0,7,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch224 = {6,10,-1,0,7,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xb0,0x88,0x88,0x88,0xb0,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch223 = {5,9,-1,0,7,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80,0x80, +}; + +static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch221 = {7,12,-1,0,9,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, +}; + +static const BitmapCharRec ch220 = {6,11,-1,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch219 = {6,12,-1,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch218 = {6,12,-1,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {6,12,-1,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x0,0x5e,0x0,0x21,0x0,0x50,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80, +0x21,0x0,0x1e,0x80,0x0,0x40, +}; + +static const BitmapCharRec ch216 = {10,11,0,1,10,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch215 = {5,5,-1,-1,7,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x24, +}; + +static const BitmapCharRec ch214 = {8,11,-1,0,10,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch213 = {8,12,-1,0,10,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x14,0x8, +}; + +static const BitmapCharRec ch212 = {8,12,-1,0,10,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x4, +}; + +static const BitmapCharRec ch211 = {8,12,-1,0,10,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x10, +}; + +static const BitmapCharRec ch210 = {8,12,-1,0,10,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch209 = {7,12,-1,0,9,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x7c,0x42,0x41,0x41,0xf1,0x41,0x41,0x42,0x7c, +}; + +static const BitmapCharRec ch208 = {8,9,0,0,9,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch207 = {3,11,0,0,3,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch206 = {3,12,0,0,3,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch205 = {2,12,-1,0,3,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch204 = {2,12,0,0,3,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28, +}; + +static const BitmapCharRec ch203 = {6,11,-1,0,8,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch202 = {6,12,-1,0,8,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch201 = {6,12,-1,0,8,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch200 = {6,12,-1,0,8,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x30,0x8,0x8,0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, +}; + +static const BitmapCharRec ch199 = {7,12,-1,3,9,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x8f,0x80,0x88,0x0,0x88,0x0,0x78,0x0,0x4f,0x80,0x48,0x0,0x28,0x0,0x28,0x0, +0x1f,0x80, +}; + +static const BitmapCharRec ch198 = {9,9,-1,0,11,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,12,-1,0,9,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28, +}; + +static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch195 = {7,12,-1,0,9,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch194 = {7,12,-1,0,9,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch193 = {7,12,-1,0,9,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {7,12,-1,0,9,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x70,0x88,0x88,0x40,0x40,0x20,0x20,0x0,0x20, +}; + +static const BitmapCharRec ch191 = {5,9,-1,3,7,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x21,0x0,0x17,0x80,0x15,0x0,0xb,0x0,0xc9,0x0,0x24,0x0,0x44,0x0,0x22,0x0, +0xe1,0x0, +}; + +static const BitmapCharRec ch190 = {9,9,0,0,10,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x47,0x80,0x22,0x0,0x11,0x0,0x14,0x80,0x4b,0x0,0x48,0x0,0x44,0x0,0xc2,0x0, +0x41,0x0, +}; + +static const BitmapCharRec ch189 = {9,9,0,0,10,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x41,0x0,0x27,0x80,0x15,0x0,0x13,0x0,0x49,0x0,0x44,0x0,0x44,0x0,0xc2,0x0, +0x41,0x0, +}; + +static const BitmapCharRec ch188 = {9,9,0,0,10,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0xa0,0x50,0x28,0x50,0xa0, +}; + +static const BitmapCharRec ch187 = {5,5,-1,-1,7,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xe0,0x0,0xe0,0xa0,0xe0, +}; + +static const BitmapCharRec ch186 = {3,5,-1,-4,5,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {2,5,-1,-3,4,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x20,0x20,0x40, +}; + +static const BitmapCharRec ch184 = {3,4,0,3,3,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0x80, +}; + +static const BitmapCharRec ch183 = {1,1,-1,-3,3,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x68,0x3c, +}; + +static const BitmapCharRec ch182 = {6,12,0,3,7,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0x80,0xe8,0x98,0x88,0x88,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch181 = {5,10,-1,3,7,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,0,-8,2,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0xc0,0x20,0x40,0x20,0xe0, +}; + +static const BitmapCharRec ch179 = {3,5,0,-3,4,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf0,0x40,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch178 = {4,5,0,-3,4,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,-1,0,7,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,0,-4,5,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xf0, +}; + +static const BitmapCharRec ch175 = {4,1,0,-8,4,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x3e,0x0,0x41,0x0,0x94,0x80,0x94,0x80,0x98,0x80,0x94,0x80,0x9c,0x80,0x41,0x0, +0x3e,0x0, +}; + +static const BitmapCharRec ch174 = {9,9,-1,0,11,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xf0, +}; + +static const BitmapCharRec ch173 = {4,1,0,-3,5,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x4,0x4,0x4,0xfc, +}; + +static const BitmapCharRec ch172 = {6,4,-1,-2,8,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x28,0x50,0xa0,0x50,0x28, +}; + +static const BitmapCharRec ch171 = {5,5,-1,-1,7,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xe0,0x0,0xa0,0x20,0xe0, +}; + +static const BitmapCharRec ch170 = {3,5,-1,-4,5,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x3e,0x0,0x41,0x0,0x9c,0x80,0xa2,0x80,0xa0,0x80,0xa2,0x80,0x9c,0x80,0x41,0x0, +0x3e,0x0, +}; + +static const BitmapCharRec ch169 = {9,9,-1,0,11,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0, +}; + +static const BitmapCharRec ch168 = {3,1,0,-8,3,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x70,0x88,0x8,0x30,0x48,0x88,0x88,0x90,0x60,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch167 = {5,12,0,3,6,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,11,-1,2,3,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x20,0x20,0xf8,0x20,0xf8,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch165 = {5,9,-1,0,7,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x84,0x78,0x48,0x48,0x78,0x84, +}; + +static const BitmapCharRec ch164 = {6,6,0,-1,7,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xb0,0x48,0x20,0x20,0xf0,0x40,0x40,0x48,0x30, +}; + +static const BitmapCharRec ch163 = {5,9,-1,0,7,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x70,0xc8,0xa0,0xa0,0xa0,0xa8,0x70,0x10, +}; + +static const BitmapCharRec ch162 = {5,9,-1,1,7,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,10,-1,3,3,ch161data}; + +/* char: 0xa0 */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,4,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,4,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x98,0x64, +}; + +static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xc0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xc0, +}; + +static const BitmapCharRec ch125 = {4,12,0,3,4,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,12,-1,3,3,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x30,0x40,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, +}; + +static const BitmapCharRec ch123 = {4,12,0,3,4,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xf0,0x80,0x40,0x40,0x20,0x10,0xf0, +}; + +static const BitmapCharRec ch122 = {4,7,-1,0,6,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch121 = {5,10,-1,3,7,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x84,0x84,0x48,0x30,0x30,0x48,0x84, +}; + +static const BitmapCharRec ch120 = {6,7,0,0,6,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, +}; + +static const BitmapCharRec ch119 = {9,7,0,0,9,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x20,0x50,0x50,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch118 = {5,7,-1,0,7,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch117 = {5,7,-1,0,7,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x60,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, +}; + +static const BitmapCharRec ch116 = {3,9,0,0,3,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x60,0x90,0x10,0x60,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch115 = {4,7,-1,0,6,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x80,0x80,0x80,0x80,0x80,0xc0,0xa0, +}; + +static const BitmapCharRec ch114 = {3,7,-1,0,4,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x8,0x8,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch113 = {5,10,-1,3,7,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch112 = {5,10,-1,3,7,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch111 = {5,7,-1,0,7,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x88,0x88,0x88,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch110 = {5,7,-1,0,7,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x92,0x92,0x92,0x92,0x92,0xda,0xa4, +}; + +static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch108 = {1,9,-1,0,3,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x88,0x90,0xa0,0xc0,0xc0,0xa0,0x90,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {5,9,-1,0,6,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40, +}; + +static const BitmapCharRec ch106 = {2,12,0,3,3,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch105 = {1,9,-1,0,3,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {5,9,-1,0,7,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch103 = {5,10,-1,3,7,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch102 = {4,9,0,0,3,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch101 = {5,7,-1,0,7,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x68,0x98,0x88,0x88,0x88,0x98,0x68,0x8,0x8, +}; + +static const BitmapCharRec ch100 = {5,9,-1,0,7,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x70,0x88,0x80,0x80,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch99 = {5,7,-1,0,7,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {5,9,-1,0,7,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch97 = {6,7,-1,0,7,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0xc0,0x80,0x40, +}; + +static const BitmapCharRec ch96 = {2,3,0,-6,3,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xfe, +}; + +static const BitmapCharRec ch95 = {7,1,0,2,7,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x88,0x50,0x20, +}; + +static const BitmapCharRec ch94 = {5,3,0,-5,6,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch93 = {2,12,0,3,3,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {4,9,0,0,4,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, +}; + +static const BitmapCharRec ch91 = {2,12,-1,3,3,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xfe,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, +}; + +static const BitmapCharRec ch90 = {7,9,-1,0,9,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch89 = {7,9,-1,0,9,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x82,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x82, +}; + +static const BitmapCharRec ch88 = {7,9,-1,0,9,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0x49,0x0,0x88,0x80,0x88,0x80, +0x88,0x80, +}; + +static const BitmapCharRec ch87 = {9,9,-1,0,11,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,9,-1,0,9,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, +}; + +static const BitmapCharRec ch84 = {7,9,0,0,7,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x78,0x84,0x84,0x4,0x18,0x60,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x84,0x84,0x84,0x88,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x3d,0x42,0x85,0x89,0x81,0x81,0x81,0x42,0x3c, +}; + +static const BitmapCharRec ch81 = {8,9,-1,0,10,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c, +}; + +static const BitmapCharRec ch79 = {8,9,-1,0,10,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82, +}; + +static const BitmapCharRec ch78 = {7,9,-1,0,9,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x88,0x80,0x88,0x80,0x94,0x80,0x94,0x80,0xa2,0x80,0xa2,0x80,0xc1,0x80,0xc1,0x80, +0x80,0x80, +}; + +static const BitmapCharRec ch77 = {9,9,-1,0,11,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {5,9,-1,0,7,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x82,0x84,0x88,0x90,0xe0,0xa0,0x90,0x88,0x84, +}; + +static const BitmapCharRec ch75 = {7,9,-1,0,8,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x8,0x8, +}; + +static const BitmapCharRec ch74 = {5,9,-1,0,7,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch73 = {1,9,-1,0,3,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch72 = {7,9,-1,0,9,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x3a,0x46,0x82,0x82,0x8e,0x80,0x80,0x42,0x3c, +}; + +static const BitmapCharRec ch71 = {7,9,-1,0,9,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xf8,0x84,0x82,0x82,0x82,0x82,0x82,0x84,0xf8, +}; + +static const BitmapCharRec ch68 = {7,9,-1,0,9,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, +}; + +static const BitmapCharRec ch67 = {7,9,-1,0,9,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xf8,0x84,0x84,0x84,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch66 = {6,9,-1,0,8,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x28,0x10, +}; + +static const BitmapCharRec ch65 = {7,9,-1,0,9,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3e,0x0,0x40,0x0,0x9b,0x0,0xa6,0x80,0xa2,0x40,0xa2,0x40,0x92,0x40,0x4d,0x40, +0x60,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch64 = {10,10,-1,1,12,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x20,0x0,0x20,0x20,0x10,0x10,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch63 = {5,9,-1,0,7,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0xc0,0x30,0xc,0x30,0xc0, +}; + +static const BitmapCharRec ch62 = {6,5,-1,-1,7,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xf8,0x0,0xf8, +}; + +static const BitmapCharRec ch61 = {5,3,-1,-2,7,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0xc,0x30,0xc0,0x30,0xc, +}; + +static const BitmapCharRec ch60 = {6,5,0,-1,7,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, +}; + +static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x80,0x0,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x70,0x88,0x8,0x8,0x78,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch57 = {5,9,-1,0,7,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch56 = {5,9,-1,0,7,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x8,0xf8, +}; + +static const BitmapCharRec ch55 = {5,9,-1,0,7,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x70,0x88,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch54 = {5,9,-1,0,7,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x70,0x88,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch53 = {5,9,-1,0,7,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x8,0x8,0xfc,0x88,0x48,0x28,0x28,0x18,0x8, +}; + +static const BitmapCharRec ch52 = {6,9,0,0,7,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x70,0x88,0x88,0x8,0x8,0x30,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch51 = {5,9,-1,0,7,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xf8,0x80,0x80,0x40,0x20,0x10,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch50 = {5,9,-1,0,7,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x20, +}; + +static const BitmapCharRec ch49 = {3,9,-1,0,7,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch48 = {5,9,-1,0,7,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10, +}; + +static const BitmapCharRec ch47 = {4,9,0,0,4,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x80, +}; + +static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xf8, +}; + +static const BitmapCharRec ch45 = {5,1,-1,-3,8,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40, +}; + +static const BitmapCharRec ch44 = {2,3,-1,2,4,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,-1,-1,7,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0xa0,0x40,0xa0, +}; + +static const BitmapCharRec ch42 = {3,3,-1,-6,5,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,12,0,3,4,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,12,-1,3,4,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0xc0, +}; + +static const BitmapCharRec ch39 = {2,3,-1,-6,3,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x72,0x8c,0x84,0x8a,0x50,0x30,0x48,0x48,0x30, +}; + +static const BitmapCharRec ch38 = {7,9,-1,0,9,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x23,0x0,0x14,0x80,0x14,0x80,0x13,0x0,0x8,0x0,0x68,0x0,0x94,0x0,0x94,0x0, +0x62,0x0, +}; + +static const BitmapCharRec ch37 = {9,9,-1,0,11,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0x70,0xa8,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, +}; + +static const BitmapCharRec ch36 = {5,10,-1,1,7,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x50,0x50,0x50,0xfc,0x28,0xfc,0x28,0x28, +}; + +static const BitmapCharRec ch35 = {6,8,0,0,7,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0xa0,0xa0,0xa0, +}; + +static const BitmapCharRec ch34 = {3,3,-1,-6,5,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,9,-1,0,3,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,4,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,4,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmapHelvetica12 = { +"-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_hel18.cpp b/xc/extras/Mesa/src-glut.beos/glut_hel18.cpp new file mode 100644 index 000000000..00d509d57 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_hel18.cpp @@ -0,0 +1,1896 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x66, +0x66, +}; + +static const BitmapCharRec ch255 = {8,17,-1,4,10,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch254 = {9,18,-1,4,11,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x18, +0xc,0x6, +}; + +static const BitmapCharRec ch253 = {8,18,-1,4,10,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x66, +}; + +static const BitmapCharRec ch252 = {8,13,-1,0,10,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch251 = {8,14,-1,0,10,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x18,0xc,0x6, +}; + +static const BitmapCharRec ch250 = {8,14,-1,0,10,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0xc,0x18,0x30, +}; + +static const BitmapCharRec ch249 = {8,14,-1,0,10,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0xce,0x0,0x7f,0x80,0x31,0x80,0x78,0xc0,0x6c,0xc0,0x66,0xc0,0x63,0xc0,0x31,0x80, +0x3f,0xc0,0xe,0x60, +}; + +static const BitmapCharRec ch248 = {11,10,0,0,11,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x18,0x18,0x0,0xff,0xff,0x0,0x18,0x18, +}; + +static const BitmapCharRec ch247 = {8,8,-1,-1,10,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x36,0x0,0x36,0x0, +}; + +static const BitmapCharRec ch246 = {9,13,-1,0,11,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x26,0x0,0x2d,0x0,0x19,0x0, +}; + +static const BitmapCharRec ch245 = {9,14,-1,0,11,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x33,0x0,0x1e,0x0,0xc,0x0, +}; + +static const BitmapCharRec ch244 = {9,14,-1,0,11,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x18,0x0,0xc,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch243 = {9,14,-1,0,11,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0xc,0x0,0x18,0x0,0x30,0x0, +}; + +static const BitmapCharRec ch242 = {9,14,-1,0,11,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0x0,0x4c,0x5a,0x32, +}; + +static const BitmapCharRec ch241 = {8,14,-1,0,10,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x4c,0x0,0x38,0x0,0x36,0x0,0x60,0x0, +}; + +static const BitmapCharRec ch240 = {9,14,-1,0,11,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xd8,0xd8, +}; + +static const BitmapCharRec ch239 = {5,13,0,0,4,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc,0x78,0x30, +}; + +static const BitmapCharRec ch238 = {6,14,1,0,4,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xc0,0x60,0x30, +}; + +static const BitmapCharRec ch237 = {4,14,0,0,4,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0x30,0x60,0xc0, +}; + +static const BitmapCharRec ch236 = {4,14,0,0,4,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x36,0x36, +}; + +static const BitmapCharRec ch235 = {8,13,-1,0,10,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch234 = {8,14,-1,0,10,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0xc,0x6, +}; + +static const BitmapCharRec ch233 = {8,14,-1,0,10,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0x30,0x60, +}; + +static const BitmapCharRec ch232 = {8,14,-1,0,10,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x78,0x6c,0xc,0x38,0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, +}; + +static const BitmapCharRec ch231 = {8,14,-1,4,10,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x75,0xe0,0xef,0xf8,0xc7,0x18,0xc6,0x0,0xe6,0x0,0x7f,0xf8,0xe,0x18,0xc6,0x18, +0xef,0xf0,0x7d,0xe0, +}; + +static const BitmapCharRec ch230 = {13,10,-1,0,15,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x38,0x6c,0x6c,0x38, +}; + +static const BitmapCharRec ch229 = {7,14,-1,0,9,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x6c,0x6c, +}; + +static const BitmapCharRec ch228 = {7,13,-1,0,9,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x4c,0x5a,0x32, +}; + +static const BitmapCharRec ch227 = {7,14,-1,0,9,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch226 = {7,14,-1,0,9,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x30,0x18,0xc, +}; + +static const BitmapCharRec ch225 = {7,14,-1,0,9,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x18,0x30,0x60, +}; + +static const BitmapCharRec ch224 = {7,14,-1,0,9,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xdc,0xde,0xc6,0xc6,0xc6,0xc6,0xdc,0xdc,0xc6,0xc6,0xc6,0xc6,0x7c,0x38, +}; + +static const BitmapCharRec ch223 = {7,14,-1,0,9,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc1,0xc0,0xff,0x80,0xff,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch222 = {10,14,-1,0,12,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, +0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30,0x0,0x0,0x6,0x0, +0x3,0x0,0x1,0x80, +}; + +static const BitmapCharRec ch221 = {12,18,-1,0,14,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, +0x19,0x80, +}; + +static const BitmapCharRec ch220 = {11,17,-1,0,13,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, +0xf,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch219 = {11,18,-1,0,13,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0xc,0x0, +0x6,0x0,0x3,0x0, +}; + +static const BitmapCharRec ch218 = {11,18,-1,0,13,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x6,0x0, +0xc,0x0,0x18,0x0, +}; + +static const BitmapCharRec ch217 = {11,18,-1,0,13,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0xc7,0xc0,0xff,0xf0,0x78,0x38,0x38,0x18,0x6c,0x1c,0x6e,0xc,0x67,0xc,0x63,0x8c, +0x61,0xcc,0x70,0xdc,0x30,0x78,0x38,0x38,0x1f,0xfc,0x7,0xcc, +}; + +static const BitmapCharRec ch216 = {14,14,0,0,15,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0,0x61,0x80, +0xc0,0xc0, +}; + +static const BitmapCharRec ch215 = {10,9,0,0,10,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xd,0x80, +0xd,0x80, +}; + +static const BitmapCharRec ch214 = {13,17,-1,0,15,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x9,0x80, +0xb,0x40,0x6,0x40, +}; + +static const BitmapCharRec ch213 = {13,18,-1,0,15,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xc,0xc0, +0x7,0x80,0x3,0x0, +}; + +static const BitmapCharRec ch212 = {13,18,-1,0,15,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, +0x1,0x80,0x0,0xc0, +}; + +static const BitmapCharRec ch211 = {13,18,-1,0,15,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, +0x6,0x0,0xc,0x0, +}; + +static const BitmapCharRec ch210 = {13,18,-1,0,15,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, +0xcc,0x60,0xd8,0x60,0xd8,0x60,0xf0,0x60,0xe0,0x60,0xe0,0x60,0x0,0x0,0x13,0x0, +0x16,0x80,0xc,0x80, +}; + +static const BitmapCharRec ch209 = {11,18,-1,0,13,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x7f,0x80,0x7f,0xc0,0x60,0xe0,0x60,0x60,0x60,0x30,0x60,0x30,0xfc,0x30,0xfc,0x30, +0x60,0x30,0x60,0x30,0x60,0x60,0x60,0xe0,0x7f,0xc0,0x7f,0x80, +}; + +static const BitmapCharRec ch208 = {12,14,0,0,13,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, +0xcc, +}; + +static const BitmapCharRec ch207 = {6,17,0,0,6,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, +0x78,0x30, +}; + +static const BitmapCharRec ch206 = {6,18,0,0,6,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0xc0, +0x60,0x30, +}; + +static const BitmapCharRec ch205 = {4,18,-2,0,6,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x30, +0x60,0xc0, +}; + +static const BitmapCharRec ch204 = {4,18,0,0,6,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, +0x33,0x0, +}; + +static const BitmapCharRec ch203 = {9,17,-1,0,11,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, +0x1e,0x0,0xc,0x0, +}; + +static const BitmapCharRec ch202 = {9,18,-1,0,11,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, +0x6,0x0,0x3,0x0, +}; + +static const BitmapCharRec ch201 = {9,18,-1,0,11,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, +0x18,0x0,0x30,0x0, +}; + +static const BitmapCharRec ch200 = {9,18,-1,0,11,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x1e,0x0,0x1b,0x0,0x3,0x0,0xe,0x0,0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30, +0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70, +0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch199 = {12,18,-1,4,14,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0xc1,0xff,0xc1,0xff,0x61,0x80,0x61,0x80,0x7f,0x80,0x3f,0x80,0x31,0xfe,0x31,0xfe, +0x19,0x80,0x19,0x80,0xd,0x80,0xd,0x80,0x7,0xff,0x7,0xff, +}; + +static const BitmapCharRec ch198 = {16,14,-1,0,18,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, +0x19,0x80,0xf,0x0, +}; + +static const BitmapCharRec ch197 = {12,18,0,0,12,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, +0x19,0x80, +}; + +static const BitmapCharRec ch196 = {12,17,0,0,12,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x13,0x0, +0x16,0x80,0xc,0x80, +}; + +static const BitmapCharRec ch195 = {12,18,0,0,12,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, +0xf,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch194 = {12,18,0,0,12,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, +0x3,0x0,0x1,0x80, +}; + +static const BitmapCharRec ch193 = {12,18,0,0,12,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, +0xc,0x0,0x18,0x0, +}; + +static const BitmapCharRec ch192 = {12,18,0,0,12,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x7c,0xfe,0xc6,0xc6,0xe0,0x70,0x38,0x18,0x18,0x18,0x0,0x0,0x18,0x18, +}; + +static const BitmapCharRec ch191 = {7,14,-1,4,10,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x18,0x18,0x18,0x18,0xc,0xfc,0x6,0xd8,0x6,0x78,0x73,0x38,0xf9,0x18,0x99,0x88, +0x30,0xc0,0x30,0xc0,0x98,0x60,0xf8,0x30,0x70,0x30, +}; + +static const BitmapCharRec ch190 = {14,13,0,0,15,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x30,0xf8,0x30,0xf8,0x18,0x60,0xc,0x30,0xc,0x18,0x66,0x98,0x62,0xf8,0x63,0x70, +0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, +}; + +static const BitmapCharRec ch189 = {13,13,-1,0,15,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x30,0x30,0x30,0x30,0x19,0xf8,0xd,0xb0,0xc,0xf0,0x66,0x70,0x62,0x30,0x63,0x10, +0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, +}; + +static const BitmapCharRec ch188 = {13,13,-1,0,15,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x90,0xd8,0x6c,0x36,0x36,0x6c,0xd8,0x90, +}; + +static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xf8,0x0,0x70,0xd8,0x88,0x88,0xd8,0x70, +}; + +static const BitmapCharRec ch186 = {5,8,-1,-6,7,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x60, +}; + +static const BitmapCharRec ch185 = {3,8,-1,-5,6,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xf0,0xd8,0x18,0x70,0x60, +}; + +static const BitmapCharRec ch184 = {5,5,0,4,5,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch183 = {2,2,-1,-4,4,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x32,0x72,0xf2,0xf2,0xf2,0xf2, +0x72,0x3f, +}; + +static const BitmapCharRec ch182 = {8,18,-1,4,10,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0xc0,0xc0,0xc0,0xc0,0xdb,0xff,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch181 = {8,14,-1,4,10,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0xc0,0x60,0x30, +}; + +static const BitmapCharRec ch180 = {4,3,0,-11,4,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x70,0xf8,0x98,0x30,0x30,0x98,0xf8,0x70, +}; + +static const BitmapCharRec ch179 = {5,8,0,-5,6,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf8,0xf8,0x60,0x30,0x18,0x98,0xf8,0x70, +}; + +static const BitmapCharRec ch178 = {5,8,0,-5,6,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xff,0xff,0x0,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18, +}; + +static const BitmapCharRec ch177 = {8,11,-1,0,10,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x70,0xd8,0x88,0xd8,0x70, +}; + +static const BitmapCharRec ch176 = {5,5,-1,-8,7,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xf8, +}; + +static const BitmapCharRec ch175 = {5,1,0,-12,5,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0xf,0x80,0x30,0x60,0x40,0x10,0x48,0x50,0x88,0x88,0x89,0x8,0x8f,0x88,0x88,0x48, +0x88,0x48,0x4f,0x90,0x40,0x10,0x30,0x60,0xf,0x80, +}; + +static const BitmapCharRec ch174 = {13,13,-1,0,14,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xf8,0xf8, +}; + +static const BitmapCharRec ch173 = {5,2,-1,-4,7,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x1,0x80,0x1,0x80,0x1,0x80,0xff,0x80,0xff,0x80, +}; + +static const BitmapCharRec ch172 = {9,5,-1,-3,11,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x12,0x36,0x6c,0xd8,0xd8,0x6c,0x36,0x12, +}; + +static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xf8,0x0,0x68,0xd8,0x48,0x38,0xc8,0x70, +}; + +static const BitmapCharRec ch170 = {5,8,-1,-6,7,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0xf,0x80,0x30,0x60,0x40,0x10,0x47,0x10,0x88,0x88,0x90,0x8,0x90,0x8,0x90,0x8, +0x88,0x88,0x47,0x10,0x40,0x10,0x30,0x60,0xf,0x80, +}; + +static const BitmapCharRec ch169 = {13,13,-1,0,15,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xd8,0xd8, +}; + +static const BitmapCharRec ch168 = {5,2,0,-11,6,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x3c,0x7e,0xc3,0xc3,0x7,0xe,0x3e,0x73,0xe3,0xc3,0xc7,0x6e,0x7c,0xf0,0xc3,0xc3, +0x7e,0x3c, +}; + +static const BitmapCharRec ch167 = {8,18,-1,4,10,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch166 = {2,17,-1,3,4,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x3c,0x66,0x66,0x66,0xc3,0xc3, +}; + +static const BitmapCharRec ch165 = {8,13,-1,0,10,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0xc3,0xff,0x66,0x66,0x66,0xff,0xc3, +}; + +static const BitmapCharRec ch164 = {8,7,-1,-3,10,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xdf,0x0,0xff,0x80,0x60,0x80,0x30,0x0,0x18,0x0,0x18,0x0,0x7e,0x0,0x30,0x0, +0x60,0x0,0x61,0x80,0x61,0x80,0x3f,0x0,0x1e,0x0, +}; + +static const BitmapCharRec ch163 = {9,13,0,0,10,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x10,0x10,0x3e,0x7f,0x6b,0xc8,0xc8,0xc8,0xc8,0x6b,0x7f,0x3e,0x4,0x4, +}; + +static const BitmapCharRec ch162 = {8,14,-1,2,10,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x40,0x40,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch161 = {2,14,-2,4,6,ch161data}; + +/* char: 0xa0 */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,5,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,5,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0xcc,0x7e,0x33, +}; + +static const BitmapCharRec ch126 = {8,3,-1,-4,10,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xc0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0xc,0x18,0x30,0x30,0x30,0x30,0x30, +0x60,0xc0, +}; + +static const BitmapCharRec ch125 = {6,18,0,4,6,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0, +}; + +static const BitmapCharRec ch124 = {2,18,-1,4,4,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0xc,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xc0,0x60,0x30,0x30,0x30,0x30,0x30, +0x18,0xc, +}; + +static const BitmapCharRec ch123 = {6,18,0,4,6,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xfe,0xfe,0xc0,0x60,0x30,0x18,0xc,0x6,0xfe,0xfe, +}; + +static const BitmapCharRec ch122 = {7,10,-1,0,9,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch121 = {8,14,-1,4,10,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0xc3,0xe7,0x66,0x3c,0x18,0x18,0x3c,0x66,0xe7,0xc3, +}; + +static const BitmapCharRec ch120 = {8,10,-1,0,10,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x19,0x80,0x19,0x80,0x39,0xc0,0x29,0x40,0x69,0x60,0x66,0x60,0x66,0x60,0xc6,0x30, +0xc6,0x30,0xc6,0x30, +}; + +static const BitmapCharRec ch119 = {12,10,-1,0,14,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch118 = {8,10,-1,0,10,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch117 = {8,10,-1,0,10,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x18,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x30, +}; + +static const BitmapCharRec ch116 = {6,13,0,0,6,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x78,0xfc,0xc6,0x6,0x3e,0xfc,0xc0,0xc6,0x7e,0x3c, +}; + +static const BitmapCharRec ch115 = {7,10,-1,0,9,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xd8,0xd8, +}; + +static const BitmapCharRec ch114 = {5,10,-1,0,6,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80,0x7f,0x80,0x3d,0x80, +}; + +static const BitmapCharRec ch113 = {9,14,-1,4,11,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0, +}; + +static const BitmapCharRec ch112 = {9,14,-1,4,11,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0, +}; + +static const BitmapCharRec ch111 = {9,10,-1,0,11,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce, +}; + +static const BitmapCharRec ch110 = {8,10,-1,0,10,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xe7,0x30, +0xde,0xf0,0xcc,0x60, +}; + +static const BitmapCharRec ch109 = {12,10,-1,0,14,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch108 = {2,14,-1,0,4,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0xc7,0xc6,0xce,0xcc,0xd8,0xf8,0xf0,0xd8,0xcc,0xc6,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch107 = {8,14,-1,0,9,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0xe0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x0, +0x30,0x30, +}; + +static const BitmapCharRec ch106 = {4,18,1,4,4,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch105 = {2,14,-1,0,4,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch104 = {8,14,-1,0,10,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x1c,0x0,0x7f,0x0,0x63,0x0,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x7f,0x80,0x3d,0x80, +}; + +static const BitmapCharRec ch103 = {9,14,-1,4,11,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x3c,0x1c, +}; + +static const BitmapCharRec ch102 = {6,14,0,0,6,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c, +}; + +static const BitmapCharRec ch101 = {8,10,-1,0,10,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80, +0x7f,0x80,0x3d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, +}; + +static const BitmapCharRec ch100 = {9,14,-1,0,11,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, +}; + +static const BitmapCharRec ch99 = {8,10,-1,0,10,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0, +0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch98 = {9,14,-1,0,11,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c, +}; + +static const BitmapCharRec ch97 = {7,10,-1,0,9,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0xc0,0xc0,0x80,0x80,0x40, +}; + +static const BitmapCharRec ch96 = {2,5,-1,-9,4,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xff,0xc0,0xff,0xc0, +}; + +static const BitmapCharRec ch95 = {10,2,0,4,10,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x82,0xc6,0x6c,0x38,0x10, +}; + +static const BitmapCharRec ch94 = {7,5,-1,-8,9,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xf0,0xf0, +}; + +static const BitmapCharRec ch93 = {4,18,0,4,5,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x18,0x18,0x10,0x10,0x30,0x30,0x20,0x20,0x60,0x60,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch92 = {5,14,0,0,5,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf0,0xf0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xf0,0xf0, +}; + +static const BitmapCharRec ch91 = {4,18,-1,4,5,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xff,0xc0,0xff,0xc0,0xc0,0x0,0x60,0x0,0x30,0x0,0x18,0x0,0x1c,0x0,0xc,0x0, +0x6,0x0,0x3,0x0,0x1,0x80,0x0,0xc0,0xff,0xc0,0xff,0xc0, +}; + +static const BitmapCharRec ch90 = {10,14,-1,0,12,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, +0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, +}; + +static const BitmapCharRec ch89 = {12,14,-1,0,14,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0xc0,0x60,0xe0,0xe0,0x60,0xc0,0x71,0xc0,0x31,0x80,0x1b,0x0,0xe,0x0,0xe,0x0, +0x1b,0x0,0x31,0x80,0x71,0xc0,0x60,0xc0,0xe0,0xe0,0xc0,0x60, +}; + +static const BitmapCharRec ch88 = {11,14,-1,0,13,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x18,0x18,0x18,0x18,0x1c,0x38,0x34,0x2c,0x36,0x6c,0x36,0x6c,0x66,0x66,0x66,0x66, +0x62,0x46,0x63,0xc6,0xc3,0xc3,0xc1,0x83,0xc1,0x83,0xc1,0x83, +}; + +static const BitmapCharRec ch87 = {16,14,-1,0,18,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x6,0x0,0xf,0x0,0xf,0x0,0x19,0x80,0x19,0x80,0x19,0x80,0x30,0xc0,0x30,0xc0, +0x30,0xc0,0x60,0x60,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, +}; + +static const BitmapCharRec ch86 = {12,14,-1,0,14,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +}; + +static const BitmapCharRec ch85 = {11,14,-1,0,13,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0, +0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xff,0xc0,0xff,0xc0, +}; + +static const BitmapCharRec ch84 = {10,14,-1,0,12,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x3f,0x0,0x7f,0xc0,0xe0,0xe0,0xc0,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0,0x1f,0x0, +0x7c,0x0,0xe0,0x0,0xc0,0x60,0xe0,0xe0,0x7f,0xc0,0x1f,0x0, +}; + +static const BitmapCharRec ch83 = {11,14,-1,0,13,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0x80,0xc1,0x80,0xff,0x0,0xff,0x80, +0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch82 = {10,14,-1,0,12,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x0,0x30,0xf,0xb0,0x3f,0xe0,0x70,0xf0,0x61,0xb0,0xe1,0xb8,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch81 = {13,15,-1,1,15,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80, +0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch80 = {10,14,-1,0,12,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch79 = {13,14,-1,0,15,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, +0xcc,0x60,0xd8,0x60,0xf0,0x60,0xf0,0x60,0xe0,0x60,0xc0,0x60, +}; + +static const BitmapCharRec ch78 = {11,14,-1,0,13,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0xc3,0xc,0xc3,0xc,0xc7,0x8c,0xc4,0x8c,0xcc,0xcc,0xcc,0xcc,0xd8,0x6c,0xd8,0x6c, +0xf0,0x3c,0xf0,0x3c,0xe0,0x1c,0xe0,0x1c,0xc0,0xc,0xc0,0xc, +}; + +static const BitmapCharRec ch77 = {14,14,-1,0,16,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch76 = {8,14,-1,0,10,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0xc0,0x70,0xc0,0xe0,0xc1,0xc0,0xc3,0x80,0xc7,0x0,0xce,0x0,0xfc,0x0,0xf8,0x0, +0xdc,0x0,0xce,0x0,0xc7,0x0,0xc3,0x80,0xc1,0xc0,0xc0,0xe0, +}; + +static const BitmapCharRec ch75 = {12,14,-1,0,13,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x3c,0x7e,0xe7,0xc3,0xc3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3, +}; + +static const BitmapCharRec ch74 = {8,14,-1,0,10,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch73 = {2,14,-2,0,6,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xff,0xe0,0xff,0xe0, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +}; + +static const BitmapCharRec ch72 = {11,14,-1,0,13,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0xf,0xb0,0x3f,0xf0,0x70,0x70,0x60,0x30,0xe0,0x30,0xc1,0xf0,0xc1,0xf0,0xc0,0x0, +0xc0,0x0,0xe0,0x30,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch71 = {12,14,-1,0,14,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, +}; + +static const BitmapCharRec ch70 = {9,14,-1,0,11,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, +}; + +static const BitmapCharRec ch69 = {9,14,-1,0,11,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch68 = {11,14,-1,0,13,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch67 = {12,14,-1,0,14,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xff,0x80,0xff,0xc0,0xc0,0xe0,0xc0,0x60,0xc0,0x60,0xc0,0xe0,0xff,0xc0,0xff,0x80, +0xc1,0x80,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch66 = {11,14,-1,0,13,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch65 = {12,14,0,0,12,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x7,0xe0,0x1f,0xf0,0x38,0x0,0x70,0x0,0x67,0x70,0xcf,0xf8,0xcc,0xcc,0xcc,0x66, +0xcc,0x66,0xcc,0x63,0xc6,0x33,0x67,0x73,0x63,0xb3,0x30,0x6,0x1c,0xe,0xf,0xfc, +0x3,0xf0, +}; + +static const BitmapCharRec ch64 = {16,17,-1,3,18,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x30,0x30,0x0,0x0,0x30,0x30,0x30,0x38,0x1c,0xe,0xc6,0xc6,0xfe,0x7c, +}; + +static const BitmapCharRec ch63 = {7,14,-1,0,10,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0xc0,0xf0,0x3c,0xe,0x3,0xe,0x3c,0xf0,0xc0, +}; + +static const BitmapCharRec ch62 = {8,9,-1,0,10,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xfe,0xfe,0x0,0x0,0xfe,0xfe, +}; + +static const BitmapCharRec ch61 = {7,6,-2,-2,11,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x3,0xf,0x3c,0x70,0xc0,0x70,0x3c,0xf,0x3, +}; + +static const BitmapCharRec ch60 = {8,9,-1,0,10,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch59 = {2,13,-1,3,5,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch58 = {2,10,-1,0,5,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x7c,0xfe,0xc6,0x3,0x3,0x3b,0x7f,0xc3,0xc3,0xc3,0xc7,0x7e,0x3c, +}; + +static const BitmapCharRec ch57 = {8,13,-1,0,10,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x3c,0x7e,0xe7,0xc3,0xc3,0x66,0x7e,0x66,0xc3,0xc3,0xe7,0x7e,0x3c, +}; + +static const BitmapCharRec ch56 = {8,13,-1,0,10,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x60,0x60,0x30,0x30,0x30,0x18,0x18,0xc,0xc,0x6,0x3,0xff,0xff, +}; + +static const BitmapCharRec ch55 = {8,13,-1,0,10,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x3c,0x7e,0xe3,0xc3,0xc3,0xc3,0xfe,0xdc,0xc0,0xc0,0x63,0x7f,0x3c, +}; + +static const BitmapCharRec ch54 = {8,13,-1,0,10,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x7c,0xfe,0xc7,0xc3,0x3,0x3,0xc7,0xfe,0xfc,0xc0,0xc0,0xfe,0xfe, +}; + +static const BitmapCharRec ch53 = {8,13,-1,0,10,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x3,0x0,0x3,0x0,0x3,0x0,0xff,0x80,0xff,0x80,0xc3,0x0,0x63,0x0,0x33,0x0, +0x33,0x0,0x1b,0x0,0xf,0x0,0x7,0x0,0x3,0x0, +}; + +static const BitmapCharRec ch52 = {9,13,-1,0,10,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x3c,0x7e,0xc7,0xc3,0x3,0x7,0x1e,0x1c,0x6,0xc3,0xc3,0x7e,0x3c, +}; + +static const BitmapCharRec ch51 = {8,13,-1,0,10,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xff,0xff,0xc0,0xe0,0x70,0x38,0x1c,0xe,0x7,0x3,0xc3,0xfe,0x3c, +}; + +static const BitmapCharRec ch50 = {8,13,-1,0,10,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0xf8,0x18, +}; + +static const BitmapCharRec ch49 = {5,13,-2,0,10,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x3c,0x7e,0x66,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x7e,0x3c, +}; + +static const BitmapCharRec ch48 = {8,13,-1,0,10,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0xc0,0xc0,0x40,0x40,0x60,0x60,0x20,0x20,0x30,0x30,0x10,0x10,0x18,0x18, +}; + +static const BitmapCharRec ch47 = {5,14,0,0,5,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch46 = {2,2,-1,0,5,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xff,0xff, +}; + +static const BitmapCharRec ch45 = {8,2,-1,-4,11,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch44 = {2,5,-1,3,5,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x18,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,0x18, +}; + +static const BitmapCharRec ch43 = {8,10,-1,0,10,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x88,0x70,0x70,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch42 = {5,6,-1,-8,7,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0xc0,0x60,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0x60, +0xc0,0x80, +}; + +static const BitmapCharRec ch41 = {4,18,-1,4,6,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x10,0x30,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60,0x60, +0x30,0x10, +}; + +static const BitmapCharRec ch40 = {4,18,-1,4,6,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch39 = {2,5,-1,-9,4,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x3c,0x70,0x7e,0xe0,0xe7,0xc0,0xc3,0x80,0xc3,0xc0,0xc6,0xc0,0xee,0xc0,0x7c,0x0, +0x3c,0x0,0x66,0x0,0x66,0x0,0x7e,0x0,0x3c,0x0, +}; + +static const BitmapCharRec ch38 = {12,13,-1,0,13,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x18,0x78,0x18,0xfc,0xc,0xcc,0xc,0xcc,0x6,0xfc,0x6,0x78,0x3,0x0,0x7b,0x0, +0xfd,0x80,0xcd,0x80,0xcc,0xc0,0xfc,0xc0,0x78,0x60, +}; + +static const BitmapCharRec ch37 = {14,13,-1,0,16,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x8,0x0,0x8,0x0,0x3e,0x0,0x7f,0x0,0xeb,0x80,0xc9,0x80,0x9,0x80,0xf,0x0, +0x3e,0x0,0x78,0x0,0xe8,0x0,0xc8,0x0,0xcb,0x0,0x7f,0x0,0x3e,0x0,0x8,0x0, +}; + +static const BitmapCharRec ch36 = {9,16,-1,2,10,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x24,0x0,0x24,0x0,0x24,0x0,0xff,0x80,0xff,0x80,0x12,0x0,0x12,0x0,0x12,0x0, +0x7f,0xc0,0x7f,0xc0,0x9,0x0,0x9,0x0,0x9,0x0, +}; + +static const BitmapCharRec ch35 = {10,13,0,0,10,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x90,0x90,0xd8,0xd8,0xd8, +}; + +static const BitmapCharRec ch34 = {5,5,0,-9,5,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0xc0,0xc0,0x0,0x0,0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch33 = {2,14,-2,0,6,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,5,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,5,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmapHelvetica18 = { +"-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_mroman.cpp b/xc/extras/Mesa/src-glut.beos/glut_mroman.cpp new file mode 100644 index 000000000..a29f043b4 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_mroman.cpp @@ -0,0 +1,2451 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutstroke.h" + +/* char: 33 '!' */ + +static const CoordRec char33_stroke0[] = { + { 52.381, 100 }, + { 52.381, 33.3333 }, +}; + +static const CoordRec char33_stroke1[] = { + { 52.381, 9.5238 }, + { 47.6191, 4.7619 }, + { 52.381, 0 }, + { 57.1429, 4.7619 }, + { 52.381, 9.5238 }, +}; + +static const StrokeRec char33[] = { + { 2, char33_stroke0 }, + { 5, char33_stroke1 }, +}; + +/* char: 34 '"' */ + +static const CoordRec char34_stroke0[] = { + { 33.3334, 100 }, + { 33.3334, 66.6667 }, +}; + +static const CoordRec char34_stroke1[] = { + { 71.4286, 100 }, + { 71.4286, 66.6667 }, +}; + +static const StrokeRec char34[] = { + { 2, char34_stroke0 }, + { 2, char34_stroke1 }, +}; + +/* char: 35 '#' */ + +static const CoordRec char35_stroke0[] = { + { 54.7619, 119.048 }, + { 21.4286, -33.3333 }, +}; + +static const CoordRec char35_stroke1[] = { + { 83.3334, 119.048 }, + { 50, -33.3333 }, +}; + +static const CoordRec char35_stroke2[] = { + { 21.4286, 57.1429 }, + { 88.0952, 57.1429 }, +}; + +static const CoordRec char35_stroke3[] = { + { 16.6667, 28.5714 }, + { 83.3334, 28.5714 }, +}; + +static const StrokeRec char35[] = { + { 2, char35_stroke0 }, + { 2, char35_stroke1 }, + { 2, char35_stroke2 }, + { 2, char35_stroke3 }, +}; + +/* char: 36 '$' */ + +static const CoordRec char36_stroke0[] = { + { 42.8571, 119.048 }, + { 42.8571, -19.0476 }, +}; + +static const CoordRec char36_stroke1[] = { + { 61.9047, 119.048 }, + { 61.9047, -19.0476 }, +}; + +static const CoordRec char36_stroke2[] = { + { 85.7143, 85.7143 }, + { 76.1905, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, + { 28.5714, 95.2381 }, + { 19.0476, 85.7143 }, + { 19.0476, 76.1905 }, + { 23.8095, 66.6667 }, + { 28.5714, 61.9048 }, + { 38.0952, 57.1429 }, + { 66.6666, 47.619 }, + { 76.1905, 42.8571 }, + { 80.9524, 38.0952 }, + { 85.7143, 28.5714 }, + { 85.7143, 14.2857 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 19.0476, 14.2857 }, +}; + +static const StrokeRec char36[] = { + { 2, char36_stroke0 }, + { 2, char36_stroke1 }, + { 20, char36_stroke2 }, +}; + +/* char: 37 '%' */ + +static const CoordRec char37_stroke0[] = { + { 95.2381, 100 }, + { 9.5238, 0 }, +}; + +static const CoordRec char37_stroke1[] = { + { 33.3333, 100 }, + { 42.8571, 90.4762 }, + { 42.8571, 80.9524 }, + { 38.0952, 71.4286 }, + { 28.5714, 66.6667 }, + { 19.0476, 66.6667 }, + { 9.5238, 76.1905 }, + { 9.5238, 85.7143 }, + { 14.2857, 95.2381 }, + { 23.8095, 100 }, + { 33.3333, 100 }, + { 42.8571, 95.2381 }, + { 57.1428, 90.4762 }, + { 71.4286, 90.4762 }, + { 85.7143, 95.2381 }, + { 95.2381, 100 }, +}; + +static const CoordRec char37_stroke2[] = { + { 76.1905, 33.3333 }, + { 66.6667, 28.5714 }, + { 61.9048, 19.0476 }, + { 61.9048, 9.5238 }, + { 71.4286, 0 }, + { 80.9524, 0 }, + { 90.4762, 4.7619 }, + { 95.2381, 14.2857 }, + { 95.2381, 23.8095 }, + { 85.7143, 33.3333 }, + { 76.1905, 33.3333 }, +}; + +static const StrokeRec char37[] = { + { 2, char37_stroke0 }, + { 16, char37_stroke1 }, + { 11, char37_stroke2 }, +}; + +/* char: 38 '&' */ + +static const CoordRec char38_stroke0[] = { + { 100, 57.1429 }, + { 100, 61.9048 }, + { 95.2381, 66.6667 }, + { 90.4762, 66.6667 }, + { 85.7143, 61.9048 }, + { 80.9524, 52.381 }, + { 71.4286, 28.5714 }, + { 61.9048, 14.2857 }, + { 52.3809, 4.7619 }, + { 42.8571, 0 }, + { 23.8095, 0 }, + { 14.2857, 4.7619 }, + { 9.5238, 9.5238 }, + { 4.7619, 19.0476 }, + { 4.7619, 28.5714 }, + { 9.5238, 38.0952 }, + { 14.2857, 42.8571 }, + { 47.619, 61.9048 }, + { 52.3809, 66.6667 }, + { 57.1429, 76.1905 }, + { 57.1429, 85.7143 }, + { 52.3809, 95.2381 }, + { 42.8571, 100 }, + { 33.3333, 95.2381 }, + { 28.5714, 85.7143 }, + { 28.5714, 76.1905 }, + { 33.3333, 61.9048 }, + { 42.8571, 47.619 }, + { 66.6667, 14.2857 }, + { 76.1905, 4.7619 }, + { 85.7143, 0 }, + { 95.2381, 0 }, + { 100, 4.7619 }, + { 100, 9.5238 }, +}; + +static const StrokeRec char38[] = { + { 34, char38_stroke0 }, +}; + +/* char: 39 ''' */ + +static const CoordRec char39_stroke0[] = { + { 52.381, 100 }, + { 52.381, 66.6667 }, +}; + +static const StrokeRec char39[] = { + { 2, char39_stroke0 }, +}; + +/* char: 40 '(' */ + +static const CoordRec char40_stroke0[] = { + { 69.0476, 119.048 }, + { 59.5238, 109.524 }, + { 50, 95.2381 }, + { 40.4762, 76.1905 }, + { 35.7143, 52.381 }, + { 35.7143, 33.3333 }, + { 40.4762, 9.5238 }, + { 50, -9.5238 }, + { 59.5238, -23.8095 }, + { 69.0476, -33.3333 }, +}; + +static const StrokeRec char40[] = { + { 10, char40_stroke0 }, +}; + +/* char: 41 ')' */ + +static const CoordRec char41_stroke0[] = { + { 35.7143, 119.048 }, + { 45.2381, 109.524 }, + { 54.7619, 95.2381 }, + { 64.2857, 76.1905 }, + { 69.0476, 52.381 }, + { 69.0476, 33.3333 }, + { 64.2857, 9.5238 }, + { 54.7619, -9.5238 }, + { 45.2381, -23.8095 }, + { 35.7143, -33.3333 }, +}; + +static const StrokeRec char41[] = { + { 10, char41_stroke0 }, +}; + +/* char: 42 '*' */ + +static const CoordRec char42_stroke0[] = { + { 52.381, 71.4286 }, + { 52.381, 14.2857 }, +}; + +static const CoordRec char42_stroke1[] = { + { 28.5715, 57.1429 }, + { 76.1905, 28.5714 }, +}; + +static const CoordRec char42_stroke2[] = { + { 76.1905, 57.1429 }, + { 28.5715, 28.5714 }, +}; + +static const StrokeRec char42[] = { + { 2, char42_stroke0 }, + { 2, char42_stroke1 }, + { 2, char42_stroke2 }, +}; + +/* char: 43 '+' */ + +static const CoordRec char43_stroke0[] = { + { 52.3809, 85.7143 }, + { 52.3809, 0 }, +}; + +static const CoordRec char43_stroke1[] = { + { 9.5238, 42.8571 }, + { 95.2381, 42.8571 }, +}; + +static const StrokeRec char43[] = { + { 2, char43_stroke0 }, + { 2, char43_stroke1 }, +}; + +/* char: 44 ',' */ + +static const CoordRec char44_stroke0[] = { + { 57.1429, 4.7619 }, + { 52.381, 0 }, + { 47.6191, 4.7619 }, + { 52.381, 9.5238 }, + { 57.1429, 4.7619 }, + { 57.1429, -4.7619 }, + { 52.381, -14.2857 }, + { 47.6191, -19.0476 }, +}; + +static const StrokeRec char44[] = { + { 8, char44_stroke0 }, +}; + +/* char: 45 '-' */ + +static const CoordRec char45_stroke0[] = { + { 9.5238, 42.8571 }, + { 95.2381, 42.8571 }, +}; + +static const StrokeRec char45[] = { + { 2, char45_stroke0 }, +}; + +/* char: 46 '.' */ + +static const CoordRec char46_stroke0[] = { + { 52.381, 9.5238 }, + { 47.6191, 4.7619 }, + { 52.381, 0 }, + { 57.1429, 4.7619 }, + { 52.381, 9.5238 }, +}; + +static const StrokeRec char46[] = { + { 5, char46_stroke0 }, +}; + +/* char: 47 '/' */ + +static const CoordRec char47_stroke0[] = { + { 19.0476, -14.2857 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char47[] = { + { 2, char47_stroke0 }, +}; + +/* char: 48 '0' */ + +static const CoordRec char48_stroke0[] = { + { 47.619, 100 }, + { 33.3333, 95.2381 }, + { 23.8095, 80.9524 }, + { 19.0476, 57.1429 }, + { 19.0476, 42.8571 }, + { 23.8095, 19.0476 }, + { 33.3333, 4.7619 }, + { 47.619, 0 }, + { 57.1428, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 19.0476 }, + { 85.7143, 42.8571 }, + { 85.7143, 57.1429 }, + { 80.9524, 80.9524 }, + { 71.4286, 95.2381 }, + { 57.1428, 100 }, + { 47.619, 100 }, +}; + +static const StrokeRec char48[] = { + { 17, char48_stroke0 }, +}; + +/* char: 49 '1' */ + +static const CoordRec char49_stroke0[] = { + { 40.4762, 80.9524 }, + { 50, 85.7143 }, + { 64.2857, 100 }, + { 64.2857, 0 }, +}; + +static const StrokeRec char49[] = { + { 4, char49_stroke0 }, +}; + +/* char: 50 '2' */ + +static const CoordRec char50_stroke0[] = { + { 23.8095, 76.1905 }, + { 23.8095, 80.9524 }, + { 28.5714, 90.4762 }, + { 33.3333, 95.2381 }, + { 42.8571, 100 }, + { 61.9047, 100 }, + { 71.4286, 95.2381 }, + { 76.1905, 90.4762 }, + { 80.9524, 80.9524 }, + { 80.9524, 71.4286 }, + { 76.1905, 61.9048 }, + { 66.6666, 47.619 }, + { 19.0476, 0 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char50[] = { + { 14, char50_stroke0 }, +}; + +/* char: 51 '3' */ + +static const CoordRec char51_stroke0[] = { + { 28.5714, 100 }, + { 80.9524, 100 }, + { 52.3809, 61.9048 }, + { 66.6666, 61.9048 }, + { 76.1905, 57.1429 }, + { 80.9524, 52.381 }, + { 85.7143, 38.0952 }, + { 85.7143, 28.5714 }, + { 80.9524, 14.2857 }, + { 71.4286, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 23.8095, 9.5238 }, + { 19.0476, 19.0476 }, +}; + +static const StrokeRec char51[] = { + { 15, char51_stroke0 }, +}; + +/* char: 52 '4' */ + +static const CoordRec char52_stroke0[] = { + { 64.2857, 100 }, + { 16.6667, 33.3333 }, + { 88.0952, 33.3333 }, +}; + +static const CoordRec char52_stroke1[] = { + { 64.2857, 100 }, + { 64.2857, 0 }, +}; + +static const StrokeRec char52[] = { + { 3, char52_stroke0 }, + { 2, char52_stroke1 }, +}; + +/* char: 53 '5' */ + +static const CoordRec char53_stroke0[] = { + { 76.1905, 100 }, + { 28.5714, 100 }, + { 23.8095, 57.1429 }, + { 28.5714, 61.9048 }, + { 42.8571, 66.6667 }, + { 57.1428, 66.6667 }, + { 71.4286, 61.9048 }, + { 80.9524, 52.381 }, + { 85.7143, 38.0952 }, + { 85.7143, 28.5714 }, + { 80.9524, 14.2857 }, + { 71.4286, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 23.8095, 9.5238 }, + { 19.0476, 19.0476 }, +}; + +static const StrokeRec char53[] = { + { 17, char53_stroke0 }, +}; + +/* char: 54 '6' */ + +static const CoordRec char54_stroke0[] = { + { 78.5714, 85.7143 }, + { 73.8096, 95.2381 }, + { 59.5238, 100 }, + { 50, 100 }, + { 35.7143, 95.2381 }, + { 26.1905, 80.9524 }, + { 21.4286, 57.1429 }, + { 21.4286, 33.3333 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 50, 0 }, + { 54.7619, 0 }, + { 69.0476, 4.7619 }, + { 78.5714, 14.2857 }, + { 83.3334, 28.5714 }, + { 83.3334, 33.3333 }, + { 78.5714, 47.619 }, + { 69.0476, 57.1429 }, + { 54.7619, 61.9048 }, + { 50, 61.9048 }, + { 35.7143, 57.1429 }, + { 26.1905, 47.619 }, + { 21.4286, 33.3333 }, +}; + +static const StrokeRec char54[] = { + { 23, char54_stroke0 }, +}; + +/* char: 55 '7' */ + +static const CoordRec char55_stroke0[] = { + { 85.7143, 100 }, + { 38.0952, 0 }, +}; + +static const CoordRec char55_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char55[] = { + { 2, char55_stroke0 }, + { 2, char55_stroke1 }, +}; + +/* char: 56 '8' */ + +static const CoordRec char56_stroke0[] = { + { 42.8571, 100 }, + { 28.5714, 95.2381 }, + { 23.8095, 85.7143 }, + { 23.8095, 76.1905 }, + { 28.5714, 66.6667 }, + { 38.0952, 61.9048 }, + { 57.1428, 57.1429 }, + { 71.4286, 52.381 }, + { 80.9524, 42.8571 }, + { 85.7143, 33.3333 }, + { 85.7143, 19.0476 }, + { 80.9524, 9.5238 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 23.8095, 9.5238 }, + { 19.0476, 19.0476 }, + { 19.0476, 33.3333 }, + { 23.8095, 42.8571 }, + { 33.3333, 52.381 }, + { 47.619, 57.1429 }, + { 66.6666, 61.9048 }, + { 76.1905, 66.6667 }, + { 80.9524, 76.1905 }, + { 80.9524, 85.7143 }, + { 76.1905, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, +}; + +static const StrokeRec char56[] = { + { 29, char56_stroke0 }, +}; + +/* char: 57 '9' */ + +static const CoordRec char57_stroke0[] = { + { 83.3334, 66.6667 }, + { 78.5714, 52.381 }, + { 69.0476, 42.8571 }, + { 54.7619, 38.0952 }, + { 50, 38.0952 }, + { 35.7143, 42.8571 }, + { 26.1905, 52.381 }, + { 21.4286, 66.6667 }, + { 21.4286, 71.4286 }, + { 26.1905, 85.7143 }, + { 35.7143, 95.2381 }, + { 50, 100 }, + { 54.7619, 100 }, + { 69.0476, 95.2381 }, + { 78.5714, 85.7143 }, + { 83.3334, 66.6667 }, + { 83.3334, 42.8571 }, + { 78.5714, 19.0476 }, + { 69.0476, 4.7619 }, + { 54.7619, 0 }, + { 45.2381, 0 }, + { 30.9524, 4.7619 }, + { 26.1905, 14.2857 }, +}; + +static const StrokeRec char57[] = { + { 23, char57_stroke0 }, +}; + +/* char: 58 ':' */ + +static const CoordRec char58_stroke0[] = { + { 52.381, 66.6667 }, + { 47.6191, 61.9048 }, + { 52.381, 57.1429 }, + { 57.1429, 61.9048 }, + { 52.381, 66.6667 }, +}; + +static const CoordRec char58_stroke1[] = { + { 52.381, 9.5238 }, + { 47.6191, 4.7619 }, + { 52.381, 0 }, + { 57.1429, 4.7619 }, + { 52.381, 9.5238 }, +}; + +static const StrokeRec char58[] = { + { 5, char58_stroke0 }, + { 5, char58_stroke1 }, +}; + +/* char: 59 ';' */ + +static const CoordRec char59_stroke0[] = { + { 52.381, 66.6667 }, + { 47.6191, 61.9048 }, + { 52.381, 57.1429 }, + { 57.1429, 61.9048 }, + { 52.381, 66.6667 }, +}; + +static const CoordRec char59_stroke1[] = { + { 57.1429, 4.7619 }, + { 52.381, 0 }, + { 47.6191, 4.7619 }, + { 52.381, 9.5238 }, + { 57.1429, 4.7619 }, + { 57.1429, -4.7619 }, + { 52.381, -14.2857 }, + { 47.6191, -19.0476 }, +}; + +static const StrokeRec char59[] = { + { 5, char59_stroke0 }, + { 8, char59_stroke1 }, +}; + +/* char: 60 '<' */ + +static const CoordRec char60_stroke0[] = { + { 90.4762, 85.7143 }, + { 14.2857, 42.8571 }, + { 90.4762, 0 }, +}; + +static const StrokeRec char60[] = { + { 3, char60_stroke0 }, +}; + +/* char: 61 '=' */ + +static const CoordRec char61_stroke0[] = { + { 9.5238, 57.1429 }, + { 95.2381, 57.1429 }, +}; + +static const CoordRec char61_stroke1[] = { + { 9.5238, 28.5714 }, + { 95.2381, 28.5714 }, +}; + +static const StrokeRec char61[] = { + { 2, char61_stroke0 }, + { 2, char61_stroke1 }, +}; + +/* char: 62 '>' */ + +static const CoordRec char62_stroke0[] = { + { 14.2857, 85.7143 }, + { 90.4762, 42.8571 }, + { 14.2857, 0 }, +}; + +static const StrokeRec char62[] = { + { 3, char62_stroke0 }, +}; + +/* char: 63 '?' */ + +static const CoordRec char63_stroke0[] = { + { 23.8095, 76.1905 }, + { 23.8095, 80.9524 }, + { 28.5714, 90.4762 }, + { 33.3333, 95.2381 }, + { 42.8571, 100 }, + { 61.9047, 100 }, + { 71.4285, 95.2381 }, + { 76.1905, 90.4762 }, + { 80.9524, 80.9524 }, + { 80.9524, 71.4286 }, + { 76.1905, 61.9048 }, + { 71.4285, 57.1429 }, + { 52.3809, 47.619 }, + { 52.3809, 33.3333 }, +}; + +static const CoordRec char63_stroke1[] = { + { 52.3809, 9.5238 }, + { 47.619, 4.7619 }, + { 52.3809, 0 }, + { 57.1428, 4.7619 }, + { 52.3809, 9.5238 }, +}; + +static const StrokeRec char63[] = { + { 14, char63_stroke0 }, + { 5, char63_stroke1 }, +}; + +/* char: 64 '@' */ + +static const CoordRec char64_stroke0[] = { + { 64.2857, 52.381 }, + { 54.7619, 57.1429 }, + { 45.2381, 57.1429 }, + { 40.4762, 47.619 }, + { 40.4762, 42.8571 }, + { 45.2381, 33.3333 }, + { 54.7619, 33.3333 }, + { 64.2857, 38.0952 }, +}; + +static const CoordRec char64_stroke1[] = { + { 64.2857, 57.1429 }, + { 64.2857, 38.0952 }, + { 69.0476, 33.3333 }, + { 78.5714, 33.3333 }, + { 83.3334, 42.8571 }, + { 83.3334, 47.619 }, + { 78.5714, 61.9048 }, + { 69.0476, 71.4286 }, + { 54.7619, 76.1905 }, + { 50, 76.1905 }, + { 35.7143, 71.4286 }, + { 26.1905, 61.9048 }, + { 21.4286, 47.619 }, + { 21.4286, 42.8571 }, + { 26.1905, 28.5714 }, + { 35.7143, 19.0476 }, + { 50, 14.2857 }, + { 54.7619, 14.2857 }, + { 69.0476, 19.0476 }, +}; + +static const StrokeRec char64[] = { + { 8, char64_stroke0 }, + { 19, char64_stroke1 }, +}; + +/* char: 65 'A' */ + +static const CoordRec char65_stroke0[] = { + { 52.3809, 100 }, + { 14.2857, 0 }, +}; + +static const CoordRec char65_stroke1[] = { + { 52.3809, 100 }, + { 90.4762, 0 }, +}; + +static const CoordRec char65_stroke2[] = { + { 28.5714, 33.3333 }, + { 76.1905, 33.3333 }, +}; + +static const StrokeRec char65[] = { + { 2, char65_stroke0 }, + { 2, char65_stroke1 }, + { 2, char65_stroke2 }, +}; + +/* char: 66 'B' */ + +static const CoordRec char66_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char66_stroke1[] = { + { 19.0476, 100 }, + { 61.9047, 100 }, + { 76.1905, 95.2381 }, + { 80.9524, 90.4762 }, + { 85.7143, 80.9524 }, + { 85.7143, 71.4286 }, + { 80.9524, 61.9048 }, + { 76.1905, 57.1429 }, + { 61.9047, 52.381 }, +}; + +static const CoordRec char66_stroke2[] = { + { 19.0476, 52.381 }, + { 61.9047, 52.381 }, + { 76.1905, 47.619 }, + { 80.9524, 42.8571 }, + { 85.7143, 33.3333 }, + { 85.7143, 19.0476 }, + { 80.9524, 9.5238 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 19.0476, 0 }, +}; + +static const StrokeRec char66[] = { + { 2, char66_stroke0 }, + { 9, char66_stroke1 }, + { 10, char66_stroke2 }, +}; + +/* char: 67 'C' */ + +static const CoordRec char67_stroke0[] = { + { 88.0952, 76.1905 }, + { 83.3334, 85.7143 }, + { 73.8096, 95.2381 }, + { 64.2857, 100 }, + { 45.2381, 100 }, + { 35.7143, 95.2381 }, + { 26.1905, 85.7143 }, + { 21.4286, 76.1905 }, + { 16.6667, 61.9048 }, + { 16.6667, 38.0952 }, + { 21.4286, 23.8095 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 45.2381, 0 }, + { 64.2857, 0 }, + { 73.8096, 4.7619 }, + { 83.3334, 14.2857 }, + { 88.0952, 23.8095 }, +}; + +static const StrokeRec char67[] = { + { 18, char67_stroke0 }, +}; + +/* char: 68 'D' */ + +static const CoordRec char68_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char68_stroke1[] = { + { 19.0476, 100 }, + { 52.3809, 100 }, + { 66.6666, 95.2381 }, + { 76.1905, 85.7143 }, + { 80.9524, 76.1905 }, + { 85.7143, 61.9048 }, + { 85.7143, 38.0952 }, + { 80.9524, 23.8095 }, + { 76.1905, 14.2857 }, + { 66.6666, 4.7619 }, + { 52.3809, 0 }, + { 19.0476, 0 }, +}; + +static const StrokeRec char68[] = { + { 2, char68_stroke0 }, + { 12, char68_stroke1 }, +}; + +/* char: 69 'E' */ + +static const CoordRec char69_stroke0[] = { + { 21.4286, 100 }, + { 21.4286, 0 }, +}; + +static const CoordRec char69_stroke1[] = { + { 21.4286, 100 }, + { 83.3334, 100 }, +}; + +static const CoordRec char69_stroke2[] = { + { 21.4286, 52.381 }, + { 59.5238, 52.381 }, +}; + +static const CoordRec char69_stroke3[] = { + { 21.4286, 0 }, + { 83.3334, 0 }, +}; + +static const StrokeRec char69[] = { + { 2, char69_stroke0 }, + { 2, char69_stroke1 }, + { 2, char69_stroke2 }, + { 2, char69_stroke3 }, +}; + +/* char: 70 'F' */ + +static const CoordRec char70_stroke0[] = { + { 21.4286, 100 }, + { 21.4286, 0 }, +}; + +static const CoordRec char70_stroke1[] = { + { 21.4286, 100 }, + { 83.3334, 100 }, +}; + +static const CoordRec char70_stroke2[] = { + { 21.4286, 52.381 }, + { 59.5238, 52.381 }, +}; + +static const StrokeRec char70[] = { + { 2, char70_stroke0 }, + { 2, char70_stroke1 }, + { 2, char70_stroke2 }, +}; + +/* char: 71 'G' */ + +static const CoordRec char71_stroke0[] = { + { 88.0952, 76.1905 }, + { 83.3334, 85.7143 }, + { 73.8096, 95.2381 }, + { 64.2857, 100 }, + { 45.2381, 100 }, + { 35.7143, 95.2381 }, + { 26.1905, 85.7143 }, + { 21.4286, 76.1905 }, + { 16.6667, 61.9048 }, + { 16.6667, 38.0952 }, + { 21.4286, 23.8095 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 45.2381, 0 }, + { 64.2857, 0 }, + { 73.8096, 4.7619 }, + { 83.3334, 14.2857 }, + { 88.0952, 23.8095 }, + { 88.0952, 38.0952 }, +}; + +static const CoordRec char71_stroke1[] = { + { 64.2857, 38.0952 }, + { 88.0952, 38.0952 }, +}; + +static const StrokeRec char71[] = { + { 19, char71_stroke0 }, + { 2, char71_stroke1 }, +}; + +/* char: 72 'H' */ + +static const CoordRec char72_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char72_stroke1[] = { + { 85.7143, 100 }, + { 85.7143, 0 }, +}; + +static const CoordRec char72_stroke2[] = { + { 19.0476, 52.381 }, + { 85.7143, 52.381 }, +}; + +static const StrokeRec char72[] = { + { 2, char72_stroke0 }, + { 2, char72_stroke1 }, + { 2, char72_stroke2 }, +}; + +/* char: 73 'I' */ + +static const CoordRec char73_stroke0[] = { + { 52.381, 100 }, + { 52.381, 0 }, +}; + +static const StrokeRec char73[] = { + { 2, char73_stroke0 }, +}; + +/* char: 74 'J' */ + +static const CoordRec char74_stroke0[] = { + { 76.1905, 100 }, + { 76.1905, 23.8095 }, + { 71.4286, 9.5238 }, + { 66.6667, 4.7619 }, + { 57.1429, 0 }, + { 47.6191, 0 }, + { 38.0953, 4.7619 }, + { 33.3334, 9.5238 }, + { 28.5715, 23.8095 }, + { 28.5715, 33.3333 }, +}; + +static const StrokeRec char74[] = { + { 10, char74_stroke0 }, +}; + +/* char: 75 'K' */ + +static const CoordRec char75_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char75_stroke1[] = { + { 85.7143, 100 }, + { 19.0476, 33.3333 }, +}; + +static const CoordRec char75_stroke2[] = { + { 42.8571, 57.1429 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char75[] = { + { 2, char75_stroke0 }, + { 2, char75_stroke1 }, + { 2, char75_stroke2 }, +}; + +/* char: 76 'L' */ + +static const CoordRec char76_stroke0[] = { + { 23.8095, 100 }, + { 23.8095, 0 }, +}; + +static const CoordRec char76_stroke1[] = { + { 23.8095, 0 }, + { 80.9524, 0 }, +}; + +static const StrokeRec char76[] = { + { 2, char76_stroke0 }, + { 2, char76_stroke1 }, +}; + +/* char: 77 'M' */ + +static const CoordRec char77_stroke0[] = { + { 14.2857, 100 }, + { 14.2857, 0 }, +}; + +static const CoordRec char77_stroke1[] = { + { 14.2857, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char77_stroke2[] = { + { 90.4762, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char77_stroke3[] = { + { 90.4762, 100 }, + { 90.4762, 0 }, +}; + +static const StrokeRec char77[] = { + { 2, char77_stroke0 }, + { 2, char77_stroke1 }, + { 2, char77_stroke2 }, + { 2, char77_stroke3 }, +}; + +/* char: 78 'N' */ + +static const CoordRec char78_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char78_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 0 }, +}; + +static const CoordRec char78_stroke2[] = { + { 85.7143, 100 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char78[] = { + { 2, char78_stroke0 }, + { 2, char78_stroke1 }, + { 2, char78_stroke2 }, +}; + +/* char: 79 'O' */ + +static const CoordRec char79_stroke0[] = { + { 42.8571, 100 }, + { 33.3333, 95.2381 }, + { 23.8095, 85.7143 }, + { 19.0476, 76.1905 }, + { 14.2857, 61.9048 }, + { 14.2857, 38.0952 }, + { 19.0476, 23.8095 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 42.8571, 0 }, + { 61.9047, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 23.8095 }, + { 90.4762, 38.0952 }, + { 90.4762, 61.9048 }, + { 85.7143, 76.1905 }, + { 80.9524, 85.7143 }, + { 71.4286, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, +}; + +static const StrokeRec char79[] = { + { 21, char79_stroke0 }, +}; + +/* char: 80 'P' */ + +static const CoordRec char80_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char80_stroke1[] = { + { 19.0476, 100 }, + { 61.9047, 100 }, + { 76.1905, 95.2381 }, + { 80.9524, 90.4762 }, + { 85.7143, 80.9524 }, + { 85.7143, 66.6667 }, + { 80.9524, 57.1429 }, + { 76.1905, 52.381 }, + { 61.9047, 47.619 }, + { 19.0476, 47.619 }, +}; + +static const StrokeRec char80[] = { + { 2, char80_stroke0 }, + { 10, char80_stroke1 }, +}; + +/* char: 81 'Q' */ + +static const CoordRec char81_stroke0[] = { + { 42.8571, 100 }, + { 33.3333, 95.2381 }, + { 23.8095, 85.7143 }, + { 19.0476, 76.1905 }, + { 14.2857, 61.9048 }, + { 14.2857, 38.0952 }, + { 19.0476, 23.8095 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 42.8571, 0 }, + { 61.9047, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 23.8095 }, + { 90.4762, 38.0952 }, + { 90.4762, 61.9048 }, + { 85.7143, 76.1905 }, + { 80.9524, 85.7143 }, + { 71.4286, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, +}; + +static const CoordRec char81_stroke1[] = { + { 57.1428, 19.0476 }, + { 85.7143, -9.5238 }, +}; + +static const StrokeRec char81[] = { + { 21, char81_stroke0 }, + { 2, char81_stroke1 }, +}; + +/* char: 82 'R' */ + +static const CoordRec char82_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char82_stroke1[] = { + { 19.0476, 100 }, + { 61.9047, 100 }, + { 76.1905, 95.2381 }, + { 80.9524, 90.4762 }, + { 85.7143, 80.9524 }, + { 85.7143, 71.4286 }, + { 80.9524, 61.9048 }, + { 76.1905, 57.1429 }, + { 61.9047, 52.381 }, + { 19.0476, 52.381 }, +}; + +static const CoordRec char82_stroke2[] = { + { 52.3809, 52.381 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char82[] = { + { 2, char82_stroke0 }, + { 10, char82_stroke1 }, + { 2, char82_stroke2 }, +}; + +/* char: 83 'S' */ + +static const CoordRec char83_stroke0[] = { + { 85.7143, 85.7143 }, + { 76.1905, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, + { 28.5714, 95.2381 }, + { 19.0476, 85.7143 }, + { 19.0476, 76.1905 }, + { 23.8095, 66.6667 }, + { 28.5714, 61.9048 }, + { 38.0952, 57.1429 }, + { 66.6666, 47.619 }, + { 76.1905, 42.8571 }, + { 80.9524, 38.0952 }, + { 85.7143, 28.5714 }, + { 85.7143, 14.2857 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 19.0476, 14.2857 }, +}; + +static const StrokeRec char83[] = { + { 20, char83_stroke0 }, +}; + +/* char: 84 'T' */ + +static const CoordRec char84_stroke0[] = { + { 52.3809, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char84_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char84[] = { + { 2, char84_stroke0 }, + { 2, char84_stroke1 }, +}; + +/* char: 85 'U' */ + +static const CoordRec char85_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 28.5714 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 47.619, 0 }, + { 57.1428, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 28.5714 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char85[] = { + { 10, char85_stroke0 }, +}; + +/* char: 86 'V' */ + +static const CoordRec char86_stroke0[] = { + { 14.2857, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char86_stroke1[] = { + { 90.4762, 100 }, + { 52.3809, 0 }, +}; + +static const StrokeRec char86[] = { + { 2, char86_stroke0 }, + { 2, char86_stroke1 }, +}; + +/* char: 87 'W' */ + +static const CoordRec char87_stroke0[] = { + { 4.7619, 100 }, + { 28.5714, 0 }, +}; + +static const CoordRec char87_stroke1[] = { + { 52.3809, 100 }, + { 28.5714, 0 }, +}; + +static const CoordRec char87_stroke2[] = { + { 52.3809, 100 }, + { 76.1905, 0 }, +}; + +static const CoordRec char87_stroke3[] = { + { 100, 100 }, + { 76.1905, 0 }, +}; + +static const StrokeRec char87[] = { + { 2, char87_stroke0 }, + { 2, char87_stroke1 }, + { 2, char87_stroke2 }, + { 2, char87_stroke3 }, +}; + +/* char: 88 'X' */ + +static const CoordRec char88_stroke0[] = { + { 19.0476, 100 }, + { 85.7143, 0 }, +}; + +static const CoordRec char88_stroke1[] = { + { 85.7143, 100 }, + { 19.0476, 0 }, +}; + +static const StrokeRec char88[] = { + { 2, char88_stroke0 }, + { 2, char88_stroke1 }, +}; + +/* char: 89 'Y' */ + +static const CoordRec char89_stroke0[] = { + { 14.2857, 100 }, + { 52.3809, 52.381 }, + { 52.3809, 0 }, +}; + +static const CoordRec char89_stroke1[] = { + { 90.4762, 100 }, + { 52.3809, 52.381 }, +}; + +static const StrokeRec char89[] = { + { 3, char89_stroke0 }, + { 2, char89_stroke1 }, +}; + +/* char: 90 'Z' */ + +static const CoordRec char90_stroke0[] = { + { 85.7143, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char90_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 100 }, +}; + +static const CoordRec char90_stroke2[] = { + { 19.0476, 0 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char90[] = { + { 2, char90_stroke0 }, + { 2, char90_stroke1 }, + { 2, char90_stroke2 }, +}; + +/* char: 91 '[' */ + +static const CoordRec char91_stroke0[] = { + { 35.7143, 119.048 }, + { 35.7143, -33.3333 }, +}; + +static const CoordRec char91_stroke1[] = { + { 40.4762, 119.048 }, + { 40.4762, -33.3333 }, +}; + +static const CoordRec char91_stroke2[] = { + { 35.7143, 119.048 }, + { 69.0476, 119.048 }, +}; + +static const CoordRec char91_stroke3[] = { + { 35.7143, -33.3333 }, + { 69.0476, -33.3333 }, +}; + +static const StrokeRec char91[] = { + { 2, char91_stroke0 }, + { 2, char91_stroke1 }, + { 2, char91_stroke2 }, + { 2, char91_stroke3 }, +}; + +/* char: 92 '\' */ + +static const CoordRec char92_stroke0[] = { + { 19.0476, 100 }, + { 85.7143, -14.2857 }, +}; + +static const StrokeRec char92[] = { + { 2, char92_stroke0 }, +}; + +/* char: 93 ']' */ + +static const CoordRec char93_stroke0[] = { + { 64.2857, 119.048 }, + { 64.2857, -33.3333 }, +}; + +static const CoordRec char93_stroke1[] = { + { 69.0476, 119.048 }, + { 69.0476, -33.3333 }, +}; + +static const CoordRec char93_stroke2[] = { + { 35.7143, 119.048 }, + { 69.0476, 119.048 }, +}; + +static const CoordRec char93_stroke3[] = { + { 35.7143, -33.3333 }, + { 69.0476, -33.3333 }, +}; + +static const StrokeRec char93[] = { + { 2, char93_stroke0 }, + { 2, char93_stroke1 }, + { 2, char93_stroke2 }, + { 2, char93_stroke3 }, +}; + +/* char: 94 '^' */ + +static const CoordRec char94_stroke0[] = { + { 52.3809, 109.524 }, + { 14.2857, 42.8571 }, +}; + +static const CoordRec char94_stroke1[] = { + { 52.3809, 109.524 }, + { 90.4762, 42.8571 }, +}; + +static const StrokeRec char94[] = { + { 2, char94_stroke0 }, + { 2, char94_stroke1 }, +}; + +/* char: 95 '_' */ + +static const CoordRec char95_stroke0[] = { + { 0, -33.3333 }, + { 104.762, -33.3333 }, + { 104.762, -28.5714 }, + { 0, -28.5714 }, + { 0, -33.3333 }, +}; + +static const StrokeRec char95[] = { + { 5, char95_stroke0 }, +}; + +/* char: 96 '`' */ + +static const CoordRec char96_stroke0[] = { + { 42.8572, 100 }, + { 66.6667, 71.4286 }, +}; + +static const CoordRec char96_stroke1[] = { + { 42.8572, 100 }, + { 38.0953, 95.2381 }, + { 66.6667, 71.4286 }, +}; + +static const StrokeRec char96[] = { + { 2, char96_stroke0 }, + { 3, char96_stroke1 }, +}; + +/* char: 97 'a' */ + +static const CoordRec char97_stroke0[] = { + { 80.9524, 66.6667 }, + { 80.9524, 0 }, +}; + +static const CoordRec char97_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char97[] = { + { 2, char97_stroke0 }, + { 14, char97_stroke1 }, +}; + +/* char: 98 'b' */ + +static const CoordRec char98_stroke0[] = { + { 23.8095, 100 }, + { 23.8095, 0 }, +}; + +static const CoordRec char98_stroke1[] = { + { 23.8095, 52.381 }, + { 33.3333, 61.9048 }, + { 42.8571, 66.6667 }, + { 57.1428, 66.6667 }, + { 66.6666, 61.9048 }, + { 76.1905, 52.381 }, + { 80.9524, 38.0952 }, + { 80.9524, 28.5714 }, + { 76.1905, 14.2857 }, + { 66.6666, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 33.3333, 4.7619 }, + { 23.8095, 14.2857 }, +}; + +static const StrokeRec char98[] = { + { 2, char98_stroke0 }, + { 14, char98_stroke1 }, +}; + +/* char: 99 'c' */ + +static const CoordRec char99_stroke0[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char99[] = { + { 14, char99_stroke0 }, +}; + +/* char: 100 'd' */ + +static const CoordRec char100_stroke0[] = { + { 80.9524, 100 }, + { 80.9524, 0 }, +}; + +static const CoordRec char100_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char100[] = { + { 2, char100_stroke0 }, + { 14, char100_stroke1 }, +}; + +/* char: 101 'e' */ + +static const CoordRec char101_stroke0[] = { + { 23.8095, 38.0952 }, + { 80.9524, 38.0952 }, + { 80.9524, 47.619 }, + { 76.1905, 57.1429 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char101[] = { + { 17, char101_stroke0 }, +}; + +/* char: 102 'f' */ + +static const CoordRec char102_stroke0[] = { + { 71.4286, 100 }, + { 61.9048, 100 }, + { 52.381, 95.2381 }, + { 47.6191, 80.9524 }, + { 47.6191, 0 }, +}; + +static const CoordRec char102_stroke1[] = { + { 33.3334, 66.6667 }, + { 66.6667, 66.6667 }, +}; + +static const StrokeRec char102[] = { + { 5, char102_stroke0 }, + { 2, char102_stroke1 }, +}; + +/* char: 103 'g' */ + +static const CoordRec char103_stroke0[] = { + { 80.9524, 66.6667 }, + { 80.9524, -9.5238 }, + { 76.1905, -23.8095 }, + { 71.4285, -28.5714 }, + { 61.9047, -33.3333 }, + { 47.619, -33.3333 }, + { 38.0952, -28.5714 }, +}; + +static const CoordRec char103_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char103[] = { + { 7, char103_stroke0 }, + { 14, char103_stroke1 }, +}; + +/* char: 104 'h' */ + +static const CoordRec char104_stroke0[] = { + { 26.1905, 100 }, + { 26.1905, 0 }, +}; + +static const CoordRec char104_stroke1[] = { + { 26.1905, 47.619 }, + { 40.4762, 61.9048 }, + { 50, 66.6667 }, + { 64.2857, 66.6667 }, + { 73.8095, 61.9048 }, + { 78.5715, 47.619 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char104[] = { + { 2, char104_stroke0 }, + { 7, char104_stroke1 }, +}; + +/* char: 105 'i' */ + +static const CoordRec char105_stroke0[] = { + { 47.6191, 100 }, + { 52.381, 95.2381 }, + { 57.1429, 100 }, + { 52.381, 104.762 }, + { 47.6191, 100 }, +}; + +static const CoordRec char105_stroke1[] = { + { 52.381, 66.6667 }, + { 52.381, 0 }, +}; + +static const StrokeRec char105[] = { + { 5, char105_stroke0 }, + { 2, char105_stroke1 }, +}; + +/* char: 106 'j' */ + +static const CoordRec char106_stroke0[] = { + { 57.1429, 100 }, + { 61.9048, 95.2381 }, + { 66.6667, 100 }, + { 61.9048, 104.762 }, + { 57.1429, 100 }, +}; + +static const CoordRec char106_stroke1[] = { + { 61.9048, 66.6667 }, + { 61.9048, -14.2857 }, + { 57.1429, -28.5714 }, + { 47.6191, -33.3333 }, + { 38.0953, -33.3333 }, +}; + +static const StrokeRec char106[] = { + { 5, char106_stroke0 }, + { 5, char106_stroke1 }, +}; + +/* char: 107 'k' */ + +static const CoordRec char107_stroke0[] = { + { 26.1905, 100 }, + { 26.1905, 0 }, +}; + +static const CoordRec char107_stroke1[] = { + { 73.8095, 66.6667 }, + { 26.1905, 19.0476 }, +}; + +static const CoordRec char107_stroke2[] = { + { 45.2381, 38.0952 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char107[] = { + { 2, char107_stroke0 }, + { 2, char107_stroke1 }, + { 2, char107_stroke2 }, +}; + +/* char: 108 'l' */ + +static const CoordRec char108_stroke0[] = { + { 52.381, 100 }, + { 52.381, 0 }, +}; + +static const StrokeRec char108[] = { + { 2, char108_stroke0 }, +}; + +/* char: 109 'm' */ + +static const CoordRec char109_stroke0[] = { + { 0, 66.6667 }, + { 0, 0 }, +}; + +static const CoordRec char109_stroke1[] = { + { 0, 47.619 }, + { 14.2857, 61.9048 }, + { 23.8095, 66.6667 }, + { 38.0952, 66.6667 }, + { 47.619, 61.9048 }, + { 52.381, 47.619 }, + { 52.381, 0 }, +}; + +static const CoordRec char109_stroke2[] = { + { 52.381, 47.619 }, + { 66.6667, 61.9048 }, + { 76.1905, 66.6667 }, + { 90.4762, 66.6667 }, + { 100, 61.9048 }, + { 104.762, 47.619 }, + { 104.762, 0 }, +}; + +static const StrokeRec char109[] = { + { 2, char109_stroke0 }, + { 7, char109_stroke1 }, + { 7, char109_stroke2 }, +}; + +/* char: 110 'n' */ + +static const CoordRec char110_stroke0[] = { + { 26.1905, 66.6667 }, + { 26.1905, 0 }, +}; + +static const CoordRec char110_stroke1[] = { + { 26.1905, 47.619 }, + { 40.4762, 61.9048 }, + { 50, 66.6667 }, + { 64.2857, 66.6667 }, + { 73.8095, 61.9048 }, + { 78.5715, 47.619 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char110[] = { + { 2, char110_stroke0 }, + { 7, char110_stroke1 }, +}; + +/* char: 111 'o' */ + +static const CoordRec char111_stroke0[] = { + { 45.2381, 66.6667 }, + { 35.7143, 61.9048 }, + { 26.1905, 52.381 }, + { 21.4286, 38.0952 }, + { 21.4286, 28.5714 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 45.2381, 0 }, + { 59.5238, 0 }, + { 69.0476, 4.7619 }, + { 78.5714, 14.2857 }, + { 83.3334, 28.5714 }, + { 83.3334, 38.0952 }, + { 78.5714, 52.381 }, + { 69.0476, 61.9048 }, + { 59.5238, 66.6667 }, + { 45.2381, 66.6667 }, +}; + +static const StrokeRec char111[] = { + { 17, char111_stroke0 }, +}; + +/* char: 112 'p' */ + +static const CoordRec char112_stroke0[] = { + { 23.8095, 66.6667 }, + { 23.8095, -33.3333 }, +}; + +static const CoordRec char112_stroke1[] = { + { 23.8095, 52.381 }, + { 33.3333, 61.9048 }, + { 42.8571, 66.6667 }, + { 57.1428, 66.6667 }, + { 66.6666, 61.9048 }, + { 76.1905, 52.381 }, + { 80.9524, 38.0952 }, + { 80.9524, 28.5714 }, + { 76.1905, 14.2857 }, + { 66.6666, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 33.3333, 4.7619 }, + { 23.8095, 14.2857 }, +}; + +static const StrokeRec char112[] = { + { 2, char112_stroke0 }, + { 14, char112_stroke1 }, +}; + +/* char: 113 'q' */ + +static const CoordRec char113_stroke0[] = { + { 80.9524, 66.6667 }, + { 80.9524, -33.3333 }, +}; + +static const CoordRec char113_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char113[] = { + { 2, char113_stroke0 }, + { 14, char113_stroke1 }, +}; + +/* char: 114 'r' */ + +static const CoordRec char114_stroke0[] = { + { 33.3334, 66.6667 }, + { 33.3334, 0 }, +}; + +static const CoordRec char114_stroke1[] = { + { 33.3334, 38.0952 }, + { 38.0953, 52.381 }, + { 47.6191, 61.9048 }, + { 57.1429, 66.6667 }, + { 71.4286, 66.6667 }, +}; + +static const StrokeRec char114[] = { + { 2, char114_stroke0 }, + { 5, char114_stroke1 }, +}; + +/* char: 115 's' */ + +static const CoordRec char115_stroke0[] = { + { 78.5715, 52.381 }, + { 73.8095, 61.9048 }, + { 59.5238, 66.6667 }, + { 45.2381, 66.6667 }, + { 30.9524, 61.9048 }, + { 26.1905, 52.381 }, + { 30.9524, 42.8571 }, + { 40.4762, 38.0952 }, + { 64.2857, 33.3333 }, + { 73.8095, 28.5714 }, + { 78.5715, 19.0476 }, + { 78.5715, 14.2857 }, + { 73.8095, 4.7619 }, + { 59.5238, 0 }, + { 45.2381, 0 }, + { 30.9524, 4.7619 }, + { 26.1905, 14.2857 }, +}; + +static const StrokeRec char115[] = { + { 17, char115_stroke0 }, +}; + +/* char: 116 't' */ + +static const CoordRec char116_stroke0[] = { + { 47.6191, 100 }, + { 47.6191, 19.0476 }, + { 52.381, 4.7619 }, + { 61.9048, 0 }, + { 71.4286, 0 }, +}; + +static const CoordRec char116_stroke1[] = { + { 33.3334, 66.6667 }, + { 66.6667, 66.6667 }, +}; + +static const StrokeRec char116[] = { + { 5, char116_stroke0 }, + { 2, char116_stroke1 }, +}; + +/* char: 117 'u' */ + +static const CoordRec char117_stroke0[] = { + { 26.1905, 66.6667 }, + { 26.1905, 19.0476 }, + { 30.9524, 4.7619 }, + { 40.4762, 0 }, + { 54.7619, 0 }, + { 64.2857, 4.7619 }, + { 78.5715, 19.0476 }, +}; + +static const CoordRec char117_stroke1[] = { + { 78.5715, 66.6667 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char117[] = { + { 7, char117_stroke0 }, + { 2, char117_stroke1 }, +}; + +/* char: 118 'v' */ + +static const CoordRec char118_stroke0[] = { + { 23.8095, 66.6667 }, + { 52.3809, 0 }, +}; + +static const CoordRec char118_stroke1[] = { + { 80.9524, 66.6667 }, + { 52.3809, 0 }, +}; + +static const StrokeRec char118[] = { + { 2, char118_stroke0 }, + { 2, char118_stroke1 }, +}; + +/* char: 119 'w' */ + +static const CoordRec char119_stroke0[] = { + { 14.2857, 66.6667 }, + { 33.3333, 0 }, +}; + +static const CoordRec char119_stroke1[] = { + { 52.3809, 66.6667 }, + { 33.3333, 0 }, +}; + +static const CoordRec char119_stroke2[] = { + { 52.3809, 66.6667 }, + { 71.4286, 0 }, +}; + +static const CoordRec char119_stroke3[] = { + { 90.4762, 66.6667 }, + { 71.4286, 0 }, +}; + +static const StrokeRec char119[] = { + { 2, char119_stroke0 }, + { 2, char119_stroke1 }, + { 2, char119_stroke2 }, + { 2, char119_stroke3 }, +}; + +/* char: 120 'x' */ + +static const CoordRec char120_stroke0[] = { + { 26.1905, 66.6667 }, + { 78.5715, 0 }, +}; + +static const CoordRec char120_stroke1[] = { + { 78.5715, 66.6667 }, + { 26.1905, 0 }, +}; + +static const StrokeRec char120[] = { + { 2, char120_stroke0 }, + { 2, char120_stroke1 }, +}; + +/* char: 121 'y' */ + +static const CoordRec char121_stroke0[] = { + { 26.1905, 66.6667 }, + { 54.7619, 0 }, +}; + +static const CoordRec char121_stroke1[] = { + { 83.3334, 66.6667 }, + { 54.7619, 0 }, + { 45.2381, -19.0476 }, + { 35.7143, -28.5714 }, + { 26.1905, -33.3333 }, + { 21.4286, -33.3333 }, +}; + +static const StrokeRec char121[] = { + { 2, char121_stroke0 }, + { 6, char121_stroke1 }, +}; + +/* char: 122 'z' */ + +static const CoordRec char122_stroke0[] = { + { 78.5715, 66.6667 }, + { 26.1905, 0 }, +}; + +static const CoordRec char122_stroke1[] = { + { 26.1905, 66.6667 }, + { 78.5715, 66.6667 }, +}; + +static const CoordRec char122_stroke2[] = { + { 26.1905, 0 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char122[] = { + { 2, char122_stroke0 }, + { 2, char122_stroke1 }, + { 2, char122_stroke2 }, +}; + +/* char: 123 '{' */ + +static const CoordRec char123_stroke0[] = { + { 64.2857, 119.048 }, + { 54.7619, 114.286 }, + { 50, 109.524 }, + { 45.2381, 100 }, + { 45.2381, 90.4762 }, + { 50, 80.9524 }, + { 54.7619, 76.1905 }, + { 59.5238, 66.6667 }, + { 59.5238, 57.1429 }, + { 50, 47.619 }, +}; + +static const CoordRec char123_stroke1[] = { + { 54.7619, 114.286 }, + { 50, 104.762 }, + { 50, 95.2381 }, + { 54.7619, 85.7143 }, + { 59.5238, 80.9524 }, + { 64.2857, 71.4286 }, + { 64.2857, 61.9048 }, + { 59.5238, 52.381 }, + { 40.4762, 42.8571 }, + { 59.5238, 33.3333 }, + { 64.2857, 23.8095 }, + { 64.2857, 14.2857 }, + { 59.5238, 4.7619 }, + { 54.7619, 0 }, + { 50, -9.5238 }, + { 50, -19.0476 }, + { 54.7619, -28.5714 }, +}; + +static const CoordRec char123_stroke2[] = { + { 50, 38.0952 }, + { 59.5238, 28.5714 }, + { 59.5238, 19.0476 }, + { 54.7619, 9.5238 }, + { 50, 4.7619 }, + { 45.2381, -4.7619 }, + { 45.2381, -14.2857 }, + { 50, -23.8095 }, + { 54.7619, -28.5714 }, + { 64.2857, -33.3333 }, +}; + +static const StrokeRec char123[] = { + { 10, char123_stroke0 }, + { 17, char123_stroke1 }, + { 10, char123_stroke2 }, +}; + +/* char: 124 '|' */ + +static const CoordRec char124_stroke0[] = { + { 52.381, 119.048 }, + { 52.381, -33.3333 }, +}; + +static const StrokeRec char124[] = { + { 2, char124_stroke0 }, +}; + +/* char: 125 '}' */ + +static const CoordRec char125_stroke0[] = { + { 40.4762, 119.048 }, + { 50, 114.286 }, + { 54.7619, 109.524 }, + { 59.5238, 100 }, + { 59.5238, 90.4762 }, + { 54.7619, 80.9524 }, + { 50, 76.1905 }, + { 45.2381, 66.6667 }, + { 45.2381, 57.1429 }, + { 54.7619, 47.619 }, +}; + +static const CoordRec char125_stroke1[] = { + { 50, 114.286 }, + { 54.7619, 104.762 }, + { 54.7619, 95.2381 }, + { 50, 85.7143 }, + { 45.2381, 80.9524 }, + { 40.4762, 71.4286 }, + { 40.4762, 61.9048 }, + { 45.2381, 52.381 }, + { 64.2857, 42.8571 }, + { 45.2381, 33.3333 }, + { 40.4762, 23.8095 }, + { 40.4762, 14.2857 }, + { 45.2381, 4.7619 }, + { 50, 0 }, + { 54.7619, -9.5238 }, + { 54.7619, -19.0476 }, + { 50, -28.5714 }, +}; + +static const CoordRec char125_stroke2[] = { + { 54.7619, 38.0952 }, + { 45.2381, 28.5714 }, + { 45.2381, 19.0476 }, + { 50, 9.5238 }, + { 54.7619, 4.7619 }, + { 59.5238, -4.7619 }, + { 59.5238, -14.2857 }, + { 54.7619, -23.8095 }, + { 50, -28.5714 }, + { 40.4762, -33.3333 }, +}; + +static const StrokeRec char125[] = { + { 10, char125_stroke0 }, + { 17, char125_stroke1 }, + { 10, char125_stroke2 }, +}; + +/* char: 126 '~' */ + +static const CoordRec char126_stroke0[] = { + { 9.5238, 28.5714 }, + { 9.5238, 38.0952 }, + { 14.2857, 52.381 }, + { 23.8095, 57.1429 }, + { 33.3333, 57.1429 }, + { 42.8571, 52.381 }, + { 61.9048, 38.0952 }, + { 71.4286, 33.3333 }, + { 80.9524, 33.3333 }, + { 90.4762, 38.0952 }, + { 95.2381, 47.619 }, +}; + +static const CoordRec char126_stroke1[] = { + { 9.5238, 38.0952 }, + { 14.2857, 47.619 }, + { 23.8095, 52.381 }, + { 33.3333, 52.381 }, + { 42.8571, 47.619 }, + { 61.9048, 33.3333 }, + { 71.4286, 28.5714 }, + { 80.9524, 28.5714 }, + { 90.4762, 33.3333 }, + { 95.2381, 47.619 }, + { 95.2381, 57.1429 }, +}; + +static const StrokeRec char126[] = { + { 11, char126_stroke0 }, + { 11, char126_stroke1 }, +}; + +/* char: 127 */ + +static const CoordRec char127_stroke0[] = { + { 71.4286, 100 }, + { 33.3333, -33.3333 }, +}; + +static const CoordRec char127_stroke1[] = { + { 47.619, 66.6667 }, + { 33.3333, 61.9048 }, + { 23.8095, 52.381 }, + { 19.0476, 38.0952 }, + { 19.0476, 23.8095 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 47.619, 0 }, + { 57.1428, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 28.5714 }, + { 85.7143, 42.8571 }, + { 80.9524, 52.381 }, + { 71.4286, 61.9048 }, + { 57.1428, 66.6667 }, + { 47.619, 66.6667 }, +}; + +static const StrokeRec char127[] = { + { 2, char127_stroke0 }, + { 17, char127_stroke1 }, +}; + +static const StrokeCharRec chars[] = { + { 0, /* char0 */ 0, 0, 0 }, + { 0, /* char1 */ 0, 0, 0 }, + { 0, /* char2 */ 0, 0, 0 }, + { 0, /* char3 */ 0, 0, 0 }, + { 0, /* char4 */ 0, 0, 0 }, + { 0, /* char5 */ 0, 0, 0 }, + { 0, /* char6 */ 0, 0, 0 }, + { 0, /* char7 */ 0, 0, 0 }, + { 0, /* char8 */ 0, 0, 0 }, + { 0, /* char9 */ 0, 0, 0 }, + { 0, /* char10 */ 0, 0, 0 }, + { 0, /* char11 */ 0, 0, 0 }, + { 0, /* char12 */ 0, 0, 0 }, + { 0, /* char13 */ 0, 0, 0 }, + { 0, /* char14 */ 0, 0, 0 }, + { 0, /* char15 */ 0, 0, 0 }, + { 0, /* char16 */ 0, 0, 0 }, + { 0, /* char17 */ 0, 0, 0 }, + { 0, /* char18 */ 0, 0, 0 }, + { 0, /* char19 */ 0, 0, 0 }, + { 0, /* char20 */ 0, 0, 0 }, + { 0, /* char21 */ 0, 0, 0 }, + { 0, /* char22 */ 0, 0, 0 }, + { 0, /* char23 */ 0, 0, 0 }, + { 0, /* char24 */ 0, 0, 0 }, + { 0, /* char25 */ 0, 0, 0 }, + { 0, /* char26 */ 0, 0, 0 }, + { 0, /* char27 */ 0, 0, 0 }, + { 0, /* char28 */ 0, 0, 0 }, + { 0, /* char29 */ 0, 0, 0 }, + { 0, /* char30 */ 0, 0, 0 }, + { 0, /* char31 */ 0, 0, 0 }, + { 0, /* char32 */ 0, 52.381, 104.762 }, + { 2, char33, 52.381, 104.762 }, + { 2, char34, 52.381, 104.762 }, + { 4, char35, 52.381, 104.762 }, + { 3, char36, 52.381, 104.762 }, + { 3, char37, 52.381, 104.762 }, + { 1, char38, 52.381, 104.762 }, + { 1, char39, 52.381, 104.762 }, + { 1, char40, 52.381, 104.762 }, + { 1, char41, 52.381, 104.762 }, + { 3, char42, 52.381, 104.762 }, + { 2, char43, 52.381, 104.762 }, + { 1, char44, 52.381, 104.762 }, + { 1, char45, 52.381, 104.762 }, + { 1, char46, 52.381, 104.762 }, + { 1, char47, 52.381, 104.762 }, + { 1, char48, 52.381, 104.762 }, + { 1, char49, 52.381, 104.762 }, + { 1, char50, 52.381, 104.762 }, + { 1, char51, 52.381, 104.762 }, + { 2, char52, 52.381, 104.762 }, + { 1, char53, 52.381, 104.762 }, + { 1, char54, 52.381, 104.762 }, + { 2, char55, 52.381, 104.762 }, + { 1, char56, 52.381, 104.762 }, + { 1, char57, 52.381, 104.762 }, + { 2, char58, 52.381, 104.762 }, + { 2, char59, 52.381, 104.762 }, + { 1, char60, 52.381, 104.762 }, + { 2, char61, 52.381, 104.762 }, + { 1, char62, 52.381, 104.762 }, + { 2, char63, 52.381, 104.762 }, + { 2, char64, 52.381, 104.762 }, + { 3, char65, 52.381, 104.762 }, + { 3, char66, 52.381, 104.762 }, + { 1, char67, 52.381, 104.762 }, + { 2, char68, 52.381, 104.762 }, + { 4, char69, 52.381, 104.762 }, + { 3, char70, 52.381, 104.762 }, + { 2, char71, 52.381, 104.762 }, + { 3, char72, 52.381, 104.762 }, + { 1, char73, 52.381, 104.762 }, + { 1, char74, 52.381, 104.762 }, + { 3, char75, 52.381, 104.762 }, + { 2, char76, 52.381, 104.762 }, + { 4, char77, 52.381, 104.762 }, + { 3, char78, 52.381, 104.762 }, + { 1, char79, 52.381, 104.762 }, + { 2, char80, 52.381, 104.762 }, + { 2, char81, 52.381, 104.762 }, + { 3, char82, 52.381, 104.762 }, + { 1, char83, 52.381, 104.762 }, + { 2, char84, 52.381, 104.762 }, + { 1, char85, 52.381, 104.762 }, + { 2, char86, 52.381, 104.762 }, + { 4, char87, 52.381, 104.762 }, + { 2, char88, 52.381, 104.762 }, + { 2, char89, 52.381, 104.762 }, + { 3, char90, 52.381, 104.762 }, + { 4, char91, 52.381, 104.762 }, + { 1, char92, 52.381, 104.762 }, + { 4, char93, 52.381, 104.762 }, + { 2, char94, 52.381, 104.762 }, + { 1, char95, 52.381, 104.762 }, + { 2, char96, 52.381, 104.762 }, + { 2, char97, 52.381, 104.762 }, + { 2, char98, 52.381, 104.762 }, + { 1, char99, 52.381, 104.762 }, + { 2, char100, 52.381, 104.762 }, + { 1, char101, 52.381, 104.762 }, + { 2, char102, 52.381, 104.762 }, + { 2, char103, 52.381, 104.762 }, + { 2, char104, 52.381, 104.762 }, + { 2, char105, 52.381, 104.762 }, + { 2, char106, 52.381, 104.762 }, + { 3, char107, 52.381, 104.762 }, + { 1, char108, 52.381, 104.762 }, + { 3, char109, 52.381, 104.762 }, + { 2, char110, 52.381, 104.762 }, + { 1, char111, 52.381, 104.762 }, + { 2, char112, 52.381, 104.762 }, + { 2, char113, 52.381, 104.762 }, + { 2, char114, 52.381, 104.762 }, + { 1, char115, 52.381, 104.762 }, + { 2, char116, 52.381, 104.762 }, + { 2, char117, 52.381, 104.762 }, + { 2, char118, 52.381, 104.762 }, + { 4, char119, 52.381, 104.762 }, + { 2, char120, 52.381, 104.762 }, + { 2, char121, 52.381, 104.762 }, + { 3, char122, 52.381, 104.762 }, + { 3, char123, 52.381, 104.762 }, + { 1, char124, 52.381, 104.762 }, + { 3, char125, 52.381, 104.762 }, + { 2, char126, 52.381, 104.762 }, + { 2, char127, 52.381, 104.762 }, +}; + +StrokeFontRec glutStrokeMonoRoman = { "Roman", 128, chars, 119.048, -33.3333 }; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_roman.cpp b/xc/extras/Mesa/src-glut.beos/glut_roman.cpp new file mode 100644 index 000000000..af2b4ec95 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_roman.cpp @@ -0,0 +1,2451 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutstroke.h" + +/* char: 33 '!' */ + +static const CoordRec char33_stroke0[] = { + { 13.3819, 100 }, + { 13.3819, 33.3333 }, +}; + +static const CoordRec char33_stroke1[] = { + { 13.3819, 9.5238 }, + { 8.62, 4.7619 }, + { 13.3819, 0 }, + { 18.1438, 4.7619 }, + { 13.3819, 9.5238 }, +}; + +static const StrokeRec char33[] = { + { 2, char33_stroke0 }, + { 5, char33_stroke1 }, +}; + +/* char: 34 '"' */ + +static const CoordRec char34_stroke0[] = { + { 4.02, 100 }, + { 4.02, 66.6667 }, +}; + +static const CoordRec char34_stroke1[] = { + { 42.1152, 100 }, + { 42.1152, 66.6667 }, +}; + +static const StrokeRec char34[] = { + { 2, char34_stroke0 }, + { 2, char34_stroke1 }, +}; + +/* char: 35 '#' */ + +static const CoordRec char35_stroke0[] = { + { 41.2952, 119.048 }, + { 7.9619, -33.3333 }, +}; + +static const CoordRec char35_stroke1[] = { + { 69.8667, 119.048 }, + { 36.5333, -33.3333 }, +}; + +static const CoordRec char35_stroke2[] = { + { 7.9619, 57.1429 }, + { 74.6286, 57.1429 }, +}; + +static const CoordRec char35_stroke3[] = { + { 3.2, 28.5714 }, + { 69.8667, 28.5714 }, +}; + +static const StrokeRec char35[] = { + { 2, char35_stroke0 }, + { 2, char35_stroke1 }, + { 2, char35_stroke2 }, + { 2, char35_stroke3 }, +}; + +/* char: 36 '$' */ + +static const CoordRec char36_stroke0[] = { + { 28.6295, 119.048 }, + { 28.6295, -19.0476 }, +}; + +static const CoordRec char36_stroke1[] = { + { 47.6771, 119.048 }, + { 47.6771, -19.0476 }, +}; + +static const CoordRec char36_stroke2[] = { + { 71.4867, 85.7143 }, + { 61.9629, 95.2381 }, + { 47.6771, 100 }, + { 28.6295, 100 }, + { 14.3438, 95.2381 }, + { 4.82, 85.7143 }, + { 4.82, 76.1905 }, + { 9.5819, 66.6667 }, + { 14.3438, 61.9048 }, + { 23.8676, 57.1429 }, + { 52.439, 47.619 }, + { 61.9629, 42.8571 }, + { 66.7248, 38.0952 }, + { 71.4867, 28.5714 }, + { 71.4867, 14.2857 }, + { 61.9629, 4.7619 }, + { 47.6771, 0 }, + { 28.6295, 0 }, + { 14.3438, 4.7619 }, + { 4.82, 14.2857 }, +}; + +static const StrokeRec char36[] = { + { 2, char36_stroke0 }, + { 2, char36_stroke1 }, + { 20, char36_stroke2 }, +}; + +/* char: 37 '%' */ + +static const CoordRec char37_stroke0[] = { + { 92.0743, 100 }, + { 6.36, 0 }, +}; + +static const CoordRec char37_stroke1[] = { + { 30.1695, 100 }, + { 39.6933, 90.4762 }, + { 39.6933, 80.9524 }, + { 34.9314, 71.4286 }, + { 25.4076, 66.6667 }, + { 15.8838, 66.6667 }, + { 6.36, 76.1905 }, + { 6.36, 85.7143 }, + { 11.1219, 95.2381 }, + { 20.6457, 100 }, + { 30.1695, 100 }, + { 39.6933, 95.2381 }, + { 53.979, 90.4762 }, + { 68.2648, 90.4762 }, + { 82.5505, 95.2381 }, + { 92.0743, 100 }, +}; + +static const CoordRec char37_stroke2[] = { + { 73.0267, 33.3333 }, + { 63.5029, 28.5714 }, + { 58.741, 19.0476 }, + { 58.741, 9.5238 }, + { 68.2648, 0 }, + { 77.7886, 0 }, + { 87.3124, 4.7619 }, + { 92.0743, 14.2857 }, + { 92.0743, 23.8095 }, + { 82.5505, 33.3333 }, + { 73.0267, 33.3333 }, +}; + +static const StrokeRec char37[] = { + { 2, char37_stroke0 }, + { 16, char37_stroke1 }, + { 11, char37_stroke2 }, +}; + +/* char: 38 '&' */ + +static const CoordRec char38_stroke0[] = { + { 101.218, 57.1429 }, + { 101.218, 61.9048 }, + { 96.4562, 66.6667 }, + { 91.6943, 66.6667 }, + { 86.9324, 61.9048 }, + { 82.1705, 52.381 }, + { 72.6467, 28.5714 }, + { 63.1229, 14.2857 }, + { 53.599, 4.7619 }, + { 44.0752, 0 }, + { 25.0276, 0 }, + { 15.5038, 4.7619 }, + { 10.7419, 9.5238 }, + { 5.98, 19.0476 }, + { 5.98, 28.5714 }, + { 10.7419, 38.0952 }, + { 15.5038, 42.8571 }, + { 48.8371, 61.9048 }, + { 53.599, 66.6667 }, + { 58.361, 76.1905 }, + { 58.361, 85.7143 }, + { 53.599, 95.2381 }, + { 44.0752, 100 }, + { 34.5514, 95.2381 }, + { 29.7895, 85.7143 }, + { 29.7895, 76.1905 }, + { 34.5514, 61.9048 }, + { 44.0752, 47.619 }, + { 67.8848, 14.2857 }, + { 77.4086, 4.7619 }, + { 86.9324, 0 }, + { 96.4562, 0 }, + { 101.218, 4.7619 }, + { 101.218, 9.5238 }, +}; + +static const StrokeRec char38[] = { + { 34, char38_stroke0 }, +}; + +/* char: 39 ''' */ + +static const CoordRec char39_stroke0[] = { + { 4.44, 100 }, + { 4.44, 66.6667 }, +}; + +static const StrokeRec char39[] = { + { 2, char39_stroke0 }, +}; + +/* char: 40 '(' */ + +static const CoordRec char40_stroke0[] = { + { 40.9133, 119.048 }, + { 31.3895, 109.524 }, + { 21.8657, 95.2381 }, + { 12.3419, 76.1905 }, + { 7.58, 52.381 }, + { 7.58, 33.3333 }, + { 12.3419, 9.5238 }, + { 21.8657, -9.5238 }, + { 31.3895, -23.8095 }, + { 40.9133, -33.3333 }, +}; + +static const StrokeRec char40[] = { + { 10, char40_stroke0 }, +}; + +/* char: 41 ')' */ + +static const CoordRec char41_stroke0[] = { + { 5.28, 119.048 }, + { 14.8038, 109.524 }, + { 24.3276, 95.2381 }, + { 33.8514, 76.1905 }, + { 38.6133, 52.381 }, + { 38.6133, 33.3333 }, + { 33.8514, 9.5238 }, + { 24.3276, -9.5238 }, + { 14.8038, -23.8095 }, + { 5.28, -33.3333 }, +}; + +static const StrokeRec char41[] = { + { 10, char41_stroke0 }, +}; + +/* char: 42 '*' */ + +static const CoordRec char42_stroke0[] = { + { 30.7695, 71.4286 }, + { 30.7695, 14.2857 }, +}; + +static const CoordRec char42_stroke1[] = { + { 6.96, 57.1429 }, + { 54.579, 28.5714 }, +}; + +static const CoordRec char42_stroke2[] = { + { 54.579, 57.1429 }, + { 6.96, 28.5714 }, +}; + +static const StrokeRec char42[] = { + { 2, char42_stroke0 }, + { 2, char42_stroke1 }, + { 2, char42_stroke2 }, +}; + +/* char: 43 '+' */ + +static const CoordRec char43_stroke0[] = { + { 48.8371, 85.7143 }, + { 48.8371, 0 }, +}; + +static const CoordRec char43_stroke1[] = { + { 5.98, 42.8571 }, + { 91.6943, 42.8571 }, +}; + +static const StrokeRec char43[] = { + { 2, char43_stroke0 }, + { 2, char43_stroke1 }, +}; + +/* char: 44 ',' */ + +static const CoordRec char44_stroke0[] = { + { 18.2838, 4.7619 }, + { 13.5219, 0 }, + { 8.76, 4.7619 }, + { 13.5219, 9.5238 }, + { 18.2838, 4.7619 }, + { 18.2838, -4.7619 }, + { 13.5219, -14.2857 }, + { 8.76, -19.0476 }, +}; + +static const StrokeRec char44[] = { + { 8, char44_stroke0 }, +}; + +/* char: 45 '-' */ + +static const CoordRec char45_stroke0[] = { + { 7.38, 42.8571 }, + { 93.0943, 42.8571 }, +}; + +static const StrokeRec char45[] = { + { 2, char45_stroke0 }, +}; + +/* char: 46 '.' */ + +static const CoordRec char46_stroke0[] = { + { 13.1019, 9.5238 }, + { 8.34, 4.7619 }, + { 13.1019, 0 }, + { 17.8638, 4.7619 }, + { 13.1019, 9.5238 }, +}; + +static const StrokeRec char46[] = { + { 5, char46_stroke0 }, +}; + +/* char: 47 '/' */ + +static const CoordRec char47_stroke0[] = { + { 7.24, -14.2857 }, + { 73.9067, 100 }, +}; + +static const StrokeRec char47[] = { + { 2, char47_stroke0 }, +}; + +/* char: 48 '0' */ + +static const CoordRec char48_stroke0[] = { + { 33.5514, 100 }, + { 19.2657, 95.2381 }, + { 9.7419, 80.9524 }, + { 4.98, 57.1429 }, + { 4.98, 42.8571 }, + { 9.7419, 19.0476 }, + { 19.2657, 4.7619 }, + { 33.5514, 0 }, + { 43.0752, 0 }, + { 57.361, 4.7619 }, + { 66.8848, 19.0476 }, + { 71.6467, 42.8571 }, + { 71.6467, 57.1429 }, + { 66.8848, 80.9524 }, + { 57.361, 95.2381 }, + { 43.0752, 100 }, + { 33.5514, 100 }, +}; + +static const StrokeRec char48[] = { + { 17, char48_stroke0 }, +}; + +/* char: 49 '1' */ + +static const CoordRec char49_stroke0[] = { + { 11.82, 80.9524 }, + { 21.3438, 85.7143 }, + { 35.6295, 100 }, + { 35.6295, 0 }, +}; + +static const StrokeRec char49[] = { + { 4, char49_stroke0 }, +}; + +/* char: 50 '2' */ + +static const CoordRec char50_stroke0[] = { + { 10.1819, 76.1905 }, + { 10.1819, 80.9524 }, + { 14.9438, 90.4762 }, + { 19.7057, 95.2381 }, + { 29.2295, 100 }, + { 48.2771, 100 }, + { 57.801, 95.2381 }, + { 62.5629, 90.4762 }, + { 67.3248, 80.9524 }, + { 67.3248, 71.4286 }, + { 62.5629, 61.9048 }, + { 53.039, 47.619 }, + { 5.42, 0 }, + { 72.0867, 0 }, +}; + +static const StrokeRec char50[] = { + { 14, char50_stroke0 }, +}; + +/* char: 51 '3' */ + +static const CoordRec char51_stroke0[] = { + { 14.5238, 100 }, + { 66.9048, 100 }, + { 38.3333, 61.9048 }, + { 52.619, 61.9048 }, + { 62.1429, 57.1429 }, + { 66.9048, 52.381 }, + { 71.6667, 38.0952 }, + { 71.6667, 28.5714 }, + { 66.9048, 14.2857 }, + { 57.381, 4.7619 }, + { 43.0952, 0 }, + { 28.8095, 0 }, + { 14.5238, 4.7619 }, + { 9.7619, 9.5238 }, + { 5, 19.0476 }, +}; + +static const StrokeRec char51[] = { + { 15, char51_stroke0 }, +}; + +/* char: 52 '4' */ + +static const CoordRec char52_stroke0[] = { + { 51.499, 100 }, + { 3.88, 33.3333 }, + { 75.3086, 33.3333 }, +}; + +static const CoordRec char52_stroke1[] = { + { 51.499, 100 }, + { 51.499, 0 }, +}; + +static const StrokeRec char52[] = { + { 3, char52_stroke0 }, + { 2, char52_stroke1 }, +}; + +/* char: 53 '5' */ + +static const CoordRec char53_stroke0[] = { + { 62.0029, 100 }, + { 14.3838, 100 }, + { 9.6219, 57.1429 }, + { 14.3838, 61.9048 }, + { 28.6695, 66.6667 }, + { 42.9552, 66.6667 }, + { 57.241, 61.9048 }, + { 66.7648, 52.381 }, + { 71.5267, 38.0952 }, + { 71.5267, 28.5714 }, + { 66.7648, 14.2857 }, + { 57.241, 4.7619 }, + { 42.9552, 0 }, + { 28.6695, 0 }, + { 14.3838, 4.7619 }, + { 9.6219, 9.5238 }, + { 4.86, 19.0476 }, +}; + +static const StrokeRec char53[] = { + { 17, char53_stroke0 }, +}; + +/* char: 54 '6' */ + +static const CoordRec char54_stroke0[] = { + { 62.7229, 85.7143 }, + { 57.961, 95.2381 }, + { 43.6752, 100 }, + { 34.1514, 100 }, + { 19.8657, 95.2381 }, + { 10.3419, 80.9524 }, + { 5.58, 57.1429 }, + { 5.58, 33.3333 }, + { 10.3419, 14.2857 }, + { 19.8657, 4.7619 }, + { 34.1514, 0 }, + { 38.9133, 0 }, + { 53.199, 4.7619 }, + { 62.7229, 14.2857 }, + { 67.4848, 28.5714 }, + { 67.4848, 33.3333 }, + { 62.7229, 47.619 }, + { 53.199, 57.1429 }, + { 38.9133, 61.9048 }, + { 34.1514, 61.9048 }, + { 19.8657, 57.1429 }, + { 10.3419, 47.619 }, + { 5.58, 33.3333 }, +}; + +static const StrokeRec char54[] = { + { 23, char54_stroke0 }, +}; + +/* char: 55 '7' */ + +static const CoordRec char55_stroke0[] = { + { 72.2267, 100 }, + { 24.6076, 0 }, +}; + +static const CoordRec char55_stroke1[] = { + { 5.56, 100 }, + { 72.2267, 100 }, +}; + +static const StrokeRec char55[] = { + { 2, char55_stroke0 }, + { 2, char55_stroke1 }, +}; + +/* char: 56 '8' */ + +static const CoordRec char56_stroke0[] = { + { 29.4095, 100 }, + { 15.1238, 95.2381 }, + { 10.3619, 85.7143 }, + { 10.3619, 76.1905 }, + { 15.1238, 66.6667 }, + { 24.6476, 61.9048 }, + { 43.6952, 57.1429 }, + { 57.981, 52.381 }, + { 67.5048, 42.8571 }, + { 72.2667, 33.3333 }, + { 72.2667, 19.0476 }, + { 67.5048, 9.5238 }, + { 62.7429, 4.7619 }, + { 48.4571, 0 }, + { 29.4095, 0 }, + { 15.1238, 4.7619 }, + { 10.3619, 9.5238 }, + { 5.6, 19.0476 }, + { 5.6, 33.3333 }, + { 10.3619, 42.8571 }, + { 19.8857, 52.381 }, + { 34.1714, 57.1429 }, + { 53.219, 61.9048 }, + { 62.7429, 66.6667 }, + { 67.5048, 76.1905 }, + { 67.5048, 85.7143 }, + { 62.7429, 95.2381 }, + { 48.4571, 100 }, + { 29.4095, 100 }, +}; + +static const StrokeRec char56[] = { + { 29, char56_stroke0 }, +}; + +/* char: 57 '9' */ + +static const CoordRec char57_stroke0[] = { + { 68.5048, 66.6667 }, + { 63.7429, 52.381 }, + { 54.219, 42.8571 }, + { 39.9333, 38.0952 }, + { 35.1714, 38.0952 }, + { 20.8857, 42.8571 }, + { 11.3619, 52.381 }, + { 6.6, 66.6667 }, + { 6.6, 71.4286 }, + { 11.3619, 85.7143 }, + { 20.8857, 95.2381 }, + { 35.1714, 100 }, + { 39.9333, 100 }, + { 54.219, 95.2381 }, + { 63.7429, 85.7143 }, + { 68.5048, 66.6667 }, + { 68.5048, 42.8571 }, + { 63.7429, 19.0476 }, + { 54.219, 4.7619 }, + { 39.9333, 0 }, + { 30.4095, 0 }, + { 16.1238, 4.7619 }, + { 11.3619, 14.2857 }, +}; + +static const StrokeRec char57[] = { + { 23, char57_stroke0 }, +}; + +/* char: 58 ':' */ + +static const CoordRec char58_stroke0[] = { + { 14.0819, 66.6667 }, + { 9.32, 61.9048 }, + { 14.0819, 57.1429 }, + { 18.8438, 61.9048 }, + { 14.0819, 66.6667 }, +}; + +static const CoordRec char58_stroke1[] = { + { 14.0819, 9.5238 }, + { 9.32, 4.7619 }, + { 14.0819, 0 }, + { 18.8438, 4.7619 }, + { 14.0819, 9.5238 }, +}; + +static const StrokeRec char58[] = { + { 5, char58_stroke0 }, + { 5, char58_stroke1 }, +}; + +/* char: 59 ';' */ + +static const CoordRec char59_stroke0[] = { + { 12.9619, 66.6667 }, + { 8.2, 61.9048 }, + { 12.9619, 57.1429 }, + { 17.7238, 61.9048 }, + { 12.9619, 66.6667 }, +}; + +static const CoordRec char59_stroke1[] = { + { 17.7238, 4.7619 }, + { 12.9619, 0 }, + { 8.2, 4.7619 }, + { 12.9619, 9.5238 }, + { 17.7238, 4.7619 }, + { 17.7238, -4.7619 }, + { 12.9619, -14.2857 }, + { 8.2, -19.0476 }, +}; + +static const StrokeRec char59[] = { + { 5, char59_stroke0 }, + { 8, char59_stroke1 }, +}; + +/* char: 60 '<' */ + +static const CoordRec char60_stroke0[] = { + { 79.2505, 85.7143 }, + { 3.06, 42.8571 }, + { 79.2505, 0 }, +}; + +static const StrokeRec char60[] = { + { 3, char60_stroke0 }, +}; + +/* char: 61 '=' */ + +static const CoordRec char61_stroke0[] = { + { 5.7, 57.1429 }, + { 91.4143, 57.1429 }, +}; + +static const CoordRec char61_stroke1[] = { + { 5.7, 28.5714 }, + { 91.4143, 28.5714 }, +}; + +static const StrokeRec char61[] = { + { 2, char61_stroke0 }, + { 2, char61_stroke1 }, +}; + +/* char: 62 '>' */ + +static const CoordRec char62_stroke0[] = { + { 2.78, 85.7143 }, + { 78.9705, 42.8571 }, + { 2.78, 0 }, +}; + +static const StrokeRec char62[] = { + { 3, char62_stroke0 }, +}; + +/* char: 63 '?' */ + +static const CoordRec char63_stroke0[] = { + { 8.42, 76.1905 }, + { 8.42, 80.9524 }, + { 13.1819, 90.4762 }, + { 17.9438, 95.2381 }, + { 27.4676, 100 }, + { 46.5152, 100 }, + { 56.039, 95.2381 }, + { 60.801, 90.4762 }, + { 65.5629, 80.9524 }, + { 65.5629, 71.4286 }, + { 60.801, 61.9048 }, + { 56.039, 57.1429 }, + { 36.9914, 47.619 }, + { 36.9914, 33.3333 }, +}; + +static const CoordRec char63_stroke1[] = { + { 36.9914, 9.5238 }, + { 32.2295, 4.7619 }, + { 36.9914, 0 }, + { 41.7533, 4.7619 }, + { 36.9914, 9.5238 }, +}; + +static const StrokeRec char63[] = { + { 14, char63_stroke0 }, + { 5, char63_stroke1 }, +}; + +/* char: 64 '@' */ + +static const CoordRec char64_stroke0[] = { + { 49.2171, 52.381 }, + { 39.6933, 57.1429 }, + { 30.1695, 57.1429 }, + { 25.4076, 47.619 }, + { 25.4076, 42.8571 }, + { 30.1695, 33.3333 }, + { 39.6933, 33.3333 }, + { 49.2171, 38.0952 }, +}; + +static const CoordRec char64_stroke1[] = { + { 49.2171, 57.1429 }, + { 49.2171, 38.0952 }, + { 53.979, 33.3333 }, + { 63.5029, 33.3333 }, + { 68.2648, 42.8571 }, + { 68.2648, 47.619 }, + { 63.5029, 61.9048 }, + { 53.979, 71.4286 }, + { 39.6933, 76.1905 }, + { 34.9314, 76.1905 }, + { 20.6457, 71.4286 }, + { 11.1219, 61.9048 }, + { 6.36, 47.619 }, + { 6.36, 42.8571 }, + { 11.1219, 28.5714 }, + { 20.6457, 19.0476 }, + { 34.9314, 14.2857 }, + { 39.6933, 14.2857 }, + { 53.979, 19.0476 }, +}; + +static const StrokeRec char64[] = { + { 8, char64_stroke0 }, + { 19, char64_stroke1 }, +}; + +/* char: 65 'A' */ + +static const CoordRec char65_stroke0[] = { + { 40.5952, 100 }, + { 2.5, 0 }, +}; + +static const CoordRec char65_stroke1[] = { + { 40.5952, 100 }, + { 78.6905, 0 }, +}; + +static const CoordRec char65_stroke2[] = { + { 16.7857, 33.3333 }, + { 64.4048, 33.3333 }, +}; + +static const StrokeRec char65[] = { + { 2, char65_stroke0 }, + { 2, char65_stroke1 }, + { 2, char65_stroke2 }, +}; + +/* char: 66 'B' */ + +static const CoordRec char66_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char66_stroke1[] = { + { 11.42, 100 }, + { 54.2771, 100 }, + { 68.5629, 95.2381 }, + { 73.3248, 90.4762 }, + { 78.0867, 80.9524 }, + { 78.0867, 71.4286 }, + { 73.3248, 61.9048 }, + { 68.5629, 57.1429 }, + { 54.2771, 52.381 }, +}; + +static const CoordRec char66_stroke2[] = { + { 11.42, 52.381 }, + { 54.2771, 52.381 }, + { 68.5629, 47.619 }, + { 73.3248, 42.8571 }, + { 78.0867, 33.3333 }, + { 78.0867, 19.0476 }, + { 73.3248, 9.5238 }, + { 68.5629, 4.7619 }, + { 54.2771, 0 }, + { 11.42, 0 }, +}; + +static const StrokeRec char66[] = { + { 2, char66_stroke0 }, + { 9, char66_stroke1 }, + { 10, char66_stroke2 }, +}; + +/* char: 67 'C' */ + +static const CoordRec char67_stroke0[] = { + { 78.0886, 76.1905 }, + { 73.3267, 85.7143 }, + { 63.8029, 95.2381 }, + { 54.279, 100 }, + { 35.2314, 100 }, + { 25.7076, 95.2381 }, + { 16.1838, 85.7143 }, + { 11.4219, 76.1905 }, + { 6.66, 61.9048 }, + { 6.66, 38.0952 }, + { 11.4219, 23.8095 }, + { 16.1838, 14.2857 }, + { 25.7076, 4.7619 }, + { 35.2314, 0 }, + { 54.279, 0 }, + { 63.8029, 4.7619 }, + { 73.3267, 14.2857 }, + { 78.0886, 23.8095 }, +}; + +static const StrokeRec char67[] = { + { 18, char67_stroke0 }, +}; + +/* char: 68 'D' */ + +static const CoordRec char68_stroke0[] = { + { 11.96, 100 }, + { 11.96, 0 }, +}; + +static const CoordRec char68_stroke1[] = { + { 11.96, 100 }, + { 45.2933, 100 }, + { 59.579, 95.2381 }, + { 69.1029, 85.7143 }, + { 73.8648, 76.1905 }, + { 78.6267, 61.9048 }, + { 78.6267, 38.0952 }, + { 73.8648, 23.8095 }, + { 69.1029, 14.2857 }, + { 59.579, 4.7619 }, + { 45.2933, 0 }, + { 11.96, 0 }, +}; + +static const StrokeRec char68[] = { + { 2, char68_stroke0 }, + { 12, char68_stroke1 }, +}; + +/* char: 69 'E' */ + +static const CoordRec char69_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char69_stroke1[] = { + { 11.42, 100 }, + { 73.3248, 100 }, +}; + +static const CoordRec char69_stroke2[] = { + { 11.42, 52.381 }, + { 49.5152, 52.381 }, +}; + +static const CoordRec char69_stroke3[] = { + { 11.42, 0 }, + { 73.3248, 0 }, +}; + +static const StrokeRec char69[] = { + { 2, char69_stroke0 }, + { 2, char69_stroke1 }, + { 2, char69_stroke2 }, + { 2, char69_stroke3 }, +}; + +/* char: 70 'F' */ + +static const CoordRec char70_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char70_stroke1[] = { + { 11.42, 100 }, + { 73.3248, 100 }, +}; + +static const CoordRec char70_stroke2[] = { + { 11.42, 52.381 }, + { 49.5152, 52.381 }, +}; + +static const StrokeRec char70[] = { + { 2, char70_stroke0 }, + { 2, char70_stroke1 }, + { 2, char70_stroke2 }, +}; + +/* char: 71 'G' */ + +static const CoordRec char71_stroke0[] = { + { 78.4886, 76.1905 }, + { 73.7267, 85.7143 }, + { 64.2029, 95.2381 }, + { 54.679, 100 }, + { 35.6314, 100 }, + { 26.1076, 95.2381 }, + { 16.5838, 85.7143 }, + { 11.8219, 76.1905 }, + { 7.06, 61.9048 }, + { 7.06, 38.0952 }, + { 11.8219, 23.8095 }, + { 16.5838, 14.2857 }, + { 26.1076, 4.7619 }, + { 35.6314, 0 }, + { 54.679, 0 }, + { 64.2029, 4.7619 }, + { 73.7267, 14.2857 }, + { 78.4886, 23.8095 }, + { 78.4886, 38.0952 }, +}; + +static const CoordRec char71_stroke1[] = { + { 54.679, 38.0952 }, + { 78.4886, 38.0952 }, +}; + +static const StrokeRec char71[] = { + { 19, char71_stroke0 }, + { 2, char71_stroke1 }, +}; + +/* char: 72 'H' */ + +static const CoordRec char72_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char72_stroke1[] = { + { 78.0867, 100 }, + { 78.0867, 0 }, +}; + +static const CoordRec char72_stroke2[] = { + { 11.42, 52.381 }, + { 78.0867, 52.381 }, +}; + +static const StrokeRec char72[] = { + { 2, char72_stroke0 }, + { 2, char72_stroke1 }, + { 2, char72_stroke2 }, +}; + +/* char: 73 'I' */ + +static const CoordRec char73_stroke0[] = { + { 10.86, 100 }, + { 10.86, 0 }, +}; + +static const StrokeRec char73[] = { + { 2, char73_stroke0 }, +}; + +/* char: 74 'J' */ + +static const CoordRec char74_stroke0[] = { + { 50.119, 100 }, + { 50.119, 23.8095 }, + { 45.3571, 9.5238 }, + { 40.5952, 4.7619 }, + { 31.0714, 0 }, + { 21.5476, 0 }, + { 12.0238, 4.7619 }, + { 7.2619, 9.5238 }, + { 2.5, 23.8095 }, + { 2.5, 33.3333 }, +}; + +static const StrokeRec char74[] = { + { 10, char74_stroke0 }, +}; + +/* char: 75 'K' */ + +static const CoordRec char75_stroke0[] = { + { 11.28, 100 }, + { 11.28, 0 }, +}; + +static const CoordRec char75_stroke1[] = { + { 77.9467, 100 }, + { 11.28, 33.3333 }, +}; + +static const CoordRec char75_stroke2[] = { + { 35.0895, 57.1429 }, + { 77.9467, 0 }, +}; + +static const StrokeRec char75[] = { + { 2, char75_stroke0 }, + { 2, char75_stroke1 }, + { 2, char75_stroke2 }, +}; + +/* char: 76 'L' */ + +static const CoordRec char76_stroke0[] = { + { 11.68, 100 }, + { 11.68, 0 }, +}; + +static const CoordRec char76_stroke1[] = { + { 11.68, 0 }, + { 68.8229, 0 }, +}; + +static const StrokeRec char76[] = { + { 2, char76_stroke0 }, + { 2, char76_stroke1 }, +}; + +/* char: 77 'M' */ + +static const CoordRec char77_stroke0[] = { + { 10.86, 100 }, + { 10.86, 0 }, +}; + +static const CoordRec char77_stroke1[] = { + { 10.86, 100 }, + { 48.9552, 0 }, +}; + +static const CoordRec char77_stroke2[] = { + { 87.0505, 100 }, + { 48.9552, 0 }, +}; + +static const CoordRec char77_stroke3[] = { + { 87.0505, 100 }, + { 87.0505, 0 }, +}; + +static const StrokeRec char77[] = { + { 2, char77_stroke0 }, + { 2, char77_stroke1 }, + { 2, char77_stroke2 }, + { 2, char77_stroke3 }, +}; + +/* char: 78 'N' */ + +static const CoordRec char78_stroke0[] = { + { 11.14, 100 }, + { 11.14, 0 }, +}; + +static const CoordRec char78_stroke1[] = { + { 11.14, 100 }, + { 77.8067, 0 }, +}; + +static const CoordRec char78_stroke2[] = { + { 77.8067, 100 }, + { 77.8067, 0 }, +}; + +static const StrokeRec char78[] = { + { 2, char78_stroke0 }, + { 2, char78_stroke1 }, + { 2, char78_stroke2 }, +}; + +/* char: 79 'O' */ + +static const CoordRec char79_stroke0[] = { + { 34.8114, 100 }, + { 25.2876, 95.2381 }, + { 15.7638, 85.7143 }, + { 11.0019, 76.1905 }, + { 6.24, 61.9048 }, + { 6.24, 38.0952 }, + { 11.0019, 23.8095 }, + { 15.7638, 14.2857 }, + { 25.2876, 4.7619 }, + { 34.8114, 0 }, + { 53.859, 0 }, + { 63.3829, 4.7619 }, + { 72.9067, 14.2857 }, + { 77.6686, 23.8095 }, + { 82.4305, 38.0952 }, + { 82.4305, 61.9048 }, + { 77.6686, 76.1905 }, + { 72.9067, 85.7143 }, + { 63.3829, 95.2381 }, + { 53.859, 100 }, + { 34.8114, 100 }, +}; + +static const StrokeRec char79[] = { + { 21, char79_stroke0 }, +}; + +/* char: 80 'P' */ + +static const CoordRec char80_stroke0[] = { + { 12.1, 100 }, + { 12.1, 0 }, +}; + +static const CoordRec char80_stroke1[] = { + { 12.1, 100 }, + { 54.9571, 100 }, + { 69.2429, 95.2381 }, + { 74.0048, 90.4762 }, + { 78.7667, 80.9524 }, + { 78.7667, 66.6667 }, + { 74.0048, 57.1429 }, + { 69.2429, 52.381 }, + { 54.9571, 47.619 }, + { 12.1, 47.619 }, +}; + +static const StrokeRec char80[] = { + { 2, char80_stroke0 }, + { 10, char80_stroke1 }, +}; + +/* char: 81 'Q' */ + +static const CoordRec char81_stroke0[] = { + { 33.8714, 100 }, + { 24.3476, 95.2381 }, + { 14.8238, 85.7143 }, + { 10.0619, 76.1905 }, + { 5.3, 61.9048 }, + { 5.3, 38.0952 }, + { 10.0619, 23.8095 }, + { 14.8238, 14.2857 }, + { 24.3476, 4.7619 }, + { 33.8714, 0 }, + { 52.919, 0 }, + { 62.4429, 4.7619 }, + { 71.9667, 14.2857 }, + { 76.7286, 23.8095 }, + { 81.4905, 38.0952 }, + { 81.4905, 61.9048 }, + { 76.7286, 76.1905 }, + { 71.9667, 85.7143 }, + { 62.4429, 95.2381 }, + { 52.919, 100 }, + { 33.8714, 100 }, +}; + +static const CoordRec char81_stroke1[] = { + { 48.1571, 19.0476 }, + { 76.7286, -9.5238 }, +}; + +static const StrokeRec char81[] = { + { 21, char81_stroke0 }, + { 2, char81_stroke1 }, +}; + +/* char: 82 'R' */ + +static const CoordRec char82_stroke0[] = { + { 11.68, 100 }, + { 11.68, 0 }, +}; + +static const CoordRec char82_stroke1[] = { + { 11.68, 100 }, + { 54.5371, 100 }, + { 68.8229, 95.2381 }, + { 73.5848, 90.4762 }, + { 78.3467, 80.9524 }, + { 78.3467, 71.4286 }, + { 73.5848, 61.9048 }, + { 68.8229, 57.1429 }, + { 54.5371, 52.381 }, + { 11.68, 52.381 }, +}; + +static const CoordRec char82_stroke2[] = { + { 45.0133, 52.381 }, + { 78.3467, 0 }, +}; + +static const StrokeRec char82[] = { + { 2, char82_stroke0 }, + { 10, char82_stroke1 }, + { 2, char82_stroke2 }, +}; + +/* char: 83 'S' */ + +static const CoordRec char83_stroke0[] = { + { 74.6667, 85.7143 }, + { 65.1429, 95.2381 }, + { 50.8571, 100 }, + { 31.8095, 100 }, + { 17.5238, 95.2381 }, + { 8, 85.7143 }, + { 8, 76.1905 }, + { 12.7619, 66.6667 }, + { 17.5238, 61.9048 }, + { 27.0476, 57.1429 }, + { 55.619, 47.619 }, + { 65.1429, 42.8571 }, + { 69.9048, 38.0952 }, + { 74.6667, 28.5714 }, + { 74.6667, 14.2857 }, + { 65.1429, 4.7619 }, + { 50.8571, 0 }, + { 31.8095, 0 }, + { 17.5238, 4.7619 }, + { 8, 14.2857 }, +}; + +static const StrokeRec char83[] = { + { 20, char83_stroke0 }, +}; + +/* char: 84 'T' */ + +static const CoordRec char84_stroke0[] = { + { 35.6933, 100 }, + { 35.6933, 0 }, +}; + +static const CoordRec char84_stroke1[] = { + { 2.36, 100 }, + { 69.0267, 100 }, +}; + +static const StrokeRec char84[] = { + { 2, char84_stroke0 }, + { 2, char84_stroke1 }, +}; + +/* char: 85 'U' */ + +static const CoordRec char85_stroke0[] = { + { 11.54, 100 }, + { 11.54, 28.5714 }, + { 16.3019, 14.2857 }, + { 25.8257, 4.7619 }, + { 40.1114, 0 }, + { 49.6352, 0 }, + { 63.921, 4.7619 }, + { 73.4448, 14.2857 }, + { 78.2067, 28.5714 }, + { 78.2067, 100 }, +}; + +static const StrokeRec char85[] = { + { 10, char85_stroke0 }, +}; + +/* char: 86 'V' */ + +static const CoordRec char86_stroke0[] = { + { 2.36, 100 }, + { 40.4552, 0 }, +}; + +static const CoordRec char86_stroke1[] = { + { 78.5505, 100 }, + { 40.4552, 0 }, +}; + +static const StrokeRec char86[] = { + { 2, char86_stroke0 }, + { 2, char86_stroke1 }, +}; + +/* char: 87 'W' */ + +static const CoordRec char87_stroke0[] = { + { 2.22, 100 }, + { 26.0295, 0 }, +}; + +static const CoordRec char87_stroke1[] = { + { 49.839, 100 }, + { 26.0295, 0 }, +}; + +static const CoordRec char87_stroke2[] = { + { 49.839, 100 }, + { 73.6486, 0 }, +}; + +static const CoordRec char87_stroke3[] = { + { 97.4581, 100 }, + { 73.6486, 0 }, +}; + +static const StrokeRec char87[] = { + { 2, char87_stroke0 }, + { 2, char87_stroke1 }, + { 2, char87_stroke2 }, + { 2, char87_stroke3 }, +}; + +/* char: 88 'X' */ + +static const CoordRec char88_stroke0[] = { + { 2.5, 100 }, + { 69.1667, 0 }, +}; + +static const CoordRec char88_stroke1[] = { + { 69.1667, 100 }, + { 2.5, 0 }, +}; + +static const StrokeRec char88[] = { + { 2, char88_stroke0 }, + { 2, char88_stroke1 }, +}; + +/* char: 89 'Y' */ + +static const CoordRec char89_stroke0[] = { + { 1.52, 100 }, + { 39.6152, 52.381 }, + { 39.6152, 0 }, +}; + +static const CoordRec char89_stroke1[] = { + { 77.7105, 100 }, + { 39.6152, 52.381 }, +}; + +static const StrokeRec char89[] = { + { 3, char89_stroke0 }, + { 2, char89_stroke1 }, +}; + +/* char: 90 'Z' */ + +static const CoordRec char90_stroke0[] = { + { 69.1667, 100 }, + { 2.5, 0 }, +}; + +static const CoordRec char90_stroke1[] = { + { 2.5, 100 }, + { 69.1667, 100 }, +}; + +static const CoordRec char90_stroke2[] = { + { 2.5, 0 }, + { 69.1667, 0 }, +}; + +static const StrokeRec char90[] = { + { 2, char90_stroke0 }, + { 2, char90_stroke1 }, + { 2, char90_stroke2 }, +}; + +/* char: 91 '[' */ + +static const CoordRec char91_stroke0[] = { + { 7.78, 119.048 }, + { 7.78, -33.3333 }, +}; + +static const CoordRec char91_stroke1[] = { + { 12.5419, 119.048 }, + { 12.5419, -33.3333 }, +}; + +static const CoordRec char91_stroke2[] = { + { 7.78, 119.048 }, + { 41.1133, 119.048 }, +}; + +static const CoordRec char91_stroke3[] = { + { 7.78, -33.3333 }, + { 41.1133, -33.3333 }, +}; + +static const StrokeRec char91[] = { + { 2, char91_stroke0 }, + { 2, char91_stroke1 }, + { 2, char91_stroke2 }, + { 2, char91_stroke3 }, +}; + +/* char: 92 '\' */ + +static const CoordRec char92_stroke0[] = { + { 5.84, 100 }, + { 72.5067, -14.2857 }, +}; + +static const StrokeRec char92[] = { + { 2, char92_stroke0 }, +}; + +/* char: 93 ']' */ + +static const CoordRec char93_stroke0[] = { + { 33.0114, 119.048 }, + { 33.0114, -33.3333 }, +}; + +static const CoordRec char93_stroke1[] = { + { 37.7733, 119.048 }, + { 37.7733, -33.3333 }, +}; + +static const CoordRec char93_stroke2[] = { + { 4.44, 119.048 }, + { 37.7733, 119.048 }, +}; + +static const CoordRec char93_stroke3[] = { + { 4.44, -33.3333 }, + { 37.7733, -33.3333 }, +}; + +static const StrokeRec char93[] = { + { 2, char93_stroke0 }, + { 2, char93_stroke1 }, + { 2, char93_stroke2 }, + { 2, char93_stroke3 }, +}; + +/* char: 94 '^' */ + +static const CoordRec char94_stroke0[] = { + { 44.0752, 109.524 }, + { 5.98, 42.8571 }, +}; + +static const CoordRec char94_stroke1[] = { + { 44.0752, 109.524 }, + { 82.1705, 42.8571 }, +}; + +static const StrokeRec char94[] = { + { 2, char94_stroke0 }, + { 2, char94_stroke1 }, +}; + +/* char: 95 '_' */ + +static const CoordRec char95_stroke0[] = { + { -1.1, -33.3333 }, + { 103.662, -33.3333 }, + { 103.662, -28.5714 }, + { -1.1, -28.5714 }, + { -1.1, -33.3333 }, +}; + +static const StrokeRec char95[] = { + { 5, char95_stroke0 }, +}; + +/* char: 96 '`' */ + +static const CoordRec char96_stroke0[] = { + { 33.0219, 100 }, + { 56.8314, 71.4286 }, +}; + +static const CoordRec char96_stroke1[] = { + { 33.0219, 100 }, + { 28.26, 95.2381 }, + { 56.8314, 71.4286 }, +}; + +static const StrokeRec char96[] = { + { 2, char96_stroke0 }, + { 3, char96_stroke1 }, +}; + +/* char: 97 'a' */ + +static const CoordRec char97_stroke0[] = { + { 63.8229, 66.6667 }, + { 63.8229, 0 }, +}; + +static const CoordRec char97_stroke1[] = { + { 63.8229, 52.381 }, + { 54.299, 61.9048 }, + { 44.7752, 66.6667 }, + { 30.4895, 66.6667 }, + { 20.9657, 61.9048 }, + { 11.4419, 52.381 }, + { 6.68, 38.0952 }, + { 6.68, 28.5714 }, + { 11.4419, 14.2857 }, + { 20.9657, 4.7619 }, + { 30.4895, 0 }, + { 44.7752, 0 }, + { 54.299, 4.7619 }, + { 63.8229, 14.2857 }, +}; + +static const StrokeRec char97[] = { + { 2, char97_stroke0 }, + { 14, char97_stroke1 }, +}; + +/* char: 98 'b' */ + +static const CoordRec char98_stroke0[] = { + { 8.76, 100 }, + { 8.76, 0 }, +}; + +static const CoordRec char98_stroke1[] = { + { 8.76, 52.381 }, + { 18.2838, 61.9048 }, + { 27.8076, 66.6667 }, + { 42.0933, 66.6667 }, + { 51.6171, 61.9048 }, + { 61.141, 52.381 }, + { 65.9029, 38.0952 }, + { 65.9029, 28.5714 }, + { 61.141, 14.2857 }, + { 51.6171, 4.7619 }, + { 42.0933, 0 }, + { 27.8076, 0 }, + { 18.2838, 4.7619 }, + { 8.76, 14.2857 }, +}; + +static const StrokeRec char98[] = { + { 2, char98_stroke0 }, + { 14, char98_stroke1 }, +}; + +/* char: 99 'c' */ + +static const CoordRec char99_stroke0[] = { + { 62.6629, 52.381 }, + { 53.139, 61.9048 }, + { 43.6152, 66.6667 }, + { 29.3295, 66.6667 }, + { 19.8057, 61.9048 }, + { 10.2819, 52.381 }, + { 5.52, 38.0952 }, + { 5.52, 28.5714 }, + { 10.2819, 14.2857 }, + { 19.8057, 4.7619 }, + { 29.3295, 0 }, + { 43.6152, 0 }, + { 53.139, 4.7619 }, + { 62.6629, 14.2857 }, +}; + +static const StrokeRec char99[] = { + { 14, char99_stroke0 }, +}; + +/* char: 100 'd' */ + +static const CoordRec char100_stroke0[] = { + { 61.7829, 100 }, + { 61.7829, 0 }, +}; + +static const CoordRec char100_stroke1[] = { + { 61.7829, 52.381 }, + { 52.259, 61.9048 }, + { 42.7352, 66.6667 }, + { 28.4495, 66.6667 }, + { 18.9257, 61.9048 }, + { 9.4019, 52.381 }, + { 4.64, 38.0952 }, + { 4.64, 28.5714 }, + { 9.4019, 14.2857 }, + { 18.9257, 4.7619 }, + { 28.4495, 0 }, + { 42.7352, 0 }, + { 52.259, 4.7619 }, + { 61.7829, 14.2857 }, +}; + +static const StrokeRec char100[] = { + { 2, char100_stroke0 }, + { 14, char100_stroke1 }, +}; + +/* char: 101 'e' */ + +static const CoordRec char101_stroke0[] = { + { 5.72, 38.0952 }, + { 62.8629, 38.0952 }, + { 62.8629, 47.619 }, + { 58.101, 57.1429 }, + { 53.339, 61.9048 }, + { 43.8152, 66.6667 }, + { 29.5295, 66.6667 }, + { 20.0057, 61.9048 }, + { 10.4819, 52.381 }, + { 5.72, 38.0952 }, + { 5.72, 28.5714 }, + { 10.4819, 14.2857 }, + { 20.0057, 4.7619 }, + { 29.5295, 0 }, + { 43.8152, 0 }, + { 53.339, 4.7619 }, + { 62.8629, 14.2857 }, +}; + +static const StrokeRec char101[] = { + { 17, char101_stroke0 }, +}; + +/* char: 102 'f' */ + +static const CoordRec char102_stroke0[] = { + { 38.7752, 100 }, + { 29.2514, 100 }, + { 19.7276, 95.2381 }, + { 14.9657, 80.9524 }, + { 14.9657, 0 }, +}; + +static const CoordRec char102_stroke1[] = { + { 0.68, 66.6667 }, + { 34.0133, 66.6667 }, +}; + +static const StrokeRec char102[] = { + { 5, char102_stroke0 }, + { 2, char102_stroke1 }, +}; + +/* char: 103 'g' */ + +static const CoordRec char103_stroke0[] = { + { 62.5029, 66.6667 }, + { 62.5029, -9.5238 }, + { 57.741, -23.8095 }, + { 52.979, -28.5714 }, + { 43.4552, -33.3333 }, + { 29.1695, -33.3333 }, + { 19.6457, -28.5714 }, +}; + +static const CoordRec char103_stroke1[] = { + { 62.5029, 52.381 }, + { 52.979, 61.9048 }, + { 43.4552, 66.6667 }, + { 29.1695, 66.6667 }, + { 19.6457, 61.9048 }, + { 10.1219, 52.381 }, + { 5.36, 38.0952 }, + { 5.36, 28.5714 }, + { 10.1219, 14.2857 }, + { 19.6457, 4.7619 }, + { 29.1695, 0 }, + { 43.4552, 0 }, + { 52.979, 4.7619 }, + { 62.5029, 14.2857 }, +}; + +static const StrokeRec char103[] = { + { 7, char103_stroke0 }, + { 14, char103_stroke1 }, +}; + +/* char: 104 'h' */ + +static const CoordRec char104_stroke0[] = { + { 9.6, 100 }, + { 9.6, 0 }, +}; + +static const CoordRec char104_stroke1[] = { + { 9.6, 47.619 }, + { 23.8857, 61.9048 }, + { 33.4095, 66.6667 }, + { 47.6952, 66.6667 }, + { 57.219, 61.9048 }, + { 61.981, 47.619 }, + { 61.981, 0 }, +}; + +static const StrokeRec char104[] = { + { 2, char104_stroke0 }, + { 7, char104_stroke1 }, +}; + +/* char: 105 'i' */ + +static const CoordRec char105_stroke0[] = { + { 10.02, 100 }, + { 14.7819, 95.2381 }, + { 19.5438, 100 }, + { 14.7819, 104.762 }, + { 10.02, 100 }, +}; + +static const CoordRec char105_stroke1[] = { + { 14.7819, 66.6667 }, + { 14.7819, 0 }, +}; + +static const StrokeRec char105[] = { + { 5, char105_stroke0 }, + { 2, char105_stroke1 }, +}; + +/* char: 106 'j' */ + +static const CoordRec char106_stroke0[] = { + { 17.3876, 100 }, + { 22.1495, 95.2381 }, + { 26.9114, 100 }, + { 22.1495, 104.762 }, + { 17.3876, 100 }, +}; + +static const CoordRec char106_stroke1[] = { + { 22.1495, 66.6667 }, + { 22.1495, -14.2857 }, + { 17.3876, -28.5714 }, + { 7.8638, -33.3333 }, + { -1.66, -33.3333 }, +}; + +static const StrokeRec char106[] = { + { 5, char106_stroke0 }, + { 5, char106_stroke1 }, +}; + +/* char: 107 'k' */ + +static const CoordRec char107_stroke0[] = { + { 9.6, 100 }, + { 9.6, 0 }, +}; + +static const CoordRec char107_stroke1[] = { + { 57.219, 66.6667 }, + { 9.6, 19.0476 }, +}; + +static const CoordRec char107_stroke2[] = { + { 28.6476, 38.0952 }, + { 61.981, 0 }, +}; + +static const StrokeRec char107[] = { + { 2, char107_stroke0 }, + { 2, char107_stroke1 }, + { 2, char107_stroke2 }, +}; + +/* char: 108 'l' */ + +static const CoordRec char108_stroke0[] = { + { 10.02, 100 }, + { 10.02, 0 }, +}; + +static const StrokeRec char108[] = { + { 2, char108_stroke0 }, +}; + +/* char: 109 'm' */ + +static const CoordRec char109_stroke0[] = { + { 9.6, 66.6667 }, + { 9.6, 0 }, +}; + +static const CoordRec char109_stroke1[] = { + { 9.6, 47.619 }, + { 23.8857, 61.9048 }, + { 33.4095, 66.6667 }, + { 47.6952, 66.6667 }, + { 57.219, 61.9048 }, + { 61.981, 47.619 }, + { 61.981, 0 }, +}; + +static const CoordRec char109_stroke2[] = { + { 61.981, 47.619 }, + { 76.2667, 61.9048 }, + { 85.7905, 66.6667 }, + { 100.076, 66.6667 }, + { 109.6, 61.9048 }, + { 114.362, 47.619 }, + { 114.362, 0 }, +}; + +static const StrokeRec char109[] = { + { 2, char109_stroke0 }, + { 7, char109_stroke1 }, + { 7, char109_stroke2 }, +}; + +/* char: 110 'n' */ + +static const CoordRec char110_stroke0[] = { + { 9.18, 66.6667 }, + { 9.18, 0 }, +}; + +static const CoordRec char110_stroke1[] = { + { 9.18, 47.619 }, + { 23.4657, 61.9048 }, + { 32.9895, 66.6667 }, + { 47.2752, 66.6667 }, + { 56.799, 61.9048 }, + { 61.561, 47.619 }, + { 61.561, 0 }, +}; + +static const StrokeRec char110[] = { + { 2, char110_stroke0 }, + { 7, char110_stroke1 }, +}; + +/* char: 111 'o' */ + +static const CoordRec char111_stroke0[] = { + { 28.7895, 66.6667 }, + { 19.2657, 61.9048 }, + { 9.7419, 52.381 }, + { 4.98, 38.0952 }, + { 4.98, 28.5714 }, + { 9.7419, 14.2857 }, + { 19.2657, 4.7619 }, + { 28.7895, 0 }, + { 43.0752, 0 }, + { 52.599, 4.7619 }, + { 62.1229, 14.2857 }, + { 66.8848, 28.5714 }, + { 66.8848, 38.0952 }, + { 62.1229, 52.381 }, + { 52.599, 61.9048 }, + { 43.0752, 66.6667 }, + { 28.7895, 66.6667 }, +}; + +static const StrokeRec char111[] = { + { 17, char111_stroke0 }, +}; + +/* char: 112 'p' */ + +static const CoordRec char112_stroke0[] = { + { 9.46, 66.6667 }, + { 9.46, -33.3333 }, +}; + +static const CoordRec char112_stroke1[] = { + { 9.46, 52.381 }, + { 18.9838, 61.9048 }, + { 28.5076, 66.6667 }, + { 42.7933, 66.6667 }, + { 52.3171, 61.9048 }, + { 61.841, 52.381 }, + { 66.6029, 38.0952 }, + { 66.6029, 28.5714 }, + { 61.841, 14.2857 }, + { 52.3171, 4.7619 }, + { 42.7933, 0 }, + { 28.5076, 0 }, + { 18.9838, 4.7619 }, + { 9.46, 14.2857 }, +}; + +static const StrokeRec char112[] = { + { 2, char112_stroke0 }, + { 14, char112_stroke1 }, +}; + +/* char: 113 'q' */ + +static const CoordRec char113_stroke0[] = { + { 61.9829, 66.6667 }, + { 61.9829, -33.3333 }, +}; + +static const CoordRec char113_stroke1[] = { + { 61.9829, 52.381 }, + { 52.459, 61.9048 }, + { 42.9352, 66.6667 }, + { 28.6495, 66.6667 }, + { 19.1257, 61.9048 }, + { 9.6019, 52.381 }, + { 4.84, 38.0952 }, + { 4.84, 28.5714 }, + { 9.6019, 14.2857 }, + { 19.1257, 4.7619 }, + { 28.6495, 0 }, + { 42.9352, 0 }, + { 52.459, 4.7619 }, + { 61.9829, 14.2857 }, +}; + +static const StrokeRec char113[] = { + { 2, char113_stroke0 }, + { 14, char113_stroke1 }, +}; + +/* char: 114 'r' */ + +static const CoordRec char114_stroke0[] = { + { 9.46, 66.6667 }, + { 9.46, 0 }, +}; + +static const CoordRec char114_stroke1[] = { + { 9.46, 38.0952 }, + { 14.2219, 52.381 }, + { 23.7457, 61.9048 }, + { 33.2695, 66.6667 }, + { 47.5552, 66.6667 }, +}; + +static const StrokeRec char114[] = { + { 2, char114_stroke0 }, + { 5, char114_stroke1 }, +}; + +/* char: 115 's' */ + +static const CoordRec char115_stroke0[] = { + { 57.081, 52.381 }, + { 52.319, 61.9048 }, + { 38.0333, 66.6667 }, + { 23.7476, 66.6667 }, + { 9.4619, 61.9048 }, + { 4.7, 52.381 }, + { 9.4619, 42.8571 }, + { 18.9857, 38.0952 }, + { 42.7952, 33.3333 }, + { 52.319, 28.5714 }, + { 57.081, 19.0476 }, + { 57.081, 14.2857 }, + { 52.319, 4.7619 }, + { 38.0333, 0 }, + { 23.7476, 0 }, + { 9.4619, 4.7619 }, + { 4.7, 14.2857 }, +}; + +static const StrokeRec char115[] = { + { 17, char115_stroke0 }, +}; + +/* char: 116 't' */ + +static const CoordRec char116_stroke0[] = { + { 14.8257, 100 }, + { 14.8257, 19.0476 }, + { 19.5876, 4.7619 }, + { 29.1114, 0 }, + { 38.6352, 0 }, +}; + +static const CoordRec char116_stroke1[] = { + { 0.54, 66.6667 }, + { 33.8733, 66.6667 }, +}; + +static const StrokeRec char116[] = { + { 5, char116_stroke0 }, + { 2, char116_stroke1 }, +}; + +/* char: 117 'u' */ + +static const CoordRec char117_stroke0[] = { + { 9.46, 66.6667 }, + { 9.46, 19.0476 }, + { 14.2219, 4.7619 }, + { 23.7457, 0 }, + { 38.0314, 0 }, + { 47.5552, 4.7619 }, + { 61.841, 19.0476 }, +}; + +static const CoordRec char117_stroke1[] = { + { 61.841, 66.6667 }, + { 61.841, 0 }, +}; + +static const StrokeRec char117[] = { + { 7, char117_stroke0 }, + { 2, char117_stroke1 }, +}; + +/* char: 118 'v' */ + +static const CoordRec char118_stroke0[] = { + { 1.8, 66.6667 }, + { 30.3714, 0 }, +}; + +static const CoordRec char118_stroke1[] = { + { 58.9429, 66.6667 }, + { 30.3714, 0 }, +}; + +static const StrokeRec char118[] = { + { 2, char118_stroke0 }, + { 2, char118_stroke1 }, +}; + +/* char: 119 'w' */ + +static const CoordRec char119_stroke0[] = { + { 2.5, 66.6667 }, + { 21.5476, 0 }, +}; + +static const CoordRec char119_stroke1[] = { + { 40.5952, 66.6667 }, + { 21.5476, 0 }, +}; + +static const CoordRec char119_stroke2[] = { + { 40.5952, 66.6667 }, + { 59.6429, 0 }, +}; + +static const CoordRec char119_stroke3[] = { + { 78.6905, 66.6667 }, + { 59.6429, 0 }, +}; + +static const StrokeRec char119[] = { + { 2, char119_stroke0 }, + { 2, char119_stroke1 }, + { 2, char119_stroke2 }, + { 2, char119_stroke3 }, +}; + +/* char: 120 'x' */ + +static const CoordRec char120_stroke0[] = { + { 1.66, 66.6667 }, + { 54.041, 0 }, +}; + +static const CoordRec char120_stroke1[] = { + { 54.041, 66.6667 }, + { 1.66, 0 }, +}; + +static const StrokeRec char120[] = { + { 2, char120_stroke0 }, + { 2, char120_stroke1 }, +}; + +/* char: 121 'y' */ + +static const CoordRec char121_stroke0[] = { + { 6.5619, 66.6667 }, + { 35.1333, 0 }, +}; + +static const CoordRec char121_stroke1[] = { + { 63.7048, 66.6667 }, + { 35.1333, 0 }, + { 25.6095, -19.0476 }, + { 16.0857, -28.5714 }, + { 6.5619, -33.3333 }, + { 1.8, -33.3333 }, +}; + +static const StrokeRec char121[] = { + { 2, char121_stroke0 }, + { 6, char121_stroke1 }, +}; + +/* char: 122 'z' */ + +static const CoordRec char122_stroke0[] = { + { 56.821, 66.6667 }, + { 4.44, 0 }, +}; + +static const CoordRec char122_stroke1[] = { + { 4.44, 66.6667 }, + { 56.821, 66.6667 }, +}; + +static const CoordRec char122_stroke2[] = { + { 4.44, 0 }, + { 56.821, 0 }, +}; + +static const StrokeRec char122[] = { + { 2, char122_stroke0 }, + { 2, char122_stroke1 }, + { 2, char122_stroke2 }, +}; + +/* char: 123 '{' */ + +static const CoordRec char123_stroke0[] = { + { 31.1895, 119.048 }, + { 21.6657, 114.286 }, + { 16.9038, 109.524 }, + { 12.1419, 100 }, + { 12.1419, 90.4762 }, + { 16.9038, 80.9524 }, + { 21.6657, 76.1905 }, + { 26.4276, 66.6667 }, + { 26.4276, 57.1429 }, + { 16.9038, 47.619 }, +}; + +static const CoordRec char123_stroke1[] = { + { 21.6657, 114.286 }, + { 16.9038, 104.762 }, + { 16.9038, 95.2381 }, + { 21.6657, 85.7143 }, + { 26.4276, 80.9524 }, + { 31.1895, 71.4286 }, + { 31.1895, 61.9048 }, + { 26.4276, 52.381 }, + { 7.38, 42.8571 }, + { 26.4276, 33.3333 }, + { 31.1895, 23.8095 }, + { 31.1895, 14.2857 }, + { 26.4276, 4.7619 }, + { 21.6657, 0 }, + { 16.9038, -9.5238 }, + { 16.9038, -19.0476 }, + { 21.6657, -28.5714 }, +}; + +static const CoordRec char123_stroke2[] = { + { 16.9038, 38.0952 }, + { 26.4276, 28.5714 }, + { 26.4276, 19.0476 }, + { 21.6657, 9.5238 }, + { 16.9038, 4.7619 }, + { 12.1419, -4.7619 }, + { 12.1419, -14.2857 }, + { 16.9038, -23.8095 }, + { 21.6657, -28.5714 }, + { 31.1895, -33.3333 }, +}; + +static const StrokeRec char123[] = { + { 10, char123_stroke0 }, + { 17, char123_stroke1 }, + { 10, char123_stroke2 }, +}; + +/* char: 124 '|' */ + +static const CoordRec char124_stroke0[] = { + { 11.54, 119.048 }, + { 11.54, -33.3333 }, +}; + +static const StrokeRec char124[] = { + { 2, char124_stroke0 }, +}; + +/* char: 125 '}' */ + +static const CoordRec char125_stroke0[] = { + { 9.18, 119.048 }, + { 18.7038, 114.286 }, + { 23.4657, 109.524 }, + { 28.2276, 100 }, + { 28.2276, 90.4762 }, + { 23.4657, 80.9524 }, + { 18.7038, 76.1905 }, + { 13.9419, 66.6667 }, + { 13.9419, 57.1429 }, + { 23.4657, 47.619 }, +}; + +static const CoordRec char125_stroke1[] = { + { 18.7038, 114.286 }, + { 23.4657, 104.762 }, + { 23.4657, 95.2381 }, + { 18.7038, 85.7143 }, + { 13.9419, 80.9524 }, + { 9.18, 71.4286 }, + { 9.18, 61.9048 }, + { 13.9419, 52.381 }, + { 32.9895, 42.8571 }, + { 13.9419, 33.3333 }, + { 9.18, 23.8095 }, + { 9.18, 14.2857 }, + { 13.9419, 4.7619 }, + { 18.7038, 0 }, + { 23.4657, -9.5238 }, + { 23.4657, -19.0476 }, + { 18.7038, -28.5714 }, +}; + +static const CoordRec char125_stroke2[] = { + { 23.4657, 38.0952 }, + { 13.9419, 28.5714 }, + { 13.9419, 19.0476 }, + { 18.7038, 9.5238 }, + { 23.4657, 4.7619 }, + { 28.2276, -4.7619 }, + { 28.2276, -14.2857 }, + { 23.4657, -23.8095 }, + { 18.7038, -28.5714 }, + { 9.18, -33.3333 }, +}; + +static const StrokeRec char125[] = { + { 10, char125_stroke0 }, + { 17, char125_stroke1 }, + { 10, char125_stroke2 }, +}; + +/* char: 126 '~' */ + +static const CoordRec char126_stroke0[] = { + { 2.92, 28.5714 }, + { 2.92, 38.0952 }, + { 7.6819, 52.381 }, + { 17.2057, 57.1429 }, + { 26.7295, 57.1429 }, + { 36.2533, 52.381 }, + { 55.301, 38.0952 }, + { 64.8248, 33.3333 }, + { 74.3486, 33.3333 }, + { 83.8724, 38.0952 }, + { 88.6343, 47.619 }, +}; + +static const CoordRec char126_stroke1[] = { + { 2.92, 38.0952 }, + { 7.6819, 47.619 }, + { 17.2057, 52.381 }, + { 26.7295, 52.381 }, + { 36.2533, 47.619 }, + { 55.301, 33.3333 }, + { 64.8248, 28.5714 }, + { 74.3486, 28.5714 }, + { 83.8724, 33.3333 }, + { 88.6343, 47.619 }, + { 88.6343, 57.1429 }, +}; + +static const StrokeRec char126[] = { + { 11, char126_stroke0 }, + { 11, char126_stroke1 }, +}; + +/* char: 127 */ + +static const CoordRec char127_stroke0[] = { + { 52.381, 100 }, + { 14.2857, -33.3333 }, +}; + +static const CoordRec char127_stroke1[] = { + { 28.5714, 66.6667 }, + { 14.2857, 61.9048 }, + { 4.7619, 52.381 }, + { 0, 38.0952 }, + { 0, 23.8095 }, + { 4.7619, 14.2857 }, + { 14.2857, 4.7619 }, + { 28.5714, 0 }, + { 38.0952, 0 }, + { 52.381, 4.7619 }, + { 61.9048, 14.2857 }, + { 66.6667, 28.5714 }, + { 66.6667, 42.8571 }, + { 61.9048, 52.381 }, + { 52.381, 61.9048 }, + { 38.0952, 66.6667 }, + { 28.5714, 66.6667 }, +}; + +static const StrokeRec char127[] = { + { 2, char127_stroke0 }, + { 17, char127_stroke1 }, +}; + +static const StrokeCharRec chars[] = { + { 0, /* char0 */ 0, 0, 0 }, + { 0, /* char1 */ 0, 0, 0 }, + { 0, /* char2 */ 0, 0, 0 }, + { 0, /* char3 */ 0, 0, 0 }, + { 0, /* char4 */ 0, 0, 0 }, + { 0, /* char5 */ 0, 0, 0 }, + { 0, /* char6 */ 0, 0, 0 }, + { 0, /* char7 */ 0, 0, 0 }, + { 0, /* char8 */ 0, 0, 0 }, + { 0, /* char9 */ 0, 0, 0 }, + { 0, /* char10 */ 0, 0, 0 }, + { 0, /* char11 */ 0, 0, 0 }, + { 0, /* char12 */ 0, 0, 0 }, + { 0, /* char13 */ 0, 0, 0 }, + { 0, /* char14 */ 0, 0, 0 }, + { 0, /* char15 */ 0, 0, 0 }, + { 0, /* char16 */ 0, 0, 0 }, + { 0, /* char17 */ 0, 0, 0 }, + { 0, /* char18 */ 0, 0, 0 }, + { 0, /* char19 */ 0, 0, 0 }, + { 0, /* char20 */ 0, 0, 0 }, + { 0, /* char21 */ 0, 0, 0 }, + { 0, /* char22 */ 0, 0, 0 }, + { 0, /* char23 */ 0, 0, 0 }, + { 0, /* char24 */ 0, 0, 0 }, + { 0, /* char25 */ 0, 0, 0 }, + { 0, /* char26 */ 0, 0, 0 }, + { 0, /* char27 */ 0, 0, 0 }, + { 0, /* char28 */ 0, 0, 0 }, + { 0, /* char29 */ 0, 0, 0 }, + { 0, /* char30 */ 0, 0, 0 }, + { 0, /* char31 */ 0, 0, 0 }, + { 0, /* char32 */ 0, 52.381, 104.762 }, + { 2, char33, 13.3819, 26.6238 }, + { 2, char34, 23.0676, 51.4352 }, + { 4, char35, 36.5333, 79.4886 }, + { 3, char36, 38.1533, 76.2067 }, + { 3, char37, 49.2171, 96.5743 }, + { 1, char38, 53.599, 101.758 }, + { 1, char39, 4.44, 13.62 }, + { 1, char40, 21.8657, 47.1733 }, + { 1, char41, 24.3276, 47.5333 }, + { 3, char42, 30.7695, 59.439 }, + { 2, char43, 48.8371, 97.2543 }, + { 1, char44, 13.5219, 26.0638 }, + { 1, char45, 50.2371, 100.754 }, + { 1, char46, 13.1019, 26.4838 }, + { 1, char47, 40.5733, 82.1067 }, + { 1, char48, 38.3133, 77.0667 }, + { 1, char49, 30.8676, 66.5295 }, + { 1, char50, 38.7533, 77.6467 }, + { 1, char51, 38.3333, 77.0467 }, + { 2, char52, 37.2133, 80.1686 }, + { 1, char53, 38.1933, 77.6867 }, + { 1, char54, 34.1514, 73.8048 }, + { 2, char55, 38.8933, 77.2267 }, + { 1, char56, 38.9333, 77.6667 }, + { 1, char57, 39.9333, 74.0648 }, + { 2, char58, 14.0819, 26.2238 }, + { 2, char59, 12.9619, 26.3038 }, + { 1, char60, 41.1552, 81.6105 }, + { 2, char61, 48.5571, 97.2543 }, + { 1, char62, 40.8752, 81.6105 }, + { 2, char63, 36.9914, 73.9029 }, + { 2, char64, 34.9314, 74.3648 }, + { 3, char65, 40.5952, 80.4905 }, + { 3, char66, 44.7533, 83.6267 }, + { 1, char67, 39.9933, 84.4886 }, + { 2, char68, 45.2933, 85.2867 }, + { 4, char69, 39.9914, 78.1848 }, + { 3, char70, 39.9914, 78.7448 }, + { 2, char71, 40.3933, 89.7686 }, + { 3, char72, 44.7533, 89.0867 }, + { 1, char73, 10.86, 21.3 }, + { 1, char74, 31.0714, 59.999 }, + { 3, char75, 44.6133, 79.3267 }, + { 2, char76, 40.2514, 71.3229 }, + { 4, char77, 48.9552, 97.2105 }, + { 3, char78, 44.4733, 88.8067 }, + { 1, char79, 44.3352, 88.8305 }, + { 2, char80, 45.4333, 85.6667 }, + { 2, char81, 43.3952, 88.0905 }, + { 3, char82, 45.0133, 82.3667 }, + { 1, char83, 41.3333, 80.8267 }, + { 2, char84, 35.6933, 71.9467 }, + { 1, char85, 44.8733, 89.4867 }, + { 2, char86, 40.4552, 81.6105 }, + { 4, char87, 49.839, 100.518 }, + { 2, char88, 35.8333, 72.3667 }, + { 2, char89, 39.6152, 79.6505 }, + { 3, char90, 35.8333, 73.7467 }, + { 4, char91, 22.0657, 46.1133 }, + { 1, char92, 39.1733, 78.2067 }, + { 4, char93, 23.4876, 46.3933 }, + { 2, char94, 44.0752, 90.2305 }, + { 1, char95, 51.281, 104.062 }, + { 2, char96, 42.5457, 83.5714 }, + { 2, char97, 35.2514, 66.6029 }, + { 2, char98, 37.3314, 70.4629 }, + { 1, char99, 34.0914, 68.9229 }, + { 2, char100, 33.2114, 70.2629 }, + { 1, char101, 34.2914, 68.5229 }, + { 2, char102, 14.9657, 38.6552 }, + { 2, char103, 33.9314, 70.9829 }, + { 2, char104, 33.4095, 71.021 }, + { 2, char105, 14.7819, 28.8638 }, + { 2, char106, 17.3876, 36.2314 }, + { 3, char107, 33.4095, 62.521 }, + { 1, char108, 10.02, 19.34 }, + { 3, char109, 61.981, 123.962 }, + { 2, char110, 32.9895, 70.881 }, + { 1, char111, 33.5514, 71.7448 }, + { 2, char112, 38.0314, 70.8029 }, + { 2, char113, 33.4114, 70.7429 }, + { 2, char114, 23.7457, 49.4952 }, + { 1, char115, 28.5095, 62.321 }, + { 2, char116, 14.8257, 39.3152 }, + { 2, char117, 33.2695, 71.161 }, + { 2, char118, 30.3714, 60.6029 }, + { 4, char119, 40.5952, 80.4905 }, + { 2, char120, 25.4695, 56.401 }, + { 2, char121, 35.1333, 66.0648 }, + { 3, char122, 28.2495, 61.821 }, + { 3, char123, 21.6657, 41.6295 }, + { 1, char124, 11.54, 23.78 }, + { 3, char125, 18.7038, 41.4695 }, + { 2, char126, 45.7771, 91.2743 }, + { 2, char127, 33.3333, 66.6667 }, +}; + +StrokeFontRec glutStrokeRoman = { "Roman", 128, chars, 119.048, -33.3333 }; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_shapes.cpp b/xc/extras/Mesa/src-glut.beos/glut_shapes.cpp new file mode 100644 index 000000000..2249639f0 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_shapes.cpp @@ -0,0 +1,616 @@ + +/* 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 <math.h> +#include <GL/glut.h> +#include "glutint.h" + +/* Some <math.h> files do not define M_PI... */ +#ifndef M_PI +#define M_PI 3.14159265 +#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 = 0; i < 6; 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, GLenum type) +{ + int i, j; + GLfloat theta, phi, theta1, phi1; + GLfloat p0[03], p1[3], p2[3], p3[3]; + GLfloat n0[3], n1[3], n2[3], n3[3]; + + for (i = 0; i < rings; i++) { + theta = (GLfloat) i *2.0 * M_PI / rings; + theta1 = (GLfloat) (i + 1) * 2.0 * M_PI / rings; + for (j = 0; j < nsides; j++) { + phi = (GLfloat) j *2.0 * M_PI / nsides; + phi1 = (GLfloat) (j + 1) * 2.0 * M_PI / nsides; + + p0[0] = cos(theta) * (R + r * cos(phi)); + p0[1] = -sin(theta) * (R + r * cos(phi)); + p0[2] = r * sin(phi); + + p1[0] = cos(theta1) * (R + r * cos(phi)); + p1[1] = -sin(theta1) * (R + r * cos(phi)); + p1[2] = r * sin(phi); + + p2[0] = cos(theta1) * (R + r * cos(phi1)); + p2[1] = -sin(theta1) * (R + r * cos(phi1)); + p2[2] = r * sin(phi1); + + p3[0] = cos(theta) * (R + r * cos(phi1)); + p3[1] = -sin(theta) * (R + r * cos(phi1)); + p3[2] = r * sin(phi1); + + n0[0] = cos(theta) * (cos(phi)); + n0[1] = -sin(theta) * (cos(phi)); + n0[2] = sin(phi); + + n1[0] = cos(theta1) * (cos(phi)); + n1[1] = -sin(theta1) * (cos(phi)); + n1[2] = sin(phi); + + n2[0] = cos(theta1) * (cos(phi1)); + n2[1] = -sin(theta1) * (cos(phi1)); + n2[2] = sin(phi1); + + n3[0] = cos(theta) * (cos(phi1)); + n3[1] = -sin(theta) * (cos(phi1)); + n3[2] = sin(phi1); + + glBegin(type); + glNormal3fv(n3); + glVertex3fv(p3); + glNormal3fv(n2); + glVertex3fv(p2); + glNormal3fv(n1); + glVertex3fv(p1); + glNormal3fv(n0); + glVertex3fv(p0); + glEnd(); + } + } +} + +/* CENTRY */ +void APIENTRY +glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, + GLint nsides, GLint rings) +{ + doughnut(innerRadius, outerRadius, + nsides, rings, GL_LINE_LOOP); +} + +void APIENTRY +glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, + GLint nsides, GLint rings) +{ + doughnut(innerRadius, outerRadius, nsides, rings, GL_QUADS); +} + +/* 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 = 0; i < 8; 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 = 0; i < 20; 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 = 0; i < 4; i++) + drawtriangle(i, tdata, tndex, shadeType); +} + +/* CENTRY */ +void APIENTRY +glutWireTetrahedron(void) +{ + tetrahedron(GL_LINE_LOOP); +} + +void APIENTRY +glutSolidTetrahedron(void) +{ + tetrahedron(GL_TRIANGLES); +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut.beos/glut_stroke.cpp b/xc/extras/Mesa/src-glut.beos/glut_stroke.cpp new file mode 100644 index 000000000..c9231ebbd --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_stroke.cpp @@ -0,0 +1,43 @@ + +/* 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 <GL/glut.h> +#include "glutint.h" +#include "glutstroke.h" + +void APIENTRY +glutStrokeCharacter(GLUTstrokeFont font, int c) +{ + const StrokeCharRec *ch; + const StrokeRec *stroke; + const CoordRec *coord; + StrokeFontPtr fontinfo; + int i, j; + + +#if defined(WIN32) + fontinfo = (StrokeFontPtr) __glutFont(font); +#else + fontinfo = (StrokeFontPtr) font; +#endif + + if (c < 0 || c >= fontinfo->num_chars) + return; + ch = &(fontinfo->ch[c]); + if (ch) { + for (i = ch->num_strokes, stroke = ch->stroke; + i > 0; i--, stroke++) { + glBegin(GL_LINE_STRIP); + for (j = stroke->num_coords, coord = stroke->coord; + j > 0; j--, coord++) { + glVertex2f(coord->x, coord->y); + } + glEnd(); + } + glTranslatef(ch->right, 0.0, 0.0); + } +} diff --git a/xc/extras/Mesa/src-glut.beos/glut_swidth.cpp b/xc/extras/Mesa/src-glut.beos/glut_swidth.cpp new file mode 100644 index 000000000..228c8fc25 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_swidth.cpp @@ -0,0 +1,59 @@ + +/* Copyright (c) Mark J. Kilgard, 1995. */ + +/* 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 <GL/glut.h> +#include "glutint.h" +#include "glutstroke.h" + +/* CENTRY */ +int APIENTRY +glutStrokeWidth(GLUTstrokeFont font, int c) +{ + StrokeFontPtr fontinfo; + const StrokeCharRec *ch; + +#if defined(WIN32) + fontinfo = (StrokeFontPtr) __glutFont(font); +#else + fontinfo = (StrokeFontPtr) font; +#endif + + if (c < 0 || c >= fontinfo->num_chars) + return 0; + ch = &(fontinfo->ch[c]); + if (ch) + return (int)ch->right; + else + return 0; +} + +int APIENTRY +glutStrokeLength(GLUTstrokeFont font, const char *string) +{ + int c, length; + StrokeFontPtr fontinfo; + const StrokeCharRec *ch; + +#if defined(WIN32) + fontinfo = (StrokeFontPtr) __glutFont(font); +#else + fontinfo = (StrokeFontPtr) font; +#endif + + length = 0; + for (; *string != '\0'; string++) { + c = *string; + if (c >= 0 && c < fontinfo->num_chars) { + ch = &(fontinfo->ch[c]); + if (ch) + length += (int)ch->right; + } + } + return length; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut.beos/glut_teapot.cpp b/xc/extras/Mesa/src-glut.beos/glut_teapot.cpp new file mode 100644 index 000000000..63e63e448 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_teapot.cpp @@ -0,0 +1,210 @@ + +/* 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/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(14, scale, GL_FILL); +} + +void APIENTRY +glutWireTeapot(GLdouble scale) +{ + teapot(10, scale, GL_LINE); +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut.beos/glut_tr10.cpp b/xc/extras/Mesa/src-glut.beos/glut_tr10.cpp new file mode 100644 index 000000000..6cf158044 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_tr10.cpp @@ -0,0 +1,1776 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x80,0xc0,0x40,0x60,0xa0,0x90,0xb8,0x0,0xa0, +}; + +static const BitmapCharRec ch255 = {5,9,0,2,5,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0xc0,0x80,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {4,9,0,2,5,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x80,0xc0,0x40,0x60,0xa0,0x90,0xb8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {5,10,0,2,5,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x50, +}; + +static const BitmapCharRec ch252 = {5,7,0,0,5,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch251 = {5,8,0,0,5,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch250 = {5,8,0,0,5,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch249 = {5,8,0,0,5,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x80,0x70,0x48,0x48,0x48,0x38,0x4, +}; + +static const BitmapCharRec ch248 = {6,7,1,1,5,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x0,0xf8,0x0,0x20, +}; + +static const BitmapCharRec ch247 = {5,5,0,0,6,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0xa0, +}; + +static const BitmapCharRec ch246 = {4,7,0,0,5,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch245 = {4,8,0,0,5,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch244 = {4,8,0,0,5,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch243 = {4,8,0,0,5,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch242 = {4,8,0,0,5,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0xd8,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch241 = {5,8,0,0,5,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x60,0x90,0x90,0x90,0x70,0xa0,0x70,0x40, +}; + +static const BitmapCharRec ch240 = {4,8,0,0,5,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0xa0, +}; + +static const BitmapCharRec ch239 = {3,7,0,0,4,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch238 = {3,8,0,0,4,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch237 = {3,8,0,0,4,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch236 = {3,8,0,0,4,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0xa0, +}; + +static const BitmapCharRec ch235 = {3,7,0,0,4,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch234 = {3,8,0,0,4,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch233 = {3,8,0,0,4,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch232 = {3,8,0,0,4,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0xc0,0x20,0x40,0x60,0x80,0x80,0x80,0x60, +}; + +static const BitmapCharRec ch231 = {3,8,0,3,4,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0xd8,0xa0,0x70,0x28,0xd8, +}; + +static const BitmapCharRec ch230 = {5,5,0,0,6,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x40,0xa0,0x40, +}; + +static const BitmapCharRec ch229 = {3,8,0,0,4,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0, +}; + +static const BitmapCharRec ch228 = {3,7,0,0,4,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch227 = {4,8,0,0,4,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch226 = {3,8,0,0,4,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch225 = {3,8,0,0,4,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch224 = {3,8,0,0,4,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xe0,0x50,0x50,0x60,0x50,0x50,0x20, +}; + +static const BitmapCharRec ch223 = {4,7,0,0,5,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0xe0,0x40,0x70,0x48,0x70,0x40,0xe0, +}; + +static const BitmapCharRec ch222 = {5,7,0,0,6,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x38,0x10,0x10,0x28,0x28,0x44,0xee,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch221 = {7,10,0,0,8,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x28, +}; + +static const BitmapCharRec ch220 = {7,9,0,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch219 = {7,10,0,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch218 = {7,10,0,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {7,10,0,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x7c,0x66,0x52,0x52,0x4a,0x66,0x3e,0x1, +}; + +static const BitmapCharRec ch216 = {8,9,0,1,8,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch215 = {5,5,0,0,6,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50, +}; + +static const BitmapCharRec ch214 = {6,9,0,0,7,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch213 = {6,10,0,0,7,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch212 = {6,10,0,0,7,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch211 = {6,10,0,0,7,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch210 = {6,10,0,0,7,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0xe4,0x4c,0x4c,0x54,0x54,0x64,0xee,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0xf8,0x4c,0x44,0xe4,0x44,0x4c,0xf8, +}; + +static const BitmapCharRec ch208 = {6,7,0,0,7,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0xa0, +}; + +static const BitmapCharRec ch207 = {3,9,0,0,4,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch206 = {3,10,0,0,4,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch205 = {3,10,0,0,4,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch204 = {3,10,0,0,4,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x50, +}; + +static const BitmapCharRec ch203 = {5,9,0,0,6,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch202 = {5,10,0,0,6,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch201 = {5,10,0,0,6,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch200 = {5,10,0,0,6,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x60,0x10,0x20,0x78,0xc4,0x80,0x80,0x80,0xc4,0x7c, +}; + +static const BitmapCharRec ch199 = {6,10,0,3,7,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0xef,0x49,0x78,0x2e,0x28,0x39,0x1f, +}; + +static const BitmapCharRec ch198 = {8,7,0,0,9,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,10,0,0,8,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28, +}; + +static const BitmapCharRec ch196 = {7,9,0,0,8,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch195 = {7,10,0,0,8,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch194 = {7,10,0,0,8,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch193 = {7,10,0,0,8,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {7,10,0,0,8,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0xe0,0xa0,0x80,0x40,0x40,0x0,0x40, +}; + +static const BitmapCharRec ch191 = {3,7,0,2,4,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x44,0x3e,0x2c,0xd4,0x28,0x48,0xe4, +}; + +static const BitmapCharRec ch190 = {7,7,0,0,8,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x4e,0x24,0x2a,0xf6,0x48,0xc8,0x44, +}; + +static const BitmapCharRec ch189 = {7,7,0,0,8,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x44,0x3e,0x2c,0xf4,0x48,0xc8,0x44, +}; + +static const BitmapCharRec ch188 = {7,7,0,0,8,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0xa0,0x50,0x50,0xa0, +}; + +static const BitmapCharRec ch187 = {4,4,0,-1,5,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xe0,0x0,0x40,0xa0,0x40, +}; + +static const BitmapCharRec ch186 = {3,5,0,-2,4,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xe0,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {3,4,0,-3,3,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x20,0x40, +}; + +static const BitmapCharRec ch184 = {3,3,0,3,4,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0x80, +}; + +static const BitmapCharRec ch183 = {1,1,0,-2,2,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, +}; + +static const BitmapCharRec ch182 = {6,9,0,2,6,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0xe8,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch181 = {5,7,0,2,5,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,0,-5,3,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0xc0,0x20,0x40,0xe0, +}; + +static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xe0,0x40,0xa0,0x60, +}; + +static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xe0, +}; + +static const BitmapCharRec ch175 = {3,1,0,-6,4,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, +}; + +static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xe0, +}; + +static const BitmapCharRec ch173 = {3,1,0,-2,4,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x8,0x8,0xf8, +}; + +static const BitmapCharRec ch172 = {5,3,-1,-1,7,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x50,0xa0,0xa0,0x50, +}; + +static const BitmapCharRec ch171 = {4,4,0,-1,5,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xe0,0x0,0xa0,0x20,0xc0, +}; + +static const BitmapCharRec ch170 = {3,5,0,-2,4,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, +}; + +static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0, +}; + +static const BitmapCharRec ch168 = {3,1,-1,-6,5,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0xe0,0x90,0x20,0x50,0x90,0xa0,0x40,0x90,0x70, +}; + +static const BitmapCharRec ch167 = {4,9,0,1,5,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x0,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,7,0,0,2,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x70,0x20,0xf8,0x20,0xd8,0x50,0x88, +}; + +static const BitmapCharRec ch165 = {5,7,0,0,5,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x88,0x70,0x50,0x50,0x70,0x88, +}; + +static const BitmapCharRec ch164 = {5,6,0,-1,5,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xf0,0xc8,0x40,0xe0,0x40,0x50,0x30, +}; + +static const BitmapCharRec ch163 = {5,7,0,0,5,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x80,0xe0,0x90,0x80,0x90,0x70,0x10, +}; + +static const BitmapCharRec ch162 = {4,7,0,1,5,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,7,-1,2,3,ch161data}; + +/* char: 0xa0 */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,2,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,2,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x98,0x64, +}; + +static const BitmapCharRec ch126 = {6,2,0,-2,7,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0x80,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch125 = {3,9,0,2,4,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,9,0,2,2,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x20,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch123 = {3,9,0,2,4,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xf0,0x90,0x40,0x20,0xf0, +}; + +static const BitmapCharRec ch122 = {4,5,0,0,5,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x40,0x40,0x20,0x30,0x50,0x48,0xdc, +}; + +static const BitmapCharRec ch121 = {6,7,1,2,5,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0xd8,0x50,0x20,0x50,0xd8, +}; + +static const BitmapCharRec ch120 = {5,5,0,0,6,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x28,0x6c,0x54,0x92,0xdb, +}; + +static const BitmapCharRec ch119 = {8,5,0,0,8,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x60,0x50,0x90,0xd8, +}; + +static const BitmapCharRec ch118 = {5,5,0,0,5,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x68,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch117 = {5,5,0,0,5,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x30,0x40,0x40,0x40,0xe0,0x40, +}; + +static const BitmapCharRec ch116 = {4,6,0,0,4,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0xe0,0x20,0x60,0x80,0xe0, +}; + +static const BitmapCharRec ch115 = {3,5,0,0,4,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0xe0,0x40,0x40,0x60,0xa0, +}; + +static const BitmapCharRec ch114 = {3,5,0,0,4,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x38,0x10,0x70,0x90,0x90,0x90,0x70, +}; + +static const BitmapCharRec ch113 = {5,7,0,2,5,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0xc0,0x80,0xe0,0x90,0x90,0x90,0xe0, +}; + +static const BitmapCharRec ch112 = {4,7,0,2,5,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x60,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch111 = {4,5,0,0,5,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0xd8,0x90,0x90,0x90,0xe0, +}; + +static const BitmapCharRec ch110 = {5,5,0,0,5,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0xdb,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {8,5,0,0,8,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch108 = {3,7,0,0,4,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x98,0x90,0xe0,0xa0,0x90,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {5,7,0,0,5,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x80,0x40,0x40,0x40,0x40,0x40,0xc0,0x0,0x40, +}; + +static const BitmapCharRec ch106 = {2,9,0,2,3,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0x40,0x40,0x40,0x40,0xc0,0x0,0x40, +}; + +static const BitmapCharRec ch105 = {2,7,0,0,3,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0xd8,0x90,0x90,0x90,0xe0,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {5,7,0,0,5,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0xe0,0x90,0x60,0x40,0xa0,0xa0,0x70, +}; + +static const BitmapCharRec ch103 = {4,7,0,2,5,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0xe0,0x40,0x40,0x40,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch102 = {4,7,0,0,4,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x60,0x80,0xc0,0xa0,0x60, +}; + +static const BitmapCharRec ch101 = {3,5,0,0,4,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x68,0x90,0x90,0x90,0x70,0x10,0x30, +}; + +static const BitmapCharRec ch100 = {5,7,0,0,5,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x60,0x80,0x80,0x80,0x60, +}; + +static const BitmapCharRec ch99 = {3,5,0,0,4,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {4,7,0,0,5,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0xe0,0xa0,0x60,0x20,0xc0, +}; + +static const BitmapCharRec ch97 = {3,5,0,0,4,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0xc0,0x80, +}; + +static const BitmapCharRec ch96 = {2,2,0,-5,3,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xf8, +}; + +static const BitmapCharRec ch95 = {5,1,0,3,5,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0xa0,0xa0,0x40, +}; + +static const BitmapCharRec ch94 = {3,3,-1,-4,5,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch93 = {2,9,0,2,3,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x20,0x20,0x40,0x40,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {3,7,0,0,3,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, +}; + +static const BitmapCharRec ch91 = {2,9,0,2,3,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xf8,0x88,0x40,0x20,0x10,0x88,0xf8, +}; + +static const BitmapCharRec ch90 = {5,7,0,0,6,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x38,0x10,0x10,0x28,0x28,0x44,0xee, +}; + +static const BitmapCharRec ch89 = {7,7,0,0,8,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0xee,0x44,0x28,0x10,0x28,0x44,0xee, +}; + +static const BitmapCharRec ch88 = {7,7,0,0,8,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0xc9,0x80,0x88,0x80,0xdd,0xc0, +}; + +static const BitmapCharRec ch87 = {10,7,0,0,10,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x10,0x28,0x28,0x6c,0x44,0xee, +}; + +static const BitmapCharRec ch86 = {7,7,0,0,8,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee, +}; + +static const BitmapCharRec ch85 = {7,7,0,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x70,0x20,0x20,0x20,0x20,0xa8,0xf8, +}; + +static const BitmapCharRec ch84 = {5,7,0,0,6,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0xe0,0x90,0x10,0x60,0xc0,0x90,0x70, +}; + +static const BitmapCharRec ch83 = {4,7,0,0,5,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0xec,0x48,0x50,0x70,0x48,0x48,0xf0, +}; + +static const BitmapCharRec ch82 = {6,7,0,0,7,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0xc,0x18,0x70,0xcc,0x84,0x84,0x84,0xcc,0x78, +}; + +static const BitmapCharRec ch81 = {6,9,0,2,7,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0xe0,0x40,0x40,0x70,0x48,0x48,0xf0, +}; + +static const BitmapCharRec ch80 = {5,7,0,0,6,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78, +}; + +static const BitmapCharRec ch79 = {6,7,0,0,7,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0xe4,0x4c,0x4c,0x54,0x54,0x64,0xee, +}; + +static const BitmapCharRec ch78 = {7,7,0,0,8,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0xeb,0x80,0x49,0x0,0x55,0x0,0x55,0x0,0x63,0x0,0x63,0x0,0xe3,0x80, +}; + +static const BitmapCharRec ch77 = {9,7,0,0,10,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xf8,0x48,0x40,0x40,0x40,0x40,0xe0, +}; + +static const BitmapCharRec ch76 = {5,7,0,0,6,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0xec,0x48,0x50,0x60,0x50,0x48,0xec, +}; + +static const BitmapCharRec ch75 = {6,7,0,0,7,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0xc0,0xa0,0x20,0x20,0x20,0x20,0x70, +}; + +static const BitmapCharRec ch74 = {4,7,0,0,4,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0, +}; + +static const BitmapCharRec ch73 = {3,7,0,0,4,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0xee,0x44,0x44,0x7c,0x44,0x44,0xee, +}; + +static const BitmapCharRec ch72 = {7,7,0,0,8,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x78,0xc4,0x84,0x9c,0x80,0xc4,0x7c, +}; + +static const BitmapCharRec ch71 = {6,7,0,0,7,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0xe0,0x40,0x40,0x70,0x40,0x48,0xf8, +}; + +static const BitmapCharRec ch70 = {5,7,0,0,6,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8, +}; + +static const BitmapCharRec ch69 = {5,7,0,0,6,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xf8,0x4c,0x44,0x44,0x44,0x4c,0xf8, +}; + +static const BitmapCharRec ch68 = {6,7,0,0,7,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x78,0xc4,0x80,0x80,0x80,0xc4,0x7c, +}; + +static const BitmapCharRec ch67 = {6,7,0,0,7,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xf0,0x48,0x48,0x70,0x48,0x48,0xf0, +}; + +static const BitmapCharRec ch66 = {5,7,0,0,6,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10, +}; + +static const BitmapCharRec ch65 = {7,7,0,0,8,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3e,0x40,0x92,0xad,0xa5,0xa5,0x9d,0x42,0x3c, +}; + +static const BitmapCharRec ch64 = {8,9,0,2,9,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x40,0x0,0x40,0x40,0x20,0xa0,0xe0, +}; + +static const BitmapCharRec ch63 = {3,7,0,0,4,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {3,5,0,0,5,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xf8,0x0,0xf8, +}; + +static const BitmapCharRec ch61 = {5,3,0,-1,6,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x20,0x40,0x80,0x40,0x20, +}; + +static const BitmapCharRec ch60 = {3,5,-1,0,5,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x80,0x80,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch59 = {1,7,-1,2,3,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x80,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch58 = {1,5,-1,0,3,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0xc0,0x20,0x70,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch57 = {4,7,0,0,5,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x60,0x90,0x90,0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch56 = {4,7,0,0,5,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x40,0x20,0x20,0x90,0xf0, +}; + +static const BitmapCharRec ch55 = {4,7,0,0,5,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x60,0x90,0x90,0x90,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch54 = {4,7,0,0,5,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0xe0,0x90,0x10,0x10,0xe0,0x40,0x70, +}; + +static const BitmapCharRec ch53 = {4,7,0,0,5,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x10,0x10,0xf8,0x90,0x50,0x30,0x10, +}; + +static const BitmapCharRec ch52 = {5,7,0,0,5,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0xe0,0x10,0x10,0x60,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch51 = {4,7,0,0,5,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xf0,0x40,0x20,0x20,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch50 = {4,7,0,0,5,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xe0,0x40,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch49 = {3,7,-1,0,5,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x60,0x90,0x90,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch48 = {4,7,0,0,5,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x40,0x40,0x20,0x20, +}; + +static const BitmapCharRec ch47 = {3,7,0,0,3,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x80, +}; + +static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xf0, +}; + +static const BitmapCharRec ch45 = {4,1,-1,-2,7,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x80,0x80, +}; + +static const BitmapCharRec ch44 = {1,3,-1,2,3,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,0,0,6,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0xa0,0x40,0xa0, +}; + +static const BitmapCharRec ch42 = {3,3,0,-4,5,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,9,0,2,4,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,9,0,2,4,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x40,0xc0, +}; + +static const BitmapCharRec ch39 = {2,2,0,-5,3,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x76,0x8d,0x98,0x74,0x6e,0x50,0x30, +}; + +static const BitmapCharRec ch38 = {8,7,0,0,8,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x44,0x2a,0x2a,0x56,0xa8,0xa4,0x7e, +}; + +static const BitmapCharRec ch37 = {7,7,0,0,8,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0xe0,0x90,0x10,0x60,0x80,0x90,0x70,0x20, +}; + +static const BitmapCharRec ch36 = {4,9,0,1,5,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x50,0x50,0xf8,0x50,0xf8,0x50,0x50, +}; + +static const BitmapCharRec ch35 = {5,7,0,0,5,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0xa0,0xa0, +}; + +static const BitmapCharRec ch34 = {3,2,0,-5,4,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,7,-1,0,3,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,2,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,2,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmapTimesRoman10 = { +"-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_tr24.cpp b/xc/extras/Mesa/src-glut.beos/glut_tr24.cpp new file mode 100644 index 000000000..5ae5d413c --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_tr24.cpp @@ -0,0 +1,2059 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutbitmap.h" + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, +0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, +0xf1,0xe0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch255 = {11,21,0,5,11,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, +0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0xe0,0x0, +}; + +static const BitmapCharRec ch254 = {10,22,-1,5,12,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, +0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, +0xf1,0xe0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80,0x1,0x80, +}; + +static const BitmapCharRec ch253 = {11,22,0,5,11,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch252 = {11,16,-1,0,13,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, +0xc,0x0, +}; + +static const BitmapCharRec ch251 = {11,17,-1,0,13,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, +0x1,0x80, +}; + +static const BitmapCharRec ch250 = {11,17,-1,0,13,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, +0x30,0x0, +}; + +static const BitmapCharRec ch249 = {11,17,-1,0,13,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0xc0,0x0,0xde,0x0,0x73,0x80,0x71,0x80,0xd0,0xc0,0xd8,0xc0,0xc8,0xc0,0xcc,0xc0, +0xc4,0xc0,0xc6,0xc0,0x63,0x80,0x73,0x80,0x1e,0xc0,0x0,0xc0, +}; + +static const BitmapCharRec ch248 = {10,14,-1,1,12,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0, +0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch247 = {12,10,-1,-2,14,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch246 = {10,16,-1,0,12,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, +}; + +static const BitmapCharRec ch245 = {10,16,-1,0,12,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, +0xc,0x0, +}; + +static const BitmapCharRec ch244 = {10,17,-1,0,12,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, +0x1,0x80, +}; + +static const BitmapCharRec ch243 = {10,17,-1,0,12,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, +0x30,0x0, +}; + +static const BitmapCharRec ch242 = {10,17,-1,0,12,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, +}; + +static const BitmapCharRec ch241 = {11,16,-1,0,13,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1f,0x0,0xc6,0x0,0x3c,0x0,0x1e,0x0,0x71,0x80, +0xc0,0x0, +}; + +static const BitmapCharRec ch240 = {10,17,-1,0,12,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x0,0xcc,0xcc, +}; + +static const BitmapCharRec ch239 = {6,16,0,0,6,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x84,0x48,0x78, +0x30, +}; + +static const BitmapCharRec ch238 = {6,17,0,0,6,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x80,0x60,0x38, +0x18, +}; + +static const BitmapCharRec ch237 = {5,17,-1,0,6,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x8,0x30,0xe0, +0xc0, +}; + +static const BitmapCharRec ch236 = {5,17,0,0,6,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch235 = {9,16,-1,0,11,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, +0xc,0x0, +}; + +static const BitmapCharRec ch234 = {9,17,-1,0,11,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, +0x3,0x0, +}; + +static const BitmapCharRec ch233 = {9,17,-1,0,11,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, +0x60,0x0, +}; + +static const BitmapCharRec ch232 = {9,17,-1,0,11,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x3c,0x0,0x66,0x0,0x6,0x0,0x1e,0x0,0x18,0x0,0x8,0x0,0x1e,0x0,0x7f,0x0, +0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x41,0x80, +0x63,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch231 = {9,18,-1,6,11,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x70,0xf0,0xfb,0xf8,0xc7,0x84,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0xfc, +0x3,0xc,0x63,0xc,0x67,0x98,0x3c,0xf0, +}; + +static const BitmapCharRec ch230 = {14,12,-1,0,16,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x1c,0x0,0x22,0x0,0x22,0x0, +0x1c,0x0, +}; + +static const BitmapCharRec ch229 = {9,17,-1,0,11,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x66,0x0,0x66,0x0, +}; + +static const BitmapCharRec ch228 = {9,16,-1,0,11,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x5c,0x0,0x3a,0x0, +}; + +static const BitmapCharRec ch227 = {9,16,-1,0,11,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x42,0x0,0x24,0x0,0x3c,0x0, +0x18,0x0, +}; + +static const BitmapCharRec ch226 = {9,17,-1,0,11,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, +0x3,0x0, +}; + +static const BitmapCharRec ch225 = {9,17,-1,0,11,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, +0x60,0x0, +}; + +static const BitmapCharRec ch224 = {9,17,-1,0,11,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xe7,0x0,0x6c,0x80,0x6c,0xc0,0x60,0xc0,0x60,0xc0,0x61,0xc0,0x61,0x80,0x63,0x80, +0x67,0x0,0x6c,0x0,0x63,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, +0x1e,0x0, +}; + +static const BitmapCharRec ch223 = {10,17,-1,0,12,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18, +0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70,0x3f,0xc0,0x30,0x0,0x30,0x0,0x30,0x0, +0xfc,0x0, +}; + +static const BitmapCharRec ch222 = {13,17,-1,0,15,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, +0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, +0xfc,0x3f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, +}; + +static const BitmapCharRec ch221 = {16,22,0,0,16,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x0,0x0,0x6,0x30,0x6,0x30, +}; + +static const BitmapCharRec ch220 = {16,21,-1,0,18,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, +}; + +static const BitmapCharRec ch219 = {16,22,-1,0,18,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, +}; + +static const BitmapCharRec ch218 = {16,22,-1,0,18,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch217 = {16,22,-1,0,18,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x20,0x0,0x27,0xe0,0x1c,0x38,0x38,0x1c,0x68,0x6,0x64,0x6,0xc2,0x3,0xc2,0x3, +0xc1,0x3,0xc1,0x3,0xc0,0x83,0xc0,0x83,0xc0,0x43,0x60,0x46,0x60,0x26,0x38,0x1c, +0x1c,0x38,0x7,0xe4,0x0,0x4, +}; + +static const BitmapCharRec ch216 = {16,19,-1,1,18,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x80,0x40,0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0, +0x61,0x80,0xc0,0xc0,0x80,0x40, +}; + +static const BitmapCharRec ch215 = {10,11,-2,-1,14,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x0,0x0,0x6,0x60,0x6,0x60, +}; + +static const BitmapCharRec ch214 = {16,21,-1,0,18,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, +}; + +static const BitmapCharRec ch213 = {16,21,-1,0,18,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, +}; + +static const BitmapCharRec ch212 = {16,22,-1,0,18,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, +}; + +static const BitmapCharRec ch211 = {16,22,-1,0,18,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch210 = {16,22,-1,0,18,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, +0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, +0xf0,0x1f,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, +}; + +static const BitmapCharRec ch209 = {16,21,-1,0,18,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x7f,0xe0,0x18,0x38,0x18,0x1c,0x18,0x6,0x18,0x6,0x18,0x3,0x18,0x3,0x18,0x3, +0xff,0x3,0x18,0x3,0x18,0x3,0x18,0x3,0x18,0x6,0x18,0x6,0x18,0x1c,0x18,0x38, +0x7f,0xe0, +}; + +static const BitmapCharRec ch208 = {16,17,0,0,17,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc,0x0,0x0,0xcc,0xcc, +}; + +static const BitmapCharRec ch207 = {6,21,-1,0,8,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x7e,0x0,0x81,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch206 = {8,22,-1,0,8,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc,0x0,0x40,0x30,0x1c,0xc, +}; + +static const BitmapCharRec ch205 = {6,22,-1,0,8,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc,0x0,0x8,0x30,0xe0,0xc0, +}; + +static const BitmapCharRec ch204 = {6,22,-1,0,8,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x0,0x0,0x19,0x80,0x19,0x80, +}; + +static const BitmapCharRec ch203 = {13,21,-1,0,15,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x10,0x20,0xc,0xc0,0x7,0x80,0x3,0x0, +}; + +static const BitmapCharRec ch202 = {13,22,-1,0,15,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x4,0x0,0x3,0x0,0x1,0xc0,0x0,0xc0, +}; + +static const BitmapCharRec ch201 = {13,22,-1,0,15,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x1,0x0,0x6,0x0,0x1c,0x0,0x18,0x0, +}; + +static const BitmapCharRec ch200 = {13,22,-1,0,15,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x7,0x80,0xc,0xc0,0x0,0xc0,0x3,0xc0,0x3,0x0,0x1,0x0,0x7,0xe0,0x1e,0x38, +0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c,0x7,0xe4, +}; + +static const BitmapCharRec ch199 = {14,23,-1,6,16,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0xf9,0xff,0xf0,0x30,0x60,0x30,0x10,0x60,0x10,0x10,0x60,0x10,0x18,0x60,0x0,0x8, +0x60,0x0,0xf,0xe0,0x80,0xc,0x60,0x80,0x4,0x7f,0x80,0x4,0x60,0x80,0x6,0x60, +0x80,0x2,0x60,0x0,0x2,0x60,0x0,0x1,0x60,0x20,0x1,0x60,0x20,0x1,0xe0,0x60, +0x3,0xff,0xe0, +}; + +static const BitmapCharRec ch198 = {20,17,0,0,21,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x1,0xc0,0x0,0x2,0x20,0x0,0x2,0x20,0x0,0x1,0xc0,0x0, +}; + +static const BitmapCharRec ch197 = {17,21,0,0,17,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x30,0x0,0x6,0x30,0x0, +}; + +static const BitmapCharRec ch196 = {17,21,0,0,17,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0xfc,0x1f,0x80,0x30,0x7,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xe0,0x0,0x3,0x90,0x0, +}; + +static const BitmapCharRec ch195 = {17,21,0,0,17,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x8,0x10,0x0,0x6,0x60,0x0,0x3,0xc0,0x0,0x1, +0x80,0x0, +}; + +static const BitmapCharRec ch194 = {17,22,0,0,17,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xc0,0x0,0x0,0x70,0x0,0x0, +0x30,0x0, +}; + +static const BitmapCharRec ch193 = {17,22,0,0,17,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0xc0,0x0,0x3,0x80,0x0,0x3, +0x0,0x0, +}; + +static const BitmapCharRec ch192 = {17,22,0,0,17,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x3e,0x63,0xc1,0xc3,0xc3,0xe0,0x70,0x30,0x38,0x18,0x18,0x8,0x8,0x0,0x0,0xc, +0xc, +}; + +static const BitmapCharRec ch191 = {8,17,-1,5,11,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x18,0x2,0x0,0x8,0x2,0x0,0xc,0x7f,0x80,0x4,0x22,0x0,0x6,0x32,0x0,0x3, +0x12,0x0,0x1,0xa,0x0,0x71,0x8e,0x0,0x88,0x86,0x0,0x8c,0xc2,0x0,0xc,0x60, +0x0,0x8,0x20,0x0,0x30,0x30,0x0,0x8,0x10,0x0,0x8c,0x18,0x0,0x4c,0xc,0x0, +0x38,0x4,0x0, +}; + +static const BitmapCharRec ch190 = {17,17,0,0,18,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x30,0x7e,0x10,0x22,0x18,0x10,0x8,0x18,0xc,0x8,0x6,0x4,0x2,0x6,0xfb,0x46, +0x21,0x26,0x21,0x9c,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, +0x20,0x8, +}; + +static const BitmapCharRec ch189 = {15,17,-1,0,18,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x30,0x4,0x10,0x4,0x18,0xff,0x8,0x44,0xc,0x64,0x6,0x24,0x2,0x14,0xfb,0x1c, +0x21,0xc,0x21,0x84,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, +0x20,0x8, +}; + +static const BitmapCharRec ch188 = {16,17,-1,0,18,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x88,0x0,0xcc,0x0,0x66,0x0,0x33,0x0,0x19,0x80,0x19,0x80,0x33,0x0,0x66,0x0, +0xcc,0x0,0x88,0x0, +}; + +static const BitmapCharRec ch187 = {9,10,-2,-1,12,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xfc,0x0,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0x78, +}; + +static const BitmapCharRec ch186 = {6,9,-1,-8,8,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, +}; + +static const BitmapCharRec ch185 = {5,10,-1,-7,7,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0x78,0xcc,0xc,0x3c,0x30,0x10, +}; + +static const BitmapCharRec ch184 = {6,6,-1,6,8,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch183 = {2,2,-2,-6,6,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0, +0x9,0x0,0x9,0x0,0x9,0x0,0x19,0x0,0x39,0x0,0x79,0x0,0x79,0x0,0xf9,0x0, +0xf9,0x0,0xf9,0x0,0x79,0x0,0x79,0x0,0x39,0x0,0x1f,0x80, +}; + +static const BitmapCharRec ch182 = {9,22,-1,5,11,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x40,0x0,0xe0,0x0,0xc0,0x0,0x40,0x0,0x40,0x0,0x5c,0xe0,0x7e,0xc0,0x71,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0xe1,0xc0, +}; + +static const BitmapCharRec ch181 = {11,17,-1,5,13,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x60,0x38,0x18, +}; + +static const BitmapCharRec ch180 = {5,4,-2,-13,8,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x70,0x88,0x8c,0xc,0x8,0x30,0x8,0x8c,0x4c,0x38, +}; + +static const BitmapCharRec ch179 = {6,10,0,-7,7,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xfc,0x44,0x20,0x30,0x10,0x8,0xc,0x8c,0x4c,0x38, +}; + +static const BitmapCharRec ch178 = {6,10,0,-7,7,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xff,0xf0,0xff,0xf0,0x0,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +0xff,0xf0,0xff,0xf0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch177 = {12,15,-1,0,14,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x38,0x44,0x82,0x82,0x82,0x44,0x38, +}; + +static const BitmapCharRec ch176 = {7,7,-1,-10,9,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xfc,0xfc, +}; + +static const BitmapCharRec ch175 = {6,2,-1,-14,8,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x60,0x3,0x0,0x47,0x19,0x0,0xc2, +0x31,0x80,0x82,0x20,0x80,0x82,0x40,0x80,0x83,0xe0,0x80,0x82,0x30,0x80,0x82,0x10, +0x80,0xc2,0x11,0x80,0x42,0x31,0x0,0x67,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, +0x7,0xf0,0x0, +}; + +static const BitmapCharRec ch174 = {17,17,-1,0,19,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xfe,0xfe, +}; + +static const BitmapCharRec ch173 = {7,2,-1,-5,9,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0xff,0xf0,0xff,0xf0, +}; + +static const BitmapCharRec ch172 = {12,7,-1,-3,14,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x8,0x80,0x19,0x80,0x33,0x0,0x66,0x0,0xcc,0x0,0xcc,0x0,0x66,0x0,0x33,0x0, +0x19,0x80,0x8,0x80, +}; + +static const BitmapCharRec ch171 = {9,10,-2,-1,13,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0x7e,0x0,0x76,0xcc,0xcc,0x7c,0xc,0xcc,0x78, +}; + +static const BitmapCharRec ch170 = {7,9,0,-8,8,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x61,0xc3,0x0,0x47,0x71,0x0,0xc4, +0x19,0x80,0x8c,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x8c,0x0, +0x80,0xc4,0x19,0x80,0x47,0x31,0x0,0x61,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, +0x7,0xf0,0x0, +}; + +static const BitmapCharRec ch169 = {17,17,-1,0,19,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xcc,0xcc, +}; + +static const BitmapCharRec ch168 = {6,2,-1,-14,8,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x38,0x64,0x62,0x6,0xe,0x1c,0x38,0x74,0xe2,0xc3,0x83,0x87,0x4e,0x3c,0x38,0x70, +0x60,0x46,0x26,0x1c, +}; + +static const BitmapCharRec ch167 = {8,20,-2,2,12,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch166 = {2,17,-2,0,6,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x1f,0xe0,0x3,0x0,0x1f,0xe0, +0x3,0x0,0x7,0x80,0xc,0x80,0xc,0xc0,0x18,0x40,0x18,0x60,0x30,0x20,0x70,0x30, +0xf8,0x7c, +}; + +static const BitmapCharRec ch165 = {14,17,0,0,14,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0xc0,0x60,0xee,0xe0,0x7f,0xc0,0x31,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x31,0x80,0x7f,0xc0,0xee,0xe0,0xc0,0x60, +}; + +static const BitmapCharRec ch164 = {11,12,-1,-3,13,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xe7,0x80,0xbe,0xc0,0x78,0x40,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0x30,0x0,0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x31,0x80,0x19,0x80, +0xf,0x0, +}; + +static const BitmapCharRec ch163 = {10,17,-1,0,12,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x0,0x40,0x0,0x3e,0x0,0x7f,0x0,0x70,0x80,0xd0,0x0,0xc8,0x0,0xc8,0x0, +0xc8,0x0,0xc4,0x0,0xc4,0x0,0x43,0x80,0x63,0x80,0x1f,0x0,0x1,0x0,0x1,0x0, +}; + +static const BitmapCharRec ch162 = {9,16,-1,2,12,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch161 = {2,17,-4,5,8,ch161data}; + +/* char: 0xa0 */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,6,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,6,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x83,0x80,0xc7,0xc0,0x7c,0x60,0x38,0x20, +}; + +static const BitmapCharRec ch126 = {11,4,-1,-5,13,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xe0,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x8,0xc,0x4,0x3,0x4,0xc,0x8,0x18, +0x18,0x18,0x18,0x18,0x30,0xe0, +}; + +static const BitmapCharRec ch125 = {8,22,-1,5,10,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch124 = {2,17,-2,0,6,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x7,0xc,0x18,0x18,0x18,0x18,0x18,0x18,0x10,0x30,0x20,0xc0,0x20,0x30,0x10,0x18, +0x18,0x18,0x18,0x18,0xc,0x7, +}; + +static const BitmapCharRec ch123 = {8,22,-1,5,10,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xff,0xc3,0x61,0x70,0x30,0x38,0x18,0x1c,0xe,0x86,0xc3,0xff, +}; + +static const BitmapCharRec ch122 = {8,12,-1,0,10,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, +0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, +0xf1,0xe0, +}; + +static const BitmapCharRec ch121 = {11,17,0,5,11,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0xf1,0xe0,0x60,0xc0,0x21,0x80,0x33,0x80,0x1b,0x0,0xe,0x0,0xc,0x0,0x1a,0x0, +0x39,0x0,0x31,0x80,0x60,0xc0,0xf1,0xe0, +}; + +static const BitmapCharRec ch120 = {11,12,-1,0,13,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x4,0x10,0x0,0xe,0x38,0x0,0xe,0x38,0x0,0x1a,0x28,0x0,0x1a,0x64,0x0,0x19, +0x64,0x0,0x31,0x64,0x0,0x30,0xc2,0x0,0x30,0xc2,0x0,0x60,0xc2,0x0,0x60,0xc3, +0x0,0xf1,0xe7,0x80, +}; + +static const BitmapCharRec ch119 = {17,12,0,0,17,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x4,0x0,0xe,0x0,0xe,0x0,0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80, +0x30,0x80,0x60,0x80,0x60,0xc0,0xf1,0xe0, +}; + +static const BitmapCharRec ch118 = {11,12,0,0,11,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0, +}; + +static const BitmapCharRec ch117 = {11,12,-1,0,13,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x1c,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x70,0x30,0x10, +}; + +static const BitmapCharRec ch116 = {7,15,0,0,7,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0xf8,0xc6,0x83,0x3,0x7,0x1e,0x7c,0x70,0xe0,0xc2,0x66,0x3e, +}; + +static const BitmapCharRec ch115 = {8,12,-1,0,10,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x76,0x6e,0xe6, +}; + +static const BitmapCharRec ch114 = {7,12,-1,0,8,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x3,0xc0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1d,0x80,0x73,0x80,0x61,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x73,0x80, +0x1d,0x80, +}; + +static const BitmapCharRec ch113 = {10,17,-1,5,12,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, +0xee,0x0, +}; + +static const BitmapCharRec ch112 = {10,17,-1,5,12,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0, +}; + +static const BitmapCharRec ch111 = {10,12,-1,0,12,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0, +}; + +static const BitmapCharRec ch110 = {11,12,-1,0,13,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0xf1,0xe3,0xc0,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60, +0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x71,0xe3,0x80,0x6f,0x9f, +0x0,0xe7,0xe,0x0, +}; + +static const BitmapCharRec ch109 = {18,12,-1,0,20,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, +0xe0, +}; + +static const BitmapCharRec ch108 = {4,17,-1,0,6,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0xf3,0xe0,0x61,0xc0,0x63,0x80,0x67,0x0,0x6e,0x0,0x6c,0x0,0x78,0x0,0x68,0x0, +0x64,0x0,0x66,0x0,0x63,0x0,0x67,0xc0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, +0xe0,0x0, +}; + +static const BitmapCharRec ch107 = {11,17,-1,0,12,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0xc0,0xe0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0x70,0x0,0x0,0x0,0x30,0x30, +}; + +static const BitmapCharRec ch106 = {4,22,0,5,6,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x0,0x0,0x60, +0x60, +}; + +static const BitmapCharRec ch105 = {4,17,-1,0,6,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x71,0xc0,0x6f,0x80,0x67,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, +0xe0,0x0, +}; + +static const BitmapCharRec ch104 = {11,17,-1,0,13,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x3f,0x0,0xf1,0xc0,0xc0,0x60,0xc0,0x20,0x60,0x60,0x3f,0xc0,0x7f,0x0,0x60,0x0, +0x30,0x0,0x3e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, +0x1f,0xc0, +}; + +static const BitmapCharRec ch103 = {11,17,-1,5,12,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x30,0x30,0x30,0x16, +0xe, +}; + +static const BitmapCharRec ch102 = {7,17,0,0,7,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0, +}; + +static const BitmapCharRec ch101 = {9,12,-1,0,11,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x1e,0xc0,0x73,0x80,0x61,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80, +0xc1,0x80,0x61,0x80,0x73,0x80,0x1d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, +0x3,0x80, +}; + +static const BitmapCharRec ch100 = {10,17,-1,0,12,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0x41,0x80,0x63,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch99 = {9,12,-1,0,11,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0x5e,0x0,0x73,0x80,0x61,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x61,0x80,0x73,0x80,0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, +0xe0,0x0, +}; + +static const BitmapCharRec ch98 = {10,17,-1,0,12,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0, +}; + +static const BitmapCharRec ch97 = {9,12,-1,0,11,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x60,0xe0,0x80,0xc0,0x60, +}; + +static const BitmapCharRec ch96 = {3,5,-2,-12,7,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xff,0xf8,0xff,0xf8, +}; + +static const BitmapCharRec ch95 = {13,2,0,5,13,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x80,0x80,0xc1,0x80,0x41,0x0,0x63,0x0,0x22,0x0,0x36,0x0,0x14,0x0,0x1c,0x0, +0x8,0x0, +}; + +static const BitmapCharRec ch94 = {9,9,-1,-8,11,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0xf8, +}; + +static const BitmapCharRec ch93 = {5,21,-1,4,8,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x6,0x6,0x4,0xc,0xc,0x8,0x18,0x18,0x10,0x30,0x30,0x20,0x60,0x60,0x40,0xc0, +0xc0, +}; + +static const BitmapCharRec ch92 = {7,17,0,0,7,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0xc0,0xc0,0xf8, +}; + +static const BitmapCharRec ch91 = {5,21,-2,4,8,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xff,0xf8,0xe0,0x18,0x70,0x8,0x30,0x8,0x38,0x0,0x18,0x0,0x1c,0x0,0xe,0x0, +0x6,0x0,0x7,0x0,0x3,0x0,0x3,0x80,0x1,0xc0,0x80,0xc0,0x80,0xe0,0xc0,0x70, +0xff,0xf0, +}; + +static const BitmapCharRec ch90 = {13,17,-1,0,15,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, +0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, +0xfc,0x3f, +}; + +static const BitmapCharRec ch89 = {16,17,0,0,16,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0xfc,0xf,0xc0,0x30,0x3,0x80,0x18,0x7,0x0,0x8,0xe,0x0,0x4,0xc,0x0,0x6, +0x18,0x0,0x2,0x38,0x0,0x1,0x70,0x0,0x0,0xe0,0x0,0x0,0xc0,0x0,0x1,0xc0, +0x0,0x3,0xa0,0x0,0x3,0x10,0x0,0x6,0x8,0x0,0xe,0xc,0x0,0x1c,0x6,0x0, +0x7e,0xf,0x80, +}; + +static const BitmapCharRec ch88 = {18,17,0,0,18,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x1,0x83,0x0,0x1,0x83,0x0,0x1,0x83,0x80,0x3,0x87,0x80,0x3,0x46,0x80,0x3, +0x46,0xc0,0x6,0x46,0x40,0x6,0x4c,0x40,0x6,0x4c,0x60,0xc,0x2c,0x60,0xc,0x2c, +0x20,0x18,0x2c,0x20,0x18,0x18,0x30,0x18,0x18,0x10,0x30,0x18,0x10,0x30,0x18,0x18, +0xfc,0x7e,0x7e, +}; + +static const BitmapCharRec ch87 = {23,17,0,0,23,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x1,0x80,0x0,0x1,0x80,0x0,0x1,0x80,0x0,0x3,0xc0,0x0,0x3,0x40,0x0,0x3, +0x60,0x0,0x6,0x20,0x0,0x6,0x20,0x0,0x6,0x30,0x0,0xc,0x10,0x0,0xc,0x18, +0x0,0x18,0x8,0x0,0x18,0x8,0x0,0x18,0xc,0x0,0x30,0x4,0x0,0x30,0x6,0x0, +0xfc,0x1f,0x80, +}; + +static const BitmapCharRec ch86 = {17,17,0,0,17,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f, +}; + +static const BitmapCharRec ch85 = {16,17,-1,0,18,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0, +0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x83,0x4,0x83,0x4,0xc3,0xc, +0xff,0xfc, +}; + +static const BitmapCharRec ch84 = {14,17,-1,0,16,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x9e,0x0,0xf1,0x80,0xc0,0xc0,0x80,0x60,0x80,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0, +0xf,0x80,0x1e,0x0,0x78,0x0,0xe0,0x0,0xc0,0x40,0xc0,0x40,0xc0,0xc0,0x63,0xc0, +0x1e,0x40, +}; + +static const BitmapCharRec ch83 = {11,17,-1,0,13,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0xfc,0x1e,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0x60,0x30,0xc0,0x31,0xc0,0x33,0x80, +0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x38,0x30,0x18,0x30,0x38,0x30,0x30,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch82 = {15,17,-1,0,16,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x0,0xf,0x0,0x38,0x0,0x70,0x0,0xe0,0x1,0xc0,0x7,0xe0,0x1c,0x38,0x38,0x1c, +0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38,0x7,0xe0, +}; + +static const BitmapCharRec ch81 = {16,22,-1,5,18,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch80 = {13,17,-1,0,15,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0, +}; + +static const BitmapCharRec ch79 = {16,17,-1,0,18,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, +0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, +0xf0,0x1f, +}; + +static const BitmapCharRec ch78 = {16,17,-1,0,18,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0xf8,0x21,0xf8,0x20,0x60,0x60,0x20,0x60,0x60,0x20,0xd0,0x60,0x20,0xd0,0x60,0x21, +0x88,0x60,0x21,0x88,0x60,0x23,0x8,0x60,0x23,0x4,0x60,0x26,0x4,0x60,0x26,0x2, +0x60,0x2c,0x2,0x60,0x2c,0x2,0x60,0x38,0x1,0x60,0x38,0x1,0x60,0x30,0x0,0xe0, +0xf0,0x0,0xf8, +}; + +static const BitmapCharRec ch77 = {21,17,-1,0,22,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0xfc,0x0, +}; + +static const BitmapCharRec ch76 = {13,17,-1,0,14,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0xfc,0x1f,0x30,0xe,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0xe0,0x31,0xc0,0x33,0x80, +0x3f,0x0,0x3e,0x0,0x33,0x0,0x31,0x80,0x30,0xc0,0x30,0x60,0x30,0x30,0x30,0x18, +0xfc,0x7e, +}; + +static const BitmapCharRec ch75 = {16,17,-1,0,17,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x78,0x0,0xcc,0x0,0xc6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +0x1f,0x80, +}; + +static const BitmapCharRec ch74 = {9,17,-1,0,11,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc, +}; + +static const BitmapCharRec ch73 = {6,17,-1,0,8,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30, +0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x3f,0xfe,0x0,0x30,0x6,0x0,0x30,0x6, +0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0, +0xfc,0x1f,0x80, +}; + +static const BitmapCharRec ch72 = {17,17,-1,0,19,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x7,0xe0,0x1e,0x38,0x38,0x1c,0x60,0xc,0x60,0xc,0xc0,0xc,0xc0,0xc,0xc0,0x3f, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, +0x7,0xe4, +}; + +static const BitmapCharRec ch71 = {16,17,-1,0,18,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x20,0x30,0x20, +0x3f,0xe0,0x30,0x20,0x30,0x20,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0, +}; + +static const BitmapCharRec ch70 = {12,17,-1,0,14,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0, +}; + +static const BitmapCharRec ch69 = {13,17,-1,0,15,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xff,0xc0,0x30,0x70,0x30,0x38,0x30,0xc,0x30,0xc,0x30,0x6,0x30,0x6,0x30,0x6, +0x30,0x6,0x30,0x6,0x30,0x6,0x30,0x6,0x30,0xc,0x30,0xc,0x30,0x38,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch68 = {15,17,-1,0,17,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x7,0xe0,0x1e,0x38,0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, +0x7,0xe4, +}; + +static const BitmapCharRec ch67 = {14,17,-1,0,16,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xff,0xe0,0x30,0x78,0x30,0x18,0x30,0xc,0x30,0xc,0x30,0xc,0x30,0x18,0x30,0x38, +0x3f,0xe0,0x30,0x40,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch66 = {14,17,-1,0,16,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0, +}; + +static const BitmapCharRec ch65 = {17,17,0,0,17,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3,0xf0,0x0,0xe,0xc,0x0,0x18,0x0,0x0,0x30,0x0,0x0,0x61,0xde,0x0,0x63, +0x7b,0x0,0xc6,0x39,0x80,0xc6,0x18,0x80,0xc6,0x18,0xc0,0xc6,0x18,0x40,0xc6,0xc, +0x40,0xc3,0xc,0x40,0xc3,0x8c,0x40,0xe1,0xfc,0x40,0x60,0xec,0xc0,0x70,0x0,0x80, +0x38,0x1,0x80,0x1c,0x3,0x0,0xf,0xe,0x0,0x3,0xf8,0x0, +}; + +static const BitmapCharRec ch64 = {18,20,-2,3,22,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x30,0x30,0x0,0x0,0x10,0x10,0x10,0x18,0x18,0xc,0xe,0x7,0xc3,0xc3,0x83,0xc6, +0x7c, +}; + +static const BitmapCharRec ch63 = {8,17,-2,0,11,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0xc0,0x0,0x70,0x0,0x1c,0x0,0x7,0x0,0x1,0xc0,0x0,0x60,0x1,0xc0,0x7,0x0, +0x1c,0x0,0x70,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch62 = {11,11,-1,-1,13,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0, +}; + +static const BitmapCharRec ch61 = {12,6,-1,-4,14,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x0,0x60,0x1,0xc0,0x7,0x0,0x1c,0x0,0x70,0x0,0xc0,0x0,0x70,0x0,0x1c,0x0, +0x7,0x0,0x1,0xc0,0x0,0x60, +}; + +static const BitmapCharRec ch60 = {11,11,-1,-1,13,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0xc0,0x60,0x20,0xe0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch59 = {3,14,-2,3,7,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch58 = {2,11,-2,0,6,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0xf0,0x0,0x1c,0x0,0x6,0x0,0x3,0x0,0x3,0x80,0x1,0x80,0x1d,0x80,0x73,0xc0, +0x61,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0x61,0x80,0x77,0x80, +0x1e,0x0, +}; + +static const BitmapCharRec ch57 = {10,17,-1,0,12,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x1e,0x0,0x73,0x80,0xe1,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x41,0xc0,0x61,0x80, +0x37,0x0,0x1e,0x0,0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, +0x1e,0x0, +}; + +static const BitmapCharRec ch56 = {10,17,-1,0,12,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x18,0x0,0x18,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0x4,0x0,0x6,0x0,0x6,0x0, +0x2,0x0,0x3,0x0,0x3,0x0,0x1,0x0,0x1,0x80,0x81,0x80,0xc0,0xc0,0xff,0xc0, +0x7f,0xc0, +}; + +static const BitmapCharRec ch55 = {10,17,-1,0,12,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x1e,0x0,0x7b,0x80,0x61,0x80,0xe0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc1,0x80,0xf3,0x80,0xee,0x0,0x60,0x0,0x70,0x0,0x30,0x0,0x18,0x0,0xe,0x0, +0x3,0xc0, +}; + +static const BitmapCharRec ch54 = {10,17,-1,0,12,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x7e,0x0,0xe3,0x80,0xc1,0x80,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x1,0xc0, +0x3,0x80,0xf,0x80,0x7e,0x0,0x78,0x0,0x60,0x0,0x20,0x0,0x20,0x0,0x1f,0x80, +0x1f,0xc0, +}; + +static const BitmapCharRec ch53 = {10,17,-1,0,12,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0xff,0xc0,0xff,0xc0,0xc3,0x0,0x43,0x0, +0x63,0x0,0x23,0x0,0x33,0x0,0x13,0x0,0x1b,0x0,0xb,0x0,0x7,0x0,0x7,0x0, +0x3,0x0, +}; + +static const BitmapCharRec ch52 = {10,17,-1,0,12,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x78,0x0,0xe6,0x0,0xc3,0x0,0x1,0x0,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0x80, +0x7,0x0,0x1e,0x0,0xc,0x0,0x6,0x0,0x83,0x0,0x83,0x0,0x47,0x0,0x7e,0x0, +0x1c,0x0, +}; + +static const BitmapCharRec ch51 = {9,17,-1,0,12,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xff,0x80,0xff,0xc0,0x60,0x40,0x30,0x0,0x18,0x0,0xc,0x0,0x4,0x0,0x6,0x0, +0x3,0x0,0x3,0x0,0x1,0x80,0x1,0x80,0x81,0x80,0x81,0x80,0x43,0x80,0x7f,0x0, +0x1c,0x0, +}; + +static const BitmapCharRec ch50 = {10,17,-1,0,12,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x18, +0x8, +}; + +static const BitmapCharRec ch49 = {8,17,-2,0,12,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0xe1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x61,0x80,0x61,0x80,0x33,0x0, +0x1e,0x0, +}; + +static const BitmapCharRec ch48 = {10,17,-1,0,12,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0xc0,0xc0,0xc0,0x60,0x60,0x20,0x30,0x30,0x10,0x18,0x18,0x8,0xc,0xc,0x4,0x6, +0x6,0x3,0x3,0x3, +}; + +static const BitmapCharRec ch47 = {8,20,1,3,7,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch46 = {2,2,-2,0,6,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xff,0xf0,0xff,0xf0, +}; + +static const BitmapCharRec ch45 = {12,2,-1,-6,14,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0xc0,0x60,0x20,0xe0,0xc0, +}; + +static const BitmapCharRec ch44 = {3,5,-2,3,7,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xff,0xf0,0xff,0xf0,0x6,0x0, +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch43 = {12,12,-1,-1,14,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x8,0x0,0x1c,0x0,0xc9,0x80,0xeb,0x80,0x1c,0x0,0xeb,0x80,0xc9,0x80,0x1c,0x0, +0x8,0x0, +}; + +static const BitmapCharRec ch42 = {9,9,-2,-8,12,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x20,0x30,0x10,0x18,0x18,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0x18, +0x18,0x10,0x30,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {6,22,-1,5,8,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x4,0x8,0x10,0x30,0x20,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60, +0x60,0x20,0x30,0x10,0x8,0x4, +}; + +static const BitmapCharRec ch40 = {6,22,-1,5,8,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0xc0,0x60,0x20,0xe0,0xc0, +}; + +static const BitmapCharRec ch39 = {3,5,-3,-12,8,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x3c,0x3c,0x7f,0x7e,0xe1,0xe1,0xc0,0xc0,0xc1,0xc0,0xc1,0xa0,0x63,0x20,0x37,0x10, +0x1e,0x18,0xe,0x3e,0xf,0x0,0x1d,0x80,0x18,0xc0,0x18,0x40,0x18,0x40,0xc,0xc0, +0x7,0x80, +}; + +static const BitmapCharRec ch38 = {16,17,-1,0,18,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x30,0x3c,0x0,0x18,0x72,0x0,0xc,0x61,0x0,0x4,0x60,0x80,0x6,0x60,0x80,0x3, +0x30,0x80,0x1,0x19,0x80,0x1,0x8f,0x0,0x78,0xc0,0x0,0xe4,0x40,0x0,0xc2,0x60, +0x0,0xc1,0x30,0x0,0xc1,0x10,0x0,0x61,0x18,0x0,0x33,0xfc,0x0,0x1e,0xc,0x0, +}; + +static const BitmapCharRec ch37 = {17,16,-1,0,19,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x4,0x0,0x4,0x0,0x3f,0x0,0xe5,0xc0,0xc4,0xc0,0x84,0x60,0x84,0x60,0x4,0x60, +0x4,0xe0,0x7,0xc0,0x7,0x80,0x1e,0x0,0x3c,0x0,0x74,0x0,0x64,0x0,0x64,0x20, +0x64,0x60,0x34,0xe0,0x1f,0x80,0x4,0x0,0x4,0x0, +}; + +static const BitmapCharRec ch36 = {11,21,0,2,12,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0xff,0xc0,0xff,0xc0,0x11,0x0, +0x11,0x0,0x11,0x0,0x7f,0xe0,0x7f,0xe0,0x8,0x80,0x8,0x80,0x8,0x80,0x8,0x80, +0x8,0x80, +}; + +static const BitmapCharRec ch35 = {11,17,-1,0,13,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x88,0xcc,0xcc,0xcc,0xcc, +}; + +static const BitmapCharRec ch34 = {6,5,-1,-12,10,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch33 = {2,17,-3,0,8,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,6,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,6,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +// jeh: removed const so mwld can export structure to shared lib +BitmapFontRec glutBitmapTimesRoman24 = { +"-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut.beos/glut_util.cpp b/xc/extras/Mesa/src-glut.beos/glut_util.cpp new file mode 100644 index 000000000..97e311583 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glut_util.cpp @@ -0,0 +1,66 @@ + +/* 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 <stdlib.h> +#include <stdarg.h> +#include <stdio.h> + +#include <GL/glut.h> +#include "glutint.h" +#include "glutState.h" + +void +__glutWarning(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Warning in %s: ", + gState.programName ? gState.programName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); +} + +/* CENTRY */ +void APIENTRY +glutReportErrors(void) +{ + GLenum error; + + while ((error = glGetError()) != GL_NO_ERROR) + __glutWarning("GL error: %s", gluErrorString(error)); +} +/* ENDCENTRY */ + +void +__glutFatalError(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Fatal Error in %s: ", + gState.programName ? gState.programName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); + exit(1); +} + +void +__glutFatalUsage(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Fatal API Usage in %s: ", + gState.programName ? gState.programName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); + abort(); +} diff --git a/xc/extras/Mesa/src-glut.beos/glutbitmap.h b/xc/extras/Mesa/src-glut.beos/glutbitmap.h new file mode 100644 index 000000000..55d341706 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutbitmap.h @@ -0,0 +1,35 @@ +#ifndef __glutbitmap_h__ +#define __glutbitmap_h__ + +/* 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. */ + + +#if defined(WIN32) +#include <windows.h> +#pragma warning(disable:4244) +#endif /* WIN32 */ +#include <GL/gl.h> + +typedef struct { + const GLsizei width; + const GLsizei height; + const GLfloat xorig; + const GLfloat yorig; + const GLfloat advance; + const GLubyte *bitmap; +} BitmapCharRec, *BitmapCharPtr; + +typedef struct { + const char *name; + const int num_chars; + const int first; + const BitmapCharRec * const *ch; +} BitmapFontRec, *BitmapFontPtr; + +typedef void *GLUTbitmapFont; + +#endif /* __glutbitmap_h__ */ diff --git a/xc/extras/Mesa/src-glut.beos/glutint.h b/xc/extras/Mesa/src-glut.beos/glutint.h new file mode 100644 index 000000000..5ce2970d2 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutint.h @@ -0,0 +1,75 @@ +/*********************************************************** + * Copyright (C) 1997, Be Inc. All rights reserved. + * + * FILE: glutint.h + * + * DESCRIPTION: This is the new glut internal header file. + * most of the things formerly stored here are now in + * their own header files as C++ classes. + ***********************************************************/ + +#include <SupportDefs.h> + +/*********************************************************** + * GLUT function types + ***********************************************************/ +typedef void (*GLUTdisplayCB) (void); +typedef void (*GLUTreshapeCB) (int, int); +typedef void (*GLUTkeyboardCB) (unsigned char, int, int); +typedef void (*GLUTmouseCB) (int, int, int, int); +typedef void (*GLUTmotionCB) (int, int); +typedef void (*GLUTpassiveCB) (int, int); +typedef void (*GLUTentryCB) (int); +typedef void (*GLUTvisibilityCB) (int); +typedef void (*GLUTwindowStatusCB) (int); +typedef void (*GLUTidleCB) (void); +typedef void (*GLUTtimerCB) (int); +typedef void (*GLUTmenuStateCB) (int); /* DEPRICATED. + */ +typedef void (*GLUTmenuStatusCB) (int, int, int); +typedef void (*GLUTselectCB) (int); +typedef void (*GLUTspecialCB) (int, int, int); +typedef void (*GLUTspaceMotionCB) (int, int, int); +typedef void (*GLUTspaceRotateCB) (int, int, int); +typedef void (*GLUTspaceButtonCB) (int, int); +typedef void (*GLUTdialsCB) (int, int); +typedef void (*GLUTbuttonBoxCB) (int, int); +typedef void (*GLUTtabletMotionCB) (int, int); +typedef void (*GLUTtabletButtonCB) (int, int, int, int); + +/*********************************************************** + * Prototypes for glutInit.cpp + ***********************************************************/ +void __glutInitTime(bigtime_t *beginning); +void __glutInit(); + +/*********************************************************** + * Prototypes for glut_util.c + ***********************************************************/ +void __glutWarning(char *format,...); +void __glutFatalError(char *format,...); +void __glutFatalUsage(char *format,...); + +/*********************************************************** + * Prototypes for glutMenu.cpp + ***********************************************************/ +class GlutMenu; // avoid including glutMenu.h +GlutMenu *__glutGetMenuByNum(int menunum); + +/*********************************************************** + * Prototypes for glutWindow.cpp + ***********************************************************/ +int __glutConvertDisplayMode(unsigned long *options); +void __glutDefaultReshape(int width, int height); +class GlutWindow; // avoid including glutWindow.h in every source file +void __glutSetWindow(GlutWindow * window); + +/*********************************************************** + * Prototypes for glutDstr.cpp + ***********************************************************/ +int __glutConvertDisplayModeFromString(unsigned long *options); + +/*********************************************************** + * Prototypes for glutCursor.cpp + ***********************************************************/ +void __glutSetCursor(int cursor); diff --git a/xc/extras/Mesa/src-glut.beos/glutstroke.h b/xc/extras/Mesa/src-glut.beos/glutstroke.h new file mode 100644 index 000000000..4712ebbde --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/glutstroke.h @@ -0,0 +1,41 @@ +#ifndef __glutstroke_h__ +#define __glutstroke_h__ + +/* 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. */ + +#if defined(WIN32) +#pragma warning (disable:4244) +#endif + +typedef struct { + float x; + float y; +} CoordRec, *CoordPtr; + +typedef struct { + int num_coords; + const CoordRec *coord; +} StrokeRec, *StrokePtr; + +typedef struct { + int num_strokes; + const StrokeRec *stroke; + float center; + float right; +} StrokeCharRec, *StrokeCharPtr; + +typedef struct { + const char *name; + int num_chars; + const StrokeCharRec *ch; + float top; + float bottom; +} StrokeFontRec, *StrokeFontPtr; + +typedef void *GLUTstrokeFont; + +#endif /* __glutstroke_h__ */ diff --git a/xc/extras/Mesa/src-glut.beos/libglut.def b/xc/extras/Mesa/src-glut.beos/libglut.def new file mode 100644 index 000000000..e900bb040 --- /dev/null +++ b/xc/extras/Mesa/src-glut.beos/libglut.def @@ -0,0 +1,98 @@ +EXPORTS +glutInit +glutInitWindowPosition +glutInitWindowSize +glutInitDisplayMode +glutInitDisplayString +glutMainLoop +glutCreateWindow +glutCreateSubWindow +glutSetWindow +glutGetWindow +glutDestroyWindow +glutPostRedisplay +glutSwapBuffers +glutPositionWindow +glutReshapeWindow +glutFullScreen +glutPopWindow +glutPushWindow +glutShowWindow +glutHideWindow +glutIconifyWindow +glutSetWindowTitle +glutSetIconTitle +glutSetCursor +glutWarpPointer +glutEstablishOverlay +glutUseLayer +glutRemoveOverlay +glutPostOverlayRedisplay +glutShowOverlay +glutHideOverlay +glutCreateMenu +glutSetMenu +glutGetMenu +glutDestroyMenu +glutAddMenuEntry +glutAddSubMenu +glutChangeToMenuEntry +glutChangeToSubMenu +glutRemoveMenuItem +glutAttachMenu +glutDetachMenu +glutDisplayFunc +glutOverlayDisplayFunc +glutReshapeFunc +glutKeyboardFunc +glutMouseFunc +glutMotionFunc +glutPassiveMotionFunc +glutVisibilityFunc +glutEntryFunc +glutSpecialFunc +glutSpaceballMotionFunc +glutSpaceballRotateFunc +glutSpaceballButtonFunc +glutButtonBoxFunc +glutDialsFunc +glutTabletMotionFunc +glutTabletButtonFunc +glutMenuStatusFunc +glutMenuStateFunc +glutIdleFunc +glutTimerFunc +glutSetColor +glutGetColor +glutCopyColormap +glutGet +glutLayerGet +glutDeviceGet +glutGetModifiers +glutExtensionSupported +glutBitmapCharacter +glutBitmapWidth +glutStrokeCharacter +glutStrokeWidth +glutBitmapLength +glutStrokeLength +glutStrokeRoman +glutStrokeMonoRoman +glutSolidSphere +glutWireSphere +glutSolidCube +glutWireCube +glutSolidCone +glutWireCone +glutSolidTorus +glutWireTorus +glutSolidDodecahedron +glutWireDodecahedron +glutSolidOctahedron +glutWireOctahedron +glutSolidTetrahedron +glutWireTetrahedron +glutSolidIcosahedron +glutWireIcosahedron +glutSolidTeapot +glutWireTeapot diff --git a/xc/extras/Mesa/src-glut/.cvsignore b/xc/extras/Mesa/src-glut/.cvsignore new file mode 100644 index 000000000..44b4308ba --- /dev/null +++ b/xc/extras/Mesa/src-glut/.cvsignore @@ -0,0 +1 @@ +depend diff --git a/xc/extras/Mesa/src-glut/Makefile.X11 b/xc/extras/Mesa/src-glut/Makefile.X11 new file mode 100644 index 000000000..c1c4cc7e1 --- /dev/null +++ b/xc/extras/Mesa/src-glut/Makefile.X11 @@ -0,0 +1,128 @@ +# $Id: Makefile.X11,v 1.1.1.1 2000/12/05 16:38:43 dawes Exp $ + +# Makefile for GLUT +# +# NOTICE: The OpenGL Utility Toolkit (GLUT) distribution contains source +# code published in a book titled "Programming OpenGL for the X Window +# System" (ISBN: 0-201-48359-9) published by Addison-Wesley. The +# programs and associated files contained in the distribution were +# developed by Mark J. Kilgard and are Copyright 1994, 1995, 1996 by Mark +# J. Kilgard (unless otherwise noted). The programs are not in the +# public domain, but they are freely distributable without licensing +# fees. These programs are provided without guarantee or warrantee +# expressed or implied. +# +# GLUT source included with Mesa with permission from Mark Kilgard. + + +# $Log: Makefile.X11,v $ +# Revision 1.1.1.1 2000/12/05 16:38:43 dawes +# Import of XFree86 4.0.1g +# +# Revision 1.2 1999/09/15 15:11:24 brianp +# added third, tiny version number to mklib scripts +# +# Revision 1.1 1999/08/19 14:00:01 brianp +# initial check-in (post crash) +# + + +##### MACROS ##### + +GLUT_MAJOR = 3 +GLUT_MINOR = 7 +GLUT_TINY = 0 + +VPATH = RCS + +INCDIR = ../include +LIBDIR = ../lib + +SOURCES = \ + glut_8x13.c \ + glut_9x15.c \ + glut_bitmap.c \ + glut_bwidth.c \ + glut_cindex.c \ + glut_cmap.c \ + glut_cursor.c \ + glut_dials.c \ + glut_dstr.c \ + glut_event.c \ + glut_ext.c \ + glut_fbc.c \ + glut_fullscrn.c \ + glut_gamemode.c \ + glut_get.c \ + glut_glxext.c \ + glut_hel10.c \ + glut_hel12.c \ + glut_hel18.c \ + glut_init.c \ + glut_input.c \ + glut_joy.c \ + glut_key.c \ + glut_keyctrl.c \ + glut_keyup.c \ + glut_menu.c \ + glut_menu2.c \ + glut_mesa.c \ + glut_modifier.c \ + glut_mroman.c \ + glut_overlay.c \ + glut_roman.c \ + glut_shapes.c \ + glut_space.c \ + glut_stroke.c \ + glut_swap.c \ + glut_swidth.c \ + glut_tablet.c \ + glut_teapot.c \ + glut_tr10.c \ + glut_tr24.c \ + glut_util.c \ + glut_vidresize.c \ + glut_warp.c \ + glut_win.c \ + glut_winmisc.c \ + layerutil.c + + +OBJECTS = $(SOURCES:.c=.o) + + + +##### RULES ##### + +.c.o: + $(CC) -c -I$(INCDIR) $(CFLAGS) $< + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +targets: $(LIBDIR)/$(GLUT_LIB) + +# Make the library +$(LIBDIR)/$(GLUT_LIB): $(OBJECTS) + $(MAKELIB) $(GLUT_LIB) $(GLUT_MAJOR) $(GLUT_MINOR) $(GLUT_TINY) $(OBJECTS) + mv $(GLUT_LIB)* $(LIBDIR) + +include ../Make-config + +include depend + + + +# +# Run 'make dep' to update the dependencies if you change what's included +# by any source file. +# +dep: $(SOURCES) + makedepend -fdepend -Y -I../include $(SOURCES) diff --git a/xc/extras/Mesa/src-glut/Makefile.am b/xc/extras/Mesa/src-glut/Makefile.am new file mode 100644 index 000000000..498c74d12 --- /dev/null +++ b/xc/extras/Mesa/src-glut/Makefile.am @@ -0,0 +1,74 @@ +## Process this file with automake to produce Makefile.in + +#AUTOMAKE_OPTIONS = no-dependencies + +INCLUDES = -I$(top_srcdir)/include $(X_CFLAGS) $(GLUT_CFLAGS) + +# Build a libtool library for installation in libdir. +lib_LTLIBRARIES = libglut.la + +libglut_la_LDFLAGS = -version-info $(LIBGLUT_VERSION) +libglut_la_SOURCES = \ + glut_8x13.c \ + glut_9x15.c \ + glut_bitmap.c \ + glut_bwidth.c \ + glut_cindex.c \ + glut_cmap.c \ + glut_cursor.c \ + glut_dials.c \ + glut_dstr.c \ + glut_event.c \ + glut_ext.c \ + glut_fbc.c \ + glut_fullscrn.c \ + glut_gamemode.c \ + glut_get.c \ + glut_glxext.c \ + glut_hel10.c \ + glut_hel12.c \ + glut_hel18.c \ + glut_init.c \ + glut_input.c \ + glut_joy.c \ + glut_key.c \ + glut_keyctrl.c \ + glut_keyup.c \ + glut_menu.c \ + glut_menu2.c \ + glut_mesa.c \ + glut_modifier.c \ + glut_mroman.c \ + glut_overlay.c \ + glut_roman.c \ + glut_shapes.c \ + glut_space.c \ + glut_stroke.c \ + glut_swap.c \ + glut_swidth.c \ + glut_tablet.c \ + glut_teapot.c \ + glut_tr10.c \ + glut_tr24.c \ + glut_util.c \ + glut_vidresize.c \ + glut_warp.c \ + glut_win.c \ + glut_winmisc.c \ + glutbitmap.h \ + glutint.h \ + glutstroke.h \ + layerutil.c \ + layerutil.h \ + stroke.h + +libglut_la_LIBADD = $(X_LIBS) $(X_PRE_LIBS) $(X_LIBADD) + +EXTRA_PROGRAMS = capturexfont +capturexfont_LDFLAGS = $(X_LIBS) $(X_PRE_LIBS) $(X_LIBADD) + +strip: + -if strip -V 2>&1 | grep "GNU" > /dev/null; then \ + strip --strip-unneeded .libs/*.so; \ + strip --strip-debug .libs/*.a; \ + fi diff --git a/xc/extras/Mesa/src-glut/Makefile.cygnus b/xc/extras/Mesa/src-glut/Makefile.cygnus new file mode 100644 index 000000000..5d5fa6912 --- /dev/null +++ b/xc/extras/Mesa/src-glut/Makefile.cygnus @@ -0,0 +1,110 @@ +# Makefile.cygnus for Cygnus-Win32 target +# /Stephane Rehel, November 16 1997 + +# Makefile for GLUT 3.7 +# +# NOTICE: The OpenGL Utility Toolkit (GLUT) distribution contains source +# code published in a book titled "Programming OpenGL for the X Window +# System" (ISBN: 0-201-48359-9) published by Addison-Wesley. The +# programs and associated files contained in the distribution were +# developed by Mark J. Kilgard and are Copyright 1994, 1995, 1996 by Mark +# J. Kilgard (unless otherwise noted). The programs are not in the +# public domain, but they are freely distributable without licensing +# fees. These programs are provided without guarantee or warrantee +# expressed or implied. +# +# GLUT source included with Mesa with permission from Mark Kilgard. + + +##### MACROS ##### + +GLUT_MAJOR = 3 +GLUT_MINOR = 7 +GLUT_TINY = 0 + +VPATH = RCS + +INCDIR = ../include +LIBDIR = ../lib + +SOURCES = \ + glut_8x13.c \ + glut_9x15.c \ + glut_bitmap.c \ + glut_bwidth.c \ + glut_cindex.c \ + glut_cmap.c \ + glut_cursor.c \ + glut_dials.c \ + glut_dstr.c \ + glut_event.c \ + glut_ext.c \ + glut_fullscrn.c \ + glut_get.c \ + glut_hel10.c \ + glut_hel12.c \ + glut_hel18.c \ + glut_init.c \ + glut_input.c \ + glut_mesa.c \ + glut_modifier.c \ + glut_mroman.c \ + glut_overlay.c \ + glut_roman.c \ + glut_shapes.c \ + glut_space.c \ + glut_stroke.c \ + glut_swap.c \ + glut_swidth.c \ + glut_tablet.c \ + glut_teapot.c \ + glut_tr10.c \ + glut_tr24.c \ + glut_util.c \ + glut_vidresize.c \ + glut_warp.c \ + glut_win.c \ + glut_winmisc.c \ + win32_x11.c \ + win32_glx.c \ + win32_menu.c \ + win32_util.c + +OBJECTS = $(SOURCES:.c=.o) + + + +##### RULES ##### + +.c.o: + $(CC) -c -I$(INCDIR) $(CFLAGS) $< + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +targets: $(LIBDIR)/$(GLUT_LIB) + +# Make the library +$(LIBDIR)/$(GLUT_LIB): $(OBJECTS) + $(MAKELIB) $(GLUT_LIB) $(GLUT_MAJOR) $(GLUT_MINOR) $(GLUT_TINY) $(OBJECTS) + mv $(GLUT_LIB)* $(LIBDIR) + +include ../Make-config + +include depend + + + +# +# Run 'make dep' to update the dependencies if you change what's included +# by any source file. +# +dep: $(SOURCES) + makedepend -fdepend -Y -I../include $(SOURCES) diff --git a/xc/extras/Mesa/src-glut/Makefile.fx b/xc/extras/Mesa/src-glut/Makefile.fx new file mode 100644 index 000000000..c98d473d2 --- /dev/null +++ b/xc/extras/Mesa/src-glut/Makefile.fx @@ -0,0 +1,23 @@ +!include <win32.mak> + +CFLAGS = $(cvarsdll) /Ox /G5 /D__MSC__ /DFX /D__WIN32__ \ + /DWIN32 /DMESA_MINWARN /I..\include + +OBJS = glut_8x13.obj glut_9x15.obj glut_bitmap.obj glut_bwidth.obj glut_cindex.obj \ + glut_cursor.obj glut_dials.obj glut_dstr.obj glut_event.obj glut_ext.obj \ + glut_fullscrn.obj glut_gamemode.obj glut_get.obj glut_hel10.obj glut_hel12.obj glut_hel18.obj \ + glut_init.obj glut_input.obj glut_joy.obj glut_key.obj glut_keyctrl.obj glut_keyup.obj \ + glut_mesa.obj glut_modifier.obj glut_mroman.obj \ + glut_overlay.obj glut_roman.obj glut_shapes.obj glut_space.obj glut_stroke.obj \ + glut_swidth.obj glut_tablet.obj glut_teapot.obj glut_tr10.obj glut_tr24.obj \ + glut_util.obj glut_vidresize.obj glut_warp.obj glut_win.obj glut_winmisc.obj \ + glut_swap.obj glut_cmap.obj \ + win32_glx.obj win32_menu.obj win32_util.obj win32_winproc.obj win32_x11.obj + +PROGRAM = ..\lib\GLUT32.dll + +all: $(PROGRAM) + +$(PROGRAM): $(OBJS) + $(link) $(dlllflags) /out:$(PROGRAM) \ + /def:fxglut.def $(OBJS) $(guilibsdll) ..\lib\GLU32.lib ..\lib\OpenGL32.lib winmm.lib > link.log
\ No newline at end of file diff --git a/xc/extras/Mesa/src-glut/Makefile.sgi b/xc/extras/Mesa/src-glut/Makefile.sgi new file mode 100644 index 000000000..9514c324d --- /dev/null +++ b/xc/extras/Mesa/src-glut/Makefile.sgi @@ -0,0 +1,189 @@ +#! smake +# +# Copyright (c) Mark J. Kilgard, 1995, 1998. +# +include $(ROOT)/usr/include/make/commondefs + +# NOTE: In my GLUT development tree, many of the C source files for +# GLUT are generated. For this reason, "make full_clobber" will remove +# these generated C files, while "make clobber" will not. + +TOP = ../.. + +TARGETS = libglut.a + +LN = ln -s +MV = mv +RM = -rm -rf + +HDRS = glutint.h glutstroke.h layerutil.h glutbitmap.h + +SRCS = \ + glut_bitmap.c \ + glut_bwidth.c \ + glut_cindex.c \ + glut_cmap.c \ + glut_cursor.c \ + glut_dials.c \ + glut_dstr.c \ + glut_event.c \ + glut_ext.c \ + glut_fbc.c \ + glut_fullscrn.c \ + glut_gamemode.c \ + glut_get.c \ + glut_glxext.c \ + glut_init.c \ + glut_input.c \ + glut_joy.c \ + glut_key.c \ + glut_keyctrl.c \ + glut_keyup.c \ + glut_menu.c \ + glut_menu2.c \ + glut_mesa.c \ + glut_modifier.c \ + glut_overlay.c \ + glut_shapes.c \ + glut_space.c \ + glut_stroke.c \ + glut_swap.c \ + glut_swidth.c \ + glut_tablet.c \ + glut_teapot.c \ + glut_util.c \ + glut_vidresize.c \ + glut_warp.c \ + glut_win.c \ + glut_winmisc.c \ + layerutil.c + +SRCSSEMIGENS = \ + glut_8x13.c \ + glut_9x15.c \ + glut_hel10.c \ + glut_hel12.c \ + glut_hel18.c \ + glut_mroman.c \ + glut_roman.c \ + glut_tr10.c \ + glut_tr24.c + +OBJS = $(SRCS:.c=.o) $(SRCSSEMIGENS:.c=.o) +OTHERGENS = y.tab.c y.tab.h strokegen.c strokegen.h strokelex.c +OTHERSRCS = strokegen.y strokelex.l stroke.h +FONTS = Roman.stroke MonoRoman.stroke + +# Uncomment the LCDEFS line below if you want to build a version of +# libglut.a that avoids using the SGI "fast atoms" optimization +# introduced in IRIX 6.3. This optimization eliminates serveral X server +# round-trips. If you are building libglut.a on an IRIX 6.3 or later +# machine and want a chance (no guarantees) that GLUT executables built +# against your libglut.a will work on IRIX 6.2 machines, uncomment out +# the LCDEFS line below. Otherwise, you'll get a run-time message about +# "attempted access to unresolvable symbol in XXX: _XSGIFastInternAtom" +#LCDEFS = -DNO_FAST_ATOMS + +LCOPTS = -I$(TOP)/include -fullwarn +LWOFF = ,813,852,827,826 +LDIRT = *~ $(OTHERGENS) strokegen *.bak hardcopy glutsrc.ps capturexfont *.pure dstr dstr.c *.gen + +default: $(TARGETS) + +sinclude ObjectType.mk + +$(OBJS) : $(HDRS) + +libglut.a : $(OBJS) + $(RM) $@ + $(AR) crl $@ $(OBJS) + +.ORDER : strokegen.h strokegen.c + +strokegen.h strokegen.c : strokegen.y + $(YACC) -d strokegen.y + $(MV) y.tab.c strokegen.c + $(MV) y.tab.h strokegen.h + +# avoid warnings when compiling lex generated code +strokegen.o : strokegen.c + $(CC) $(CFLAGS) -woff 726,825,635,818,819,820,824,831,835,822,821,1167,1498,1116,1136,1174,1196,803 -c -MDupdate Makedepend strokegen.c + +strokelex.c : strokelex.l + $(LEX) strokelex.l + $(MV) lex.yy.c strokelex.c + +# avoid warnings when compiling lex generated code +strokelex.o : strokelex.c + $(CC) $(CFLAGS) -woff 831,825,817,835,702,819,635,824,822,1167,1498,1110,1196,1174,803 -c -MDupdate Makedepend strokelex.c + +strokegen : strokegen.o strokelex.o + $(CC) -o $@ $(LDFLAGS) strokegen.o strokelex.o -ll + +capturexfont : capturexfont.o + $(CC) -o $@ $(LDFLAGS) capturexfont.o -lX11 + +# glut_roman.c and glut_mroman.c are now checked in, but here are rules to generate them +glut_roman.c.gen : Roman.stroke strokegen + ./strokegen -s glutStrokeRoman < Roman.stroke > $@ +glut_mroman.c.gen : MonoRoman.stroke strokegen + ./strokegen -s glutStrokeMonoRoman < MonoRoman.stroke > $@ + +glutsrc.ps : $(SRCS) + $(RM) hardcopy + mkdir -p hardcopy + for i in $(SRCS) ;\ + do \ + grep -v CENTRY $$i | grep -v INDENT- > hardcopy/$$i; \ + done + cd hardcopy ; enscript -p ../$@ -G -2r `echo $(SRCS) | fmt -1 | sort` + $(RM) hardcopy + +# The bitmap files can be generated using capturexfont, but because +# they require a connection to an X server and potentially different +# X servers have different fonts, these generated files are part +# of the GLUT distribution. + +9_BY_15 = -misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1 +8_BY_13 = -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1 +TR10 = -adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1 +TR24 = -adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1 +HEL10 = -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1 +HEL12 = -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1 +HEL18 = -adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1 + +semigens : capturexfont + ./capturexfont $(9_BY_15) glutBitmap9By15 > glut_9x15.c.gen + ./capturexfont $(8_BY_13) glutBitmap8By13 > glut_8x13.c.gen + ./capturexfont $(TR10) glutBitmapTimesRoman10 > glut_tr10.c.gen + ./capturexfont $(TR24) glutBitmapTimesRoman24 > glut_tr24.c.gen + ./capturexfont $(HEL10) glutBitmapHelvetica10 > glut_hel10.c.gen + ./capturexfont $(HEL12) glutBitmapHelvetica12 > glut_hel12.c.gen + ./capturexfont $(HEL18) glutBitmapHelvetica18 > glut_hel18.c.gen + +# unused test rule for test building 16-bit font +JIS = -jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-0 +glut_jis.c : + ./capturexfont $(JIS) glutBitmapJis > $@ + +sources: $(SRCS) + +symcheck: libglut.a + -nm -Bo libglut.a | grep -v ' d ' | grep -v ' T glut' | grep -v ' D glut' | grep -v ' U ' | grep -v ' T __glut' | grep -v ' t ' | grep -v ' b ' | grep -v ' D __glut' | grep -v ' B __glut' + +dstr.c: glut_dstr.c + ln -s glut_dstr.c $@ + +dstr: dstr.c glut_util.o glut_glxext.o + $(RM) $@ + $(CC) -g -o $@ $(CFLAGS) -DTEST dstr.c glut_util.o glut_glxext.o -lGLU -lGL -lXext -lX11 -lm + +./glut.h : glut.h +./glutint.h : glutint.h +./glutstroke.h : glutstroke.h +./strokegen.h : strokegen.h +./stroke.h : stroke.h +./layerutil.h : layerutil.h +strokelex.o: strokelex.c strokegen.h + +include $(COMMONRULES) diff --git a/xc/extras/Mesa/src-glut/Makefile.win b/xc/extras/Mesa/src-glut/Makefile.win new file mode 100644 index 000000000..4d809f119 --- /dev/null +++ b/xc/extras/Mesa/src-glut/Makefile.win @@ -0,0 +1,95 @@ +# Makefile for Win32
+
+!include <win32.mak>
+
+TOP = ../..
+
+# NOTE: glut_menu.c and glut_glxext.c are NOT compiled into Win32 GLUT
+
+SRCS = glut_8x13.c glut_9x15.c glut_bitmap.c glut_bwidth.c glut_cindex.c glut_cmap.c glut_cursor.c glut_dials.c glut_dstr.c glut_event.c glut_ext.c glut_fbc.c glut_fullscrn.c glut_gamemode.c glut_get.c glut_hel10.c glut_hel12.c glut_hel18.c glut_init.c glut_input.c glut_joy.c glut_key.c glut_keyctrl.c glut_keyup.c glut_mesa.c glut_modifier.c glut_mroman.c glut_overlay.c glut_roman.c glut_shapes.c glut_space.c glut_stroke.c glut_swap.c glut_swidth.c glut_tablet.c glut_teapot.c glut_tr10.c glut_tr24.c glut_util.c glut_vidresize.c glut_warp.c glut_win.c glut_winmisc.c win32_glx.c win32_menu.c win32_util.c win32_winproc.c win32_x11.c
+
+all : glutdll install
+
+!include "$(TOP)/glutwin32.mak"
+
+glutdll : $(GLUTDLL)
+
+!IFDEF NODEBUG
+OPTIMIZE_CFLAGS = -DNDEBUG
+!ENDIF
+
+CFLAGS = $(cvarsdll) $(CFLAGS) $(OPTIMIZE_CFLAGS)
+LFLAGS = $(dlllflags) $(LFLAGS)
+
+OBJS = $(SRCS:.c=.obj)
+MS_LIBS = $(MS_OPENGL) $(MS_GLU) winmm.lib $(guilibsdll)
+SGI_LIBS = $(SGI_OPENGL) $(SGI_GLU) winmm.lib $(guilibsdll)
+
+glut32.dll : $(OBJS) glut.def
+ $(link) $(LFLAGS) -out:glut32.dll -def:glut.def $(OBJS) $(MS_LIBS)
+
+glut.dll : $(OBJS) glut.def
+ $(link) $(LFLAGS) -out:glut.dll -def:glut.def $(OBJS) $(SGI_LIBS)
+
+install : $(GLUTDLL)
+ @echo "copying GLUT dynamic link library to system directory..."
+ -copy $(GLUTDLL) $(DLLINSTALL)
+ @echo "copying GLUT header file to include directory..."
+ -copy ..\..\include\GL\glut.h $(INCLUDEINSTALL)
+ @echo "copying GLUT import library to library directory..."
+ -copy $(GLUTLIB) $(LIBINSTALL)
+
+.c.obj :
+ $(cc) $(CFLAGS) -I . $*.c
+
+# explicit object dependencies for all source files
+
+win32_glx.obj: win32_glx.c win32_glx.h
+win32_x11.obj: win32_x11.c win32_x11.h
+win32_menu.obj: win32_menu.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h
+win32_util.obj: win32_util.c glutint.h ..\..\include\GL\glutf90.h
+win32_winproc.obj: win32_winproc.c glutint.h ..\..\include\GL\glutf90.h
+
+glut_mroman.obj: glut_mroman.c glutstroke.h glutint.h ..\..\include\GL\glutf90.h
+glut_roman.obj: glut_roman.c glutstroke.h glutint.h ..\..\include\GL\glutf90.h
+glut_hel12.obj: glut_hel12.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+glut_8x13.obj: glut_8x13.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+glut_hel18.obj: glut_hel18.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+glut_9x15.obj: glut_9x15.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+glut_tr10.obj: glut_tr10.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+glut_hel10.obj: glut_hel10.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+glut_tr24.obj: glut_tr24.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
+
+glut_bitmap.obj: glut_bitmap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_bwidth.obj: glut_bwidth.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_cindex.obj: glut_cindex.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_cmap.obj: glut_cmap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_cursor.obj: glut_cursor.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_dials.obj: glut_dials.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_dstr.obj: glut_dstr.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_event.obj: glut_event.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_ext.obj: glut_ext.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_fullscrn.obj: glut_fullscrn.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_gamemode.obj: glut_gamemode.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_get.obj: glut_get.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_init.obj: glut_init.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_input.obj: glut_input.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_joy.obj: glut_joy.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_key.obj: glut_key.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_keyctrl.obj: glut_keyctrl.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_keyup.obj: glut_keyup.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_mesa.obj: glut_mesa.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_modifier.obj: glut_modifier.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_overlay.obj: glut_overlay.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_shapes.obj: glut_shapes.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_space.obj: glut_space.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_swap.obj: glut_swap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_swidth.obj: glut_swidth.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_tablet.obj: glut_tablet.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_teapot.obj: glut_teapot.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_util.obj: glut_util.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_vidresize.obj: glut_vidresize.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_warp.obj: glut_warp.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+glut_win.obj: glut_win.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h
+glut_winmisc.obj: glut_winmisc.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
+
diff --git a/xc/extras/Mesa/src-glut/capturexfont.c b/xc/extras/Mesa/src-glut/capturexfont.c new file mode 100644 index 000000000..3bed13c9b --- /dev/null +++ b/xc/extras/Mesa/src-glut/capturexfont.c @@ -0,0 +1,352 @@ + +/* 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. */ + +/* capturexfont.c connects to an X server and downloads a + bitmap font from which a C source file is generated, + encoding the font for GLUT's use. Example usage: + capturexfont.c 9x15 glutBitmap9By15 > glut_9x15.c */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <GL/gl.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +#define MAX_GLYPHS_PER_GRAB 512 /* This is big enough for 2^9 + glyph character sets */ + +static void +outputChar(int num, int width, int height, + int xoff, int yoff, int advance, int data) +{ + if (width == 0 || height == 0) { + printf("#ifdef _WIN32\n"); + printf("/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with\n"); + printf(" a height or width of zero does not advance the raster position\n"); + printf(" as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */\n"); + printf("static const GLubyte ch%ddata[] = { 0x0 };\n", num); + printf("static const BitmapCharRec ch%d = {", num); + printf("%d,", 0); + printf("%d,", 0); + printf("%d,", xoff); + printf("%d,", yoff); + printf("%d,", advance); + printf("ch%ddata", num); + printf("};\n"); + printf("#else\n"); + } + printf("static const BitmapCharRec ch%d = {", num); + printf("%d,", width); + printf("%d,", height); + printf("%d,", xoff); + printf("%d,", yoff); + printf("%d,", advance); + if (data) { + printf("ch%ddata", num); + } else { + printf("0"); + } + printf("};\n"); + if (width == 0 || height == 0) { + printf("#endif\n"); + } + printf("\n"); +} + +/* Can't just use isprint because it only works for the range + of ASCII characters (ie, TRUE for isascii) and capturexfont + might be run on 16-bit fonts. */ +#define PRINTABLE(ch) (isascii(ch) ? isprint(ch) : 0) + +void +captureXFont(Display * dpy, Font font, char *xfont, char *name) +{ + int first, last, count; + int cnt, len; + Pixmap offscreen; + Window drawable; + XFontStruct *fontinfo; + XImage *image; + GC xgc; + XGCValues values; + int width, height; + int i, j, k; + XCharStruct *charinfo; + XChar2b character; + GLubyte *bitmapData; + int x, y; + int spanLength; + int charWidth, charHeight, maxSpanLength, pixwidth; + int grabList[MAX_GLYPHS_PER_GRAB]; + int glyphsPerGrab = MAX_GLYPHS_PER_GRAB; + int numToGrab; + int rows, pages, byte1, byte2, index; + int nullBitmap; + + drawable = RootWindow(dpy, DefaultScreen(dpy)); + + fontinfo = XQueryFont(dpy, font); + pages = fontinfo->max_char_or_byte2 - fontinfo->min_char_or_byte2 + 1; + first = (fontinfo->min_byte1 << 8) + fontinfo->min_char_or_byte2; + last = (fontinfo->max_byte1 << 8) + fontinfo->max_char_or_byte2; + count = last - first + 1; + + width = fontinfo->max_bounds.rbearing - + fontinfo->min_bounds.lbearing; + height = fontinfo->max_bounds.ascent + + fontinfo->max_bounds.descent; + /* 16-bit fonts have more than one row; indexing into + per_char is trickier. */ + rows = fontinfo->max_byte1 - fontinfo->min_byte1 + 1; + + maxSpanLength = (width + 7) / 8; + /* For portability reasons we don't use alloca for + bitmapData, but we could. */ + bitmapData = malloc(height * maxSpanLength); + /* Be careful determining the width of the pixmap; the X + protocol allows pixmaps of width 2^16-1 (unsigned short + size) but drawing coordinates max out at 2^15-1 (signed + short size). If the width is too large, we need to limit + the glyphs per grab. */ + if ((glyphsPerGrab * 8 * maxSpanLength) >= (1 << 15)) { + glyphsPerGrab = (1 << 15) / (8 * maxSpanLength); + } + pixwidth = glyphsPerGrab * 8 * maxSpanLength; + offscreen = XCreatePixmap(dpy, drawable, pixwidth, height, 1); + + values.font = font; + values.background = 0; + values.foreground = 0; + xgc = XCreateGC(dpy, offscreen, + GCFont | GCBackground | GCForeground, &values); + XFillRectangle(dpy, offscreen, xgc, 0, 0, + 8 * maxSpanLength * glyphsPerGrab, height); + XSetForeground(dpy, xgc, 1); + + numToGrab = 0; + if (fontinfo->per_char == NULL) { + charinfo = &(fontinfo->min_bounds); + charWidth = charinfo->rbearing - charinfo->lbearing; + charHeight = charinfo->ascent + charinfo->descent; + spanLength = (charWidth + 7) / 8; + } + printf("\n/* GENERATED FILE -- DO NOT MODIFY */\n\n"); + printf("#include \"glutbitmap.h\"\n\n"); + for (i = first; count; i++, count--) { + int undefined; + if (rows == 1) { + undefined = (fontinfo->min_char_or_byte2 > i || + fontinfo->max_char_or_byte2 < i); + } else { + byte2 = i & 0xff; + byte1 = i >> 8; + undefined = (fontinfo->min_char_or_byte2 > byte2 || + fontinfo->max_char_or_byte2 < byte2 || + fontinfo->min_byte1 > byte1 || + fontinfo->max_byte1 < byte1); + + } + if (undefined) { + goto PossiblyDoGrab; + } + if (fontinfo->per_char != NULL) { + if (rows == 1) { + index = i - fontinfo->min_char_or_byte2; + } else { + byte2 = i & 0xff; + byte1 = i >> 8; + index = + (byte1 - fontinfo->min_byte1) * pages + + (byte2 - fontinfo->min_char_or_byte2); + } + charinfo = &(fontinfo->per_char[index]); + charWidth = charinfo->rbearing - charinfo->lbearing; + charHeight = charinfo->ascent + charinfo->descent; + if (charWidth == 0 || charHeight == 0) { + if (charinfo->width != 0) { + /* Still must move raster pos even if empty character + + */ + outputChar(i, 0, 0, 0, 0, charinfo->width, 0); + } + goto PossiblyDoGrab; + } + } + grabList[numToGrab] = i; + character.byte2 = i & 255; + character.byte1 = i >> 8; + + /* XXX We could use XDrawImageString16 which would also + paint the backing rectangle but X server bugs in some + scalable font rasterizers makes it more effective to do + XFillRectangles to clear the pixmap and then + XDrawImage16 for the text. */ + XDrawString16(dpy, offscreen, xgc, + -charinfo->lbearing + 8 * maxSpanLength * numToGrab, + charinfo->ascent, &character, 1); + + numToGrab++; + + PossiblyDoGrab: + + if (numToGrab >= glyphsPerGrab || count == 1) { + image = XGetImage(dpy, offscreen, + 0, 0, pixwidth, height, 1, XYPixmap); + for (j = numToGrab - 1; j >= 0; j--) { + if (fontinfo->per_char != NULL) { + byte2 = grabList[j] & 0xff; + byte1 = grabList[j] >> 8; + index = + (byte1 - fontinfo->min_byte1) * pages + + (byte2 - fontinfo->min_char_or_byte2); + charinfo = &(fontinfo->per_char[index]); + charWidth = charinfo->rbearing - charinfo->lbearing; + charHeight = charinfo->ascent + charinfo->descent; + spanLength = (charWidth + 7) / 8; + } + memset(bitmapData, 0, height * spanLength); + for (y = 0; y < charHeight; y++) { + for (x = 0; x < charWidth; x++) { + if (XGetPixel(image, j * maxSpanLength * 8 + x, + charHeight - 1 - y)) { + /* Little endian machines (such as DEC Alpha) + could benefit from reversing the bit order + here and changing the GL_UNPACK_LSB_FIRST + parameter in glutBitmapCharacter to GL_TRUE. */ + bitmapData[y * spanLength + x / 8] |= + (1 << (7 - (x & 7))); + } + } + } + if (PRINTABLE(grabList[j])) { + printf("/* char: 0x%x '%c' */\n\n", + grabList[j], grabList[j]); + } else { + printf("/* char: 0x%x */\n\n", grabList[j]); + } + + /* Determine if the bitmap is null. */ + nullBitmap = 1; + len = (charinfo->ascent + charinfo->descent) * + ((charinfo->rbearing - charinfo->lbearing + 7) / 8); + cnt = 0; + while (cnt < len) { + for (k = 0; k < 16 && cnt < len; k++, cnt++) { + if (bitmapData[cnt] != 0) { + nullBitmap = 0; + } + } + } + + if (!nullBitmap) { + printf("static const GLubyte ch%ddata[] = {\n", grabList[j]); + len = (charinfo->ascent + charinfo->descent) * + ((charinfo->rbearing - charinfo->lbearing + 7) / 8); + cnt = 0; + while (cnt < len) { + for (k = 0; k < 16 && cnt < len; k++, cnt++) { + printf("0x%x,", bitmapData[cnt]); + } + printf("\n"); + } + printf("};\n\n"); + } else { + charWidth = 0; + charHeight = 0; + } + + outputChar(grabList[j], charWidth, charHeight, + -charinfo->lbearing, charinfo->descent, + charinfo->width, !nullBitmap); + } + XDestroyImage(image); + numToGrab = 0; + if (count > 0) { + XSetForeground(dpy, xgc, 0); + XFillRectangle(dpy, offscreen, xgc, 0, 0, + 8 * maxSpanLength * glyphsPerGrab, height); + XSetForeground(dpy, xgc, 1); + } + } + } + XFreeGC(dpy, xgc); + XFreePixmap(dpy, offscreen); + /* For portability reasons we don't use alloca for + bitmapData, but we could. */ + free(bitmapData); + + printf("static const BitmapCharRec * const chars[] = {\n"); + for (i = first; i <= last; i++) { + int undefined; + byte2 = i & 0xff; + byte1 = i >> 8; + undefined = (fontinfo->min_char_or_byte2 > byte2 || + fontinfo->max_char_or_byte2 < byte2 || + fontinfo->min_byte1 > byte1 || + fontinfo->max_byte1 < byte1); + if (undefined) { + printf("0,\n"); + } else { + if (fontinfo->per_char != NULL) { + if (rows == 1) { + index = i - fontinfo->min_char_or_byte2; + } else { + byte2 = i & 0xff; + byte1 = i >> 8; + index = + (byte1 - fontinfo->min_byte1) * pages + + (byte2 - fontinfo->min_char_or_byte2); + } + charinfo = &(fontinfo->per_char[index]); + charWidth = charinfo->rbearing - charinfo->lbearing; + charHeight = charinfo->ascent + charinfo->descent; + if (charWidth == 0 || charHeight == 0) { + if (charinfo->width == 0) { + printf("0,\n"); + continue; + } + } + } + printf("&ch%d,\n", i); + } + } + printf("};\n\n"); + printf("const BitmapFontRec %s = {\n", name); + printf("\"%s\",\n", xfont); + printf("%d,\n", last - first + 1); + printf("%d,\n", first); + printf("chars\n"); + printf("};\n\n"); + XFreeFont(dpy, fontinfo); +} + +int +main(int argc, char **argv) +{ + Display *dpy; + Font font; + + if (argc != 3) { + fprintf(stderr, "usage: capturexfont XFONT NAME\n"); + exit(1); + } + dpy = XOpenDisplay(NULL); + if (dpy == NULL) { + fprintf(stderr, "capturexfont: could not open X display\n"); + exit(1); + } + font = XLoadFont(dpy, argv[1]); + if (font == None) { + fprintf(stderr, "capturexfont: bad font\n"); + exit(1); + } + captureXFont(dpy, font, argv[1], argv[2]); + XCloseDisplay(dpy); + return 0; +} diff --git a/xc/extras/Mesa/src-glut/descrip.mms b/xc/extras/Mesa/src-glut/descrip.mms new file mode 100644 index 000000000..e6aeb8352 --- /dev/null +++ b/xc/extras/Mesa/src-glut/descrip.mms @@ -0,0 +1,162 @@ +# Makefile for GLUT for VMS +# contributed by Jouk Jansen joukj@crys.chem.uva.nl + +.first + define gl [-.include.gl] + +.include [-]mms-config. + +##### MACROS ##### +GLUT_MAJOR = 3 +GLUT_MINOR = 7 + +VPATH = RCS + +INCDIR = [-.include] +LIBDIR = [-.lib] +CFLAGS = /nowarn/include=$(INCDIR)/prefix=all + +SOURCES = \ +glut_8x13.c \ +glut_9x15.c \ +glut_bitmap.c \ +glut_bwidth.c \ +glut_cindex.c \ +glut_cmap.c \ +glut_cursor.c \ +glut_dials.c \ +glut_dstr.c \ +glut_event.c \ +glut_ext.c \ +glut_fullscrn.c \ +glut_gamemode.c \ +glut_get.c \ +glut_glxext.c \ +glut_hel10.c \ +glut_hel12.c \ +glut_hel18.c \ +glut_init.c \ +glut_input.c \ +glut_joy.c \ +glut_key.c \ +glut_keyctrl.c \ +glut_keyup.c \ +glut_menu.c \ +glut_menu2.c \ +glut_mesa.c \ +glut_modifier.c \ +glut_mroman.c \ +glut_overlay.c \ +glut_roman.c \ +glut_shapes.c \ +glut_space.c \ +glut_stroke.c \ +glut_swap.c \ +glut_swidth.c \ +glut_tablet.c \ +glut_teapot.c \ +glut_tr10.c \ +glut_tr24.c \ +glut_util.c \ +glut_vidresize.c \ +glut_warp.c \ +glut_win.c \ +glut_winmisc.c \ +layerutil.c + +OBJECTS = \ +glut_8x13.obj,\ +glut_9x15.obj,\ +glut_bitmap.obj,\ +glut_bwidth.obj,\ +glut_cindex.obj,\ +glut_cmap.obj,\ +glut_cursor.obj,\ +glut_dials.obj,\ +glut_dstr.obj,\ +glut_event.obj,\ +glut_ext.obj,\ +glut_fullscrn.obj,\ +glut_gamemode.obj + +OBJECTS1=glut_get.obj,\ +glut_glxext.obj,\ +glut_hel10.obj,\ +glut_hel12.obj,\ +glut_hel18.obj,\ +glut_init.obj,\ +glut_input.obj,\ +glut_joy.obj,\ +glut_key.obj,\ +glut_keyctrl.obj,\ +glut_keyup.obj,\ +glut_menu.obj,\ +glut_menu2.obj,\ +glut_mesa.obj,\ +glut_modifier.obj + +OBJECTS2=glut_mroman.obj,\ +glut_overlay.obj,\ +glut_roman.obj,\ +glut_shapes.obj,\ +glut_space.obj,\ +glut_stroke.obj,\ +glut_swap.obj,\ +glut_swidth.obj,\ +glut_tablet.obj,\ +glut_teapot.obj,\ +glut_tr10.obj,\ +glut_tr24.obj,\ +glut_util.obj,\ +glut_vidresize.obj + +OBJECTS3=glut_warp.obj,\ +glut_win.obj,\ +glut_winmisc.obj,\ +layerutil.obj + +##### RULES ##### + +VERSION=Glut V3.7 + +##### TARGETS ##### + +# Make the library: +$(LIBDIR)$(GLUT_LIB) : $(OBJECTS) $(OBJECTS1) $(OBJECTS2) $(OBJECTS3) +.ifdef SHARE + @ WRITE_ SYS$OUTPUT " generating mesagl1.opt" + @ OPEN_/WRITE FILE mesagl1.opt + @ WRITE_ FILE "!" + @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)" + @ WRITE_ FILE "!" + @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)""" + @ WRITE_ FILE "GSMATCH=LEQUAL,3,7 + @ WRITE_ FILE "$(OBJECTS)" + @ WRITE_ FILE "$(OBJECTS1)" + @ WRITE_ FILE "$(OBJECTS2)" + @ WRITE_ FILE "$(OBJECTS3)" + @ WRITE_ FILE "[-.lib]libmesaglu.exe/SHARE" + @ WRITE_ FILE "[-.lib]libmesagl.exe/SHARE" + @ write file "sys$library:decw$xmulibshr.exe/share" + @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE" + @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE" + @ CLOSE_ FILE + @ WRITE_ SYS$OUTPUT " generating mesagl.map ..." + @ LINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT + @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..." + @ @[-.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt + @ WRITE_ SYS$OUTPUT " linking $(GLUT_LIB) ..." + @ LINK_/NODEB/SHARE=$(GLUT_LIB)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt +.else + @ $(MAKELIB) $(GLUT_LIB) $(OBJECTS) + @ library $(GLUT_LIB) $(OBJECTS1) + @ library $(GLUT_LIB) $(OBJECTS2) + @ library $(GLUT_LIB) $(OBJECTS3) +.endif + @ rename $(GLUT_LIB)* $(LIBDIR) + +clean : + delete *.obj;* + purge + +include mms_depend. diff --git a/xc/extras/Mesa/src-glut/fxglut.def b/xc/extras/Mesa/src-glut/fxglut.def new file mode 100644 index 000000000..ff6ffb1d3 --- /dev/null +++ b/xc/extras/Mesa/src-glut/fxglut.def @@ -0,0 +1,103 @@ +EXPORTS
+ glutInit
+ glutInitDisplayMode
+ glutInitDisplayString
+ glutInitWindowPosition
+ glutInitWindowSize
+ glutMainLoop
+ glutCreateWindow
+ glutCreateSubWindow
+ glutDestroyWindow
+ glutPostRedisplay
+ glutSwapBuffers
+ glutGetWindow
+ glutSetWindow
+ glutSetWindowTitle
+ glutSetIconTitle
+ glutPositionWindow
+ glutReshapeWindow
+ glutPopWindow
+ glutPushWindow
+ glutIconifyWindow
+ glutShowWindow
+ glutHideWindow
+ glutFullScreen
+ glutSetCursor
+ glutWarpPointer
+ glutEstablishOverlay
+ glutRemoveOverlay
+ glutUseLayer
+ glutPostOverlayRedisplay
+ glutShowOverlay
+ glutHideOverlay
+ glutCreateMenu
+ glutDestroyMenu
+ glutGetMenu
+ glutSetMenu
+ glutAddMenuEntry
+ glutAddSubMenu
+ glutChangeToMenuEntry
+ glutChangeToSubMenu
+ glutRemoveMenuItem
+ glutAttachMenu
+ glutDetachMenu
+ glutDisplayFunc
+ glutReshapeFunc
+ glutKeyboardFunc
+ glutMouseFunc
+ glutMotionFunc
+ glutPassiveMotionFunc
+ glutEntryFunc
+ glutVisibilityFunc
+ glutIdleFunc
+ glutTimerFunc
+ glutMenuStateFunc
+ glutSpecialFunc
+ glutSpaceballMotionFunc
+ glutSpaceballRotateFunc
+ glutSpaceballButtonFunc
+ glutButtonBoxFunc
+ glutDialsFunc
+ glutTabletMotionFunc
+ glutTabletButtonFunc
+ glutMenuStatusFunc
+ glutOverlayDisplayFunc
+ glutWindowStatusFunc
+ glutSetColor
+ glutGetColor
+ glutCopyColormap
+ glutGet
+ glutDeviceGet
+ glutExtensionSupported
+ glutGetModifiers
+ glutLayerGet
+ glutBitmapCharacter
+ glutBitmapWidth
+ glutStrokeCharacter
+ glutStrokeWidth
+ glutBitmapLength
+ glutStrokeLength
+ glutWireSphere
+ glutSolidSphere
+ glutWireCone
+ glutSolidCone
+ glutWireCube
+ glutSolidCube
+ glutWireTorus
+ glutSolidTorus
+ glutWireDodecahedron
+ glutSolidDodecahedron
+ glutWireTeapot
+ glutSolidTeapot
+ glutWireOctahedron
+ glutSolidOctahedron
+ glutWireTetrahedron
+ glutSolidTetrahedron
+ glutWireIcosahedron
+ glutSolidIcosahedron
+ glutVideoResizeGet
+ glutSetupVideoResizing
+ glutStopVideoResizing
+ glutVideoResize
+ glutVideoPan
+ glutReportErrors
diff --git a/xc/extras/Mesa/src-glut/glut_8x13.c b/xc/extras/Mesa/src-glut/glut_8x13.c new file mode 100644 index 000000000..843c63d35 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_8x13.c @@ -0,0 +1,2073 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmap8By13 XXX +#include "glutbitmap.h" +#undef glutBitmap8By13 + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch0data[] = { 0x0 }; +static const BitmapCharRec ch0 = {1,1,0,0,8,ch0data}; +#else +static const BitmapCharRec ch0 = {0,0,0,0,8,0}; +#endif + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,8,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,8,0}; +#endif + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch127data[] = { 0x0 }; +static const BitmapCharRec ch127 = {1,1,0,0,8,ch127data}; +#else +static const BitmapCharRec ch127 = {0,0,0,0,8,0}; +#endif + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,8,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,8,0}; +#endif + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch255 = {6,12,-1,2,8,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {6,10,-1,2,8,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {6,12,-1,2,8,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch252 = {6,10,-1,0,8,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch251 = {6,10,-1,0,8,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch250 = {6,10,-1,0,8,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch249 = {6,10,-1,0,8,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x80,0x78,0xc4,0xa4,0x94,0x8c,0x78,0x4, +}; + +static const BitmapCharRec ch248 = {6,8,-1,1,8,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x20,0x0,0xf8,0x0,0x20,0x20, +}; + +static const BitmapCharRec ch247 = {5,7,-1,-1,8,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch246 = {6,10,-1,0,8,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {6,10,-1,0,8,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch244 = {6,10,-1,0,8,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch243 = {6,10,-1,0,8,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch242 = {6,10,-1,0,8,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x84,0x84,0x84,0x84,0xc4,0xb8,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch241 = {6,10,-1,0,8,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x78,0x84,0x84,0x84,0x84,0x78,0x8,0x50,0x30,0x48, +}; + +static const BitmapCharRec ch240 = {6,10,-1,0,8,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch239 = {5,10,-1,0,8,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x90,0x60, +}; + +static const BitmapCharRec ch238 = {5,10,-1,0,8,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch237 = {5,10,-1,0,8,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch236 = {5,10,-1,0,8,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch235 = {6,10,-1,0,8,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch234 = {6,10,-1,0,8,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch233 = {6,10,-1,0,8,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch232 = {6,10,-1,0,8,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x20,0x10,0x78,0x84,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch231 = {6,8,-1,2,8,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x6c,0x92,0x90,0x7c,0x12,0x6c, +}; + +static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x30,0x48,0x30, +}; + +static const BitmapCharRec ch229 = {6,10,-1,0,8,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch228 = {6,10,-1,0,8,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch227 = {6,10,-1,0,8,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch226 = {6,10,-1,0,8,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch225 = {6,10,-1,0,8,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch224 = {6,10,-1,0,8,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0x80,0xb8,0xc4,0x84,0x84,0xf8,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch223 = {6,9,-1,1,8,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80, +}; + +static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x20,0x20,0x20,0x20,0x50,0x88,0x88,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch221 = {5,10,-1,0,8,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch219 = {6,10,-1,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch218 = {6,10,-1,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {6,10,-1,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x78,0xc4,0xa4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, +}; + +static const BitmapCharRec ch216 = {6,11,-1,1,8,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x84,0x48,0x30,0x30,0x48,0x84, +}; + +static const BitmapCharRec ch215 = {6,6,-1,-1,8,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch214 = {7,10,0,0,8,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch213 = {7,10,0,0,8,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x24,0x18, +}; + +static const BitmapCharRec ch212 = {7,10,0,0,8,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch211 = {7,10,0,0,8,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x8,0x10, +}; + +static const BitmapCharRec ch210 = {7,10,0,0,8,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0xfc,0x42,0x42,0x42,0xe2,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch208 = {7,9,0,0,8,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch207 = {5,10,-1,0,8,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch206 = {5,10,-1,0,8,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch205 = {5,10,-1,0,8,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch204 = {5,10,-1,0,8,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch203 = {6,10,-1,0,8,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch202 = {6,10,-1,0,8,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch201 = {6,10,-1,0,8,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch200 = {6,10,-1,0,8,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x20,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch199 = {6,11,-1,2,8,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x9e,0x90,0x90,0xf0,0x9c,0x90,0x90,0x90,0x6e, +}; + +static const BitmapCharRec ch198 = {7,9,0,0,8,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x30,0x48,0x30, +}; + +static const BitmapCharRec ch197 = {6,10,-1,0,8,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x48, +}; + +static const BitmapCharRec ch196 = {6,10,-1,0,8,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch195 = {6,10,-1,0,8,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x30, +}; + +static const BitmapCharRec ch194 = {6,10,-1,0,8,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch193 = {6,10,-1,0,8,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {6,10,-1,0,8,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x78,0x84,0x84,0x80,0x40,0x20,0x20,0x0,0x20, +}; + +static const BitmapCharRec ch191 = {6,9,-1,0,8,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch190 = {7,10,0,0,8,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch189 = {7,10,0,0,8,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch188 = {7,10,0,0,8,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x90,0x48,0x24,0x12,0x24,0x48,0x90, +}; + +static const BitmapCharRec ch187 = {7,7,0,-1,8,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xf0,0x0,0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch186 = {4,6,-1,-3,8,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {3,6,-1,-4,8,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x40, +}; + +static const BitmapCharRec ch184 = {2,2,-3,2,8,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0, +}; + +static const BitmapCharRec ch183 = {2,1,-3,-4,8,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, +}; + +static const BitmapCharRec ch182 = {6,9,-1,0,8,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0xb4,0xcc,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch181 = {6,7,-1,1,8,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,-3,-8,8,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x60,0x90,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch179 = {4,6,-1,-4,8,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf0,0x80,0x60,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch178 = {4,6,-1,-4,8,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,-1,-1,8,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,-2,-5,8,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xfc, +}; + +static const BitmapCharRec ch175 = {6,1,-1,-8,8,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x38,0x44,0xaa,0xb2,0xaa,0xaa,0x92,0x44,0x38, +}; + +static const BitmapCharRec ch174 = {7,9,0,-1,8,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xfc, +}; + +static const BitmapCharRec ch173 = {6,1,-1,-4,8,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x4,0x4,0x4,0xfc, +}; + +static const BitmapCharRec ch172 = {6,4,-1,-1,8,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x12,0x24,0x48,0x90,0x48,0x24,0x12, +}; + +static const BitmapCharRec ch171 = {7,7,0,-1,8,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xf8,0x0,0x78,0x88,0x78,0x8,0x70, +}; + +static const BitmapCharRec ch170 = {5,7,-1,-2,8,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x38,0x44,0x92,0xaa,0xa2,0xaa,0x92,0x44,0x38, +}; + +static const BitmapCharRec ch169 = {7,9,0,-1,8,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xd8, +}; + +static const BitmapCharRec ch168 = {5,1,-1,-8,8,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x60,0x90,0x10,0x60,0x90,0x90,0x60,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch167 = {4,10,-2,0,8,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,9,-3,0,8,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch165 = {7,9,0,0,8,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x84,0x78,0x48,0x48,0x78,0x84, +}; + +static const BitmapCharRec ch164 = {6,6,-1,-1,8,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch163 = {7,9,0,0,8,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x20,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x20, +}; + +static const BitmapCharRec ch162 = {5,8,-1,-1,8,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,9,-3,0,8,ch161data}; + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x90,0xa8,0x48, +}; + +static const BitmapCharRec ch126 = {5,3,-1,-6,8,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xe0,0x10,0x10,0x20,0x18,0x20,0x10,0x10,0xe0, +}; + +static const BitmapCharRec ch125 = {5,9,-1,0,8,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,9,-3,0,8,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x38,0x40,0x40,0x20,0xc0,0x20,0x40,0x40,0x38, +}; + +static const BitmapCharRec ch123 = {5,9,-2,0,8,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xfc,0x40,0x20,0x10,0x8,0xfc, +}; + +static const BitmapCharRec ch122 = {6,6,-1,0,8,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch121 = {6,8,-1,2,8,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x84,0x48,0x30,0x30,0x48,0x84, +}; + +static const BitmapCharRec ch120 = {6,6,-1,0,8,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x44,0xaa,0x92,0x92,0x82,0x82, +}; + +static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x50,0x50,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch118 = {5,6,-1,0,8,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x74,0x88,0x88,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch117 = {6,6,-1,0,8,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x38,0x44,0x40,0x40,0x40,0xf8,0x40,0x40, +}; + +static const BitmapCharRec ch116 = {6,8,-1,0,8,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x78,0x84,0x18,0x60,0x84,0x78, +}; + +static const BitmapCharRec ch115 = {6,6,-1,0,8,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x40,0x40,0x40,0x40,0x44,0xb8, +}; + +static const BitmapCharRec ch114 = {6,6,-1,0,8,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x4,0x4,0x4,0x74,0x8c,0x84,0x8c,0x74, +}; + +static const BitmapCharRec ch113 = {6,8,-1,2,8,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0x80,0xb8,0xc4,0x84,0xc4,0xb8, +}; + +static const BitmapCharRec ch112 = {6,8,-1,2,8,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x78,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch111 = {6,6,-1,0,8,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x84,0x84,0x84,0x84,0xc4,0xb8, +}; + +static const BitmapCharRec ch110 = {6,6,-1,0,8,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x82,0x92,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, +}; + +static const BitmapCharRec ch108 = {5,9,-1,0,8,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x84,0x88,0x90,0xe0,0x90,0x88,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {6,9,-1,0,8,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x18,0x0,0x8, +}; + +static const BitmapCharRec ch106 = {5,10,-1,2,8,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x20, +}; + +static const BitmapCharRec ch105 = {5,8,-1,0,8,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x84,0x84,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {6,9,-1,0,8,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x78,0x84,0x78,0x80,0x70,0x88,0x88,0x74, +}; + +static const BitmapCharRec ch103 = {6,8,-1,2,8,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x40,0x40,0x40,0x40,0xf8,0x40,0x40,0x44,0x38, +}; + +static const BitmapCharRec ch102 = {6,9,-1,0,8,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x78,0x84,0x80,0xfc,0x84,0x78, +}; + +static const BitmapCharRec ch101 = {6,6,-1,0,8,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x74,0x8c,0x84,0x84,0x8c,0x74,0x4,0x4,0x4, +}; + +static const BitmapCharRec ch100 = {6,9,-1,0,8,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x78,0x84,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch99 = {6,6,-1,0,8,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {6,9,-1,0,8,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x74,0x8c,0x84,0x7c,0x4,0x78, +}; + +static const BitmapCharRec ch97 = {6,6,-1,0,8,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x10,0x60,0xe0, +}; + +static const BitmapCharRec ch96 = {4,3,-2,-6,8,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xfe, +}; + +static const BitmapCharRec ch95 = {7,1,0,1,8,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x88,0x50,0x20, +}; + +static const BitmapCharRec ch94 = {5,3,-1,-6,8,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, +}; + +static const BitmapCharRec ch93 = {4,9,-1,0,8,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x2,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {7,9,0,0,8,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, +}; + +static const BitmapCharRec ch91 = {4,9,-2,0,8,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xfc,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0xfc, +}; + +static const BitmapCharRec ch90 = {6,9,-1,0,8,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch89 = {7,9,0,0,8,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x82,0x82,0x44,0x28,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch88 = {7,9,0,0,8,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x44,0xaa,0x92,0x92,0x92,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch87 = {7,9,0,0,8,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,9,0,0,8,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, +}; + +static const BitmapCharRec ch84 = {7,9,0,0,8,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x78,0x84,0x4,0x4,0x78,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x84,0x88,0x90,0xa0,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x4,0x78,0x94,0xa4,0x84,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch81 = {6,10,-1,1,8,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch79 = {6,9,-1,0,8,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x84,0x84,0x84,0x8c,0x94,0xa4,0xc4,0x84,0x84, +}; + +static const BitmapCharRec ch78 = {6,9,-1,0,8,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x82,0x82,0x82,0x92,0x92,0xaa,0xc6,0x82,0x82, +}; + +static const BitmapCharRec ch77 = {7,9,0,0,8,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xfc,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {6,9,-1,0,8,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x84,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x84, +}; + +static const BitmapCharRec ch75 = {6,9,-1,0,8,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x70,0x88,0x8,0x8,0x8,0x8,0x8,0x8,0x3c, +}; + +static const BitmapCharRec ch74 = {6,9,-1,0,8,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, +}; + +static const BitmapCharRec ch73 = {5,9,-1,0,8,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch72 = {6,9,-1,0,8,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x74,0x8c,0x84,0x9c,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch71 = {6,9,-1,0,8,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xfc,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch68 = {7,9,0,0,8,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch67 = {6,9,-1,0,8,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xfc,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch66 = {7,9,0,0,8,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x48,0x30, +}; + +static const BitmapCharRec ch65 = {6,9,-1,0,8,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x78,0x80,0x94,0xac,0xa4,0x9c,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch64 = {6,9,-1,0,8,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x10,0x0,0x10,0x10,0x8,0x4,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch63 = {6,9,-1,0,8,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x10,0x8,0x10,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {5,9,-1,0,8,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xfc,0x0,0x0,0xfc, +}; + +static const BitmapCharRec ch61 = {6,4,-1,-2,8,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x8,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x8, +}; + +static const BitmapCharRec ch60 = {5,9,-2,0,8,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x60,0x70,0x0,0x0,0x20,0x70,0x20, +}; + +static const BitmapCharRec ch59 = {4,8,-1,1,8,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x40,0xe0,0x40,0x0,0x0,0x40,0xe0,0x40, +}; + +static const BitmapCharRec ch58 = {3,8,-2,1,8,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x70,0x8,0x4,0x4,0x74,0x8c,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch57 = {6,9,-1,0,8,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x78,0x84,0x84,0x84,0x78,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch56 = {6,9,-1,0,8,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x10,0x10,0x8,0x4,0xfc, +}; + +static const BitmapCharRec ch55 = {6,9,-1,0,8,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x78,0x84,0x84,0xc4,0xb8,0x80,0x80,0x40,0x38, +}; + +static const BitmapCharRec ch54 = {6,9,-1,0,8,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x78,0x84,0x4,0x4,0xc4,0xb8,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch53 = {6,9,-1,0,8,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x8,0x8,0xfc,0x88,0x88,0x48,0x28,0x18,0x8, +}; + +static const BitmapCharRec ch52 = {6,9,-1,0,8,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x78,0x84,0x4,0x4,0x38,0x10,0x8,0x4,0xfc, +}; + +static const BitmapCharRec ch51 = {6,9,-1,0,8,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xfc,0x80,0x40,0x30,0x8,0x4,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch50 = {6,9,-1,0,8,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, +}; + +static const BitmapCharRec ch49 = {5,9,-1,0,8,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x48,0x30, +}; + +static const BitmapCharRec ch48 = {6,9,-1,0,8,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x2, +}; + +static const BitmapCharRec ch47 = {7,9,0,0,8,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x40,0xe0,0x40, +}; + +static const BitmapCharRec ch46 = {3,3,-2,1,8,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xfc, +}; + +static const BitmapCharRec ch45 = {6,1,-1,-4,8,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x60,0x70, +}; + +static const BitmapCharRec ch44 = {4,3,-1,1,8,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,-1,-2,8,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x48,0x30,0xfc,0x30,0x48, +}; + +static const BitmapCharRec ch42 = {6,5,-1,-2,8,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,9,-2,0,8,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,9,-3,0,8,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x60,0x70, +}; + +static const BitmapCharRec ch39 = {4,3,-1,-6,8,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x74,0x88,0x94,0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch38 = {6,7,-1,0,8,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x88,0x54,0x48,0x20,0x10,0x10,0x48,0xa4,0x44, +}; + +static const BitmapCharRec ch37 = {6,9,-1,0,8,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0xf0,0x28,0x70,0xa0,0x78,0x20, +}; + +static const BitmapCharRec ch36 = {5,7,-1,-1,8,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x48,0x48,0xfc,0x48,0xfc,0x48,0x48, +}; + +static const BitmapCharRec ch35 = {6,7,-1,-1,8,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x90,0x90,0x90, +}; + +static const BitmapCharRec ch34 = {4,3,-2,-6,8,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,9,-3,0,8,ch33data}; + +/* char: 0x1f */ + +static const GLubyte ch31data[] = { +0x80, +}; + +static const BitmapCharRec ch31 = {1,1,-3,-3,8,ch31data}; + +/* char: 0x1e */ + +static const GLubyte ch30data[] = { +0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch30 = {7,9,0,0,8,ch30data}; + +/* char: 0x1d */ + +static const GLubyte ch29data[] = { +0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, +}; + +static const BitmapCharRec ch29 = {7,7,0,0,8,ch29data}; + +/* char: 0x1c */ + +static const GLubyte ch28data[] = { +0x88,0x48,0x48,0x48,0x48,0xfc, +}; + +static const BitmapCharRec ch28 = {6,6,-1,0,8,ch28data}; + +/* char: 0x1b */ + +static const GLubyte ch27data[] = { +0xfe,0x80,0x20,0x8,0x2,0x8,0x20,0x80, +}; + +static const BitmapCharRec ch27 = {7,8,0,0,8,ch27data}; + +/* char: 0x1a */ + +static const GLubyte ch26data[] = { +0xfe,0x2,0x8,0x20,0x80,0x20,0x8,0x2, +}; + +static const BitmapCharRec ch26 = {7,8,0,0,8,ch26data}; + +/* char: 0x19 */ + +static const GLubyte ch25data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch25 = {1,13,-3,2,8,ch25data}; + +/* char: 0x18 */ + +static const GLubyte ch24data[] = { +0x10,0x10,0x10,0x10,0x10,0xff, +}; + +static const BitmapCharRec ch24 = {8,6,0,2,8,ch24data}; + +/* char: 0x17 */ + +static const GLubyte ch23data[] = { +0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch23 = {8,8,0,-3,8,ch23data}; + +/* char: 0x16 */ + +static const GLubyte ch22data[] = { +0x10,0x10,0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch22 = {4,13,0,2,8,ch22data}; + +/* char: 0x15 */ + +static const GLubyte ch21data[] = { +0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch21 = {5,13,-3,2,8,ch21data}; + +/* char: 0x14 */ + +static const GLubyte ch20data[] = { +0xff, +}; + +static const BitmapCharRec ch20 = {8,1,0,1,8,ch20data}; + +/* char: 0x13 */ + +static const GLubyte ch19data[] = { +0xff, +}; + +static const BitmapCharRec ch19 = {8,1,0,-1,8,ch19data}; + +/* char: 0x12 */ + +static const GLubyte ch18data[] = { +0xff, +}; + +static const BitmapCharRec ch18 = {8,1,0,-3,8,ch18data}; + +/* char: 0x11 */ + +static const GLubyte ch17data[] = { +0xff, +}; + +static const BitmapCharRec ch17 = {8,1,0,-5,8,ch17data}; + +/* char: 0x10 */ + +static const GLubyte ch16data[] = { +0xff, +}; + +static const BitmapCharRec ch16 = {8,1,0,-7,8,ch16data}; + +/* char: 0xf */ + +static const GLubyte ch15data[] = { +0x10,0x10,0x10,0x10,0x10,0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch15 = {8,13,0,2,8,ch15data}; + +/* char: 0xe */ + +static const GLubyte ch14data[] = { +0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch14 = {5,8,-3,-3,8,ch14data}; + +/* char: 0xd */ + +static const GLubyte ch13data[] = { +0x80,0x80,0x80,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch13 = {5,6,-3,2,8,ch13data}; + +/* char: 0xc */ + +static const GLubyte ch12data[] = { +0x10,0x10,0x10,0x10,0x10,0xf0, +}; + +static const BitmapCharRec ch12 = {4,6,0,2,8,ch12data}; + +/* char: 0xb */ + +static const GLubyte ch11data[] = { +0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch11 = {4,8,0,-3,8,ch11data}; + +/* char: 0xa */ + +static const GLubyte ch10data[] = { +0x8,0x8,0x8,0x8,0x3e,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch10 = {7,9,0,2,8,ch10data}; + +/* char: 0x9 */ + +static const GLubyte ch9data[] = { +0x3e,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, +}; + +static const BitmapCharRec ch9 = {7,9,0,2,8,ch9data}; + +/* char: 0x8 */ + +static const GLubyte ch8data[] = { +0xfe,0x10,0x10,0xfe,0x10,0x10, +}; + +static const BitmapCharRec ch8 = {7,6,0,0,8,ch8data}; + +/* char: 0x7 */ + +static const GLubyte ch7data[] = { +0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch7 = {5,4,-1,-5,8,ch7data}; + +/* char: 0x6 */ + +static const GLubyte ch6data[] = { +0x20,0x20,0x3c,0x20,0x3e,0xf8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch6 = {7,9,0,2,8,ch6data}; + +/* char: 0x5 */ + +static const GLubyte ch5data[] = { +0x22,0x22,0x3c,0x22,0x3c,0x78,0x80,0x80,0x78, +}; + +static const BitmapCharRec ch5 = {7,9,0,2,8,ch5data}; + +/* char: 0x4 */ + +static const GLubyte ch4data[] = { +0x10,0x10,0x1c,0x10,0x9e,0x80,0xe0,0x80,0xf0, +}; + +static const BitmapCharRec ch4 = {7,9,0,2,8,ch4data}; + +/* char: 0x3 */ + +static const GLubyte ch3data[] = { +0x8,0x8,0x8,0x3e,0x88,0x88,0xf8,0x88,0x88, +}; + +static const BitmapCharRec ch3 = {7,9,0,2,8,ch3data}; + +/* char: 0x2 */ + +static const GLubyte ch2data[] = { +0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, +}; + +static const BitmapCharRec ch2 = {8,12,0,2,8,ch2data}; + +/* char: 0x1 */ + +static const GLubyte ch1data[] = { +0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, +}; + +static const BitmapCharRec ch1 = {7,7,0,-1,8,ch1data}; + +static const BitmapCharRec * const chars[] = { +&ch0, +&ch1, +&ch2, +&ch3, +&ch4, +&ch5, +&ch6, +&ch7, +&ch8, +&ch9, +&ch10, +&ch11, +&ch12, +&ch13, +&ch14, +&ch15, +&ch16, +&ch17, +&ch18, +&ch19, +&ch20, +&ch21, +&ch22, +&ch23, +&ch24, +&ch25, +&ch26, +&ch27, +&ch28, +&ch29, +&ch30, +&ch31, +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +&ch127, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmap8By13 = { +"-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1", +256, +0, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_9x15.c b/xc/extras/Mesa/src-glut/glut_9x15.c new file mode 100644 index 000000000..2d5c004e4 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_9x15.c @@ -0,0 +1,2075 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmap9By15 XXX +#include "glutbitmap.h" +#undef glutBitmap9By15 + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch0data[] = { 0x0 }; +static const BitmapCharRec ch0 = {1,1,0,0,9,ch0data}; +#else +static const BitmapCharRec ch0 = {0,0,0,0,9,0}; +#endif + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,9,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,9,0}; +#endif + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch127data[] = { 0x0 }; +static const BitmapCharRec ch127 = {1,1,0,0,9,ch127data}; +#else +static const BitmapCharRec ch127 = {0,0,0,0,9,0}; +#endif + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,9,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,9,0}; +#endif + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch255 = {6,14,-1,3,9,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {7,12,-1,3,9,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch253 = {6,14,-1,3,9,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch252 = {7,11,-1,0,9,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch251 = {7,11,-1,0,9,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch250 = {7,11,-1,0,9,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch249 = {7,11,-1,0,9,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x80,0x7c,0xa2,0xa2,0x92,0x8a,0x8a,0x7c,0x2, +}; + +static const BitmapCharRec ch248 = {7,9,-1,1,9,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x10,0x38,0x10,0x0,0xfe,0x0,0x10,0x38,0x10, +}; + +static const BitmapCharRec ch247 = {7,9,-1,0,9,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch246 = {7,11,-1,0,9,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {7,11,-1,0,9,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch244 = {7,11,-1,0,9,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch243 = {7,11,-1,0,9,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch242 = {7,11,-1,0,9,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch241 = {7,11,-1,0,9,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x8,0x50,0x30,0x48, +}; + +static const BitmapCharRec ch240 = {7,11,-1,0,9,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch239 = {5,11,-2,0,9,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x90,0x60, +}; + +static const BitmapCharRec ch238 = {5,11,-2,0,9,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60,0x10, +}; + +static const BitmapCharRec ch237 = {5,11,-2,0,9,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x30,0x40, +}; + +static const BitmapCharRec ch236 = {5,11,-2,0,9,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch235 = {7,11,-1,0,9,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch234 = {7,11,-1,0,9,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch233 = {7,11,-1,0,9,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch232 = {7,11,-1,0,9,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch231 = {7,10,-1,3,9,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x6e,0x92,0x90,0x7c,0x12,0x92,0x6c, +}; + +static const BitmapCharRec ch230 = {7,7,-1,0,9,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x18,0x24,0x18, +}; + +static const BitmapCharRec ch229 = {7,11,-1,0,9,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch228 = {7,11,-1,0,9,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch227 = {7,11,-1,0,9,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch226 = {7,11,-1,0,9,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch225 = {7,11,-1,0,9,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch224 = {7,11,-1,0,9,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0x80,0xbc,0xc2,0x82,0x82,0xfc,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch223 = {7,9,-1,1,9,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc,0x80,0x80, +}; + +static const BitmapCharRec ch222 = {7,10,-1,0,9,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch221 = {7,11,-1,0,9,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch220 = {7,11,-1,0,9,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch219 = {7,11,-1,0,9,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch218 = {7,11,-1,0,9,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch217 = {7,11,-1,0,9,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x7c,0xc2,0xa2,0xa2,0x92,0x92,0x8a,0x8a,0x86,0x7c,0x2, +}; + +static const BitmapCharRec ch216 = {7,12,-1,1,9,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x82,0x44,0x28,0x10,0x28,0x44,0x82, +}; + +static const BitmapCharRec ch215 = {7,7,-1,-1,9,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch214 = {7,11,-1,0,9,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch213 = {7,11,-1,0,9,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch212 = {7,11,-1,0,9,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch211 = {7,11,-1,0,9,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch210 = {7,11,-1,0,9,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x82,0x86,0x8a,0x92,0x92,0xa2,0xc2,0x82,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch209 = {7,11,-1,0,9,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0xfc,0x42,0x42,0x42,0x42,0xf2,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch208 = {7,10,-1,0,9,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, +}; + +static const BitmapCharRec ch207 = {5,11,-2,0,9,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x88,0x70, +}; + +static const BitmapCharRec ch206 = {5,11,-2,0,9,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x60,0x10, +}; + +static const BitmapCharRec ch205 = {5,11,-2,0,9,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x30,0x40, +}; + +static const BitmapCharRec ch204 = {5,11,-2,0,9,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch203 = {7,11,-1,0,9,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch202 = {7,11,-1,0,9,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch201 = {7,11,-1,0,9,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch200 = {7,11,-1,0,9,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch199 = {7,13,-1,3,9,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x9e,0x90,0x90,0x90,0xfc,0x90,0x90,0x90,0x90,0x6e, +}; + +static const BitmapCharRec ch198 = {7,10,-1,0,9,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,11,-1,0,9,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x28,0x28, +}; + +static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch195 = {7,11,-1,0,9,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x44,0x38, +}; + +static const BitmapCharRec ch194 = {7,11,-1,0,9,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x30,0x8, +}; + +static const BitmapCharRec ch193 = {7,11,-1,0,9,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x18,0x20, +}; + +static const BitmapCharRec ch192 = {7,11,-1,0,9,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x7c,0x82,0x82,0x80,0x40,0x20,0x10,0x10,0x0,0x10, +}; + +static const BitmapCharRec ch191 = {7,10,-1,0,9,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch190 = {7,10,-1,0,9,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch189 = {7,10,-1,0,9,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch188 = {7,10,-1,0,9,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x90,0x48,0x24,0x12,0x12,0x24,0x48,0x90, +}; + +static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xf8,0x0,0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch186 = {5,6,-1,-5,9,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {3,6,-1,-4,9,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0x60,0x90,0x30, +}; + +static const BitmapCharRec ch184 = {4,3,-2,3,9,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch183 = {2,2,-4,-4,9,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0xa,0xa,0xa,0xa,0xa,0x7a,0x8a,0x8a,0x8a,0x7e, +}; + +static const BitmapCharRec ch182 = {7,10,-1,0,9,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0xba,0xc6,0x82,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch181 = {7,9,-1,2,9,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0xc0,0x20, +}; + +static const BitmapCharRec ch180 = {3,2,-3,-9,9,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x60,0x90,0x10,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch179 = {4,6,-1,-4,9,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf0,0x80,0x60,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch178 = {4,6,-1,-4,9,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xfe,0x0,0x10,0x10,0x10,0xfe,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch177 = {7,9,-1,-1,9,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,-3,-6,9,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xfc, +}; + +static const BitmapCharRec ch175 = {6,1,-1,-9,9,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x3c,0x42,0xa5,0xa9,0xbd,0xa5,0xb9,0x42,0x3c, +}; + +static const BitmapCharRec ch174 = {8,9,0,-1,9,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xfc, +}; + +static const BitmapCharRec ch173 = {6,1,-1,-4,9,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x4,0x4,0x4,0xfc, +}; + +static const BitmapCharRec ch172 = {6,4,-1,-2,9,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x12,0x24,0x48,0x90,0x90,0x48,0x24,0x12, +}; + +static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xf8,0x0,0x78,0x90,0x70,0x90,0x60, +}; + +static const BitmapCharRec ch170 = {5,7,-3,-3,9,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x3c,0x42,0x99,0xa5,0xa1,0xa5,0x99,0x42,0x3c, +}; + +static const BitmapCharRec ch169 = {8,9,0,-1,9,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0,0xa0, +}; + +static const BitmapCharRec ch168 = {3,2,-3,-9,9,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x70,0x88,0x8,0x70,0x88,0x88,0x88,0x70,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch167 = {5,11,-2,1,9,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,11,-4,1,9,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x10,0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch165 = {7,10,-1,0,9,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x82,0x7c,0x44,0x44,0x7c,0x82, +}; + +static const BitmapCharRec ch164 = {7,6,-1,-3,9,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch163 = {7,10,-1,0,9,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x78,0xa4,0xa0,0x90,0x94,0x78,0x8, +}; + +static const BitmapCharRec ch162 = {6,8,-1,0,9,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80, +}; + +static const BitmapCharRec ch161 = {1,11,-4,0,9,ch161data}; + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x8c,0x92,0x62, +}; + +static const BitmapCharRec ch126 = {7,3,-1,-7,9,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xe0,0x10,0x10,0x10,0x20,0x18,0x18,0x20,0x10,0x10,0x10,0xe0, +}; + +static const BitmapCharRec ch125 = {5,12,-1,1,9,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,12,-4,1,9,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x38,0x40,0x40,0x40,0x20,0xc0,0xc0,0x20,0x40,0x40,0x40,0x38, +}; + +static const BitmapCharRec ch123 = {5,12,-3,1,9,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xfe,0x40,0x20,0x10,0x8,0x4,0xfe, +}; + +static const BitmapCharRec ch122 = {7,7,-1,0,9,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch121 = {6,10,-1,3,9,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x82,0x44,0x28,0x10,0x28,0x44,0x82, +}; + +static const BitmapCharRec ch120 = {7,7,-1,0,9,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x44,0xaa,0x92,0x92,0x92,0x82,0x82, +}; + +static const BitmapCharRec ch119 = {7,7,-1,0,9,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x10,0x28,0x28,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch118 = {7,7,-1,0,9,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x7a,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch117 = {7,7,-1,0,9,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x1c,0x22,0x20,0x20,0x20,0x20,0xfc,0x20,0x20, +}; + +static const BitmapCharRec ch116 = {7,9,-1,0,9,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x7c,0x82,0x2,0x7c,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch115 = {7,7,-1,0,9,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x40,0x40,0x40,0x40,0x42,0x62,0x9c, +}; + +static const BitmapCharRec ch114 = {7,7,-1,0,9,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x2,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x86,0x7a, +}; + +static const BitmapCharRec ch113 = {7,10,-1,3,9,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc, +}; + +static const BitmapCharRec ch112 = {7,10,-1,3,9,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch111 = {7,7,-1,0,9,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x82,0x82,0x82,0x82,0x82,0xc2,0xbc, +}; + +static const BitmapCharRec ch110 = {7,7,-1,0,9,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x82,0x92,0x92,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0, +}; + +static const BitmapCharRec ch108 = {5,10,-2,0,9,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x82,0x8c,0xb0,0xc0,0xb0,0x8c,0x82,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {7,10,-1,0,9,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x78,0x84,0x84,0x84,0x4,0x4,0x4,0x4,0x4,0x1c,0x0,0x0,0xc, +}; + +static const BitmapCharRec ch106 = {6,13,-1,3,9,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60, +}; + +static const BitmapCharRec ch105 = {5,10,-2,0,9,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {7,10,-1,0,9,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x7c,0x82,0x82,0x7c,0x80,0x78,0x84,0x84,0x84,0x7a, +}; + +static const BitmapCharRec ch103 = {7,10,-1,3,9,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x20,0x20,0x20,0x20,0xf8,0x20,0x20,0x22,0x22,0x1c, +}; + +static const BitmapCharRec ch102 = {7,10,-1,0,9,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch101 = {7,7,-1,0,9,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x7a,0x86,0x82,0x82,0x82,0x86,0x7a,0x2,0x2,0x2, +}; + +static const BitmapCharRec ch100 = {7,10,-1,0,9,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch99 = {7,7,-1,0,9,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {7,10,-1,0,9,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c, +}; + +static const BitmapCharRec ch97 = {7,7,-1,0,9,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x10,0x20,0x40,0xc0, +}; + +static const BitmapCharRec ch96 = {4,4,-3,-6,9,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xff, +}; + +static const BitmapCharRec ch95 = {8,1,0,1,9,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x82,0x44,0x28,0x10, +}; + +static const BitmapCharRec ch94 = {7,4,-1,-6,9,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, +}; + +static const BitmapCharRec ch93 = {4,12,-2,1,9,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x2,0x4,0x4,0x8,0x10,0x10,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch92 = {7,10,-1,0,9,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, +}; + +static const BitmapCharRec ch91 = {4,12,-3,1,9,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xfe,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, +}; + +static const BitmapCharRec ch90 = {7,10,-1,0,9,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch89 = {7,10,-1,0,9,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x82,0x82,0x44,0x28,0x10,0x10,0x28,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch88 = {7,10,-1,0,9,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x44,0xaa,0x92,0x92,0x92,0x92,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch87 = {7,10,-1,0,9,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,10,-1,0,9,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch85 = {7,10,-1,0,9,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, +}; + +static const BitmapCharRec ch84 = {7,10,-1,0,9,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x7c,0x82,0x82,0x2,0xc,0x70,0x80,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch83 = {7,10,-1,0,9,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x82,0x82,0x84,0x88,0x90,0xfc,0x82,0x82,0x82,0xfc, +}; + +static const BitmapCharRec ch82 = {7,10,-1,0,9,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x6,0x8,0x7c,0x92,0xa2,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch81 = {7,12,-1,2,9,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc, +}; + +static const BitmapCharRec ch80 = {7,10,-1,0,9,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch79 = {7,10,-1,0,9,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x82,0x82,0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x82, +}; + +static const BitmapCharRec ch78 = {7,10,-1,0,9,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x82,0x82,0x82,0x92,0x92,0xaa,0xaa,0xc6,0x82,0x82, +}; + +static const BitmapCharRec ch77 = {7,10,-1,0,9,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xfe,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {7,10,-1,0,9,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x82,0x84,0x88,0x90,0xa0,0xe0,0x90,0x88,0x84,0x82, +}; + +static const BitmapCharRec ch75 = {7,10,-1,0,9,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x78,0x84,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x1e, +}; + +static const BitmapCharRec ch74 = {7,10,-1,0,9,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, +}; + +static const BitmapCharRec ch73 = {5,10,-2,0,9,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x82,0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch72 = {7,10,-1,0,9,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x7c,0x82,0x82,0x82,0x8e,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch71 = {7,10,-1,0,9,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x40,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, +}; + +static const BitmapCharRec ch70 = {7,10,-1,0,9,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xfe,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, +}; + +static const BitmapCharRec ch69 = {7,10,-1,0,9,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch68 = {7,10,-1,0,9,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, +}; + +static const BitmapCharRec ch67 = {7,10,-1,0,9,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xfc,0x42,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, +}; + +static const BitmapCharRec ch66 = {7,10,-1,0,9,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x44,0x28,0x10, +}; + +static const BitmapCharRec ch65 = {7,10,-1,0,9,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x7c,0x80,0x80,0x9a,0xa6,0xa2,0x9e,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch64 = {7,10,-1,0,9,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x10,0x0,0x10,0x10,0x8,0x4,0x2,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch63 = {7,10,-1,0,9,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {5,10,-2,0,9,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xfe,0x0,0x0,0xfe, +}; + +static const BitmapCharRec ch61 = {7,4,-1,-2,9,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x8,0x10,0x20,0x40,0x80,0x80,0x40,0x20,0x10,0x8, +}; + +static const BitmapCharRec ch60 = {5,10,-2,0,9,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch59 = {2,10,-4,3,9,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch58 = {2,7,-4,0,9,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x78,0x4,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch57 = {7,10,-1,0,9,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x38,0x44,0x82,0x82,0x44,0x38,0x44,0x82,0x44,0x38, +}; + +static const BitmapCharRec ch56 = {7,10,-1,0,9,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x10,0x8,0x4,0x2,0x2,0xfe, +}; + +static const BitmapCharRec ch55 = {7,10,-1,0,9,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x7c,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x40,0x3c, +}; + +static const BitmapCharRec ch54 = {7,10,-1,0,9,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x7c,0x82,0x2,0x2,0x2,0xc2,0xbc,0x80,0x80,0xfe, +}; + +static const BitmapCharRec ch53 = {7,10,-1,0,9,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x4,0x4,0x4,0xfe,0x84,0x44,0x24,0x14,0xc,0x4, +}; + +static const BitmapCharRec ch52 = {7,10,-1,0,9,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x7c,0x82,0x2,0x2,0x2,0x1c,0x8,0x4,0x2,0xfe, +}; + +static const BitmapCharRec ch51 = {7,10,-1,0,9,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xfe,0x80,0x40,0x30,0x8,0x4,0x2,0x82,0x82,0x7c, +}; + +static const BitmapCharRec ch50 = {7,10,-1,0,9,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xfe,0x10,0x10,0x10,0x10,0x10,0x90,0x50,0x30,0x10, +}; + +static const BitmapCharRec ch49 = {7,10,-1,0,9,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38, +}; + +static const BitmapCharRec ch48 = {7,10,-1,0,9,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x40,0x40,0x20,0x10,0x10,0x8,0x4,0x4,0x2, +}; + +static const BitmapCharRec ch47 = {7,10,-1,0,9,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch46 = {2,2,-4,0,9,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xfe, +}; + +static const BitmapCharRec ch45 = {7,1,-1,-4,9,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch44 = {2,5,-4,3,9,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x10,0x10,0x10,0xfe,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch43 = {7,7,-1,-1,9,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x10,0x92,0x54,0x38,0x54,0x92,0x10, +}; + +static const BitmapCharRec ch42 = {7,7,-1,-1,9,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,12,-3,1,9,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,12,-3,1,9,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0x20,0x30, +}; + +static const BitmapCharRec ch39 = {4,4,-3,-6,9,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x62,0x94,0x88,0x94,0x62,0x60,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch38 = {7,10,-1,0,9,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x84,0x4a,0x4a,0x24,0x10,0x10,0x48,0xa4,0xa4,0x42, +}; + +static const BitmapCharRec ch37 = {7,10,-1,0,9,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x10,0x7c,0x92,0x12,0x12,0x14,0x38,0x50,0x90,0x92,0x7c,0x10, +}; + +static const BitmapCharRec ch36 = {7,12,-1,1,9,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48, +}; + +static const BitmapCharRec ch35 = {6,8,-1,-1,9,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x90,0x90,0x90, +}; + +static const BitmapCharRec ch34 = {4,3,-3,-7,9,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,11,-4,0,9,ch33data}; + +/* char: 0x1f */ + +static const GLubyte ch31data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch31 = {2,2,-4,-2,9,ch31data}; + +/* char: 0x1e */ + +static const GLubyte ch30data[] = { +0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, +}; + +static const BitmapCharRec ch30 = {7,10,-1,0,9,ch30data}; + +/* char: 0x1d */ + +static const GLubyte ch29data[] = { +0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, +}; + +static const BitmapCharRec ch29 = {7,7,-1,0,9,ch29data}; + +/* char: 0x1c */ + +static const GLubyte ch28data[] = { +0x44,0x24,0x24,0x24,0x24,0x24,0xfe, +}; + +static const BitmapCharRec ch28 = {7,7,-1,0,9,ch28data}; + +/* char: 0x1b */ + +static const GLubyte ch27data[] = { +0xfe,0x0,0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch27 = {7,12,-1,2,9,ch27data}; + +/* char: 0x1a */ + +static const GLubyte ch26data[] = { +0xfc,0x0,0x4,0x8,0x10,0x20,0x40,0x40,0x20,0x10,0x8,0x4, +}; + +static const BitmapCharRec ch26 = {6,12,-2,2,9,ch26data}; + +/* char: 0x19 */ + +static const GLubyte ch25data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch25 = {1,15,-4,3,9,ch25data}; + +/* char: 0x18 */ + +static const GLubyte ch24data[] = { +0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80, +}; + +static const BitmapCharRec ch24 = {9,7,0,3,9,ch24data}; + +/* char: 0x17 */ + +static const GLubyte ch23data[] = { +0xff,0x80,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, +0x8,0x0, +}; + +static const BitmapCharRec ch23 = {9,9,0,-3,9,ch23data}; + +/* char: 0x16 */ + +static const GLubyte ch22data[] = { +0x8,0x8,0x8,0x8,0x8,0x8,0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, +}; + +static const BitmapCharRec ch22 = {5,15,0,3,9,ch22data}; + +/* char: 0x15 */ + +static const GLubyte ch21data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch21 = {5,15,-4,3,9,ch21data}; + +/* char: 0x14 */ + +static const GLubyte ch20data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch20 = {9,1,0,1,9,ch20data}; + +/* char: 0x13 */ + +static const GLubyte ch19data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch19 = {9,1,0,-1,9,ch19data}; + +/* char: 0x12 */ + +static const GLubyte ch18data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch18 = {9,1,0,-3,9,ch18data}; + +/* char: 0x11 */ + +static const GLubyte ch17data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch17 = {9,1,0,-5,9,ch17data}; + +/* char: 0x10 */ + +static const GLubyte ch16data[] = { +0xff,0x80, +}; + +static const BitmapCharRec ch16 = {9,1,0,-7,9,ch16data}; + +/* char: 0xf */ + +static const GLubyte ch15data[] = { +0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80,0x8,0x0, +0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, +}; + +static const BitmapCharRec ch15 = {9,15,0,3,9,ch15data}; + +/* char: 0xe */ + +static const GLubyte ch14data[] = { +0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch14 = {5,9,-4,-3,9,ch14data}; + +/* char: 0xd */ + +static const GLubyte ch13data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch13 = {5,7,-4,3,9,ch13data}; + +/* char: 0xc */ + +static const GLubyte ch12data[] = { +0x8,0x8,0x8,0x8,0x8,0x8,0xf8, +}; + +static const BitmapCharRec ch12 = {5,7,0,3,9,ch12data}; + +/* char: 0xb */ + +static const GLubyte ch11data[] = { +0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, +}; + +static const BitmapCharRec ch11 = {5,9,0,-3,9,ch11data}; + +/* char: 0xa */ + +static const GLubyte ch10data[] = { +0x8,0x8,0x8,0x8,0x3e,0x0,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch10 = {7,10,-1,2,9,ch10data}; + +/* char: 0x9 */ + +static const GLubyte ch9data[] = { +0x3e,0x20,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, +}; + +static const BitmapCharRec ch9 = {7,10,-1,2,9,ch9data}; + +/* char: 0x8 */ + +static const GLubyte ch8data[] = { +0xfe,0x10,0x10,0xfe,0x10,0x10, +}; + +static const BitmapCharRec ch8 = {7,6,-1,0,9,ch8data}; + +/* char: 0x7 */ + +static const GLubyte ch7data[] = { +0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch7 = {5,4,-2,-6,9,ch7data}; + +/* char: 0x6 */ + +static const GLubyte ch6data[] = { +0x20,0x20,0x3c,0x20,0x3e,0x0,0xf8,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch6 = {7,10,-1,2,9,ch6data}; + +/* char: 0x5 */ + +static const GLubyte ch5data[] = { +0x22,0x22,0x3c,0x22,0x3c,0x0,0x78,0x80,0x80,0x78, +}; + +static const BitmapCharRec ch5 = {7,10,-1,2,9,ch5data}; + +/* char: 0x4 */ + +static const GLubyte ch4data[] = { +0x10,0x10,0x1c,0x10,0x1e,0x80,0x80,0xe0,0x80,0xf0, +}; + +static const BitmapCharRec ch4 = {7,10,-1,2,9,ch4data}; + +/* char: 0x3 */ + +static const GLubyte ch3data[] = { +0x8,0x8,0x8,0x3e,0x0,0x88,0x88,0xf8,0x88,0x88, +}; + +static const BitmapCharRec ch3 = {7,10,-1,2,9,ch3data}; + +/* char: 0x2 */ + +static const GLubyte ch2data[] = { +0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, +}; + +static const BitmapCharRec ch2 = {8,14,0,3,9,ch2data}; + +/* char: 0x1 */ + +static const GLubyte ch1data[] = { +0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, +}; + +static const BitmapCharRec ch1 = {7,7,-1,0,9,ch1data}; + +static const BitmapCharRec * const chars[] = { +&ch0, +&ch1, +&ch2, +&ch3, +&ch4, +&ch5, +&ch6, +&ch7, +&ch8, +&ch9, +&ch10, +&ch11, +&ch12, +&ch13, +&ch14, +&ch15, +&ch16, +&ch17, +&ch18, +&ch19, +&ch20, +&ch21, +&ch22, +&ch23, +&ch24, +&ch25, +&ch26, +&ch27, +&ch28, +&ch29, +&ch30, +&ch31, +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +&ch127, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmap9By15 = { +"-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1", +256, +0, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_bitmap.c b/xc/extras/Mesa/src-glut/glut_bitmap.c new file mode 100644 index 000000000..f1afdd7a0 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_bitmap.c @@ -0,0 +1,57 @@ + +/* 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 "glutint.h" +#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); + } +} diff --git a/xc/extras/Mesa/src-glut/glut_bwidth.c b/xc/extras/Mesa/src-glut/glut_bwidth.c new file mode 100644 index 000000000..bee5e8827 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_bwidth.c @@ -0,0 +1,58 @@ + +/* 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 "glutint.h" +#include "glutbitmap.h" + +/* CENTRY */ +int APIENTRY +glutBitmapWidth(GLUTbitmapFont font, int c) +{ + BitmapFontPtr fontinfo; + const BitmapCharRec *ch; + +#ifdef _WIN32 + fontinfo = (BitmapFontPtr) __glutFont(font); +#else + fontinfo = (BitmapFontPtr) font; +#endif + + if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars) + return 0; + ch = fontinfo->ch[c - fontinfo->first]; + if (ch) + return ch->advance; + else + return 0; +} + +int APIENTRY +glutBitmapLength(GLUTbitmapFont font, const unsigned char *string) +{ + int c, length; + BitmapFontPtr fontinfo; + const BitmapCharRec *ch; + +#ifdef _WIN32 + fontinfo = (BitmapFontPtr) __glutFont(font); +#else + fontinfo = (BitmapFontPtr) font; +#endif + + length = 0; + for (; *string != '\0'; string++) { + c = *string; + if (c >= fontinfo->first && c < fontinfo->first + fontinfo->num_chars) { + ch = fontinfo->ch[c - fontinfo->first]; + if (ch) + length += ch->advance; + } + } + return length; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_cindex.c b/xc/extras/Mesa/src-glut/glut_cindex.c new file mode 100644 index 000000000..c47b21ea7 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_cindex.c @@ -0,0 +1,252 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ + +/* 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 <stdlib.h> +#include "glutint.h" + +#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) + +/* CENTRY */ +void APIENTRY +glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) +{ + GLUTcolormap *cmap, *newcmap; + XVisualInfo *vis; + XColor color; + int i; + + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + cmap = __glutCurrentWindow->colormap; + vis = __glutCurrentWindow->vis; + } else { + cmap = __glutCurrentWindow->overlay->colormap; + vis = __glutCurrentWindow->overlay->vis; + if (ndx == __glutCurrentWindow->overlay->transparentPixel) { + __glutWarning( + "glutSetColor: cannot set color of overlay transparent index %d\n", + ndx); + return; + } + } + + if (!cmap) { + __glutWarning("glutSetColor: current window is RGBA"); + return; + } +#if defined(_WIN32) + if (ndx >= 256 || /* always assume 256 colors on Win32 */ +#else + if (ndx >= vis->visual->map_entries || +#endif + ndx < 0) { + __glutWarning("glutSetColor: index %d out of range", ndx); + return; + } + if (cmap->refcnt > 1) { + newcmap = __glutAssociateNewColormap(vis); + cmap->refcnt--; + /* Wouldn't it be nice if XCopyColormapAndFree could be + told not to free the old colormap's entries! */ + for (i = cmap->size - 1; i >= 0; i--) { + if (i == ndx) { + /* We are going to set this cell shortly! */ + continue; + } + if (cmap->cells[i].component[GLUT_RED] >= 0.0) { + color.pixel = i; + newcmap->cells[i].component[GLUT_RED] = + cmap->cells[i].component[GLUT_RED]; + color.red = (GLfloat) 0xffff * + cmap->cells[i].component[GLUT_RED]; + newcmap->cells[i].component[GLUT_GREEN] = + cmap->cells[i].component[GLUT_GREEN]; + color.green = (GLfloat) 0xffff * + cmap->cells[i].component[GLUT_GREEN]; + newcmap->cells[i].component[GLUT_BLUE] = + cmap->cells[i].component[GLUT_BLUE]; + color.blue = (GLfloat) 0xffff * + cmap->cells[i].component[GLUT_BLUE]; + color.flags = DoRed | DoGreen | DoBlue; +#if defined(_WIN32) + if (IsWindowVisible(__glutCurrentWindow->win)) { + XHDC = __glutCurrentWindow->hdc; + } else { + XHDC = 0; + } +#endif + XStoreColor(__glutDisplay, newcmap->cmap, &color); + } else { + /* Leave unallocated entries unallocated. */ + } + } + cmap = newcmap; + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + __glutCurrentWindow->colormap = cmap; + __glutCurrentWindow->cmap = cmap->cmap; + } else { + __glutCurrentWindow->overlay->colormap = cmap; + __glutCurrentWindow->overlay->cmap = cmap->cmap; + } + XSetWindowColormap(__glutDisplay, + __glutCurrentWindow->renderWin, cmap->cmap); + +#if !defined(_WIN32) + { + GLUTwindow *toplevel; + + toplevel = __glutToplevelOf(__glutCurrentWindow); + if (toplevel->cmap != cmap->cmap) { + __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); + } + } +#endif + } + color.pixel = ndx; + red = CLAMP(red); + cmap->cells[ndx].component[GLUT_RED] = red; + color.red = (GLfloat) 0xffff *red; + green = CLAMP(green); + cmap->cells[ndx].component[GLUT_GREEN] = green; + color.green = (GLfloat) 0xffff *green; + blue = CLAMP(blue); + cmap->cells[ndx].component[GLUT_BLUE] = blue; + color.blue = (GLfloat) 0xffff *blue; + color.flags = DoRed | DoGreen | DoBlue; +#if defined(_WIN32) + if (IsWindowVisible(__glutCurrentWindow->win)) { + XHDC = __glutCurrentWindow->hdc; + } else { + XHDC = 0; + } +#endif + XStoreColor(__glutDisplay, cmap->cmap, &color); +} + +GLfloat APIENTRY +glutGetColor(int ndx, int comp) +{ + GLUTcolormap *colormap; + XVisualInfo *vis; + + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + colormap = __glutCurrentWindow->colormap; + vis = __glutCurrentWindow->vis; + } else { + colormap = __glutCurrentWindow->overlay->colormap; + vis = __glutCurrentWindow->overlay->vis; + if (ndx == __glutCurrentWindow->overlay->transparentPixel) { + __glutWarning("glutGetColor: requesting overlay transparent index %d\n", + ndx); + return -1.0; + } + } + + if (!colormap) { + __glutWarning("glutGetColor: current window is RGBA"); + return -1.0; + } +#if defined(_WIN32) +#define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0) +#else +#define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0) +#endif + if (OUT_OF_RANGE_NDX(ndx)) { + __glutWarning("glutGetColor: index %d out of range", ndx); + return -1.0; + } + return colormap->cells[ndx].component[comp]; +} + +void APIENTRY +glutCopyColormap(int winnum) +{ + GLUTwindow *window = __glutWindowList[winnum - 1]; + GLUTcolormap *oldcmap, *newcmap; + XVisualInfo *dstvis; + + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + oldcmap = __glutCurrentWindow->colormap; + dstvis = __glutCurrentWindow->vis; + newcmap = window->colormap; + } else { + oldcmap = __glutCurrentWindow->overlay->colormap; + dstvis = __glutCurrentWindow->overlay->vis; + if (!window->overlay) { + __glutWarning("glutCopyColormap: window %d has no overlay", winnum); + return; + } + newcmap = window->overlay->colormap; + } + + if (!oldcmap) { + __glutWarning("glutCopyColormap: destination colormap must be color index"); + return; + } + if (!newcmap) { + __glutWarning( + "glutCopyColormap: source colormap of window %d must be color index", + winnum); + return; + } + if (newcmap == oldcmap) { + /* Source and destination are the same; now copy needed. */ + return; + } +#if !defined(_WIN32) + /* Play safe: compare visual IDs, not Visual*'s. */ + if (newcmap->visual->visualid == oldcmap->visual->visualid) { +#endif + /* Visuals match! "Copy" by reference... */ + __glutFreeColormap(oldcmap); + newcmap->refcnt++; + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + __glutCurrentWindow->colormap = newcmap; + __glutCurrentWindow->cmap = newcmap->cmap; + } else { + __glutCurrentWindow->overlay->colormap = newcmap; + __glutCurrentWindow->overlay->cmap = newcmap->cmap; + } + XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin, + newcmap->cmap); +#if !defined(_WIN32) + __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); + } else { + GLUTcolormap *copycmap; + XColor color; + int i, last; + + /* Visuals different - need a distinct X colormap! */ + copycmap = __glutAssociateNewColormap(dstvis); + /* Wouldn't it be nice if XCopyColormapAndFree could be + told not to free the old colormap's entries! */ + last = newcmap->size; + if (last > copycmap->size) { + last = copycmap->size; + } + for (i = last - 1; i >= 0; i--) { + if (newcmap->cells[i].component[GLUT_RED] >= 0.0) { + color.pixel = i; + copycmap->cells[i].component[GLUT_RED] = + newcmap->cells[i].component[GLUT_RED]; + color.red = (GLfloat) 0xffff * + newcmap->cells[i].component[GLUT_RED]; + copycmap->cells[i].component[GLUT_GREEN] = + newcmap->cells[i].component[GLUT_GREEN]; + color.green = (GLfloat) 0xffff * + newcmap->cells[i].component[GLUT_GREEN]; + copycmap->cells[i].component[GLUT_BLUE] = + newcmap->cells[i].component[GLUT_BLUE]; + color.blue = (GLfloat) 0xffff * + newcmap->cells[i].component[GLUT_BLUE]; + color.flags = DoRed | DoGreen | DoBlue; + XStoreColor(__glutDisplay, copycmap->cmap, &color); + } + } + } +#endif +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_cmap.c b/xc/extras/Mesa/src-glut/glut_cmap.c new file mode 100644 index 000000000..a9d004003 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_cmap.c @@ -0,0 +1,395 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ + +/* 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 <stdlib.h> +#include <string.h> +#include <stdio.h> /* SunOS multithreaded assert() needs <stdio.h>. Lame. */ +#include <assert.h> +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> /* for XA_RGB_DEFAULT_MAP atom */ +#if defined(__vms) +#include <Xmu/StdCmap.h> /* for XmuLookupStandardColormap */ +#else +#include <X11/Xmu/StdCmap.h> /* for XmuLookupStandardColormap */ +#endif +#endif + +/* SGI optimization introduced in IRIX 6.3 to avoid X server + round trips for interning common X atoms. */ +#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) +#include <X11/SGIFastAtom.h> +#else +#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) +#endif + +#include "glutint.h" +#include "layerutil.h" + +GLUTcolormap *__glutColormapList = NULL; + +GLUTcolormap * +__glutAssociateNewColormap(XVisualInfo * vis) +{ + GLUTcolormap *cmap; + int transparentPixel, i; + unsigned long pixels[255]; + + cmap = (GLUTcolormap *) malloc(sizeof(GLUTcolormap)); + if (!cmap) + __glutFatalError("out of memory."); +#if defined(_WIN32) + pixels[0] = 0; /* avoid compilation warnings on win32 */ + cmap->visual = 0; + cmap->size = 256; /* always assume 256 on Win32 */ +#else + cmap->visual = vis->visual; + cmap->size = vis->visual->map_entries; +#endif + cmap->refcnt = 1; + cmap->cells = (GLUTcolorcell *) + malloc(sizeof(GLUTcolorcell) * cmap->size); + if (!cmap->cells) + __glutFatalError("out of memory."); + /* make all color cell entries be invalid */ + for (i = cmap->size - 1; i >= 0; i--) { + cmap->cells[i].component[GLUT_RED] = -1.0; + cmap->cells[i].component[GLUT_GREEN] = -1.0; + cmap->cells[i].component[GLUT_BLUE] = -1.0; + } + transparentPixel = __glutGetTransparentPixel(__glutDisplay, vis); + if (transparentPixel == -1 || transparentPixel >= cmap->size) { + + /* If there is no transparent pixel or if the transparent + pixel is outside the range of valid colormap cells (HP + can implement their overlays this smart way since their + transparent pixel is 255), we can AllocAll the colormap. + See note below. */ + + cmap->cmap = XCreateColormap(__glutDisplay, + __glutRoot, cmap->visual, AllocAll); + } else { + + /* On machines where zero (or some other value in the range + of 0 through map_entries-1), BadAlloc may be generated + when an AllocAll overlay colormap is allocated since the + transparent pixel precludes all the cells in the colormap + being allocated (the transparent pixel is pre-allocated). + So in this case, use XAllocColorCells to allocate + map_entries-1 pixels (that is, all but the transparent + pixel. */ + +#if defined(_WIN32) + cmap->cmap = XCreateColormap(__glutDisplay, + __glutRoot, 0, AllocNone); +#else + cmap->cmap = XCreateColormap(__glutDisplay, + __glutRoot, vis->visual, AllocNone); + XAllocColorCells(__glutDisplay, cmap->cmap, False, 0, 0, + pixels, cmap->size - 1); +#endif + } + cmap->next = __glutColormapList; + __glutColormapList = cmap; + return cmap; +} + +static GLUTcolormap * +associateColormap(XVisualInfo * vis) +{ +#if !defined(_WIN32) + GLUTcolormap *cmap = __glutColormapList; + + while (cmap != NULL) { + /* Play safe: compare visual IDs, not Visual*'s. */ + if (cmap->visual->visualid == vis->visual->visualid) { + /* Already have created colormap for the visual. */ + cmap->refcnt++; + return cmap; + } + cmap = cmap->next; + } +#endif + return __glutAssociateNewColormap(vis); +} + +void +__glutSetupColormap(XVisualInfo * vi, GLUTcolormap ** colormap, Colormap * cmap) +{ +#if defined(_WIN32) + if (vi->dwFlags & PFD_NEED_PALETTE || vi->iPixelType == PFD_TYPE_COLORINDEX) { + *colormap = associateColormap(vi); + *cmap = (*colormap)->cmap; + } else { + *colormap = NULL; + *cmap = 0; + } +#else + Status status; + XStandardColormap *standardCmaps; + int i, numCmaps; + static Atom hpColorRecoveryAtom = -1; + int isRGB, visualClass, rc; + +#if defined(__cplusplus) || defined(c_plusplus) + visualClass = vi->c_class; +#else + visualClass = vi->class; +#endif + switch (visualClass) { + case PseudoColor: + /* Mesa might return a PseudoColor visual for RGB mode. */ + rc = glXGetConfig(__glutDisplay, vi, GLX_RGBA, &isRGB); + if (rc == 0 && isRGB) { + /* Must be Mesa. */ + *colormap = NULL; + if (MaxCmapsOfScreen(DefaultScreenOfDisplay(__glutDisplay)) == 1 + && vi->visual == DefaultVisual(__glutDisplay, __glutScreen)) { + char *privateCmap = getenv("MESA_PRIVATE_CMAP"); + + if (privateCmap) { + /* User doesn't want to share colormaps. */ + *cmap = XCreateColormap(__glutDisplay, __glutRoot, + vi->visual, AllocNone); + } else { + /* Share the root colormap. */ + *cmap = DefaultColormap(__glutDisplay, __glutScreen); + } + } else { + /* Get our own PseudoColor colormap. */ + *cmap = XCreateColormap(__glutDisplay, __glutRoot, + vi->visual, AllocNone); + } + } else { + /* CI mode, real GLX never returns a PseudoColor visual + for RGB mode. */ + *colormap = associateColormap(vi); + *cmap = (*colormap)->cmap; + } + break; + case TrueColor: + case DirectColor: + *colormap = NULL; /* NULL if RGBA */ + + /* Hewlett-Packard supports a feature called "HP Color + Recovery". Mesa has code to use HP Color Recovery. For + Mesa to use this feature, the atom + _HP_RGB_SMOOTH_MAP_LIST must be defined on the root + window AND the colormap obtainable by XGetRGBColormaps + for that atom must be set on the window. If that + colormap is not set, the output will look stripy. */ + + if (hpColorRecoveryAtom == -1) { + char *xvendor; + +#define VENDOR_HP "Hewlett-Packard" + + /* Only makes sense to make XInternAtom round-trip if we + know that we are connected to an HP X server. */ + xvendor = ServerVendor(__glutDisplay); + if (!strncmp(xvendor, VENDOR_HP, sizeof(VENDOR_HP) - 1)) { + hpColorRecoveryAtom = XInternAtom(__glutDisplay, "_HP_RGB_SMOOTH_MAP_LIST", True); + } else { + hpColorRecoveryAtom = None; + } + } + if (hpColorRecoveryAtom != None) { + status = XGetRGBColormaps(__glutDisplay, __glutRoot, + &standardCmaps, &numCmaps, hpColorRecoveryAtom); + if (status == 1) { + for (i = 0; i < numCmaps; i++) { + if (standardCmaps[i].visualid == vi->visualid) { + *cmap = standardCmaps[i].colormap; + XFree(standardCmaps); + return; + } + } + XFree(standardCmaps); + } + } +#ifndef SOLARIS_2_4_BUG + /* Solaris 2.4 and 2.5 have a bug in their + XmuLookupStandardColormap implementations. Please + compile your Solaris 2.4 or 2.5 version of GLUT with + -DSOLARIS_2_4_BUG to work around this bug. The symptom + of the bug is that programs will get a BadMatch error + from X_CreateWindow when creating a GLUT window because + Solaris 2.4 and 2.5 create a corrupted RGB_DEFAULT_MAP + property. Note that this workaround prevents Colormap + sharing between applications, perhaps leading + unnecessary colormap installations or colormap flashing. + Sun fixed this bug in Solaris 2.6. */ + status = XmuLookupStandardColormap(__glutDisplay, + vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP, + /* replace */ False, /* retain */ True); + if (status == 1) { + status = XGetRGBColormaps(__glutDisplay, __glutRoot, + &standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP); + if (status == 1) { + for (i = 0; i < numCmaps; i++) { + if (standardCmaps[i].visualid == vi->visualid) { + *cmap = standardCmaps[i].colormap; + XFree(standardCmaps); + return; + } + } + XFree(standardCmaps); + } + } +#endif + /* If no standard colormap but TrueColor, just make a + private one. */ + /* XXX Should do a better job of internal sharing for + privately allocated TrueColor colormaps. */ + /* XXX DirectColor probably needs ramps hand initialized! */ + *cmap = XCreateColormap(__glutDisplay, __glutRoot, + vi->visual, AllocNone); + break; + case StaticColor: + case StaticGray: + case GrayScale: + /* Mesa supports these visuals */ + *colormap = NULL; + *cmap = XCreateColormap(__glutDisplay, __glutRoot, + vi->visual, AllocNone); + break; + default: + __glutFatalError( + "could not allocate colormap for visual type: %d.", + visualClass); + } + return; +#endif +} + +#if !defined(_WIN32) +static int +findColormaps(GLUTwindow * window, + Window * winlist, Colormap * cmaplist, int num, int max) +{ + GLUTwindow *child; + int i; + + /* Do not allow more entries that maximum number of + colormaps! */ + if (num >= max) + return num; + /* Is cmap for this window already on the list? */ + for (i = 0; i < num; i++) { + if (cmaplist[i] == window->cmap) + goto normalColormapAlreadyListed; + } + /* Not found on the list; add colormap and window. */ + winlist[num] = window->win; + cmaplist[num] = window->cmap; + num++; + +normalColormapAlreadyListed: + + /* Repeat above but for the overlay colormap if there one. */ + if (window->overlay) { + if (num >= max) + return num; + for (i = 0; i < num; i++) { + if (cmaplist[i] == window->overlay->cmap) + goto overlayColormapAlreadyListed; + } + winlist[num] = window->overlay->win; + cmaplist[num] = window->overlay->cmap; + num++; + } +overlayColormapAlreadyListed: + + /* Recursively search children. */ + child = window->children; + while (child) { + num = findColormaps(child, winlist, cmaplist, num, max); + child = child->siblings; + } + return num; +} + +void +__glutEstablishColormapsProperty(GLUTwindow * window) +{ + /* this routine is strictly X. Win32 doesn't need to do + anything of this sort (but has to do other wacky stuff + later). */ + static Atom wmColormapWindows = None; + Window *winlist; + Colormap *cmaplist; + Status status; + int maxcmaps, num; + + assert(!window->parent); + maxcmaps = MaxCmapsOfScreen(ScreenOfDisplay(__glutDisplay, + __glutScreen)); + /* For portability reasons we don't use alloca for winlist + and cmaplist, but we could. */ + winlist = (Window *) malloc(maxcmaps * sizeof(Window)); + cmaplist = (Colormap *) malloc(maxcmaps * sizeof(Colormap)); + num = findColormaps(window, winlist, cmaplist, 0, maxcmaps); + if (num < 2) { + /* Property no longer needed; remove it. */ + wmColormapWindows = XSGIFastInternAtom(__glutDisplay, + "WM_COLORMAP_WINDOWS", SGI_XA_WM_COLORMAP_WINDOWS, False); + if (wmColormapWindows == None) { + __glutWarning("Could not intern X atom for WM_COLORMAP_WINDOWS."); + return; + } + XDeleteProperty(__glutDisplay, window->win, wmColormapWindows); + } else { + status = XSetWMColormapWindows(__glutDisplay, window->win, + winlist, num); + /* XSetWMColormapWindows should always work unless the + WM_COLORMAP_WINDOWS property cannot be intern'ed. We + check to be safe. */ + if (status == False) + __glutFatalError("XSetWMColormapWindows returned False."); + } + /* For portability reasons we don't use alloca for winlist + and cmaplist, but we could. */ + free(winlist); + free(cmaplist); +} + +GLUTwindow * +__glutToplevelOf(GLUTwindow * window) +{ + while (window->parent) { + window = window->parent; + } + return window; +} +#endif + +void +__glutFreeColormap(GLUTcolormap * cmap) +{ + GLUTcolormap *cur, **prev; + + cmap->refcnt--; + if (cmap->refcnt == 0) { + /* remove from colormap list */ + cur = __glutColormapList; + prev = &__glutColormapList; + while (cur) { + if (cur == cmap) { + *prev = cmap->next; + break; + } + prev = &(cur->next); + cur = cur->next; + } + /* actually free colormap */ + XFreeColormap(__glutDisplay, cmap->cmap); + free(cmap->cells); + free(cmap); + } +} + diff --git a/xc/extras/Mesa/src-glut/glut_cursor.c b/xc/extras/Mesa/src-glut/glut_cursor.c new file mode 100644 index 000000000..c0a5a5b7a --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_cursor.c @@ -0,0 +1,201 @@ + +/* Copyright (c) Mark J. Kilgard, 1995, 1998. */ + +/* 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 "glutint.h" + +#if !defined(_WIN32) +#include <X11/Xatom.h> /* For XA_CURSOR */ +#include <X11/cursorfont.h> +#endif + +typedef struct _CursorTable { +#if defined(_WIN32) + char* glyph; +#else + int glyph; +#endif + Cursor cursor; +} CursorTable; +/* *INDENT-OFF* */ + +static CursorTable cursorTable[] = { + {XC_arrow, None}, /* GLUT_CURSOR_RIGHT_ARROW */ + {XC_top_left_arrow, None}, /* GLUT_CURSOR_LEFT_ARROW */ + {XC_hand1, None}, /* GLUT_CURSOR_INFO */ + {XC_pirate, None}, /* GLUT_CURSOR_DESTROY */ + {XC_question_arrow, None}, /* GLUT_CURSOR_HELP */ + {XC_exchange, None}, /* GLUT_CURSOR_CYCLE */ + {XC_spraycan, None}, /* GLUT_CURSOR_SPRAY */ + {XC_watch, None}, /* GLUT_CURSOR_WAIT */ + {XC_xterm, None}, /* GLUT_CURSOR_TEXT */ + {XC_crosshair, None}, /* GLUT_CURSOR_CROSSHAIR */ + {XC_sb_v_double_arrow, None}, /* GLUT_CURSOR_UP_DOWN */ + {XC_sb_h_double_arrow, None}, /* GLUT_CURSOR_LEFT_RIGHT */ + {XC_top_side, None}, /* GLUT_CURSOR_TOP_SIDE */ + {XC_bottom_side, None}, /* GLUT_CURSOR_BOTTOM_SIDE */ + {XC_left_side, None}, /* GLUT_CURSOR_LEFT_SIDE */ + {XC_right_side, None}, /* GLUT_CURSOR_RIGHT_SIDE */ + {XC_top_left_corner, None}, /* GLUT_CURSOR_TOP_LEFT_CORNER */ + {XC_top_right_corner, None}, /* GLUT_CURSOR_TOP_RIGHT_CORNER */ + {XC_bottom_right_corner, None}, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */ + {XC_bottom_left_corner, None}, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */ +}; +/* *INDENT-ON* */ + +#if !defined(_WIN32) +static Cursor blankCursor = None; +static Cursor fullCrosshairCusor = None; + +/* SGI X server's support a special property called the + _SGI_CROSSHAIR_CURSOR that when installed as a window's + cursor, becomes a full screen crosshair cursor. SGI + has special cursor generation hardware for this case. */ +static Cursor +getFullCrosshairCursor(void) +{ + Cursor cursor; + Atom crosshairAtom, actualType; + int rc, actualFormat; + unsigned long n, left; + unsigned long *value; + + if (fullCrosshairCusor == None) { + crosshairAtom = XInternAtom(__glutDisplay, + "_SGI_CROSSHAIR_CURSOR", True); + if (crosshairAtom != None) { + value = 0; /* Make compiler happy. */ + rc = XGetWindowProperty(__glutDisplay, __glutRoot, + crosshairAtom, 0, 1, False, XA_CURSOR, &actualType, + &actualFormat, &n, &left, (unsigned char **) &value); + if (rc == Success && actualFormat == 32 && n >= 1) { + cursor = value[0]; + XFree(value); + return cursor; + } + } + } + return XCreateFontCursor(__glutDisplay, XC_crosshair); +} + +/* X11 forces you to create a blank cursor if you want + to disable the cursor. */ +static Cursor +makeBlankCursor(void) +{ + static char data[1] = + {0}; + Cursor cursor; + Pixmap blank; + XColor dummy; + + blank = XCreateBitmapFromData(__glutDisplay, __glutRoot, + data, 1, 1); + if (blank == None) + __glutFatalError("out of memory."); + cursor = XCreatePixmapCursor(__glutDisplay, blank, blank, + &dummy, &dummy, 0, 0); + XFreePixmap(__glutDisplay, blank); + + return cursor; +} +#endif /* !_WIN32 */ + +/* Win32 and X11 use this same function to accomplish + fairly different tasks. X11 lets you just define the + cursor for a window and the window system takes care + of making sure that the window's cursor is installed + when the mouse is in the window. Win32 requires the + application to handle a WM_SETCURSOR message to install + the right cursor when windows are entered. Think of + the Win32 __glutSetCursor (called from __glutWindowProc) + as "install cursor". Think of the X11 __glutSetCursor + (called from glutSetCursor) as "define cursor". */ +void +__glutSetCursor(GLUTwindow *window) +{ + int cursor = window->cursor; + Cursor xcursor = 0; + + if (cursor >= 0 && + cursor < sizeof(cursorTable) / sizeof(cursorTable[0])) { + if (cursorTable[cursor].cursor == None) { + cursorTable[cursor].cursor = XCreateFontCursor(__glutDisplay, + cursorTable[cursor].glyph); + } + xcursor = cursorTable[cursor].cursor; + } else { + /* Special cases. */ + switch (cursor) { + case GLUT_CURSOR_INHERIT: +#if defined(_WIN32) + while (window->parent) { + window = window->parent; + if (window->cursor != GLUT_CURSOR_INHERIT) { + __glutSetCursor(window); + return; + } + } + /* XXX Default to an arrow cursor. Is this + right or should we be letting the default + window proc be installing some system cursor? */ + xcursor = cursorTable[0].cursor; + if (xcursor == NULL) { + xcursor = + cursorTable[0].cursor = + LoadCursor(NULL, cursorTable[0].glyph); + } +#else + xcursor = None; +#endif + break; + case GLUT_CURSOR_NONE: +#if defined(_WIN32) + xcursor = NULL; +#else + if (blankCursor == None) { + blankCursor = makeBlankCursor(); + } + xcursor = blankCursor; +#endif + break; + case GLUT_CURSOR_FULL_CROSSHAIR: +#if defined(_WIN32) + xcursor = (HICON) IDC_CROSS; +#else + if (fullCrosshairCusor == None) { + fullCrosshairCusor = getFullCrosshairCursor(); + } + xcursor = fullCrosshairCusor; +#endif + break; + } + } + XDefineCursor(__glutDisplay, + window->win, xcursor); + XFlush(__glutDisplay); +} + +/* CENTRY */ +void APIENTRY +glutSetCursor(int cursor) +{ +#ifdef _WIN32 + POINT point; + + __glutCurrentWindow->cursor = cursor; + /* Are we in the window right now? If so, + install the cursor. */ + GetCursorPos(&point); + if (__glutCurrentWindow->win == WindowFromPoint(point)) { + __glutSetCursor(__glutCurrentWindow); + } +#else + __glutCurrentWindow->cursor = cursor; + __glutSetCursor(__glutCurrentWindow); +#endif +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_dials.c b/xc/extras/Mesa/src-glut/glut_dials.c new file mode 100644 index 000000000..3eea850c5 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_dials.c @@ -0,0 +1,26 @@ + +/* 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 "glutint.h" + +void APIENTRY +glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) +{ + __glutCurrentWindow->buttonBox = buttonBoxFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); +} + +void APIENTRY +glutDialsFunc(GLUTdialsCB dialsFunc) +{ + __glutCurrentWindow->dials = dialsFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); +} diff --git a/xc/extras/Mesa/src-glut/glut_dstr.c b/xc/extras/Mesa/src-glut/glut_dstr.c new file mode 100644 index 000000000..468844449 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_dstr.c @@ -0,0 +1,1627 @@ + +/* Copyright (c) Mark J. Kilgard, 1997. */ + +/* 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 <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "glutint.h" + +/* glxcaps matches the criteria macros listed in glutint.h, but + only list the first set (those that correspond to GLX visual + attributes). */ +static int glxcap[NUM_GLXCAPS] = +{ + GLX_RGBA, + GLX_BUFFER_SIZE, + GLX_DOUBLEBUFFER, + GLX_STEREO, + GLX_AUX_BUFFERS, + GLX_RED_SIZE, + GLX_GREEN_SIZE, + GLX_BLUE_SIZE, + GLX_ALPHA_SIZE, + GLX_DEPTH_SIZE, + GLX_STENCIL_SIZE, + GLX_ACCUM_RED_SIZE, + GLX_ACCUM_GREEN_SIZE, + GLX_ACCUM_BLUE_SIZE, + GLX_ACCUM_ALPHA_SIZE, + GLX_LEVEL, +}; + +#ifdef TEST + +#if !defined(_WIN32) +char *__glutProgramName = "dstr"; +Display *__glutDisplay; +int __glutScreen; +XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle, + Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc) = NULL; +char *__glutDisplayString = NULL; +#endif +static int verbose = 0; + +static char *compstr[] = +{ + "none", "=", "!=", "<=", ">=", ">", "<", "~" +}; +static char *capstr[] = +{ + "rgba", "bufsize", "double", "stereo", "auxbufs", "red", "green", "blue", "alpha", + "depth", "stencil", "acred", "acgreen", "acblue", "acalpha", "level", "xvisual", + "transparent", "samples", "xstaticgray", "xgrayscale", "xstaticcolor", "xpseudocolor", + "xtruecolor", "xdirectcolor", "slow", "conformant", "num" +}; + +static void +printCriteria(Criterion * criteria, int ncriteria) +{ + int i; + printf("Criteria: %d\n", ncriteria); + for (i = 0; i < ncriteria; i++) { + printf(" %s %s %d\n", + capstr[criteria[i].capability], + compstr[criteria[i].comparison], + criteria[i].value); + } +} + +#endif /* TEST */ + +static int isMesaGLX = -1; + +static int +determineMesaGLX(void) +{ +#ifdef GLX_VERSION_1_1 + const char *vendor, *version, *ch; + + vendor = glXGetClientString(__glutDisplay, GLX_VENDOR); + if (!strcmp(vendor, "Brian Paul")) { + version = glXGetClientString(__glutDisplay, GLX_VERSION); + for (ch = version; *ch != ' ' && *ch != '\0'; ch++); + for (; *ch == ' ' && *ch != '\0'; ch++); + +#define MESA_NAME "Mesa " /* Trailing space is intentional. */ + + if (!strncmp(MESA_NAME, ch, sizeof(MESA_NAME) - 1)) { + return 1; + } + } +#else + /* Recent versions for Mesa should support GLX 1.1 and + therefore glXGetClientString. If we get into this case, + we would be compiling against a true OpenGL not supporting + GLX 1.1, and the resulting compiled library won't work well + with Mesa then. */ +#endif + return 0; +} + +static XVisualInfo ** +getMesaVisualList(int *n) +{ + XVisualInfo **vlist, *vinfo; + int attribs[23]; + int i, x, cnt; + + vlist = (XVisualInfo **) malloc((32 + 16) * sizeof(XVisualInfo *)); + if (!vlist) + __glutFatalError("out of memory."); + + cnt = 0; + for (i = 0; i < 32; i++) { + x = 0; + attribs[x] = GLX_RGBA; + x++; + attribs[x] = GLX_RED_SIZE; + x++; + attribs[x] = 1; + x++; + attribs[x] = GLX_GREEN_SIZE; + x++; + attribs[x] = 1; + x++; + attribs[x] = GLX_BLUE_SIZE; + x++; + attribs[x] = 1; + x++; + if (i & 1) { + attribs[x] = GLX_DEPTH_SIZE; + x++; + attribs[x] = 1; + x++; + } + if (i & 2) { + attribs[x] = GLX_STENCIL_SIZE; + x++; + attribs[x] = 1; + x++; + } + if (i & 4) { + attribs[x] = GLX_ACCUM_RED_SIZE; + x++; + attribs[x] = 1; + x++; + attribs[x] = GLX_ACCUM_GREEN_SIZE; + x++; + attribs[x] = 1; + x++; + attribs[x] = GLX_ACCUM_BLUE_SIZE; + x++; + attribs[x] = 1; + x++; + } + if (i & 8) { + attribs[x] = GLX_ALPHA_SIZE; + x++; + attribs[x] = 1; + x++; + if (i & 4) { + attribs[x] = GLX_ACCUM_ALPHA_SIZE; + x++; + attribs[x] = 1; + x++; + } + } + if (i & 16) { + attribs[x] = GLX_DOUBLEBUFFER; + x++; + } + attribs[x] = None; + x++; + assert(x <= sizeof(attribs) / sizeof(attribs[0])); + vinfo = glXChooseVisual(__glutDisplay, __glutScreen, attribs); + if (vinfo) { + vlist[cnt] = vinfo; + cnt++; + } + } + for (i = 0; i < 16; i++) { + x = 0; + if (i & 1) { + attribs[x] = GLX_DEPTH_SIZE; + x++; + attribs[x] = 1; + x++; + } + if (i & 2) { + attribs[x] = GLX_STENCIL_SIZE; + x++; + attribs[x] = 1; + x++; + } + if (i & 4) { + attribs[x] = GLX_DOUBLEBUFFER; + x++; + } + if (i & 8) { + attribs[x] = GLX_LEVEL; + x++; + attribs[x] = 1; + x++; +#if defined(GLX_TRANSPARENT_TYPE_EXT) && defined(GLX_TRANSPARENT_INDEX_EXT) + attribs[x] = GLX_TRANSPARENT_TYPE_EXT; + x++; + attribs[x] = GLX_TRANSPARENT_INDEX_EXT; + x++; +#endif + } + attribs[x] = None; + x++; + assert(x <= sizeof(attribs) / sizeof(attribs[0])); + vinfo = glXChooseVisual(__glutDisplay, __glutScreen, attribs); + if (vinfo) { + vlist[cnt] = vinfo; + cnt++; + } + } + + *n = cnt; + return vlist; +} + +static FrameBufferMode * +loadVisuals(int *nitems_return) +{ + XVisualInfo *vinfo, **vlist, template; + FrameBufferMode *fbmodes, *mode; + int n, i, j, rc, glcapable; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + int multisample; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_info) + int visual_info; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_rating) + int visual_rating; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + int fbconfig; +#endif + + isMesaGLX = determineMesaGLX(); + if (isMesaGLX) { + vlist = getMesaVisualList(&n); + } else { +#if !defined(_WIN32) + template.screen = __glutScreen; + vinfo = XGetVisualInfo(__glutDisplay, VisualScreenMask, &template, &n); +#else + vinfo = XGetVisualInfo(__glutDisplay, 0, &template, &n); +#endif + if (vinfo == NULL) { + *nitems_return = 0; + return NULL; + } + assert(n > 0); + + /* Make an array of XVisualInfo* pointers to help the Mesa + case because each glXChooseVisual call returns a + distinct XVisualInfo*, not a handy array like + XGetVisualInfo. (Mesa expects us to return the _exact_ + pointer returned by glXChooseVisual so we could not just + copy the returned structure.) */ + vlist = (XVisualInfo **) malloc(n * sizeof(XVisualInfo *)); + if (!vlist) + __glutFatalError("out of memory."); + for (i = 0; i < n; i++) { + vlist[i] = &vinfo[i]; + } + } + +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + multisample = __glutIsSupportedByGLX("GLX_SGIS_multisample"); +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_info) + visual_info = __glutIsSupportedByGLX("GLX_EXT_visual_info"); +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_rating) + visual_rating = __glutIsSupportedByGLX("GLX_EXT_visual_rating"); +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + fbconfig = __glutIsSupportedByGLX("GLX_SGIX_fbconfig"); +#endif + + fbmodes = (FrameBufferMode *) malloc(n * sizeof(FrameBufferMode)); + if (fbmodes == NULL) { + *nitems_return = -1; + return NULL; + } + for (i = 0; i < n; i++) { + mode = &fbmodes[i]; + mode->vi = vlist[i]; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + mode->fbc = NULL; +#endif + rc = glXGetConfig(__glutDisplay, vlist[i], GLX_USE_GL, &glcapable); + if (rc == 0 && glcapable) { + mode->valid = 1; /* Assume the best until proven + otherwise. */ + for (j = 0; j < NUM_GLXCAPS; j++) { + rc = glXGetConfig(__glutDisplay, vlist[i], glxcap[j], &mode->cap[j]); + if (rc != 0) { + mode->valid = 0; + } + } +#if defined(_WIN32) + mode->cap[XVISUAL] = ChoosePixelFormat(XHDC, vlist[i]); +#else + mode->cap[XVISUAL] = (int) vlist[i]->visualid; +#endif + mode->cap[XSTATICGRAY] = 0; + mode->cap[XGRAYSCALE] = 0; + mode->cap[XSTATICCOLOR] = 0; + mode->cap[XPSEUDOCOLOR] = 0; + mode->cap[XTRUECOLOR] = 0; + mode->cap[XDIRECTCOLOR] = 0; +#if !defined(_WIN32) +#if defined(__cplusplus) || defined(c_plusplus) + switch (vlist[i]->c_class) { +#else + switch (vlist[i]->class) { +#endif + case StaticGray: + mode->cap[XSTATICGRAY] = 1; + break; + case GrayScale: + mode->cap[XGRAYSCALE] = 1; + break; + case StaticColor: + mode->cap[XSTATICCOLOR] = 1; + break; + case PseudoColor: + mode->cap[XPSEUDOCOLOR] = 1; + break; + case TrueColor: + mode->cap[XTRUECOLOR] = 1; + break; + case DirectColor: + mode->cap[XDIRECTCOLOR] = 1; + break; + } +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_rating) + if (visual_rating) { + int rating; + +/* babcock@cs.montana.edu reported that DEC UNIX (OSF1) V4.0 + 564 for Alpha did not properly define GLX_VISUAL_CAVEAT_EXT + in <GL/glx.h> despite claiming to support + GLX_EXT_visual_rating. */ +#ifndef GLX_VISUAL_CAVEAT_EXT +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#endif + + rc = glXGetConfig(__glutDisplay, + vlist[i], GLX_VISUAL_CAVEAT_EXT, &rating); + if (rc != 0) { + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 1; + } else { + switch (rating) { + case GLX_SLOW_VISUAL_EXT: + mode->cap[SLOW] = 1; + mode->cap[CONFORMANT] = 1; + break; + +/* IRIX 5.3 for the R10K Indigo2 may have shipped without this + properly defined in /usr/include/GL/glxtokens.h */ +#ifndef GLX_NON_CONFORMANT_VISUAL_EXT +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +#endif + + case GLX_NON_CONFORMANT_VISUAL_EXT: + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 0; + break; + case GLX_NONE_EXT: + default: /* XXX Hopefully this is a good default + assumption. */ + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 1; + break; + } + } + } else { + mode->cap[TRANSPARENT] = 0; + } +#else + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 1; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_info) + if (visual_info) { + int transparent; + +/* babcock@cs.montana.edu reported that DEC UNIX (OSF1) V4.0 + 564 for Alpha did not properly define + GLX_TRANSPARENT_TYPE_EXT in <GL/glx.h> despite claiming to + support GLX_EXT_visual_info. */ +#ifndef GLX_TRANSPARENT_TYPE_EXT +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#endif + + rc = glXGetConfig(__glutDisplay, + vlist[i], GLX_TRANSPARENT_TYPE_EXT, &transparent); + if (rc != 0) { + mode->cap[TRANSPARENT] = 0; + } else { + mode->cap[TRANSPARENT] = (transparent != GLX_NONE_EXT); + } + } else { + mode->cap[TRANSPARENT] = 0; + } +#else + mode->cap[TRANSPARENT] = 0; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + if (multisample) { + rc = glXGetConfig(__glutDisplay, + vlist[i], GLX_SAMPLES_SGIS, &mode->cap[SAMPLES]); + if (rc != 0) { + mode->cap[SAMPLES] = 0; + } + } else { + mode->cap[SAMPLES] = 0; + } +#else + mode->cap[SAMPLES] = 0; +#endif + } else { +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + if (fbconfig) { + GLXFBConfigSGIX fbc; + int fbconfigID, drawType, renderType; + + fbc = glXGetFBConfigFromVisualSGIX(__glutDisplay, vlist[i]); + if (fbc) { + rc = glXGetFBConfigAttribSGIX(__glutDisplay, fbc, + GLX_FBCONFIG_ID_SGIX, &fbconfigID); + if ((rc == 0) && (fbconfigID != None)) { + rc = glXGetFBConfigAttribSGIX(__glutDisplay, fbc, + GLX_DRAWABLE_TYPE_SGIX, &drawType); + if ((rc == 0) && (drawType & GLX_WINDOW_BIT_SGIX)) { + rc = glXGetFBConfigAttribSGIX(__glutDisplay, fbc, + GLX_RENDER_TYPE_SGIX, &renderType); + if ((rc == 0) && (renderType & GLX_RGBA_BIT_SGIX)) { + mode->fbc = fbc; + mode->valid = 1; /* Assume the best until + proven otherwise. */ + + assert(glxcap[0] == GLX_RGBA); + mode->cap[0] = 1; + + /* Start with "j = 1" to skip the GLX_RGBA attribute. */ + for (j = 1; j < NUM_GLXCAPS; j++) { + rc = glXGetFBConfigAttribSGIX(__glutDisplay, + fbc, glxcap[j], &mode->cap[j]); + if (rc != 0) { + mode->valid = 0; + } + } + + mode->cap[XVISUAL] = (int) vlist[i]->visualid; + mode->cap[XSTATICGRAY] = 0; + mode->cap[XGRAYSCALE] = 0; + mode->cap[XSTATICCOLOR] = 0; + mode->cap[XPSEUDOCOLOR] = 0; + mode->cap[XTRUECOLOR] = 0; + mode->cap[XDIRECTCOLOR] = 0; +#if defined(__cplusplus) || defined(c_plusplus) + switch (vlist[i]->c_class) { +#else + switch (vlist[i]->class) { +#endif + case StaticGray: + mode->cap[XSTATICGRAY] = 1; + break; + case GrayScale: + mode->cap[XGRAYSCALE] = 1; + break; + case StaticColor: + mode->cap[XSTATICCOLOR] = 1; + break; + case PseudoColor: + mode->cap[XPSEUDOCOLOR] = 1; + break; + case TrueColor: + mode->cap[XTRUECOLOR] = 1; + break; + case DirectColor: + mode->cap[XDIRECTCOLOR] = 1; + break; + } +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_rating) + if (visual_rating) { + int rating; + +/* babcock@cs.montana.edu reported that DEC UNIX (OSF1) V4.0 + 564 for Alpha did not properly define GLX_VISUAL_CAVEAT_EXT + in <GL/glx.h> despite claiming to support + GLX_EXT_visual_rating. */ +#ifndef GLX_VISUAL_CAVEAT_EXT +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#endif + + rc = glXGetFBConfigAttribSGIX(__glutDisplay, + fbc, GLX_VISUAL_CAVEAT_EXT, &rating); + if (rc != 0) { + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 1; + } else { + switch (rating) { + case GLX_SLOW_VISUAL_EXT: + mode->cap[SLOW] = 1; + mode->cap[CONFORMANT] = 1; + break; + +/* IRIX 5.3 for the R10K Indigo2 may have shipped without this + properly defined in /usr/include/GL/glxtokens.h */ +#ifndef GLX_NON_CONFORMANT_VISUAL_EXT +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +#endif + + case GLX_NON_CONFORMANT_VISUAL_EXT: + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 0; + break; + case GLX_NONE_EXT: + default: /* XXX Hopefully this is a good + default assumption. */ + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 1; + break; + } + } + } else { + mode->cap[TRANSPARENT] = 0; + } +#else + mode->cap[SLOW] = 0; + mode->cap[CONFORMANT] = 1; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_info) + if (visual_info) { + int transparent; + +/* babcock@cs.montana.edu reported that DEC UNIX (OSF1) V4.0 + 564 for Alpha did not properly define + GLX_TRANSPARENT_TYPE_EXT in <GL/glx.h> despite claiming to + support GLX_EXT_visual_info. */ +#ifndef GLX_TRANSPARENT_TYPE_EXT +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#endif + + rc = glXGetFBConfigAttribSGIX(__glutDisplay, + fbc, GLX_TRANSPARENT_TYPE_EXT, &transparent); + if (rc != 0) { + mode->cap[TRANSPARENT] = 0; + } else { + mode->cap[TRANSPARENT] = (transparent != GLX_NONE_EXT); + } + } else { + mode->cap[TRANSPARENT] = 0; + } +#else + mode->cap[TRANSPARENT] = 0; +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + if (multisample) { + rc = glXGetFBConfigAttribSGIX(__glutDisplay, + fbc, GLX_SAMPLES_SGIS, &mode->cap[SAMPLES]); + if (rc != 0) { + mode->cap[SAMPLES] = 0; + } + } else { + mode->cap[SAMPLES] = 0; + } +#else + mode->cap[SAMPLES] = 0; +#endif + + } else { + /* Fbconfig is not RGBA; GLUT only uses RGBA + FBconfigs. */ + /* XXX Code could be exteneded to handle color + index FBconfigs, but seems a color index + window-renderable FBconfig would also be + advertised as an X visual. */ + mode->valid = 0; + } + } else { + /* Fbconfig does not support window rendering; + not a valid FBconfig for GLUT windows. */ + mode->valid = 0; + } + } else { + /* FBconfig ID is None (zero); not a valid + FBconfig. */ + mode->valid = 0; + } + } else { + /* FBconfig ID is None (zero); not a valid FBconfig. */ + mode->valid = 0; + } + } else { + /* No SGIX_fbconfig GLX sever implementation support. */ + mode->valid = 0; + } +#else + /* No SGIX_fbconfig GLX extension API support. */ + mode->valid = 0; +#endif + } + } + + free(vlist); + *nitems_return = n; + return fbmodes; +} + +static XVisualInfo * +findMatch(FrameBufferMode * fbmodes, int nfbmodes, + Criterion * criteria, int ncriteria, void **fbc) +{ + FrameBufferMode *found; + int *bestScore, *thisScore; + int i, j, numok, result = 0, worse, better; + + found = NULL; + numok = 1; /* "num" capability is indexed from 1, + not 0. */ + + /* XXX alloca canidate. */ + bestScore = (int *) malloc(ncriteria * sizeof(int)); + if (!bestScore) + __glutFatalError("out of memory."); + for (j = 0; j < ncriteria; j++) { + /* Very negative number. */ + bestScore[j] = -32768; + } + + /* XXX alloca canidate. */ + thisScore = (int *) malloc(ncriteria * sizeof(int)); + if (!thisScore) + __glutFatalError("out of memory."); + + for (i = 0; i < nfbmodes; i++) { + if (fbmodes[i].valid) { +#ifdef TEST +#if !defined(_WIN32) + if (verbose) + printf("Visual 0x%x\n", fbmodes[i].vi->visualid); +#endif +#endif + + worse = 0; + better = 0; + + for (j = 0; j < ncriteria; j++) { + int cap, cvalue, fbvalue; + + cap = criteria[j].capability; + cvalue = criteria[j].value; + if (cap == NUM) { + fbvalue = numok; + } else { + fbvalue = fbmodes[i].cap[cap]; + } +#ifdef TEST + if (verbose) + printf(" %s %s %d to %d\n", + capstr[cap], compstr[criteria[j].comparison], cvalue, fbvalue); +#endif + switch (criteria[j].comparison) { + case EQ: + result = cvalue == fbvalue; + thisScore[j] = 1; + break; + case NEQ: + result = cvalue != fbvalue; + thisScore[j] = 1; + break; + case LT: + result = fbvalue < cvalue; + thisScore[j] = fbvalue - cvalue; + break; + case GT: + result = fbvalue > cvalue; + thisScore[j] = fbvalue - cvalue; + break; + case LTE: + result = fbvalue <= cvalue; + thisScore[j] = fbvalue - cvalue; + break; + case GTE: + result = (fbvalue >= cvalue); + thisScore[j] = fbvalue - cvalue; + break; + case MIN: + result = fbvalue >= cvalue; + thisScore[j] = cvalue - fbvalue; + break; + } + +#ifdef TEST + if (verbose) + printf(" result=%d score=%d bestScore=%d\n", result, thisScore[j], bestScore[j]); +#endif + + if (result) { + if (better || thisScore[j] > bestScore[j]) { + better = 1; + } else if (thisScore[j] == bestScore[j]) { + /* Keep looking. */ + } else { + goto nextFBM; + } + } else { + if (cap == NUM) { + worse = 1; + } else { + goto nextFBM; + } + } + + } + + if (better && !worse) { + found = &fbmodes[i]; + for (j = 0; j < ncriteria; j++) { + bestScore[j] = thisScore[j]; + } + } + numok++; + + nextFBM:; + + } + } + free(bestScore); + free(thisScore); + if (found) { +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + *fbc = found->fbc; +#endif + return found->vi; + } else { + return NULL; + } +} + +static int +parseCriteria(char *word, Criterion * criterion, int *mask, + Bool * allowDoubleAsSingle) +{ + char *cstr, *vstr, *response; + int comparator, value = 0; + int rgb, rgba, acc, acca, count, i; + + cstr = strpbrk(word, "=><!~"); + if (cstr) { + switch (cstr[0]) { + case '=': + comparator = EQ; + vstr = &cstr[1]; + break; + case '~': + comparator = MIN; + vstr = &cstr[1]; + break; + case '>': + if (cstr[1] == '=') { + comparator = GTE; + vstr = &cstr[2]; + } else { + comparator = GT; + vstr = &cstr[1]; + } + break; + case '<': + if (cstr[1] == '=') { + comparator = LTE; + vstr = &cstr[2]; + } else { + comparator = LT; + vstr = &cstr[1]; + } + break; + case '!': + if (cstr[1] == '=') { + comparator = NEQ; + vstr = &cstr[2]; + } else { + return -1; + } + break; + default: + return -1; + } + value = (int) strtol(vstr, &response, 0); + if (response == vstr) { + /* Not a valid number. */ + return -1; + } + *cstr = '\0'; + } else { + comparator = NONE; + } + switch (word[0]) { + case 'a': + if (!strcmp(word, "alpha")) { + criterion[0].capability = ALPHA_SIZE; + if (comparator == NONE) { + criterion[0].comparison = GTE; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << RGBA); + *mask |= (1 << ALPHA_SIZE); + *mask |= (1 << RGBA_MODE); + return 1; + } + acca = !strcmp(word, "acca"); + acc = !strcmp(word, "acc"); + if (acc || acca) { + criterion[0].capability = ACCUM_RED_SIZE; + criterion[1].capability = ACCUM_GREEN_SIZE; + criterion[2].capability = ACCUM_BLUE_SIZE; + criterion[3].capability = ACCUM_ALPHA_SIZE; + if (acca) { + count = 4; + } else { + count = 3; + criterion[3].comparison = MIN; + criterion[3].value = 0; + } + if (comparator == NONE) { + comparator = GTE; + value = 8; + } + for (i = 0; i < count; i++) { + criterion[i].comparison = comparator; + criterion[i].value = value; + } + *mask |= (1 << ACCUM_RED_SIZE); + return 4; + } + if (!strcmp(word, "auxbufs")) { + criterion[0].capability = AUX_BUFFERS; + if (comparator == NONE) { + criterion[0].comparison = MIN; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << AUX_BUFFERS); + return 1; + } + return -1; + case 'b': + if (!strcmp(word, "blue")) { + criterion[0].capability = BLUE_SIZE; + if (comparator == NONE) { + criterion[0].comparison = GTE; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << RGBA); + *mask |= (1 << RGBA_MODE); + return 1; + } + if (!strcmp(word, "buffer")) { + criterion[0].capability = BUFFER_SIZE; + if (comparator == NONE) { + criterion[0].comparison = GTE; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + return 1; + } + return -1; + case 'c': + if (!strcmp(word, "conformant")) { + criterion[0].capability = CONFORMANT; + if (comparator == NONE) { + criterion[0].comparison = EQ; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << CONFORMANT); + return 1; + } + return -1; + case 'd': + if (!strcmp(word, "depth")) { + criterion[0].capability = DEPTH_SIZE; + if (comparator == NONE) { + criterion[0].comparison = GTE; + criterion[0].value = 12; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << DEPTH_SIZE); + return 1; + } + if (!strcmp(word, "double")) { + criterion[0].capability = DOUBLEBUFFER; + if (comparator == NONE) { + criterion[0].comparison = EQ; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << DOUBLEBUFFER); + return 1; + } + return -1; + case 'g': + if (!strcmp(word, "green")) { + criterion[0].capability = GREEN_SIZE; + if (comparator == NONE) { + criterion[0].comparison = GTE; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << RGBA); + *mask |= (1 << RGBA_MODE); + return 1; + } + return -1; + case 'i': + if (!strcmp(word, "index")) { + criterion[0].capability = RGBA; + criterion[0].comparison = EQ; + criterion[0].value = 0; + *mask |= (1 << RGBA); + *mask |= (1 << CI_MODE); + criterion[1].capability = BUFFER_SIZE; + if (comparator == NONE) { + criterion[1].comparison = GTE; + criterion[1].value = 1; + } else { + criterion[1].comparison = comparator; + criterion[1].value = value; + } + return 2; + } + return -1; + case 'l': + if (!strcmp(word, "luminance")) { + criterion[0].capability = RGBA; + criterion[0].comparison = EQ; + criterion[0].value = 1; + + criterion[1].capability = RED_SIZE; + if (comparator == NONE) { + criterion[1].comparison = GTE; + criterion[1].value = 1; + } else { + criterion[1].comparison = comparator; + criterion[1].value = value; + } + + criterion[2].capability = GREEN_SIZE; + criterion[2].comparison = EQ; + criterion[2].value = 0; + + criterion[3].capability = BLUE_SIZE; + criterion[3].comparison = EQ; + criterion[3].value = 0; + + *mask |= (1 << RGBA); + *mask |= (1 << RGBA_MODE); + *mask |= (1 << LUMINANCE_MODE); + return 4; + } + return -1; + case 'n': + if (!strcmp(word, "num")) { + criterion[0].capability = NUM; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + return -1; + case 'r': + if (!strcmp(word, "red")) { + criterion[0].capability = RED_SIZE; + if (comparator == NONE) { + criterion[0].comparison = GTE; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << RGBA); + *mask |= (1 << RGBA_MODE); + return 1; + } + rgba = !strcmp(word, "rgba"); + rgb = !strcmp(word, "rgb"); + if (rgb || rgba) { + criterion[0].capability = RGBA; + criterion[0].comparison = EQ; + criterion[0].value = 1; + + criterion[1].capability = RED_SIZE; + criterion[2].capability = GREEN_SIZE; + criterion[3].capability = BLUE_SIZE; + criterion[4].capability = ALPHA_SIZE; + if (rgba) { + count = 5; + } else { + count = 4; + criterion[4].comparison = MIN; + criterion[4].value = 0; + } + if (comparator == NONE) { + comparator = GTE; + value = 1; + } + for (i = 1; i < count; i++) { + criterion[i].comparison = comparator; + criterion[i].value = value; + } + *mask |= (1 << RGBA); + *mask |= (1 << RGBA_MODE); + return 5; + } + return -1; + case 's': + if (!strcmp(word, "stencil")) { + criterion[0].capability = STENCIL_SIZE; + if (comparator == NONE) { + criterion[0].comparison = MIN; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << STENCIL_SIZE); + return 1; + } + if (!strcmp(word, "single")) { + criterion[0].capability = DOUBLEBUFFER; + if (comparator == NONE) { + criterion[0].comparison = EQ; + criterion[0].value = 0; + *allowDoubleAsSingle = True; + *mask |= (1 << DOUBLEBUFFER); + return 1; + } else { + return -1; + } + } + if (!strcmp(word, "stereo")) { + criterion[0].capability = STEREO; + if (comparator == NONE) { + criterion[0].comparison = EQ; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << STEREO); + return 1; + } + if (!strcmp(word, "samples")) { + criterion[0].capability = SAMPLES; + if (comparator == NONE) { + criterion[0].comparison = LTE; + criterion[0].value = 4; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << SAMPLES); + return 1; + } + if (!strcmp(word, "slow")) { + criterion[0].capability = SLOW; + if (comparator == NONE) { + /* Just "slow" means permit fast visuals, but accept + slow ones in preference. Presumably the slow ones + must be higher quality or something else desirable. */ + criterion[0].comparison = GTE; + criterion[0].value = 0; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + *mask |= (1 << SLOW); + return 1; + } + return -1; +#if defined(_WIN32) + case 'w': + if (!strcmp(word, "win32pfd")) { + criterion[0].capability = XVISUAL; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + return -1; +#endif +#if !defined(_WIN32) + case 'x': + if (!strcmp(word, "xvisual")) { + if (comparator == NONE) { + return -1; + } else { + criterion[0].capability = XVISUAL; + criterion[0].comparison = comparator; + criterion[0].value = value; + /* Set everything in "mask" so that no default criteria + get used. Assume the program really wants the + xvisual specified. */ + *mask |= ~0; + return 1; + } + } + /* Be a little over-eager to fill in the comparison and + value so we won't have to replicate the code after each + string match. */ + if (comparator == NONE) { + criterion[0].comparison = EQ; + criterion[0].value = 1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + } + + if (!strcmp(word, "xstaticgray")) { + criterion[0].capability = XSTATICGRAY; + *mask |= (1 << XSTATICGRAY); /* Indicates _any_ visual + class selected. */ + return 1; + } + if (!strcmp(word, "xgrayscale")) { + criterion[0].capability = XGRAYSCALE; + *mask |= (1 << XSTATICGRAY); /* Indicates _any_ visual + class selected. */ + return 1; + } + if (!strcmp(word, "xstaticcolor")) { + criterion[0].capability = XSTATICCOLOR; + *mask |= (1 << XSTATICGRAY); /* Indicates _any_ visual + class selected. */ + return 1; + } + if (!strcmp(word, "xpseudocolor")) { + criterion[0].capability = XPSEUDOCOLOR; + *mask |= (1 << XSTATICGRAY); /* Indicates _any_ visual + class selected. */ + return 1; + } + if (!strcmp(word, "xtruecolor")) { + criterion[0].capability = XTRUECOLOR; + *mask |= (1 << XSTATICGRAY); /* Indicates _any_ visual + class selected. */ + return 1; + } + if (!strcmp(word, "xdirectcolor")) { + criterion[0].capability = XDIRECTCOLOR; + *mask |= (1 << XSTATICGRAY); /* Indicates _any_ visual + class selected. */ + return 1; + } + return -1; +#endif + default: + return -1; + } +} + +static Criterion * +parseModeString(char *mode, int *ncriteria, Bool * allowDoubleAsSingle, + Criterion * requiredCriteria, int nRequired, int requiredMask) +{ + Criterion *criteria = NULL; + int n, mask, parsed, i; + char *copy, *word; + + *allowDoubleAsSingle = False; + copy = __glutStrdup(mode); + /* Attempt to estimate how many criteria entries should be + needed. */ + n = 0; + word = strtok(copy, " \t"); + while (word) { + n++; + word = strtok(NULL, " \t"); + } + /* Overestimate by 4 times ("rgba" might add four criteria + entries) plus add in possible defaults plus space for + required criteria. */ + criteria = (Criterion *) malloc((4 * n + 30 + nRequired) * sizeof(Criterion)); + if (!criteria) { + __glutFatalError("out of memory."); + } + + /* Re-copy the copy of the mode string. */ + strcpy(copy, mode); + + /* First add the required criteria (these match at the + highest priority). Typically these will be used to force a + specific level (layer), transparency, and/or visual type. */ + mask = requiredMask; + for (i = 0; i < nRequired; i++) { + criteria[i] = requiredCriteria[i]; + } + n = nRequired; + + word = strtok(copy, " \t"); + while (word) { + parsed = parseCriteria(word, &criteria[n], &mask, allowDoubleAsSingle); + if (parsed >= 0) { + n += parsed; + } else { + __glutWarning("Unrecognized display string word: %s (ignoring)\n", word); + } + word = strtok(NULL, " \t"); + } + +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + if (__glutIsSupportedByGLX("GLX_SGIS_multisample")) { + if (!(mask & (1 << SAMPLES))) { + criteria[n].capability = SAMPLES; + criteria[n].comparison = EQ; + criteria[n].value = 0; + n++; + } else { + /* Multisample visuals are marked nonconformant. If + multisampling was requeste and no conformant + preference was set, assume that we will settle for a + non-conformant visual to get multisampling. */ + if (!(mask & (1 << CONFORMANT))) { + criteria[n].capability = CONFORMANT; + criteria[n].comparison = MIN; + criteria[n].value = 0; + n++; + mask |= (1 << CONFORMANT); + } + } + } +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_info) + if (__glutIsSupportedByGLX("GLX_EXT_visual_info")) { + if (!(mask & (1 << TRANSPARENT))) { + criteria[n].capability = TRANSPARENT; + criteria[n].comparison = EQ; + criteria[n].value = 0; + n++; + } + } +#endif +#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_rating) + if (__glutIsSupportedByGLX("GLX_EXT_visual_rating")) { + if (!(mask & (1 << SLOW))) { + criteria[n].capability = SLOW; + criteria[n].comparison = EQ; + criteria[n].value = 0; + n++; + } + if (!(mask & (1 << CONFORMANT))) { + criteria[n].capability = CONFORMANT; + criteria[n].comparison = EQ; + criteria[n].value = 1; + n++; + } + } +#endif + if (!(mask & (1 << ACCUM_RED_SIZE))) { + criteria[n].capability = ACCUM_RED_SIZE; + criteria[n].comparison = MIN; + criteria[n].value = 0; + criteria[n + 1].capability = ACCUM_GREEN_SIZE; + criteria[n + 1].comparison = MIN; + criteria[n + 1].value = 0; + criteria[n + 2].capability = ACCUM_BLUE_SIZE; + criteria[n + 2].comparison = MIN; + criteria[n + 2].value = 0; + criteria[n + 3].capability = ACCUM_ALPHA_SIZE; + criteria[n + 3].comparison = MIN; + criteria[n + 3].value = 0; + n += 4; + } + if (!(mask & (1 << AUX_BUFFERS))) { + criteria[n].capability = AUX_BUFFERS; + criteria[n].comparison = MIN; + criteria[n].value = 0; + n++; + } + if (!(mask & (1 << RGBA))) { + criteria[n].capability = RGBA; + criteria[n].comparison = EQ; + criteria[n].value = 1; + criteria[n + 1].capability = RED_SIZE; + criteria[n + 1].comparison = GTE; + criteria[n + 1].value = 1; + criteria[n + 2].capability = GREEN_SIZE; + criteria[n + 2].comparison = GTE; + criteria[n + 2].value = 1; + criteria[n + 3].capability = BLUE_SIZE; + criteria[n + 3].comparison = GTE; + criteria[n + 3].value = 1; + criteria[n + 4].capability = ALPHA_SIZE; + criteria[n + 4].comparison = MIN; + criteria[n + 4].value = 0; + n += 5; + mask |= (1 << RGBA_MODE); + } +#if !defined(_WIN32) + if (!(mask & (1 << XSTATICGRAY))) { + assert(isMesaGLX != -1); + if ((mask & (1 << RGBA_MODE)) && !isMesaGLX) { + /* Normally, request an RGBA mode visual be TrueColor, + except in the case of Mesa where we trust Mesa (and + other code in GLUT) to handle any type of RGBA visual + reasonably. */ + if (mask & (1 << LUMINANCE_MODE)) { + /* If RGBA luminance was requested, actually go for + a StaticGray visual. */ + criteria[n].capability = XSTATICGRAY; + } else { + criteria[n].capability = XTRUECOLOR; + } + criteria[n].value = 1; + criteria[n].comparison = EQ; + + n++; + } + if (mask & (1 << CI_MODE)) { + criteria[n].capability = XPSEUDOCOLOR; + criteria[n].value = 1; + criteria[n].comparison = EQ; + n++; + } + } +#endif + if (!(mask & (1 << STEREO))) { + criteria[n].capability = STEREO; + criteria[n].comparison = EQ; + criteria[n].value = 0; + n++; + } + if (!(mask & (1 << DOUBLEBUFFER))) { + criteria[n].capability = DOUBLEBUFFER; + criteria[n].comparison = EQ; + criteria[n].value = 0; + *allowDoubleAsSingle = True; + n++; + } + if (!(mask & (1 << DEPTH_SIZE))) { + criteria[n].capability = DEPTH_SIZE; + criteria[n].comparison = MIN; + criteria[n].value = 0; + n++; + } + if (!(mask & (1 << STENCIL_SIZE))) { + criteria[n].capability = STENCIL_SIZE; + criteria[n].comparison = MIN; + criteria[n].value = 0; + n++; + } + if (!(mask & (1 << LEVEL))) { + criteria[n].capability = LEVEL; + criteria[n].comparison = EQ; + criteria[n].value = 0; + n++; + } + if (n) { + /* Since over-estimated the size needed; squeeze it down to + reality. */ + criteria = (Criterion *) realloc(criteria, n * sizeof(Criterion)); + if (!criteria) { + /* Should never happen since should be shrinking down! */ + __glutFatalError("out of memory."); + } + } else { + /* For portability, avoid "realloc(ptr,0)" call. */ + free(criteria); + criteria = NULL; + } + + free(copy); + *ncriteria = n; + return criteria; +} + +static FrameBufferMode *fbmodes = NULL; +static int nfbmodes = 0; + +static XVisualInfo * +getVisualInfoFromString(char *string, Bool * treatAsSingle, + Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc) +{ + Criterion *criteria; + XVisualInfo *visinfo; + Bool allowDoubleAsSingle; + int ncriteria, i; + + if (!fbmodes) { + fbmodes = loadVisuals(&nfbmodes); + } + criteria = parseModeString(string, &ncriteria, + &allowDoubleAsSingle, requiredCriteria, nRequired, requiredMask); + if (criteria == NULL) { + __glutWarning("failed to parse mode string"); + return NULL; + } +#ifdef TEST + printCriteria(criteria, ncriteria); +#endif + visinfo = findMatch(fbmodes, nfbmodes, criteria, ncriteria, fbc); + if (visinfo) { + *treatAsSingle = 0; + } else { + if (allowDoubleAsSingle) { + /* Rewrite criteria so that we now look for a double + buffered visual which will then get treated as a + single buffered visual. */ + for (i = 0; i < ncriteria; i++) { + if (criteria[i].capability == DOUBLEBUFFER + && criteria[i].comparison == EQ + && criteria[i].value == 0) { + criteria[i].value = 1; + } + } + visinfo = findMatch(fbmodes, nfbmodes, criteria, ncriteria, fbc); + if (visinfo) { + *treatAsSingle = 1; + } + } + } + free(criteria); + + if (visinfo) { +#if defined(_WIN32) + /* We could have a valid pixel format for drawing to a + bitmap. However, we don't want to draw into a bitmap, we + need one that can be used with a window, so make sure + that this is true. */ + if (!(visinfo->dwFlags & PFD_DRAW_TO_WINDOW)) + return NULL; +#endif + return visinfo; + } else { + return NULL; + } +} + +/* CENTRY */ +void APIENTRY +glutInitDisplayString(const char *string) +{ +#ifdef _WIN32 + XHDC = GetDC(GetDesktopWindow()); +#endif + + __glutDetermineVisualFromString = getVisualInfoFromString; + if (__glutDisplayString) { + free(__glutDisplayString); + } + if (string) { + __glutDisplayString = __glutStrdup(string); + if (!__glutDisplayString) + __glutFatalError("out of memory."); + } else { + __glutDisplayString = NULL; + } +} +/* ENDCENTRY */ + +#ifdef TEST + +Criterion requiredWindowCriteria[] = +{ + {LEVEL, EQ, 0}, + {TRANSPARENT, EQ, 0} +}; +int numRequiredWindowCriteria = sizeof(requiredWindowCriteria) / sizeof(Criterion); +int requiredWindowCriteriaMask = (1 << LEVEL) | (1 << TRANSPARENT); + +Criterion requiredOverlayCriteria[] = +{ + {LEVEL, EQ, 1}, + {TRANSPARENT, EQ, 1}, + {XPSEUDOCOLOR, EQ, 1}, + {RGBA, EQ, 0}, + {BUFFER_SIZE, GTE, 1} +}; +int numRequiredOverlayCriteria = sizeof(requiredOverlayCriteria) / sizeof(Criterion); +int requiredOverlayCriteriaMask = +(1 << LEVEL) | (1 << TRANSPARENT) | (1 << XSTATICGRAY) | (1 << RGBA) | (1 << CI_MODE); + +int +main(int argc, char **argv) +{ + Display *dpy; + XVisualInfo *vinfo; + Bool treatAsSingle; + char *str, buffer[1024]; + int tty = isatty(fileno(stdin)); + int overlay = 0, showconfig = 0; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + GLXFBConfigSGIX fbc; +#else + void *fbc; +#endif + +#if !defined(_WIN32) + dpy = XOpenDisplay(NULL); + if (dpy == NULL) { + printf("Could not connect to X server\n"); + exit(1); + } + __glutDisplay = dpy; + __glutScreen = DefaultScreen(__glutDisplay); +#endif + while (!feof(stdin)) { + if (tty) + printf("dstr> "); + str = gets(buffer); + if (str) { + printf("\n"); + if (!strcmp("v", str)) { + verbose = 1 - verbose; + printf("verbose = %d\n\n", verbose); + } else if (!strcmp("s", str)) { + showconfig = 1 - showconfig; + printf("showconfig = %d\n\n", showconfig); + } else if (!strcmp("o", str)) { + overlay = 1 - overlay; + printf("overlay = %d\n\n", overlay); + } else { + if (overlay) { + vinfo = getVisualInfoFromString(str, &treatAsSingle, + requiredOverlayCriteria, numRequiredOverlayCriteria, requiredOverlayCriteriaMask, (void**) &fbc); + } else { + vinfo = getVisualInfoFromString(str, &treatAsSingle, + requiredWindowCriteria, numRequiredWindowCriteria, requiredWindowCriteriaMask, (void**) &fbc); + } + if (vinfo) { + printf("\n"); + if (!tty) + printf("Display string: %s", str); +#ifdef _WIN32 + printf("Visual = 0x%x\n", 0); +#else + printf("Visual = 0x%x%s\n", vinfo->visualid, fbc ? " (needs FBC)" : ""); +#endif + if (treatAsSingle) { + printf("Treat as SINGLE.\n"); + } + if (showconfig) { + int glxCapable, bufferSize, level, renderType, doubleBuffer, + stereo, auxBuffers, redSize, greenSize, blueSize, + alphaSize, depthSize, stencilSize, acRedSize, acGreenSize, + acBlueSize, acAlphaSize; + + glXGetConfig(dpy, vinfo, GLX_BUFFER_SIZE, &bufferSize); + glXGetConfig(dpy, vinfo, GLX_LEVEL, &level); + glXGetConfig(dpy, vinfo, GLX_RGBA, &renderType); + glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &doubleBuffer); + glXGetConfig(dpy, vinfo, GLX_STEREO, &stereo); + glXGetConfig(dpy, vinfo, GLX_AUX_BUFFERS, &auxBuffers); + glXGetConfig(dpy, vinfo, GLX_RED_SIZE, &redSize); + glXGetConfig(dpy, vinfo, GLX_GREEN_SIZE, &greenSize); + glXGetConfig(dpy, vinfo, GLX_BLUE_SIZE, &blueSize); + glXGetConfig(dpy, vinfo, GLX_ALPHA_SIZE, &alphaSize); + glXGetConfig(dpy, vinfo, GLX_DEPTH_SIZE, &depthSize); + glXGetConfig(dpy, vinfo, GLX_STENCIL_SIZE, &stencilSize); + glXGetConfig(dpy, vinfo, GLX_ACCUM_RED_SIZE, &acRedSize); + glXGetConfig(dpy, vinfo, GLX_ACCUM_GREEN_SIZE, &acGreenSize); + glXGetConfig(dpy, vinfo, GLX_ACCUM_BLUE_SIZE, &acBlueSize); + glXGetConfig(dpy, vinfo, GLX_ACCUM_ALPHA_SIZE, &acAlphaSize); + printf("RGBA = (%d, %d, %d, %d)\n", redSize, greenSize, blueSize, alphaSize); + printf("acc = (%d, %d, %d, %d)\n", acRedSize, acGreenSize, acBlueSize, acAlphaSize); + printf("db = %d\n", doubleBuffer); + printf("str = %d\n", stereo); + printf("aux = %d\n", auxBuffers); + printf("lvl = %d\n", level); + printf("buf = %d\n", bufferSize); + printf("rgba = %d\n", renderType); + printf("z = %d\n", depthSize); + printf("s = %d\n", stencilSize); + } + } else { + printf("\n"); + printf("No match.\n"); + } + printf("\n"); + } + } + } + printf("\n"); + return 0; +} +#endif diff --git a/xc/extras/Mesa/src-glut/glut_event.c b/xc/extras/Mesa/src-glut/glut_event.c new file mode 100644 index 000000000..6d928af2e --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_event.c @@ -0,0 +1,1361 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1997, 1998. */ + +/* 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 <stdlib.h> +#include <stdio.h> +#include <errno.h> +#include <assert.h> +#include <string.h> /* Some FD_ZERO macros use memset without + prototyping memset. */ + +/* Much of the following #ifdef logic to include the proper + prototypes for the select system call is based on logic + from the X11R6.3 version of <X11/Xpoll.h>. */ + +#if !defined(_WIN32) +# ifdef __sgi +# include <bstring.h> /* prototype for bzero used by FD_ZERO */ +# endif +# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE) +# include <sys/select.h> /* select system call interface */ +# ifdef luna +# include <sysent.h> +# endif +# endif + /* AIX 4.2 fubar-ed <sys/select.h>, so go to heroic measures to get it */ +# if defined(AIXV4) && !defined(NFDBITS) +# include <sys/select.h> +# endif +#endif /* !_WIN32 */ + +#include <sys/types.h> + +#if !defined(_WIN32) +# if defined(__vms) && ( __VMS_VER < 70000000 ) +# include <sys/time.h> +# else +# ifndef __vms +# include <sys/time.h> +# endif +# endif +# include <unistd.h> +# include <X11/Xlib.h> +# include <X11/keysym.h> +#else +# ifdef __CYGWIN32__ +# include <sys/time.h> +# else +# include <sys/timeb.h> +# endif +# ifdef __hpux + /* XXX Bert Gijsbers <bert@mc.bio.uva.nl> reports that HP-UX + needs different keysyms for the End, Insert, and Delete keys + to work on an HP 715. It would be better if HP generated + standard keysyms for standard keys. */ +# include <X11/HPkeysym.h> +# endif +#endif /* !_WIN32 */ + +#if defined(__vms) && ( __VMS_VER < 70000000 ) +#include <ssdef.h> +#include <psldef.h> +extern int SYS$CLREF(int efn); +extern int SYS$SETIMR(unsigned int efn, struct timeval *timeout, void *ast, + unsigned int request_id, unsigned int flags); +extern int SYS$WFLOR(unsigned int efn, unsigned int mask); +extern int SYS$CANTIM(unsigned int request_id, unsigned int mode); +#endif /* __vms, VMs 6.2 or earlier */ + +#include "glutint.h" + +static GLUTtimer *freeTimerList = NULL; + +GLUTidleCB __glutIdleFunc = NULL; +GLUTtimer *__glutTimerList = NULL; +#ifdef SUPPORT_FORTRAN +GLUTtimer *__glutNewTimer; +#endif +GLUTwindow *__glutWindowWorkList = NULL; +GLUTmenu *__glutMappedMenu; +GLUTmenu *__glutCurrentMenu = NULL; + +void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *); +#if !defined(_WIN32) +void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item, int num, int type) = NULL; +void (*__glutFinishMenu)(Window win, int x, int y); +void (*__glutPaintMenu)(GLUTmenu * menu); +void (*__glutStartMenu)(GLUTmenu * menu, GLUTwindow * window, int x, int y, int x_win, int y_win); +GLUTmenu * (*__glutGetMenuByNum)(int menunum); +GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu, Window win, int *which); +GLUTmenu * (*__glutGetMenu)(Window win); +#endif + +Atom __glutMotifHints = None; +/* Modifier mask of ~0 implies not in core input callback. */ +unsigned int __glutModifierMask = (unsigned int) ~0; +int __glutWindowDamaged = 0; + +void APIENTRY +glutIdleFunc(GLUTidleCB idleFunc) +{ + __glutIdleFunc = idleFunc; +} + +void APIENTRY +glutTimerFunc(unsigned int interval, GLUTtimerCB timerFunc, int value) +{ + GLUTtimer *timer, *other; + GLUTtimer **prevptr; + struct timeval now; + + if (!timerFunc) + return; + + if (freeTimerList) { + timer = freeTimerList; + freeTimerList = timer->next; + } else { + timer = (GLUTtimer *) malloc(sizeof(GLUTtimer)); + if (!timer) + __glutFatalError("out of memory."); + } + + timer->func = timerFunc; +#if defined(__vms) && ( __VMS_VER < 70000000 ) + /* VMS time is expressed in units of 100 ns */ + timer->timeout.val = interval * TICKS_PER_MILLISECOND; +#else + timer->timeout.tv_sec = (int) interval / 1000; + timer->timeout.tv_usec = (int) (interval % 1000) * 1000; +#endif + timer->value = value; + timer->next = NULL; + GETTIMEOFDAY(&now); + ADD_TIME(timer->timeout, timer->timeout, now); + prevptr = &__glutTimerList; + other = *prevptr; + while (other && IS_AFTER(other->timeout, timer->timeout)) { + prevptr = &other->next; + other = *prevptr; + } + timer->next = other; +#ifdef SUPPORT_FORTRAN + __glutNewTimer = timer; /* for Fortran binding! */ +#endif + *prevptr = timer; +} + +void +handleTimeouts(void) +{ + struct timeval now; + GLUTtimer *timer; + + /* Assumption is that __glutTimerList is already determined + to be non-NULL. */ + GETTIMEOFDAY(&now); + while (IS_AT_OR_AFTER(__glutTimerList->timeout, now)) { + timer = __glutTimerList; + timer->func(timer->value); + __glutTimerList = timer->next; + timer->next = freeTimerList; + freeTimerList = timer; + if (!__glutTimerList) + break; + } +} + +void +__glutPutOnWorkList(GLUTwindow * window, int workMask) +{ + if (window->workMask) { + /* Already on list; just OR in new workMask. */ + window->workMask |= workMask; + } else { + /* Update work mask and add to window work list. */ + window->workMask = workMask; + /* Assert that if the window does not have a + workMask already, the window should definitely + not be the head of the work list. */ + assert(window != __glutWindowWorkList); + window->prevWorkWin = __glutWindowWorkList; + __glutWindowWorkList = window; + } +} + +void +__glutPostRedisplay(GLUTwindow * window, int layerMask) +{ + int shown = (layerMask & (GLUT_REDISPLAY_WORK | GLUT_REPAIR_WORK)) ? + window->shownState : window->overlay->shownState; + + /* Post a redisplay if the window is visible (or the + visibility of the window is unknown, ie. window->visState + == -1) _and_ the layer is known to be shown. */ + if (window->visState != GLUT_HIDDEN + && window->visState != GLUT_FULLY_COVERED && shown) { + __glutPutOnWorkList(window, layerMask); + } +} + +/* CENTRY */ +void APIENTRY +glutPostRedisplay(void) +{ + __glutPostRedisplay(__glutCurrentWindow, GLUT_REDISPLAY_WORK); +} + +/* The advantage of this routine is that it saves the cost of a + glutSetWindow call (entailing an expensive OpenGL context switch), + particularly useful when multiple windows need redisplays posted at + the same times. See also glutPostWindowOverlayRedisplay. */ +void APIENTRY +glutPostWindowRedisplay(int win) +{ + __glutPostRedisplay(__glutWindowList[win - 1], GLUT_REDISPLAY_WORK); +} + +/* ENDCENTRY */ +static GLUTeventParser *eventParserList = NULL; + +/* __glutRegisterEventParser allows another module to register + to intercept X events types not otherwise acted on by the + GLUT processEventsAndTimeouts routine. The X Input + extension support code uses an event parser for handling X + Input extension events. */ + +void +__glutRegisterEventParser(GLUTeventParser * parser) +{ + parser->next = eventParserList; + eventParserList = parser; +} + +static void +markWindowHidden(GLUTwindow * window) +{ + if (GLUT_HIDDEN != window->visState) { + GLUTwindow *child; + + if (window->windowStatus) { + window->visState = GLUT_HIDDEN; + __glutSetWindow(window); + window->windowStatus(GLUT_HIDDEN); + } + /* An unmap is only reported on a single window; its + descendents need to know they are no longer visible. */ + child = window->children; + while (child) { + markWindowHidden(child); + child = child->siblings; + } + } +} + +#if !defined(_WIN32) + +static void +purgeStaleWindow(Window win) +{ + GLUTstale **pEntry = &__glutStaleWindowList; + GLUTstale *entry = __glutStaleWindowList; + + /* Tranverse singly-linked stale window list look for the + window ID. */ + while (entry) { + if (entry->win == win) { + /* Found it; delete it. */ + *pEntry = entry->next; + free(entry); + return; + } else { + pEntry = &entry->next; + entry = *pEntry; + } + } +} + +/* Unlike XNextEvent, if a signal arrives, + interruptibleXNextEvent will return (with a zero return + value). This helps GLUT drop out of XNextEvent if a signal + is delivered. The intent is so that a GLUT program can call + glutIdleFunc in a signal handler to register an idle func + and then immediately get dropped into the idle func (after + returning from the signal handler). The idea is to make + GLUT's main loop reliably interruptible by signals. */ +static int +interruptibleXNextEvent(Display * dpy, XEvent * event) +{ + fd_set fds; + int rc; + + /* Flush X protocol since XPending does not do this + implicitly. */ + XFlush(__glutDisplay); + for (;;) { + if (XPending(__glutDisplay)) { + XNextEvent(dpy, event); + return 1; + } +#ifndef VMS + /* the combination ConectionNumber-select is buggy on VMS. Sometimes it + * fails. This part of the code hangs the program on VMS7.2. But even + * without it the program seems to run correctly. + * Note that this is a bug in the VMS/DECWindows run-time-libraries. + * Compaq engeneering does not want or is not able to make a fix. + * (last sentence is a quotation from Compaq when I reported the + * problem January 2000) */ + FD_ZERO(&fds); + FD_SET(__glutConnectionFD, &fds); + rc = select(__glutConnectionFD + 1, &fds, NULL, NULL, NULL); + if (rc < 0) { + if (errno == EINTR) { + return 0; + } else { + __glutFatalError("select error."); + } + } +#endif + } +} + +#endif + +static void +processEventsAndTimeouts(void) +{ + do { +#if defined(_WIN32) + MSG event; + + if(!GetMessage(&event, NULL, 0, 0)) /* bail if no more messages */ + exit(0); + TranslateMessage(&event); /* translate virtual-key messages */ + DispatchMessage(&event); /* call the window proc */ + /* see win32_event.c for event (message) processing procedures */ +#else + static int mappedMenuButton; + GLUTeventParser *parser; + XEvent event, ahead; + GLUTwindow *window; + GLUTkeyboardCB keyboard; + GLUTspecialCB special; + int gotEvent, width, height; + + gotEvent = interruptibleXNextEvent(__glutDisplay, &event); + if (gotEvent) { + switch (event.type) { + case MappingNotify: + XRefreshKeyboardMapping((XMappingEvent *) & event); + break; + case ConfigureNotify: + window = __glutGetWindow(event.xconfigure.window); + if (window) { + if (window->win != event.xconfigure.window) { + /* Ignore ConfigureNotify sent to the overlay + planes. GLUT could get here because overlays + select for StructureNotify events to receive + DestroyNotify. */ + break; + } + width = event.xconfigure.width; + height = event.xconfigure.height; + if (width != window->width || height != window->height) { + if (window->overlay) { + XResizeWindow(__glutDisplay, window->overlay->win, width, height); + } + window->width = width; + window->height = height; + __glutSetWindow(window); + /* Do not execute OpenGL out of sequence with + respect to the XResizeWindow request! */ + glXWaitX(); + window->reshape(width, height); + window->forceReshape = False; + /* A reshape should be considered like posting a + repair; this is necessary for the "Mesa + glXSwapBuffers to repair damage" hack to operate + correctly. Without it, there's not an initial + back buffer render from which to blit from when + damage happens to the window. */ + __glutPostRedisplay(window, GLUT_REPAIR_WORK); + } + } + break; + case Expose: + /* compress expose events */ + while (XEventsQueued(__glutDisplay, QueuedAfterReading) + > 0) { + XPeekEvent(__glutDisplay, &ahead); + if (ahead.type != Expose || + ahead.xexpose.window != event.xexpose.window) { + break; + } + XNextEvent(__glutDisplay, &event); + } + if (event.xexpose.count == 0) { + GLUTmenu *menu; + + if (__glutMappedMenu && + (menu = __glutGetMenu(event.xexpose.window))) { + __glutPaintMenu(menu); + } else { + window = __glutGetWindow(event.xexpose.window); + if (window) { + if (window->win == event.xexpose.window) { + __glutPostRedisplay(window, GLUT_REPAIR_WORK); + } else if (window->overlay && window->overlay->win == event.xexpose.window) { + __glutPostRedisplay(window, GLUT_OVERLAY_REPAIR_WORK); + } + } + } + } else { + /* there are more exposes to read; wait to redisplay */ + } + break; + case ButtonPress: + case ButtonRelease: + if (__glutMappedMenu && event.type == ButtonRelease + && mappedMenuButton == event.xbutton.button) { + /* Menu is currently popped up and its button is + released. */ + __glutFinishMenu(event.xbutton.window, event.xbutton.x, event.xbutton.y); + } else { + window = __glutGetWindow(event.xbutton.window); + if (window) { + GLUTmenu *menu; + int menuNum; + + menuNum = window->menu[event.xbutton.button - 1]; + /* Make sure that __glutGetMenuByNum is only called if there + really is a menu present. */ + if ((menuNum > 0) && (menu = __glutGetMenuByNum(menuNum))) { + if (event.type == ButtonPress && !__glutMappedMenu) { + __glutStartMenu(menu, window, + event.xbutton.x_root, event.xbutton.y_root, + event.xbutton.x, event.xbutton.y); + mappedMenuButton = event.xbutton.button; + } else { + /* Ignore a release of a button with a menu + attatched to it when no menu is popped up, + or ignore a press when another menu is + already popped up. */ + } + } else if (window->mouse) { + __glutSetWindow(window); + __glutModifierMask = event.xbutton.state; + window->mouse(event.xbutton.button - 1, + event.type == ButtonRelease ? + GLUT_UP : GLUT_DOWN, + event.xbutton.x, event.xbutton.y); + __glutModifierMask = ~0; + } else { + /* Stray mouse events. Ignore. */ + } + } else { + /* Window might have been destroyed and all the + events for the window may not yet be received. */ + } + } + break; + case MotionNotify: + if (!__glutMappedMenu) { + window = __glutGetWindow(event.xmotion.window); + if (window) { + /* If motion function registered _and_ buttons held + * down, call motion function... */ + if (window->motion && event.xmotion.state & + (Button1Mask | Button2Mask | Button3Mask)) { + __glutSetWindow(window); + window->motion(event.xmotion.x, event.xmotion.y); + } + /* If passive motion function registered _and_ + buttons not held down, call passive motion + function... */ + else if (window->passive && + ((event.xmotion.state & + (Button1Mask | Button2Mask | Button3Mask)) == + 0)) { + __glutSetWindow(window); + window->passive(event.xmotion.x, + event.xmotion.y); + } + } + } else { + /* Motion events are thrown away when a pop up menu + is active. */ + } + break; + case KeyPress: + case KeyRelease: + window = __glutGetWindow(event.xkey.window); + if (!window) { + break; + } + if (event.type == KeyPress) { + keyboard = window->keyboard; + } else { + + /* If we are ignoring auto repeated keys for this window, + check if the next event in the X event queue is a KeyPress + for the exact same key (and at the exact same time) as the + key being released. The X11 protocol will send auto + repeated keys as such KeyRelease/KeyPress pairs. */ + + if (window->ignoreKeyRepeat) { + if (XEventsQueued(__glutDisplay, QueuedAfterReading)) { + XPeekEvent(__glutDisplay, &ahead); + if (ahead.type == KeyPress + && ahead.xkey.window == event.xkey.window + && ahead.xkey.keycode == event.xkey.keycode + && ahead.xkey.time == event.xkey.time) { + /* Pop off the repeated KeyPress and ignore + the auto repeated KeyRelease/KeyPress pair. */ + XNextEvent(__glutDisplay, &event); + break; + } + } + } + keyboard = window->keyboardUp; + } + if (keyboard) { + char tmp[1]; + int rc; + + rc = XLookupString(&event.xkey, tmp, sizeof(tmp), + NULL, NULL); + if (rc) { + __glutSetWindow(window); + __glutModifierMask = event.xkey.state; + keyboard(tmp[0], + event.xkey.x, event.xkey.y); + __glutModifierMask = ~0; + break; + } + } + if (event.type == KeyPress) { + special = window->special; + } else { + special = window->specialUp; + } + if (special) { + KeySym ks; + int key; + +/* Introduced in X11R6: (Partial list of) Keypad Functions. Define + in place in case compiling against an older pre-X11R6 + X11/keysymdef.h file. */ +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + + ks = XLookupKeysym((XKeyEvent *) & event, 0); + /* XXX Verbose, but makes no assumptions about keysym + layout. */ + switch (ks) { +/* *INDENT-OFF* */ + /* function keys */ + case XK_F1: key = GLUT_KEY_F1; break; + case XK_F2: key = GLUT_KEY_F2; break; + case XK_F3: key = GLUT_KEY_F3; break; + case XK_F4: key = GLUT_KEY_F4; break; + case XK_F5: key = GLUT_KEY_F5; break; + case XK_F6: key = GLUT_KEY_F6; break; + case XK_F7: key = GLUT_KEY_F7; break; + case XK_F8: key = GLUT_KEY_F8; break; + case XK_F9: key = GLUT_KEY_F9; break; + case XK_F10: key = GLUT_KEY_F10; break; + case XK_F11: key = GLUT_KEY_F11; break; + case XK_F12: key = GLUT_KEY_F12; break; + /* directional keys */ + case XK_KP_Left: + case XK_Left: key = GLUT_KEY_LEFT; break; + case XK_KP_Up: /* Introduced in X11R6. */ + case XK_Up: key = GLUT_KEY_UP; break; + case XK_KP_Right: /* Introduced in X11R6. */ + case XK_Right: key = GLUT_KEY_RIGHT; break; + case XK_KP_Down: /* Introduced in X11R6. */ + case XK_Down: key = GLUT_KEY_DOWN; break; +/* *INDENT-ON* */ + + case XK_KP_Prior: /* Introduced in X11R6. */ + case XK_Prior: + /* XK_Prior same as X11R6's XK_Page_Up */ + key = GLUT_KEY_PAGE_UP; + break; + case XK_KP_Next: /* Introduced in X11R6. */ + case XK_Next: + /* XK_Next same as X11R6's XK_Page_Down */ + key = GLUT_KEY_PAGE_DOWN; + break; + case XK_KP_Home: /* Introduced in X11R6. */ + case XK_Home: + key = GLUT_KEY_HOME; + break; +#ifdef __hpux + case XK_Select: +#endif + case XK_KP_End: /* Introduced in X11R6. */ + case XK_End: + key = GLUT_KEY_END; + break; +#ifdef __hpux + case XK_InsertChar: +#endif + case XK_KP_Insert: /* Introduced in X11R6. */ + case XK_Insert: + key = GLUT_KEY_INSERT; + break; +#ifdef __hpux + case XK_DeleteChar: +#endif + case XK_KP_Delete: /* Introduced in X11R6. */ + /* The Delete character is really an ASCII key. */ + __glutSetWindow(window); + keyboard(127, /* ASCII Delete character. */ + event.xkey.x, event.xkey.y); + goto skip; + default: + goto skip; + } + __glutSetWindow(window); + __glutModifierMask = event.xkey.state; + special(key, event.xkey.x, event.xkey.y); + __glutModifierMask = ~0; + skip:; + } + break; + case EnterNotify: + case LeaveNotify: + if (event.xcrossing.mode != NotifyNormal || + event.xcrossing.detail == NotifyNonlinearVirtual || + event.xcrossing.detail == NotifyVirtual) { + + /* Careful to ignore Enter/LeaveNotify events that + come from the pop-up menu pointer grab and ungrab. + Also, ignore "virtual" Enter/LeaveNotify events + since they represent the pointer passing through + the window hierarchy without actually entering or + leaving the actual real estate of a window. */ + + break; + } + if (__glutMappedMenu) { + GLUTmenuItem *item; + int num; + + item = __glutGetMenuItem(__glutMappedMenu, + event.xcrossing.window, &num); + if (item) { + __glutMenuItemEnterOrLeave(item, num, event.type); + break; + } + } + window = __glutGetWindow(event.xcrossing.window); + if (window) { + if (window->entry) { + if (event.type == EnterNotify) { + + /* With overlays established, X can report two + enter events for both the overlay and normal + plane window. Do not generate a second enter + callback if we reported one without an + intervening leave. */ + + if (window->entryState != EnterNotify) { + int num = window->num; + Window xid = window->win; + + window->entryState = EnterNotify; + __glutSetWindow(window); + window->entry(GLUT_ENTERED); + + if (__glutMappedMenu) { + + /* Do not generate any passive motion events + when menus are in use. */ + + } else { + + /* An EnterNotify event can result in a + "compound" callback if a passive motion + callback is also registered. In this case, + be a little paranoid about the possibility + the window could have been destroyed in the + entry callback. */ + + window = __glutWindowList[num]; + if (window && window->passive && window->win == xid) { + __glutSetWindow(window); + window->passive(event.xcrossing.x, event.xcrossing.y); + } + } + } + } else { + if (window->entryState != LeaveNotify) { + + /* When an overlay is established for a window + already mapped and with the pointer in it, + the X server will generate a leave/enter + event pair as the pointer leaves (without + moving) from the normal plane X window to + the newly mapped overlay X window (or vice + versa). This enter/leave pair should not be + reported to the GLUT program since the pair + is a consequence of creating (or destroying) + the overlay, not an actual leave from the + GLUT window. */ + + if (XEventsQueued(__glutDisplay, QueuedAfterReading)) { + XPeekEvent(__glutDisplay, &ahead); + if (ahead.type == EnterNotify && + __glutGetWindow(ahead.xcrossing.window) == window) { + XNextEvent(__glutDisplay, &event); + break; + } + } + window->entryState = LeaveNotify; + __glutSetWindow(window); + window->entry(GLUT_LEFT); + } + } + } else if (window->passive) { + __glutSetWindow(window); + window->passive(event.xcrossing.x, event.xcrossing.y); + } + } + break; + case UnmapNotify: + /* MapNotify events are not needed to maintain + visibility state since VisibilityNotify events will + be delivered when a window becomes visible from + mapping. However, VisibilityNotify events are not + delivered when a window is unmapped (for the window + or its children). */ + window = __glutGetWindow(event.xunmap.window); + if (window) { + if (window->win != event.xconfigure.window) { + /* Ignore UnmapNotify sent to the overlay planes. + GLUT could get here because overlays select for + StructureNotify events to receive DestroyNotify. + */ + break; + } + markWindowHidden(window); + } + break; + case VisibilityNotify: + window = __glutGetWindow(event.xvisibility.window); + if (window) { + /* VisibilityUnobscured+1 = GLUT_FULLY_RETAINED, + VisibilityPartiallyObscured+1 = + GLUT_PARTIALLY_RETAINED, VisibilityFullyObscured+1 + = GLUT_FULLY_COVERED. */ + int visState = event.xvisibility.state + 1; + + if (visState != window->visState) { + if (window->windowStatus) { + window->visState = visState; + __glutSetWindow(window); + window->windowStatus(visState); + } + } + } + break; + case ClientMessage: + if (event.xclient.data.l[0] == __glutWMDeleteWindow) + exit(0); + break; + case DestroyNotify: + purgeStaleWindow(event.xdestroywindow.window); + break; + case CirculateNotify: + case CreateNotify: + case GravityNotify: + case ReparentNotify: + /* Uninteresting to GLUT (but possible for GLUT to + receive). */ + break; + default: + /* Pass events not directly handled by the GLUT main + event loop to any event parsers that have been + registered. In this way, X Input extension events + are passed to the correct handler without forcing + all GLUT programs to support X Input event handling. + */ + parser = eventParserList; + while (parser) { + if (parser->func(&event)) + break; + parser = parser->next; + } + break; + } + } +#endif /* _WIN32 */ + if (__glutTimerList) { + handleTimeouts(); + } + } + while (XPending(__glutDisplay)); +} + +static void +waitForSomething(void) +{ +#if defined(__vms) && ( __VMS_VER < 70000000 ) + static struct timeval zerotime = + {0}; + unsigned int timer_efn; +#define timer_id 'glut' /* random :-) number */ + unsigned int wait_mask; +#else + static struct timeval zerotime = + {0, 0}; +#if !defined(_WIN32) + fd_set fds; +#endif +#endif + struct timeval now, timeout, waittime; +#if !defined(_WIN32) + int rc; +#endif + + /* Flush X protocol since XPending does not do this + implicitly. */ + XFlush(__glutDisplay); + if (XPending(__glutDisplay)) { + /* It is possible (but quite rare) that XFlush may have + needed to wait for a writable X connection file + descriptor, and in the process, may have had to read off + X protocol from the file descriptor. If XPending is true, + this case occured and we should avoid waiting in select + since X protocol buffered within Xlib is due to be + processed and potentially no more X protocol is on the + file descriptor, so we would risk waiting improperly in + select. */ + goto immediatelyHandleXinput; + } +#if defined(__vms) && ( __VMS_VER < 70000000 ) + timeout = __glutTimerList->timeout; + GETTIMEOFDAY(&now); + wait_mask = 1 << (__glutConnectionFD & 31); + if (IS_AFTER(now, timeout)) { + /* We need an event flag for the timer. */ + /* XXX The `right' way to do this is to use LIB$GET_EF, but + since it needs to be in the same cluster as the EFN for + the display, we will have hack it. */ + timer_efn = __glutConnectionFD - 1; + if ((timer_efn / 32) != (__glutConnectionFD / 32)) { + timer_efn = __glutConnectionFD + 1; + } + rc = SYS$CLREF(timer_efn); + rc = SYS$SETIMR(timer_efn, &timeout, NULL, timer_id, 0); + wait_mask |= 1 << (timer_efn & 31); + } else { + timer_efn = 0; + } + rc = SYS$WFLOR(__glutConnectionFD, wait_mask); + if (timer_efn != 0 && SYS$CLREF(timer_efn) == SS$_WASCLR) { + rc = SYS$CANTIM(timer_id, PSL$C_USER); + } + /* XXX There does not seem to be checking of "rc" in the code + above. Can any of the SYS$ routines above fail? */ +#else /* not vms6.2 or lower */ +#if !defined(_WIN32) + FD_ZERO(&fds); + FD_SET(__glutConnectionFD, &fds); +#endif + timeout = __glutTimerList->timeout; + GETTIMEOFDAY(&now); + if (IS_AFTER(now, timeout)) { + TIMEDELTA(waittime, timeout, now); + } else { + waittime = zerotime; + } +#if !defined(_WIN32) + rc = select(__glutConnectionFD + 1, &fds, + NULL, NULL, &waittime); + if (rc < 0 && errno != EINTR) + __glutFatalError("select error."); +#else + + MsgWaitForMultipleObjects(0, NULL, FALSE, + waittime.tv_sec*1000 + waittime.tv_usec/1000, QS_ALLINPUT); + +#endif +#endif /* not vms6.2 or lower */ + /* Without considering the cause of select unblocking, check + for pending X events and handle any timeouts (by calling + processEventsAndTimeouts). We always look for X events + even if select returned with 0 (indicating a timeout); + otherwise we risk starving X event processing by continous + timeouts. */ + if (XPending(__glutDisplay)) { + immediatelyHandleXinput: + processEventsAndTimeouts(); + } else { + if (__glutTimerList) + handleTimeouts(); + } +} + +static void +idleWait(void) +{ + if (XPending(__glutDisplay)) { + processEventsAndTimeouts(); + } else { + if (__glutTimerList) { + handleTimeouts(); + } + } + /* Make sure idle func still exists! */ + if (__glutIdleFunc) { + __glutIdleFunc(); + } +} + +static GLUTwindow **beforeEnd; + +static GLUTwindow * +processWindowWorkList(GLUTwindow * window) +{ + int workMask; + + if (window->prevWorkWin) { + window->prevWorkWin = processWindowWorkList(window->prevWorkWin); + } else { + beforeEnd = &window->prevWorkWin; + } + + /* Capture work mask for work that needs to be done to this + window, then clear the window's work mask (excepting the + dummy work bit, see below). Then, process the captured + work mask. This allows callbacks in the processing the + captured work mask to set the window's work mask for + subsequent processing. */ + + workMask = window->workMask; + assert((workMask & GLUT_DUMMY_WORK) == 0); + + /* Set the dummy work bit, clearing all other bits, to + indicate that the window is currently on the window work + list _and_ that the window's work mask is currently being + processed. This convinces __glutPutOnWorkList that this + window is on the work list still. */ + window->workMask = GLUT_DUMMY_WORK; + + /* Optimization: most of the time, the work to do is a + redisplay and not these other types of work. Check for + the following cases as a group to before checking each one + individually one by one. This saves about 25 MIPS + instructions in the common redisplay only case. */ + if (workMask & (GLUT_EVENT_MASK_WORK | GLUT_DEVICE_MASK_WORK | + GLUT_CONFIGURE_WORK | GLUT_COLORMAP_WORK | GLUT_MAP_WORK)) { +#if !defined(_WIN32) + /* Be sure to set event mask BEFORE map window is done. */ + if (workMask & GLUT_EVENT_MASK_WORK) { + long eventMask; + + /* Make sure children are not propogating events this + window is selecting for. Be sure to do this before + enabling events on the children's parent. */ + if (window->children) { + GLUTwindow *child = window->children; + unsigned long attribMask = CWDontPropagate; + XSetWindowAttributes wa; + + wa.do_not_propagate_mask = window->eventMask & GLUT_DONT_PROPAGATE_FILTER_MASK; + if (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) { + wa.event_mask = child->eventMask | (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK); + attribMask |= CWEventMask; + } + do { + XChangeWindowAttributes(__glutDisplay, child->win, + attribMask, &wa); + child = child->siblings; + } while (child); + } + eventMask = window->eventMask; + if (window->parent && window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) + eventMask |= (window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK); + XSelectInput(__glutDisplay, window->win, eventMask); + if (window->overlay) + XSelectInput(__glutDisplay, window->overlay->win, + window->eventMask & GLUT_OVERLAY_EVENT_FILTER_MASK); + } +#endif /* !_WIN32 */ + /* Be sure to set device mask BEFORE map window is done. */ + if (workMask & GLUT_DEVICE_MASK_WORK) { + __glutUpdateInputDeviceMaskFunc(window); + } + /* Be sure to configure window BEFORE map window is done. */ + if (workMask & GLUT_CONFIGURE_WORK) { +#if defined(_WIN32) + RECT changes; + POINT point; + UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER + | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOZORDER; + + GetClientRect(window->win, &changes); + + /* If this window is a toplevel window, translate the 0,0 client + coordinate into a screen coordinate for proper placement. */ + if (!window->parent) { + point.x = 0; + point.y = 0; + ClientToScreen(window->win, &point); + changes.left = point.x; + changes.top = point.y; + } + if (window->desiredConfMask & (CWX | CWY)) { + changes.left = window->desiredX; + changes.top = window->desiredY; + flags &= ~SWP_NOMOVE; + } + if (window->desiredConfMask & (CWWidth | CWHeight)) { + changes.right = changes.left + window->desiredWidth; + changes.bottom = changes.top + window->desiredHeight; + flags &= ~SWP_NOSIZE; + /* XXX If overlay exists, resize the overlay here, ie. + if (window->overlay) ... */ + } + if (window->desiredConfMask & CWStackMode) { + flags &= ~SWP_NOZORDER; + /* XXX Overlay support might require something special here. */ + } + + /* Adjust the window rectangle because Win32 thinks that the x, y, + width & height are the WHOLE window (including decorations), + whereas GLUT treats the x, y, width & height as only the CLIENT + area of the window. Only do this to top level windows + that are not in game mode (since game mode windows do + not have any decorations). */ + if (!window->parent && window != __glutGameModeWindow) { + AdjustWindowRect(&changes, + WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + FALSE); + } + + /* Do the repositioning, moving, and push/pop. */ + SetWindowPos(window->win, + window->desiredStack == Above ? HWND_TOP : HWND_NOTOPMOST, + changes.left, changes.top, + changes.right - changes.left, changes.bottom - changes.top, + flags); + + /* Zero out the mask. */ + window->desiredConfMask = 0; + + /* This hack causes the window to go back to the right position + when it is taken out of fullscreen mode. */ + if (workMask & GLUT_FULL_SCREEN_WORK) { + window->desiredConfMask |= CWX | CWY; + window->desiredX = point.x; + window->desiredY = point.y; + } +#else /* !_WIN32 */ + XWindowChanges changes; + + changes.x = window->desiredX; + changes.y = window->desiredY; + if (window->desiredConfMask & (CWWidth | CWHeight)) { + changes.width = window->desiredWidth; + changes.height = window->desiredHeight; + if (window->overlay) + XResizeWindow(__glutDisplay, window->overlay->win, + window->desiredWidth, window->desiredHeight); + if (__glutMotifHints != None) { + if (workMask & GLUT_FULL_SCREEN_WORK) { + MotifWmHints hints; + + hints.flags = MWM_HINTS_DECORATIONS; + hints.decorations = 0; /* Absolutely no + decorations. */ + XChangeProperty(__glutDisplay, window->win, + __glutMotifHints, __glutMotifHints, 32, + PropModeReplace, (unsigned char *) &hints, 4); + if (workMask & GLUT_MAP_WORK) { + /* Handle case where glutFullScreen is called + before the first time that the window is + mapped. Some window managers will randomly or + interactively position the window the first + time it is mapped if the window's + WM_NORMAL_HINTS property does not request an + explicit position. We don't want any such + window manager interaction when going + fullscreen. Overwrite the WM_NORMAL_HINTS + property installed by glutCreateWindow's + XSetWMProperties property with one explicitly + requesting a fullscreen window. */ + XSizeHints hints; + + hints.flags = USPosition | USSize; + hints.x = 0; + hints.y = 0; + hints.width = window->desiredWidth; + hints.height = window->desiredHeight; + XSetWMNormalHints(__glutDisplay, window->win, &hints); + } + } else { + XDeleteProperty(__glutDisplay, window->win, __glutMotifHints); + } + } + } + if (window->desiredConfMask & CWStackMode) { + changes.stack_mode = window->desiredStack; + /* Do not let glutPushWindow push window beneath the + underlay. */ + if (window->parent && window->parent->overlay + && window->desiredStack == Below) { + changes.stack_mode = Above; + changes.sibling = window->parent->overlay->win; + window->desiredConfMask |= CWSibling; + } + } + XConfigureWindow(__glutDisplay, window->win, + window->desiredConfMask, &changes); + window->desiredConfMask = 0; +#endif + } +#if !defined(_WIN32) + /* Be sure to establish the colormaps BEFORE map window is + done. */ + if (workMask & GLUT_COLORMAP_WORK) { + __glutEstablishColormapsProperty(window); + } +#endif + if (workMask & GLUT_MAP_WORK) { + switch (window->desiredMapState) { + case WithdrawnState: + if (window->parent) { + XUnmapWindow(__glutDisplay, window->win); + } else { + XWithdrawWindow(__glutDisplay, window->win, + __glutScreen); + } + window->shownState = 0; + break; + case NormalState: + XMapWindow(__glutDisplay, window->win); + window->shownState = 1; + break; +#ifdef _WIN32 + case GameModeState: /* Not an Xlib value. */ + ShowWindow(window->win, SW_SHOW); + window->shownState = 1; + break; +#endif + case IconicState: + XIconifyWindow(__glutDisplay, window->win, __glutScreen); + window->shownState = 0; + break; + } + } + } + if (workMask & (GLUT_REDISPLAY_WORK | GLUT_OVERLAY_REDISPLAY_WORK | GLUT_REPAIR_WORK | GLUT_OVERLAY_REPAIR_WORK)) { + if (window->forceReshape) { + /* Guarantee that before a display callback is generated + for a window, a reshape callback must be generated. */ + __glutSetWindow(window); + window->reshape(window->width, window->height); + window->forceReshape = False; + + /* Setting the redisplay bit on the first reshape is + necessary to make the "Mesa glXSwapBuffers to repair + damage" hack operate correctly. Without indicating a + redisplay is necessary, there's not an initial back + buffer render from which to blit from when damage + happens to the window. */ + workMask |= GLUT_REDISPLAY_WORK; + } + /* The code below is more involved than otherwise necessary + because it is paranoid about the overlay or entire window + being removed or destroyed in the course of the callbacks. + Notice how the global __glutWindowDamaged is used to record + the layers' damage status. See the code in glutLayerGet for + how __glutWindowDamaged is used. The point is to not have to + update the "damaged" field after the callback since the + window (or overlay) may be destroyed (or removed) when the + callback returns. */ + + if (window->overlay && window->overlay->display) { + int num = window->num; + Window xid = window->overlay ? window->overlay->win : None; + + /* If an overlay display callback is registered, we + differentiate between a redisplay needed for the + overlay and/or normal plane. If there is no overlay + display callback registered, we simply use the + standard display callback. */ + + if (workMask & (GLUT_REDISPLAY_WORK | GLUT_REPAIR_WORK)) { + if (__glutMesaSwapHackSupport) { + if (window->usedSwapBuffers) { + if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) { + SWAP_BUFFERS_WINDOW(window); + goto skippedDisplayCallback1; + } + } + } + /* Render to normal plane. */ +#ifdef _WIN32 + window->renderDc = window->hdc; +#endif + window->renderWin = window->win; + window->renderCtx = window->ctx; + __glutWindowDamaged = (workMask & GLUT_REPAIR_WORK); + __glutSetWindow(window); + window->usedSwapBuffers = 0; + window->display(); + __glutWindowDamaged = 0; + + skippedDisplayCallback1:; + } + if (workMask & (GLUT_OVERLAY_REDISPLAY_WORK | GLUT_OVERLAY_REPAIR_WORK)) { + window = __glutWindowList[num]; + if (window && window->overlay && + window->overlay->win == xid && window->overlay->display) { + + /* Render to overlay. */ +#ifdef _WIN32 + window->renderDc = window->overlay->hdc; +#endif + window->renderWin = window->overlay->win; + window->renderCtx = window->overlay->ctx; + __glutWindowDamaged = (workMask & GLUT_OVERLAY_REPAIR_WORK); + __glutSetWindow(window); + window->overlay->display(); + __glutWindowDamaged = 0; + } else { + /* Overlay may have since been destroyed or the + overlay callback may have been disabled during + normal display callback. */ + } + } + } else { + if (__glutMesaSwapHackSupport) { + if (!window->overlay && window->usedSwapBuffers) { + if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) { + SWAP_BUFFERS_WINDOW(window); + goto skippedDisplayCallback2; + } + } + } + /* Render to normal plane (and possibly overlay). */ + __glutWindowDamaged = (workMask & (GLUT_OVERLAY_REPAIR_WORK | GLUT_REPAIR_WORK)); + __glutSetWindow(window); + window->usedSwapBuffers = 0; + window->display(); + __glutWindowDamaged = 0; + + skippedDisplayCallback2:; + } + } + /* Combine workMask with window->workMask to determine what + finish and debug work there is. */ + workMask |= window->workMask; + + if (workMask & GLUT_FINISH_WORK) { + /* Finish work makes sure a glFinish gets done to indirect + rendering contexts. Indirect contexts tend to have much + longer latency because lots of OpenGL extension requests + can queue up in the X protocol stream. __glutSetWindow + is where the finish works gets queued for indirect + contexts. */ + __glutSetWindow(window); + glFinish(); + } + if (workMask & GLUT_DEBUG_WORK) { + __glutSetWindow(window); + glutReportErrors(); + } + /* Strip out dummy, finish, and debug work bits. */ + window->workMask &= ~(GLUT_DUMMY_WORK | GLUT_FINISH_WORK | GLUT_DEBUG_WORK); + if (window->workMask) { + /* Leave on work list. */ + return window; + } else { + /* Remove current window from work list. */ + return window->prevWorkWin; + } +} + +#ifndef _WIN32 +static /* X11 implementations do not need this global. */ +#endif +void +__glutProcessWindowWorkLists(void) +{ + if (__glutWindowWorkList) { + GLUTwindow *remainder, *work; + + work = __glutWindowWorkList; + __glutWindowWorkList = NULL; + if (work) { + remainder = processWindowWorkList(work); + if (remainder) { + *beforeEnd = __glutWindowWorkList; + __glutWindowWorkList = remainder; + } + } + } +} + +/* CENTRY */ +void APIENTRY +glutMainLoop(void) +{ +#if !defined(_WIN32) + if (!__glutDisplay) + __glutFatalUsage("main loop entered with out proper initialization."); +#endif + if (!__glutWindowListSize) + __glutFatalUsage( + "main loop entered with no windows created."); + for (;;) { + __glutProcessWindowWorkLists(); + if (__glutIdleFunc || __glutWindowWorkList) { + idleWait(); + } else { + if (__glutTimerList) { + waitForSomething(); + } else { + processEventsAndTimeouts(); + } + } + } +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_ext.c b/xc/extras/Mesa/src-glut/glut_ext.c new file mode 100644 index 000000000..abcb17a91 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_ext.c @@ -0,0 +1,53 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* 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 <stdlib.h> +#include <string.h> + +#include "glutint.h" + +/* CENTRY */ +int APIENTRY +glutExtensionSupported(const char *extension) +{ + static const GLubyte *extensions = NULL; + const GLubyte *start; + GLubyte *where, *terminator; + + /* Extension names should not have spaces. */ + where = (GLubyte *) strchr(extension, ' '); + if (where || *extension == '\0') + return 0; + + if (!extensions) { + extensions = glGetString(GL_EXTENSIONS); + } + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = extensions; + for (;;) { + /* If your application crashes in the strstr routine below, + you are probably calling glutExtensionSupported without + having a current window. Calling glGetString without + a current OpenGL context has unpredictable results. + Please fix your program. */ + where = (GLubyte *) strstr((const char *) start, extension); + if (!where) + break; + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') { + if (*terminator == ' ' || *terminator == '\0') { + return 1; + } + } + start = terminator; + } + return 0; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_fbc.c b/xc/extras/Mesa/src-glut/glut_fbc.c new file mode 100644 index 000000000..e93188b86 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_fbc.c @@ -0,0 +1,164 @@ + +/* Copyright (c) Mark J. Kilgard, 1998. */ + +/* 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. */ + +/* I appreciate the guidance from William Mitchell + (mitchell@cam.nist.gov) in developing this friend interface + for use by the f90gl package. See ../../README.fortran */ + +#include "glutint.h" + +/* FCB stands for Fortran CallBack. */ + +/* There is only one idleFunc, menuStateFunc, and menuStatusFunc, so they + can be saved in the wrappers for Fortran rather than the C structures. */ + +/* Set a Fortran callback function. */ + +void APIENTRY +__glutSetFCB(int which, void *func) +{ +#ifdef SUPPORT_FORTRAN + switch (which) { + case GLUT_FCB_DISPLAY: + __glutCurrentWindow->fdisplay = (GLUTdisplayFCB) func; + break; + case GLUT_FCB_RESHAPE: + __glutCurrentWindow->freshape = (GLUTreshapeFCB) func; + break; + case GLUT_FCB_MOUSE: + __glutCurrentWindow->fmouse = (GLUTmouseFCB) func; + break; + case GLUT_FCB_MOTION: + __glutCurrentWindow->fmotion = (GLUTmotionFCB) func; + break; + case GLUT_FCB_PASSIVE: + __glutCurrentWindow->fpassive = (GLUTpassiveFCB) func; + break; + case GLUT_FCB_ENTRY: + __glutCurrentWindow->fentry = (GLUTentryFCB) func; + break; + case GLUT_FCB_KEYBOARD: + __glutCurrentWindow->fkeyboard = (GLUTkeyboardFCB) func; + break; + case GLUT_FCB_KEYBOARD_UP: + __glutCurrentWindow->fkeyboardUp = (GLUTkeyboardFCB) func; + break; + case GLUT_FCB_WINDOW_STATUS: + __glutCurrentWindow->fwindowStatus = (GLUTwindowStatusFCB) func; + break; + case GLUT_FCB_VISIBILITY: + __glutCurrentWindow->fvisibility = (GLUTvisibilityFCB) func; + break; + case GLUT_FCB_SPECIAL: + __glutCurrentWindow->fspecial = (GLUTspecialFCB) func; + break; + case GLUT_FCB_SPECIAL_UP: + __glutCurrentWindow->fspecialUp = (GLUTspecialFCB) func; + break; + case GLUT_FCB_BUTTON_BOX: + __glutCurrentWindow->fbuttonBox = (GLUTbuttonBoxFCB) func; + break; + case GLUT_FCB_DIALS: + __glutCurrentWindow->fdials = (GLUTdialsFCB) func; + break; + case GLUT_FCB_SPACE_MOTION: + __glutCurrentWindow->fspaceMotion = (GLUTspaceMotionFCB) func; + break; + case GLUT_FCB_SPACE_ROTATE: + __glutCurrentWindow->fspaceRotate = (GLUTspaceRotateFCB) func; + break; + case GLUT_FCB_SPACE_BUTTON: + __glutCurrentWindow->fspaceButton = (GLUTspaceButtonFCB) func; + break; + case GLUT_FCB_TABLET_MOTION: + __glutCurrentWindow->ftabletMotion = (GLUTtabletMotionFCB) func; + break; + case GLUT_FCB_TABLET_BUTTON: + __glutCurrentWindow->ftabletButton = (GLUTtabletButtonFCB) func; + break; +#ifdef _WIN32 + case GLUT_FCB_JOYSTICK: + __glutCurrentWindow->fjoystick = (GLUTjoystickFCB) func; + break; +#endif + case GLUT_FCB_OVERLAY_DISPLAY: + __glutCurrentWindow->overlay->fdisplay = (GLUTdisplayFCB) func; + break; + case GLUT_FCB_SELECT: + __glutCurrentMenu->fselect = (GLUTselectFCB) func; + break; + case GLUT_FCB_TIMER: + __glutNewTimer->ffunc = (GLUTtimerFCB) func; + break; + } +#endif +} + +/* Get a Fortran callback function. */ + +void* APIENTRY +__glutGetFCB(int which) +{ +#ifdef SUPPORT_FORTRAN + switch (which) { + case GLUT_FCB_DISPLAY: + return (void *) __glutCurrentWindow->fdisplay; + case GLUT_FCB_RESHAPE: + return (void *) __glutCurrentWindow->freshape; + case GLUT_FCB_MOUSE: + return (void *) __glutCurrentWindow->fmouse; + case GLUT_FCB_MOTION: + return (void *) __glutCurrentWindow->fmotion; + case GLUT_FCB_PASSIVE: + return (void *) __glutCurrentWindow->fpassive; + case GLUT_FCB_ENTRY: + return (void *) __glutCurrentWindow->fentry; + case GLUT_FCB_KEYBOARD: + return (void *) __glutCurrentWindow->fkeyboard; + case GLUT_FCB_KEYBOARD_UP: + return (void *) __glutCurrentWindow->fkeyboardUp; + case GLUT_FCB_WINDOW_STATUS: + return (void *) __glutCurrentWindow->fwindowStatus; + case GLUT_FCB_VISIBILITY: + return (void *) __glutCurrentWindow->fvisibility; + case GLUT_FCB_SPECIAL: + return (void *) __glutCurrentWindow->fspecial; + case GLUT_FCB_SPECIAL_UP: + return (void *) __glutCurrentWindow->fspecialUp; + case GLUT_FCB_BUTTON_BOX: + return (void *) __glutCurrentWindow->fbuttonBox; + case GLUT_FCB_DIALS: + return (void *) __glutCurrentWindow->fdials; + case GLUT_FCB_SPACE_MOTION: + return (void *) __glutCurrentWindow->fspaceMotion; + case GLUT_FCB_SPACE_ROTATE: + return (void *) __glutCurrentWindow->fspaceRotate; + case GLUT_FCB_SPACE_BUTTON: + return (void *) __glutCurrentWindow->fspaceButton; + case GLUT_FCB_TABLET_MOTION: + return (void *) __glutCurrentWindow->ftabletMotion; + case GLUT_FCB_TABLET_BUTTON: + return (void *) __glutCurrentWindow->ftabletButton; + case GLUT_FCB_JOYSTICK: +#ifdef _WIN32 + return (void *) __glutCurrentWindow->fjoystick; +#else + return NULL; +#endif + case GLUT_FCB_OVERLAY_DISPLAY: + return (void *) __glutCurrentWindow->overlay->fdisplay; + case GLUT_FCB_SELECT: + return (void *) __glutCurrentMenu->fselect; + case GLUT_FCB_TIMER: + return (void *) __glutTimerList->ffunc; + default: + return NULL; + } +#else + return NULL; +#endif +} diff --git a/xc/extras/Mesa/src-glut/glut_fullscrn.c b/xc/extras/Mesa/src-glut/glut_fullscrn.c new file mode 100644 index 000000000..8d58f1743 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_fullscrn.c @@ -0,0 +1,52 @@ + +/* Copyright (c) Mark J. Kilgard, 1995, 1998. */ + +/* 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 <stdio.h> /* SunOS multithreaded assert() needs <stdio.h>. Lame. */ +#include <assert.h> + +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#endif + +/* SGI optimization introduced in IRIX 6.3 to avoid X server + round trips for interning common X atoms. */ +#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) +#include <X11/SGIFastAtom.h> +#else +#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) +#endif + +#include "glutint.h" + +/* CENTRY */ +void APIENTRY +glutFullScreen(void) +{ + assert(!__glutCurrentWindow->parent); + IGNORE_IN_GAME_MODE(); +#if !defined(_WIN32) + if (__glutMotifHints == None) { + __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", + SGI_XA__MOTIF_WM_HINTS, 0); + if (__glutMotifHints == None) { + __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); + } + } +#endif + + __glutCurrentWindow->desiredX = 0; + __glutCurrentWindow->desiredY = 0; + __glutCurrentWindow->desiredWidth = __glutScreenWidth; + __glutCurrentWindow->desiredHeight = __glutScreenHeight; + __glutCurrentWindow->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; + + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_gamemode.c b/xc/extras/Mesa/src-glut/glut_gamemode.c new file mode 100644 index 000000000..5584b790b --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_gamemode.c @@ -0,0 +1,674 @@ + +/* Copyright (c) Mark J. Kilgard, 1998. */ + +/* 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 <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "glutint.h" + +#ifndef _WIN32 +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +/* SGI optimization introduced in IRIX 6.3 to avoid X server + round trips for interning common X atoms. */ +#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) +#include <X11/SGIFastAtom.h> +#else +#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) +#endif +#endif /* not _WIN32 */ + +int __glutDisplaySettingsChanged = 0; +static DisplayMode *dmodes, *currentDm = NULL; +static int ndmodes = -1; +GLUTwindow *__glutGameModeWindow = NULL; + +#ifdef TEST +static char *compstr[] = +{ + "none", "=", "!=", "<=", ">=", ">", "<", "~" +}; +static char *capstr[] = +{ + "width", "height", "bpp", "hertz", "num" +}; +#endif + +void __cdecl +__glutCloseDownGameMode(void) +{ + if (__glutDisplaySettingsChanged) { +#ifdef _WIN32 + /* Assumes that display settings have been changed, that + is __glutDisplaySettingsChanged is true. */ + ChangeDisplaySettings(NULL, 0); +#endif + __glutDisplaySettingsChanged = 0; + } + __glutGameModeWindow = NULL; +} + +void APIENTRY +glutLeaveGameMode(void) +{ + if (__glutGameModeWindow == NULL) { + __glutWarning("not in game mode so cannot leave game mode"); + return; + } + __glutDestroyWindow(__glutGameModeWindow, + __glutGameModeWindow); + XFlush(__glutDisplay); + __glutGameModeWindow = NULL; +} + +#ifdef _WIN32 + +/* Same values as from MSDN's SetDisp.c example. */ +#define MIN_WIDTH 400 +#define MIN_FREQUENCY 60 + +static void +initGameModeSupport(void) +{ + DEVMODE dm; + DWORD mode; + int i; + + if (ndmodes >= 0) { + /* ndmodes is initially -1 to indicate no + dmodes allocated yet. */ + return; + } + + /* Determine how many display modes there are. */ + ndmodes = 0; + mode = 0; + while (EnumDisplaySettings(NULL, mode, &dm)) { + if (dm.dmPelsWidth >= MIN_WIDTH && + (dm.dmDisplayFrequency == 0 || + dm.dmDisplayFrequency >= MIN_FREQUENCY)) { + ndmodes++; + } + mode++; + } + + /* Allocate memory for a list of all the display modes. */ + dmodes = (DisplayMode*) + malloc(ndmodes * sizeof(DisplayMode)); + + /* Now that we know how many display modes to expect, + enumerate them again and save the information in + the list we allocated above. */ + i = 0; + mode = 0; + while (EnumDisplaySettings(NULL, mode, &dm)) { + /* Try to reject any display settings that seem unplausible. */ + if (dm.dmPelsWidth >= MIN_WIDTH && + (dm.dmDisplayFrequency == 0 || + dm.dmDisplayFrequency >= MIN_FREQUENCY)) { + dmodes[i].devmode = dm; + dmodes[i].valid = 1; /* XXX Not used for now. */ + dmodes[i].cap[DM_WIDTH] = dm.dmPelsWidth; + dmodes[i].cap[DM_HEIGHT] = dm.dmPelsHeight; + dmodes[i].cap[DM_PIXEL_DEPTH] = dm.dmBitsPerPel; + if (dm.dmDisplayFrequency == 0) { + /* Guess a reasonable guess. */ + /* Lame Windows 95 version of EnumDisplaySettings. */ + dmodes[i].cap[DM_HERTZ] = 60; + } else { + dmodes[i].cap[DM_HERTZ] = dm.dmDisplayFrequency; + } + i++; + } + mode++; + } + + assert(i == ndmodes); +} + +#else + +/* X Windows version of initGameModeSupport. */ +static void +initGameModeSupport(void) +{ + if (ndmodes >= 0) { + /* ndmodes is initially -1 to indicate no + dmodes allocated yet. */ + return; + } + + /* Determine how many display modes there are. */ + ndmodes = 0; +} + +#endif + +/* This routine is based on similiar code in glut_dstr.c */ +static DisplayMode * +findMatch(DisplayMode * dmodes, int ndmodes, + Criterion * criteria, int ncriteria) +{ + DisplayMode *found; + int *bestScore, *thisScore; + int i, j, numok, result = 0, worse, better; + + found = NULL; + numok = 1; /* "num" capability is indexed from 1, + not 0. */ + + /* XXX alloca canidate. */ + bestScore = (int *) malloc(ncriteria * sizeof(int)); + if (!bestScore) { + __glutFatalError("out of memory."); + } + for (j = 0; j < ncriteria; j++) { + /* Very negative number. */ + bestScore[j] = -32768; + } + + /* XXX alloca canidate. */ + thisScore = (int *) malloc(ncriteria * sizeof(int)); + if (!thisScore) { + __glutFatalError("out of memory."); + } + + for (i = 0; i < ndmodes; i++) { + if (dmodes[i].valid) { + worse = 0; + better = 0; + + for (j = 0; j < ncriteria; j++) { + int cap, cvalue, dvalue; + + cap = criteria[j].capability; + cvalue = criteria[j].value; + if (cap == NUM) { + dvalue = numok; + } else { + dvalue = dmodes[i].cap[cap]; + } +#ifdef TEST + if (verbose) + printf(" %s %s %d to %d\n", + capstr[cap], compstr[criteria[j].comparison], cvalue, dvalue); +#endif + switch (criteria[j].comparison) { + case EQ: + result = cvalue == dvalue; + thisScore[j] = 1; + break; + case NEQ: + result = cvalue != dvalue; + thisScore[j] = 1; + break; + case LT: + result = dvalue < cvalue; + thisScore[j] = dvalue - cvalue; + break; + case GT: + result = dvalue > cvalue; + thisScore[j] = dvalue - cvalue; + break; + case LTE: + result = dvalue <= cvalue; + thisScore[j] = dvalue - cvalue; + break; + case GTE: + result = (dvalue >= cvalue); + thisScore[j] = dvalue - cvalue; + break; + case MIN: + result = dvalue >= cvalue; + thisScore[j] = cvalue - dvalue; + break; + } + +#ifdef TEST + if (verbose) + printf(" result=%d score=%d bestScore=%d\n", result, thisScore[j], bestScore[j]); +#endif + + if (result) { + if (better || thisScore[j] > bestScore[j]) { + better = 1; + } else if (thisScore[j] == bestScore[j]) { + /* Keep looking. */ + } else { + goto nextDM; + } + } else { + if (cap == NUM) { + worse = 1; + } else { + goto nextDM; + } + } + + } + + if (better && !worse) { + found = &dmodes[i]; + for (j = 0; j < ncriteria; j++) { + bestScore[j] = thisScore[j]; + } + } + numok++; + + nextDM:; + + } + } + free(bestScore); + free(thisScore); + return found; +} + +/** + * Parses strings in the form of: + * 800x600 + * 800x600:16 + * 800x600@60 + * 800x600:16@60 + * @60 + * :16 + * :16@60 + * NOTE that @ before : is not parsed. + */ +static int +specialCaseParse(char *word, Criterion * criterion, int mask) +{ + char *xstr, *response; + int got; + int width, height, bpp, hertz; + + switch(word[0]) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + /* The WWWxHHH case. */ + if (mask & (1 << DM_WIDTH)) { + return -1; + } + xstr = strpbrk(&word[1], "x"); + if (xstr) { + width = (int) strtol(word, &response, 0); + if (response == word || response[0] != 'x') { + /* Not a valid number OR needs to be followed by 'x'. */ + return -1; + } + height = (int) strtol(&xstr[1], &response, 0); + if (response == &xstr[1]) { + /* Not a valid number. */ + return -1; + } + criterion[0].capability = DM_WIDTH; + criterion[0].comparison = EQ; + criterion[0].value = width; + criterion[1].capability = DM_HEIGHT; + criterion[1].comparison = EQ; + criterion[1].value = height; + got = specialCaseParse(response, + &criterion[2], 1 << DM_WIDTH); + if (got >= 0) { + return got + 2; + } else { + return -1; + } + } + return -1; + case ':': + /* The :BPP case. */ + if (mask & (1 << DM_PIXEL_DEPTH)) { + return -1; + } + bpp = (int) strtol(&word[1], &response, 0); + if (response == &word[1]) { + /* Not a valid number. */ + return -1; + } + criterion[0].capability = DM_PIXEL_DEPTH; + criterion[0].comparison = EQ; + criterion[0].value = bpp; + got = specialCaseParse(response, + &criterion[1], 1 << DM_WIDTH | 1 << DM_PIXEL_DEPTH); + if (got >= 0) { + return got + 1; + } else { + return -1; + } + case '@': + /* The @HZ case. */ + if (mask & (1 << DM_HERTZ)) { + return -1; + } + hertz = (int) strtol(&word[1], &response, 0); + if (response == &word[1]) { + /* Not a valid number. */ + return -1; + } + criterion[0].capability = DM_HERTZ; + criterion[0].comparison = EQ; + criterion[0].value = hertz; + got = specialCaseParse(response, + &criterion[1], ~DM_HERTZ); + if (got >= 0) { + return got + 1; + } else { + return -1; + } + case '\0': + return 0; + } + return -1; +} + +/* This routine is based on similiar code in glut_dstr.c */ +static int +parseCriteria(char *word, Criterion * criterion) +{ + char *cstr, *vstr, *response; + int comparator, value = 0; + + cstr = strpbrk(word, "=><!~"); + if (cstr) { + switch (cstr[0]) { + case '=': + comparator = EQ; + vstr = &cstr[1]; + break; + case '~': + comparator = MIN; + vstr = &cstr[1]; + break; + case '>': + if (cstr[1] == '=') { + comparator = GTE; + vstr = &cstr[2]; + } else { + comparator = GT; + vstr = &cstr[1]; + } + break; + case '<': + if (cstr[1] == '=') { + comparator = LTE; + vstr = &cstr[2]; + } else { + comparator = LT; + vstr = &cstr[1]; + } + break; + case '!': + if (cstr[1] == '=') { + comparator = NEQ; + vstr = &cstr[2]; + } else { + return -1; + } + break; + default: + return -1; + } + value = (int) strtol(vstr, &response, 0); + if (response == vstr) { + /* Not a valid number. */ + return -1; + } + *cstr = '\0'; + } else { + comparator = NONE; + } + switch (word[0]) { + case 'b': + if (!strcmp(word, "bpp")) { + criterion[0].capability = DM_PIXEL_DEPTH; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + return -1; + case 'h': + if (!strcmp(word, "height")) { + criterion[0].capability = DM_HEIGHT; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + if (!strcmp(word, "hertz")) { + criterion[0].capability = DM_HERTZ; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + return -1; + case 'n': + if (!strcmp(word, "num")) { + criterion[0].capability = DM_NUM; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + return -1; + case 'w': + if (!strcmp(word, "width")) { + criterion[0].capability = DM_WIDTH; + if (comparator == NONE) { + return -1; + } else { + criterion[0].comparison = comparator; + criterion[0].value = value; + return 1; + } + } + return -1; + } + if (comparator == NONE) { + return specialCaseParse(word, criterion, 0); + } + return -1; +} + +/* This routine is based on similiar code in glut_dstr.c */ +static Criterion * +parseDisplayString(const char *display, int *ncriteria) +{ + Criterion *criteria = NULL; + int n, parsed; + char *copy, *word; + + copy = __glutStrdup(display); + /* Attempt to estimate how many criteria entries should be + needed. */ + n = 0; + word = strtok(copy, " \t"); + while (word) { + n++; + word = strtok(NULL, " \t"); + } + /* Allocate number of words of criteria. A word + could contain as many as four criteria in the + worst case. Example: 800x600:16@60 */ + criteria = (Criterion *) malloc(4 * n * sizeof(Criterion)); + if (!criteria) { + __glutFatalError("out of memory."); + } + + /* Re-copy the copy of the display string. */ + strcpy(copy, display); + + n = 0; + word = strtok(copy, " \t"); + while (word) { + parsed = parseCriteria(word, &criteria[n]); + if (parsed >= 0) { + n += parsed; + } else { + __glutWarning("Unrecognized game mode string word: %s (ignoring)\n", word); + } + word = strtok(NULL, " \t"); + } + + free(copy); + *ncriteria = n; + return criteria; +} + +void APIENTRY +glutGameModeString(const char *string) +{ + Criterion *criteria; + int ncriteria; + + initGameModeSupport(); + criteria = parseDisplayString(string, &ncriteria); + currentDm = findMatch(dmodes, ndmodes, criteria, ncriteria); + free(criteria); +} + +int APIENTRY +glutEnterGameMode(void) +{ + GLUTwindow *window; + int width, height; + Window win; + + if (__glutMappedMenu) { + __glutFatalUsage("entering game mode not allowed while menus in use"); + } + if (__glutGameModeWindow) { + /* Already in game mode, so blow away game mode + window so apps can change resolutions. */ + window = __glutGameModeWindow; + /* Setting the game mode window to NULL tricks + the window destroy code into not undoing the + screen display change since we plan on immediately + doing another mode change. */ + __glutGameModeWindow = NULL; + __glutDestroyWindow(window, window); + } + + /* Assume default screen size until we find out if we + can actually change the display settings. */ + width = __glutScreenWidth; + height = __glutScreenHeight; + + if (currentDm) { +#ifdef _WIN32 + LONG status; + static int registered = 0; + + status = ChangeDisplaySettings(¤tDm->devmode, + CDS_FULLSCREEN); + if (status == DISP_CHANGE_SUCCESSFUL) { + __glutDisplaySettingsChanged = 1; + width = currentDm->cap[DM_WIDTH]; + height = currentDm->cap[DM_HEIGHT]; + if (!registered) { + atexit(__glutCloseDownGameMode); + registered = 1; + } + } else { + /* Switch back to default resolution. */ + ChangeDisplaySettings(NULL, 0); + } +#endif + } + + window = __glutCreateWindow(NULL, 0, 0, + width, height, /* game mode */ 1); + win = window->win; + +#if !defined(_WIN32) + if (__glutMotifHints == None) { + __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", + SGI_XA__MOTIF_WM_HINTS, 0); + if (__glutMotifHints == None) { + __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); + } + } + + /* Game mode window is a toplevel window. */ + XSetWMProtocols(__glutDisplay, win, &__glutWMDeleteWindow, 1); +#endif + + /* Schedule the fullscreen property to be added and to + make sure the window is configured right. Win32 + doesn't need this. */ + window->desiredX = 0; + window->desiredY = 0; + window->desiredWidth = width; + window->desiredHeight = height; + window->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; +#ifdef _WIN32 + /* Win32 does not want to use GLUT_FULL_SCREEN_WORK + for game mode because we need to be maximizing + the window in game mode, not just sizing it to + take up the full screen. The Win32-ness of game + mode happens when you pass 1 in the gameMode parameter + to __glutCreateWindow above. A gameMode of creates + a WS_POPUP window, not a standard WS_OVERLAPPEDWINDOW + window. WS_POPUP ensures the taskbar is hidden. */ + __glutPutOnWorkList(window, + GLUT_CONFIGURE_WORK); +#else + __glutPutOnWorkList(window, + GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); +#endif + + __glutGameModeWindow = window; + return window->num + 1; +} + +int APIENTRY +glutGameModeGet(GLenum mode) +{ + switch (mode) { + case GLUT_GAME_MODE_ACTIVE: + return __glutGameModeWindow != NULL; + case GLUT_GAME_MODE_POSSIBLE: + return currentDm != NULL; + case GLUT_GAME_MODE_WIDTH: + return currentDm ? currentDm->cap[DM_WIDTH] : -1; + case GLUT_GAME_MODE_HEIGHT: + return currentDm ? currentDm->cap[DM_HEIGHT] : -1; + case GLUT_GAME_MODE_PIXEL_DEPTH: + return currentDm ? currentDm->cap[DM_PIXEL_DEPTH] : -1; + case GLUT_GAME_MODE_REFRESH_RATE: + return currentDm ? currentDm->cap[DM_HERTZ] : -1; + case GLUT_GAME_MODE_DISPLAY_CHANGED: + return __glutDisplaySettingsChanged; + default: + return -1; + } +} diff --git a/xc/extras/Mesa/src-glut/glut_get.c b/xc/extras/Mesa/src-glut/glut_get.c new file mode 100644 index 000000000..e4117bdc8 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_get.c @@ -0,0 +1,216 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ + +/* 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 <assert.h> +#include <stdlib.h> /* SunOS 4 needs NULL defined for GETTIMEOFDAY macro. */ +#include "glutint.h" + +/* CENTRY */ +int APIENTRY +glutGet(GLenum param) +{ + Window win, root; + int x, y, value; + unsigned int width, height, border, depth; + + switch (param) { + case GLUT_INIT_WINDOW_X: + return __glutInitX; + case GLUT_INIT_WINDOW_Y: + return __glutInitY; + case GLUT_INIT_WINDOW_WIDTH: + return __glutInitWidth; + case GLUT_INIT_WINDOW_HEIGHT: + return __glutInitHeight; + case GLUT_INIT_DISPLAY_MODE: + return __glutDisplayMode; + case GLUT_WINDOW_X: + XTranslateCoordinates(__glutDisplay, __glutCurrentWindow->win, + __glutRoot, 0, 0, &x, &y, &win); + return x; + case GLUT_WINDOW_Y: + XTranslateCoordinates(__glutDisplay, __glutCurrentWindow->win, + __glutRoot, 0, 0, &x, &y, &win); + return y; + case GLUT_WINDOW_WIDTH: + if (!__glutCurrentWindow->reshape) { + XGetGeometry(__glutDisplay, __glutCurrentWindow->win, + &root, &x, &y, + &width, &height, &border, &depth); + return width; + } + return __glutCurrentWindow->width; + case GLUT_WINDOW_HEIGHT: + if (!__glutCurrentWindow->reshape) { + XGetGeometry(__glutDisplay, __glutCurrentWindow->win, + &root, &x, &y, + &width, &height, &border, &depth); + return height; + } + return __glutCurrentWindow->height; + +#define GET_CONFIG(attrib) { \ + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { \ + glXGetConfig(__glutDisplay, __glutCurrentWindow->vis, \ + attrib, &value); \ + } else { \ + glXGetConfig(__glutDisplay, __glutCurrentWindow->overlay->vis, \ + attrib, &value); \ + } \ +} + + case GLUT_WINDOW_BUFFER_SIZE: + GET_CONFIG(GLX_BUFFER_SIZE); + return value; + case GLUT_WINDOW_STENCIL_SIZE: + GET_CONFIG(GLX_STENCIL_SIZE); + return value; + case GLUT_WINDOW_DEPTH_SIZE: + GET_CONFIG(GLX_DEPTH_SIZE); + return value; + case GLUT_WINDOW_RED_SIZE: + GET_CONFIG(GLX_RED_SIZE); + return value; + case GLUT_WINDOW_GREEN_SIZE: + GET_CONFIG(GLX_GREEN_SIZE); + return value; + case GLUT_WINDOW_BLUE_SIZE: + GET_CONFIG(GLX_BLUE_SIZE); + return value; + case GLUT_WINDOW_ALPHA_SIZE: + GET_CONFIG(GLX_ALPHA_SIZE); + return value; + case GLUT_WINDOW_ACCUM_RED_SIZE: + GET_CONFIG(GLX_ACCUM_RED_SIZE); + return value; + case GLUT_WINDOW_ACCUM_GREEN_SIZE: + GET_CONFIG(GLX_ACCUM_GREEN_SIZE); + return value; + case GLUT_WINDOW_ACCUM_BLUE_SIZE: + GET_CONFIG(GLX_ACCUM_BLUE_SIZE); + return value; + case GLUT_WINDOW_ACCUM_ALPHA_SIZE: + GET_CONFIG(GLX_ACCUM_ALPHA_SIZE); + return value; + case GLUT_WINDOW_DOUBLEBUFFER: + GET_CONFIG(GLX_DOUBLEBUFFER); + return value; + case GLUT_WINDOW_RGBA: + GET_CONFIG(GLX_RGBA); + return value; + case GLUT_WINDOW_COLORMAP_SIZE: + GET_CONFIG(GLX_RGBA); + if (value) { + return 0; + } else { +#if defined(_WIN32) + /* KLUDGE: we always assume 256 colors in CI mode on + Win32 */ + return 256; +#else + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + return __glutCurrentWindow->vis->visual->map_entries; + } else { + return __glutCurrentWindow->overlay->vis->visual->map_entries; + } +#endif /* _WIN32 */ + } + case GLUT_WINDOW_PARENT: + return __glutCurrentWindow->parent ? + __glutCurrentWindow->parent->num + 1 : 0; + case GLUT_WINDOW_NUM_CHILDREN: + { + int num = 0; + GLUTwindow *children = __glutCurrentWindow->children; + + while (children) { + num++; + children = children->siblings; + } + return num; + } + case GLUT_WINDOW_NUM_SAMPLES: +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + if (__glutIsSupportedByGLX("GLX_SGIS_multisample")) { + GET_CONFIG(GLX_SAMPLES_SGIS); + return value; + } else { + return 0; + } +#else + /* Independent of GLX server support, multisampling not + supported by GLX client-side. */ + return 0; +#endif + case GLUT_WINDOW_STEREO: + GET_CONFIG(GLX_STEREO); + return value; + case GLUT_WINDOW_CURSOR: + return __glutCurrentWindow->cursor; + case GLUT_SCREEN_WIDTH: + return DisplayWidth(__glutDisplay, __glutScreen); + case GLUT_SCREEN_HEIGHT: + return DisplayHeight(__glutDisplay, __glutScreen); + case GLUT_SCREEN_WIDTH_MM: + return DisplayWidthMM(__glutDisplay, __glutScreen); + case GLUT_SCREEN_HEIGHT_MM: + return DisplayHeightMM(__glutDisplay, __glutScreen); + case GLUT_MENU_NUM_ITEMS: + return __glutCurrentMenu->num; + case GLUT_DISPLAY_MODE_POSSIBLE: + { + XVisualInfo *vi; + Bool dummy, visAlloced; + void *fbc; + +#if defined(_WIN32) + /* Our fake glXChooseVisual (which is called by + __glutDetermineVisual) needs an HDC to work with, so grab one + from the "root" window. */ + XHDC = GetDC(GetDesktopWindow()); +#endif + vi = __glutDetermineWindowVisual(&dummy, &visAlloced, &fbc); +#if defined(_WIN32) + ReleaseDC(GetDesktopWindow(), XHDC); +#endif + if (vi) { + if (visAlloced) + XFree(vi); + return 1; + } + return 0; + } + case GLUT_ELAPSED_TIME: + { + struct timeval elapsed, beginning, now; + + __glutInitTime(&beginning); + GETTIMEOFDAY(&now); + TIMEDELTA(elapsed, now, beginning); + /* Return elapsed milliseconds. */ +#if defined(__vms) && ( __VMS_VER < 70000000 ) + return (int) (elapsed.val / TICKS_PER_MILLISECOND); +#else + return (int) ((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000)); +#endif + } + case GLUT_WINDOW_FORMAT_ID: +#if defined(_WIN32) + return GetPixelFormat(__glutCurrentWindow->hdc); +#else + if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { + return (int) __glutCurrentWindow->vis->visualid; + } else { + return (int) __glutCurrentWindow->overlay->vis->visualid; + } +#endif + default: + __glutWarning("invalid glutGet parameter: %d", param); + return -1; + } +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_glxext.c b/xc/extras/Mesa/src-glut/glut_glxext.c new file mode 100644 index 000000000..04862432f --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_glxext.c @@ -0,0 +1,48 @@ + +/* Copyright (c) Mark J. Kilgard, 1997. */ + +/* 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 <stdlib.h> +#include <string.h> +#include "glutint.h" + +#if defined(GLX_VERSION_1_1) +int +__glutIsSupportedByGLX(char *extension) +{ + static const char *extensions = NULL; + const char *start; + char *where, *terminator; + int major, minor; + + glXQueryVersion(__glutDisplay, &major, &minor); + /* Be careful not to call glXQueryExtensionsString if it + looks like the server doesn't support GLX 1.1. + Unfortunately, the original GLX 1.0 didn't have the notion + of GLX extensions. */ + if ((major == 1 && minor >= 1) || (major > 1)) { + if (!extensions) + extensions = glXQueryExtensionsString(__glutDisplay, __glutScreen); + /* It takes a bit of care to be fool-proof about parsing + the GLX extensions string. Don't be fooled by + sub-strings, etc. */ + start = extensions; + for (;;) { + where = strstr(start, extension); + if (!where) + return 0; + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') { + if (*terminator == ' ' || *terminator == '\0') { + return 1; + } + } + start = terminator; + } + } + return 0; +} +#endif diff --git a/xc/extras/Mesa/src-glut/glut_hel10.c b/xc/extras/Mesa/src-glut/glut_hel10.c new file mode 100644 index 000000000..703cef38f --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_hel10.c @@ -0,0 +1,1778 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmapHelvetica10 XXX +#include "glutbitmap.h" +#undef glutBitmapHelvetica10 + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x50, +}; + +static const BitmapCharRec ch255 = {4,10,0,2,5,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {5,10,0,2,6,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {4,11,0,2,5,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50, +}; + +static const BitmapCharRec ch252 = {4,8,0,0,5,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch251 = {4,9,0,0,5,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch250 = {4,9,0,0,5,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch249 = {4,9,0,0,5,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x70,0x88,0xc8,0xa8,0x98,0x74, +}; + +static const BitmapCharRec ch248 = {6,6,0,0,6,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x0,0xf8,0x0,0x20, +}; + +static const BitmapCharRec ch247 = {5,5,0,-1,6,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch246 = {5,8,0,0,6,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {5,9,0,0,6,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch244 = {5,9,0,0,6,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch243 = {5,9,0,0,6,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch242 = {5,9,0,0,6,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x90,0x90,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch241 = {4,9,0,0,5,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x70,0x88,0x88,0x88,0x88,0x78,0x90,0x60,0x50, +}; + +static const BitmapCharRec ch240 = {5,9,0,0,6,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch239 = {3,8,0,0,2,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch238 = {3,9,1,0,2,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch237 = {2,9,0,0,2,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch236 = {2,9,1,0,2,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50, +}; + +static const BitmapCharRec ch235 = {4,8,0,0,5,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch234 = {4,9,0,0,5,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch233 = {4,9,0,0,5,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch232 = {4,9,0,0,5,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x60,0x20,0x60,0x90,0x80,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch231 = {4,8,0,2,5,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x6c,0x92,0x90,0x7e,0x12,0xec, +}; + +static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x20,0x50,0x20, +}; + +static const BitmapCharRec ch229 = {5,9,0,0,5,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50, +}; + +static const BitmapCharRec ch228 = {5,8,0,0,5,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch227 = {5,9,0,0,5,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch226 = {5,9,0,0,5,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch225 = {5,9,0,0,5,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch224 = {5,9,0,0,5,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xa0,0x90,0x90,0x90,0xa0,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch223 = {4,8,0,0,5,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0xf0,0x88,0x88,0xf0,0x80,0x80, +}; + +static const BitmapCharRec ch222 = {5,8,-1,0,7,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch221 = {7,11,0,0,7,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, +}; + +static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch219 = {6,11,-1,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch218 = {6,11,-1,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {6,11,-1,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x78,0xc4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, +}; + +static const BitmapCharRec ch216 = {6,10,-1,1,8,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch215 = {5,5,0,-1,6,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x48, +}; + +static const BitmapCharRec ch214 = {6,10,-1,0,8,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch213 = {6,11,-1,0,8,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch212 = {6,11,-1,0,8,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch211 = {6,11,-1,0,8,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch210 = {6,11,-1,0,8,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch209 = {6,11,-1,0,8,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x78,0x44,0x42,0x42,0xf2,0x42,0x44,0x78, +}; + +static const BitmapCharRec ch208 = {7,8,0,0,8,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch207 = {3,10,0,0,3,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch206 = {3,11,0,0,3,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch205 = {2,11,-1,0,3,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch204 = {2,11,0,0,3,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x50, +}; + +static const BitmapCharRec ch203 = {5,10,-1,0,7,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xf8,0x80,0x80,0xf8,0x80,0x80,0x80,0xf8,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch202 = {5,11,-1,0,7,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch201 = {5,11,-1,0,7,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch200 = {5,11,-1,0,7,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x30,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch199 = {6,10,-1,2,8,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x8f,0x80,0x88,0x0,0x78,0x0,0x48,0x0,0x2f,0x80,0x28,0x0,0x18,0x0,0x1f,0x80, +}; + +static const BitmapCharRec ch198 = {9,8,0,0,10,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,11,0,0,7,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28, +}; + +static const BitmapCharRec ch196 = {7,10,0,0,7,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch195 = {7,11,0,0,7,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch194 = {7,11,0,0,7,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch193 = {7,11,0,0,7,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {7,11,0,0,7,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x60,0x90,0x80,0x40,0x20,0x20,0x0,0x20, +}; + +static const BitmapCharRec ch191 = {4,8,-1,2,6,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0xc8,0x0,0x24,0x0,0x44,0x0,0xe2,0x0, +}; + +static const BitmapCharRec ch190 = {9,8,0,0,9,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x27,0x12,0x15,0xb,0x48,0x44,0xc4,0x42, +}; + +static const BitmapCharRec ch189 = {8,8,0,0,9,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0x48,0x0,0x44,0x0,0xc4,0x0,0x42,0x0, +}; + +static const BitmapCharRec ch188 = {9,8,0,0,9,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0xa0,0x50,0x28,0x50,0xa0, +}; + +static const BitmapCharRec ch187 = {5,5,0,0,6,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xe0,0x0,0xe0,0xa0,0xe0, +}; + +static const BitmapCharRec ch186 = {3,5,0,-3,4,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {2,4,0,-3,3,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x40, +}; + +static const BitmapCharRec ch184 = {2,2,0,2,3,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0, +}; + +static const BitmapCharRec ch183 = {2,1,0,-3,3,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, +}; + +static const BitmapCharRec ch182 = {6,10,0,2,6,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0xf0,0x90,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch181 = {4,8,0,2,5,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,0,-6,3,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0xc0,0x20,0x40,0xe0, +}; + +static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xe0,0x40,0xa0,0x60, +}; + +static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xe0, +}; + +static const BitmapCharRec ch175 = {3,1,0,-7,3,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, +}; + +static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xe0, +}; + +static const BitmapCharRec ch173 = {3,1,0,-3,4,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x8,0x8,0xf8, +}; + +static const BitmapCharRec ch172 = {5,3,-1,-2,7,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x28,0x50,0xa0,0x50,0x28, +}; + +static const BitmapCharRec ch171 = {5,5,0,0,6,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xe0,0x0,0xa0,0x20,0xe0, +}; + +static const BitmapCharRec ch170 = {3,5,0,-3,4,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, +}; + +static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0, +}; + +static const BitmapCharRec ch168 = {3,1,0,-7,3,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x70,0x88,0x18,0x70,0xc8,0x98,0x70,0xc0,0x88,0x70, +}; + +static const BitmapCharRec ch167 = {5,10,0,2,6,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,10,-1,2,3,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x20,0xf8,0x20,0xf8,0x50,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch165 = {5,8,0,0,6,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x90,0x60,0x90,0x90,0x60,0x90, +}; + +static const BitmapCharRec ch164 = {4,6,0,-1,5,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xb0,0x48,0x40,0x40,0xe0,0x40,0x48,0x30, +}; + +static const BitmapCharRec ch163 = {5,8,0,0,6,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x10, +}; + +static const BitmapCharRec ch162 = {5,8,0,1,6,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,8,-1,2,3,ch161data}; + +/* char: 0xa0 */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,3,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,3,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x98,0x64, +}; + +static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0x80,0x40,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch125 = {3,10,0,2,3,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,10,-1,2,3,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x20,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch123 = {3,10,0,2,3,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xf0,0x80,0x40,0x20,0x10,0xf0, +}; + +static const BitmapCharRec ch122 = {4,6,0,0,5,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90, +}; + +static const BitmapCharRec ch121 = {4,8,0,2,5,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x88,0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch120 = {5,6,0,0,6,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x28,0x28,0x54,0x54,0x92,0x92, +}; + +static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x20,0x50,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch118 = {5,6,0,0,6,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x70,0x90,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch117 = {4,6,0,0,5,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x60,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, +}; + +static const BitmapCharRec ch116 = {3,8,0,0,4,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x60,0x90,0x10,0x60,0x90,0x60, +}; + +static const BitmapCharRec ch115 = {4,6,0,0,5,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x80,0x80,0x80,0x80,0xc0,0xa0, +}; + +static const BitmapCharRec ch114 = {3,6,0,0,4,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x8,0x8,0x68,0x98,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch113 = {5,8,0,2,6,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch112 = {5,8,0,2,6,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x70,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch111 = {5,6,0,0,6,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x88,0x88,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch110 = {5,6,0,0,6,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x92,0x92,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch108 = {1,8,0,0,2,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x90,0x90,0xa0,0xc0,0xa0,0x90,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {4,8,0,0,5,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch106 = {1,9,0,1,2,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch105 = {1,8,0,0,2,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {5,8,0,0,6,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x70,0x8,0x68,0x98,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch103 = {5,8,0,2,6,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch102 = {4,8,0,0,4,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x60,0x90,0x80,0xf0,0x90,0x60, +}; + +static const BitmapCharRec ch101 = {4,6,0,0,5,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x68,0x98,0x88,0x88,0x98,0x68,0x8,0x8, +}; + +static const BitmapCharRec ch100 = {5,8,0,0,6,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x60,0x90,0x80,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch99 = {4,6,0,0,5,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {5,8,0,0,6,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x68,0x90,0x90,0x70,0x10,0xe0, +}; + +static const BitmapCharRec ch97 = {5,6,0,0,5,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x80,0x80,0x40, +}; + +static const BitmapCharRec ch96 = {2,3,0,-5,3,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xfc, +}; + +static const BitmapCharRec ch95 = {6,1,0,2,6,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x88,0x50,0x50,0x20,0x20, +}; + +static const BitmapCharRec ch94 = {5,5,0,-3,6,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch93 = {2,10,0,2,3,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x20,0x20,0x40,0x40,0x40,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {3,8,0,0,3,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, +}; + +static const BitmapCharRec ch91 = {2,10,-1,2,3,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xf8,0x80,0x40,0x20,0x20,0x10,0x8,0xf8, +}; + +static const BitmapCharRec ch90 = {5,8,-1,0,7,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82, +}; + +static const BitmapCharRec ch89 = {7,8,0,0,7,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch88 = {5,8,-1,0,7,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, +}; + +static const BitmapCharRec ch87 = {9,8,0,0,9,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,8,0,0,7,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch85 = {6,8,-1,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, +}; + +static const BitmapCharRec ch84 = {5,8,0,0,5,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x70,0x88,0x88,0x8,0x70,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch83 = {5,8,-1,0,7,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x88,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, +}; + +static const BitmapCharRec ch82 = {5,8,-1,0,7,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x2,0x7c,0x8c,0x94,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch81 = {7,9,-1,1,8,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0xf0,0x88,0x88,0xf0, +}; + +static const BitmapCharRec ch80 = {5,8,-1,0,7,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78, +}; + +static const BitmapCharRec ch79 = {6,8,-1,0,8,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4, +}; + +static const BitmapCharRec ch78 = {6,8,-1,0,8,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x92,0x92,0x92,0xaa,0xaa,0xc6,0xc6,0x82, +}; + +static const BitmapCharRec ch77 = {7,8,-1,0,9,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {4,8,-1,0,6,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x88,0x88,0x90,0x90,0xe0,0xa0,0x90,0x88, +}; + +static const BitmapCharRec ch75 = {5,8,-1,0,7,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x60,0x90,0x10,0x10,0x10,0x10,0x10,0x10, +}; + +static const BitmapCharRec ch74 = {4,8,0,0,5,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch73 = {1,8,-1,0,3,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch72 = {6,8,-1,0,8,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x74,0x8c,0x84,0x8c,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch71 = {6,8,-1,0,8,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch70 = {5,8,-1,0,6,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch69 = {5,8,-1,0,7,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xf0,0x88,0x84,0x84,0x84,0x84,0x88,0xf0, +}; + +static const BitmapCharRec ch68 = {6,8,-1,0,8,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch67 = {6,8,-1,0,8,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, +}; + +static const BitmapCharRec ch66 = {5,8,-1,0,7,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10, +}; + +static const BitmapCharRec ch65 = {7,8,0,0,7,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3e,0x0,0x40,0x0,0x9b,0x0,0xa4,0x80,0xa4,0x80,0xa2,0x40,0x92,0x40,0x4d,0x40, +0x20,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch64 = {10,10,0,2,11,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x40,0x0,0x40,0x40,0x20,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch63 = {4,8,-1,0,6,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {3,5,-1,-1,6,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xf0,0x0,0xf0, +}; + +static const BitmapCharRec ch61 = {4,3,0,-2,5,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x20,0x40,0x80,0x40,0x20, +}; + +static const BitmapCharRec ch60 = {3,5,-1,-1,6,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, +}; + +static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x80,0x0,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch57 = {5,8,0,0,6,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch56 = {5,8,0,0,6,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x10,0x10,0x8,0xf8, +}; + +static const BitmapCharRec ch55 = {5,8,0,0,6,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x70,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch54 = {5,8,0,0,6,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x70,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch53 = {5,8,0,0,6,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x10,0x10,0xf8,0x90,0x50,0x50,0x30,0x10, +}; + +static const BitmapCharRec ch52 = {5,8,0,0,6,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x70,0x88,0x8,0x8,0x30,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch51 = {5,8,0,0,6,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xf8,0x80,0x40,0x30,0x8,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch50 = {5,8,0,0,6,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch49 = {2,8,-1,0,6,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch48 = {5,8,0,0,6,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20, +}; + +static const BitmapCharRec ch47 = {3,8,0,0,3,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x80, +}; + +static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xf8, +}; + +static const BitmapCharRec ch45 = {5,1,-1,-3,7,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40, +}; + +static const BitmapCharRec ch44 = {2,3,0,2,3,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,0,-1,6,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0xa0,0x40,0xa0, +}; + +static const BitmapCharRec ch42 = {3,3,0,-5,4,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,10,-1,2,4,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,10,0,2,4,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0x40, +}; + +static const BitmapCharRec ch39 = {2,3,-1,-5,3,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x64,0x98,0x98,0xa4,0x60,0x50,0x50,0x20, +}; + +static const BitmapCharRec ch38 = {6,8,-1,0,8,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x26,0x29,0x16,0x10,0x8,0x68,0x94,0x64, +}; + +static const BitmapCharRec ch37 = {8,8,0,0,9,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0x70,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, +}; + +static const BitmapCharRec ch36 = {5,9,0,1,6,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x50,0x50,0xf8,0x28,0x7c,0x28,0x28, +}; + +static const BitmapCharRec ch35 = {6,7,0,0,6,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0xa0,0xa0, +}; + +static const BitmapCharRec ch34 = {3,2,-1,-6,4,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,8,-1,0,3,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {0,0,0,0,3,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,3,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmapHelvetica10 = { +"-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_hel12.c b/xc/extras/Mesa/src-glut/glut_hel12.c new file mode 100644 index 000000000..68aed8a2b --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_hel12.c @@ -0,0 +1,1788 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmapHelvetica12 XXX +#include "glutbitmap.h" +#undef glutBitmapHelvetica12 + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0xc0,0x20,0x20,0x20,0x30,0x50,0x50,0x48,0x88,0x88,0x0,0x50, +}; + +static const BitmapCharRec ch255 = {5,12,-1,3,7,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {5,12,-1,3,7,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {5,13,-1,3,7,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50, +}; + +static const BitmapCharRec ch252 = {5,9,-1,0,7,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch251 = {5,10,-1,0,7,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch250 = {5,10,-1,0,7,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch249 = {5,10,-1,0,7,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0xb8,0x44,0x64,0x54,0x4c,0x44,0x3a, +}; + +static const BitmapCharRec ch248 = {7,7,0,0,7,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x0,0xf8,0x0,0x20, +}; + +static const BitmapCharRec ch247 = {5,5,-1,-1,7,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch246 = {5,9,-1,0,7,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch245 = {5,10,-1,0,7,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch244 = {5,10,-1,0,7,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch243 = {5,10,-1,0,7,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch242 = {5,10,-1,0,7,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch241 = {5,10,-1,0,7,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x70,0x88,0x88,0x88,0x88,0x78,0x8,0x50,0x30,0x68, +}; + +static const BitmapCharRec ch240 = {5,10,-1,0,7,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch239 = {3,9,0,0,3,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch238 = {3,10,0,0,3,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch237 = {2,10,-1,0,3,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch236 = {2,10,0,0,3,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch235 = {5,9,-1,0,7,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch234 = {5,10,-1,0,7,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch233 = {5,10,-1,0,7,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch232 = {5,10,-1,0,7,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x60,0x10,0x20,0x70,0x88,0x80,0x80,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch231 = {5,10,-1,3,7,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x77,0x0,0x88,0x80,0x88,0x0,0x7f,0x80,0x8,0x80,0x88,0x80,0x77,0x0, +}; + +static const BitmapCharRec ch230 = {9,7,-1,0,11,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x30,0x48,0x30, +}; + +static const BitmapCharRec ch229 = {6,10,-1,0,7,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50, +}; + +static const BitmapCharRec ch228 = {6,9,-1,0,7,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch227 = {6,10,-1,0,7,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch226 = {6,10,-1,0,7,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch225 = {6,10,-1,0,7,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch224 = {6,10,-1,0,7,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xb0,0x88,0x88,0x88,0xb0,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch223 = {5,9,-1,0,7,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80,0x80, +}; + +static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch221 = {7,12,-1,0,9,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, +}; + +static const BitmapCharRec ch220 = {6,11,-1,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch219 = {6,12,-1,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch218 = {6,12,-1,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {6,12,-1,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x0,0x5e,0x0,0x21,0x0,0x50,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80, +0x21,0x0,0x1e,0x80,0x0,0x40, +}; + +static const BitmapCharRec ch216 = {10,11,0,1,10,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch215 = {5,5,-1,-1,7,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x24, +}; + +static const BitmapCharRec ch214 = {8,11,-1,0,10,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch213 = {8,12,-1,0,10,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x14,0x8, +}; + +static const BitmapCharRec ch212 = {8,12,-1,0,10,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x4, +}; + +static const BitmapCharRec ch211 = {8,12,-1,0,10,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x10, +}; + +static const BitmapCharRec ch210 = {8,12,-1,0,10,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch209 = {7,12,-1,0,9,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x7c,0x42,0x41,0x41,0xf1,0x41,0x41,0x42,0x7c, +}; + +static const BitmapCharRec ch208 = {8,9,0,0,9,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, +}; + +static const BitmapCharRec ch207 = {3,11,0,0,3,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch206 = {3,12,0,0,3,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, +}; + +static const BitmapCharRec ch205 = {2,12,-1,0,3,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch204 = {2,12,0,0,3,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28, +}; + +static const BitmapCharRec ch203 = {6,11,-1,0,8,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch202 = {6,12,-1,0,8,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch201 = {6,12,-1,0,8,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch200 = {6,12,-1,0,8,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x30,0x8,0x8,0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, +}; + +static const BitmapCharRec ch199 = {7,12,-1,3,9,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0x8f,0x80,0x88,0x0,0x88,0x0,0x78,0x0,0x4f,0x80,0x48,0x0,0x28,0x0,0x28,0x0, +0x1f,0x80, +}; + +static const BitmapCharRec ch198 = {9,9,-1,0,11,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,12,-1,0,9,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28, +}; + +static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch195 = {7,12,-1,0,9,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch194 = {7,12,-1,0,9,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch193 = {7,12,-1,0,9,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {7,12,-1,0,9,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x70,0x88,0x88,0x40,0x40,0x20,0x20,0x0,0x20, +}; + +static const BitmapCharRec ch191 = {5,9,-1,3,7,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x21,0x0,0x17,0x80,0x15,0x0,0xb,0x0,0xc9,0x0,0x24,0x0,0x44,0x0,0x22,0x0, +0xe1,0x0, +}; + +static const BitmapCharRec ch190 = {9,9,0,0,10,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x47,0x80,0x22,0x0,0x11,0x0,0x14,0x80,0x4b,0x0,0x48,0x0,0x44,0x0,0xc2,0x0, +0x41,0x0, +}; + +static const BitmapCharRec ch189 = {9,9,0,0,10,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x41,0x0,0x27,0x80,0x15,0x0,0x13,0x0,0x49,0x0,0x44,0x0,0x44,0x0,0xc2,0x0, +0x41,0x0, +}; + +static const BitmapCharRec ch188 = {9,9,0,0,10,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0xa0,0x50,0x28,0x50,0xa0, +}; + +static const BitmapCharRec ch187 = {5,5,-1,-1,7,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xe0,0x0,0xe0,0xa0,0xe0, +}; + +static const BitmapCharRec ch186 = {3,5,-1,-4,5,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {2,5,-1,-3,4,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x20,0x20,0x40, +}; + +static const BitmapCharRec ch184 = {3,4,0,3,3,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0x80, +}; + +static const BitmapCharRec ch183 = {1,1,-1,-3,3,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x68,0x3c, +}; + +static const BitmapCharRec ch182 = {6,12,0,3,7,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0x80,0xe8,0x98,0x88,0x88,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch181 = {5,10,-1,3,7,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,0,-8,2,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0xc0,0x20,0x40,0x20,0xe0, +}; + +static const BitmapCharRec ch179 = {3,5,0,-3,4,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf0,0x40,0x20,0x90,0x60, +}; + +static const BitmapCharRec ch178 = {4,5,0,-3,4,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,-1,0,7,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,0,-4,5,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xf0, +}; + +static const BitmapCharRec ch175 = {4,1,0,-8,4,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x3e,0x0,0x41,0x0,0x94,0x80,0x94,0x80,0x98,0x80,0x94,0x80,0x9c,0x80,0x41,0x0, +0x3e,0x0, +}; + +static const BitmapCharRec ch174 = {9,9,-1,0,11,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xf0, +}; + +static const BitmapCharRec ch173 = {4,1,0,-3,5,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x4,0x4,0x4,0xfc, +}; + +static const BitmapCharRec ch172 = {6,4,-1,-2,8,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x28,0x50,0xa0,0x50,0x28, +}; + +static const BitmapCharRec ch171 = {5,5,-1,-1,7,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xe0,0x0,0xa0,0x20,0xe0, +}; + +static const BitmapCharRec ch170 = {3,5,-1,-4,5,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x3e,0x0,0x41,0x0,0x9c,0x80,0xa2,0x80,0xa0,0x80,0xa2,0x80,0x9c,0x80,0x41,0x0, +0x3e,0x0, +}; + +static const BitmapCharRec ch169 = {9,9,-1,0,11,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0, +}; + +static const BitmapCharRec ch168 = {3,1,0,-8,3,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x70,0x88,0x8,0x30,0x48,0x88,0x88,0x90,0x60,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch167 = {5,12,0,3,6,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,11,-1,2,3,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x20,0x20,0xf8,0x20,0xf8,0x20,0x50,0x88,0x88, +}; + +static const BitmapCharRec ch165 = {5,9,-1,0,7,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x84,0x78,0x48,0x48,0x78,0x84, +}; + +static const BitmapCharRec ch164 = {6,6,0,-1,7,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xb0,0x48,0x20,0x20,0xf0,0x40,0x40,0x48,0x30, +}; + +static const BitmapCharRec ch163 = {5,9,-1,0,7,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x70,0xc8,0xa0,0xa0,0xa0,0xa8,0x70,0x10, +}; + +static const BitmapCharRec ch162 = {5,9,-1,1,7,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,10,-1,3,3,ch161data}; + +/* char: 0xa0 */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,4,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,4,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x98,0x64, +}; + +static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xc0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xc0, +}; + +static const BitmapCharRec ch125 = {4,12,0,3,4,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,12,-1,3,3,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x30,0x40,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, +}; + +static const BitmapCharRec ch123 = {4,12,0,3,4,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xf0,0x80,0x40,0x40,0x20,0x10,0xf0, +}; + +static const BitmapCharRec ch122 = {4,7,-1,0,6,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch121 = {5,10,-1,3,7,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0x84,0x84,0x48,0x30,0x30,0x48,0x84, +}; + +static const BitmapCharRec ch120 = {6,7,0,0,6,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, +}; + +static const BitmapCharRec ch119 = {9,7,0,0,9,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x20,0x50,0x50,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch118 = {5,7,-1,0,7,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x68,0x98,0x88,0x88,0x88,0x88,0x88, +}; + +static const BitmapCharRec ch117 = {5,7,-1,0,7,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x60,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, +}; + +static const BitmapCharRec ch116 = {3,9,0,0,3,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x60,0x90,0x10,0x60,0x80,0x90,0x60, +}; + +static const BitmapCharRec ch115 = {4,7,-1,0,6,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0x80,0x80,0x80,0x80,0x80,0xc0,0xa0, +}; + +static const BitmapCharRec ch114 = {3,7,-1,0,4,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x8,0x8,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch113 = {5,10,-1,3,7,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch112 = {5,10,-1,3,7,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch111 = {5,7,-1,0,7,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0x88,0x88,0x88,0x88,0x88,0xc8,0xb0, +}; + +static const BitmapCharRec ch110 = {5,7,-1,0,7,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0x92,0x92,0x92,0x92,0x92,0xda,0xa4, +}; + +static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch108 = {1,9,-1,0,3,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x88,0x90,0xa0,0xc0,0xc0,0xa0,0x90,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {5,9,-1,0,6,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40, +}; + +static const BitmapCharRec ch106 = {2,12,0,3,3,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch105 = {1,9,-1,0,3,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {5,9,-1,0,7,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, +}; + +static const BitmapCharRec ch103 = {5,10,-1,3,7,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x40,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch102 = {4,9,0,0,3,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x70,0x88,0x80,0xf8,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch101 = {5,7,-1,0,7,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x68,0x98,0x88,0x88,0x88,0x98,0x68,0x8,0x8, +}; + +static const BitmapCharRec ch100 = {5,9,-1,0,7,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x70,0x88,0x80,0x80,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch99 = {5,7,-1,0,7,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {5,9,-1,0,7,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x74,0x88,0x88,0x78,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch97 = {6,7,-1,0,7,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0xc0,0x80,0x40, +}; + +static const BitmapCharRec ch96 = {2,3,0,-6,3,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xfe, +}; + +static const BitmapCharRec ch95 = {7,1,0,2,7,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x88,0x50,0x20, +}; + +static const BitmapCharRec ch94 = {5,3,0,-5,6,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch93 = {2,12,0,3,3,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {4,9,0,0,4,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, +}; + +static const BitmapCharRec ch91 = {2,12,-1,3,3,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xfe,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, +}; + +static const BitmapCharRec ch90 = {7,9,-1,0,9,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch89 = {7,9,-1,0,9,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0x82,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x82, +}; + +static const BitmapCharRec ch88 = {7,9,-1,0,9,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0x49,0x0,0x88,0x80,0x88,0x80, +0x88,0x80, +}; + +static const BitmapCharRec ch87 = {9,9,-1,0,11,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, +}; + +static const BitmapCharRec ch86 = {7,9,-1,0,9,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +}; + +static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, +}; + +static const BitmapCharRec ch84 = {7,9,0,0,7,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x78,0x84,0x84,0x4,0x18,0x60,0x80,0x84,0x78, +}; + +static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0x84,0x84,0x84,0x88,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x3d,0x42,0x85,0x89,0x81,0x81,0x81,0x42,0x3c, +}; + +static const BitmapCharRec ch81 = {8,9,-1,0,10,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c, +}; + +static const BitmapCharRec ch79 = {8,9,-1,0,10,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82, +}; + +static const BitmapCharRec ch78 = {7,9,-1,0,9,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0x88,0x80,0x88,0x80,0x94,0x80,0x94,0x80,0xa2,0x80,0xa2,0x80,0xc1,0x80,0xc1,0x80, +0x80,0x80, +}; + +static const BitmapCharRec ch77 = {9,9,-1,0,11,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch76 = {5,9,-1,0,7,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0x82,0x84,0x88,0x90,0xe0,0xa0,0x90,0x88,0x84, +}; + +static const BitmapCharRec ch75 = {7,9,-1,0,8,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x8,0x8, +}; + +static const BitmapCharRec ch74 = {5,9,-1,0,7,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch73 = {1,9,-1,0,3,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, +}; + +static const BitmapCharRec ch72 = {7,9,-1,0,9,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x3a,0x46,0x82,0x82,0x8e,0x80,0x80,0x42,0x3c, +}; + +static const BitmapCharRec ch71 = {7,9,-1,0,9,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc, +}; + +static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xf8,0x84,0x82,0x82,0x82,0x82,0x82,0x84,0xf8, +}; + +static const BitmapCharRec ch68 = {7,9,-1,0,9,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, +}; + +static const BitmapCharRec ch67 = {7,9,-1,0,9,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xf8,0x84,0x84,0x84,0xf8,0x84,0x84,0x84,0xf8, +}; + +static const BitmapCharRec ch66 = {6,9,-1,0,8,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x28,0x10, +}; + +static const BitmapCharRec ch65 = {7,9,-1,0,9,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3e,0x0,0x40,0x0,0x9b,0x0,0xa6,0x80,0xa2,0x40,0xa2,0x40,0x92,0x40,0x4d,0x40, +0x60,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch64 = {10,10,-1,1,12,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x20,0x0,0x20,0x20,0x10,0x10,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch63 = {5,9,-1,0,7,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0xc0,0x30,0xc,0x30,0xc0, +}; + +static const BitmapCharRec ch62 = {6,5,-1,-1,7,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xf8,0x0,0xf8, +}; + +static const BitmapCharRec ch61 = {5,3,-1,-2,7,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0xc,0x30,0xc0,0x30,0xc, +}; + +static const BitmapCharRec ch60 = {6,5,0,-1,7,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, +}; + +static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x80,0x0,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x70,0x88,0x8,0x8,0x78,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch57 = {5,9,-1,0,7,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x70,0x88,0x88,0x88,0x88,0x70,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch56 = {5,9,-1,0,7,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x8,0xf8, +}; + +static const BitmapCharRec ch55 = {5,9,-1,0,7,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x70,0x88,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, +}; + +static const BitmapCharRec ch54 = {5,9,-1,0,7,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x70,0x88,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, +}; + +static const BitmapCharRec ch53 = {5,9,-1,0,7,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x8,0x8,0xfc,0x88,0x48,0x28,0x28,0x18,0x8, +}; + +static const BitmapCharRec ch52 = {6,9,0,0,7,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x70,0x88,0x88,0x8,0x8,0x30,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch51 = {5,9,-1,0,7,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xf8,0x80,0x80,0x40,0x20,0x10,0x8,0x88,0x70, +}; + +static const BitmapCharRec ch50 = {5,9,-1,0,7,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x20, +}; + +static const BitmapCharRec ch49 = {3,9,-1,0,7,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70, +}; + +static const BitmapCharRec ch48 = {5,9,-1,0,7,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10, +}; + +static const BitmapCharRec ch47 = {4,9,0,0,4,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x80, +}; + +static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xf8, +}; + +static const BitmapCharRec ch45 = {5,1,-1,-3,8,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40, +}; + +static const BitmapCharRec ch44 = {2,3,-1,2,4,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,-1,-1,7,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0xa0,0x40,0xa0, +}; + +static const BitmapCharRec ch42 = {3,3,-1,-6,5,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,12,0,3,4,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,12,-1,3,4,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0xc0, +}; + +static const BitmapCharRec ch39 = {2,3,-1,-6,3,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x72,0x8c,0x84,0x8a,0x50,0x30,0x48,0x48,0x30, +}; + +static const BitmapCharRec ch38 = {7,9,-1,0,9,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x23,0x0,0x14,0x80,0x14,0x80,0x13,0x0,0x8,0x0,0x68,0x0,0x94,0x0,0x94,0x0, +0x62,0x0, +}; + +static const BitmapCharRec ch37 = {9,9,-1,0,11,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0x70,0xa8,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, +}; + +static const BitmapCharRec ch36 = {5,10,-1,1,7,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x50,0x50,0x50,0xfc,0x28,0xfc,0x28,0x28, +}; + +static const BitmapCharRec ch35 = {6,8,0,0,7,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0xa0,0xa0,0xa0, +}; + +static const BitmapCharRec ch34 = {3,3,-1,-6,5,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,9,-1,0,3,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,4,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,4,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmapHelvetica12 = { +"-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_hel18.c b/xc/extras/Mesa/src-glut/glut_hel18.c new file mode 100644 index 000000000..f0800843e --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_hel18.c @@ -0,0 +1,1897 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmapHelvetica18 XXX +#include "glutbitmap.h" +#undef glutBitmapHelvetica18 + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x66, +0x66, +}; + +static const BitmapCharRec ch255 = {8,17,-1,4,10,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch254 = {9,18,-1,4,11,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x18, +0xc,0x6, +}; + +static const BitmapCharRec ch253 = {8,18,-1,4,10,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x66, +}; + +static const BitmapCharRec ch252 = {8,13,-1,0,10,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch251 = {8,14,-1,0,10,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x18,0xc,0x6, +}; + +static const BitmapCharRec ch250 = {8,14,-1,0,10,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0xc,0x18,0x30, +}; + +static const BitmapCharRec ch249 = {8,14,-1,0,10,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0xce,0x0,0x7f,0x80,0x31,0x80,0x78,0xc0,0x6c,0xc0,0x66,0xc0,0x63,0xc0,0x31,0x80, +0x3f,0xc0,0xe,0x60, +}; + +static const BitmapCharRec ch248 = {11,10,0,0,11,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x18,0x18,0x0,0xff,0xff,0x0,0x18,0x18, +}; + +static const BitmapCharRec ch247 = {8,8,-1,-1,10,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x36,0x0,0x36,0x0, +}; + +static const BitmapCharRec ch246 = {9,13,-1,0,11,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x26,0x0,0x2d,0x0,0x19,0x0, +}; + +static const BitmapCharRec ch245 = {9,14,-1,0,11,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x33,0x0,0x1e,0x0,0xc,0x0, +}; + +static const BitmapCharRec ch244 = {9,14,-1,0,11,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0x18,0x0,0xc,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch243 = {9,14,-1,0,11,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x0,0x0,0xc,0x0,0x18,0x0,0x30,0x0, +}; + +static const BitmapCharRec ch242 = {9,14,-1,0,11,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0x0,0x4c,0x5a,0x32, +}; + +static const BitmapCharRec ch241 = {8,14,-1,0,10,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0,0x4c,0x0,0x38,0x0,0x36,0x0,0x60,0x0, +}; + +static const BitmapCharRec ch240 = {9,14,-1,0,11,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xd8,0xd8, +}; + +static const BitmapCharRec ch239 = {5,13,0,0,4,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc,0x78,0x30, +}; + +static const BitmapCharRec ch238 = {6,14,1,0,4,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xc0,0x60,0x30, +}; + +static const BitmapCharRec ch237 = {4,14,0,0,4,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0x30,0x60,0xc0, +}; + +static const BitmapCharRec ch236 = {4,14,0,0,4,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x36,0x36, +}; + +static const BitmapCharRec ch235 = {8,13,-1,0,10,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch234 = {8,14,-1,0,10,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0xc,0x6, +}; + +static const BitmapCharRec ch233 = {8,14,-1,0,10,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0x30,0x60, +}; + +static const BitmapCharRec ch232 = {8,14,-1,0,10,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x78,0x6c,0xc,0x38,0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, +}; + +static const BitmapCharRec ch231 = {8,14,-1,4,10,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x75,0xe0,0xef,0xf8,0xc7,0x18,0xc6,0x0,0xe6,0x0,0x7f,0xf8,0xe,0x18,0xc6,0x18, +0xef,0xf0,0x7d,0xe0, +}; + +static const BitmapCharRec ch230 = {13,10,-1,0,15,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x38,0x6c,0x6c,0x38, +}; + +static const BitmapCharRec ch229 = {7,14,-1,0,9,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x6c,0x6c, +}; + +static const BitmapCharRec ch228 = {7,13,-1,0,9,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x4c,0x5a,0x32, +}; + +static const BitmapCharRec ch227 = {7,14,-1,0,9,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch226 = {7,14,-1,0,9,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x30,0x18,0xc, +}; + +static const BitmapCharRec ch225 = {7,14,-1,0,9,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x18,0x30,0x60, +}; + +static const BitmapCharRec ch224 = {7,14,-1,0,9,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xdc,0xde,0xc6,0xc6,0xc6,0xc6,0xdc,0xdc,0xc6,0xc6,0xc6,0xc6,0x7c,0x38, +}; + +static const BitmapCharRec ch223 = {7,14,-1,0,9,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc1,0xc0,0xff,0x80,0xff,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch222 = {10,14,-1,0,12,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, +0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30,0x0,0x0,0x6,0x0, +0x3,0x0,0x1,0x80, +}; + +static const BitmapCharRec ch221 = {12,18,-1,0,14,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, +0x19,0x80, +}; + +static const BitmapCharRec ch220 = {11,17,-1,0,13,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, +0xf,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch219 = {11,18,-1,0,13,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0xc,0x0, +0x6,0x0,0x3,0x0, +}; + +static const BitmapCharRec ch218 = {11,18,-1,0,13,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x6,0x0, +0xc,0x0,0x18,0x0, +}; + +static const BitmapCharRec ch217 = {11,18,-1,0,13,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0xc7,0xc0,0xff,0xf0,0x78,0x38,0x38,0x18,0x6c,0x1c,0x6e,0xc,0x67,0xc,0x63,0x8c, +0x61,0xcc,0x70,0xdc,0x30,0x78,0x38,0x38,0x1f,0xfc,0x7,0xcc, +}; + +static const BitmapCharRec ch216 = {14,14,0,0,15,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0,0x61,0x80, +0xc0,0xc0, +}; + +static const BitmapCharRec ch215 = {10,9,0,0,10,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xd,0x80, +0xd,0x80, +}; + +static const BitmapCharRec ch214 = {13,17,-1,0,15,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x9,0x80, +0xb,0x40,0x6,0x40, +}; + +static const BitmapCharRec ch213 = {13,18,-1,0,15,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xc,0xc0, +0x7,0x80,0x3,0x0, +}; + +static const BitmapCharRec ch212 = {13,18,-1,0,15,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, +0x1,0x80,0x0,0xc0, +}; + +static const BitmapCharRec ch211 = {13,18,-1,0,15,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, +0x6,0x0,0xc,0x0, +}; + +static const BitmapCharRec ch210 = {13,18,-1,0,15,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, +0xcc,0x60,0xd8,0x60,0xd8,0x60,0xf0,0x60,0xe0,0x60,0xe0,0x60,0x0,0x0,0x13,0x0, +0x16,0x80,0xc,0x80, +}; + +static const BitmapCharRec ch209 = {11,18,-1,0,13,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x7f,0x80,0x7f,0xc0,0x60,0xe0,0x60,0x60,0x60,0x30,0x60,0x30,0xfc,0x30,0xfc,0x30, +0x60,0x30,0x60,0x30,0x60,0x60,0x60,0xe0,0x7f,0xc0,0x7f,0x80, +}; + +static const BitmapCharRec ch208 = {12,14,0,0,13,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, +0xcc, +}; + +static const BitmapCharRec ch207 = {6,17,0,0,6,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, +0x78,0x30, +}; + +static const BitmapCharRec ch206 = {6,18,0,0,6,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0xc0, +0x60,0x30, +}; + +static const BitmapCharRec ch205 = {4,18,-2,0,6,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x30, +0x60,0xc0, +}; + +static const BitmapCharRec ch204 = {4,18,0,0,6,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, +0x33,0x0, +}; + +static const BitmapCharRec ch203 = {9,17,-1,0,11,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, +0x1e,0x0,0xc,0x0, +}; + +static const BitmapCharRec ch202 = {9,18,-1,0,11,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, +0x6,0x0,0x3,0x0, +}; + +static const BitmapCharRec ch201 = {9,18,-1,0,11,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, +0x18,0x0,0x30,0x0, +}; + +static const BitmapCharRec ch200 = {9,18,-1,0,11,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x1e,0x0,0x1b,0x0,0x3,0x0,0xe,0x0,0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30, +0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70, +0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch199 = {12,18,-1,4,14,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0xc1,0xff,0xc1,0xff,0x61,0x80,0x61,0x80,0x7f,0x80,0x3f,0x80,0x31,0xfe,0x31,0xfe, +0x19,0x80,0x19,0x80,0xd,0x80,0xd,0x80,0x7,0xff,0x7,0xff, +}; + +static const BitmapCharRec ch198 = {16,14,-1,0,18,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, +0x19,0x80,0xf,0x0, +}; + +static const BitmapCharRec ch197 = {12,18,0,0,12,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, +0x19,0x80, +}; + +static const BitmapCharRec ch196 = {12,17,0,0,12,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x13,0x0, +0x16,0x80,0xc,0x80, +}; + +static const BitmapCharRec ch195 = {12,18,0,0,12,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, +0xf,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch194 = {12,18,0,0,12,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, +0x3,0x0,0x1,0x80, +}; + +static const BitmapCharRec ch193 = {12,18,0,0,12,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, +0xc,0x0,0x18,0x0, +}; + +static const BitmapCharRec ch192 = {12,18,0,0,12,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x7c,0xfe,0xc6,0xc6,0xe0,0x70,0x38,0x18,0x18,0x18,0x0,0x0,0x18,0x18, +}; + +static const BitmapCharRec ch191 = {7,14,-1,4,10,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x18,0x18,0x18,0x18,0xc,0xfc,0x6,0xd8,0x6,0x78,0x73,0x38,0xf9,0x18,0x99,0x88, +0x30,0xc0,0x30,0xc0,0x98,0x60,0xf8,0x30,0x70,0x30, +}; + +static const BitmapCharRec ch190 = {14,13,0,0,15,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x30,0xf8,0x30,0xf8,0x18,0x60,0xc,0x30,0xc,0x18,0x66,0x98,0x62,0xf8,0x63,0x70, +0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, +}; + +static const BitmapCharRec ch189 = {13,13,-1,0,15,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x30,0x30,0x30,0x30,0x19,0xf8,0xd,0xb0,0xc,0xf0,0x66,0x70,0x62,0x30,0x63,0x10, +0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, +}; + +static const BitmapCharRec ch188 = {13,13,-1,0,15,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x90,0xd8,0x6c,0x36,0x36,0x6c,0xd8,0x90, +}; + +static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xf8,0x0,0x70,0xd8,0x88,0x88,0xd8,0x70, +}; + +static const BitmapCharRec ch186 = {5,8,-1,-6,7,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x60, +}; + +static const BitmapCharRec ch185 = {3,8,-1,-5,6,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xf0,0xd8,0x18,0x70,0x60, +}; + +static const BitmapCharRec ch184 = {5,5,0,4,5,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch183 = {2,2,-1,-4,4,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x32,0x72,0xf2,0xf2,0xf2,0xf2, +0x72,0x3f, +}; + +static const BitmapCharRec ch182 = {8,18,-1,4,10,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0xc0,0xc0,0xc0,0xc0,0xdb,0xff,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch181 = {8,14,-1,4,10,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0xc0,0x60,0x30, +}; + +static const BitmapCharRec ch180 = {4,3,0,-11,4,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x70,0xf8,0x98,0x30,0x30,0x98,0xf8,0x70, +}; + +static const BitmapCharRec ch179 = {5,8,0,-5,6,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xf8,0xf8,0x60,0x30,0x18,0x98,0xf8,0x70, +}; + +static const BitmapCharRec ch178 = {5,8,0,-5,6,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xff,0xff,0x0,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18, +}; + +static const BitmapCharRec ch177 = {8,11,-1,0,10,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x70,0xd8,0x88,0xd8,0x70, +}; + +static const BitmapCharRec ch176 = {5,5,-1,-8,7,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xf8, +}; + +static const BitmapCharRec ch175 = {5,1,0,-12,5,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0xf,0x80,0x30,0x60,0x40,0x10,0x48,0x50,0x88,0x88,0x89,0x8,0x8f,0x88,0x88,0x48, +0x88,0x48,0x4f,0x90,0x40,0x10,0x30,0x60,0xf,0x80, +}; + +static const BitmapCharRec ch174 = {13,13,-1,0,14,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xf8,0xf8, +}; + +static const BitmapCharRec ch173 = {5,2,-1,-4,7,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x1,0x80,0x1,0x80,0x1,0x80,0xff,0x80,0xff,0x80, +}; + +static const BitmapCharRec ch172 = {9,5,-1,-3,11,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x12,0x36,0x6c,0xd8,0xd8,0x6c,0x36,0x12, +}; + +static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xf8,0x0,0x68,0xd8,0x48,0x38,0xc8,0x70, +}; + +static const BitmapCharRec ch170 = {5,8,-1,-6,7,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0xf,0x80,0x30,0x60,0x40,0x10,0x47,0x10,0x88,0x88,0x90,0x8,0x90,0x8,0x90,0x8, +0x88,0x88,0x47,0x10,0x40,0x10,0x30,0x60,0xf,0x80, +}; + +static const BitmapCharRec ch169 = {13,13,-1,0,15,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xd8,0xd8, +}; + +static const BitmapCharRec ch168 = {5,2,0,-11,6,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x3c,0x7e,0xc3,0xc3,0x7,0xe,0x3e,0x73,0xe3,0xc3,0xc7,0x6e,0x7c,0xf0,0xc3,0xc3, +0x7e,0x3c, +}; + +static const BitmapCharRec ch167 = {8,18,-1,4,10,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch166 = {2,17,-1,3,4,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x3c,0x66,0x66,0x66,0xc3,0xc3, +}; + +static const BitmapCharRec ch165 = {8,13,-1,0,10,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0xc3,0xff,0x66,0x66,0x66,0xff,0xc3, +}; + +static const BitmapCharRec ch164 = {8,7,-1,-3,10,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xdf,0x0,0xff,0x80,0x60,0x80,0x30,0x0,0x18,0x0,0x18,0x0,0x7e,0x0,0x30,0x0, +0x60,0x0,0x61,0x80,0x61,0x80,0x3f,0x0,0x1e,0x0, +}; + +static const BitmapCharRec ch163 = {9,13,0,0,10,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x10,0x10,0x3e,0x7f,0x6b,0xc8,0xc8,0xc8,0xc8,0x6b,0x7f,0x3e,0x4,0x4, +}; + +static const BitmapCharRec ch162 = {8,14,-1,2,10,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x40,0x40,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch161 = {2,14,-2,4,6,ch161data}; + +/* char: 0xa0 */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,5,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,5,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0xcc,0x7e,0x33, +}; + +static const BitmapCharRec ch126 = {8,3,-1,-4,10,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xc0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0xc,0x18,0x30,0x30,0x30,0x30,0x30, +0x60,0xc0, +}; + +static const BitmapCharRec ch125 = {6,18,0,4,6,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0, +}; + +static const BitmapCharRec ch124 = {2,18,-1,4,4,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0xc,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xc0,0x60,0x30,0x30,0x30,0x30,0x30, +0x18,0xc, +}; + +static const BitmapCharRec ch123 = {6,18,0,4,6,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xfe,0xfe,0xc0,0x60,0x30,0x18,0xc,0x6,0xfe,0xfe, +}; + +static const BitmapCharRec ch122 = {7,10,-1,0,9,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch121 = {8,14,-1,4,10,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0xc3,0xe7,0x66,0x3c,0x18,0x18,0x3c,0x66,0xe7,0xc3, +}; + +static const BitmapCharRec ch120 = {8,10,-1,0,10,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x19,0x80,0x19,0x80,0x39,0xc0,0x29,0x40,0x69,0x60,0x66,0x60,0x66,0x60,0xc6,0x30, +0xc6,0x30,0xc6,0x30, +}; + +static const BitmapCharRec ch119 = {12,10,-1,0,14,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch118 = {8,10,-1,0,10,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, +}; + +static const BitmapCharRec ch117 = {8,10,-1,0,10,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x18,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x30, +}; + +static const BitmapCharRec ch116 = {6,13,0,0,6,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0x78,0xfc,0xc6,0x6,0x3e,0xfc,0xc0,0xc6,0x7e,0x3c, +}; + +static const BitmapCharRec ch115 = {7,10,-1,0,9,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xd8,0xd8, +}; + +static const BitmapCharRec ch114 = {5,10,-1,0,6,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80,0x7f,0x80,0x3d,0x80, +}; + +static const BitmapCharRec ch113 = {9,14,-1,4,11,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0, +}; + +static const BitmapCharRec ch112 = {9,14,-1,4,11,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, +0x7f,0x0,0x3e,0x0, +}; + +static const BitmapCharRec ch111 = {9,10,-1,0,11,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce, +}; + +static const BitmapCharRec ch110 = {8,10,-1,0,10,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xe7,0x30, +0xde,0xf0,0xcc,0x60, +}; + +static const BitmapCharRec ch109 = {12,10,-1,0,14,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch108 = {2,14,-1,0,4,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0xc7,0xc6,0xce,0xcc,0xd8,0xf8,0xf0,0xd8,0xcc,0xc6,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch107 = {8,14,-1,0,9,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0xe0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x0, +0x30,0x30, +}; + +static const BitmapCharRec ch106 = {4,18,1,4,4,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch105 = {2,14,-1,0,4,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch104 = {8,14,-1,0,10,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x1c,0x0,0x7f,0x0,0x63,0x0,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x7f,0x80,0x3d,0x80, +}; + +static const BitmapCharRec ch103 = {9,14,-1,4,11,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x3c,0x1c, +}; + +static const BitmapCharRec ch102 = {6,14,0,0,6,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c, +}; + +static const BitmapCharRec ch101 = {8,10,-1,0,10,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80, +0x7f,0x80,0x3d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, +}; + +static const BitmapCharRec ch100 = {9,14,-1,0,11,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, +}; + +static const BitmapCharRec ch99 = {8,10,-1,0,10,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0, +0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch98 = {9,14,-1,0,11,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c, +}; + +static const BitmapCharRec ch97 = {7,10,-1,0,9,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0xc0,0xc0,0x80,0x80,0x40, +}; + +static const BitmapCharRec ch96 = {2,5,-1,-9,4,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xff,0xc0,0xff,0xc0, +}; + +static const BitmapCharRec ch95 = {10,2,0,4,10,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x82,0xc6,0x6c,0x38,0x10, +}; + +static const BitmapCharRec ch94 = {7,5,-1,-8,9,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xf0,0xf0, +}; + +static const BitmapCharRec ch93 = {4,18,0,4,5,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x18,0x18,0x10,0x10,0x30,0x30,0x20,0x20,0x60,0x60,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch92 = {5,14,0,0,5,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf0,0xf0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xf0,0xf0, +}; + +static const BitmapCharRec ch91 = {4,18,-1,4,5,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xff,0xc0,0xff,0xc0,0xc0,0x0,0x60,0x0,0x30,0x0,0x18,0x0,0x1c,0x0,0xc,0x0, +0x6,0x0,0x3,0x0,0x1,0x80,0x0,0xc0,0xff,0xc0,0xff,0xc0, +}; + +static const BitmapCharRec ch90 = {10,14,-1,0,12,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, +0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, +}; + +static const BitmapCharRec ch89 = {12,14,-1,0,14,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0xc0,0x60,0xe0,0xe0,0x60,0xc0,0x71,0xc0,0x31,0x80,0x1b,0x0,0xe,0x0,0xe,0x0, +0x1b,0x0,0x31,0x80,0x71,0xc0,0x60,0xc0,0xe0,0xe0,0xc0,0x60, +}; + +static const BitmapCharRec ch88 = {11,14,-1,0,13,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x18,0x18,0x18,0x18,0x1c,0x38,0x34,0x2c,0x36,0x6c,0x36,0x6c,0x66,0x66,0x66,0x66, +0x62,0x46,0x63,0xc6,0xc3,0xc3,0xc1,0x83,0xc1,0x83,0xc1,0x83, +}; + +static const BitmapCharRec ch87 = {16,14,-1,0,18,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x6,0x0,0xf,0x0,0xf,0x0,0x19,0x80,0x19,0x80,0x19,0x80,0x30,0xc0,0x30,0xc0, +0x30,0xc0,0x60,0x60,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, +}; + +static const BitmapCharRec ch86 = {12,14,-1,0,14,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +}; + +static const BitmapCharRec ch85 = {11,14,-1,0,13,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0, +0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xff,0xc0,0xff,0xc0, +}; + +static const BitmapCharRec ch84 = {10,14,-1,0,12,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x3f,0x0,0x7f,0xc0,0xe0,0xe0,0xc0,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0,0x1f,0x0, +0x7c,0x0,0xe0,0x0,0xc0,0x60,0xe0,0xe0,0x7f,0xc0,0x1f,0x0, +}; + +static const BitmapCharRec ch83 = {11,14,-1,0,13,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0x80,0xc1,0x80,0xff,0x0,0xff,0x80, +0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch82 = {10,14,-1,0,12,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x0,0x30,0xf,0xb0,0x3f,0xe0,0x70,0xf0,0x61,0xb0,0xe1,0xb8,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch81 = {13,15,-1,1,15,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80, +0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch80 = {10,14,-1,0,12,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, +0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch79 = {13,14,-1,0,15,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, +0xcc,0x60,0xd8,0x60,0xf0,0x60,0xf0,0x60,0xe0,0x60,0xc0,0x60, +}; + +static const BitmapCharRec ch78 = {11,14,-1,0,13,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0xc3,0xc,0xc3,0xc,0xc7,0x8c,0xc4,0x8c,0xcc,0xcc,0xcc,0xcc,0xd8,0x6c,0xd8,0x6c, +0xf0,0x3c,0xf0,0x3c,0xe0,0x1c,0xe0,0x1c,0xc0,0xc,0xc0,0xc, +}; + +static const BitmapCharRec ch77 = {14,14,-1,0,16,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch76 = {8,14,-1,0,10,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0xc0,0x70,0xc0,0xe0,0xc1,0xc0,0xc3,0x80,0xc7,0x0,0xce,0x0,0xfc,0x0,0xf8,0x0, +0xdc,0x0,0xce,0x0,0xc7,0x0,0xc3,0x80,0xc1,0xc0,0xc0,0xe0, +}; + +static const BitmapCharRec ch75 = {12,14,-1,0,13,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x3c,0x7e,0xe7,0xc3,0xc3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3, +}; + +static const BitmapCharRec ch74 = {8,14,-1,0,10,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch73 = {2,14,-2,0,6,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xff,0xe0,0xff,0xe0, +0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +}; + +static const BitmapCharRec ch72 = {11,14,-1,0,13,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0xf,0xb0,0x3f,0xf0,0x70,0x70,0x60,0x30,0xe0,0x30,0xc1,0xf0,0xc1,0xf0,0xc0,0x0, +0xc0,0x0,0xe0,0x30,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch71 = {12,14,-1,0,14,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, +}; + +static const BitmapCharRec ch70 = {9,14,-1,0,11,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, +}; + +static const BitmapCharRec ch69 = {9,14,-1,0,11,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, +0xc0,0x60,0xc0,0x60,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch68 = {11,14,-1,0,13,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, +}; + +static const BitmapCharRec ch67 = {12,14,-1,0,14,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xff,0x80,0xff,0xc0,0xc0,0xe0,0xc0,0x60,0xc0,0x60,0xc0,0xe0,0xff,0xc0,0xff,0x80, +0xc1,0x80,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, +}; + +static const BitmapCharRec ch66 = {11,14,-1,0,13,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, +0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch65 = {12,14,0,0,12,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x7,0xe0,0x1f,0xf0,0x38,0x0,0x70,0x0,0x67,0x70,0xcf,0xf8,0xcc,0xcc,0xcc,0x66, +0xcc,0x66,0xcc,0x63,0xc6,0x33,0x67,0x73,0x63,0xb3,0x30,0x6,0x1c,0xe,0xf,0xfc, +0x3,0xf0, +}; + +static const BitmapCharRec ch64 = {16,17,-1,3,18,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x30,0x30,0x0,0x0,0x30,0x30,0x30,0x38,0x1c,0xe,0xc6,0xc6,0xfe,0x7c, +}; + +static const BitmapCharRec ch63 = {7,14,-1,0,10,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0xc0,0xf0,0x3c,0xe,0x3,0xe,0x3c,0xf0,0xc0, +}; + +static const BitmapCharRec ch62 = {8,9,-1,0,10,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xfe,0xfe,0x0,0x0,0xfe,0xfe, +}; + +static const BitmapCharRec ch61 = {7,6,-2,-2,11,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x3,0xf,0x3c,0x70,0xc0,0x70,0x3c,0xf,0x3, +}; + +static const BitmapCharRec ch60 = {8,9,-1,0,10,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch59 = {2,13,-1,3,5,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch58 = {2,10,-1,0,5,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0x7c,0xfe,0xc6,0x3,0x3,0x3b,0x7f,0xc3,0xc3,0xc3,0xc7,0x7e,0x3c, +}; + +static const BitmapCharRec ch57 = {8,13,-1,0,10,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x3c,0x7e,0xe7,0xc3,0xc3,0x66,0x7e,0x66,0xc3,0xc3,0xe7,0x7e,0x3c, +}; + +static const BitmapCharRec ch56 = {8,13,-1,0,10,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x60,0x60,0x30,0x30,0x30,0x18,0x18,0xc,0xc,0x6,0x3,0xff,0xff, +}; + +static const BitmapCharRec ch55 = {8,13,-1,0,10,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x3c,0x7e,0xe3,0xc3,0xc3,0xc3,0xfe,0xdc,0xc0,0xc0,0x63,0x7f,0x3c, +}; + +static const BitmapCharRec ch54 = {8,13,-1,0,10,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x7c,0xfe,0xc7,0xc3,0x3,0x3,0xc7,0xfe,0xfc,0xc0,0xc0,0xfe,0xfe, +}; + +static const BitmapCharRec ch53 = {8,13,-1,0,10,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x3,0x0,0x3,0x0,0x3,0x0,0xff,0x80,0xff,0x80,0xc3,0x0,0x63,0x0,0x33,0x0, +0x33,0x0,0x1b,0x0,0xf,0x0,0x7,0x0,0x3,0x0, +}; + +static const BitmapCharRec ch52 = {9,13,-1,0,10,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x3c,0x7e,0xc7,0xc3,0x3,0x7,0x1e,0x1c,0x6,0xc3,0xc3,0x7e,0x3c, +}; + +static const BitmapCharRec ch51 = {8,13,-1,0,10,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xff,0xff,0xc0,0xe0,0x70,0x38,0x1c,0xe,0x7,0x3,0xc3,0xfe,0x3c, +}; + +static const BitmapCharRec ch50 = {8,13,-1,0,10,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0xf8,0x18, +}; + +static const BitmapCharRec ch49 = {5,13,-2,0,10,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x3c,0x7e,0x66,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x7e,0x3c, +}; + +static const BitmapCharRec ch48 = {8,13,-1,0,10,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0xc0,0xc0,0x40,0x40,0x60,0x60,0x20,0x20,0x30,0x30,0x10,0x10,0x18,0x18, +}; + +static const BitmapCharRec ch47 = {5,14,0,0,5,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch46 = {2,2,-1,0,5,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xff,0xff, +}; + +static const BitmapCharRec ch45 = {8,2,-1,-4,11,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch44 = {2,5,-1,3,5,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x18,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,0x18, +}; + +static const BitmapCharRec ch43 = {8,10,-1,0,10,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x88,0x70,0x70,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch42 = {5,6,-1,-8,7,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0xc0,0x60,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0x60, +0xc0,0x80, +}; + +static const BitmapCharRec ch41 = {4,18,-1,4,6,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x10,0x30,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60,0x60, +0x30,0x10, +}; + +static const BitmapCharRec ch40 = {4,18,-1,4,6,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x80,0x40,0x40,0xc0,0xc0, +}; + +static const BitmapCharRec ch39 = {2,5,-1,-9,4,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x3c,0x70,0x7e,0xe0,0xe7,0xc0,0xc3,0x80,0xc3,0xc0,0xc6,0xc0,0xee,0xc0,0x7c,0x0, +0x3c,0x0,0x66,0x0,0x66,0x0,0x7e,0x0,0x3c,0x0, +}; + +static const BitmapCharRec ch38 = {12,13,-1,0,13,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x18,0x78,0x18,0xfc,0xc,0xcc,0xc,0xcc,0x6,0xfc,0x6,0x78,0x3,0x0,0x7b,0x0, +0xfd,0x80,0xcd,0x80,0xcc,0xc0,0xfc,0xc0,0x78,0x60, +}; + +static const BitmapCharRec ch37 = {14,13,-1,0,16,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x8,0x0,0x8,0x0,0x3e,0x0,0x7f,0x0,0xeb,0x80,0xc9,0x80,0x9,0x80,0xf,0x0, +0x3e,0x0,0x78,0x0,0xe8,0x0,0xc8,0x0,0xcb,0x0,0x7f,0x0,0x3e,0x0,0x8,0x0, +}; + +static const BitmapCharRec ch36 = {9,16,-1,2,10,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x24,0x0,0x24,0x0,0x24,0x0,0xff,0x80,0xff,0x80,0x12,0x0,0x12,0x0,0x12,0x0, +0x7f,0xc0,0x7f,0xc0,0x9,0x0,0x9,0x0,0x9,0x0, +}; + +static const BitmapCharRec ch35 = {10,13,0,0,10,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x90,0x90,0xd8,0xd8,0xd8, +}; + +static const BitmapCharRec ch34 = {5,5,0,-9,5,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0xc0,0xc0,0x0,0x0,0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +}; + +static const BitmapCharRec ch33 = {2,14,-2,0,6,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,5,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,5,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmapHelvetica18 = { +"-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_init.c b/xc/extras/Mesa/src-glut/glut_init.c new file mode 100644 index 000000000..b9d2fde3f --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_init.c @@ -0,0 +1,364 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* 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 <stdlib.h> +#include <string.h> +#include <stdio.h> + +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#endif + +/* SGI optimization introduced in IRIX 6.3 to avoid X server + round trips for interning common X atoms. */ +#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) +#include <X11/SGIFastAtom.h> +#else +#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) +#endif + +#include "glutint.h" + +/* GLUT inter-file variables */ +/* *INDENT-OFF* */ +char *__glutProgramName = NULL; +int __glutArgc = 0; +char **__glutArgv = NULL; +char *__glutGeometry = NULL; +Display *__glutDisplay = NULL; +int __glutScreen; +Window __glutRoot; +int __glutScreenHeight; +int __glutScreenWidth; +GLboolean __glutIconic = GL_FALSE; +GLboolean __glutDebug = GL_FALSE; +unsigned int __glutDisplayMode = + GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH; +char *__glutDisplayString = NULL; +int __glutConnectionFD; +XSizeHints __glutSizeHints = {0}; +int __glutInitWidth = 300, __glutInitHeight = 300; +int __glutInitX = -1, __glutInitY = -1; +GLboolean __glutForceDirect = GL_FALSE, + __glutTryDirect = GL_TRUE; +Atom __glutWMDeleteWindow; +/* *INDENT-ON* */ + +#ifdef _WIN32 +void (__cdecl *__glutExitFunc)(int retval) = NULL; +#endif + +static Bool synchronize = False; + +#if defined(_WIN32) + +#ifdef __BORLANDC__ +#include <float.h> /* For masking floating point exceptions. */ +#endif + +void +__glutOpenWin32Connection(char* display) +{ + static char *classname; + WNDCLASS wc; + HINSTANCE hInstance = GetModuleHandle(NULL); + + /* Make sure we register the window only once. */ + if(classname) + return; + +#ifdef __BORLANDC__ + /* Under certain conditions (e.g. while rendering solid surfaces with + lighting enabled) Microsoft OpenGL libraries cause some illegal + operations like floating point overflow or division by zero. The + default behaviour of Microsoft compilers is to mask (ignore) + floating point exceptions, while Borland compilers do not. The + following function of Borland RTL allows to mask exceptions. + Advice from Pier Giorgio Esposito (mc2172@mclink.it). */ + _control87(MCW_EM,MCW_EM); +#endif + + classname = "GLUT"; + + /* Clear (important!) and then fill in the window class structure. */ + memset(&wc, 0, sizeof(WNDCLASS)); + wc.style = CS_OWNDC; + wc.lpfnWndProc = (WNDPROC)__glutWindowProc; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, "GLUT_ICON"); + wc.hCursor = LoadCursor(hInstance, IDC_ARROW); + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = classname; + + /* Fill in a default icon if one isn't specified as a resource. */ + if(!wc.hIcon) + wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); + + if(!RegisterClass(&wc)) { + __glutFatalError("RegisterClass() failed:" + "Cannot register GLUT window class."); + } + + __glutScreenWidth = GetSystemMetrics(SM_CXSCREEN); + __glutScreenHeight = GetSystemMetrics(SM_CYSCREEN); + + /* Set the root window to NULL because windows creates a top-level + window when the parent is NULL. X creates a top-level window + when the parent is the root window. */ + __glutRoot = NULL; + + /* Set the display to 1 -- we shouldn't be using this anywhere + (except as an argument to X calls). */ + __glutDisplay = (Display*)1; + + /* There isn't any concept of multiple screens in Win32, therefore, + we don't need to keep track of the screen we're on... it's always + the same one. */ + __glutScreen = 0; +} +#else /* !_WIN32 */ +void +__glutOpenXConnection(char *display) +{ + int errorBase, eventBase; + + __glutDisplay = XOpenDisplay(display); + if (!__glutDisplay) + __glutFatalError("could not open display: %s", + XDisplayName(display)); + if (synchronize) + XSynchronize(__glutDisplay, True); + if (!glXQueryExtension(__glutDisplay, &errorBase, &eventBase)) + __glutFatalError( + "OpenGL GLX extension not supported by display: %s", + XDisplayName(display)); + __glutScreen = DefaultScreen(__glutDisplay); + __glutRoot = RootWindow(__glutDisplay, __glutScreen); + __glutScreenWidth = DisplayWidth(__glutDisplay, __glutScreen); + __glutScreenHeight = DisplayHeight(__glutDisplay, + __glutScreen); + __glutConnectionFD = ConnectionNumber(__glutDisplay); + __glutWMDeleteWindow = XSGIFastInternAtom(__glutDisplay, + "WM_DELETE_WINDOW", SGI_XA_WM_DELETE_WINDOW, False); +} +#endif /* _WIN32 */ + +void +__glutInitTime(struct timeval *beginning) +{ + static int beenhere = 0; + static struct timeval genesis; + + if (!beenhere) { + GETTIMEOFDAY(&genesis); + beenhere = 1; + } + *beginning = genesis; +} + +static void +removeArgs(int *argcp, char **argv, int numToRemove) +{ + int i, j; + + for (i = 0, j = numToRemove; argv[j]; i++, j++) { + argv[i] = argv[j]; + } + argv[i] = NULL; + *argcp -= numToRemove; +} + +void APIENTRY +glutInit(int *argcp, char **argv) +{ + char *display = NULL; + char *str, *geometry = NULL; + struct timeval unused; + int i; + + if (__glutDisplay) { + __glutWarning("glutInit being called a second time."); + return; + } + /* Determine temporary program name. */ + str = strrchr(argv[0], '/'); + if (str == NULL) { + __glutProgramName = argv[0]; + } else { + __glutProgramName = str + 1; + } + + /* Make private copy of command line arguments. */ + __glutArgc = *argcp; + __glutArgv = (char **) malloc(__glutArgc * sizeof(char *)); + if (!__glutArgv) + __glutFatalError("out of memory."); + for (i = 0; i < __glutArgc; i++) { + __glutArgv[i] = __glutStrdup(argv[i]); + if (!__glutArgv[i]) + __glutFatalError("out of memory."); + } + + /* determine permanent program name */ + str = strrchr(__glutArgv[0], '/'); + if (str == NULL) { + __glutProgramName = __glutArgv[0]; + } else { + __glutProgramName = str + 1; + } + + /* parse arguments for standard options */ + for (i = 1; i < __glutArgc; i++) { + if (!strcmp(__glutArgv[i], "-display")) { +#if defined(_WIN32) + __glutWarning("-display option not supported by Win32 GLUT."); +#endif + if (++i >= __glutArgc) { + __glutFatalError( + "follow -display option with X display name."); + } + display = __glutArgv[i]; + removeArgs(argcp, &argv[1], 2); + } else if (!strcmp(__glutArgv[i], "-geometry")) { + if (++i >= __glutArgc) { + __glutFatalError( + "follow -geometry option with geometry parameter."); + } + geometry = __glutArgv[i]; + removeArgs(argcp, &argv[1], 2); + } else if (!strcmp(__glutArgv[i], "-direct")) { +#if defined(_WIN32) + __glutWarning("-direct option not supported by Win32 GLUT."); +#endif + if (!__glutTryDirect) + __glutFatalError( + "cannot force both direct and indirect rendering."); + __glutForceDirect = GL_TRUE; + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-indirect")) { +#if defined(_WIN32) + __glutWarning("-indirect option not supported by Win32 GLUT."); +#endif + if (__glutForceDirect) + __glutFatalError( + "cannot force both direct and indirect rendering."); + __glutTryDirect = GL_FALSE; + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-iconic")) { + __glutIconic = GL_TRUE; + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-gldebug")) { + __glutDebug = GL_TRUE; + removeArgs(argcp, &argv[1], 1); + } else if (!strcmp(__glutArgv[i], "-sync")) { +#if defined(_WIN32) + __glutWarning("-sync option not supported by Win32 GLUT."); +#endif + synchronize = GL_TRUE; + removeArgs(argcp, &argv[1], 1); + } else { + /* Once unknown option encountered, stop command line + processing. */ + break; + } + } +#if defined(_WIN32) + __glutOpenWin32Connection(display); +#else + __glutOpenXConnection(display); +#endif + if (geometry) { + int flags, x, y, width, height; + + /* Fix bogus "{width|height} may be used before set" + warning */ + width = 0; + height = 0; + + flags = XParseGeometry(geometry, &x, &y, + (unsigned int *) &width, (unsigned int *) &height); + if (WidthValue & flags) { + /* Careful because X does not allow zero or negative + width windows */ + if (width > 0) + __glutInitWidth = width; + } + if (HeightValue & flags) { + /* Careful because X does not allow zero or negative + height windows */ + if (height > 0) + __glutInitHeight = height; + } + glutInitWindowSize(__glutInitWidth, __glutInitHeight); + if (XValue & flags) { + if (XNegative & flags) + x = DisplayWidth(__glutDisplay, __glutScreen) + + x - __glutSizeHints.width; + /* Play safe: reject negative X locations */ + if (x >= 0) + __glutInitX = x; + } + if (YValue & flags) { + if (YNegative & flags) + y = DisplayHeight(__glutDisplay, __glutScreen) + + y - __glutSizeHints.height; + /* Play safe: reject negative Y locations */ + if (y >= 0) + __glutInitY = y; + } + glutInitWindowPosition(__glutInitX, __glutInitY); + } + __glutInitTime(&unused); +} + +#ifdef _WIN32 +void APIENTRY +__glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)) +{ + __glutExitFunc = exitfunc; + glutInit(argcp, argv); +} +#endif + +/* CENTRY */ +void APIENTRY +glutInitWindowPosition(int x, int y) +{ + __glutInitX = x; + __glutInitY = y; + if (x >= 0 && y >= 0) { + __glutSizeHints.x = x; + __glutSizeHints.y = y; + __glutSizeHints.flags |= USPosition; + } else { + __glutSizeHints.flags &= ~USPosition; + } +} + +void APIENTRY +glutInitWindowSize(int width, int height) +{ + __glutInitWidth = width; + __glutInitHeight = height; + if (width > 0 && height > 0) { + __glutSizeHints.width = width; + __glutSizeHints.height = height; + __glutSizeHints.flags |= USSize; + } else { + __glutSizeHints.flags &= ~USSize; + } +} + +void APIENTRY +glutInitDisplayMode(unsigned int mask) +{ + __glutDisplayMode = mask; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_input.c b/xc/extras/Mesa/src-glut/glut_input.c new file mode 100644 index 000000000..830ef920e --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_input.c @@ -0,0 +1,635 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ + +/* 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 <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#if !defined(_WIN32) +#include <X11/Xlib.h> +#if defined(__vms) +#include <X11/XInput.h> +#else +#include <X11/extensions/XInput.h> +#endif +#include <X11/Xutil.h> +#else +#include <windows.h> +#ifndef __CYGWIN32__ +#include <mmsystem.h> /* Win32 Multimedia API header. */ +#endif +#endif /* !_WIN32 */ + +#include "glutint.h" + +int __glutNumDials = 0; +int __glutNumSpaceballButtons = 0; +int __glutNumButtonBoxButtons = 0; +int __glutNumTabletButtons = 0; +int __glutNumMouseButtons = 3; /* Good guess. */ +XDevice *__glutTablet = NULL; +XDevice *__glutDials = NULL; +XDevice *__glutSpaceball = NULL; + +int __glutHasJoystick = 0; +int __glutNumJoystickButtons = 0; +int __glutNumJoystickAxes = 0; + +#if !defined(_WIN32) +typedef struct _Range { + int min; + int range; +} Range; + +#define NUM_SPACEBALL_AXIS 6 +#define NUM_TABLET_AXIS 2 +#define NUM_DIALS_AXIS 8 + +Range __glutSpaceballRange[NUM_SPACEBALL_AXIS]; +Range __glutTabletRange[NUM_TABLET_AXIS]; +int *__glutDialsResolution; + +/* Safely assumes 0 is an illegal event type for X Input + extension events. */ +int __glutDeviceMotionNotify = 0; +int __glutDeviceButtonPress = 0; +int __glutDeviceButtonPressGrab = 0; +int __glutDeviceButtonRelease = 0; +int __glutDeviceStateNotify = 0; + +static int +normalizeTabletPos(int axis, int rawValue) +{ + assert(rawValue >= __glutTabletRange[axis].min); + assert(rawValue <= __glutTabletRange[axis].min + + __glutTabletRange[axis].range); + /* Normalize rawValue to between 0 and 4000. */ + return ((rawValue - __glutTabletRange[axis].min) * 4000) / + __glutTabletRange[axis].range; +} + +static int +normalizeDialAngle(int axis, int rawValue) +{ + /* XXX Assumption made that the resolution of the device is + number of clicks for one complete dial revolution. This + is true for SGI's dial & button box. */ + return (rawValue * 360.0) / __glutDialsResolution[axis]; +} + +static int +normalizeSpaceballAngle(int axis, int rawValue) +{ + assert(rawValue >= __glutSpaceballRange[axis].min); + assert(rawValue <= __glutSpaceballRange[axis].min + + __glutSpaceballRange[axis].range); + /* Normalize rawValue to between -1800 and 1800. */ + return ((rawValue - __glutSpaceballRange[axis].min) * 3600) / + __glutSpaceballRange[axis].range - 1800; +} + +static int +normalizeSpaceballDelta(int axis, int rawValue) +{ + assert(rawValue >= __glutSpaceballRange[axis].min); + assert(rawValue <= __glutSpaceballRange[axis].min + + __glutSpaceballRange[axis].range); + /* Normalize rawValue to between -1000 and 1000. */ + return ((rawValue - __glutSpaceballRange[axis].min) * 2000) / + __glutSpaceballRange[axis].range - 1000; +} + +static void +queryTabletPos(GLUTwindow * window) +{ + XDeviceState *state; + XInputClass *any; + XValuatorState *v; + int i; + + state = XQueryDeviceState(__glutDisplay, __glutTablet); + any = state->data; + for (i = 0; i < state->num_classes; i++) { +#if defined(__cplusplus) || defined(c_plusplus) + switch (any->c_class) { +#else + switch (any->class) { +#endif + case ValuatorClass: + v = (XValuatorState *) any; + if (v->num_valuators < 2) + goto end; + if (window->tabletPos[0] == -1) + window->tabletPos[0] = normalizeTabletPos(0, v->valuators[0]); + if (window->tabletPos[1] == -1) + window->tabletPos[1] = normalizeTabletPos(1, v->valuators[1]); + } + any = (XInputClass *) ((char *) any + any->length); + } +end: + XFreeDeviceState(state); +} + +static void +tabletPosChange(GLUTwindow * window, int first, int count, int *data) +{ + int i, value, genEvent = 0; + + for (i = first; i < first + count; i++) { + switch (i) { + case 0: /* X axis */ + case 1: /* Y axis */ + value = normalizeTabletPos(i, data[i - first]); + if (value != window->tabletPos[i]) { + window->tabletPos[i] = value; + genEvent = 1; + } + break; + } + } + if (window->tabletPos[0] == -1 || window->tabletPos[1] == -1) + queryTabletPos(window); + if (genEvent) + window->tabletMotion(window->tabletPos[0], window->tabletPos[1]); +} +#endif /* !_WIN32 */ + +static int +__glutProcessDeviceEvents(XEvent * event) +{ +#if !defined(_WIN32) + GLUTwindow *window; + + /* XXX Ugly code fan out. */ + + /* Can't use switch/case since X Input event types are + dynamic. */ + + if (__glutDeviceMotionNotify && event->type == __glutDeviceMotionNotify) { + XDeviceMotionEvent *devmot = (XDeviceMotionEvent *) event; + + window = __glutGetWindow(devmot->window); + if (window) { + if (__glutTablet + && devmot->deviceid == __glutTablet->device_id + && window->tabletMotion) { + tabletPosChange(window, devmot->first_axis, devmot->axes_count, + devmot->axis_data); + } else if (__glutDials + && devmot->deviceid == __glutDials->device_id + && window->dials) { + int i, first = devmot->first_axis, count = devmot->axes_count; + + for (i = first; i < first + count; i++) + window->dials(i + 1, + normalizeDialAngle(i, devmot->axis_data[i - first])); + } else if (__glutSpaceball + && devmot->deviceid == __glutSpaceball->device_id) { + /* XXX Assume that space ball motion events come in as + all the first 6 axes. Assume first 3 axes are XYZ + translations; second 3 axes are XYZ rotations. */ + if (devmot->first_axis == 0 && devmot->axes_count == 6) { + if (window->spaceMotion) + window->spaceMotion( + normalizeSpaceballDelta(0, devmot->axis_data[0]), + normalizeSpaceballDelta(1, devmot->axis_data[1]), + normalizeSpaceballDelta(2, devmot->axis_data[2])); + if (window->spaceRotate) + window->spaceRotate( + normalizeSpaceballAngle(3, devmot->axis_data[3]), + normalizeSpaceballAngle(4, devmot->axis_data[4]), + normalizeSpaceballAngle(5, devmot->axis_data[5])); + } + } + return 1; + } + } else if (__glutDeviceButtonPress + && event->type == __glutDeviceButtonPress) { + XDeviceButtonEvent *devbtn = (XDeviceButtonEvent *) event; + + window = __glutGetWindow(devbtn->window); + if (window) { + if (__glutTablet + && devbtn->deviceid == __glutTablet->device_id + && window->tabletButton + && devbtn->first_axis == 0 + && devbtn->axes_count == 2) { + tabletPosChange(window, devbtn->first_axis, devbtn->axes_count, + devbtn->axis_data); + window->tabletButton(devbtn->button, GLUT_DOWN, + window->tabletPos[0], window->tabletPos[1]); + } else if (__glutDials + && devbtn->deviceid == __glutDials->device_id + && window->buttonBox) { + window->buttonBox(devbtn->button, GLUT_DOWN); + } else if (__glutSpaceball + && devbtn->deviceid == __glutSpaceball->device_id + && window->spaceButton) { + window->spaceButton(devbtn->button, GLUT_DOWN); + } + return 1; + } + } else if (__glutDeviceButtonRelease + && event->type == __glutDeviceButtonRelease) { + XDeviceButtonEvent *devbtn = (XDeviceButtonEvent *) event; + + window = __glutGetWindow(devbtn->window); + if (window) { + if (__glutTablet + && devbtn->deviceid == __glutTablet->device_id + && window->tabletButton + && devbtn->first_axis == 0 + && devbtn->axes_count == 2) { + tabletPosChange(window, devbtn->first_axis, devbtn->axes_count, + devbtn->axis_data); + window->tabletButton(devbtn->button, GLUT_UP, + window->tabletPos[0], window->tabletPos[1]); + } else if (__glutDials + && devbtn->deviceid == __glutDials->device_id + && window->buttonBox) { + window->buttonBox(devbtn->button, GLUT_UP); + } else if (__glutSpaceball + && devbtn->deviceid == __glutSpaceball->device_id + && window->spaceButton) { + window->spaceButton(devbtn->button, GLUT_UP); + } + return 1; + } + } +#else + { + JOYINFOEX info; + JOYCAPS joyCaps; + + memset(&info, 0, sizeof(JOYINFOEX)); + info.dwSize = sizeof(JOYINFOEX); + info.dwFlags = JOY_RETURNALL; + + if (joyGetPosEx(JOYSTICKID1,&info) != JOYERR_NOERROR) { + __glutHasJoystick = 1; + joyGetDevCaps(JOYSTICKID1, &joyCaps, sizeof(joyCaps)); + __glutNumJoystickButtons = joyCaps.wNumButtons; + __glutNumJoystickAxes = joyCaps.wNumAxes; + } else { + __glutHasJoystick = 0; + __glutNumJoystickButtons = 0; + __glutNumJoystickAxes = 0; + } + } +#endif /* !_WIN32 */ + return 0; +} + +static GLUTeventParser eventParser = +{__glutProcessDeviceEvents, NULL}; + +static void +addDeviceEventParser(void) +{ + static Bool been_here = False; + + if (been_here) + return; + been_here = True; + __glutRegisterEventParser(&eventParser); +} + +static int +probeDevices(void) +{ + static Bool been_here = False; + static int support; +#if !defined(_WIN32) + XExtensionVersion *version; + XDeviceInfoPtr device_info, device; + XAnyClassPtr any; + XButtonInfoPtr b; + XValuatorInfoPtr v; + XAxisInfoPtr a; + int num_dev = 0, btns = 0, dials = 0; + int i, j, k; +#endif /* !_WIN32 */ + + if (been_here) { + return support; + } + been_here = True; + +#if !defined(_WIN32) + version = XGetExtensionVersion(__glutDisplay, "XInputExtension"); + /* Ugh. XInput extension API forces annoying cast of a pointer + to a long so it can be compared with the NoSuchExtension + value (#defined to 1). */ + if (version == NULL || ((long) version) == NoSuchExtension) { + support = 0; + return support; + } + XFree(version); + device_info = XListInputDevices(__glutDisplay, &num_dev); + if (device_info) { + for (i = 0; i < num_dev; i++) { + /* XXX These are SGI names for these devices; + unfortunately, no good standard exists for standard + types of X input extension devices. */ + + device = &device_info[i]; + any = (XAnyClassPtr) device->inputclassinfo; + + if (!__glutSpaceball && !strcmp(device->name, "spaceball")) { + v = NULL; + b = NULL; + for (j = 0; j < device->num_classes; j++) { +#if defined(__cplusplus) || defined(c_plusplus) + switch (any->c_class) { +#else + switch (any->class) { +#endif + case ButtonClass: + b = (XButtonInfoPtr) any; + btns = b->num_buttons; + break; + case ValuatorClass: + v = (XValuatorInfoPtr) any; + /* Sanity check: at least 6 valuators? */ + if (v->num_axes < NUM_SPACEBALL_AXIS) + goto skip_device; + a = (XAxisInfoPtr) ((char *) v + sizeof(XValuatorInfo)); + for (k = 0; k < NUM_SPACEBALL_AXIS; k++, a++) { + __glutSpaceballRange[k].min = a->min_value; + __glutSpaceballRange[k].range = a->max_value - a->min_value; + } + break; + } + any = (XAnyClassPtr) ((char *) any + any->length); + } + if (v) { + __glutSpaceball = XOpenDevice(__glutDisplay, device->id); + if (__glutSpaceball) { + __glutNumSpaceballButtons = btns; + addDeviceEventParser(); + } + } + } else if (!__glutDials && !strcmp(device->name, "dial+buttons")) { + v = NULL; + b = NULL; + for (j = 0; j < device->num_classes; j++) { +#if defined(__cplusplus) || defined(c_plusplus) + switch (any->c_class) { +#else + switch (any->class) { +#endif + case ButtonClass: + b = (XButtonInfoPtr) any; + btns = b->num_buttons; + break; + case ValuatorClass: + v = (XValuatorInfoPtr) any; + /* Sanity check: at least 8 valuators? */ + if (v->num_axes < NUM_DIALS_AXIS) + goto skip_device; + dials = v->num_axes; + __glutDialsResolution = (int *) malloc(sizeof(int) * dials); + a = (XAxisInfoPtr) ((char *) v + sizeof(XValuatorInfo)); + for (k = 0; k < dials; k++, a++) { + __glutDialsResolution[k] = a->resolution; + } + break; + } + any = (XAnyClassPtr) ((char *) any + any->length); + } + if (v) { + __glutDials = XOpenDevice(__glutDisplay, device->id); + if (__glutDials) { + __glutNumButtonBoxButtons = btns; + __glutNumDials = dials; + addDeviceEventParser(); + } + } + } else if (!__glutTablet && !strcmp(device->name, "tablet")) { + v = NULL; + b = NULL; + for (j = 0; j < device->num_classes; j++) { +#if defined(__cplusplus) || defined(c_plusplus) + switch (any->c_class) { +#else + switch (any->class) { +#endif + case ButtonClass: + b = (XButtonInfoPtr) any; + btns = b->num_buttons; + break; + case ValuatorClass: + v = (XValuatorInfoPtr) any; + /* Sanity check: exactly 2 valuators? */ + if (v->num_axes != NUM_TABLET_AXIS) + goto skip_device; + a = (XAxisInfoPtr) ((char *) v + sizeof(XValuatorInfo)); + for (k = 0; k < NUM_TABLET_AXIS; k++, a++) { + __glutTabletRange[k].min = a->min_value; + __glutTabletRange[k].range = a->max_value - a->min_value; + } + break; + } + any = (XAnyClassPtr) ((char *) any + any->length); + } + if (v) { + __glutTablet = XOpenDevice(__glutDisplay, device->id); + if (__glutTablet) { + __glutNumTabletButtons = btns; + addDeviceEventParser(); + } + } + } else if (!strcmp(device->name, "mouse")) { + for (j = 0; j < device->num_classes; j++) { +#if defined(__cplusplus) || defined(c_plusplus) + if (any->c_class == ButtonClass) { +#else + if (any->class == ButtonClass) { +#endif + b = (XButtonInfoPtr) any; + __glutNumMouseButtons = b->num_buttons; + } + any = (XAnyClassPtr) ((char *) any + any->length); + } + } + skip_device:; + } + XFreeDeviceList(device_info); + } +#else /* _WIN32 */ + __glutNumMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); +#endif /* !_WIN32 */ + /* X Input extension might be supported, but only if there is + a tablet, dials, or spaceball do we claim devices are + supported. */ + support = __glutTablet || __glutDials || __glutSpaceball; + return support; +} + +void +__glutUpdateInputDeviceMask(GLUTwindow * window) +{ +#if !defined(_WIN32) + /* 5 (dial and buttons) + 5 (tablet locator and buttons) + 5 + (Spaceball buttons and axis) = 15 */ + XEventClass eventList[15]; + int rc, numEvents; + + rc = probeDevices(); + if (rc) { + numEvents = 0; + if (__glutTablet) { + if (window->tabletMotion) { + DeviceMotionNotify(__glutTablet, __glutDeviceMotionNotify, + eventList[numEvents]); + numEvents++; + } + if (window->tabletButton) { + DeviceButtonPress(__glutTablet, __glutDeviceButtonPress, + eventList[numEvents]); + numEvents++; + DeviceButtonPressGrab(__glutTablet, __glutDeviceButtonPressGrab, + eventList[numEvents]); + numEvents++; + DeviceButtonRelease(__glutTablet, __glutDeviceButtonRelease, + eventList[numEvents]); + numEvents++; + } + if (window->tabletMotion || window->tabletButton) { + DeviceStateNotify(__glutTablet, __glutDeviceStateNotify, + eventList[numEvents]); + numEvents++; + } + } + if (__glutDials) { + if (window->dials) { + DeviceMotionNotify(__glutDials, __glutDeviceMotionNotify, + eventList[numEvents]); + numEvents++; + } + if (window->buttonBox) { + DeviceButtonPress(__glutDials, __glutDeviceButtonPress, + eventList[numEvents]); + numEvents++; + DeviceButtonPressGrab(__glutDials, __glutDeviceButtonPressGrab, + eventList[numEvents]); + numEvents++; + DeviceButtonRelease(__glutDials, __glutDeviceButtonRelease, + eventList[numEvents]); + numEvents++; + } + if (window->dials || window->buttonBox) { + DeviceStateNotify(__glutDials, __glutDeviceStateNotify, + eventList[numEvents]); + numEvents++; + } + } + if (__glutSpaceball) { + if (window->spaceMotion || window->spaceRotate) { + DeviceMotionNotify(__glutSpaceball, __glutDeviceMotionNotify, + eventList[numEvents]); + numEvents++; + } + if (window->spaceButton) { + DeviceButtonPress(__glutSpaceball, __glutDeviceButtonPress, + eventList[numEvents]); + numEvents++; + DeviceButtonPressGrab(__glutSpaceball, __glutDeviceButtonPressGrab, + eventList[numEvents]); + numEvents++; + DeviceButtonRelease(__glutSpaceball, __glutDeviceButtonRelease, + eventList[numEvents]); + numEvents++; + } + if (window->spaceMotion || window->spaceRotate || window->spaceButton) { + DeviceStateNotify(__glutSpaceball, __glutDeviceStateNotify, + eventList[numEvents]); + numEvents++; + } + } +#if 0 + if (window->children) { + GLUTwindow *child = window->children; + + do { + XChangeDeviceDontPropagateList(__glutDisplay, child->win, + numEvents, eventList, AddToList); + child = child->siblings; + } while (child); + } +#endif + XSelectExtensionEvent(__glutDisplay, window->win, + eventList, numEvents); + if (window->overlay) { + XSelectExtensionEvent(__glutDisplay, window->overlay->win, + eventList, numEvents); + } + } else { + /* X Input extension not supported; no chance for exotic + input devices. */ + } +#endif /* !_WIN32 */ +} + +/* CENTRY */ +int APIENTRY +glutDeviceGet(GLenum param) +{ + probeDevices(); + switch (param) { + case GLUT_HAS_KEYBOARD: + case GLUT_HAS_MOUSE: + /* Assume window system always has mouse and keyboard. */ + return 1; + case GLUT_HAS_SPACEBALL: + return __glutSpaceball != NULL; + case GLUT_HAS_DIAL_AND_BUTTON_BOX: + return __glutDials != NULL; + case GLUT_HAS_TABLET: + return __glutTablet != NULL; + case GLUT_NUM_MOUSE_BUTTONS: + return __glutNumMouseButtons; + case GLUT_NUM_SPACEBALL_BUTTONS: + return __glutNumSpaceballButtons; + case GLUT_NUM_BUTTON_BOX_BUTTONS: + return __glutNumButtonBoxButtons; + case GLUT_NUM_DIALS: + return __glutNumDials; + case GLUT_NUM_TABLET_BUTTONS: + return __glutNumTabletButtons; + case GLUT_DEVICE_IGNORE_KEY_REPEAT: + return __glutCurrentWindow->ignoreKeyRepeat; +#ifndef _WIN32 + case GLUT_DEVICE_KEY_REPEAT: + { + XKeyboardState state; + + XGetKeyboardControl(__glutDisplay, &state); + return state.global_auto_repeat; + } + case GLUT_JOYSTICK_POLL_RATE: + return 0; +#else + case GLUT_DEVICE_KEY_REPEAT: + /* Win32 cannot globally disable key repeat. */ + return GLUT_KEY_REPEAT_ON; + case GLUT_JOYSTICK_POLL_RATE: + return __glutCurrentWindow->joyPollInterval; +#endif + case GLUT_HAS_JOYSTICK: + return __glutHasJoystick; + case GLUT_JOYSTICK_BUTTONS: + return __glutNumJoystickButtons; + case GLUT_JOYSTICK_AXES: + return __glutNumJoystickAxes; + default: + __glutWarning("invalid glutDeviceGet parameter: %d", param); + return -1; + } +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_joy.c b/xc/extras/Mesa/src-glut/glut_joy.c new file mode 100644 index 000000000..116f03284 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_joy.c @@ -0,0 +1,82 @@ + +/* Copyright (c) Mark J. Kilgard, 1997, 1998. */ + +/* 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. */ + +#ifdef _WIN32 +#include <windows.h> +#ifndef __CYGWIN32__ +#include <mmsystem.h> /* Win32 Multimedia API header. */ +#endif +#endif + +#include "glutint.h" + +/* CENTRY */ +void APIENTRY +glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval) +{ +#ifdef _WIN32 + if (joystickFunc && (pollInterval > 0)) { + if (__glutCurrentWindow->entryState == WM_SETFOCUS) { + MMRESULT result; + + /* Capture joystick focus if current window has + focus now. */ + result = joySetCapture(__glutCurrentWindow->win, + JOYSTICKID1, 0, TRUE); + if (result == JOYERR_NOERROR) { + (void) joySetThreshold(JOYSTICKID1, pollInterval); + } + } + __glutCurrentWindow->joyPollInterval = pollInterval; + } else { + /* Release joystick focus if current window has + focus now. */ + if (__glutCurrentWindow->joystick + && (__glutCurrentWindow->joyPollInterval > 0) + && (__glutCurrentWindow->entryState == WM_SETFOCUS)) { + (void) joyReleaseCapture(JOYSTICKID1); + } + __glutCurrentWindow->joyPollInterval = 0; + } + __glutCurrentWindow->joystick = joystickFunc; +#else + /* XXX No support currently for X11 joysticks. */ +#endif +} + +void APIENTRY +glutForceJoystickFunc(void) +{ +#ifdef _WIN32 + if (__glutCurrentWindow->joystick) { + JOYINFOEX jix; + MMRESULT res; + int x, y, z; + + /* Poll the joystick. */ + jix.dwSize = sizeof(jix); + jix.dwFlags = JOY_RETURNALL; + res = joyGetPosEx(JOYSTICKID1,&jix); + if (res == JOYERR_NOERROR) { + + /* Convert to int for scaling. */ + x = jix.dwXpos; + y = jix.dwYpos; + z = jix.dwZpos; + +#define SCALE(v) ((int) ((v - 32767)/32.768)) + + __glutCurrentWindow->joystick(jix.dwButtons, + SCALE(x), SCALE(y), SCALE(z)); + } + } +#else + /* XXX No support currently for X11 joysticks. */ +#endif +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_key.c b/xc/extras/Mesa/src-glut/glut_key.c new file mode 100644 index 000000000..0927f66e5 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_key.c @@ -0,0 +1,29 @@ + +/* Copyright (c) Mark J. Kilgard, 1997. */ + +/* 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 <stdlib.h> + +#include "glutint.h" + +/* CENTRY */ +void APIENTRY +glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) +{ + __glutChangeWindowEventMask(KeyPressMask, + keyboardFunc != NULL || __glutCurrentWindow->special != NULL); + __glutCurrentWindow->keyboard = keyboardFunc; +} + +void APIENTRY +glutSpecialFunc(GLUTspecialCB specialFunc) +{ + __glutChangeWindowEventMask(KeyPressMask, + specialFunc != NULL || __glutCurrentWindow->keyboard != NULL); + __glutCurrentWindow->special = specialFunc; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_keyctrl.c b/xc/extras/Mesa/src-glut/glut_keyctrl.c new file mode 100644 index 000000000..a4bc0210b --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_keyctrl.c @@ -0,0 +1,29 @@ + +/* Copyright (c) Mark J. Kilgard, 1996, 1997. */ + +/* 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 "glutint.h" + +/* CENTRY */ +void APIENTRY +glutIgnoreKeyRepeat(int ignore) +{ + __glutCurrentWindow->ignoreKeyRepeat = ignore; +} + +void APIENTRY +glutSetKeyRepeat(int repeatMode) +{ +#if !defined(_WIN32) + XKeyboardControl values; + + /* GLUT's repeatMode #define's match the Xlib API values. */ + values.auto_repeat_mode = repeatMode; + XChangeKeyboardControl(__glutDisplay, KBAutoRepeatMode, &values); +#endif +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_keyup.c b/xc/extras/Mesa/src-glut/glut_keyup.c new file mode 100644 index 000000000..1c6e78051 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_keyup.c @@ -0,0 +1,29 @@ + +/* Copyright (c) Mark J. Kilgard, 1997. */ + +/* 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 <stdlib.h> + +#include "glutint.h" + +/* CENTRY */ +void APIENTRY +glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc) +{ + __glutChangeWindowEventMask(KeyReleaseMask, + keyboardUpFunc != NULL || __glutCurrentWindow->specialUp != NULL); + __glutCurrentWindow->keyboardUp = keyboardUpFunc; +} + +void APIENTRY +glutSpecialUpFunc(GLUTspecialCB specialUpFunc) +{ + __glutChangeWindowEventMask(KeyReleaseMask, + specialUpFunc != NULL || __glutCurrentWindow->keyboardUp != NULL); + __glutCurrentWindow->specialUp = specialUpFunc; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_menu.c b/xc/extras/Mesa/src-glut/glut_menu.c new file mode 100644 index 000000000..a959492b1 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_menu.c @@ -0,0 +1,1010 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* 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. */ + +/* The Win32 GLUT file win32_menu.c completely re-implements all + the menuing functionality implemented. This file is used only by + the X Window System version of GLUT. */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> +#include <assert.h> + +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/cursorfont.h> /* for XC_arrow */ + +#include "glutint.h" +#include "layerutil.h" + +void (CDECL *__glutMenuStatusFunc) (int, int, int); +GLUTmenuItem *__glutItemSelected; +GLUTmenu **__glutMenuList = NULL; + +static int menuListSize = 0; +static XFontStruct *menuFont = NULL; +static Cursor menuCursor; +static Colormap menuColormap; +static Visual *menuVisual; +static int menuDepth; +static int fontHeight; +static GC blackGC, grayGC, whiteGC; +static unsigned long menuBlack, menuWhite, menuGray; +static unsigned long useSaveUnders; + +/* A replacement for XAllocColor (originally by Brian Paul). + This function should never fail to allocate a color. When + XAllocColor fails, we return the nearest matching color. If + we have to allocate many colors this function isn't a great + solution; the XQueryColors() could be done just once. */ +static void +noFaultXAllocColor(Display * dpy, Colormap cmap, int cmapSize, + XColor * color) +{ + XColor *ctable, subColor; + int i, bestmatch; + double mindist; /* 3*2^16^2 exceeds 32-bit long int + precision. */ + + for (;;) { + /* First try just using XAllocColor. */ + if (XAllocColor(dpy, cmap, color)) { + return; + } + + /* Retrieve color table entries. */ + /* XXX alloca canidate. */ + ctable = (XColor *) malloc(cmapSize * sizeof(XColor)); + for (i = 0; i < cmapSize; i++) + ctable[i].pixel = i; + XQueryColors(dpy, cmap, ctable, cmapSize); + + /* Find best match. */ + bestmatch = -1; + mindist = 0.0; + for (i = 0; i < cmapSize; i++) { + double dr = (double) color->red - (double) ctable[i].red; + double dg = (double) color->green - (double) ctable[i].green; + double db = (double) color->blue - (double) ctable[i].blue; + double dist = dr * dr + dg * dg + db * db; + if (bestmatch < 0 || dist < mindist) { + bestmatch = i; + mindist = dist; + } + } + + /* Return result. */ + subColor.red = ctable[bestmatch].red; + subColor.green = ctable[bestmatch].green; + subColor.blue = ctable[bestmatch].blue; + free(ctable); + if (XAllocColor(dpy, cmap, &subColor)) { + *color = subColor; + return; + } + /* Extremely unlikely, but possibly color was deallocated + and reallocated by someone else before we could + XAllocColor the color cell we located. If so, loop + again... */ + } +} + +static int +ifSunCreator(void) +{ + char *xvendor, *glvendor, *renderer; + int isSunCreator = 0; /* Until proven that it is. */ + int savedDisplayMode = 0; + char *savedDisplayString = 0; + GLUTwindow *window; + +#define VENDOR_SUN "Sun Microsystems" +#define RENDERER_CREATOR "Creator" + + /* Check the X vendor string first. It is easier to check + than the OpenGL vendor and renderer strings since it + doesn't require a valid OpenGL rendering context. Bail + early if not connected to a Sun. */ + xvendor = ServerVendor(__glutDisplay); + if (!strncmp(xvendor, VENDOR_SUN, sizeof(VENDOR_SUN) - 1)) { + + /* We need a valid current OpenGL rendering context to be + able to call glGetString successfully. If there is not + a current window, set up a temporary one just to call + glGetString with (gag, expensive). */ + if (__glutCurrentWindow) { + window = NULL; + } else { + savedDisplayMode = __glutDisplayMode; + savedDisplayString = __glutDisplayString; + __glutDisplayMode = GLUT_RGB | GLUT_SINGLE; + __glutDisplayString = NULL; + window = __glutCreateWindow(NULL, 0, 0, 1, 1, 0); + } + + glvendor = (char *) glGetString(GL_VENDOR); + if (!strncmp(glvendor, VENDOR_SUN, sizeof(VENDOR_SUN) - 1)) { + renderer = (char *) glGetString(GL_RENDERER); + if (!strncmp(renderer, RENDERER_CREATOR, sizeof(RENDERER_CREATOR) - 1)) { + isSunCreator = 1; + } + } + /* Destroy the temporary window for glGetString if one + needed to be created. */ + if (window) { + __glutDestroyWindow(window, window); + __glutDisplayMode = savedDisplayMode; + __glutDisplayString = savedDisplayString; + } + } + return isSunCreator; +} + +static void +menuVisualSetup(void) +{ + XLayerVisualInfo template, *visual, *overlayVisuals; + XColor color; + Status status; + Bool presumablyMesa; + int layer, nVisuals, i, dummy; + unsigned long *placeHolders = NULL; + int numPlaceHolders = 0; + Bool allocateHigh; + + allocateHigh = ifSunCreator(); + + /* Start with the highest overlay layer and work down. I + don't think any hardware has more than 3 overlay layers. */ + for (layer = 3; layer > 0; layer--) { + template.layer = layer; + template.vinfo.screen = __glutScreen; + overlayVisuals = __glutXGetLayerVisualInfo(__glutDisplay, + VisualScreenMask | VisualLayerMask, &template, &nVisuals); + if (overlayVisuals) { + /* First, check if the default visual is in this layer. + If the default visual is in this layer, we try to use + it since it has pre-defined black and white pixels and + + using the default visual will probably minimize + colormap flashing problems. Suggested by Thomas Roell + (thomas@xig.com). */ + for (i = 0; i < nVisuals; i++) { + visual = &overlayVisuals[i]; + if (visual->vinfo.colormap_size >= 3) { + /* Compare visual IDs just to be safe. */ + if (visual->vinfo.visual->visualid == DefaultVisual(__glutDisplay, __glutScreen)->visualid) { + /* Settle for default visual. */ + menuVisual = DefaultVisual(__glutDisplay, __glutScreen); + menuDepth = DefaultDepth(__glutDisplay, __glutScreen); + menuColormap = DefaultColormap(__glutDisplay, __glutScreen); + menuBlack = BlackPixel(__glutDisplay, __glutScreen); + menuWhite = WhitePixel(__glutDisplay, __glutScreen); + color.red = color.green = color.blue = 0xaa00; + noFaultXAllocColor(__glutDisplay, menuColormap, + menuVisual->map_entries, &color); + menuGray = color.pixel; + useSaveUnders = 0; + XFree(overlayVisuals); + return; + } + } + } + for (i = 0; i < nVisuals; i++) { + visual = &overlayVisuals[i]; + if (visual->vinfo.colormap_size >= 3) { + if (allocateHigh) { + /* For Sun's Creator graphics, try to force the + read-only colors to the high end of the colormap + by first allocating read-write place-holder cells + for all but the last three cells. This helps + avoid colormap flashing problems. */ + numPlaceHolders = visual->vinfo.colormap_size - 3; + if (numPlaceHolders > 0) { + placeHolders = (unsigned long *) + malloc(numPlaceHolders * sizeof(unsigned long)); + /* A malloc failure would be harmless. */ + } + } + menuColormap = XCreateColormap(__glutDisplay, __glutRoot, + visual->vinfo.visual, AllocNone); + if (placeHolders) { + /* Again for Sun's Creator graphics, do the actual + read-write place-holder cell allocation. */ + status = XAllocColorCells(__glutDisplay, menuColormap, False, 0, 0, + placeHolders, numPlaceHolders); + if (!status) { + XFreeColormap(__glutDisplay, menuColormap); + free(placeHolders); + continue; + } + } + /* Allocate overlay colormap cells in defined order: + gray, black, white to match the IRIS GL allocation + scheme. Increases likelihood of less overlay + colormap flashing. */ + /* XXX Nice if these 3 AllocColor's could be done in + one protocol round-trip. */ + color.red = color.green = color.blue = 0xaa00; + status = XAllocColor(__glutDisplay, + menuColormap, &color); + if (!status) { + XFreeColormap(__glutDisplay, menuColormap); + if (placeHolders) { + free(placeHolders); + } + continue; + } + menuGray = color.pixel; + color.red = color.green = color.blue = 0x0000; + status = XAllocColor(__glutDisplay, + menuColormap, &color); + if (!status) { + XFreeColormap(__glutDisplay, menuColormap); + if (placeHolders) { + free(placeHolders); + } + continue; + } + menuBlack = color.pixel; + color.red = color.green = color.blue = 0xffff; + status = XAllocColor(__glutDisplay, + menuColormap, &color); + if (!status) { + XFreeColormap(__glutDisplay, menuColormap); + if (placeHolders) { + free(placeHolders); + } + continue; + } + if (placeHolders) { + /* Now free the placeholder cells. */ + XFreeColors(__glutDisplay, menuColormap, + placeHolders, numPlaceHolders, 0); + free(placeHolders); + } + menuWhite = color.pixel; + menuVisual = visual->vinfo.visual; + menuDepth = visual->vinfo.depth; + /* If using overlays, do not request "save unders". */ + useSaveUnders = 0; + XFree(overlayVisuals); + return; + } + } + XFree(overlayVisuals); + } + } + /* Settle for default visual. */ + menuVisual = DefaultVisual(__glutDisplay, __glutScreen); + menuDepth = DefaultDepth(__glutDisplay, __glutScreen); + menuColormap = DefaultColormap(__glutDisplay, __glutScreen); + menuBlack = BlackPixel(__glutDisplay, __glutScreen); + menuWhite = WhitePixel(__glutDisplay, __glutScreen); + color.red = color.green = color.blue = 0xaa00; + noFaultXAllocColor(__glutDisplay, menuColormap, + menuVisual->map_entries, &color); + menuGray = color.pixel; + + /* When no overlays are supported, we would like to use X + "save unders" to avoid exposes to windows obscured by + pop-up menus. However, OpenGL's direct rendering support + means OpenGL interacts poorly with X backing store and + save unders. X servers do not (in implementation + practice) redirect OpenGL rendering destined to obscured + window regions into backing store. + + Implementation solutions exist for this problem, but they + are expensive and high-end OpenGL implementations + typically provide fast rendering and/or overlays to + obviate the problem associated of user interfaces (pop-up + menus) forcing redraws of complex normal plane scenes. + (See support for overlays pop-up menus above.) + + Mesa 3D, however, does not support direct rendering. + Overlays are often unavailable to Mesa, and Mesa is also + relatively slow. For these reasons, Mesa-rendering GLUT + programs can and should use X save unders. + + Look for the GLX extension. If _not_ supported, we are + presumably using Mesa so enable save unders. */ + + presumablyMesa = !XQueryExtension(__glutDisplay, "GLX", + &dummy, &dummy, &dummy); + + if (presumablyMesa) { + useSaveUnders = CWSaveUnder; + } else { + useSaveUnders = 0; + } +} + +static void +menuSetup(void) +{ + if (menuFont) { + /* MenuFont overload to indicate menu initalization. */ + return; + } + menuFont = XLoadQueryFont(__glutDisplay, + "-*-helvetica-bold-o-normal--14-*-*-*-p-*-iso8859-1"); + if (!menuFont) { + /* Try back up font. */ + menuFont = XLoadQueryFont(__glutDisplay, "fixed"); + } + if (!menuFont) { + __glutFatalError("could not load font."); + } + menuVisualSetup(); + fontHeight = menuFont->ascent + menuFont->descent; + menuCursor = XCreateFontCursor(__glutDisplay, XC_arrow); +} + +static void +menuGraphicsContextSetup(Window win) +{ + XGCValues gcvals; + + if (blackGC != None) { + return; + } + gcvals.font = menuFont->fid; + gcvals.foreground = menuBlack; + blackGC = XCreateGC(__glutDisplay, win, + GCFont | GCForeground, &gcvals); + gcvals.foreground = menuGray; + grayGC = XCreateGC(__glutDisplay, win, GCForeground, &gcvals); + gcvals.foreground = menuWhite; + whiteGC = XCreateGC(__glutDisplay, win, GCForeground, &gcvals); +} + +void +__glutSetMenu(GLUTmenu * menu) +{ + __glutCurrentMenu = menu; +} + +static void +unmapMenu(GLUTmenu * menu) +{ + if (menu->cascade) { + unmapMenu(menu->cascade); + menu->cascade = NULL; + } + menu->anchor = NULL; + menu->highlighted = NULL; + XUnmapWindow(__glutDisplay, menu->win); +} + +static void +finishMenu(Window win, int x, int y) +{ + Window dummy; + int rc; + + unmapMenu(__glutMappedMenu); + XUngrabPointer(__glutDisplay, CurrentTime); + + /* Popping up an overlay popup menu will install its own + colormap. If the window associated with the menu has an + overlay, install that window's overlay colormap so the + overlay isn't left using the popup menu's colormap. */ + if (__glutMenuWindow->overlay) { + XInstallColormap(__glutDisplay, + __glutMenuWindow->overlay->colormap->cmap); + } + + /* This XFlush is needed to to make sure the pointer is + really ungrabbed when the application's menu callback is + called. Otherwise, a deadlock might happen because the + application may try to read from an terminal window, but + yet the ungrab hasn't really happened since it hasn't been + flushed out. */ + XFlush(__glutDisplay); + + if (__glutMenuStatusFunc) { + if (win != __glutMenuWindow->win) { + /* The button release may have occurred in a window other + than the window requesting the pop-up menu (for + example, one of the submenu windows). In this case, we + need to translate the coordinates into the coordinate + system of the window associated with the window. */ + rc = XTranslateCoordinates(__glutDisplay, win, __glutMenuWindow->win, + x, y, &x, &y, &dummy); + assert(rc != False); /* Will always be on same screen. */ + } + __glutSetWindow(__glutMenuWindow); + __glutSetMenu(__glutMappedMenu); + + /* Setting __glutMappedMenu to NULL permits operations that + change menus or destroy the menu window again. */ + __glutMappedMenu = NULL; + + __glutMenuStatusFunc(GLUT_MENU_NOT_IN_USE, x, y); + } + /* Setting __glutMappedMenu to NULL permits operations that + change menus or destroy the menu window again. */ + __glutMappedMenu = NULL; + + /* If an item is selected and it is not a submenu trigger, + generate menu callback. */ + if (__glutItemSelected && !__glutItemSelected->isTrigger) { + __glutSetWindow(__glutMenuWindow); + /* When menu callback is triggered, current menu should be + set to the callback menu. */ + __glutSetMenu(__glutItemSelected->menu); + __glutItemSelected->menu->select( + __glutItemSelected->value); + } + __glutMenuWindow = NULL; +} + +#define MENU_BORDER 1 +#define MENU_GAP 2 +#define MENU_ARROW_GAP 6 +#define MENU_ARROW_WIDTH 8 + +static void +mapMenu(GLUTmenu * menu, int x, int y) +{ + XWindowChanges changes; + unsigned int mask; + int subMenuExtension, num; + + /* If there are submenus, we need to provide extra space for + the submenu pull arrow. */ + if (menu->submenus > 0) { + subMenuExtension = MENU_ARROW_GAP + MENU_ARROW_WIDTH; + } else { + subMenuExtension = 0; + } + + changes.stack_mode = Above; + mask = CWStackMode | CWX | CWY; + /* If the menu isn't managed (ie, validated so all the + InputOnly subwindows are the right size), do so. */ + if (!menu->managed) { + GLUTmenuItem *item; + + item = menu->list; + num = menu->num; + while (item) { + XWindowChanges itemupdate; + + itemupdate.y = (num - 1) * fontHeight + MENU_GAP; + itemupdate.width = menu->pixwidth; + itemupdate.width += subMenuExtension; + XConfigureWindow(__glutDisplay, item->win, + CWWidth | CWY, &itemupdate); + item = item->next; + num--; + } + menu->pixheight = MENU_GAP + + fontHeight * menu->num + MENU_GAP; + changes.height = menu->pixheight; + changes.width = MENU_GAP + + menu->pixwidth + subMenuExtension + MENU_GAP; + mask |= CWWidth | CWHeight; + menu->managed = True; + } + /* Make sure menu appears fully on screen. */ + if (y + menu->pixheight >= __glutScreenHeight) { + changes.y = __glutScreenHeight - menu->pixheight; + } else { + changes.y = y; + } + if (x + menu->pixwidth + subMenuExtension >= + __glutScreenWidth) { + changes.x = __glutScreenWidth - + menu->pixwidth + subMenuExtension; + } else { + changes.x = x; + } + + /* Rember where the menu is placed so submenus can be + properly placed relative to it. */ + menu->x = changes.x; + menu->y = changes.y; + + XConfigureWindow(__glutDisplay, menu->win, mask, &changes); + XInstallColormap(__glutDisplay, menuColormap); + /* XXX The XRaiseWindow below should not be necessary because + the XConfigureWindow requests an Above stack mode (same as + XRaiseWindow), but some Sun users complained this was still + necessary. Probably some window manager or X server bug on + these machines?? */ + XRaiseWindow(__glutDisplay, menu->win); + XMapWindow(__glutDisplay, menu->win); +} + +static void +startMenu(GLUTmenu * menu, GLUTwindow * window, + int x, int y, int x_win, int y_win) +{ + int grab; + + assert(__glutMappedMenu == NULL); + grab = XGrabPointer(__glutDisplay, __glutRoot, True, + ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, + __glutRoot, menuCursor, CurrentTime); + if (grab != GrabSuccess) { + /* Somebody else has pointer grabbed, ignore menu + activation. */ + return; + } + __glutMappedMenu = menu; + __glutMenuWindow = window; + __glutItemSelected = NULL; + if (__glutMenuStatusFunc) { + __glutSetMenu(menu); + __glutSetWindow(window); + __glutMenuStatusFunc(GLUT_MENU_IN_USE, x_win, y_win); + } + mapMenu(menu, x, y); +} + +static void +paintSubMenuArrow(Window win, int x, int y) +{ + XPoint p[5]; + + p[0].x = p[4].x = x; + p[0].y = p[4].y = y - menuFont->ascent + 1; + p[1].x = p[0].x + MENU_ARROW_WIDTH - 1; + p[1].y = p[0].y + (menuFont->ascent / 2) - 1; + p[2].x = p[1].x; + p[2].y = p[1].y + 1; + p[3].x = p[0].x; + p[3].y = p[0].y + menuFont->ascent - 2; + XFillPolygon(__glutDisplay, win, + whiteGC, p, 4, Convex, CoordModeOrigin); + XDrawLines(__glutDisplay, win, blackGC, p, 5, CoordModeOrigin); +} + +static void +paintMenuItem(GLUTmenuItem * item, int num) +{ + Window win = item->menu->win; + GC gc; + int y; + int subMenuExtension; + + if (item->menu->submenus > 0) { + subMenuExtension = MENU_ARROW_GAP + MENU_ARROW_WIDTH; + } else { + subMenuExtension = 0; + } + if (item->menu->highlighted == item) { + gc = whiteGC; + } else { + gc = grayGC; + } + y = MENU_GAP + fontHeight * num - menuFont->descent; + XFillRectangle(__glutDisplay, win, gc, + MENU_GAP, y - fontHeight + menuFont->descent, + item->menu->pixwidth + subMenuExtension, fontHeight); + XDrawString(__glutDisplay, win, blackGC, + MENU_GAP, y, item->label, item->len); + if (item->isTrigger) { + paintSubMenuArrow(win, + item->menu->pixwidth + MENU_ARROW_GAP + 1, y); + } +} + +static void +paintMenu(GLUTmenu * menu) +{ + GLUTmenuItem *item; + int i = menu->num; + int y = MENU_GAP + fontHeight * i - menuFont->descent; + + item = menu->list; + while (item) { + if (item->menu->highlighted == item) { + paintMenuItem(item, i); + } else { + /* Quick render of the menu item; assume background + already cleared to gray. */ + XDrawString(__glutDisplay, menu->win, blackGC, + 2, y, item->label, item->len); + if (item->isTrigger) { + paintSubMenuArrow(menu->win, + menu->pixwidth + MENU_ARROW_GAP + 1, y); + } + } + i--; + y -= fontHeight; + item = item->next; + } +} + +static GLUTmenuItem * +getMenuItem(GLUTmenu * menu, Window win, int *which) +{ + GLUTmenuItem *item; + int i; + + if (menu->searched) { + __glutFatalError("submenu infinite loop detected"); + } + menu->searched = True; + i = menu->num; + item = menu->list; + while (item) { + if (item->win == win) { + *which = i; + menu->searched = False; + return item; + } + if (item->isTrigger) { + GLUTmenuItem *subitem; + + subitem = __glutGetMenuItem(__glutMenuList[item->value], + win, which); + if (subitem) { + menu->searched = False; + return subitem; + } + } + i--; + item = item->next; + } + menu->searched = False; + return NULL; +} + +static int +getMenuItemIndex(GLUTmenuItem * item) +{ + int count = 0; + + while (item) { + count++; + item = item->next; + } + return count; +} + +static GLUTmenu * +getMenu(Window win) +{ + GLUTmenu *menu; + + menu = __glutMappedMenu; + while (menu) { + if (win == menu->win) { + return menu; + } + menu = menu->cascade; + } + return NULL; +} + +static GLUTmenu * +getMenuByNum(int menunum) +{ + if (menunum < 1 || menunum > menuListSize) { + return NULL; + } + return __glutMenuList[menunum - 1]; +} + +static int +getUnusedMenuSlot(void) +{ + int i; + + /* Look for allocated, unused slot. */ + for (i = 0; i < menuListSize; i++) { + if (!__glutMenuList[i]) { + return i; + } + } + /* Allocate a new slot. */ + menuListSize++; + if (__glutMenuList) { + __glutMenuList = (GLUTmenu **) + realloc(__glutMenuList, menuListSize * sizeof(GLUTmenu *)); + } else { + /* XXX Some realloc's do not correctly perform a malloc + when asked to perform a realloc on a NULL pointer, + though the ANSI C library spec requires this. */ + __glutMenuList = (GLUTmenu **) malloc(sizeof(GLUTmenu *)); + } + if (!__glutMenuList) { + __glutFatalError("out of memory."); + } + __glutMenuList[menuListSize - 1] = NULL; + return menuListSize - 1; +} + +void +__glutMenuModificationError(void) +{ + /* XXX Remove the warning after GLUT 3.0. */ + __glutWarning("The following is a new check for GLUT 3.0; update your code."); + __glutFatalError("menu manipulation not allowed while menus in use."); +} + + +static void +menuItemEnterOrLeave(GLUTmenuItem * item, + int num, int type) +{ + int alreadyUp = 0; + + if (type == EnterNotify) { + GLUTmenuItem *prevItem = item->menu->highlighted; + + if (prevItem && prevItem != item) { + /* If there's an already higlighted item in this menu + that is different from this one (we could be + re-entering an item with an already cascaded + submenu!), unhighlight the previous item. */ + item->menu->highlighted = NULL; + paintMenuItem(prevItem, getMenuItemIndex(prevItem)); + } + item->menu->highlighted = item; + __glutItemSelected = item; + if (item->menu->cascade) { + if (!item->isTrigger) { + /* Entered a menu item that is not a submenu trigger, + so pop down the current submenu cascade of this + menu. */ + unmapMenu(item->menu->cascade); + item->menu->cascade = NULL; + } else { + GLUTmenu *submenu = __glutMenuList[item->value]; + + if (submenu->anchor == item) { + /* We entered the submenu trigger for the submenu + that is already up, so don't take down the + submenu. */ + alreadyUp = 1; + } else { + /* Submenu already popped up for some other submenu + item of this menu; need to pop down that other + submenu cascade. */ + unmapMenu(item->menu->cascade); + item->menu->cascade = NULL; + } + } + } + if (!alreadyUp) { + /* Make sure the menu item gets painted with + highlighting. */ + paintMenuItem(item, num); + } else { + /* If already up, should already be highlighted. */ + } + } else { + /* LeaveNotify: Handle leaving a menu item... */ + if (item->menu->cascade && + item->menu->cascade->anchor == item) { + /* If there is a submenu casacaded from this item, do not + change the highlighting on this item upon leaving. */ + } else { + /* Unhighlight this menu item. */ + item->menu->highlighted = NULL; + paintMenuItem(item, num); + } + __glutItemSelected = NULL; + } + if (item->isTrigger) { + if (type == EnterNotify && !alreadyUp) { + GLUTmenu *submenu = __glutMenuList[item->value]; + + mapMenu(submenu, + item->menu->x + item->menu->pixwidth + + MENU_ARROW_GAP + MENU_ARROW_WIDTH + + MENU_GAP + MENU_BORDER, + item->menu->y + fontHeight * (num - 1) + MENU_GAP); + item->menu->cascade = submenu; + submenu->anchor = item; + } + } +} + +/* Installs callback functions for use by glut_event.c The point + of this is so that GLUT's menu code only gets linked into + GLUT binaries (assuming a static library) if the GLUT menu + API is used. */ +static void +installMenuCallbacks(void) +{ + __glutMenuItemEnterOrLeave = menuItemEnterOrLeave; + __glutFinishMenu = finishMenu; + __glutPaintMenu = paintMenu; + __glutStartMenu = startMenu; + __glutGetMenuByNum = getMenuByNum; + __glutGetMenu = getMenu; + __glutGetMenuItem = getMenuItem; +} + +int APIENTRY +glutCreateMenu(GLUTselectCB selectFunc) +{ + XSetWindowAttributes wa; + GLUTmenu *menu; + int menuid; + + if (__glutMappedMenu) { + __glutMenuModificationError(); + } + if (!__glutDisplay) { + __glutOpenXConnection(NULL); + } + + installMenuCallbacks(); + + menuid = getUnusedMenuSlot(); + menu = (GLUTmenu *) malloc(sizeof(GLUTmenu)); + if (!menu) { + __glutFatalError("out of memory."); + } + menu->id = menuid; + menu->num = 0; + menu->submenus = 0; + menu->managed = False; + menu->searched = False; + menu->pixwidth = 0; + menu->select = selectFunc; + menu->list = NULL; + menu->cascade = NULL; + menu->highlighted = NULL; + menu->anchor = NULL; + menuSetup(); + wa.override_redirect = True; + wa.background_pixel = menuGray; + wa.border_pixel = menuBlack; + wa.colormap = menuColormap; + wa.event_mask = StructureNotifyMask | ExposureMask | + ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask; + /* Save unders really only enabled if useSaveUnders is set to + CWSaveUnder, ie. using Mesa 3D. See earlier comments. */ + wa.save_under = True; + menu->win = XCreateWindow(__glutDisplay, __glutRoot, + /* Real position determined when mapped. */ + 0, 0, + /* Real size will be determined when menu is manged. */ + 1, 1, + MENU_BORDER, menuDepth, InputOutput, menuVisual, + CWOverrideRedirect | CWBackPixel | CWBorderPixel | + CWEventMask | CWColormap | useSaveUnders, + &wa); + menuGraphicsContextSetup(menu->win); + __glutMenuList[menuid] = menu; + __glutSetMenu(menu); + return menuid + 1; +} + +/* CENTRY */ +int APIENTRY +glutGetMenu(void) +{ + if (__glutCurrentMenu) { + return __glutCurrentMenu->id + 1; + } else { + return 0; + } +} + +void APIENTRY +glutSetMenu(int menuid) +{ + GLUTmenu *menu; + + if (menuid < 1 || menuid > menuListSize) { + __glutWarning("glutSetMenu attempted on bogus menu."); + return; + } + menu = __glutMenuList[menuid - 1]; + if (!menu) { + __glutWarning("glutSetMenu attempted on bogus menu."); + return; + } + __glutSetMenu(menu); +} +/* ENDCENTRY */ + +void +__glutSetMenuItem(GLUTmenuItem * item, const char *label, + int value, Bool isTrigger) +{ + GLUTmenu *menu; + + menu = item->menu; + item->label = __glutStrdup(label); + if (!item->label) { + __glutFatalError("out of memory."); + } + item->isTrigger = isTrigger; + item->len = (int) strlen(label); + item->value = value; + item->pixwidth = XTextWidth(menuFont, label, item->len) + 4; + if (item->pixwidth > menu->pixwidth) { + menu->pixwidth = item->pixwidth; + } + menu->managed = False; +} + +/* CENTRY */ +void APIENTRY +glutAddMenuEntry(const char *label, int value) +{ + XSetWindowAttributes wa; + GLUTmenuItem *entry; + + if (__glutMappedMenu) { + __glutMenuModificationError(); + } + entry = (GLUTmenuItem *) malloc(sizeof(GLUTmenuItem)); + if (!entry) { + __glutFatalError("out of memory."); + } + entry->menu = __glutCurrentMenu; + __glutSetMenuItem(entry, label, value, False); + wa.event_mask = EnterWindowMask | LeaveWindowMask; + entry->win = XCreateWindow(__glutDisplay, + __glutCurrentMenu->win, MENU_GAP, + __glutCurrentMenu->num * fontHeight + MENU_GAP, /* x & y */ + entry->pixwidth, fontHeight, /* width & height */ + 0, CopyFromParent, InputOnly, CopyFromParent, + CWEventMask, &wa); + XMapWindow(__glutDisplay, entry->win); + __glutCurrentMenu->num++; + entry->next = __glutCurrentMenu->list; + __glutCurrentMenu->list = entry; +} + +void APIENTRY +glutAddSubMenu(const char *label, int menu) +{ + XSetWindowAttributes wa; + GLUTmenuItem *submenu; + + if (__glutMappedMenu) { + __glutMenuModificationError(); + } + submenu = (GLUTmenuItem *) malloc(sizeof(GLUTmenuItem)); + if (!submenu) { + __glutFatalError("out of memory."); + } + __glutCurrentMenu->submenus++; + submenu->menu = __glutCurrentMenu; + __glutSetMenuItem(submenu, label, /* base 0 */ menu - 1, True); + wa.event_mask = EnterWindowMask | LeaveWindowMask; + submenu->win = XCreateWindow(__glutDisplay, + __glutCurrentMenu->win, MENU_GAP, + __glutCurrentMenu->num * fontHeight + MENU_GAP, /* x & y */ + submenu->pixwidth, fontHeight, /* width & height */ + 0, CopyFromParent, InputOnly, CopyFromParent, + CWEventMask, &wa); + XMapWindow(__glutDisplay, submenu->win); + __glutCurrentMenu->num++; + submenu->next = __glutCurrentMenu->list; + __glutCurrentMenu->list = submenu; +} + +void APIENTRY +glutAttachMenu(int button) +{ + if (__glutMappedMenu) { + __glutMenuModificationError(); + } + installMenuCallbacks(); + if (__glutCurrentWindow->menu[button] < 1) { + __glutCurrentWindow->buttonUses++; + } + __glutChangeWindowEventMask( + ButtonPressMask | ButtonReleaseMask, True); + __glutCurrentWindow->menu[button] = __glutCurrentMenu->id + 1; +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_menu2.c b/xc/extras/Mesa/src-glut/glut_menu2.c new file mode 100644 index 000000000..93119b540 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_menu2.c @@ -0,0 +1,185 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* 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. */ + +/* glut_menu2.c implements the little used GLUT menu calls in + a distinct file from glut_menu.c for slim static linking. */ + +/* The Win32 GLUT file win32_menu.c completely re-implements all + the menuing functionality implemented. This file is used only by + the X Window System version of GLUT. */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> +#include <assert.h> + +#include <X11/Xlib.h> + +#include "glutint.h" +#include "layerutil.h" + +/* CENTRY */ +/* DEPRICATED, use glutMenuStatusFunc instead. */ +void APIENTRY +glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) +{ + __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; +} + +void APIENTRY +glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) +{ + __glutMenuStatusFunc = menuStatusFunc; +} + +void APIENTRY +glutDestroyMenu(int menunum) +{ + GLUTmenu *menu = __glutGetMenuByNum(menunum); + GLUTmenuItem *item, *next; + + if (__glutMappedMenu) + __glutMenuModificationError(); + assert(menu->id == menunum - 1); + XDestroySubwindows(__glutDisplay, menu->win); + XDestroyWindow(__glutDisplay, menu->win); + __glutMenuList[menunum - 1] = NULL; + /* free all menu entries */ + item = menu->list; + while (item) { + assert(item->menu == menu); + next = item->next; + free(item->label); + free(item); + item = next; + } + if (__glutCurrentMenu == menu) { + __glutCurrentMenu = NULL; + } + free(menu); +} + +void APIENTRY +glutChangeToMenuEntry(int num, const char *label, int value) +{ + GLUTmenuItem *item; + int i; + + if (__glutMappedMenu) + __glutMenuModificationError(); + i = __glutCurrentMenu->num; + item = __glutCurrentMenu->list; + while (item) { + if (i == num) { + if (item->isTrigger) { + /* If changing a submenu trigger to a menu entry, we + need to account for submenus. */ + item->menu->submenus--; + } + free(item->label); + __glutSetMenuItem(item, label, value, False); + return; + } + i--; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +void APIENTRY +glutChangeToSubMenu(int num, const char *label, int menu) +{ + GLUTmenuItem *item; + int i; + + if (__glutMappedMenu) + __glutMenuModificationError(); + i = __glutCurrentMenu->num; + item = __glutCurrentMenu->list; + while (item) { + if (i == num) { + if (!item->isTrigger) { + /* If changing a menu entry to as submenu trigger, we + need to account for submenus. */ + item->menu->submenus++; + } + free(item->label); + __glutSetMenuItem(item, label, /* base 0 */ menu - 1, True); + return; + } + i--; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +void APIENTRY +glutRemoveMenuItem(int num) +{ + GLUTmenuItem *item, **prev, *remaining; + int pixwidth, i; + + if (__glutMappedMenu) + __glutMenuModificationError(); + i = __glutCurrentMenu->num; + prev = &__glutCurrentMenu->list; + item = __glutCurrentMenu->list; + /* If menu item is removed, the menu's pixwidth may need to + be recomputed. */ + pixwidth = 1; + while (item) { + if (i == num) { + /* If this menu item's pixwidth is as wide as the menu's + pixwidth, removing this menu item will necessitate + shrinking the menu's pixwidth. */ + if (item->pixwidth >= __glutCurrentMenu->pixwidth) { + /* Continue recalculating menu pixwidth, first skipping + the removed item. */ + remaining = item->next; + while (remaining) { + if (remaining->pixwidth > pixwidth) { + pixwidth = remaining->pixwidth; + } + remaining = remaining->next; + } + __glutCurrentMenu->pixwidth = pixwidth; + } + __glutCurrentMenu->num--; + __glutCurrentMenu->managed = False; + + /* Patch up menu's item list. */ + *prev = item->next; + + free(item->label); + free(item); + return; + } + if (item->pixwidth > pixwidth) { + pixwidth = item->pixwidth; + } + i--; + prev = &item->next; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +void APIENTRY +glutDetachMenu(int button) +{ + if (__glutMappedMenu) + __glutMenuModificationError(); + if (__glutCurrentWindow->menu[button] > 0) { + __glutCurrentWindow->buttonUses--; + __glutChangeWindowEventMask(ButtonPressMask | ButtonReleaseMask, + __glutCurrentWindow->buttonUses > 0); + __glutCurrentWindow->menu[button] = 0; + } +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_mesa.c b/xc/extras/Mesa/src-glut/glut_mesa.c new file mode 100644 index 000000000..7e202fa07 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_mesa.c @@ -0,0 +1,57 @@ + +/* Copyright (c) Mark J. Kilgard, 1996. */ + +/* 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 <stdlib.h> +#include <string.h> +#include "glutint.h" + +int __glutMesaSwapHackSupport = 0; /* Not supported until + proven otherwise. */ + +/* Use the "Mesa swap hack" if reasonable if and only if + MESA_SWAP_HACK is set to something whose first character is + not "N" or "n" AND "Brian Paul" is the vendor string AND + "Mesa X11"* (or "Mesa" for backward compatibility) is the + renderer string. + + Anyone who modifies Mesa so that glXSwapBuffers does not + simply blit the previously rendered back buffer should + change either their vendor or renderer string to avoid + confusing GLUT. */ + +void +__glutDetermineMesaSwapHackSupport(void) +{ + static int doneAlready = 0; + char *env, *vendor, *renderer; + + if (doneAlready) + return; + env = getenv("MESA_SWAP_HACK"); + if (env) { + if ((env[0] != 'n') && (env[0] != 'N')) { + vendor = (char *) glGetString(GL_VENDOR); + renderer = (char *) glGetString(GL_RENDERER); + + /* Old versions of X11 Mesa uses the renderer string + "Mesa"; Brian plans to start using "Mesa X11" to + distinguish the X version of Mesa from other flavor + such as Windows or 3Dfx. */ + +#define MESA_X11 "Mesa X11" + + /* XXX At some point in the future, eliminate the + backward compatibility for the old "Mesa" renderer + string. */ + + if (!strcmp(vendor, "Brian Paul") && (!strcmp(renderer, "Mesa") || + !strncmp(renderer, MESA_X11, sizeof(MESA_X11) - 1))) + __glutMesaSwapHackSupport = 1; + } + } + doneAlready = 1; +} diff --git a/xc/extras/Mesa/src-glut/glut_modifier.c b/xc/extras/Mesa/src-glut/glut_modifier.c new file mode 100644 index 000000000..d2919fa89 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_modifier.c @@ -0,0 +1,31 @@ + +/* 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 "glutint.h" + +/* CENTRY */ +int APIENTRY +glutGetModifiers(void) +{ + int modifiers; + + if(__glutModifierMask == (unsigned int) ~0) { + __glutWarning( + "glutCurrentModifiers: do not call outside core input callback."); + return 0; + } + modifiers = 0; + if(__glutModifierMask & (ShiftMask|LockMask)) + modifiers |= GLUT_ACTIVE_SHIFT; + if(__glutModifierMask & ControlMask) + modifiers |= GLUT_ACTIVE_CTRL; + if(__glutModifierMask & Mod1Mask) + modifiers |= GLUT_ACTIVE_ALT; + return modifiers; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_mroman.c b/xc/extras/Mesa/src-glut/glut_mroman.c new file mode 100644 index 000000000..a29f043b4 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_mroman.c @@ -0,0 +1,2451 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutstroke.h" + +/* char: 33 '!' */ + +static const CoordRec char33_stroke0[] = { + { 52.381, 100 }, + { 52.381, 33.3333 }, +}; + +static const CoordRec char33_stroke1[] = { + { 52.381, 9.5238 }, + { 47.6191, 4.7619 }, + { 52.381, 0 }, + { 57.1429, 4.7619 }, + { 52.381, 9.5238 }, +}; + +static const StrokeRec char33[] = { + { 2, char33_stroke0 }, + { 5, char33_stroke1 }, +}; + +/* char: 34 '"' */ + +static const CoordRec char34_stroke0[] = { + { 33.3334, 100 }, + { 33.3334, 66.6667 }, +}; + +static const CoordRec char34_stroke1[] = { + { 71.4286, 100 }, + { 71.4286, 66.6667 }, +}; + +static const StrokeRec char34[] = { + { 2, char34_stroke0 }, + { 2, char34_stroke1 }, +}; + +/* char: 35 '#' */ + +static const CoordRec char35_stroke0[] = { + { 54.7619, 119.048 }, + { 21.4286, -33.3333 }, +}; + +static const CoordRec char35_stroke1[] = { + { 83.3334, 119.048 }, + { 50, -33.3333 }, +}; + +static const CoordRec char35_stroke2[] = { + { 21.4286, 57.1429 }, + { 88.0952, 57.1429 }, +}; + +static const CoordRec char35_stroke3[] = { + { 16.6667, 28.5714 }, + { 83.3334, 28.5714 }, +}; + +static const StrokeRec char35[] = { + { 2, char35_stroke0 }, + { 2, char35_stroke1 }, + { 2, char35_stroke2 }, + { 2, char35_stroke3 }, +}; + +/* char: 36 '$' */ + +static const CoordRec char36_stroke0[] = { + { 42.8571, 119.048 }, + { 42.8571, -19.0476 }, +}; + +static const CoordRec char36_stroke1[] = { + { 61.9047, 119.048 }, + { 61.9047, -19.0476 }, +}; + +static const CoordRec char36_stroke2[] = { + { 85.7143, 85.7143 }, + { 76.1905, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, + { 28.5714, 95.2381 }, + { 19.0476, 85.7143 }, + { 19.0476, 76.1905 }, + { 23.8095, 66.6667 }, + { 28.5714, 61.9048 }, + { 38.0952, 57.1429 }, + { 66.6666, 47.619 }, + { 76.1905, 42.8571 }, + { 80.9524, 38.0952 }, + { 85.7143, 28.5714 }, + { 85.7143, 14.2857 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 19.0476, 14.2857 }, +}; + +static const StrokeRec char36[] = { + { 2, char36_stroke0 }, + { 2, char36_stroke1 }, + { 20, char36_stroke2 }, +}; + +/* char: 37 '%' */ + +static const CoordRec char37_stroke0[] = { + { 95.2381, 100 }, + { 9.5238, 0 }, +}; + +static const CoordRec char37_stroke1[] = { + { 33.3333, 100 }, + { 42.8571, 90.4762 }, + { 42.8571, 80.9524 }, + { 38.0952, 71.4286 }, + { 28.5714, 66.6667 }, + { 19.0476, 66.6667 }, + { 9.5238, 76.1905 }, + { 9.5238, 85.7143 }, + { 14.2857, 95.2381 }, + { 23.8095, 100 }, + { 33.3333, 100 }, + { 42.8571, 95.2381 }, + { 57.1428, 90.4762 }, + { 71.4286, 90.4762 }, + { 85.7143, 95.2381 }, + { 95.2381, 100 }, +}; + +static const CoordRec char37_stroke2[] = { + { 76.1905, 33.3333 }, + { 66.6667, 28.5714 }, + { 61.9048, 19.0476 }, + { 61.9048, 9.5238 }, + { 71.4286, 0 }, + { 80.9524, 0 }, + { 90.4762, 4.7619 }, + { 95.2381, 14.2857 }, + { 95.2381, 23.8095 }, + { 85.7143, 33.3333 }, + { 76.1905, 33.3333 }, +}; + +static const StrokeRec char37[] = { + { 2, char37_stroke0 }, + { 16, char37_stroke1 }, + { 11, char37_stroke2 }, +}; + +/* char: 38 '&' */ + +static const CoordRec char38_stroke0[] = { + { 100, 57.1429 }, + { 100, 61.9048 }, + { 95.2381, 66.6667 }, + { 90.4762, 66.6667 }, + { 85.7143, 61.9048 }, + { 80.9524, 52.381 }, + { 71.4286, 28.5714 }, + { 61.9048, 14.2857 }, + { 52.3809, 4.7619 }, + { 42.8571, 0 }, + { 23.8095, 0 }, + { 14.2857, 4.7619 }, + { 9.5238, 9.5238 }, + { 4.7619, 19.0476 }, + { 4.7619, 28.5714 }, + { 9.5238, 38.0952 }, + { 14.2857, 42.8571 }, + { 47.619, 61.9048 }, + { 52.3809, 66.6667 }, + { 57.1429, 76.1905 }, + { 57.1429, 85.7143 }, + { 52.3809, 95.2381 }, + { 42.8571, 100 }, + { 33.3333, 95.2381 }, + { 28.5714, 85.7143 }, + { 28.5714, 76.1905 }, + { 33.3333, 61.9048 }, + { 42.8571, 47.619 }, + { 66.6667, 14.2857 }, + { 76.1905, 4.7619 }, + { 85.7143, 0 }, + { 95.2381, 0 }, + { 100, 4.7619 }, + { 100, 9.5238 }, +}; + +static const StrokeRec char38[] = { + { 34, char38_stroke0 }, +}; + +/* char: 39 ''' */ + +static const CoordRec char39_stroke0[] = { + { 52.381, 100 }, + { 52.381, 66.6667 }, +}; + +static const StrokeRec char39[] = { + { 2, char39_stroke0 }, +}; + +/* char: 40 '(' */ + +static const CoordRec char40_stroke0[] = { + { 69.0476, 119.048 }, + { 59.5238, 109.524 }, + { 50, 95.2381 }, + { 40.4762, 76.1905 }, + { 35.7143, 52.381 }, + { 35.7143, 33.3333 }, + { 40.4762, 9.5238 }, + { 50, -9.5238 }, + { 59.5238, -23.8095 }, + { 69.0476, -33.3333 }, +}; + +static const StrokeRec char40[] = { + { 10, char40_stroke0 }, +}; + +/* char: 41 ')' */ + +static const CoordRec char41_stroke0[] = { + { 35.7143, 119.048 }, + { 45.2381, 109.524 }, + { 54.7619, 95.2381 }, + { 64.2857, 76.1905 }, + { 69.0476, 52.381 }, + { 69.0476, 33.3333 }, + { 64.2857, 9.5238 }, + { 54.7619, -9.5238 }, + { 45.2381, -23.8095 }, + { 35.7143, -33.3333 }, +}; + +static const StrokeRec char41[] = { + { 10, char41_stroke0 }, +}; + +/* char: 42 '*' */ + +static const CoordRec char42_stroke0[] = { + { 52.381, 71.4286 }, + { 52.381, 14.2857 }, +}; + +static const CoordRec char42_stroke1[] = { + { 28.5715, 57.1429 }, + { 76.1905, 28.5714 }, +}; + +static const CoordRec char42_stroke2[] = { + { 76.1905, 57.1429 }, + { 28.5715, 28.5714 }, +}; + +static const StrokeRec char42[] = { + { 2, char42_stroke0 }, + { 2, char42_stroke1 }, + { 2, char42_stroke2 }, +}; + +/* char: 43 '+' */ + +static const CoordRec char43_stroke0[] = { + { 52.3809, 85.7143 }, + { 52.3809, 0 }, +}; + +static const CoordRec char43_stroke1[] = { + { 9.5238, 42.8571 }, + { 95.2381, 42.8571 }, +}; + +static const StrokeRec char43[] = { + { 2, char43_stroke0 }, + { 2, char43_stroke1 }, +}; + +/* char: 44 ',' */ + +static const CoordRec char44_stroke0[] = { + { 57.1429, 4.7619 }, + { 52.381, 0 }, + { 47.6191, 4.7619 }, + { 52.381, 9.5238 }, + { 57.1429, 4.7619 }, + { 57.1429, -4.7619 }, + { 52.381, -14.2857 }, + { 47.6191, -19.0476 }, +}; + +static const StrokeRec char44[] = { + { 8, char44_stroke0 }, +}; + +/* char: 45 '-' */ + +static const CoordRec char45_stroke0[] = { + { 9.5238, 42.8571 }, + { 95.2381, 42.8571 }, +}; + +static const StrokeRec char45[] = { + { 2, char45_stroke0 }, +}; + +/* char: 46 '.' */ + +static const CoordRec char46_stroke0[] = { + { 52.381, 9.5238 }, + { 47.6191, 4.7619 }, + { 52.381, 0 }, + { 57.1429, 4.7619 }, + { 52.381, 9.5238 }, +}; + +static const StrokeRec char46[] = { + { 5, char46_stroke0 }, +}; + +/* char: 47 '/' */ + +static const CoordRec char47_stroke0[] = { + { 19.0476, -14.2857 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char47[] = { + { 2, char47_stroke0 }, +}; + +/* char: 48 '0' */ + +static const CoordRec char48_stroke0[] = { + { 47.619, 100 }, + { 33.3333, 95.2381 }, + { 23.8095, 80.9524 }, + { 19.0476, 57.1429 }, + { 19.0476, 42.8571 }, + { 23.8095, 19.0476 }, + { 33.3333, 4.7619 }, + { 47.619, 0 }, + { 57.1428, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 19.0476 }, + { 85.7143, 42.8571 }, + { 85.7143, 57.1429 }, + { 80.9524, 80.9524 }, + { 71.4286, 95.2381 }, + { 57.1428, 100 }, + { 47.619, 100 }, +}; + +static const StrokeRec char48[] = { + { 17, char48_stroke0 }, +}; + +/* char: 49 '1' */ + +static const CoordRec char49_stroke0[] = { + { 40.4762, 80.9524 }, + { 50, 85.7143 }, + { 64.2857, 100 }, + { 64.2857, 0 }, +}; + +static const StrokeRec char49[] = { + { 4, char49_stroke0 }, +}; + +/* char: 50 '2' */ + +static const CoordRec char50_stroke0[] = { + { 23.8095, 76.1905 }, + { 23.8095, 80.9524 }, + { 28.5714, 90.4762 }, + { 33.3333, 95.2381 }, + { 42.8571, 100 }, + { 61.9047, 100 }, + { 71.4286, 95.2381 }, + { 76.1905, 90.4762 }, + { 80.9524, 80.9524 }, + { 80.9524, 71.4286 }, + { 76.1905, 61.9048 }, + { 66.6666, 47.619 }, + { 19.0476, 0 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char50[] = { + { 14, char50_stroke0 }, +}; + +/* char: 51 '3' */ + +static const CoordRec char51_stroke0[] = { + { 28.5714, 100 }, + { 80.9524, 100 }, + { 52.3809, 61.9048 }, + { 66.6666, 61.9048 }, + { 76.1905, 57.1429 }, + { 80.9524, 52.381 }, + { 85.7143, 38.0952 }, + { 85.7143, 28.5714 }, + { 80.9524, 14.2857 }, + { 71.4286, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 23.8095, 9.5238 }, + { 19.0476, 19.0476 }, +}; + +static const StrokeRec char51[] = { + { 15, char51_stroke0 }, +}; + +/* char: 52 '4' */ + +static const CoordRec char52_stroke0[] = { + { 64.2857, 100 }, + { 16.6667, 33.3333 }, + { 88.0952, 33.3333 }, +}; + +static const CoordRec char52_stroke1[] = { + { 64.2857, 100 }, + { 64.2857, 0 }, +}; + +static const StrokeRec char52[] = { + { 3, char52_stroke0 }, + { 2, char52_stroke1 }, +}; + +/* char: 53 '5' */ + +static const CoordRec char53_stroke0[] = { + { 76.1905, 100 }, + { 28.5714, 100 }, + { 23.8095, 57.1429 }, + { 28.5714, 61.9048 }, + { 42.8571, 66.6667 }, + { 57.1428, 66.6667 }, + { 71.4286, 61.9048 }, + { 80.9524, 52.381 }, + { 85.7143, 38.0952 }, + { 85.7143, 28.5714 }, + { 80.9524, 14.2857 }, + { 71.4286, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 23.8095, 9.5238 }, + { 19.0476, 19.0476 }, +}; + +static const StrokeRec char53[] = { + { 17, char53_stroke0 }, +}; + +/* char: 54 '6' */ + +static const CoordRec char54_stroke0[] = { + { 78.5714, 85.7143 }, + { 73.8096, 95.2381 }, + { 59.5238, 100 }, + { 50, 100 }, + { 35.7143, 95.2381 }, + { 26.1905, 80.9524 }, + { 21.4286, 57.1429 }, + { 21.4286, 33.3333 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 50, 0 }, + { 54.7619, 0 }, + { 69.0476, 4.7619 }, + { 78.5714, 14.2857 }, + { 83.3334, 28.5714 }, + { 83.3334, 33.3333 }, + { 78.5714, 47.619 }, + { 69.0476, 57.1429 }, + { 54.7619, 61.9048 }, + { 50, 61.9048 }, + { 35.7143, 57.1429 }, + { 26.1905, 47.619 }, + { 21.4286, 33.3333 }, +}; + +static const StrokeRec char54[] = { + { 23, char54_stroke0 }, +}; + +/* char: 55 '7' */ + +static const CoordRec char55_stroke0[] = { + { 85.7143, 100 }, + { 38.0952, 0 }, +}; + +static const CoordRec char55_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char55[] = { + { 2, char55_stroke0 }, + { 2, char55_stroke1 }, +}; + +/* char: 56 '8' */ + +static const CoordRec char56_stroke0[] = { + { 42.8571, 100 }, + { 28.5714, 95.2381 }, + { 23.8095, 85.7143 }, + { 23.8095, 76.1905 }, + { 28.5714, 66.6667 }, + { 38.0952, 61.9048 }, + { 57.1428, 57.1429 }, + { 71.4286, 52.381 }, + { 80.9524, 42.8571 }, + { 85.7143, 33.3333 }, + { 85.7143, 19.0476 }, + { 80.9524, 9.5238 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 23.8095, 9.5238 }, + { 19.0476, 19.0476 }, + { 19.0476, 33.3333 }, + { 23.8095, 42.8571 }, + { 33.3333, 52.381 }, + { 47.619, 57.1429 }, + { 66.6666, 61.9048 }, + { 76.1905, 66.6667 }, + { 80.9524, 76.1905 }, + { 80.9524, 85.7143 }, + { 76.1905, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, +}; + +static const StrokeRec char56[] = { + { 29, char56_stroke0 }, +}; + +/* char: 57 '9' */ + +static const CoordRec char57_stroke0[] = { + { 83.3334, 66.6667 }, + { 78.5714, 52.381 }, + { 69.0476, 42.8571 }, + { 54.7619, 38.0952 }, + { 50, 38.0952 }, + { 35.7143, 42.8571 }, + { 26.1905, 52.381 }, + { 21.4286, 66.6667 }, + { 21.4286, 71.4286 }, + { 26.1905, 85.7143 }, + { 35.7143, 95.2381 }, + { 50, 100 }, + { 54.7619, 100 }, + { 69.0476, 95.2381 }, + { 78.5714, 85.7143 }, + { 83.3334, 66.6667 }, + { 83.3334, 42.8571 }, + { 78.5714, 19.0476 }, + { 69.0476, 4.7619 }, + { 54.7619, 0 }, + { 45.2381, 0 }, + { 30.9524, 4.7619 }, + { 26.1905, 14.2857 }, +}; + +static const StrokeRec char57[] = { + { 23, char57_stroke0 }, +}; + +/* char: 58 ':' */ + +static const CoordRec char58_stroke0[] = { + { 52.381, 66.6667 }, + { 47.6191, 61.9048 }, + { 52.381, 57.1429 }, + { 57.1429, 61.9048 }, + { 52.381, 66.6667 }, +}; + +static const CoordRec char58_stroke1[] = { + { 52.381, 9.5238 }, + { 47.6191, 4.7619 }, + { 52.381, 0 }, + { 57.1429, 4.7619 }, + { 52.381, 9.5238 }, +}; + +static const StrokeRec char58[] = { + { 5, char58_stroke0 }, + { 5, char58_stroke1 }, +}; + +/* char: 59 ';' */ + +static const CoordRec char59_stroke0[] = { + { 52.381, 66.6667 }, + { 47.6191, 61.9048 }, + { 52.381, 57.1429 }, + { 57.1429, 61.9048 }, + { 52.381, 66.6667 }, +}; + +static const CoordRec char59_stroke1[] = { + { 57.1429, 4.7619 }, + { 52.381, 0 }, + { 47.6191, 4.7619 }, + { 52.381, 9.5238 }, + { 57.1429, 4.7619 }, + { 57.1429, -4.7619 }, + { 52.381, -14.2857 }, + { 47.6191, -19.0476 }, +}; + +static const StrokeRec char59[] = { + { 5, char59_stroke0 }, + { 8, char59_stroke1 }, +}; + +/* char: 60 '<' */ + +static const CoordRec char60_stroke0[] = { + { 90.4762, 85.7143 }, + { 14.2857, 42.8571 }, + { 90.4762, 0 }, +}; + +static const StrokeRec char60[] = { + { 3, char60_stroke0 }, +}; + +/* char: 61 '=' */ + +static const CoordRec char61_stroke0[] = { + { 9.5238, 57.1429 }, + { 95.2381, 57.1429 }, +}; + +static const CoordRec char61_stroke1[] = { + { 9.5238, 28.5714 }, + { 95.2381, 28.5714 }, +}; + +static const StrokeRec char61[] = { + { 2, char61_stroke0 }, + { 2, char61_stroke1 }, +}; + +/* char: 62 '>' */ + +static const CoordRec char62_stroke0[] = { + { 14.2857, 85.7143 }, + { 90.4762, 42.8571 }, + { 14.2857, 0 }, +}; + +static const StrokeRec char62[] = { + { 3, char62_stroke0 }, +}; + +/* char: 63 '?' */ + +static const CoordRec char63_stroke0[] = { + { 23.8095, 76.1905 }, + { 23.8095, 80.9524 }, + { 28.5714, 90.4762 }, + { 33.3333, 95.2381 }, + { 42.8571, 100 }, + { 61.9047, 100 }, + { 71.4285, 95.2381 }, + { 76.1905, 90.4762 }, + { 80.9524, 80.9524 }, + { 80.9524, 71.4286 }, + { 76.1905, 61.9048 }, + { 71.4285, 57.1429 }, + { 52.3809, 47.619 }, + { 52.3809, 33.3333 }, +}; + +static const CoordRec char63_stroke1[] = { + { 52.3809, 9.5238 }, + { 47.619, 4.7619 }, + { 52.3809, 0 }, + { 57.1428, 4.7619 }, + { 52.3809, 9.5238 }, +}; + +static const StrokeRec char63[] = { + { 14, char63_stroke0 }, + { 5, char63_stroke1 }, +}; + +/* char: 64 '@' */ + +static const CoordRec char64_stroke0[] = { + { 64.2857, 52.381 }, + { 54.7619, 57.1429 }, + { 45.2381, 57.1429 }, + { 40.4762, 47.619 }, + { 40.4762, 42.8571 }, + { 45.2381, 33.3333 }, + { 54.7619, 33.3333 }, + { 64.2857, 38.0952 }, +}; + +static const CoordRec char64_stroke1[] = { + { 64.2857, 57.1429 }, + { 64.2857, 38.0952 }, + { 69.0476, 33.3333 }, + { 78.5714, 33.3333 }, + { 83.3334, 42.8571 }, + { 83.3334, 47.619 }, + { 78.5714, 61.9048 }, + { 69.0476, 71.4286 }, + { 54.7619, 76.1905 }, + { 50, 76.1905 }, + { 35.7143, 71.4286 }, + { 26.1905, 61.9048 }, + { 21.4286, 47.619 }, + { 21.4286, 42.8571 }, + { 26.1905, 28.5714 }, + { 35.7143, 19.0476 }, + { 50, 14.2857 }, + { 54.7619, 14.2857 }, + { 69.0476, 19.0476 }, +}; + +static const StrokeRec char64[] = { + { 8, char64_stroke0 }, + { 19, char64_stroke1 }, +}; + +/* char: 65 'A' */ + +static const CoordRec char65_stroke0[] = { + { 52.3809, 100 }, + { 14.2857, 0 }, +}; + +static const CoordRec char65_stroke1[] = { + { 52.3809, 100 }, + { 90.4762, 0 }, +}; + +static const CoordRec char65_stroke2[] = { + { 28.5714, 33.3333 }, + { 76.1905, 33.3333 }, +}; + +static const StrokeRec char65[] = { + { 2, char65_stroke0 }, + { 2, char65_stroke1 }, + { 2, char65_stroke2 }, +}; + +/* char: 66 'B' */ + +static const CoordRec char66_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char66_stroke1[] = { + { 19.0476, 100 }, + { 61.9047, 100 }, + { 76.1905, 95.2381 }, + { 80.9524, 90.4762 }, + { 85.7143, 80.9524 }, + { 85.7143, 71.4286 }, + { 80.9524, 61.9048 }, + { 76.1905, 57.1429 }, + { 61.9047, 52.381 }, +}; + +static const CoordRec char66_stroke2[] = { + { 19.0476, 52.381 }, + { 61.9047, 52.381 }, + { 76.1905, 47.619 }, + { 80.9524, 42.8571 }, + { 85.7143, 33.3333 }, + { 85.7143, 19.0476 }, + { 80.9524, 9.5238 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 19.0476, 0 }, +}; + +static const StrokeRec char66[] = { + { 2, char66_stroke0 }, + { 9, char66_stroke1 }, + { 10, char66_stroke2 }, +}; + +/* char: 67 'C' */ + +static const CoordRec char67_stroke0[] = { + { 88.0952, 76.1905 }, + { 83.3334, 85.7143 }, + { 73.8096, 95.2381 }, + { 64.2857, 100 }, + { 45.2381, 100 }, + { 35.7143, 95.2381 }, + { 26.1905, 85.7143 }, + { 21.4286, 76.1905 }, + { 16.6667, 61.9048 }, + { 16.6667, 38.0952 }, + { 21.4286, 23.8095 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 45.2381, 0 }, + { 64.2857, 0 }, + { 73.8096, 4.7619 }, + { 83.3334, 14.2857 }, + { 88.0952, 23.8095 }, +}; + +static const StrokeRec char67[] = { + { 18, char67_stroke0 }, +}; + +/* char: 68 'D' */ + +static const CoordRec char68_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char68_stroke1[] = { + { 19.0476, 100 }, + { 52.3809, 100 }, + { 66.6666, 95.2381 }, + { 76.1905, 85.7143 }, + { 80.9524, 76.1905 }, + { 85.7143, 61.9048 }, + { 85.7143, 38.0952 }, + { 80.9524, 23.8095 }, + { 76.1905, 14.2857 }, + { 66.6666, 4.7619 }, + { 52.3809, 0 }, + { 19.0476, 0 }, +}; + +static const StrokeRec char68[] = { + { 2, char68_stroke0 }, + { 12, char68_stroke1 }, +}; + +/* char: 69 'E' */ + +static const CoordRec char69_stroke0[] = { + { 21.4286, 100 }, + { 21.4286, 0 }, +}; + +static const CoordRec char69_stroke1[] = { + { 21.4286, 100 }, + { 83.3334, 100 }, +}; + +static const CoordRec char69_stroke2[] = { + { 21.4286, 52.381 }, + { 59.5238, 52.381 }, +}; + +static const CoordRec char69_stroke3[] = { + { 21.4286, 0 }, + { 83.3334, 0 }, +}; + +static const StrokeRec char69[] = { + { 2, char69_stroke0 }, + { 2, char69_stroke1 }, + { 2, char69_stroke2 }, + { 2, char69_stroke3 }, +}; + +/* char: 70 'F' */ + +static const CoordRec char70_stroke0[] = { + { 21.4286, 100 }, + { 21.4286, 0 }, +}; + +static const CoordRec char70_stroke1[] = { + { 21.4286, 100 }, + { 83.3334, 100 }, +}; + +static const CoordRec char70_stroke2[] = { + { 21.4286, 52.381 }, + { 59.5238, 52.381 }, +}; + +static const StrokeRec char70[] = { + { 2, char70_stroke0 }, + { 2, char70_stroke1 }, + { 2, char70_stroke2 }, +}; + +/* char: 71 'G' */ + +static const CoordRec char71_stroke0[] = { + { 88.0952, 76.1905 }, + { 83.3334, 85.7143 }, + { 73.8096, 95.2381 }, + { 64.2857, 100 }, + { 45.2381, 100 }, + { 35.7143, 95.2381 }, + { 26.1905, 85.7143 }, + { 21.4286, 76.1905 }, + { 16.6667, 61.9048 }, + { 16.6667, 38.0952 }, + { 21.4286, 23.8095 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 45.2381, 0 }, + { 64.2857, 0 }, + { 73.8096, 4.7619 }, + { 83.3334, 14.2857 }, + { 88.0952, 23.8095 }, + { 88.0952, 38.0952 }, +}; + +static const CoordRec char71_stroke1[] = { + { 64.2857, 38.0952 }, + { 88.0952, 38.0952 }, +}; + +static const StrokeRec char71[] = { + { 19, char71_stroke0 }, + { 2, char71_stroke1 }, +}; + +/* char: 72 'H' */ + +static const CoordRec char72_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char72_stroke1[] = { + { 85.7143, 100 }, + { 85.7143, 0 }, +}; + +static const CoordRec char72_stroke2[] = { + { 19.0476, 52.381 }, + { 85.7143, 52.381 }, +}; + +static const StrokeRec char72[] = { + { 2, char72_stroke0 }, + { 2, char72_stroke1 }, + { 2, char72_stroke2 }, +}; + +/* char: 73 'I' */ + +static const CoordRec char73_stroke0[] = { + { 52.381, 100 }, + { 52.381, 0 }, +}; + +static const StrokeRec char73[] = { + { 2, char73_stroke0 }, +}; + +/* char: 74 'J' */ + +static const CoordRec char74_stroke0[] = { + { 76.1905, 100 }, + { 76.1905, 23.8095 }, + { 71.4286, 9.5238 }, + { 66.6667, 4.7619 }, + { 57.1429, 0 }, + { 47.6191, 0 }, + { 38.0953, 4.7619 }, + { 33.3334, 9.5238 }, + { 28.5715, 23.8095 }, + { 28.5715, 33.3333 }, +}; + +static const StrokeRec char74[] = { + { 10, char74_stroke0 }, +}; + +/* char: 75 'K' */ + +static const CoordRec char75_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char75_stroke1[] = { + { 85.7143, 100 }, + { 19.0476, 33.3333 }, +}; + +static const CoordRec char75_stroke2[] = { + { 42.8571, 57.1429 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char75[] = { + { 2, char75_stroke0 }, + { 2, char75_stroke1 }, + { 2, char75_stroke2 }, +}; + +/* char: 76 'L' */ + +static const CoordRec char76_stroke0[] = { + { 23.8095, 100 }, + { 23.8095, 0 }, +}; + +static const CoordRec char76_stroke1[] = { + { 23.8095, 0 }, + { 80.9524, 0 }, +}; + +static const StrokeRec char76[] = { + { 2, char76_stroke0 }, + { 2, char76_stroke1 }, +}; + +/* char: 77 'M' */ + +static const CoordRec char77_stroke0[] = { + { 14.2857, 100 }, + { 14.2857, 0 }, +}; + +static const CoordRec char77_stroke1[] = { + { 14.2857, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char77_stroke2[] = { + { 90.4762, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char77_stroke3[] = { + { 90.4762, 100 }, + { 90.4762, 0 }, +}; + +static const StrokeRec char77[] = { + { 2, char77_stroke0 }, + { 2, char77_stroke1 }, + { 2, char77_stroke2 }, + { 2, char77_stroke3 }, +}; + +/* char: 78 'N' */ + +static const CoordRec char78_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char78_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 0 }, +}; + +static const CoordRec char78_stroke2[] = { + { 85.7143, 100 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char78[] = { + { 2, char78_stroke0 }, + { 2, char78_stroke1 }, + { 2, char78_stroke2 }, +}; + +/* char: 79 'O' */ + +static const CoordRec char79_stroke0[] = { + { 42.8571, 100 }, + { 33.3333, 95.2381 }, + { 23.8095, 85.7143 }, + { 19.0476, 76.1905 }, + { 14.2857, 61.9048 }, + { 14.2857, 38.0952 }, + { 19.0476, 23.8095 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 42.8571, 0 }, + { 61.9047, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 23.8095 }, + { 90.4762, 38.0952 }, + { 90.4762, 61.9048 }, + { 85.7143, 76.1905 }, + { 80.9524, 85.7143 }, + { 71.4286, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, +}; + +static const StrokeRec char79[] = { + { 21, char79_stroke0 }, +}; + +/* char: 80 'P' */ + +static const CoordRec char80_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char80_stroke1[] = { + { 19.0476, 100 }, + { 61.9047, 100 }, + { 76.1905, 95.2381 }, + { 80.9524, 90.4762 }, + { 85.7143, 80.9524 }, + { 85.7143, 66.6667 }, + { 80.9524, 57.1429 }, + { 76.1905, 52.381 }, + { 61.9047, 47.619 }, + { 19.0476, 47.619 }, +}; + +static const StrokeRec char80[] = { + { 2, char80_stroke0 }, + { 10, char80_stroke1 }, +}; + +/* char: 81 'Q' */ + +static const CoordRec char81_stroke0[] = { + { 42.8571, 100 }, + { 33.3333, 95.2381 }, + { 23.8095, 85.7143 }, + { 19.0476, 76.1905 }, + { 14.2857, 61.9048 }, + { 14.2857, 38.0952 }, + { 19.0476, 23.8095 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 42.8571, 0 }, + { 61.9047, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 23.8095 }, + { 90.4762, 38.0952 }, + { 90.4762, 61.9048 }, + { 85.7143, 76.1905 }, + { 80.9524, 85.7143 }, + { 71.4286, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, +}; + +static const CoordRec char81_stroke1[] = { + { 57.1428, 19.0476 }, + { 85.7143, -9.5238 }, +}; + +static const StrokeRec char81[] = { + { 21, char81_stroke0 }, + { 2, char81_stroke1 }, +}; + +/* char: 82 'R' */ + +static const CoordRec char82_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char82_stroke1[] = { + { 19.0476, 100 }, + { 61.9047, 100 }, + { 76.1905, 95.2381 }, + { 80.9524, 90.4762 }, + { 85.7143, 80.9524 }, + { 85.7143, 71.4286 }, + { 80.9524, 61.9048 }, + { 76.1905, 57.1429 }, + { 61.9047, 52.381 }, + { 19.0476, 52.381 }, +}; + +static const CoordRec char82_stroke2[] = { + { 52.3809, 52.381 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char82[] = { + { 2, char82_stroke0 }, + { 10, char82_stroke1 }, + { 2, char82_stroke2 }, +}; + +/* char: 83 'S' */ + +static const CoordRec char83_stroke0[] = { + { 85.7143, 85.7143 }, + { 76.1905, 95.2381 }, + { 61.9047, 100 }, + { 42.8571, 100 }, + { 28.5714, 95.2381 }, + { 19.0476, 85.7143 }, + { 19.0476, 76.1905 }, + { 23.8095, 66.6667 }, + { 28.5714, 61.9048 }, + { 38.0952, 57.1429 }, + { 66.6666, 47.619 }, + { 76.1905, 42.8571 }, + { 80.9524, 38.0952 }, + { 85.7143, 28.5714 }, + { 85.7143, 14.2857 }, + { 76.1905, 4.7619 }, + { 61.9047, 0 }, + { 42.8571, 0 }, + { 28.5714, 4.7619 }, + { 19.0476, 14.2857 }, +}; + +static const StrokeRec char83[] = { + { 20, char83_stroke0 }, +}; + +/* char: 84 'T' */ + +static const CoordRec char84_stroke0[] = { + { 52.3809, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char84_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char84[] = { + { 2, char84_stroke0 }, + { 2, char84_stroke1 }, +}; + +/* char: 85 'U' */ + +static const CoordRec char85_stroke0[] = { + { 19.0476, 100 }, + { 19.0476, 28.5714 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 47.619, 0 }, + { 57.1428, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 28.5714 }, + { 85.7143, 100 }, +}; + +static const StrokeRec char85[] = { + { 10, char85_stroke0 }, +}; + +/* char: 86 'V' */ + +static const CoordRec char86_stroke0[] = { + { 14.2857, 100 }, + { 52.3809, 0 }, +}; + +static const CoordRec char86_stroke1[] = { + { 90.4762, 100 }, + { 52.3809, 0 }, +}; + +static const StrokeRec char86[] = { + { 2, char86_stroke0 }, + { 2, char86_stroke1 }, +}; + +/* char: 87 'W' */ + +static const CoordRec char87_stroke0[] = { + { 4.7619, 100 }, + { 28.5714, 0 }, +}; + +static const CoordRec char87_stroke1[] = { + { 52.3809, 100 }, + { 28.5714, 0 }, +}; + +static const CoordRec char87_stroke2[] = { + { 52.3809, 100 }, + { 76.1905, 0 }, +}; + +static const CoordRec char87_stroke3[] = { + { 100, 100 }, + { 76.1905, 0 }, +}; + +static const StrokeRec char87[] = { + { 2, char87_stroke0 }, + { 2, char87_stroke1 }, + { 2, char87_stroke2 }, + { 2, char87_stroke3 }, +}; + +/* char: 88 'X' */ + +static const CoordRec char88_stroke0[] = { + { 19.0476, 100 }, + { 85.7143, 0 }, +}; + +static const CoordRec char88_stroke1[] = { + { 85.7143, 100 }, + { 19.0476, 0 }, +}; + +static const StrokeRec char88[] = { + { 2, char88_stroke0 }, + { 2, char88_stroke1 }, +}; + +/* char: 89 'Y' */ + +static const CoordRec char89_stroke0[] = { + { 14.2857, 100 }, + { 52.3809, 52.381 }, + { 52.3809, 0 }, +}; + +static const CoordRec char89_stroke1[] = { + { 90.4762, 100 }, + { 52.3809, 52.381 }, +}; + +static const StrokeRec char89[] = { + { 3, char89_stroke0 }, + { 2, char89_stroke1 }, +}; + +/* char: 90 'Z' */ + +static const CoordRec char90_stroke0[] = { + { 85.7143, 100 }, + { 19.0476, 0 }, +}; + +static const CoordRec char90_stroke1[] = { + { 19.0476, 100 }, + { 85.7143, 100 }, +}; + +static const CoordRec char90_stroke2[] = { + { 19.0476, 0 }, + { 85.7143, 0 }, +}; + +static const StrokeRec char90[] = { + { 2, char90_stroke0 }, + { 2, char90_stroke1 }, + { 2, char90_stroke2 }, +}; + +/* char: 91 '[' */ + +static const CoordRec char91_stroke0[] = { + { 35.7143, 119.048 }, + { 35.7143, -33.3333 }, +}; + +static const CoordRec char91_stroke1[] = { + { 40.4762, 119.048 }, + { 40.4762, -33.3333 }, +}; + +static const CoordRec char91_stroke2[] = { + { 35.7143, 119.048 }, + { 69.0476, 119.048 }, +}; + +static const CoordRec char91_stroke3[] = { + { 35.7143, -33.3333 }, + { 69.0476, -33.3333 }, +}; + +static const StrokeRec char91[] = { + { 2, char91_stroke0 }, + { 2, char91_stroke1 }, + { 2, char91_stroke2 }, + { 2, char91_stroke3 }, +}; + +/* char: 92 '\' */ + +static const CoordRec char92_stroke0[] = { + { 19.0476, 100 }, + { 85.7143, -14.2857 }, +}; + +static const StrokeRec char92[] = { + { 2, char92_stroke0 }, +}; + +/* char: 93 ']' */ + +static const CoordRec char93_stroke0[] = { + { 64.2857, 119.048 }, + { 64.2857, -33.3333 }, +}; + +static const CoordRec char93_stroke1[] = { + { 69.0476, 119.048 }, + { 69.0476, -33.3333 }, +}; + +static const CoordRec char93_stroke2[] = { + { 35.7143, 119.048 }, + { 69.0476, 119.048 }, +}; + +static const CoordRec char93_stroke3[] = { + { 35.7143, -33.3333 }, + { 69.0476, -33.3333 }, +}; + +static const StrokeRec char93[] = { + { 2, char93_stroke0 }, + { 2, char93_stroke1 }, + { 2, char93_stroke2 }, + { 2, char93_stroke3 }, +}; + +/* char: 94 '^' */ + +static const CoordRec char94_stroke0[] = { + { 52.3809, 109.524 }, + { 14.2857, 42.8571 }, +}; + +static const CoordRec char94_stroke1[] = { + { 52.3809, 109.524 }, + { 90.4762, 42.8571 }, +}; + +static const StrokeRec char94[] = { + { 2, char94_stroke0 }, + { 2, char94_stroke1 }, +}; + +/* char: 95 '_' */ + +static const CoordRec char95_stroke0[] = { + { 0, -33.3333 }, + { 104.762, -33.3333 }, + { 104.762, -28.5714 }, + { 0, -28.5714 }, + { 0, -33.3333 }, +}; + +static const StrokeRec char95[] = { + { 5, char95_stroke0 }, +}; + +/* char: 96 '`' */ + +static const CoordRec char96_stroke0[] = { + { 42.8572, 100 }, + { 66.6667, 71.4286 }, +}; + +static const CoordRec char96_stroke1[] = { + { 42.8572, 100 }, + { 38.0953, 95.2381 }, + { 66.6667, 71.4286 }, +}; + +static const StrokeRec char96[] = { + { 2, char96_stroke0 }, + { 3, char96_stroke1 }, +}; + +/* char: 97 'a' */ + +static const CoordRec char97_stroke0[] = { + { 80.9524, 66.6667 }, + { 80.9524, 0 }, +}; + +static const CoordRec char97_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char97[] = { + { 2, char97_stroke0 }, + { 14, char97_stroke1 }, +}; + +/* char: 98 'b' */ + +static const CoordRec char98_stroke0[] = { + { 23.8095, 100 }, + { 23.8095, 0 }, +}; + +static const CoordRec char98_stroke1[] = { + { 23.8095, 52.381 }, + { 33.3333, 61.9048 }, + { 42.8571, 66.6667 }, + { 57.1428, 66.6667 }, + { 66.6666, 61.9048 }, + { 76.1905, 52.381 }, + { 80.9524, 38.0952 }, + { 80.9524, 28.5714 }, + { 76.1905, 14.2857 }, + { 66.6666, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 33.3333, 4.7619 }, + { 23.8095, 14.2857 }, +}; + +static const StrokeRec char98[] = { + { 2, char98_stroke0 }, + { 14, char98_stroke1 }, +}; + +/* char: 99 'c' */ + +static const CoordRec char99_stroke0[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char99[] = { + { 14, char99_stroke0 }, +}; + +/* char: 100 'd' */ + +static const CoordRec char100_stroke0[] = { + { 80.9524, 100 }, + { 80.9524, 0 }, +}; + +static const CoordRec char100_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char100[] = { + { 2, char100_stroke0 }, + { 14, char100_stroke1 }, +}; + +/* char: 101 'e' */ + +static const CoordRec char101_stroke0[] = { + { 23.8095, 38.0952 }, + { 80.9524, 38.0952 }, + { 80.9524, 47.619 }, + { 76.1905, 57.1429 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char101[] = { + { 17, char101_stroke0 }, +}; + +/* char: 102 'f' */ + +static const CoordRec char102_stroke0[] = { + { 71.4286, 100 }, + { 61.9048, 100 }, + { 52.381, 95.2381 }, + { 47.6191, 80.9524 }, + { 47.6191, 0 }, +}; + +static const CoordRec char102_stroke1[] = { + { 33.3334, 66.6667 }, + { 66.6667, 66.6667 }, +}; + +static const StrokeRec char102[] = { + { 5, char102_stroke0 }, + { 2, char102_stroke1 }, +}; + +/* char: 103 'g' */ + +static const CoordRec char103_stroke0[] = { + { 80.9524, 66.6667 }, + { 80.9524, -9.5238 }, + { 76.1905, -23.8095 }, + { 71.4285, -28.5714 }, + { 61.9047, -33.3333 }, + { 47.619, -33.3333 }, + { 38.0952, -28.5714 }, +}; + +static const CoordRec char103_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char103[] = { + { 7, char103_stroke0 }, + { 14, char103_stroke1 }, +}; + +/* char: 104 'h' */ + +static const CoordRec char104_stroke0[] = { + { 26.1905, 100 }, + { 26.1905, 0 }, +}; + +static const CoordRec char104_stroke1[] = { + { 26.1905, 47.619 }, + { 40.4762, 61.9048 }, + { 50, 66.6667 }, + { 64.2857, 66.6667 }, + { 73.8095, 61.9048 }, + { 78.5715, 47.619 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char104[] = { + { 2, char104_stroke0 }, + { 7, char104_stroke1 }, +}; + +/* char: 105 'i' */ + +static const CoordRec char105_stroke0[] = { + { 47.6191, 100 }, + { 52.381, 95.2381 }, + { 57.1429, 100 }, + { 52.381, 104.762 }, + { 47.6191, 100 }, +}; + +static const CoordRec char105_stroke1[] = { + { 52.381, 66.6667 }, + { 52.381, 0 }, +}; + +static const StrokeRec char105[] = { + { 5, char105_stroke0 }, + { 2, char105_stroke1 }, +}; + +/* char: 106 'j' */ + +static const CoordRec char106_stroke0[] = { + { 57.1429, 100 }, + { 61.9048, 95.2381 }, + { 66.6667, 100 }, + { 61.9048, 104.762 }, + { 57.1429, 100 }, +}; + +static const CoordRec char106_stroke1[] = { + { 61.9048, 66.6667 }, + { 61.9048, -14.2857 }, + { 57.1429, -28.5714 }, + { 47.6191, -33.3333 }, + { 38.0953, -33.3333 }, +}; + +static const StrokeRec char106[] = { + { 5, char106_stroke0 }, + { 5, char106_stroke1 }, +}; + +/* char: 107 'k' */ + +static const CoordRec char107_stroke0[] = { + { 26.1905, 100 }, + { 26.1905, 0 }, +}; + +static const CoordRec char107_stroke1[] = { + { 73.8095, 66.6667 }, + { 26.1905, 19.0476 }, +}; + +static const CoordRec char107_stroke2[] = { + { 45.2381, 38.0952 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char107[] = { + { 2, char107_stroke0 }, + { 2, char107_stroke1 }, + { 2, char107_stroke2 }, +}; + +/* char: 108 'l' */ + +static const CoordRec char108_stroke0[] = { + { 52.381, 100 }, + { 52.381, 0 }, +}; + +static const StrokeRec char108[] = { + { 2, char108_stroke0 }, +}; + +/* char: 109 'm' */ + +static const CoordRec char109_stroke0[] = { + { 0, 66.6667 }, + { 0, 0 }, +}; + +static const CoordRec char109_stroke1[] = { + { 0, 47.619 }, + { 14.2857, 61.9048 }, + { 23.8095, 66.6667 }, + { 38.0952, 66.6667 }, + { 47.619, 61.9048 }, + { 52.381, 47.619 }, + { 52.381, 0 }, +}; + +static const CoordRec char109_stroke2[] = { + { 52.381, 47.619 }, + { 66.6667, 61.9048 }, + { 76.1905, 66.6667 }, + { 90.4762, 66.6667 }, + { 100, 61.9048 }, + { 104.762, 47.619 }, + { 104.762, 0 }, +}; + +static const StrokeRec char109[] = { + { 2, char109_stroke0 }, + { 7, char109_stroke1 }, + { 7, char109_stroke2 }, +}; + +/* char: 110 'n' */ + +static const CoordRec char110_stroke0[] = { + { 26.1905, 66.6667 }, + { 26.1905, 0 }, +}; + +static const CoordRec char110_stroke1[] = { + { 26.1905, 47.619 }, + { 40.4762, 61.9048 }, + { 50, 66.6667 }, + { 64.2857, 66.6667 }, + { 73.8095, 61.9048 }, + { 78.5715, 47.619 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char110[] = { + { 2, char110_stroke0 }, + { 7, char110_stroke1 }, +}; + +/* char: 111 'o' */ + +static const CoordRec char111_stroke0[] = { + { 45.2381, 66.6667 }, + { 35.7143, 61.9048 }, + { 26.1905, 52.381 }, + { 21.4286, 38.0952 }, + { 21.4286, 28.5714 }, + { 26.1905, 14.2857 }, + { 35.7143, 4.7619 }, + { 45.2381, 0 }, + { 59.5238, 0 }, + { 69.0476, 4.7619 }, + { 78.5714, 14.2857 }, + { 83.3334, 28.5714 }, + { 83.3334, 38.0952 }, + { 78.5714, 52.381 }, + { 69.0476, 61.9048 }, + { 59.5238, 66.6667 }, + { 45.2381, 66.6667 }, +}; + +static const StrokeRec char111[] = { + { 17, char111_stroke0 }, +}; + +/* char: 112 'p' */ + +static const CoordRec char112_stroke0[] = { + { 23.8095, 66.6667 }, + { 23.8095, -33.3333 }, +}; + +static const CoordRec char112_stroke1[] = { + { 23.8095, 52.381 }, + { 33.3333, 61.9048 }, + { 42.8571, 66.6667 }, + { 57.1428, 66.6667 }, + { 66.6666, 61.9048 }, + { 76.1905, 52.381 }, + { 80.9524, 38.0952 }, + { 80.9524, 28.5714 }, + { 76.1905, 14.2857 }, + { 66.6666, 4.7619 }, + { 57.1428, 0 }, + { 42.8571, 0 }, + { 33.3333, 4.7619 }, + { 23.8095, 14.2857 }, +}; + +static const StrokeRec char112[] = { + { 2, char112_stroke0 }, + { 14, char112_stroke1 }, +}; + +/* char: 113 'q' */ + +static const CoordRec char113_stroke0[] = { + { 80.9524, 66.6667 }, + { 80.9524, -33.3333 }, +}; + +static const CoordRec char113_stroke1[] = { + { 80.9524, 52.381 }, + { 71.4285, 61.9048 }, + { 61.9047, 66.6667 }, + { 47.619, 66.6667 }, + { 38.0952, 61.9048 }, + { 28.5714, 52.381 }, + { 23.8095, 38.0952 }, + { 23.8095, 28.5714 }, + { 28.5714, 14.2857 }, + { 38.0952, 4.7619 }, + { 47.619, 0 }, + { 61.9047, 0 }, + { 71.4285, 4.7619 }, + { 80.9524, 14.2857 }, +}; + +static const StrokeRec char113[] = { + { 2, char113_stroke0 }, + { 14, char113_stroke1 }, +}; + +/* char: 114 'r' */ + +static const CoordRec char114_stroke0[] = { + { 33.3334, 66.6667 }, + { 33.3334, 0 }, +}; + +static const CoordRec char114_stroke1[] = { + { 33.3334, 38.0952 }, + { 38.0953, 52.381 }, + { 47.6191, 61.9048 }, + { 57.1429, 66.6667 }, + { 71.4286, 66.6667 }, +}; + +static const StrokeRec char114[] = { + { 2, char114_stroke0 }, + { 5, char114_stroke1 }, +}; + +/* char: 115 's' */ + +static const CoordRec char115_stroke0[] = { + { 78.5715, 52.381 }, + { 73.8095, 61.9048 }, + { 59.5238, 66.6667 }, + { 45.2381, 66.6667 }, + { 30.9524, 61.9048 }, + { 26.1905, 52.381 }, + { 30.9524, 42.8571 }, + { 40.4762, 38.0952 }, + { 64.2857, 33.3333 }, + { 73.8095, 28.5714 }, + { 78.5715, 19.0476 }, + { 78.5715, 14.2857 }, + { 73.8095, 4.7619 }, + { 59.5238, 0 }, + { 45.2381, 0 }, + { 30.9524, 4.7619 }, + { 26.1905, 14.2857 }, +}; + +static const StrokeRec char115[] = { + { 17, char115_stroke0 }, +}; + +/* char: 116 't' */ + +static const CoordRec char116_stroke0[] = { + { 47.6191, 100 }, + { 47.6191, 19.0476 }, + { 52.381, 4.7619 }, + { 61.9048, 0 }, + { 71.4286, 0 }, +}; + +static const CoordRec char116_stroke1[] = { + { 33.3334, 66.6667 }, + { 66.6667, 66.6667 }, +}; + +static const StrokeRec char116[] = { + { 5, char116_stroke0 }, + { 2, char116_stroke1 }, +}; + +/* char: 117 'u' */ + +static const CoordRec char117_stroke0[] = { + { 26.1905, 66.6667 }, + { 26.1905, 19.0476 }, + { 30.9524, 4.7619 }, + { 40.4762, 0 }, + { 54.7619, 0 }, + { 64.2857, 4.7619 }, + { 78.5715, 19.0476 }, +}; + +static const CoordRec char117_stroke1[] = { + { 78.5715, 66.6667 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char117[] = { + { 7, char117_stroke0 }, + { 2, char117_stroke1 }, +}; + +/* char: 118 'v' */ + +static const CoordRec char118_stroke0[] = { + { 23.8095, 66.6667 }, + { 52.3809, 0 }, +}; + +static const CoordRec char118_stroke1[] = { + { 80.9524, 66.6667 }, + { 52.3809, 0 }, +}; + +static const StrokeRec char118[] = { + { 2, char118_stroke0 }, + { 2, char118_stroke1 }, +}; + +/* char: 119 'w' */ + +static const CoordRec char119_stroke0[] = { + { 14.2857, 66.6667 }, + { 33.3333, 0 }, +}; + +static const CoordRec char119_stroke1[] = { + { 52.3809, 66.6667 }, + { 33.3333, 0 }, +}; + +static const CoordRec char119_stroke2[] = { + { 52.3809, 66.6667 }, + { 71.4286, 0 }, +}; + +static const CoordRec char119_stroke3[] = { + { 90.4762, 66.6667 }, + { 71.4286, 0 }, +}; + +static const StrokeRec char119[] = { + { 2, char119_stroke0 }, + { 2, char119_stroke1 }, + { 2, char119_stroke2 }, + { 2, char119_stroke3 }, +}; + +/* char: 120 'x' */ + +static const CoordRec char120_stroke0[] = { + { 26.1905, 66.6667 }, + { 78.5715, 0 }, +}; + +static const CoordRec char120_stroke1[] = { + { 78.5715, 66.6667 }, + { 26.1905, 0 }, +}; + +static const StrokeRec char120[] = { + { 2, char120_stroke0 }, + { 2, char120_stroke1 }, +}; + +/* char: 121 'y' */ + +static const CoordRec char121_stroke0[] = { + { 26.1905, 66.6667 }, + { 54.7619, 0 }, +}; + +static const CoordRec char121_stroke1[] = { + { 83.3334, 66.6667 }, + { 54.7619, 0 }, + { 45.2381, -19.0476 }, + { 35.7143, -28.5714 }, + { 26.1905, -33.3333 }, + { 21.4286, -33.3333 }, +}; + +static const StrokeRec char121[] = { + { 2, char121_stroke0 }, + { 6, char121_stroke1 }, +}; + +/* char: 122 'z' */ + +static const CoordRec char122_stroke0[] = { + { 78.5715, 66.6667 }, + { 26.1905, 0 }, +}; + +static const CoordRec char122_stroke1[] = { + { 26.1905, 66.6667 }, + { 78.5715, 66.6667 }, +}; + +static const CoordRec char122_stroke2[] = { + { 26.1905, 0 }, + { 78.5715, 0 }, +}; + +static const StrokeRec char122[] = { + { 2, char122_stroke0 }, + { 2, char122_stroke1 }, + { 2, char122_stroke2 }, +}; + +/* char: 123 '{' */ + +static const CoordRec char123_stroke0[] = { + { 64.2857, 119.048 }, + { 54.7619, 114.286 }, + { 50, 109.524 }, + { 45.2381, 100 }, + { 45.2381, 90.4762 }, + { 50, 80.9524 }, + { 54.7619, 76.1905 }, + { 59.5238, 66.6667 }, + { 59.5238, 57.1429 }, + { 50, 47.619 }, +}; + +static const CoordRec char123_stroke1[] = { + { 54.7619, 114.286 }, + { 50, 104.762 }, + { 50, 95.2381 }, + { 54.7619, 85.7143 }, + { 59.5238, 80.9524 }, + { 64.2857, 71.4286 }, + { 64.2857, 61.9048 }, + { 59.5238, 52.381 }, + { 40.4762, 42.8571 }, + { 59.5238, 33.3333 }, + { 64.2857, 23.8095 }, + { 64.2857, 14.2857 }, + { 59.5238, 4.7619 }, + { 54.7619, 0 }, + { 50, -9.5238 }, + { 50, -19.0476 }, + { 54.7619, -28.5714 }, +}; + +static const CoordRec char123_stroke2[] = { + { 50, 38.0952 }, + { 59.5238, 28.5714 }, + { 59.5238, 19.0476 }, + { 54.7619, 9.5238 }, + { 50, 4.7619 }, + { 45.2381, -4.7619 }, + { 45.2381, -14.2857 }, + { 50, -23.8095 }, + { 54.7619, -28.5714 }, + { 64.2857, -33.3333 }, +}; + +static const StrokeRec char123[] = { + { 10, char123_stroke0 }, + { 17, char123_stroke1 }, + { 10, char123_stroke2 }, +}; + +/* char: 124 '|' */ + +static const CoordRec char124_stroke0[] = { + { 52.381, 119.048 }, + { 52.381, -33.3333 }, +}; + +static const StrokeRec char124[] = { + { 2, char124_stroke0 }, +}; + +/* char: 125 '}' */ + +static const CoordRec char125_stroke0[] = { + { 40.4762, 119.048 }, + { 50, 114.286 }, + { 54.7619, 109.524 }, + { 59.5238, 100 }, + { 59.5238, 90.4762 }, + { 54.7619, 80.9524 }, + { 50, 76.1905 }, + { 45.2381, 66.6667 }, + { 45.2381, 57.1429 }, + { 54.7619, 47.619 }, +}; + +static const CoordRec char125_stroke1[] = { + { 50, 114.286 }, + { 54.7619, 104.762 }, + { 54.7619, 95.2381 }, + { 50, 85.7143 }, + { 45.2381, 80.9524 }, + { 40.4762, 71.4286 }, + { 40.4762, 61.9048 }, + { 45.2381, 52.381 }, + { 64.2857, 42.8571 }, + { 45.2381, 33.3333 }, + { 40.4762, 23.8095 }, + { 40.4762, 14.2857 }, + { 45.2381, 4.7619 }, + { 50, 0 }, + { 54.7619, -9.5238 }, + { 54.7619, -19.0476 }, + { 50, -28.5714 }, +}; + +static const CoordRec char125_stroke2[] = { + { 54.7619, 38.0952 }, + { 45.2381, 28.5714 }, + { 45.2381, 19.0476 }, + { 50, 9.5238 }, + { 54.7619, 4.7619 }, + { 59.5238, -4.7619 }, + { 59.5238, -14.2857 }, + { 54.7619, -23.8095 }, + { 50, -28.5714 }, + { 40.4762, -33.3333 }, +}; + +static const StrokeRec char125[] = { + { 10, char125_stroke0 }, + { 17, char125_stroke1 }, + { 10, char125_stroke2 }, +}; + +/* char: 126 '~' */ + +static const CoordRec char126_stroke0[] = { + { 9.5238, 28.5714 }, + { 9.5238, 38.0952 }, + { 14.2857, 52.381 }, + { 23.8095, 57.1429 }, + { 33.3333, 57.1429 }, + { 42.8571, 52.381 }, + { 61.9048, 38.0952 }, + { 71.4286, 33.3333 }, + { 80.9524, 33.3333 }, + { 90.4762, 38.0952 }, + { 95.2381, 47.619 }, +}; + +static const CoordRec char126_stroke1[] = { + { 9.5238, 38.0952 }, + { 14.2857, 47.619 }, + { 23.8095, 52.381 }, + { 33.3333, 52.381 }, + { 42.8571, 47.619 }, + { 61.9048, 33.3333 }, + { 71.4286, 28.5714 }, + { 80.9524, 28.5714 }, + { 90.4762, 33.3333 }, + { 95.2381, 47.619 }, + { 95.2381, 57.1429 }, +}; + +static const StrokeRec char126[] = { + { 11, char126_stroke0 }, + { 11, char126_stroke1 }, +}; + +/* char: 127 */ + +static const CoordRec char127_stroke0[] = { + { 71.4286, 100 }, + { 33.3333, -33.3333 }, +}; + +static const CoordRec char127_stroke1[] = { + { 47.619, 66.6667 }, + { 33.3333, 61.9048 }, + { 23.8095, 52.381 }, + { 19.0476, 38.0952 }, + { 19.0476, 23.8095 }, + { 23.8095, 14.2857 }, + { 33.3333, 4.7619 }, + { 47.619, 0 }, + { 57.1428, 0 }, + { 71.4286, 4.7619 }, + { 80.9524, 14.2857 }, + { 85.7143, 28.5714 }, + { 85.7143, 42.8571 }, + { 80.9524, 52.381 }, + { 71.4286, 61.9048 }, + { 57.1428, 66.6667 }, + { 47.619, 66.6667 }, +}; + +static const StrokeRec char127[] = { + { 2, char127_stroke0 }, + { 17, char127_stroke1 }, +}; + +static const StrokeCharRec chars[] = { + { 0, /* char0 */ 0, 0, 0 }, + { 0, /* char1 */ 0, 0, 0 }, + { 0, /* char2 */ 0, 0, 0 }, + { 0, /* char3 */ 0, 0, 0 }, + { 0, /* char4 */ 0, 0, 0 }, + { 0, /* char5 */ 0, 0, 0 }, + { 0, /* char6 */ 0, 0, 0 }, + { 0, /* char7 */ 0, 0, 0 }, + { 0, /* char8 */ 0, 0, 0 }, + { 0, /* char9 */ 0, 0, 0 }, + { 0, /* char10 */ 0, 0, 0 }, + { 0, /* char11 */ 0, 0, 0 }, + { 0, /* char12 */ 0, 0, 0 }, + { 0, /* char13 */ 0, 0, 0 }, + { 0, /* char14 */ 0, 0, 0 }, + { 0, /* char15 */ 0, 0, 0 }, + { 0, /* char16 */ 0, 0, 0 }, + { 0, /* char17 */ 0, 0, 0 }, + { 0, /* char18 */ 0, 0, 0 }, + { 0, /* char19 */ 0, 0, 0 }, + { 0, /* char20 */ 0, 0, 0 }, + { 0, /* char21 */ 0, 0, 0 }, + { 0, /* char22 */ 0, 0, 0 }, + { 0, /* char23 */ 0, 0, 0 }, + { 0, /* char24 */ 0, 0, 0 }, + { 0, /* char25 */ 0, 0, 0 }, + { 0, /* char26 */ 0, 0, 0 }, + { 0, /* char27 */ 0, 0, 0 }, + { 0, /* char28 */ 0, 0, 0 }, + { 0, /* char29 */ 0, 0, 0 }, + { 0, /* char30 */ 0, 0, 0 }, + { 0, /* char31 */ 0, 0, 0 }, + { 0, /* char32 */ 0, 52.381, 104.762 }, + { 2, char33, 52.381, 104.762 }, + { 2, char34, 52.381, 104.762 }, + { 4, char35, 52.381, 104.762 }, + { 3, char36, 52.381, 104.762 }, + { 3, char37, 52.381, 104.762 }, + { 1, char38, 52.381, 104.762 }, + { 1, char39, 52.381, 104.762 }, + { 1, char40, 52.381, 104.762 }, + { 1, char41, 52.381, 104.762 }, + { 3, char42, 52.381, 104.762 }, + { 2, char43, 52.381, 104.762 }, + { 1, char44, 52.381, 104.762 }, + { 1, char45, 52.381, 104.762 }, + { 1, char46, 52.381, 104.762 }, + { 1, char47, 52.381, 104.762 }, + { 1, char48, 52.381, 104.762 }, + { 1, char49, 52.381, 104.762 }, + { 1, char50, 52.381, 104.762 }, + { 1, char51, 52.381, 104.762 }, + { 2, char52, 52.381, 104.762 }, + { 1, char53, 52.381, 104.762 }, + { 1, char54, 52.381, 104.762 }, + { 2, char55, 52.381, 104.762 }, + { 1, char56, 52.381, 104.762 }, + { 1, char57, 52.381, 104.762 }, + { 2, char58, 52.381, 104.762 }, + { 2, char59, 52.381, 104.762 }, + { 1, char60, 52.381, 104.762 }, + { 2, char61, 52.381, 104.762 }, + { 1, char62, 52.381, 104.762 }, + { 2, char63, 52.381, 104.762 }, + { 2, char64, 52.381, 104.762 }, + { 3, char65, 52.381, 104.762 }, + { 3, char66, 52.381, 104.762 }, + { 1, char67, 52.381, 104.762 }, + { 2, char68, 52.381, 104.762 }, + { 4, char69, 52.381, 104.762 }, + { 3, char70, 52.381, 104.762 }, + { 2, char71, 52.381, 104.762 }, + { 3, char72, 52.381, 104.762 }, + { 1, char73, 52.381, 104.762 }, + { 1, char74, 52.381, 104.762 }, + { 3, char75, 52.381, 104.762 }, + { 2, char76, 52.381, 104.762 }, + { 4, char77, 52.381, 104.762 }, + { 3, char78, 52.381, 104.762 }, + { 1, char79, 52.381, 104.762 }, + { 2, char80, 52.381, 104.762 }, + { 2, char81, 52.381, 104.762 }, + { 3, char82, 52.381, 104.762 }, + { 1, char83, 52.381, 104.762 }, + { 2, char84, 52.381, 104.762 }, + { 1, char85, 52.381, 104.762 }, + { 2, char86, 52.381, 104.762 }, + { 4, char87, 52.381, 104.762 }, + { 2, char88, 52.381, 104.762 }, + { 2, char89, 52.381, 104.762 }, + { 3, char90, 52.381, 104.762 }, + { 4, char91, 52.381, 104.762 }, + { 1, char92, 52.381, 104.762 }, + { 4, char93, 52.381, 104.762 }, + { 2, char94, 52.381, 104.762 }, + { 1, char95, 52.381, 104.762 }, + { 2, char96, 52.381, 104.762 }, + { 2, char97, 52.381, 104.762 }, + { 2, char98, 52.381, 104.762 }, + { 1, char99, 52.381, 104.762 }, + { 2, char100, 52.381, 104.762 }, + { 1, char101, 52.381, 104.762 }, + { 2, char102, 52.381, 104.762 }, + { 2, char103, 52.381, 104.762 }, + { 2, char104, 52.381, 104.762 }, + { 2, char105, 52.381, 104.762 }, + { 2, char106, 52.381, 104.762 }, + { 3, char107, 52.381, 104.762 }, + { 1, char108, 52.381, 104.762 }, + { 3, char109, 52.381, 104.762 }, + { 2, char110, 52.381, 104.762 }, + { 1, char111, 52.381, 104.762 }, + { 2, char112, 52.381, 104.762 }, + { 2, char113, 52.381, 104.762 }, + { 2, char114, 52.381, 104.762 }, + { 1, char115, 52.381, 104.762 }, + { 2, char116, 52.381, 104.762 }, + { 2, char117, 52.381, 104.762 }, + { 2, char118, 52.381, 104.762 }, + { 4, char119, 52.381, 104.762 }, + { 2, char120, 52.381, 104.762 }, + { 2, char121, 52.381, 104.762 }, + { 3, char122, 52.381, 104.762 }, + { 3, char123, 52.381, 104.762 }, + { 1, char124, 52.381, 104.762 }, + { 3, char125, 52.381, 104.762 }, + { 2, char126, 52.381, 104.762 }, + { 2, char127, 52.381, 104.762 }, +}; + +StrokeFontRec glutStrokeMonoRoman = { "Roman", 128, chars, 119.048, -33.3333 }; + diff --git a/xc/extras/Mesa/src-glut/glut_overlay.c b/xc/extras/Mesa/src-glut/glut_overlay.c new file mode 100644 index 000000000..13ece12a1 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_overlay.c @@ -0,0 +1,607 @@ + +/* Copyright (c) Mark J. Kilgard, 1996, 1997. */ + +/* 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 <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> /* for XA_RGB_DEFAULT_MAP atom */ +#if defined (__vms) +#include <Xmu/StdCmap.h> /* for XmuLookupStandardColormap */ +#else +#include <X11/Xmu/StdCmap.h> /* for XmuLookupStandardColormap */ +#endif +#endif /* !_WIN32 */ + +#include "glutint.h" +#include "layerutil.h" + +static Criterion requiredOverlayCriteria[] = +{ + {LEVEL, EQ, 1}, /* This entry gets poked in + determineOverlayVisual. */ + {TRANSPARENT, EQ, 1}, + {XPSEUDOCOLOR, EQ, 1}, + {RGBA, EQ, 0}, + {BUFFER_SIZE, GTE, 1} +}; +static int numRequiredOverlayCriteria = sizeof(requiredOverlayCriteria) / sizeof(Criterion); +static int requiredOverlayCriteriaMask = +(1 << LEVEL) | (1 << TRANSPARENT) | (1 << XSTATICGRAY) | (1 << RGBA) | (1 << CI_MODE); + +#if !defined(_WIN32) +static int +checkOverlayAcceptability(XVisualInfo * vi, unsigned int mode) +{ + int value; + + /* Must support OpenGL. */ + glXGetConfig(__glutDisplay, vi, GLX_USE_GL, &value); + if (!value) + return 1; + + /* Must be color index. */ + glXGetConfig(__glutDisplay, vi, GLX_RGBA, &value); + if (value) + return 1; + + /* Must match single/double buffering request. */ + glXGetConfig(__glutDisplay, vi, GLX_DOUBLEBUFFER, &value); + if (GLUT_WIND_IS_DOUBLE(mode) != (value != 0)) + return 1; + + /* Must match mono/stereo request. */ + glXGetConfig(__glutDisplay, vi, GLX_STEREO, &value); + if (GLUT_WIND_IS_STEREO(mode) != (value != 0)) + return 1; + + /* Alpha and accumulation buffers incompatible with color + index. */ + if (GLUT_WIND_HAS_ALPHA(mode) || GLUT_WIND_HAS_ACCUM(mode)) + return 1; + + /* Look for depth buffer if requested. */ + glXGetConfig(__glutDisplay, vi, GLX_DEPTH_SIZE, &value); + if (GLUT_WIND_HAS_DEPTH(mode) && (value <= 0)) + return 1; + + /* Look for stencil buffer if requested. */ + glXGetConfig(__glutDisplay, vi, GLX_STENCIL_SIZE, &value); + if (GLUT_WIND_HAS_STENCIL(mode) && (value <= 0)) + return 1; + +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + /* XXX Multisampled overlay color index?? Pretty unlikely. */ + /* Look for multisampling if requested. */ + if (__glutIsSupportedByGLX("GLX_SGIS_multisample")) + glXGetConfig(__glutDisplay, vi, GLX_SAMPLES_SGIS, &value); + else + value = 0; + if (GLUT_WIND_IS_MULTISAMPLE(mode) && (value <= 0)) + return 1; +#endif + + return 0; +} +#endif + +static XVisualInfo * +getOverlayVisualInfoCI(unsigned int mode) +{ +#if !defined(_WIN32) + XLayerVisualInfo *vi; + XLayerVisualInfo template; + XVisualInfo *goodVisual, *returnVisual; + int nitems, i, j, bad; + + /* The GLX 1.0 glXChooseVisual is does not permit queries + based on pixel transparency (and GLX_BUFFER_SIZE uses + "smallest that meets" its requirement instead of "largest + that meets" that GLUT wants. So, GLUT implements its own + visual selection routine for color index overlays. */ + + /* Try three overlay layers. */ + for (i = 1; i <= 3; i++) { + template.vinfo.screen = __glutScreen; + template.vinfo.class = PseudoColor; + template.layer = i; + template.type = TransparentPixel; + vi = __glutXGetLayerVisualInfo(__glutDisplay, + VisualTransparentType | VisualScreenMask | VisualClassMask | VisualLayerMask, + &template, &nitems); + if (vi) { + /* Check list for acceptable visual meeting requirements + of requested display mode. */ + for (j = 0; j < nitems; j++) { + bad = checkOverlayAcceptability(&vi[j].vinfo, mode); + if (bad) { + /* Set vi[j].vinfo.visual to mark it unacceptable. */ + vi[j].vinfo.visual = NULL; + } + } + + /* Look through list to find deepest acceptable visual. */ + goodVisual = NULL; + for (j = 0; j < nitems; j++) { + if (vi[j].vinfo.visual) { + if (goodVisual == NULL) { + goodVisual = &vi[j].vinfo; + } else { + if (goodVisual->depth < vi[j].vinfo.depth) { + goodVisual = &vi[j].vinfo; + } + } + } + } + + /* If a visual is found, clean up and return the visual. */ + if (goodVisual) { + returnVisual = (XVisualInfo *) malloc(sizeof(XVisualInfo)); + if (returnVisual) { + *returnVisual = *goodVisual; + } + XFree(vi); + return returnVisual; + } + XFree(vi); + } + } +#endif /* !_WIN32 */ + return NULL; +} + +/* ARGSUSED */ +static XVisualInfo * +getOverlayVisualInfoRGB(unsigned int mode) +{ + + /* XXX For now, transparent RGBA overlays are not supported + by GLUT. RGBA overlays raise difficult questions about + what the transparent pixel (really color) value should be. + + Color index overlay transparency is "easy" because the + transparent pixel value does not affect displayable colors + (except for stealing one color cell) since colors are + determined by indirection through a colormap, and because + it is uncommon for arbitrary pixel values in color index to + be "calculated" (as can occur with a host of RGBA operations + like lighting, blending, etc) so it is easy to avoid the + transparent pixel value. + + Since it is typically easy to avoid the transparent pixel + value in color index mode, if GLUT tells the programmer what + pixel is transparent, then most program can easily avoid + generating that pixel value except when they intend + transparency. GLUT returns whatever transparent pixel value + is provided by the system through glutGet( + GLUT_TRANSPARENT_INDEX). + + Theory versus practice for RGBA overlay transparency: In + theory, the reasonable thing is enabling overlay transparency + when an overlay pixel's destination alpha is 0 because this + allows overlay transparency to be controlled via alpha and all + visibile colors are permited, but no hardware I am aware of + supports this practice (and it requires destination alpha which + is typically optional and quite uncommon for overlay windows!). + + In practice, the choice of transparent pixel value is typically + "hardwired" into most graphics hardware to a single pixel value. + SGI hardware uses true black (0,0,0) without regard for the + destination alpha. This is far from ideal because true black (a + common color that is easy to accidently generate) can not be + generated in an RGBA overlay. I am not sure what other vendors + do. + + Pragmatically, most of the typical things you want to do in the + overlays can be done in color index (rubber banding, pop-up + menus, etc.). One solution for GLUT would be to simply + "advertise" what RGB triple (or possibly RGBA quadruple or simply + A alone) generates transparency. The problem with this approach + is that it forces programmers to avoid whatever arbitrary color + various systems decide is transparent. This is a difficult + burden to place on programmers that want to portably make use of + overlays. + + To actually support transparent RGBA overlays, there are really + two reaonsable options. ONE: Simply mandate that true black is + the RGBA overlay transparent color (what IRIS GL did). This is + nice for programmers since only one option, nice for existing SGI + hardware, bad for anyone (including SGI) who wants to improve + upon "true black" RGB transparency. + + Or TWO: Provide a set of queriable "transparency types" (like + "true black" or "alpha == 0" or "true white" or even a queriable + transparent color). This is harder for programmers, OK for + existing SGI hardware, and it leaves open the issue of what other + modes are reasonable. + + Option TWO seems the more general approach, but since hardware + designers will likely only implement a single mode (this is a + scan out issue where bandwidth is pressing issue), codifying + multiple speculative approaches nobody may ever implement seems + silly. And option ONE fiats a suboptimal solution. + + Therefore, I defer any decision of how GLUT should support RGBA + overlay transparency and leave support for it unimplemented. + Nobody has been pressing me for RGBA overlay transparency (though + people have requested color index overlay transparency + repeatedly). Geez, if you read this far you are either really + bored or maybe actually interested in this topic. Anyway, if + you have ideas (particularly if you plan on implementing a + hardware scheme for RGBA overlay transparency), I'd be + interested. + + For the record, SGI's expiremental Framebufer Configuration + experimental GLX extension uses option TWO. Transparency modes + for "none" and "RGB" are defined (others could be defined later). + What RGB value is the transparent one must be queried. + + I was hoping GLUT could have something that required less work + from the programmer to use portably. -mjk */ + + __glutWarning("RGBA overlays are not supported by GLUT (for now)."); + return NULL; +} + +static XVisualInfo * +getOverlayVisualInfo(unsigned int mode) +{ + /* XXX GLUT_LUMINANCE not implemented for GLUT 3.0. */ + if (GLUT_WIND_IS_LUMINANCE(mode)) + return NULL; + + if (GLUT_WIND_IS_RGB(mode)) + return getOverlayVisualInfoRGB(mode); + else + return getOverlayVisualInfoCI(mode); +} + +#if !defined(_WIN32) + +/* The GLUT overlay can come and go, and the overlay window has + a distinct X window ID. Logically though, GLUT treats the + normal and overlay windows as a unified window. In + particular, X input events typically go to the overlay window + since it is "on top of" the normal window. When an overlay + window ID is destroyed (due to glutRemoveOverlay or a call to + glutEstablishOverlay when an overlay already exists), we + still keep track of the overlay window ID until we get back a + DestroyNotify event for the overlay window. Otherwise, we + could lose track of X input events sent to a destroyed + overlay. To avoid this, we keep the destroyed overlay window + ID on a "stale window" list. This lets us properly route X + input events generated on destroyed overlay windows to the + proper GLUT window. */ +static void +addStaleWindow(GLUTwindow * window, Window win) +{ + GLUTstale *entry; + + entry = (GLUTstale *) malloc(sizeof(GLUTstale)); + if (!entry) + __glutFatalError("out of memory"); + entry->window = window; + entry->win = win; + entry->next = __glutStaleWindowList; + __glutStaleWindowList = entry; +} + +#endif + +void +__glutFreeOverlay(GLUToverlay * overlay) +{ + if (overlay->visAlloced) + XFree(overlay->vis); + XDestroyWindow(__glutDisplay, overlay->win); + glXDestroyContext(__glutDisplay, overlay->ctx); + if (overlay->colormap) { + /* Only color index overlays have colormap data structure. */ + __glutFreeColormap(overlay->colormap); + } + free(overlay); +} + +static XVisualInfo * +determineOverlayVisual(int *treatAsSingle, Bool * visAlloced, void **fbc) +{ + if (__glutDisplayString) { + XVisualInfo *vi; + int i; + + /* __glutDisplayString should be NULL except if + glutInitDisplayString has been called to register a + different display string. Calling glutInitDisplayString + means using a string instead of an integer mask determine + + the visual to use. Using the function pointer variable + __glutDetermineVisualFromString below avoids linking in + the code for implementing glutInitDisplayString (ie, + glut_dstr.o) unless glutInitDisplayString gets called by + the application. */ + + assert(__glutDetermineVisualFromString); + + /* Try three overlay layers. */ + *visAlloced = False; + *fbc = NULL; + for (i = 1; i <= 3; i++) { + requiredOverlayCriteria[0].value = i; + vi = __glutDetermineVisualFromString(__glutDisplayString, treatAsSingle, + requiredOverlayCriteria, numRequiredOverlayCriteria, + requiredOverlayCriteriaMask, fbc); + if (vi) { + return vi; + } + } + return NULL; + } else { + *visAlloced = True; + *fbc = NULL; + return __glutDetermineVisual(__glutDisplayMode, + treatAsSingle, getOverlayVisualInfo); + } +} + +/* CENTRY */ +void APIENTRY +glutEstablishOverlay(void) +{ + GLUToverlay *overlay; + GLUTwindow *window; + XSetWindowAttributes wa; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + GLXFBConfigSGIX fbc; +#else + void *fbc; +#endif + + /* Register a routine to free an overlay with glut_win.c; + this keeps glut_win.c from pulling in all of + glut_overlay.c when no overlay functionality is used by + the application. */ + __glutFreeOverlayFunc = __glutFreeOverlay; + + window = __glutCurrentWindow; + + /* Allow for an existant overlay to be re-established perhaps + if you wanted a different display mode. */ + if (window->overlay) { +#if !defined(_WIN32) + addStaleWindow(window, window->overlay->win); +#endif + __glutFreeOverlay(window->overlay); + } + overlay = (GLUToverlay *) malloc(sizeof(GLUToverlay)); + if (!overlay) + __glutFatalError("out of memory."); + + overlay->vis = determineOverlayVisual(&overlay->treatAsSingle, + &overlay->visAlloced, (void **) &fbc); + if (!overlay->vis) { + __glutFatalError("lacks overlay support."); + } +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + if (fbc) { + window->ctx = glXCreateContextWithConfigSGIX(__glutDisplay, fbc, + GLX_RGBA_TYPE_SGIX, None, __glutTryDirect); + } else +#endif + { + overlay->ctx = glXCreateContext(__glutDisplay, overlay->vis, + None, __glutTryDirect); + } + if (!overlay->ctx) { + __glutFatalError( + "failed to create overlay OpenGL rendering context."); + } +#if !defined(_WIN32) + overlay->isDirect = glXIsDirect(__glutDisplay, overlay->ctx); + if (__glutForceDirect) { + if (!overlay->isDirect) { + __glutFatalError("direct rendering not possible."); + } + } +#endif + __glutSetupColormap(overlay->vis, &overlay->colormap, &overlay->cmap); + overlay->transparentPixel = __glutGetTransparentPixel(__glutDisplay, + overlay->vis); + wa.colormap = overlay->cmap; + wa.background_pixel = overlay->transparentPixel; + wa.event_mask = window->eventMask & GLUT_OVERLAY_EVENT_FILTER_MASK; + wa.border_pixel = 0; +#if defined(_WIN32) + /* XXX Overlays not supported in Win32 yet. */ +#else + overlay->win = XCreateWindow(__glutDisplay, + window->win, + 0, 0, window->width, window->height, 0, + overlay->vis->depth, InputOutput, overlay->vis->visual, + CWBackPixel | CWBorderPixel | CWEventMask | CWColormap, + &wa); +#endif + if (window->children) { + /* Overlay window must be lowered below any GLUT + subwindows. */ + XLowerWindow(__glutDisplay, overlay->win); + } + XMapWindow(__glutDisplay, overlay->win); + overlay->shownState = 1; + + overlay->display = NULL; + + /* Make sure a reshape gets delivered. */ + window->forceReshape = True; + +#if !defined(_WIN32) + __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); +#endif + + window->overlay = overlay; + glutUseLayer(GLUT_OVERLAY); + + if (overlay->treatAsSingle) { + glDrawBuffer(GL_FRONT); + glReadBuffer(GL_FRONT); + } +} + +void APIENTRY +glutRemoveOverlay(void) +{ + GLUTwindow *window = __glutCurrentWindow; + GLUToverlay *overlay = __glutCurrentWindow->overlay; + + if (!window->overlay) + return; + + /* If using overlay, switch to the normal layer. */ + if (window->renderWin == overlay->win) { + glutUseLayer(GLUT_NORMAL); + } +#if !defined(_WIN32) + addStaleWindow(window, overlay->win); +#endif + __glutFreeOverlay(overlay); + window->overlay = NULL; +#if !defined(_WIN32) + __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); +#endif +} + +void APIENTRY +glutUseLayer(GLenum layer) +{ + GLUTwindow *window = __glutCurrentWindow; + + switch (layer) { + case GLUT_NORMAL: +#ifdef _WIN32 + window->renderDc = window->hdc; +#endif + window->renderWin = window->win; + window->renderCtx = window->ctx; + break; + case GLUT_OVERLAY: + /* Did you crash here? Calling glutUseLayer(GLUT_OVERLAY) + without an overlay established is erroneous. Fix your + code. */ +#ifdef _WIN32 + window->renderDc = window->overlay->hdc; +#endif + window->renderWin = window->overlay->win; + window->renderCtx = window->overlay->ctx; + break; + default: + __glutWarning("glutUseLayer: unknown layer, %d.", layer); + break; + } + __glutSetWindow(window); +} + +void APIENTRY +glutPostOverlayRedisplay(void) +{ + __glutPostRedisplay(__glutCurrentWindow, GLUT_OVERLAY_REDISPLAY_WORK); +} + +/* The advantage of this routine is that it saves the cost of a + glutSetWindow call (entailing an expensive OpenGL context + switch), particularly useful when multiple windows need + redisplays posted at the same times. */ +void APIENTRY +glutPostWindowOverlayRedisplay(int win) +{ + __glutPostRedisplay(__glutWindowList[win - 1], GLUT_OVERLAY_REDISPLAY_WORK); +} + +void APIENTRY +glutOverlayDisplayFunc(GLUTdisplayCB displayFunc) +{ + if (!__glutCurrentWindow->overlay) { + __glutWarning("glutOverlayDisplayFunc: window has no overlay established"); + return; + } + __glutCurrentWindow->overlay->display = displayFunc; +} + +void APIENTRY +glutHideOverlay(void) +{ + if (!__glutCurrentWindow->overlay) { + __glutWarning("glutHideOverlay: window has no overlay established"); + return; + } + XUnmapWindow(__glutDisplay, __glutCurrentWindow->overlay->win); + __glutCurrentWindow->overlay->shownState = 0; +} + +void APIENTRY +glutShowOverlay(void) +{ + if (!__glutCurrentWindow->overlay) { + __glutWarning("glutShowOverlay: window has no overlay established"); + return; + } + XMapWindow(__glutDisplay, __glutCurrentWindow->overlay->win); + __glutCurrentWindow->overlay->shownState = 1; +} + +int APIENTRY +glutLayerGet(GLenum param) +{ + switch (param) { + case GLUT_OVERLAY_POSSIBLE: + { + XVisualInfo *vi; + Bool dummy, visAlloced; + void *fbc; + + vi = determineOverlayVisual(&dummy, &visAlloced, &fbc); + if (vi) { + if (visAlloced) + XFree(vi); + return 1; + } + return 0; + } + case GLUT_LAYER_IN_USE: + return __glutCurrentWindow->renderWin != __glutCurrentWindow->win; + case GLUT_HAS_OVERLAY: + return __glutCurrentWindow->overlay != NULL; + case GLUT_TRANSPARENT_INDEX: + if (__glutCurrentWindow->overlay) { + return __glutCurrentWindow->overlay->transparentPixel; + } else { + return -1; + } + case GLUT_NORMAL_DAMAGED: + /* __glutWindowDamaged is used so the damage state within + the window (or overlay belwo) can be cleared before + calling a display callback so on return, the state does + not have to be cleared (since upon return from the + callback the window could be destroyed (or layer + removed). */ + return (__glutCurrentWindow->workMask & GLUT_REPAIR_WORK) + || __glutWindowDamaged; + case GLUT_OVERLAY_DAMAGED: + if (__glutCurrentWindow->overlay) { + return (__glutCurrentWindow->workMask & GLUT_OVERLAY_REPAIR_WORK) + || __glutWindowDamaged; + } else { + return -1; + } + default: + __glutWarning("invalid glutLayerGet param: %d", param); + return -1; + } +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_roman.c b/xc/extras/Mesa/src-glut/glut_roman.c new file mode 100644 index 000000000..af2b4ec95 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_roman.c @@ -0,0 +1,2451 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#include "glutstroke.h" + +/* char: 33 '!' */ + +static const CoordRec char33_stroke0[] = { + { 13.3819, 100 }, + { 13.3819, 33.3333 }, +}; + +static const CoordRec char33_stroke1[] = { + { 13.3819, 9.5238 }, + { 8.62, 4.7619 }, + { 13.3819, 0 }, + { 18.1438, 4.7619 }, + { 13.3819, 9.5238 }, +}; + +static const StrokeRec char33[] = { + { 2, char33_stroke0 }, + { 5, char33_stroke1 }, +}; + +/* char: 34 '"' */ + +static const CoordRec char34_stroke0[] = { + { 4.02, 100 }, + { 4.02, 66.6667 }, +}; + +static const CoordRec char34_stroke1[] = { + { 42.1152, 100 }, + { 42.1152, 66.6667 }, +}; + +static const StrokeRec char34[] = { + { 2, char34_stroke0 }, + { 2, char34_stroke1 }, +}; + +/* char: 35 '#' */ + +static const CoordRec char35_stroke0[] = { + { 41.2952, 119.048 }, + { 7.9619, -33.3333 }, +}; + +static const CoordRec char35_stroke1[] = { + { 69.8667, 119.048 }, + { 36.5333, -33.3333 }, +}; + +static const CoordRec char35_stroke2[] = { + { 7.9619, 57.1429 }, + { 74.6286, 57.1429 }, +}; + +static const CoordRec char35_stroke3[] = { + { 3.2, 28.5714 }, + { 69.8667, 28.5714 }, +}; + +static const StrokeRec char35[] = { + { 2, char35_stroke0 }, + { 2, char35_stroke1 }, + { 2, char35_stroke2 }, + { 2, char35_stroke3 }, +}; + +/* char: 36 '$' */ + +static const CoordRec char36_stroke0[] = { + { 28.6295, 119.048 }, + { 28.6295, -19.0476 }, +}; + +static const CoordRec char36_stroke1[] = { + { 47.6771, 119.048 }, + { 47.6771, -19.0476 }, +}; + +static const CoordRec char36_stroke2[] = { + { 71.4867, 85.7143 }, + { 61.9629, 95.2381 }, + { 47.6771, 100 }, + { 28.6295, 100 }, + { 14.3438, 95.2381 }, + { 4.82, 85.7143 }, + { 4.82, 76.1905 }, + { 9.5819, 66.6667 }, + { 14.3438, 61.9048 }, + { 23.8676, 57.1429 }, + { 52.439, 47.619 }, + { 61.9629, 42.8571 }, + { 66.7248, 38.0952 }, + { 71.4867, 28.5714 }, + { 71.4867, 14.2857 }, + { 61.9629, 4.7619 }, + { 47.6771, 0 }, + { 28.6295, 0 }, + { 14.3438, 4.7619 }, + { 4.82, 14.2857 }, +}; + +static const StrokeRec char36[] = { + { 2, char36_stroke0 }, + { 2, char36_stroke1 }, + { 20, char36_stroke2 }, +}; + +/* char: 37 '%' */ + +static const CoordRec char37_stroke0[] = { + { 92.0743, 100 }, + { 6.36, 0 }, +}; + +static const CoordRec char37_stroke1[] = { + { 30.1695, 100 }, + { 39.6933, 90.4762 }, + { 39.6933, 80.9524 }, + { 34.9314, 71.4286 }, + { 25.4076, 66.6667 }, + { 15.8838, 66.6667 }, + { 6.36, 76.1905 }, + { 6.36, 85.7143 }, + { 11.1219, 95.2381 }, + { 20.6457, 100 }, + { 30.1695, 100 }, + { 39.6933, 95.2381 }, + { 53.979, 90.4762 }, + { 68.2648, 90.4762 }, + { 82.5505, 95.2381 }, + { 92.0743, 100 }, +}; + +static const CoordRec char37_stroke2[] = { + { 73.0267, 33.3333 }, + { 63.5029, 28.5714 }, + { 58.741, 19.0476 }, + { 58.741, 9.5238 }, + { 68.2648, 0 }, + { 77.7886, 0 }, + { 87.3124, 4.7619 }, + { 92.0743, 14.2857 }, + { 92.0743, 23.8095 }, + { 82.5505, 33.3333 }, + { 73.0267, 33.3333 }, +}; + +static const StrokeRec char37[] = { + { 2, char37_stroke0 }, + { 16, char37_stroke1 }, + { 11, char37_stroke2 }, +}; + +/* char: 38 '&' */ + +static const CoordRec char38_stroke0[] = { + { 101.218, 57.1429 }, + { 101.218, 61.9048 }, + { 96.4562, 66.6667 }, + { 91.6943, 66.6667 }, + { 86.9324, 61.9048 }, + { 82.1705, 52.381 }, + { 72.6467, 28.5714 }, + { 63.1229, 14.2857 }, + { 53.599, 4.7619 }, + { 44.0752, 0 }, + { 25.0276, 0 }, + { 15.5038, 4.7619 }, + { 10.7419, 9.5238 }, + { 5.98, 19.0476 }, + { 5.98, 28.5714 }, + { 10.7419, 38.0952 }, + { 15.5038, 42.8571 }, + { 48.8371, 61.9048 }, + { 53.599, 66.6667 }, + { 58.361, 76.1905 }, + { 58.361, 85.7143 }, + { 53.599, 95.2381 }, + { 44.0752, 100 }, + { 34.5514, 95.2381 }, + { 29.7895, 85.7143 }, + { 29.7895, 76.1905 }, + { 34.5514, 61.9048 }, + { 44.0752, 47.619 }, + { 67.8848, 14.2857 }, + { 77.4086, 4.7619 }, + { 86.9324, 0 }, + { 96.4562, 0 }, + { 101.218, 4.7619 }, + { 101.218, 9.5238 }, +}; + +static const StrokeRec char38[] = { + { 34, char38_stroke0 }, +}; + +/* char: 39 ''' */ + +static const CoordRec char39_stroke0[] = { + { 4.44, 100 }, + { 4.44, 66.6667 }, +}; + +static const StrokeRec char39[] = { + { 2, char39_stroke0 }, +}; + +/* char: 40 '(' */ + +static const CoordRec char40_stroke0[] = { + { 40.9133, 119.048 }, + { 31.3895, 109.524 }, + { 21.8657, 95.2381 }, + { 12.3419, 76.1905 }, + { 7.58, 52.381 }, + { 7.58, 33.3333 }, + { 12.3419, 9.5238 }, + { 21.8657, -9.5238 }, + { 31.3895, -23.8095 }, + { 40.9133, -33.3333 }, +}; + +static const StrokeRec char40[] = { + { 10, char40_stroke0 }, +}; + +/* char: 41 ')' */ + +static const CoordRec char41_stroke0[] = { + { 5.28, 119.048 }, + { 14.8038, 109.524 }, + { 24.3276, 95.2381 }, + { 33.8514, 76.1905 }, + { 38.6133, 52.381 }, + { 38.6133, 33.3333 }, + { 33.8514, 9.5238 }, + { 24.3276, -9.5238 }, + { 14.8038, -23.8095 }, + { 5.28, -33.3333 }, +}; + +static const StrokeRec char41[] = { + { 10, char41_stroke0 }, +}; + +/* char: 42 '*' */ + +static const CoordRec char42_stroke0[] = { + { 30.7695, 71.4286 }, + { 30.7695, 14.2857 }, +}; + +static const CoordRec char42_stroke1[] = { + { 6.96, 57.1429 }, + { 54.579, 28.5714 }, +}; + +static const CoordRec char42_stroke2[] = { + { 54.579, 57.1429 }, + { 6.96, 28.5714 }, +}; + +static const StrokeRec char42[] = { + { 2, char42_stroke0 }, + { 2, char42_stroke1 }, + { 2, char42_stroke2 }, +}; + +/* char: 43 '+' */ + +static const CoordRec char43_stroke0[] = { + { 48.8371, 85.7143 }, + { 48.8371, 0 }, +}; + +static const CoordRec char43_stroke1[] = { + { 5.98, 42.8571 }, + { 91.6943, 42.8571 }, +}; + +static const StrokeRec char43[] = { + { 2, char43_stroke0 }, + { 2, char43_stroke1 }, +}; + +/* char: 44 ',' */ + +static const CoordRec char44_stroke0[] = { + { 18.2838, 4.7619 }, + { 13.5219, 0 }, + { 8.76, 4.7619 }, + { 13.5219, 9.5238 }, + { 18.2838, 4.7619 }, + { 18.2838, -4.7619 }, + { 13.5219, -14.2857 }, + { 8.76, -19.0476 }, +}; + +static const StrokeRec char44[] = { + { 8, char44_stroke0 }, +}; + +/* char: 45 '-' */ + +static const CoordRec char45_stroke0[] = { + { 7.38, 42.8571 }, + { 93.0943, 42.8571 }, +}; + +static const StrokeRec char45[] = { + { 2, char45_stroke0 }, +}; + +/* char: 46 '.' */ + +static const CoordRec char46_stroke0[] = { + { 13.1019, 9.5238 }, + { 8.34, 4.7619 }, + { 13.1019, 0 }, + { 17.8638, 4.7619 }, + { 13.1019, 9.5238 }, +}; + +static const StrokeRec char46[] = { + { 5, char46_stroke0 }, +}; + +/* char: 47 '/' */ + +static const CoordRec char47_stroke0[] = { + { 7.24, -14.2857 }, + { 73.9067, 100 }, +}; + +static const StrokeRec char47[] = { + { 2, char47_stroke0 }, +}; + +/* char: 48 '0' */ + +static const CoordRec char48_stroke0[] = { + { 33.5514, 100 }, + { 19.2657, 95.2381 }, + { 9.7419, 80.9524 }, + { 4.98, 57.1429 }, + { 4.98, 42.8571 }, + { 9.7419, 19.0476 }, + { 19.2657, 4.7619 }, + { 33.5514, 0 }, + { 43.0752, 0 }, + { 57.361, 4.7619 }, + { 66.8848, 19.0476 }, + { 71.6467, 42.8571 }, + { 71.6467, 57.1429 }, + { 66.8848, 80.9524 }, + { 57.361, 95.2381 }, + { 43.0752, 100 }, + { 33.5514, 100 }, +}; + +static const StrokeRec char48[] = { + { 17, char48_stroke0 }, +}; + +/* char: 49 '1' */ + +static const CoordRec char49_stroke0[] = { + { 11.82, 80.9524 }, + { 21.3438, 85.7143 }, + { 35.6295, 100 }, + { 35.6295, 0 }, +}; + +static const StrokeRec char49[] = { + { 4, char49_stroke0 }, +}; + +/* char: 50 '2' */ + +static const CoordRec char50_stroke0[] = { + { 10.1819, 76.1905 }, + { 10.1819, 80.9524 }, + { 14.9438, 90.4762 }, + { 19.7057, 95.2381 }, + { 29.2295, 100 }, + { 48.2771, 100 }, + { 57.801, 95.2381 }, + { 62.5629, 90.4762 }, + { 67.3248, 80.9524 }, + { 67.3248, 71.4286 }, + { 62.5629, 61.9048 }, + { 53.039, 47.619 }, + { 5.42, 0 }, + { 72.0867, 0 }, +}; + +static const StrokeRec char50[] = { + { 14, char50_stroke0 }, +}; + +/* char: 51 '3' */ + +static const CoordRec char51_stroke0[] = { + { 14.5238, 100 }, + { 66.9048, 100 }, + { 38.3333, 61.9048 }, + { 52.619, 61.9048 }, + { 62.1429, 57.1429 }, + { 66.9048, 52.381 }, + { 71.6667, 38.0952 }, + { 71.6667, 28.5714 }, + { 66.9048, 14.2857 }, + { 57.381, 4.7619 }, + { 43.0952, 0 }, + { 28.8095, 0 }, + { 14.5238, 4.7619 }, + { 9.7619, 9.5238 }, + { 5, 19.0476 }, +}; + +static const StrokeRec char51[] = { + { 15, char51_stroke0 }, +}; + +/* char: 52 '4' */ + +static const CoordRec char52_stroke0[] = { + { 51.499, 100 }, + { 3.88, 33.3333 }, + { 75.3086, 33.3333 }, +}; + +static const CoordRec char52_stroke1[] = { + { 51.499, 100 }, + { 51.499, 0 }, +}; + +static const StrokeRec char52[] = { + { 3, char52_stroke0 }, + { 2, char52_stroke1 }, +}; + +/* char: 53 '5' */ + +static const CoordRec char53_stroke0[] = { + { 62.0029, 100 }, + { 14.3838, 100 }, + { 9.6219, 57.1429 }, + { 14.3838, 61.9048 }, + { 28.6695, 66.6667 }, + { 42.9552, 66.6667 }, + { 57.241, 61.9048 }, + { 66.7648, 52.381 }, + { 71.5267, 38.0952 }, + { 71.5267, 28.5714 }, + { 66.7648, 14.2857 }, + { 57.241, 4.7619 }, + { 42.9552, 0 }, + { 28.6695, 0 }, + { 14.3838, 4.7619 }, + { 9.6219, 9.5238 }, + { 4.86, 19.0476 }, +}; + +static const StrokeRec char53[] = { + { 17, char53_stroke0 }, +}; + +/* char: 54 '6' */ + +static const CoordRec char54_stroke0[] = { + { 62.7229, 85.7143 }, + { 57.961, 95.2381 }, + { 43.6752, 100 }, + { 34.1514, 100 }, + { 19.8657, 95.2381 }, + { 10.3419, 80.9524 }, + { 5.58, 57.1429 }, + { 5.58, 33.3333 }, + { 10.3419, 14.2857 }, + { 19.8657, 4.7619 }, + { 34.1514, 0 }, + { 38.9133, 0 }, + { 53.199, 4.7619 }, + { 62.7229, 14.2857 }, + { 67.4848, 28.5714 }, + { 67.4848, 33.3333 }, + { 62.7229, 47.619 }, + { 53.199, 57.1429 }, + { 38.9133, 61.9048 }, + { 34.1514, 61.9048 }, + { 19.8657, 57.1429 }, + { 10.3419, 47.619 }, + { 5.58, 33.3333 }, +}; + +static const StrokeRec char54[] = { + { 23, char54_stroke0 }, +}; + +/* char: 55 '7' */ + +static const CoordRec char55_stroke0[] = { + { 72.2267, 100 }, + { 24.6076, 0 }, +}; + +static const CoordRec char55_stroke1[] = { + { 5.56, 100 }, + { 72.2267, 100 }, +}; + +static const StrokeRec char55[] = { + { 2, char55_stroke0 }, + { 2, char55_stroke1 }, +}; + +/* char: 56 '8' */ + +static const CoordRec char56_stroke0[] = { + { 29.4095, 100 }, + { 15.1238, 95.2381 }, + { 10.3619, 85.7143 }, + { 10.3619, 76.1905 }, + { 15.1238, 66.6667 }, + { 24.6476, 61.9048 }, + { 43.6952, 57.1429 }, + { 57.981, 52.381 }, + { 67.5048, 42.8571 }, + { 72.2667, 33.3333 }, + { 72.2667, 19.0476 }, + { 67.5048, 9.5238 }, + { 62.7429, 4.7619 }, + { 48.4571, 0 }, + { 29.4095, 0 }, + { 15.1238, 4.7619 }, + { 10.3619, 9.5238 }, + { 5.6, 19.0476 }, + { 5.6, 33.3333 }, + { 10.3619, 42.8571 }, + { 19.8857, 52.381 }, + { 34.1714, 57.1429 }, + { 53.219, 61.9048 }, + { 62.7429, 66.6667 }, + { 67.5048, 76.1905 }, + { 67.5048, 85.7143 }, + { 62.7429, 95.2381 }, + { 48.4571, 100 }, + { 29.4095, 100 }, +}; + +static const StrokeRec char56[] = { + { 29, char56_stroke0 }, +}; + +/* char: 57 '9' */ + +static const CoordRec char57_stroke0[] = { + { 68.5048, 66.6667 }, + { 63.7429, 52.381 }, + { 54.219, 42.8571 }, + { 39.9333, 38.0952 }, + { 35.1714, 38.0952 }, + { 20.8857, 42.8571 }, + { 11.3619, 52.381 }, + { 6.6, 66.6667 }, + { 6.6, 71.4286 }, + { 11.3619, 85.7143 }, + { 20.8857, 95.2381 }, + { 35.1714, 100 }, + { 39.9333, 100 }, + { 54.219, 95.2381 }, + { 63.7429, 85.7143 }, + { 68.5048, 66.6667 }, + { 68.5048, 42.8571 }, + { 63.7429, 19.0476 }, + { 54.219, 4.7619 }, + { 39.9333, 0 }, + { 30.4095, 0 }, + { 16.1238, 4.7619 }, + { 11.3619, 14.2857 }, +}; + +static const StrokeRec char57[] = { + { 23, char57_stroke0 }, +}; + +/* char: 58 ':' */ + +static const CoordRec char58_stroke0[] = { + { 14.0819, 66.6667 }, + { 9.32, 61.9048 }, + { 14.0819, 57.1429 }, + { 18.8438, 61.9048 }, + { 14.0819, 66.6667 }, +}; + +static const CoordRec char58_stroke1[] = { + { 14.0819, 9.5238 }, + { 9.32, 4.7619 }, + { 14.0819, 0 }, + { 18.8438, 4.7619 }, + { 14.0819, 9.5238 }, +}; + +static const StrokeRec char58[] = { + { 5, char58_stroke0 }, + { 5, char58_stroke1 }, +}; + +/* char: 59 ';' */ + +static const CoordRec char59_stroke0[] = { + { 12.9619, 66.6667 }, + { 8.2, 61.9048 }, + { 12.9619, 57.1429 }, + { 17.7238, 61.9048 }, + { 12.9619, 66.6667 }, +}; + +static const CoordRec char59_stroke1[] = { + { 17.7238, 4.7619 }, + { 12.9619, 0 }, + { 8.2, 4.7619 }, + { 12.9619, 9.5238 }, + { 17.7238, 4.7619 }, + { 17.7238, -4.7619 }, + { 12.9619, -14.2857 }, + { 8.2, -19.0476 }, +}; + +static const StrokeRec char59[] = { + { 5, char59_stroke0 }, + { 8, char59_stroke1 }, +}; + +/* char: 60 '<' */ + +static const CoordRec char60_stroke0[] = { + { 79.2505, 85.7143 }, + { 3.06, 42.8571 }, + { 79.2505, 0 }, +}; + +static const StrokeRec char60[] = { + { 3, char60_stroke0 }, +}; + +/* char: 61 '=' */ + +static const CoordRec char61_stroke0[] = { + { 5.7, 57.1429 }, + { 91.4143, 57.1429 }, +}; + +static const CoordRec char61_stroke1[] = { + { 5.7, 28.5714 }, + { 91.4143, 28.5714 }, +}; + +static const StrokeRec char61[] = { + { 2, char61_stroke0 }, + { 2, char61_stroke1 }, +}; + +/* char: 62 '>' */ + +static const CoordRec char62_stroke0[] = { + { 2.78, 85.7143 }, + { 78.9705, 42.8571 }, + { 2.78, 0 }, +}; + +static const StrokeRec char62[] = { + { 3, char62_stroke0 }, +}; + +/* char: 63 '?' */ + +static const CoordRec char63_stroke0[] = { + { 8.42, 76.1905 }, + { 8.42, 80.9524 }, + { 13.1819, 90.4762 }, + { 17.9438, 95.2381 }, + { 27.4676, 100 }, + { 46.5152, 100 }, + { 56.039, 95.2381 }, + { 60.801, 90.4762 }, + { 65.5629, 80.9524 }, + { 65.5629, 71.4286 }, + { 60.801, 61.9048 }, + { 56.039, 57.1429 }, + { 36.9914, 47.619 }, + { 36.9914, 33.3333 }, +}; + +static const CoordRec char63_stroke1[] = { + { 36.9914, 9.5238 }, + { 32.2295, 4.7619 }, + { 36.9914, 0 }, + { 41.7533, 4.7619 }, + { 36.9914, 9.5238 }, +}; + +static const StrokeRec char63[] = { + { 14, char63_stroke0 }, + { 5, char63_stroke1 }, +}; + +/* char: 64 '@' */ + +static const CoordRec char64_stroke0[] = { + { 49.2171, 52.381 }, + { 39.6933, 57.1429 }, + { 30.1695, 57.1429 }, + { 25.4076, 47.619 }, + { 25.4076, 42.8571 }, + { 30.1695, 33.3333 }, + { 39.6933, 33.3333 }, + { 49.2171, 38.0952 }, +}; + +static const CoordRec char64_stroke1[] = { + { 49.2171, 57.1429 }, + { 49.2171, 38.0952 }, + { 53.979, 33.3333 }, + { 63.5029, 33.3333 }, + { 68.2648, 42.8571 }, + { 68.2648, 47.619 }, + { 63.5029, 61.9048 }, + { 53.979, 71.4286 }, + { 39.6933, 76.1905 }, + { 34.9314, 76.1905 }, + { 20.6457, 71.4286 }, + { 11.1219, 61.9048 }, + { 6.36, 47.619 }, + { 6.36, 42.8571 }, + { 11.1219, 28.5714 }, + { 20.6457, 19.0476 }, + { 34.9314, 14.2857 }, + { 39.6933, 14.2857 }, + { 53.979, 19.0476 }, +}; + +static const StrokeRec char64[] = { + { 8, char64_stroke0 }, + { 19, char64_stroke1 }, +}; + +/* char: 65 'A' */ + +static const CoordRec char65_stroke0[] = { + { 40.5952, 100 }, + { 2.5, 0 }, +}; + +static const CoordRec char65_stroke1[] = { + { 40.5952, 100 }, + { 78.6905, 0 }, +}; + +static const CoordRec char65_stroke2[] = { + { 16.7857, 33.3333 }, + { 64.4048, 33.3333 }, +}; + +static const StrokeRec char65[] = { + { 2, char65_stroke0 }, + { 2, char65_stroke1 }, + { 2, char65_stroke2 }, +}; + +/* char: 66 'B' */ + +static const CoordRec char66_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char66_stroke1[] = { + { 11.42, 100 }, + { 54.2771, 100 }, + { 68.5629, 95.2381 }, + { 73.3248, 90.4762 }, + { 78.0867, 80.9524 }, + { 78.0867, 71.4286 }, + { 73.3248, 61.9048 }, + { 68.5629, 57.1429 }, + { 54.2771, 52.381 }, +}; + +static const CoordRec char66_stroke2[] = { + { 11.42, 52.381 }, + { 54.2771, 52.381 }, + { 68.5629, 47.619 }, + { 73.3248, 42.8571 }, + { 78.0867, 33.3333 }, + { 78.0867, 19.0476 }, + { 73.3248, 9.5238 }, + { 68.5629, 4.7619 }, + { 54.2771, 0 }, + { 11.42, 0 }, +}; + +static const StrokeRec char66[] = { + { 2, char66_stroke0 }, + { 9, char66_stroke1 }, + { 10, char66_stroke2 }, +}; + +/* char: 67 'C' */ + +static const CoordRec char67_stroke0[] = { + { 78.0886, 76.1905 }, + { 73.3267, 85.7143 }, + { 63.8029, 95.2381 }, + { 54.279, 100 }, + { 35.2314, 100 }, + { 25.7076, 95.2381 }, + { 16.1838, 85.7143 }, + { 11.4219, 76.1905 }, + { 6.66, 61.9048 }, + { 6.66, 38.0952 }, + { 11.4219, 23.8095 }, + { 16.1838, 14.2857 }, + { 25.7076, 4.7619 }, + { 35.2314, 0 }, + { 54.279, 0 }, + { 63.8029, 4.7619 }, + { 73.3267, 14.2857 }, + { 78.0886, 23.8095 }, +}; + +static const StrokeRec char67[] = { + { 18, char67_stroke0 }, +}; + +/* char: 68 'D' */ + +static const CoordRec char68_stroke0[] = { + { 11.96, 100 }, + { 11.96, 0 }, +}; + +static const CoordRec char68_stroke1[] = { + { 11.96, 100 }, + { 45.2933, 100 }, + { 59.579, 95.2381 }, + { 69.1029, 85.7143 }, + { 73.8648, 76.1905 }, + { 78.6267, 61.9048 }, + { 78.6267, 38.0952 }, + { 73.8648, 23.8095 }, + { 69.1029, 14.2857 }, + { 59.579, 4.7619 }, + { 45.2933, 0 }, + { 11.96, 0 }, +}; + +static const StrokeRec char68[] = { + { 2, char68_stroke0 }, + { 12, char68_stroke1 }, +}; + +/* char: 69 'E' */ + +static const CoordRec char69_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char69_stroke1[] = { + { 11.42, 100 }, + { 73.3248, 100 }, +}; + +static const CoordRec char69_stroke2[] = { + { 11.42, 52.381 }, + { 49.5152, 52.381 }, +}; + +static const CoordRec char69_stroke3[] = { + { 11.42, 0 }, + { 73.3248, 0 }, +}; + +static const StrokeRec char69[] = { + { 2, char69_stroke0 }, + { 2, char69_stroke1 }, + { 2, char69_stroke2 }, + { 2, char69_stroke3 }, +}; + +/* char: 70 'F' */ + +static const CoordRec char70_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char70_stroke1[] = { + { 11.42, 100 }, + { 73.3248, 100 }, +}; + +static const CoordRec char70_stroke2[] = { + { 11.42, 52.381 }, + { 49.5152, 52.381 }, +}; + +static const StrokeRec char70[] = { + { 2, char70_stroke0 }, + { 2, char70_stroke1 }, + { 2, char70_stroke2 }, +}; + +/* char: 71 'G' */ + +static const CoordRec char71_stroke0[] = { + { 78.4886, 76.1905 }, + { 73.7267, 85.7143 }, + { 64.2029, 95.2381 }, + { 54.679, 100 }, + { 35.6314, 100 }, + { 26.1076, 95.2381 }, + { 16.5838, 85.7143 }, + { 11.8219, 76.1905 }, + { 7.06, 61.9048 }, + { 7.06, 38.0952 }, + { 11.8219, 23.8095 }, + { 16.5838, 14.2857 }, + { 26.1076, 4.7619 }, + { 35.6314, 0 }, + { 54.679, 0 }, + { 64.2029, 4.7619 }, + { 73.7267, 14.2857 }, + { 78.4886, 23.8095 }, + { 78.4886, 38.0952 }, +}; + +static const CoordRec char71_stroke1[] = { + { 54.679, 38.0952 }, + { 78.4886, 38.0952 }, +}; + +static const StrokeRec char71[] = { + { 19, char71_stroke0 }, + { 2, char71_stroke1 }, +}; + +/* char: 72 'H' */ + +static const CoordRec char72_stroke0[] = { + { 11.42, 100 }, + { 11.42, 0 }, +}; + +static const CoordRec char72_stroke1[] = { + { 78.0867, 100 }, + { 78.0867, 0 }, +}; + +static const CoordRec char72_stroke2[] = { + { 11.42, 52.381 }, + { 78.0867, 52.381 }, +}; + +static const StrokeRec char72[] = { + { 2, char72_stroke0 }, + { 2, char72_stroke1 }, + { 2, char72_stroke2 }, +}; + +/* char: 73 'I' */ + +static const CoordRec char73_stroke0[] = { + { 10.86, 100 }, + { 10.86, 0 }, +}; + +static const StrokeRec char73[] = { + { 2, char73_stroke0 }, +}; + +/* char: 74 'J' */ + +static const CoordRec char74_stroke0[] = { + { 50.119, 100 }, + { 50.119, 23.8095 }, + { 45.3571, 9.5238 }, + { 40.5952, 4.7619 }, + { 31.0714, 0 }, + { 21.5476, 0 }, + { 12.0238, 4.7619 }, + { 7.2619, 9.5238 }, + { 2.5, 23.8095 }, + { 2.5, 33.3333 }, +}; + +static const StrokeRec char74[] = { + { 10, char74_stroke0 }, +}; + +/* char: 75 'K' */ + +static const CoordRec char75_stroke0[] = { + { 11.28, 100 }, + { 11.28, 0 }, +}; + +static const CoordRec char75_stroke1[] = { + { 77.9467, 100 }, + { 11.28, 33.3333 }, +}; + +static const CoordRec char75_stroke2[] = { + { 35.0895, 57.1429 }, + { 77.9467, 0 }, +}; + +static const StrokeRec char75[] = { + { 2, char75_stroke0 }, + { 2, char75_stroke1 }, + { 2, char75_stroke2 }, +}; + +/* char: 76 'L' */ + +static const CoordRec char76_stroke0[] = { + { 11.68, 100 }, + { 11.68, 0 }, +}; + +static const CoordRec char76_stroke1[] = { + { 11.68, 0 }, + { 68.8229, 0 }, +}; + +static const StrokeRec char76[] = { + { 2, char76_stroke0 }, + { 2, char76_stroke1 }, +}; + +/* char: 77 'M' */ + +static const CoordRec char77_stroke0[] = { + { 10.86, 100 }, + { 10.86, 0 }, +}; + +static const CoordRec char77_stroke1[] = { + { 10.86, 100 }, + { 48.9552, 0 }, +}; + +static const CoordRec char77_stroke2[] = { + { 87.0505, 100 }, + { 48.9552, 0 }, +}; + +static const CoordRec char77_stroke3[] = { + { 87.0505, 100 }, + { 87.0505, 0 }, +}; + +static const StrokeRec char77[] = { + { 2, char77_stroke0 }, + { 2, char77_stroke1 }, + { 2, char77_stroke2 }, + { 2, char77_stroke3 }, +}; + +/* char: 78 'N' */ + +static const CoordRec char78_stroke0[] = { + { 11.14, 100 }, + { 11.14, 0 }, +}; + +static const CoordRec char78_stroke1[] = { + { 11.14, 100 }, + { 77.8067, 0 }, +}; + +static const CoordRec char78_stroke2[] = { + { 77.8067, 100 }, + { 77.8067, 0 }, +}; + +static const StrokeRec char78[] = { + { 2, char78_stroke0 }, + { 2, char78_stroke1 }, + { 2, char78_stroke2 }, +}; + +/* char: 79 'O' */ + +static const CoordRec char79_stroke0[] = { + { 34.8114, 100 }, + { 25.2876, 95.2381 }, + { 15.7638, 85.7143 }, + { 11.0019, 76.1905 }, + { 6.24, 61.9048 }, + { 6.24, 38.0952 }, + { 11.0019, 23.8095 }, + { 15.7638, 14.2857 }, + { 25.2876, 4.7619 }, + { 34.8114, 0 }, + { 53.859, 0 }, + { 63.3829, 4.7619 }, + { 72.9067, 14.2857 }, + { 77.6686, 23.8095 }, + { 82.4305, 38.0952 }, + { 82.4305, 61.9048 }, + { 77.6686, 76.1905 }, + { 72.9067, 85.7143 }, + { 63.3829, 95.2381 }, + { 53.859, 100 }, + { 34.8114, 100 }, +}; + +static const StrokeRec char79[] = { + { 21, char79_stroke0 }, +}; + +/* char: 80 'P' */ + +static const CoordRec char80_stroke0[] = { + { 12.1, 100 }, + { 12.1, 0 }, +}; + +static const CoordRec char80_stroke1[] = { + { 12.1, 100 }, + { 54.9571, 100 }, + { 69.2429, 95.2381 }, + { 74.0048, 90.4762 }, + { 78.7667, 80.9524 }, + { 78.7667, 66.6667 }, + { 74.0048, 57.1429 }, + { 69.2429, 52.381 }, + { 54.9571, 47.619 }, + { 12.1, 47.619 }, +}; + +static const StrokeRec char80[] = { + { 2, char80_stroke0 }, + { 10, char80_stroke1 }, +}; + +/* char: 81 'Q' */ + +static const CoordRec char81_stroke0[] = { + { 33.8714, 100 }, + { 24.3476, 95.2381 }, + { 14.8238, 85.7143 }, + { 10.0619, 76.1905 }, + { 5.3, 61.9048 }, + { 5.3, 38.0952 }, + { 10.0619, 23.8095 }, + { 14.8238, 14.2857 }, + { 24.3476, 4.7619 }, + { 33.8714, 0 }, + { 52.919, 0 }, + { 62.4429, 4.7619 }, + { 71.9667, 14.2857 }, + { 76.7286, 23.8095 }, + { 81.4905, 38.0952 }, + { 81.4905, 61.9048 }, + { 76.7286, 76.1905 }, + { 71.9667, 85.7143 }, + { 62.4429, 95.2381 }, + { 52.919, 100 }, + { 33.8714, 100 }, +}; + +static const CoordRec char81_stroke1[] = { + { 48.1571, 19.0476 }, + { 76.7286, -9.5238 }, +}; + +static const StrokeRec char81[] = { + { 21, char81_stroke0 }, + { 2, char81_stroke1 }, +}; + +/* char: 82 'R' */ + +static const CoordRec char82_stroke0[] = { + { 11.68, 100 }, + { 11.68, 0 }, +}; + +static const CoordRec char82_stroke1[] = { + { 11.68, 100 }, + { 54.5371, 100 }, + { 68.8229, 95.2381 }, + { 73.5848, 90.4762 }, + { 78.3467, 80.9524 }, + { 78.3467, 71.4286 }, + { 73.5848, 61.9048 }, + { 68.8229, 57.1429 }, + { 54.5371, 52.381 }, + { 11.68, 52.381 }, +}; + +static const CoordRec char82_stroke2[] = { + { 45.0133, 52.381 }, + { 78.3467, 0 }, +}; + +static const StrokeRec char82[] = { + { 2, char82_stroke0 }, + { 10, char82_stroke1 }, + { 2, char82_stroke2 }, +}; + +/* char: 83 'S' */ + +static const CoordRec char83_stroke0[] = { + { 74.6667, 85.7143 }, + { 65.1429, 95.2381 }, + { 50.8571, 100 }, + { 31.8095, 100 }, + { 17.5238, 95.2381 }, + { 8, 85.7143 }, + { 8, 76.1905 }, + { 12.7619, 66.6667 }, + { 17.5238, 61.9048 }, + { 27.0476, 57.1429 }, + { 55.619, 47.619 }, + { 65.1429, 42.8571 }, + { 69.9048, 38.0952 }, + { 74.6667, 28.5714 }, + { 74.6667, 14.2857 }, + { 65.1429, 4.7619 }, + { 50.8571, 0 }, + { 31.8095, 0 }, + { 17.5238, 4.7619 }, + { 8, 14.2857 }, +}; + +static const StrokeRec char83[] = { + { 20, char83_stroke0 }, +}; + +/* char: 84 'T' */ + +static const CoordRec char84_stroke0[] = { + { 35.6933, 100 }, + { 35.6933, 0 }, +}; + +static const CoordRec char84_stroke1[] = { + { 2.36, 100 }, + { 69.0267, 100 }, +}; + +static const StrokeRec char84[] = { + { 2, char84_stroke0 }, + { 2, char84_stroke1 }, +}; + +/* char: 85 'U' */ + +static const CoordRec char85_stroke0[] = { + { 11.54, 100 }, + { 11.54, 28.5714 }, + { 16.3019, 14.2857 }, + { 25.8257, 4.7619 }, + { 40.1114, 0 }, + { 49.6352, 0 }, + { 63.921, 4.7619 }, + { 73.4448, 14.2857 }, + { 78.2067, 28.5714 }, + { 78.2067, 100 }, +}; + +static const StrokeRec char85[] = { + { 10, char85_stroke0 }, +}; + +/* char: 86 'V' */ + +static const CoordRec char86_stroke0[] = { + { 2.36, 100 }, + { 40.4552, 0 }, +}; + +static const CoordRec char86_stroke1[] = { + { 78.5505, 100 }, + { 40.4552, 0 }, +}; + +static const StrokeRec char86[] = { + { 2, char86_stroke0 }, + { 2, char86_stroke1 }, +}; + +/* char: 87 'W' */ + +static const CoordRec char87_stroke0[] = { + { 2.22, 100 }, + { 26.0295, 0 }, +}; + +static const CoordRec char87_stroke1[] = { + { 49.839, 100 }, + { 26.0295, 0 }, +}; + +static const CoordRec char87_stroke2[] = { + { 49.839, 100 }, + { 73.6486, 0 }, +}; + +static const CoordRec char87_stroke3[] = { + { 97.4581, 100 }, + { 73.6486, 0 }, +}; + +static const StrokeRec char87[] = { + { 2, char87_stroke0 }, + { 2, char87_stroke1 }, + { 2, char87_stroke2 }, + { 2, char87_stroke3 }, +}; + +/* char: 88 'X' */ + +static const CoordRec char88_stroke0[] = { + { 2.5, 100 }, + { 69.1667, 0 }, +}; + +static const CoordRec char88_stroke1[] = { + { 69.1667, 100 }, + { 2.5, 0 }, +}; + +static const StrokeRec char88[] = { + { 2, char88_stroke0 }, + { 2, char88_stroke1 }, +}; + +/* char: 89 'Y' */ + +static const CoordRec char89_stroke0[] = { + { 1.52, 100 }, + { 39.6152, 52.381 }, + { 39.6152, 0 }, +}; + +static const CoordRec char89_stroke1[] = { + { 77.7105, 100 }, + { 39.6152, 52.381 }, +}; + +static const StrokeRec char89[] = { + { 3, char89_stroke0 }, + { 2, char89_stroke1 }, +}; + +/* char: 90 'Z' */ + +static const CoordRec char90_stroke0[] = { + { 69.1667, 100 }, + { 2.5, 0 }, +}; + +static const CoordRec char90_stroke1[] = { + { 2.5, 100 }, + { 69.1667, 100 }, +}; + +static const CoordRec char90_stroke2[] = { + { 2.5, 0 }, + { 69.1667, 0 }, +}; + +static const StrokeRec char90[] = { + { 2, char90_stroke0 }, + { 2, char90_stroke1 }, + { 2, char90_stroke2 }, +}; + +/* char: 91 '[' */ + +static const CoordRec char91_stroke0[] = { + { 7.78, 119.048 }, + { 7.78, -33.3333 }, +}; + +static const CoordRec char91_stroke1[] = { + { 12.5419, 119.048 }, + { 12.5419, -33.3333 }, +}; + +static const CoordRec char91_stroke2[] = { + { 7.78, 119.048 }, + { 41.1133, 119.048 }, +}; + +static const CoordRec char91_stroke3[] = { + { 7.78, -33.3333 }, + { 41.1133, -33.3333 }, +}; + +static const StrokeRec char91[] = { + { 2, char91_stroke0 }, + { 2, char91_stroke1 }, + { 2, char91_stroke2 }, + { 2, char91_stroke3 }, +}; + +/* char: 92 '\' */ + +static const CoordRec char92_stroke0[] = { + { 5.84, 100 }, + { 72.5067, -14.2857 }, +}; + +static const StrokeRec char92[] = { + { 2, char92_stroke0 }, +}; + +/* char: 93 ']' */ + +static const CoordRec char93_stroke0[] = { + { 33.0114, 119.048 }, + { 33.0114, -33.3333 }, +}; + +static const CoordRec char93_stroke1[] = { + { 37.7733, 119.048 }, + { 37.7733, -33.3333 }, +}; + +static const CoordRec char93_stroke2[] = { + { 4.44, 119.048 }, + { 37.7733, 119.048 }, +}; + +static const CoordRec char93_stroke3[] = { + { 4.44, -33.3333 }, + { 37.7733, -33.3333 }, +}; + +static const StrokeRec char93[] = { + { 2, char93_stroke0 }, + { 2, char93_stroke1 }, + { 2, char93_stroke2 }, + { 2, char93_stroke3 }, +}; + +/* char: 94 '^' */ + +static const CoordRec char94_stroke0[] = { + { 44.0752, 109.524 }, + { 5.98, 42.8571 }, +}; + +static const CoordRec char94_stroke1[] = { + { 44.0752, 109.524 }, + { 82.1705, 42.8571 }, +}; + +static const StrokeRec char94[] = { + { 2, char94_stroke0 }, + { 2, char94_stroke1 }, +}; + +/* char: 95 '_' */ + +static const CoordRec char95_stroke0[] = { + { -1.1, -33.3333 }, + { 103.662, -33.3333 }, + { 103.662, -28.5714 }, + { -1.1, -28.5714 }, + { -1.1, -33.3333 }, +}; + +static const StrokeRec char95[] = { + { 5, char95_stroke0 }, +}; + +/* char: 96 '`' */ + +static const CoordRec char96_stroke0[] = { + { 33.0219, 100 }, + { 56.8314, 71.4286 }, +}; + +static const CoordRec char96_stroke1[] = { + { 33.0219, 100 }, + { 28.26, 95.2381 }, + { 56.8314, 71.4286 }, +}; + +static const StrokeRec char96[] = { + { 2, char96_stroke0 }, + { 3, char96_stroke1 }, +}; + +/* char: 97 'a' */ + +static const CoordRec char97_stroke0[] = { + { 63.8229, 66.6667 }, + { 63.8229, 0 }, +}; + +static const CoordRec char97_stroke1[] = { + { 63.8229, 52.381 }, + { 54.299, 61.9048 }, + { 44.7752, 66.6667 }, + { 30.4895, 66.6667 }, + { 20.9657, 61.9048 }, + { 11.4419, 52.381 }, + { 6.68, 38.0952 }, + { 6.68, 28.5714 }, + { 11.4419, 14.2857 }, + { 20.9657, 4.7619 }, + { 30.4895, 0 }, + { 44.7752, 0 }, + { 54.299, 4.7619 }, + { 63.8229, 14.2857 }, +}; + +static const StrokeRec char97[] = { + { 2, char97_stroke0 }, + { 14, char97_stroke1 }, +}; + +/* char: 98 'b' */ + +static const CoordRec char98_stroke0[] = { + { 8.76, 100 }, + { 8.76, 0 }, +}; + +static const CoordRec char98_stroke1[] = { + { 8.76, 52.381 }, + { 18.2838, 61.9048 }, + { 27.8076, 66.6667 }, + { 42.0933, 66.6667 }, + { 51.6171, 61.9048 }, + { 61.141, 52.381 }, + { 65.9029, 38.0952 }, + { 65.9029, 28.5714 }, + { 61.141, 14.2857 }, + { 51.6171, 4.7619 }, + { 42.0933, 0 }, + { 27.8076, 0 }, + { 18.2838, 4.7619 }, + { 8.76, 14.2857 }, +}; + +static const StrokeRec char98[] = { + { 2, char98_stroke0 }, + { 14, char98_stroke1 }, +}; + +/* char: 99 'c' */ + +static const CoordRec char99_stroke0[] = { + { 62.6629, 52.381 }, + { 53.139, 61.9048 }, + { 43.6152, 66.6667 }, + { 29.3295, 66.6667 }, + { 19.8057, 61.9048 }, + { 10.2819, 52.381 }, + { 5.52, 38.0952 }, + { 5.52, 28.5714 }, + { 10.2819, 14.2857 }, + { 19.8057, 4.7619 }, + { 29.3295, 0 }, + { 43.6152, 0 }, + { 53.139, 4.7619 }, + { 62.6629, 14.2857 }, +}; + +static const StrokeRec char99[] = { + { 14, char99_stroke0 }, +}; + +/* char: 100 'd' */ + +static const CoordRec char100_stroke0[] = { + { 61.7829, 100 }, + { 61.7829, 0 }, +}; + +static const CoordRec char100_stroke1[] = { + { 61.7829, 52.381 }, + { 52.259, 61.9048 }, + { 42.7352, 66.6667 }, + { 28.4495, 66.6667 }, + { 18.9257, 61.9048 }, + { 9.4019, 52.381 }, + { 4.64, 38.0952 }, + { 4.64, 28.5714 }, + { 9.4019, 14.2857 }, + { 18.9257, 4.7619 }, + { 28.4495, 0 }, + { 42.7352, 0 }, + { 52.259, 4.7619 }, + { 61.7829, 14.2857 }, +}; + +static const StrokeRec char100[] = { + { 2, char100_stroke0 }, + { 14, char100_stroke1 }, +}; + +/* char: 101 'e' */ + +static const CoordRec char101_stroke0[] = { + { 5.72, 38.0952 }, + { 62.8629, 38.0952 }, + { 62.8629, 47.619 }, + { 58.101, 57.1429 }, + { 53.339, 61.9048 }, + { 43.8152, 66.6667 }, + { 29.5295, 66.6667 }, + { 20.0057, 61.9048 }, + { 10.4819, 52.381 }, + { 5.72, 38.0952 }, + { 5.72, 28.5714 }, + { 10.4819, 14.2857 }, + { 20.0057, 4.7619 }, + { 29.5295, 0 }, + { 43.8152, 0 }, + { 53.339, 4.7619 }, + { 62.8629, 14.2857 }, +}; + +static const StrokeRec char101[] = { + { 17, char101_stroke0 }, +}; + +/* char: 102 'f' */ + +static const CoordRec char102_stroke0[] = { + { 38.7752, 100 }, + { 29.2514, 100 }, + { 19.7276, 95.2381 }, + { 14.9657, 80.9524 }, + { 14.9657, 0 }, +}; + +static const CoordRec char102_stroke1[] = { + { 0.68, 66.6667 }, + { 34.0133, 66.6667 }, +}; + +static const StrokeRec char102[] = { + { 5, char102_stroke0 }, + { 2, char102_stroke1 }, +}; + +/* char: 103 'g' */ + +static const CoordRec char103_stroke0[] = { + { 62.5029, 66.6667 }, + { 62.5029, -9.5238 }, + { 57.741, -23.8095 }, + { 52.979, -28.5714 }, + { 43.4552, -33.3333 }, + { 29.1695, -33.3333 }, + { 19.6457, -28.5714 }, +}; + +static const CoordRec char103_stroke1[] = { + { 62.5029, 52.381 }, + { 52.979, 61.9048 }, + { 43.4552, 66.6667 }, + { 29.1695, 66.6667 }, + { 19.6457, 61.9048 }, + { 10.1219, 52.381 }, + { 5.36, 38.0952 }, + { 5.36, 28.5714 }, + { 10.1219, 14.2857 }, + { 19.6457, 4.7619 }, + { 29.1695, 0 }, + { 43.4552, 0 }, + { 52.979, 4.7619 }, + { 62.5029, 14.2857 }, +}; + +static const StrokeRec char103[] = { + { 7, char103_stroke0 }, + { 14, char103_stroke1 }, +}; + +/* char: 104 'h' */ + +static const CoordRec char104_stroke0[] = { + { 9.6, 100 }, + { 9.6, 0 }, +}; + +static const CoordRec char104_stroke1[] = { + { 9.6, 47.619 }, + { 23.8857, 61.9048 }, + { 33.4095, 66.6667 }, + { 47.6952, 66.6667 }, + { 57.219, 61.9048 }, + { 61.981, 47.619 }, + { 61.981, 0 }, +}; + +static const StrokeRec char104[] = { + { 2, char104_stroke0 }, + { 7, char104_stroke1 }, +}; + +/* char: 105 'i' */ + +static const CoordRec char105_stroke0[] = { + { 10.02, 100 }, + { 14.7819, 95.2381 }, + { 19.5438, 100 }, + { 14.7819, 104.762 }, + { 10.02, 100 }, +}; + +static const CoordRec char105_stroke1[] = { + { 14.7819, 66.6667 }, + { 14.7819, 0 }, +}; + +static const StrokeRec char105[] = { + { 5, char105_stroke0 }, + { 2, char105_stroke1 }, +}; + +/* char: 106 'j' */ + +static const CoordRec char106_stroke0[] = { + { 17.3876, 100 }, + { 22.1495, 95.2381 }, + { 26.9114, 100 }, + { 22.1495, 104.762 }, + { 17.3876, 100 }, +}; + +static const CoordRec char106_stroke1[] = { + { 22.1495, 66.6667 }, + { 22.1495, -14.2857 }, + { 17.3876, -28.5714 }, + { 7.8638, -33.3333 }, + { -1.66, -33.3333 }, +}; + +static const StrokeRec char106[] = { + { 5, char106_stroke0 }, + { 5, char106_stroke1 }, +}; + +/* char: 107 'k' */ + +static const CoordRec char107_stroke0[] = { + { 9.6, 100 }, + { 9.6, 0 }, +}; + +static const CoordRec char107_stroke1[] = { + { 57.219, 66.6667 }, + { 9.6, 19.0476 }, +}; + +static const CoordRec char107_stroke2[] = { + { 28.6476, 38.0952 }, + { 61.981, 0 }, +}; + +static const StrokeRec char107[] = { + { 2, char107_stroke0 }, + { 2, char107_stroke1 }, + { 2, char107_stroke2 }, +}; + +/* char: 108 'l' */ + +static const CoordRec char108_stroke0[] = { + { 10.02, 100 }, + { 10.02, 0 }, +}; + +static const StrokeRec char108[] = { + { 2, char108_stroke0 }, +}; + +/* char: 109 'm' */ + +static const CoordRec char109_stroke0[] = { + { 9.6, 66.6667 }, + { 9.6, 0 }, +}; + +static const CoordRec char109_stroke1[] = { + { 9.6, 47.619 }, + { 23.8857, 61.9048 }, + { 33.4095, 66.6667 }, + { 47.6952, 66.6667 }, + { 57.219, 61.9048 }, + { 61.981, 47.619 }, + { 61.981, 0 }, +}; + +static const CoordRec char109_stroke2[] = { + { 61.981, 47.619 }, + { 76.2667, 61.9048 }, + { 85.7905, 66.6667 }, + { 100.076, 66.6667 }, + { 109.6, 61.9048 }, + { 114.362, 47.619 }, + { 114.362, 0 }, +}; + +static const StrokeRec char109[] = { + { 2, char109_stroke0 }, + { 7, char109_stroke1 }, + { 7, char109_stroke2 }, +}; + +/* char: 110 'n' */ + +static const CoordRec char110_stroke0[] = { + { 9.18, 66.6667 }, + { 9.18, 0 }, +}; + +static const CoordRec char110_stroke1[] = { + { 9.18, 47.619 }, + { 23.4657, 61.9048 }, + { 32.9895, 66.6667 }, + { 47.2752, 66.6667 }, + { 56.799, 61.9048 }, + { 61.561, 47.619 }, + { 61.561, 0 }, +}; + +static const StrokeRec char110[] = { + { 2, char110_stroke0 }, + { 7, char110_stroke1 }, +}; + +/* char: 111 'o' */ + +static const CoordRec char111_stroke0[] = { + { 28.7895, 66.6667 }, + { 19.2657, 61.9048 }, + { 9.7419, 52.381 }, + { 4.98, 38.0952 }, + { 4.98, 28.5714 }, + { 9.7419, 14.2857 }, + { 19.2657, 4.7619 }, + { 28.7895, 0 }, + { 43.0752, 0 }, + { 52.599, 4.7619 }, + { 62.1229, 14.2857 }, + { 66.8848, 28.5714 }, + { 66.8848, 38.0952 }, + { 62.1229, 52.381 }, + { 52.599, 61.9048 }, + { 43.0752, 66.6667 }, + { 28.7895, 66.6667 }, +}; + +static const StrokeRec char111[] = { + { 17, char111_stroke0 }, +}; + +/* char: 112 'p' */ + +static const CoordRec char112_stroke0[] = { + { 9.46, 66.6667 }, + { 9.46, -33.3333 }, +}; + +static const CoordRec char112_stroke1[] = { + { 9.46, 52.381 }, + { 18.9838, 61.9048 }, + { 28.5076, 66.6667 }, + { 42.7933, 66.6667 }, + { 52.3171, 61.9048 }, + { 61.841, 52.381 }, + { 66.6029, 38.0952 }, + { 66.6029, 28.5714 }, + { 61.841, 14.2857 }, + { 52.3171, 4.7619 }, + { 42.7933, 0 }, + { 28.5076, 0 }, + { 18.9838, 4.7619 }, + { 9.46, 14.2857 }, +}; + +static const StrokeRec char112[] = { + { 2, char112_stroke0 }, + { 14, char112_stroke1 }, +}; + +/* char: 113 'q' */ + +static const CoordRec char113_stroke0[] = { + { 61.9829, 66.6667 }, + { 61.9829, -33.3333 }, +}; + +static const CoordRec char113_stroke1[] = { + { 61.9829, 52.381 }, + { 52.459, 61.9048 }, + { 42.9352, 66.6667 }, + { 28.6495, 66.6667 }, + { 19.1257, 61.9048 }, + { 9.6019, 52.381 }, + { 4.84, 38.0952 }, + { 4.84, 28.5714 }, + { 9.6019, 14.2857 }, + { 19.1257, 4.7619 }, + { 28.6495, 0 }, + { 42.9352, 0 }, + { 52.459, 4.7619 }, + { 61.9829, 14.2857 }, +}; + +static const StrokeRec char113[] = { + { 2, char113_stroke0 }, + { 14, char113_stroke1 }, +}; + +/* char: 114 'r' */ + +static const CoordRec char114_stroke0[] = { + { 9.46, 66.6667 }, + { 9.46, 0 }, +}; + +static const CoordRec char114_stroke1[] = { + { 9.46, 38.0952 }, + { 14.2219, 52.381 }, + { 23.7457, 61.9048 }, + { 33.2695, 66.6667 }, + { 47.5552, 66.6667 }, +}; + +static const StrokeRec char114[] = { + { 2, char114_stroke0 }, + { 5, char114_stroke1 }, +}; + +/* char: 115 's' */ + +static const CoordRec char115_stroke0[] = { + { 57.081, 52.381 }, + { 52.319, 61.9048 }, + { 38.0333, 66.6667 }, + { 23.7476, 66.6667 }, + { 9.4619, 61.9048 }, + { 4.7, 52.381 }, + { 9.4619, 42.8571 }, + { 18.9857, 38.0952 }, + { 42.7952, 33.3333 }, + { 52.319, 28.5714 }, + { 57.081, 19.0476 }, + { 57.081, 14.2857 }, + { 52.319, 4.7619 }, + { 38.0333, 0 }, + { 23.7476, 0 }, + { 9.4619, 4.7619 }, + { 4.7, 14.2857 }, +}; + +static const StrokeRec char115[] = { + { 17, char115_stroke0 }, +}; + +/* char: 116 't' */ + +static const CoordRec char116_stroke0[] = { + { 14.8257, 100 }, + { 14.8257, 19.0476 }, + { 19.5876, 4.7619 }, + { 29.1114, 0 }, + { 38.6352, 0 }, +}; + +static const CoordRec char116_stroke1[] = { + { 0.54, 66.6667 }, + { 33.8733, 66.6667 }, +}; + +static const StrokeRec char116[] = { + { 5, char116_stroke0 }, + { 2, char116_stroke1 }, +}; + +/* char: 117 'u' */ + +static const CoordRec char117_stroke0[] = { + { 9.46, 66.6667 }, + { 9.46, 19.0476 }, + { 14.2219, 4.7619 }, + { 23.7457, 0 }, + { 38.0314, 0 }, + { 47.5552, 4.7619 }, + { 61.841, 19.0476 }, +}; + +static const CoordRec char117_stroke1[] = { + { 61.841, 66.6667 }, + { 61.841, 0 }, +}; + +static const StrokeRec char117[] = { + { 7, char117_stroke0 }, + { 2, char117_stroke1 }, +}; + +/* char: 118 'v' */ + +static const CoordRec char118_stroke0[] = { + { 1.8, 66.6667 }, + { 30.3714, 0 }, +}; + +static const CoordRec char118_stroke1[] = { + { 58.9429, 66.6667 }, + { 30.3714, 0 }, +}; + +static const StrokeRec char118[] = { + { 2, char118_stroke0 }, + { 2, char118_stroke1 }, +}; + +/* char: 119 'w' */ + +static const CoordRec char119_stroke0[] = { + { 2.5, 66.6667 }, + { 21.5476, 0 }, +}; + +static const CoordRec char119_stroke1[] = { + { 40.5952, 66.6667 }, + { 21.5476, 0 }, +}; + +static const CoordRec char119_stroke2[] = { + { 40.5952, 66.6667 }, + { 59.6429, 0 }, +}; + +static const CoordRec char119_stroke3[] = { + { 78.6905, 66.6667 }, + { 59.6429, 0 }, +}; + +static const StrokeRec char119[] = { + { 2, char119_stroke0 }, + { 2, char119_stroke1 }, + { 2, char119_stroke2 }, + { 2, char119_stroke3 }, +}; + +/* char: 120 'x' */ + +static const CoordRec char120_stroke0[] = { + { 1.66, 66.6667 }, + { 54.041, 0 }, +}; + +static const CoordRec char120_stroke1[] = { + { 54.041, 66.6667 }, + { 1.66, 0 }, +}; + +static const StrokeRec char120[] = { + { 2, char120_stroke0 }, + { 2, char120_stroke1 }, +}; + +/* char: 121 'y' */ + +static const CoordRec char121_stroke0[] = { + { 6.5619, 66.6667 }, + { 35.1333, 0 }, +}; + +static const CoordRec char121_stroke1[] = { + { 63.7048, 66.6667 }, + { 35.1333, 0 }, + { 25.6095, -19.0476 }, + { 16.0857, -28.5714 }, + { 6.5619, -33.3333 }, + { 1.8, -33.3333 }, +}; + +static const StrokeRec char121[] = { + { 2, char121_stroke0 }, + { 6, char121_stroke1 }, +}; + +/* char: 122 'z' */ + +static const CoordRec char122_stroke0[] = { + { 56.821, 66.6667 }, + { 4.44, 0 }, +}; + +static const CoordRec char122_stroke1[] = { + { 4.44, 66.6667 }, + { 56.821, 66.6667 }, +}; + +static const CoordRec char122_stroke2[] = { + { 4.44, 0 }, + { 56.821, 0 }, +}; + +static const StrokeRec char122[] = { + { 2, char122_stroke0 }, + { 2, char122_stroke1 }, + { 2, char122_stroke2 }, +}; + +/* char: 123 '{' */ + +static const CoordRec char123_stroke0[] = { + { 31.1895, 119.048 }, + { 21.6657, 114.286 }, + { 16.9038, 109.524 }, + { 12.1419, 100 }, + { 12.1419, 90.4762 }, + { 16.9038, 80.9524 }, + { 21.6657, 76.1905 }, + { 26.4276, 66.6667 }, + { 26.4276, 57.1429 }, + { 16.9038, 47.619 }, +}; + +static const CoordRec char123_stroke1[] = { + { 21.6657, 114.286 }, + { 16.9038, 104.762 }, + { 16.9038, 95.2381 }, + { 21.6657, 85.7143 }, + { 26.4276, 80.9524 }, + { 31.1895, 71.4286 }, + { 31.1895, 61.9048 }, + { 26.4276, 52.381 }, + { 7.38, 42.8571 }, + { 26.4276, 33.3333 }, + { 31.1895, 23.8095 }, + { 31.1895, 14.2857 }, + { 26.4276, 4.7619 }, + { 21.6657, 0 }, + { 16.9038, -9.5238 }, + { 16.9038, -19.0476 }, + { 21.6657, -28.5714 }, +}; + +static const CoordRec char123_stroke2[] = { + { 16.9038, 38.0952 }, + { 26.4276, 28.5714 }, + { 26.4276, 19.0476 }, + { 21.6657, 9.5238 }, + { 16.9038, 4.7619 }, + { 12.1419, -4.7619 }, + { 12.1419, -14.2857 }, + { 16.9038, -23.8095 }, + { 21.6657, -28.5714 }, + { 31.1895, -33.3333 }, +}; + +static const StrokeRec char123[] = { + { 10, char123_stroke0 }, + { 17, char123_stroke1 }, + { 10, char123_stroke2 }, +}; + +/* char: 124 '|' */ + +static const CoordRec char124_stroke0[] = { + { 11.54, 119.048 }, + { 11.54, -33.3333 }, +}; + +static const StrokeRec char124[] = { + { 2, char124_stroke0 }, +}; + +/* char: 125 '}' */ + +static const CoordRec char125_stroke0[] = { + { 9.18, 119.048 }, + { 18.7038, 114.286 }, + { 23.4657, 109.524 }, + { 28.2276, 100 }, + { 28.2276, 90.4762 }, + { 23.4657, 80.9524 }, + { 18.7038, 76.1905 }, + { 13.9419, 66.6667 }, + { 13.9419, 57.1429 }, + { 23.4657, 47.619 }, +}; + +static const CoordRec char125_stroke1[] = { + { 18.7038, 114.286 }, + { 23.4657, 104.762 }, + { 23.4657, 95.2381 }, + { 18.7038, 85.7143 }, + { 13.9419, 80.9524 }, + { 9.18, 71.4286 }, + { 9.18, 61.9048 }, + { 13.9419, 52.381 }, + { 32.9895, 42.8571 }, + { 13.9419, 33.3333 }, + { 9.18, 23.8095 }, + { 9.18, 14.2857 }, + { 13.9419, 4.7619 }, + { 18.7038, 0 }, + { 23.4657, -9.5238 }, + { 23.4657, -19.0476 }, + { 18.7038, -28.5714 }, +}; + +static const CoordRec char125_stroke2[] = { + { 23.4657, 38.0952 }, + { 13.9419, 28.5714 }, + { 13.9419, 19.0476 }, + { 18.7038, 9.5238 }, + { 23.4657, 4.7619 }, + { 28.2276, -4.7619 }, + { 28.2276, -14.2857 }, + { 23.4657, -23.8095 }, + { 18.7038, -28.5714 }, + { 9.18, -33.3333 }, +}; + +static const StrokeRec char125[] = { + { 10, char125_stroke0 }, + { 17, char125_stroke1 }, + { 10, char125_stroke2 }, +}; + +/* char: 126 '~' */ + +static const CoordRec char126_stroke0[] = { + { 2.92, 28.5714 }, + { 2.92, 38.0952 }, + { 7.6819, 52.381 }, + { 17.2057, 57.1429 }, + { 26.7295, 57.1429 }, + { 36.2533, 52.381 }, + { 55.301, 38.0952 }, + { 64.8248, 33.3333 }, + { 74.3486, 33.3333 }, + { 83.8724, 38.0952 }, + { 88.6343, 47.619 }, +}; + +static const CoordRec char126_stroke1[] = { + { 2.92, 38.0952 }, + { 7.6819, 47.619 }, + { 17.2057, 52.381 }, + { 26.7295, 52.381 }, + { 36.2533, 47.619 }, + { 55.301, 33.3333 }, + { 64.8248, 28.5714 }, + { 74.3486, 28.5714 }, + { 83.8724, 33.3333 }, + { 88.6343, 47.619 }, + { 88.6343, 57.1429 }, +}; + +static const StrokeRec char126[] = { + { 11, char126_stroke0 }, + { 11, char126_stroke1 }, +}; + +/* char: 127 */ + +static const CoordRec char127_stroke0[] = { + { 52.381, 100 }, + { 14.2857, -33.3333 }, +}; + +static const CoordRec char127_stroke1[] = { + { 28.5714, 66.6667 }, + { 14.2857, 61.9048 }, + { 4.7619, 52.381 }, + { 0, 38.0952 }, + { 0, 23.8095 }, + { 4.7619, 14.2857 }, + { 14.2857, 4.7619 }, + { 28.5714, 0 }, + { 38.0952, 0 }, + { 52.381, 4.7619 }, + { 61.9048, 14.2857 }, + { 66.6667, 28.5714 }, + { 66.6667, 42.8571 }, + { 61.9048, 52.381 }, + { 52.381, 61.9048 }, + { 38.0952, 66.6667 }, + { 28.5714, 66.6667 }, +}; + +static const StrokeRec char127[] = { + { 2, char127_stroke0 }, + { 17, char127_stroke1 }, +}; + +static const StrokeCharRec chars[] = { + { 0, /* char0 */ 0, 0, 0 }, + { 0, /* char1 */ 0, 0, 0 }, + { 0, /* char2 */ 0, 0, 0 }, + { 0, /* char3 */ 0, 0, 0 }, + { 0, /* char4 */ 0, 0, 0 }, + { 0, /* char5 */ 0, 0, 0 }, + { 0, /* char6 */ 0, 0, 0 }, + { 0, /* char7 */ 0, 0, 0 }, + { 0, /* char8 */ 0, 0, 0 }, + { 0, /* char9 */ 0, 0, 0 }, + { 0, /* char10 */ 0, 0, 0 }, + { 0, /* char11 */ 0, 0, 0 }, + { 0, /* char12 */ 0, 0, 0 }, + { 0, /* char13 */ 0, 0, 0 }, + { 0, /* char14 */ 0, 0, 0 }, + { 0, /* char15 */ 0, 0, 0 }, + { 0, /* char16 */ 0, 0, 0 }, + { 0, /* char17 */ 0, 0, 0 }, + { 0, /* char18 */ 0, 0, 0 }, + { 0, /* char19 */ 0, 0, 0 }, + { 0, /* char20 */ 0, 0, 0 }, + { 0, /* char21 */ 0, 0, 0 }, + { 0, /* char22 */ 0, 0, 0 }, + { 0, /* char23 */ 0, 0, 0 }, + { 0, /* char24 */ 0, 0, 0 }, + { 0, /* char25 */ 0, 0, 0 }, + { 0, /* char26 */ 0, 0, 0 }, + { 0, /* char27 */ 0, 0, 0 }, + { 0, /* char28 */ 0, 0, 0 }, + { 0, /* char29 */ 0, 0, 0 }, + { 0, /* char30 */ 0, 0, 0 }, + { 0, /* char31 */ 0, 0, 0 }, + { 0, /* char32 */ 0, 52.381, 104.762 }, + { 2, char33, 13.3819, 26.6238 }, + { 2, char34, 23.0676, 51.4352 }, + { 4, char35, 36.5333, 79.4886 }, + { 3, char36, 38.1533, 76.2067 }, + { 3, char37, 49.2171, 96.5743 }, + { 1, char38, 53.599, 101.758 }, + { 1, char39, 4.44, 13.62 }, + { 1, char40, 21.8657, 47.1733 }, + { 1, char41, 24.3276, 47.5333 }, + { 3, char42, 30.7695, 59.439 }, + { 2, char43, 48.8371, 97.2543 }, + { 1, char44, 13.5219, 26.0638 }, + { 1, char45, 50.2371, 100.754 }, + { 1, char46, 13.1019, 26.4838 }, + { 1, char47, 40.5733, 82.1067 }, + { 1, char48, 38.3133, 77.0667 }, + { 1, char49, 30.8676, 66.5295 }, + { 1, char50, 38.7533, 77.6467 }, + { 1, char51, 38.3333, 77.0467 }, + { 2, char52, 37.2133, 80.1686 }, + { 1, char53, 38.1933, 77.6867 }, + { 1, char54, 34.1514, 73.8048 }, + { 2, char55, 38.8933, 77.2267 }, + { 1, char56, 38.9333, 77.6667 }, + { 1, char57, 39.9333, 74.0648 }, + { 2, char58, 14.0819, 26.2238 }, + { 2, char59, 12.9619, 26.3038 }, + { 1, char60, 41.1552, 81.6105 }, + { 2, char61, 48.5571, 97.2543 }, + { 1, char62, 40.8752, 81.6105 }, + { 2, char63, 36.9914, 73.9029 }, + { 2, char64, 34.9314, 74.3648 }, + { 3, char65, 40.5952, 80.4905 }, + { 3, char66, 44.7533, 83.6267 }, + { 1, char67, 39.9933, 84.4886 }, + { 2, char68, 45.2933, 85.2867 }, + { 4, char69, 39.9914, 78.1848 }, + { 3, char70, 39.9914, 78.7448 }, + { 2, char71, 40.3933, 89.7686 }, + { 3, char72, 44.7533, 89.0867 }, + { 1, char73, 10.86, 21.3 }, + { 1, char74, 31.0714, 59.999 }, + { 3, char75, 44.6133, 79.3267 }, + { 2, char76, 40.2514, 71.3229 }, + { 4, char77, 48.9552, 97.2105 }, + { 3, char78, 44.4733, 88.8067 }, + { 1, char79, 44.3352, 88.8305 }, + { 2, char80, 45.4333, 85.6667 }, + { 2, char81, 43.3952, 88.0905 }, + { 3, char82, 45.0133, 82.3667 }, + { 1, char83, 41.3333, 80.8267 }, + { 2, char84, 35.6933, 71.9467 }, + { 1, char85, 44.8733, 89.4867 }, + { 2, char86, 40.4552, 81.6105 }, + { 4, char87, 49.839, 100.518 }, + { 2, char88, 35.8333, 72.3667 }, + { 2, char89, 39.6152, 79.6505 }, + { 3, char90, 35.8333, 73.7467 }, + { 4, char91, 22.0657, 46.1133 }, + { 1, char92, 39.1733, 78.2067 }, + { 4, char93, 23.4876, 46.3933 }, + { 2, char94, 44.0752, 90.2305 }, + { 1, char95, 51.281, 104.062 }, + { 2, char96, 42.5457, 83.5714 }, + { 2, char97, 35.2514, 66.6029 }, + { 2, char98, 37.3314, 70.4629 }, + { 1, char99, 34.0914, 68.9229 }, + { 2, char100, 33.2114, 70.2629 }, + { 1, char101, 34.2914, 68.5229 }, + { 2, char102, 14.9657, 38.6552 }, + { 2, char103, 33.9314, 70.9829 }, + { 2, char104, 33.4095, 71.021 }, + { 2, char105, 14.7819, 28.8638 }, + { 2, char106, 17.3876, 36.2314 }, + { 3, char107, 33.4095, 62.521 }, + { 1, char108, 10.02, 19.34 }, + { 3, char109, 61.981, 123.962 }, + { 2, char110, 32.9895, 70.881 }, + { 1, char111, 33.5514, 71.7448 }, + { 2, char112, 38.0314, 70.8029 }, + { 2, char113, 33.4114, 70.7429 }, + { 2, char114, 23.7457, 49.4952 }, + { 1, char115, 28.5095, 62.321 }, + { 2, char116, 14.8257, 39.3152 }, + { 2, char117, 33.2695, 71.161 }, + { 2, char118, 30.3714, 60.6029 }, + { 4, char119, 40.5952, 80.4905 }, + { 2, char120, 25.4695, 56.401 }, + { 2, char121, 35.1333, 66.0648 }, + { 3, char122, 28.2495, 61.821 }, + { 3, char123, 21.6657, 41.6295 }, + { 1, char124, 11.54, 23.78 }, + { 3, char125, 18.7038, 41.4695 }, + { 2, char126, 45.7771, 91.2743 }, + { 2, char127, 33.3333, 66.6667 }, +}; + +StrokeFontRec glutStrokeRoman = { "Roman", 128, chars, 119.048, -33.3333 }; + diff --git a/xc/extras/Mesa/src-glut/glut_shapes.c b/xc/extras/Mesa/src-glut/glut_shapes.c new file mode 100644 index 000000000..ce5bebb2b --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_shapes.c @@ -0,0 +1,596 @@ + +/* 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 "glutint.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 */ diff --git a/xc/extras/Mesa/src-glut/glut_space.c b/xc/extras/Mesa/src-glut/glut_space.c new file mode 100644 index 000000000..aeb00b767 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_space.c @@ -0,0 +1,35 @@ + +/* 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 "glutint.h" + +void APIENTRY +glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) +{ + __glutCurrentWindow->spaceMotion = spaceMotionFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); +} + +void APIENTRY +glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) +{ + __glutCurrentWindow->spaceRotate = spaceRotateFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); +} + +void APIENTRY +glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc) +{ + __glutCurrentWindow->spaceButton = spaceButtonFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); +} diff --git a/xc/extras/Mesa/src-glut/glut_stroke.c b/xc/extras/Mesa/src-glut/glut_stroke.c new file mode 100644 index 000000000..2fe408be1 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_stroke.c @@ -0,0 +1,42 @@ + +/* 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 "glutint.h" +#include "glutstroke.h" + +void APIENTRY +glutStrokeCharacter(GLUTstrokeFont font, int c) +{ + const StrokeCharRec *ch; + const StrokeRec *stroke; + const CoordRec *coord; + StrokeFontPtr fontinfo; + int i, j; + + +#if defined(_WIN32) + fontinfo = (StrokeFontPtr) __glutFont(font); +#else + fontinfo = (StrokeFontPtr) font; +#endif + + if (c < 0 || c >= fontinfo->num_chars) + return; + ch = &(fontinfo->ch[c]); + if (ch) { + for (i = ch->num_strokes, stroke = ch->stroke; + i > 0; i--, stroke++) { + glBegin(GL_LINE_STRIP); + for (j = stroke->num_coords, coord = stroke->coord; + j > 0; j--, coord++) { + glVertex2f(coord->x, coord->y); + } + glEnd(); + } + glTranslatef(ch->right, 0.0, 0.0); + } +} diff --git a/xc/extras/Mesa/src-glut/glut_swap.c b/xc/extras/Mesa/src-glut/glut_swap.c new file mode 100644 index 000000000..0864e58d4 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_swap.c @@ -0,0 +1,47 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* 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 "glutint.h" + +/* CENTRY */ +void APIENTRY +glutSwapBuffers(void) +{ + GLUTwindow *window = __glutCurrentWindow; + + if (window->renderWin == window->win) { + if (__glutCurrentWindow->treatAsSingle) { + /* Pretend the double buffered window is single buffered, + so treat glutSwapBuffers as a no-op. */ + return; + } + } else { + if (__glutCurrentWindow->overlay->treatAsSingle) { + /* Pretend the double buffered overlay is single + buffered, so treat glutSwapBuffers as a no-op. */ + return; + } + } + + /* For the MESA_SWAP_HACK. */ + window->usedSwapBuffers = 1; + + SWAP_BUFFERS_LAYER(__glutCurrentWindow); + + /* I considered putting the window being swapped on the + GLUT_FINISH_WORK work list because you could call + glutSwapBuffers from an idle callback which doesn't call + __glutSetWindow which normally adds indirect rendering + windows to the GLUT_FINISH_WORK work list. Not being put + on the list could lead to the buffering up of multiple + redisplays and buffer swaps and hamper interactivity. I + consider this an application bug due to not using + glutPostRedisplay to trigger redraws. If + glutPostRedisplay were used, __glutSetWindow would be + called and a glFinish to throttle buffering would occur. */ +} +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_swidth.c b/xc/extras/Mesa/src-glut/glut_swidth.c new file mode 100644 index 000000000..e1b737457 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_swidth.c @@ -0,0 +1,58 @@ + +/* Copyright (c) Mark J. Kilgard, 1995. */ + +/* 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 "glutint.h" +#include "glutstroke.h" + +/* CENTRY */ +int APIENTRY +glutStrokeWidth(GLUTstrokeFont font, int c) +{ + StrokeFontPtr fontinfo; + const StrokeCharRec *ch; + +#if defined(_WIN32) + fontinfo = (StrokeFontPtr) __glutFont(font); +#else + fontinfo = (StrokeFontPtr) font; +#endif + + if (c < 0 || c >= fontinfo->num_chars) + return 0; + ch = &(fontinfo->ch[c]); + if (ch) + return ch->right; + else + return 0; +} + +int APIENTRY +glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) +{ + int c, length; + StrokeFontPtr fontinfo; + const StrokeCharRec *ch; + +#if defined(_WIN32) + fontinfo = (StrokeFontPtr) __glutFont(font); +#else + fontinfo = (StrokeFontPtr) font; +#endif + + length = 0; + for (; *string != '\0'; string++) { + c = *string; + if (c >= 0 && c < fontinfo->num_chars) { + ch = &(fontinfo->ch[c]); + if (ch) + length += ch->right; + } + } + return length; +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_tablet.c b/xc/extras/Mesa/src-glut/glut_tablet.c new file mode 100644 index 000000000..92567f9a8 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_tablet.c @@ -0,0 +1,33 @@ + +/* 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 <stdlib.h> + +#include "glutint.h" + +void APIENTRY +glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) +{ + __glutCurrentWindow->tabletMotion = tabletMotionFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); + /* If deinstalling callback, invalidate tablet position. */ + if (tabletMotionFunc == NULL) { + __glutCurrentWindow->tabletPos[0] = -1; + __glutCurrentWindow->tabletPos[1] = -1; + } +} + +void APIENTRY +glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc) +{ + __glutCurrentWindow->tabletButton = tabletButtonFunc; + __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_DEVICE_MASK_WORK); +} diff --git a/xc/extras/Mesa/src-glut/glut_teapot.c b/xc/extras/Mesa/src-glut/glut_teapot.c new file mode 100644 index 000000000..fe096e774 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_teapot.c @@ -0,0 +1,210 @@ + +/* 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 "glutint.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 */ diff --git a/xc/extras/Mesa/src-glut/glut_tr10.c b/xc/extras/Mesa/src-glut/glut_tr10.c new file mode 100644 index 000000000..0fac8070c --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_tr10.c @@ -0,0 +1,1777 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmapTimesRoman10 XXX +#include "glutbitmap.h" +#undef glutBitmapTimesRoman10 + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0x80,0xc0,0x40,0x60,0xa0,0x90,0xb8,0x0,0xa0, +}; + +static const BitmapCharRec ch255 = {5,9,0,2,5,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0xc0,0x80,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, +}; + +static const BitmapCharRec ch254 = {4,9,0,2,5,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0x80,0xc0,0x40,0x60,0xa0,0x90,0xb8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch253 = {5,10,0,2,5,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x50, +}; + +static const BitmapCharRec ch252 = {5,7,0,0,5,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch251 = {5,8,0,0,5,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch250 = {5,8,0,0,5,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x68,0x90,0x90,0x90,0x90,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch249 = {5,8,0,0,5,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0x80,0x70,0x48,0x48,0x48,0x38,0x4, +}; + +static const BitmapCharRec ch248 = {6,7,1,1,5,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x20,0x0,0xf8,0x0,0x20, +}; + +static const BitmapCharRec ch247 = {5,5,0,0,6,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0xa0, +}; + +static const BitmapCharRec ch246 = {4,7,0,0,5,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch245 = {4,8,0,0,5,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch244 = {4,8,0,0,5,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch243 = {4,8,0,0,5,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x60,0x90,0x90,0x90,0x60,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch242 = {4,8,0,0,5,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0xd8,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch241 = {5,8,0,0,5,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x60,0x90,0x90,0x90,0x70,0xa0,0x70,0x40, +}; + +static const BitmapCharRec ch240 = {4,8,0,0,5,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0xa0, +}; + +static const BitmapCharRec ch239 = {3,7,0,0,4,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch238 = {3,8,0,0,4,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch237 = {3,8,0,0,4,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0xe0,0x40,0x40,0x40,0xc0,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch236 = {3,8,0,0,4,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0xa0, +}; + +static const BitmapCharRec ch235 = {3,7,0,0,4,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch234 = {3,8,0,0,4,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch233 = {3,8,0,0,4,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x60,0x80,0xc0,0xa0,0x60,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch232 = {3,8,0,0,4,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0xc0,0x20,0x40,0x60,0x80,0x80,0x80,0x60, +}; + +static const BitmapCharRec ch231 = {3,8,0,3,4,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0xd8,0xa0,0x70,0x28,0xd8, +}; + +static const BitmapCharRec ch230 = {5,5,0,0,6,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x40,0xa0,0x40, +}; + +static const BitmapCharRec ch229 = {3,8,0,0,4,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0, +}; + +static const BitmapCharRec ch228 = {3,7,0,0,4,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0,0x50, +}; + +static const BitmapCharRec ch227 = {4,8,0,0,4,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch226 = {3,8,0,0,4,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch225 = {3,8,0,0,4,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0xe0,0xa0,0x60,0x20,0xc0,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch224 = {3,8,0,0,4,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xe0,0x50,0x50,0x60,0x50,0x50,0x20, +}; + +static const BitmapCharRec ch223 = {4,7,0,0,5,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0xe0,0x40,0x70,0x48,0x70,0x40,0xe0, +}; + +static const BitmapCharRec ch222 = {5,7,0,0,6,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x38,0x10,0x10,0x28,0x28,0x44,0xee,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch221 = {7,10,0,0,8,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x28, +}; + +static const BitmapCharRec ch220 = {7,9,0,0,8,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch219 = {7,10,0,0,8,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch218 = {7,10,0,0,8,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch217 = {7,10,0,0,8,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x80,0x7c,0x66,0x52,0x52,0x4a,0x66,0x3e,0x1, +}; + +static const BitmapCharRec ch216 = {8,9,0,1,8,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x88,0x50,0x20,0x50,0x88, +}; + +static const BitmapCharRec ch215 = {5,5,0,0,6,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50, +}; + +static const BitmapCharRec ch214 = {6,9,0,0,7,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch213 = {6,10,0,0,7,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch212 = {6,10,0,0,7,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch211 = {6,10,0,0,7,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch210 = {6,10,0,0,7,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0xe4,0x4c,0x4c,0x54,0x54,0x64,0xee,0x0,0x50,0x28, +}; + +static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0xf8,0x4c,0x44,0xe4,0x44,0x4c,0xf8, +}; + +static const BitmapCharRec ch208 = {6,7,0,0,7,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0xa0, +}; + +static const BitmapCharRec ch207 = {3,9,0,0,4,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0xa0,0x40, +}; + +static const BitmapCharRec ch206 = {3,10,0,0,4,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0x40,0x20, +}; + +static const BitmapCharRec ch205 = {3,10,0,0,4,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x0,0x40,0x80, +}; + +static const BitmapCharRec ch204 = {3,10,0,0,4,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x50, +}; + +static const BitmapCharRec ch203 = {5,9,0,0,6,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x50,0x20, +}; + +static const BitmapCharRec ch202 = {5,10,0,0,6,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x20,0x10, +}; + +static const BitmapCharRec ch201 = {5,10,0,0,6,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8,0x0,0x20,0x40, +}; + +static const BitmapCharRec ch200 = {5,10,0,0,6,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x60,0x10,0x20,0x78,0xc4,0x80,0x80,0x80,0xc4,0x7c, +}; + +static const BitmapCharRec ch199 = {6,10,0,3,7,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0xef,0x49,0x78,0x2e,0x28,0x39,0x1f, +}; + +static const BitmapCharRec ch198 = {8,7,0,0,9,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x10,0x28,0x10, +}; + +static const BitmapCharRec ch197 = {7,10,0,0,8,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28, +}; + +static const BitmapCharRec ch196 = {7,9,0,0,8,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28,0x14, +}; + +static const BitmapCharRec ch195 = {7,10,0,0,8,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x28,0x10, +}; + +static const BitmapCharRec ch194 = {7,10,0,0,8,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x10,0x8, +}; + +static const BitmapCharRec ch193 = {7,10,0,0,8,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10,0x0,0x10,0x20, +}; + +static const BitmapCharRec ch192 = {7,10,0,0,8,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0xe0,0xa0,0x80,0x40,0x40,0x0,0x40, +}; + +static const BitmapCharRec ch191 = {3,7,0,2,4,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x44,0x3e,0x2c,0xd4,0x28,0x48,0xe4, +}; + +static const BitmapCharRec ch190 = {7,7,0,0,8,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x4e,0x24,0x2a,0xf6,0x48,0xc8,0x44, +}; + +static const BitmapCharRec ch189 = {7,7,0,0,8,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x44,0x3e,0x2c,0xf4,0x48,0xc8,0x44, +}; + +static const BitmapCharRec ch188 = {7,7,0,0,8,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0xa0,0x50,0x50,0xa0, +}; + +static const BitmapCharRec ch187 = {4,4,0,-1,5,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xe0,0x0,0x40,0xa0,0x40, +}; + +static const BitmapCharRec ch186 = {3,5,0,-2,4,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xe0,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch185 = {3,4,0,-3,3,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0xc0,0x20,0x40, +}; + +static const BitmapCharRec ch184 = {3,3,0,3,4,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0x80, +}; + +static const BitmapCharRec ch183 = {1,1,0,-2,2,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, +}; + +static const BitmapCharRec ch182 = {6,9,0,2,6,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x80,0x80,0xe8,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch181 = {5,7,0,2,5,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x40, +}; + +static const BitmapCharRec ch180 = {2,2,0,-5,3,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0xc0,0x20,0x40,0xe0, +}; + +static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xe0,0x40,0xa0,0x60, +}; + +static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xe0, +}; + +static const BitmapCharRec ch175 = {3,1,0,-6,4,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, +}; + +static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xe0, +}; + +static const BitmapCharRec ch173 = {3,1,0,-2,4,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x8,0x8,0xf8, +}; + +static const BitmapCharRec ch172 = {5,3,-1,-1,7,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x50,0xa0,0xa0,0x50, +}; + +static const BitmapCharRec ch171 = {4,4,0,-1,5,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0xe0,0x0,0xa0,0x20,0xc0, +}; + +static const BitmapCharRec ch170 = {3,5,0,-2,4,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, +}; + +static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xa0, +}; + +static const BitmapCharRec ch168 = {3,1,-1,-6,5,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0xe0,0x90,0x20,0x50,0x90,0xa0,0x40,0x90,0x70, +}; + +static const BitmapCharRec ch167 = {4,9,0,1,5,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0x80,0x80,0x80,0x0,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch166 = {1,7,0,0,2,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0x70,0x20,0xf8,0x20,0xd8,0x50,0x88, +}; + +static const BitmapCharRec ch165 = {5,7,0,0,5,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0x88,0x70,0x50,0x50,0x70,0x88, +}; + +static const BitmapCharRec ch164 = {5,6,0,-1,5,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xf0,0xc8,0x40,0xe0,0x40,0x50,0x30, +}; + +static const BitmapCharRec ch163 = {5,7,0,0,5,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x80,0xe0,0x90,0x80,0x90,0x70,0x10, +}; + +static const BitmapCharRec ch162 = {4,7,0,1,5,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0x80,0x80,0x80,0x80,0x80,0x0,0x80, +}; + +static const BitmapCharRec ch161 = {1,7,-1,2,3,ch161data}; + +/* char: 0xa0 */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,2,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,2,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x98,0x64, +}; + +static const BitmapCharRec ch126 = {6,2,0,-2,7,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0x80,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch125 = {3,9,0,2,4,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch124 = {1,9,0,2,2,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x20,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch123 = {3,9,0,2,4,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xf0,0x90,0x40,0x20,0xf0, +}; + +static const BitmapCharRec ch122 = {4,5,0,0,5,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0x40,0x40,0x20,0x30,0x50,0x48,0xdc, +}; + +static const BitmapCharRec ch121 = {6,7,1,2,5,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0xd8,0x50,0x20,0x50,0xd8, +}; + +static const BitmapCharRec ch120 = {5,5,0,0,6,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x28,0x6c,0x54,0x92,0xdb, +}; + +static const BitmapCharRec ch119 = {8,5,0,0,8,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x20,0x60,0x50,0x90,0xd8, +}; + +static const BitmapCharRec ch118 = {5,5,0,0,5,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x68,0x90,0x90,0x90,0x90, +}; + +static const BitmapCharRec ch117 = {5,5,0,0,5,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x30,0x40,0x40,0x40,0xe0,0x40, +}; + +static const BitmapCharRec ch116 = {4,6,0,0,4,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0xe0,0x20,0x60,0x80,0xe0, +}; + +static const BitmapCharRec ch115 = {3,5,0,0,4,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0xe0,0x40,0x40,0x60,0xa0, +}; + +static const BitmapCharRec ch114 = {3,5,0,0,4,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x38,0x10,0x70,0x90,0x90,0x90,0x70, +}; + +static const BitmapCharRec ch113 = {5,7,0,2,5,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0xc0,0x80,0xe0,0x90,0x90,0x90,0xe0, +}; + +static const BitmapCharRec ch112 = {4,7,0,2,5,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x60,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch111 = {4,5,0,0,5,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0xd8,0x90,0x90,0x90,0xe0, +}; + +static const BitmapCharRec ch110 = {5,5,0,0,5,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0xdb,0x92,0x92,0x92,0xec, +}; + +static const BitmapCharRec ch109 = {8,5,0,0,8,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch108 = {3,7,0,0,4,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0x98,0x90,0xe0,0xa0,0x90,0x80,0x80, +}; + +static const BitmapCharRec ch107 = {5,7,0,0,5,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0x80,0x40,0x40,0x40,0x40,0x40,0xc0,0x0,0x40, +}; + +static const BitmapCharRec ch106 = {2,9,0,2,3,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0x40,0x40,0x40,0x40,0xc0,0x0,0x40, +}; + +static const BitmapCharRec ch105 = {2,7,0,0,3,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0xd8,0x90,0x90,0x90,0xe0,0x80,0x80, +}; + +static const BitmapCharRec ch104 = {5,7,0,0,5,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0xe0,0x90,0x60,0x40,0xa0,0xa0,0x70, +}; + +static const BitmapCharRec ch103 = {4,7,0,2,5,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0xe0,0x40,0x40,0x40,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch102 = {4,7,0,0,4,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x60,0x80,0xc0,0xa0,0x60, +}; + +static const BitmapCharRec ch101 = {3,5,0,0,4,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x68,0x90,0x90,0x90,0x70,0x10,0x30, +}; + +static const BitmapCharRec ch100 = {5,7,0,0,5,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x60,0x80,0x80,0x80,0x60, +}; + +static const BitmapCharRec ch99 = {3,5,0,0,4,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, +}; + +static const BitmapCharRec ch98 = {4,7,0,0,5,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0xe0,0xa0,0x60,0x20,0xc0, +}; + +static const BitmapCharRec ch97 = {3,5,0,0,4,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0xc0,0x80, +}; + +static const BitmapCharRec ch96 = {2,2,0,-5,3,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xf8, +}; + +static const BitmapCharRec ch95 = {5,1,0,3,5,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0xa0,0xa0,0x40, +}; + +static const BitmapCharRec ch94 = {3,3,-1,-4,5,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, +}; + +static const BitmapCharRec ch93 = {2,9,0,2,3,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x20,0x20,0x40,0x40,0x40,0x80,0x80, +}; + +static const BitmapCharRec ch92 = {3,7,0,0,3,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, +}; + +static const BitmapCharRec ch91 = {2,9,0,2,3,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xf8,0x88,0x40,0x20,0x10,0x88,0xf8, +}; + +static const BitmapCharRec ch90 = {5,7,0,0,6,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x38,0x10,0x10,0x28,0x28,0x44,0xee, +}; + +static const BitmapCharRec ch89 = {7,7,0,0,8,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0xee,0x44,0x28,0x10,0x28,0x44,0xee, +}; + +static const BitmapCharRec ch88 = {7,7,0,0,8,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0xc9,0x80,0x88,0x80,0xdd,0xc0, +}; + +static const BitmapCharRec ch87 = {10,7,0,0,10,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x10,0x10,0x28,0x28,0x6c,0x44,0xee, +}; + +static const BitmapCharRec ch86 = {7,7,0,0,8,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x38,0x6c,0x44,0x44,0x44,0x44,0xee, +}; + +static const BitmapCharRec ch85 = {7,7,0,0,8,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0x70,0x20,0x20,0x20,0x20,0xa8,0xf8, +}; + +static const BitmapCharRec ch84 = {5,7,0,0,6,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0xe0,0x90,0x10,0x60,0xc0,0x90,0x70, +}; + +static const BitmapCharRec ch83 = {4,7,0,0,5,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0xec,0x48,0x50,0x70,0x48,0x48,0xf0, +}; + +static const BitmapCharRec ch82 = {6,7,0,0,7,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0xc,0x18,0x70,0xcc,0x84,0x84,0x84,0xcc,0x78, +}; + +static const BitmapCharRec ch81 = {6,9,0,2,7,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0xe0,0x40,0x40,0x70,0x48,0x48,0xf0, +}; + +static const BitmapCharRec ch80 = {5,7,0,0,6,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x78,0xcc,0x84,0x84,0x84,0xcc,0x78, +}; + +static const BitmapCharRec ch79 = {6,7,0,0,7,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0xe4,0x4c,0x4c,0x54,0x54,0x64,0xee, +}; + +static const BitmapCharRec ch78 = {7,7,0,0,8,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0xeb,0x80,0x49,0x0,0x55,0x0,0x55,0x0,0x63,0x0,0x63,0x0,0xe3,0x80, +}; + +static const BitmapCharRec ch77 = {9,7,0,0,10,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xf8,0x48,0x40,0x40,0x40,0x40,0xe0, +}; + +static const BitmapCharRec ch76 = {5,7,0,0,6,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0xec,0x48,0x50,0x60,0x50,0x48,0xec, +}; + +static const BitmapCharRec ch75 = {6,7,0,0,7,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0xc0,0xa0,0x20,0x20,0x20,0x20,0x70, +}; + +static const BitmapCharRec ch74 = {4,7,0,0,4,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xe0,0x40,0x40,0x40,0x40,0x40,0xe0, +}; + +static const BitmapCharRec ch73 = {3,7,0,0,4,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0xee,0x44,0x44,0x7c,0x44,0x44,0xee, +}; + +static const BitmapCharRec ch72 = {7,7,0,0,8,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x78,0xc4,0x84,0x9c,0x80,0xc4,0x7c, +}; + +static const BitmapCharRec ch71 = {6,7,0,0,7,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0xe0,0x40,0x40,0x70,0x40,0x48,0xf8, +}; + +static const BitmapCharRec ch70 = {5,7,0,0,6,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xf8,0x48,0x40,0x70,0x40,0x48,0xf8, +}; + +static const BitmapCharRec ch69 = {5,7,0,0,6,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xf8,0x4c,0x44,0x44,0x44,0x4c,0xf8, +}; + +static const BitmapCharRec ch68 = {6,7,0,0,7,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x78,0xc4,0x80,0x80,0x80,0xc4,0x7c, +}; + +static const BitmapCharRec ch67 = {6,7,0,0,7,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xf0,0x48,0x48,0x70,0x48,0x48,0xf0, +}; + +static const BitmapCharRec ch66 = {5,7,0,0,6,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0xee,0x44,0x7c,0x28,0x28,0x38,0x10, +}; + +static const BitmapCharRec ch65 = {7,7,0,0,8,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3e,0x40,0x92,0xad,0xa5,0xa5,0x9d,0x42,0x3c, +}; + +static const BitmapCharRec ch64 = {8,9,0,2,9,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x40,0x0,0x40,0x40,0x20,0xa0,0xe0, +}; + +static const BitmapCharRec ch63 = {3,7,0,0,4,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0x80,0x40,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch62 = {3,5,0,0,5,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xf8,0x0,0xf8, +}; + +static const BitmapCharRec ch61 = {5,3,0,-1,6,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x20,0x40,0x80,0x40,0x20, +}; + +static const BitmapCharRec ch60 = {3,5,-1,0,5,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0x80,0x80,0x80,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch59 = {1,7,-1,2,3,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0x80,0x0,0x0,0x0,0x80, +}; + +static const BitmapCharRec ch58 = {1,5,-1,0,3,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0xc0,0x20,0x70,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch57 = {4,7,0,0,5,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x60,0x90,0x90,0x60,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch56 = {4,7,0,0,5,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x40,0x40,0x40,0x20,0x20,0x90,0xf0, +}; + +static const BitmapCharRec ch55 = {4,7,0,0,5,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x60,0x90,0x90,0x90,0xe0,0x40,0x30, +}; + +static const BitmapCharRec ch54 = {4,7,0,0,5,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0xe0,0x90,0x10,0x10,0xe0,0x40,0x70, +}; + +static const BitmapCharRec ch53 = {4,7,0,0,5,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x10,0x10,0xf8,0x90,0x50,0x30,0x10, +}; + +static const BitmapCharRec ch52 = {5,7,0,0,5,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0xe0,0x10,0x10,0x60,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch51 = {4,7,0,0,5,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xf0,0x40,0x20,0x20,0x10,0x90,0x60, +}; + +static const BitmapCharRec ch50 = {4,7,0,0,5,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xe0,0x40,0x40,0x40,0x40,0xc0,0x40, +}; + +static const BitmapCharRec ch49 = {3,7,-1,0,5,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x60,0x90,0x90,0x90,0x90,0x90,0x60, +}; + +static const BitmapCharRec ch48 = {4,7,0,0,5,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0x80,0x80,0x40,0x40,0x40,0x20,0x20, +}; + +static const BitmapCharRec ch47 = {3,7,0,0,3,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0x80, +}; + +static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xf0, +}; + +static const BitmapCharRec ch45 = {4,1,-1,-2,7,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0x80,0x80,0x80, +}; + +static const BitmapCharRec ch44 = {1,3,-1,2,3,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x20,0x20,0xf8,0x20,0x20, +}; + +static const BitmapCharRec ch43 = {5,5,0,0,6,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0xa0,0x40,0xa0, +}; + +static const BitmapCharRec ch42 = {3,3,0,-4,5,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {3,9,0,2,4,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, +}; + +static const BitmapCharRec ch40 = {3,9,0,2,4,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0x40,0xc0, +}; + +static const BitmapCharRec ch39 = {2,2,0,-5,3,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x76,0x8d,0x98,0x74,0x6e,0x50,0x30, +}; + +static const BitmapCharRec ch38 = {8,7,0,0,8,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x44,0x2a,0x2a,0x56,0xa8,0xa4,0x7e, +}; + +static const BitmapCharRec ch37 = {7,7,0,0,8,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x20,0xe0,0x90,0x10,0x60,0x80,0x90,0x70,0x20, +}; + +static const BitmapCharRec ch36 = {4,9,0,1,5,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x50,0x50,0xf8,0x50,0xf8,0x50,0x50, +}; + +static const BitmapCharRec ch35 = {5,7,0,0,5,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0xa0,0xa0, +}; + +static const BitmapCharRec ch34 = {3,2,0,-5,4,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0x80,0x0,0x80,0x80,0x80,0x80,0x80, +}; + +static const BitmapCharRec ch33 = {1,7,-1,0,3,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,2,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,2,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmapTimesRoman10 = { +"-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_tr24.c b/xc/extras/Mesa/src-glut/glut_tr24.c new file mode 100644 index 000000000..22b0e5160 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_tr24.c @@ -0,0 +1,2060 @@ + +/* GENERATED FILE -- DO NOT MODIFY */ + +#define glutBitmapTimesRoman24 XXX +#include "glutbitmap.h" +#undef glutBitmapTimesRoman24 + +/* char: 0xff */ + +static const GLubyte ch255data[] = { +0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, +0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, +0xf1,0xe0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch255 = {11,21,0,5,11,ch255data}; + +/* char: 0xfe */ + +static const GLubyte ch254data[] = { +0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, +0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0xe0,0x0, +}; + +static const BitmapCharRec ch254 = {10,22,-1,5,12,ch254data}; + +/* char: 0xfd */ + +static const GLubyte ch253data[] = { +0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, +0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, +0xf1,0xe0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80,0x1,0x80, +}; + +static const BitmapCharRec ch253 = {11,22,0,5,11,ch253data}; + +/* char: 0xfc */ + +static const GLubyte ch252data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch252 = {11,16,-1,0,13,ch252data}; + +/* char: 0xfb */ + +static const GLubyte ch251data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, +0xc,0x0, +}; + +static const BitmapCharRec ch251 = {11,17,-1,0,13,ch251data}; + +/* char: 0xfa */ + +static const GLubyte ch250data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, +0x1,0x80, +}; + +static const BitmapCharRec ch250 = {11,17,-1,0,13,ch250data}; + +/* char: 0xf9 */ + +static const GLubyte ch249data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, +0x30,0x0, +}; + +static const BitmapCharRec ch249 = {11,17,-1,0,13,ch249data}; + +/* char: 0xf8 */ + +static const GLubyte ch248data[] = { +0xc0,0x0,0xde,0x0,0x73,0x80,0x71,0x80,0xd0,0xc0,0xd8,0xc0,0xc8,0xc0,0xcc,0xc0, +0xc4,0xc0,0xc6,0xc0,0x63,0x80,0x73,0x80,0x1e,0xc0,0x0,0xc0, +}; + +static const BitmapCharRec ch248 = {10,14,-1,1,12,ch248data}; + +/* char: 0xf7 */ + +static const GLubyte ch247data[] = { +0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0, +0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch247 = {12,10,-1,-2,14,ch247data}; + +/* char: 0xf6 */ + +static const GLubyte ch246data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch246 = {10,16,-1,0,12,ch246data}; + +/* char: 0xf5 */ + +static const GLubyte ch245data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, +}; + +static const BitmapCharRec ch245 = {10,16,-1,0,12,ch245data}; + +/* char: 0xf4 */ + +static const GLubyte ch244data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, +0xc,0x0, +}; + +static const BitmapCharRec ch244 = {10,17,-1,0,12,ch244data}; + +/* char: 0xf3 */ + +static const GLubyte ch243data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, +0x1,0x80, +}; + +static const BitmapCharRec ch243 = {10,17,-1,0,12,ch243data}; + +/* char: 0xf2 */ + +static const GLubyte ch242data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, +0x30,0x0, +}; + +static const BitmapCharRec ch242 = {10,17,-1,0,12,ch242data}; + +/* char: 0xf1 */ + +static const GLubyte ch241data[] = { +0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, +}; + +static const BitmapCharRec ch241 = {11,16,-1,0,13,ch241data}; + +/* char: 0xf0 */ + +static const GLubyte ch240data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1f,0x0,0xc6,0x0,0x3c,0x0,0x1e,0x0,0x71,0x80, +0xc0,0x0, +}; + +static const BitmapCharRec ch240 = {10,17,-1,0,12,ch240data}; + +/* char: 0xef */ + +static const GLubyte ch239data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x0,0xcc,0xcc, +}; + +static const BitmapCharRec ch239 = {6,16,0,0,6,ch239data}; + +/* char: 0xee */ + +static const GLubyte ch238data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x84,0x48,0x78, +0x30, +}; + +static const BitmapCharRec ch238 = {6,17,0,0,6,ch238data}; + +/* char: 0xed */ + +static const GLubyte ch237data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x80,0x60,0x38, +0x18, +}; + +static const BitmapCharRec ch237 = {5,17,-1,0,6,ch237data}; + +/* char: 0xec */ + +static const GLubyte ch236data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x8,0x30,0xe0, +0xc0, +}; + +static const BitmapCharRec ch236 = {5,17,0,0,6,ch236data}; + +/* char: 0xeb */ + +static const GLubyte ch235data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, +}; + +static const BitmapCharRec ch235 = {9,16,-1,0,11,ch235data}; + +/* char: 0xea */ + +static const GLubyte ch234data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, +0xc,0x0, +}; + +static const BitmapCharRec ch234 = {9,17,-1,0,11,ch234data}; + +/* char: 0xe9 */ + +static const GLubyte ch233data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, +0x3,0x0, +}; + +static const BitmapCharRec ch233 = {9,17,-1,0,11,ch233data}; + +/* char: 0xe8 */ + +static const GLubyte ch232data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, +0x60,0x0, +}; + +static const BitmapCharRec ch232 = {9,17,-1,0,11,ch232data}; + +/* char: 0xe7 */ + +static const GLubyte ch231data[] = { +0x3c,0x0,0x66,0x0,0x6,0x0,0x1e,0x0,0x18,0x0,0x8,0x0,0x1e,0x0,0x7f,0x0, +0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x41,0x80, +0x63,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch231 = {9,18,-1,6,11,ch231data}; + +/* char: 0xe6 */ + +static const GLubyte ch230data[] = { +0x70,0xf0,0xfb,0xf8,0xc7,0x84,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0xfc, +0x3,0xc,0x63,0xc,0x67,0x98,0x3c,0xf0, +}; + +static const BitmapCharRec ch230 = {14,12,-1,0,16,ch230data}; + +/* char: 0xe5 */ + +static const GLubyte ch229data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x1c,0x0,0x22,0x0,0x22,0x0, +0x1c,0x0, +}; + +static const BitmapCharRec ch229 = {9,17,-1,0,11,ch229data}; + +/* char: 0xe4 */ + +static const GLubyte ch228data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x66,0x0,0x66,0x0, +}; + +static const BitmapCharRec ch228 = {9,16,-1,0,11,ch228data}; + +/* char: 0xe3 */ + +static const GLubyte ch227data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x5c,0x0,0x3a,0x0, +}; + +static const BitmapCharRec ch227 = {9,16,-1,0,11,ch227data}; + +/* char: 0xe2 */ + +static const GLubyte ch226data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x42,0x0,0x24,0x0,0x3c,0x0, +0x18,0x0, +}; + +static const BitmapCharRec ch226 = {9,17,-1,0,11,ch226data}; + +/* char: 0xe1 */ + +static const GLubyte ch225data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, +0x3,0x0, +}; + +static const BitmapCharRec ch225 = {9,17,-1,0,11,ch225data}; + +/* char: 0xe0 */ + +static const GLubyte ch224data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, +0x60,0x0, +}; + +static const BitmapCharRec ch224 = {9,17,-1,0,11,ch224data}; + +/* char: 0xdf */ + +static const GLubyte ch223data[] = { +0xe7,0x0,0x6c,0x80,0x6c,0xc0,0x60,0xc0,0x60,0xc0,0x61,0xc0,0x61,0x80,0x63,0x80, +0x67,0x0,0x6c,0x0,0x63,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, +0x1e,0x0, +}; + +static const BitmapCharRec ch223 = {10,17,-1,0,12,ch223data}; + +/* char: 0xde */ + +static const GLubyte ch222data[] = { +0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18, +0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70,0x3f,0xc0,0x30,0x0,0x30,0x0,0x30,0x0, +0xfc,0x0, +}; + +static const BitmapCharRec ch222 = {13,17,-1,0,15,ch222data}; + +/* char: 0xdd */ + +static const GLubyte ch221data[] = { +0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, +0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, +0xfc,0x3f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, +}; + +static const BitmapCharRec ch221 = {16,22,0,0,16,ch221data}; + +/* char: 0xdc */ + +static const GLubyte ch220data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x0,0x0,0x6,0x30,0x6,0x30, +}; + +static const BitmapCharRec ch220 = {16,21,-1,0,18,ch220data}; + +/* char: 0xdb */ + +static const GLubyte ch219data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, +}; + +static const BitmapCharRec ch219 = {16,22,-1,0,18,ch219data}; + +/* char: 0xda */ + +static const GLubyte ch218data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, +}; + +static const BitmapCharRec ch218 = {16,22,-1,0,18,ch218data}; + +/* char: 0xd9 */ + +static const GLubyte ch217data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch217 = {16,22,-1,0,18,ch217data}; + +/* char: 0xd8 */ + +static const GLubyte ch216data[] = { +0x20,0x0,0x27,0xe0,0x1c,0x38,0x38,0x1c,0x68,0x6,0x64,0x6,0xc2,0x3,0xc2,0x3, +0xc1,0x3,0xc1,0x3,0xc0,0x83,0xc0,0x83,0xc0,0x43,0x60,0x46,0x60,0x26,0x38,0x1c, +0x1c,0x38,0x7,0xe4,0x0,0x4, +}; + +static const BitmapCharRec ch216 = {16,19,-1,1,18,ch216data}; + +/* char: 0xd7 */ + +static const GLubyte ch215data[] = { +0x80,0x40,0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0, +0x61,0x80,0xc0,0xc0,0x80,0x40, +}; + +static const BitmapCharRec ch215 = {10,11,-2,-1,14,ch215data}; + +/* char: 0xd6 */ + +static const GLubyte ch214data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x0,0x0,0x6,0x60,0x6,0x60, +}; + +static const BitmapCharRec ch214 = {16,21,-1,0,18,ch214data}; + +/* char: 0xd5 */ + +static const GLubyte ch213data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, +}; + +static const BitmapCharRec ch213 = {16,21,-1,0,18,ch213data}; + +/* char: 0xd4 */ + +static const GLubyte ch212data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, +}; + +static const BitmapCharRec ch212 = {16,22,-1,0,18,ch212data}; + +/* char: 0xd3 */ + +static const GLubyte ch211data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, +}; + +static const BitmapCharRec ch211 = {16,22,-1,0,18,ch211data}; + +/* char: 0xd2 */ + +static const GLubyte ch210data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch210 = {16,22,-1,0,18,ch210data}; + +/* char: 0xd1 */ + +static const GLubyte ch209data[] = { +0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, +0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, +0xf0,0x1f,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, +}; + +static const BitmapCharRec ch209 = {16,21,-1,0,18,ch209data}; + +/* char: 0xd0 */ + +static const GLubyte ch208data[] = { +0x7f,0xe0,0x18,0x38,0x18,0x1c,0x18,0x6,0x18,0x6,0x18,0x3,0x18,0x3,0x18,0x3, +0xff,0x3,0x18,0x3,0x18,0x3,0x18,0x3,0x18,0x6,0x18,0x6,0x18,0x1c,0x18,0x38, +0x7f,0xe0, +}; + +static const BitmapCharRec ch208 = {16,17,0,0,17,ch208data}; + +/* char: 0xcf */ + +static const GLubyte ch207data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc,0x0,0x0,0xcc,0xcc, +}; + +static const BitmapCharRec ch207 = {6,21,-1,0,8,ch207data}; + +/* char: 0xce */ + +static const GLubyte ch206data[] = { +0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x7e,0x0,0x81,0x66,0x3c,0x18, +}; + +static const BitmapCharRec ch206 = {8,22,-1,0,8,ch206data}; + +/* char: 0xcd */ + +static const GLubyte ch205data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc,0x0,0x40,0x30,0x1c,0xc, +}; + +static const BitmapCharRec ch205 = {6,22,-1,0,8,ch205data}; + +/* char: 0xcc */ + +static const GLubyte ch204data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc,0x0,0x8,0x30,0xe0,0xc0, +}; + +static const BitmapCharRec ch204 = {6,22,-1,0,8,ch204data}; + +/* char: 0xcb */ + +static const GLubyte ch203data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x0,0x0,0x19,0x80,0x19,0x80, +}; + +static const BitmapCharRec ch203 = {13,21,-1,0,15,ch203data}; + +/* char: 0xca */ + +static const GLubyte ch202data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x10,0x20,0xc,0xc0,0x7,0x80,0x3,0x0, +}; + +static const BitmapCharRec ch202 = {13,22,-1,0,15,ch202data}; + +/* char: 0xc9 */ + +static const GLubyte ch201data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x4,0x0,0x3,0x0,0x1,0xc0,0x0,0xc0, +}; + +static const BitmapCharRec ch201 = {13,22,-1,0,15,ch201data}; + +/* char: 0xc8 */ + +static const GLubyte ch200data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0,0x0,0x0,0x1,0x0,0x6,0x0,0x1c,0x0,0x18,0x0, +}; + +static const BitmapCharRec ch200 = {13,22,-1,0,15,ch200data}; + +/* char: 0xc7 */ + +static const GLubyte ch199data[] = { +0x7,0x80,0xc,0xc0,0x0,0xc0,0x3,0xc0,0x3,0x0,0x1,0x0,0x7,0xe0,0x1e,0x38, +0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c,0x7,0xe4, +}; + +static const BitmapCharRec ch199 = {14,23,-1,6,16,ch199data}; + +/* char: 0xc6 */ + +static const GLubyte ch198data[] = { +0xf9,0xff,0xf0,0x30,0x60,0x30,0x10,0x60,0x10,0x10,0x60,0x10,0x18,0x60,0x0,0x8, +0x60,0x0,0xf,0xe0,0x80,0xc,0x60,0x80,0x4,0x7f,0x80,0x4,0x60,0x80,0x6,0x60, +0x80,0x2,0x60,0x0,0x2,0x60,0x0,0x1,0x60,0x20,0x1,0x60,0x20,0x1,0xe0,0x60, +0x3,0xff,0xe0, +}; + +static const BitmapCharRec ch198 = {20,17,0,0,21,ch198data}; + +/* char: 0xc5 */ + +static const GLubyte ch197data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x1,0xc0,0x0,0x2,0x20,0x0,0x2,0x20,0x0,0x1,0xc0,0x0, +}; + +static const BitmapCharRec ch197 = {17,21,0,0,17,ch197data}; + +/* char: 0xc4 */ + +static const GLubyte ch196data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x30,0x0,0x6,0x30,0x0, +}; + +static const BitmapCharRec ch196 = {17,21,0,0,17,ch196data}; + +/* char: 0xc3 */ + +static const GLubyte ch195data[] = { +0xfc,0x1f,0x80,0x30,0x7,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xe0,0x0,0x3,0x90,0x0, +}; + +static const BitmapCharRec ch195 = {17,21,0,0,17,ch195data}; + +/* char: 0xc2 */ + +static const GLubyte ch194data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x8,0x10,0x0,0x6,0x60,0x0,0x3,0xc0,0x0,0x1, +0x80,0x0, +}; + +static const BitmapCharRec ch194 = {17,22,0,0,17,ch194data}; + +/* char: 0xc1 */ + +static const GLubyte ch193data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xc0,0x0,0x0,0x70,0x0,0x0, +0x30,0x0, +}; + +static const BitmapCharRec ch193 = {17,22,0,0,17,ch193data}; + +/* char: 0xc0 */ + +static const GLubyte ch192data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0xc0,0x0,0x3,0x80,0x0,0x3, +0x0,0x0, +}; + +static const BitmapCharRec ch192 = {17,22,0,0,17,ch192data}; + +/* char: 0xbf */ + +static const GLubyte ch191data[] = { +0x3e,0x63,0xc1,0xc3,0xc3,0xe0,0x70,0x30,0x38,0x18,0x18,0x8,0x8,0x0,0x0,0xc, +0xc, +}; + +static const BitmapCharRec ch191 = {8,17,-1,5,11,ch191data}; + +/* char: 0xbe */ + +static const GLubyte ch190data[] = { +0x18,0x2,0x0,0x8,0x2,0x0,0xc,0x7f,0x80,0x4,0x22,0x0,0x6,0x32,0x0,0x3, +0x12,0x0,0x1,0xa,0x0,0x71,0x8e,0x0,0x88,0x86,0x0,0x8c,0xc2,0x0,0xc,0x60, +0x0,0x8,0x20,0x0,0x30,0x30,0x0,0x8,0x10,0x0,0x8c,0x18,0x0,0x4c,0xc,0x0, +0x38,0x4,0x0, +}; + +static const BitmapCharRec ch190 = {17,17,0,0,18,ch190data}; + +/* char: 0xbd */ + +static const GLubyte ch189data[] = { +0x30,0x7e,0x10,0x22,0x18,0x10,0x8,0x18,0xc,0x8,0x6,0x4,0x2,0x6,0xfb,0x46, +0x21,0x26,0x21,0x9c,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, +0x20,0x8, +}; + +static const BitmapCharRec ch189 = {15,17,-1,0,18,ch189data}; + +/* char: 0xbc */ + +static const GLubyte ch188data[] = { +0x30,0x4,0x10,0x4,0x18,0xff,0x8,0x44,0xc,0x64,0x6,0x24,0x2,0x14,0xfb,0x1c, +0x21,0xc,0x21,0x84,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, +0x20,0x8, +}; + +static const BitmapCharRec ch188 = {16,17,-1,0,18,ch188data}; + +/* char: 0xbb */ + +static const GLubyte ch187data[] = { +0x88,0x0,0xcc,0x0,0x66,0x0,0x33,0x0,0x19,0x80,0x19,0x80,0x33,0x0,0x66,0x0, +0xcc,0x0,0x88,0x0, +}; + +static const BitmapCharRec ch187 = {9,10,-2,-1,12,ch187data}; + +/* char: 0xba */ + +static const GLubyte ch186data[] = { +0xfc,0x0,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0x78, +}; + +static const BitmapCharRec ch186 = {6,9,-1,-8,8,ch186data}; + +/* char: 0xb9 */ + +static const GLubyte ch185data[] = { +0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, +}; + +static const BitmapCharRec ch185 = {5,10,-1,-7,7,ch185data}; + +/* char: 0xb8 */ + +static const GLubyte ch184data[] = { +0x78,0xcc,0xc,0x3c,0x30,0x10, +}; + +static const BitmapCharRec ch184 = {6,6,-1,6,8,ch184data}; + +/* char: 0xb7 */ + +static const GLubyte ch183data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch183 = {2,2,-2,-6,6,ch183data}; + +/* char: 0xb6 */ + +static const GLubyte ch182data[] = { +0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0, +0x9,0x0,0x9,0x0,0x9,0x0,0x19,0x0,0x39,0x0,0x79,0x0,0x79,0x0,0xf9,0x0, +0xf9,0x0,0xf9,0x0,0x79,0x0,0x79,0x0,0x39,0x0,0x1f,0x80, +}; + +static const BitmapCharRec ch182 = {9,22,-1,5,11,ch182data}; + +/* char: 0xb5 */ + +static const GLubyte ch181data[] = { +0x40,0x0,0xe0,0x0,0xc0,0x0,0x40,0x0,0x40,0x0,0x5c,0xe0,0x7e,0xc0,0x71,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0xe1,0xc0, +}; + +static const BitmapCharRec ch181 = {11,17,-1,5,13,ch181data}; + +/* char: 0xb4 */ + +static const GLubyte ch180data[] = { +0x80,0x60,0x38,0x18, +}; + +static const BitmapCharRec ch180 = {5,4,-2,-13,8,ch180data}; + +/* char: 0xb3 */ + +static const GLubyte ch179data[] = { +0x70,0x88,0x8c,0xc,0x8,0x30,0x8,0x8c,0x4c,0x38, +}; + +static const BitmapCharRec ch179 = {6,10,0,-7,7,ch179data}; + +/* char: 0xb2 */ + +static const GLubyte ch178data[] = { +0xfc,0x44,0x20,0x30,0x10,0x8,0xc,0x8c,0x4c,0x38, +}; + +static const BitmapCharRec ch178 = {6,10,0,-7,7,ch178data}; + +/* char: 0xb1 */ + +static const GLubyte ch177data[] = { +0xff,0xf0,0xff,0xf0,0x0,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +0xff,0xf0,0xff,0xf0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch177 = {12,15,-1,0,14,ch177data}; + +/* char: 0xb0 */ + +static const GLubyte ch176data[] = { +0x38,0x44,0x82,0x82,0x82,0x44,0x38, +}; + +static const BitmapCharRec ch176 = {7,7,-1,-10,9,ch176data}; + +/* char: 0xaf */ + +static const GLubyte ch175data[] = { +0xfc,0xfc, +}; + +static const BitmapCharRec ch175 = {6,2,-1,-14,8,ch175data}; + +/* char: 0xae */ + +static const GLubyte ch174data[] = { +0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x60,0x3,0x0,0x47,0x19,0x0,0xc2, +0x31,0x80,0x82,0x20,0x80,0x82,0x40,0x80,0x83,0xe0,0x80,0x82,0x30,0x80,0x82,0x10, +0x80,0xc2,0x11,0x80,0x42,0x31,0x0,0x67,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, +0x7,0xf0,0x0, +}; + +static const BitmapCharRec ch174 = {17,17,-1,0,19,ch174data}; + +/* char: 0xad */ + +static const GLubyte ch173data[] = { +0xfe,0xfe, +}; + +static const BitmapCharRec ch173 = {7,2,-1,-5,9,ch173data}; + +/* char: 0xac */ + +static const GLubyte ch172data[] = { +0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0xff,0xf0,0xff,0xf0, +}; + +static const BitmapCharRec ch172 = {12,7,-1,-3,14,ch172data}; + +/* char: 0xab */ + +static const GLubyte ch171data[] = { +0x8,0x80,0x19,0x80,0x33,0x0,0x66,0x0,0xcc,0x0,0xcc,0x0,0x66,0x0,0x33,0x0, +0x19,0x80,0x8,0x80, +}; + +static const BitmapCharRec ch171 = {9,10,-2,-1,13,ch171data}; + +/* char: 0xaa */ + +static const GLubyte ch170data[] = { +0x7e,0x0,0x76,0xcc,0xcc,0x7c,0xc,0xcc,0x78, +}; + +static const BitmapCharRec ch170 = {7,9,0,-8,8,ch170data}; + +/* char: 0xa9 */ + +static const GLubyte ch169data[] = { +0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x61,0xc3,0x0,0x47,0x71,0x0,0xc4, +0x19,0x80,0x8c,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x8c,0x0, +0x80,0xc4,0x19,0x80,0x47,0x31,0x0,0x61,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, +0x7,0xf0,0x0, +}; + +static const BitmapCharRec ch169 = {17,17,-1,0,19,ch169data}; + +/* char: 0xa8 */ + +static const GLubyte ch168data[] = { +0xcc,0xcc, +}; + +static const BitmapCharRec ch168 = {6,2,-1,-14,8,ch168data}; + +/* char: 0xa7 */ + +static const GLubyte ch167data[] = { +0x38,0x64,0x62,0x6,0xe,0x1c,0x38,0x74,0xe2,0xc3,0x83,0x87,0x4e,0x3c,0x38,0x70, +0x60,0x46,0x26,0x1c, +}; + +static const BitmapCharRec ch167 = {8,20,-2,2,12,ch167data}; + +/* char: 0xa6 */ + +static const GLubyte ch166data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch166 = {2,17,-2,0,6,ch166data}; + +/* char: 0xa5 */ + +static const GLubyte ch165data[] = { +0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x1f,0xe0,0x3,0x0,0x1f,0xe0, +0x3,0x0,0x7,0x80,0xc,0x80,0xc,0xc0,0x18,0x40,0x18,0x60,0x30,0x20,0x70,0x30, +0xf8,0x7c, +}; + +static const BitmapCharRec ch165 = {14,17,0,0,14,ch165data}; + +/* char: 0xa4 */ + +static const GLubyte ch164data[] = { +0xc0,0x60,0xee,0xe0,0x7f,0xc0,0x31,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x31,0x80,0x7f,0xc0,0xee,0xe0,0xc0,0x60, +}; + +static const BitmapCharRec ch164 = {11,12,-1,-3,13,ch164data}; + +/* char: 0xa3 */ + +static const GLubyte ch163data[] = { +0xe7,0x80,0xbe,0xc0,0x78,0x40,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0x30,0x0,0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x31,0x80,0x19,0x80, +0xf,0x0, +}; + +static const BitmapCharRec ch163 = {10,17,-1,0,12,ch163data}; + +/* char: 0xa2 */ + +static const GLubyte ch162data[] = { +0x40,0x0,0x40,0x0,0x3e,0x0,0x7f,0x0,0x70,0x80,0xd0,0x0,0xc8,0x0,0xc8,0x0, +0xc8,0x0,0xc4,0x0,0xc4,0x0,0x43,0x80,0x63,0x80,0x1f,0x0,0x1,0x0,0x1,0x0, +}; + +static const BitmapCharRec ch162 = {9,16,-1,2,12,ch162data}; + +/* char: 0xa1 */ + +static const GLubyte ch161data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch161 = {2,17,-4,5,8,ch161data}; + +/* char: 0xa0 */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch160data[] = { 0x0 }; +static const BitmapCharRec ch160 = {1,1,0,0,6,ch160data}; +#else +static const BitmapCharRec ch160 = {0,0,0,0,6,0}; +#endif + +/* char: 0x7e '~' */ + +static const GLubyte ch126data[] = { +0x83,0x80,0xc7,0xc0,0x7c,0x60,0x38,0x20, +}; + +static const BitmapCharRec ch126 = {11,4,-1,-5,13,ch126data}; + +/* char: 0x7d '}' */ + +static const GLubyte ch125data[] = { +0xe0,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x8,0xc,0x4,0x3,0x4,0xc,0x8,0x18, +0x18,0x18,0x18,0x18,0x30,0xe0, +}; + +static const BitmapCharRec ch125 = {8,22,-1,5,10,ch125data}; + +/* char: 0x7c '|' */ + +static const GLubyte ch124data[] = { +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch124 = {2,17,-2,0,6,ch124data}; + +/* char: 0x7b '{' */ + +static const GLubyte ch123data[] = { +0x7,0xc,0x18,0x18,0x18,0x18,0x18,0x18,0x10,0x30,0x20,0xc0,0x20,0x30,0x10,0x18, +0x18,0x18,0x18,0x18,0xc,0x7, +}; + +static const BitmapCharRec ch123 = {8,22,-1,5,10,ch123data}; + +/* char: 0x7a 'z' */ + +static const GLubyte ch122data[] = { +0xff,0xc3,0x61,0x70,0x30,0x38,0x18,0x1c,0xe,0x86,0xc3,0xff, +}; + +static const BitmapCharRec ch122 = {8,12,-1,0,10,ch122data}; + +/* char: 0x79 'y' */ + +static const GLubyte ch121data[] = { +0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, +0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, +0xf1,0xe0, +}; + +static const BitmapCharRec ch121 = {11,17,0,5,11,ch121data}; + +/* char: 0x78 'x' */ + +static const GLubyte ch120data[] = { +0xf1,0xe0,0x60,0xc0,0x21,0x80,0x33,0x80,0x1b,0x0,0xe,0x0,0xc,0x0,0x1a,0x0, +0x39,0x0,0x31,0x80,0x60,0xc0,0xf1,0xe0, +}; + +static const BitmapCharRec ch120 = {11,12,-1,0,13,ch120data}; + +/* char: 0x77 'w' */ + +static const GLubyte ch119data[] = { +0x4,0x10,0x0,0xe,0x38,0x0,0xe,0x38,0x0,0x1a,0x28,0x0,0x1a,0x64,0x0,0x19, +0x64,0x0,0x31,0x64,0x0,0x30,0xc2,0x0,0x30,0xc2,0x0,0x60,0xc2,0x0,0x60,0xc3, +0x0,0xf1,0xe7,0x80, +}; + +static const BitmapCharRec ch119 = {17,12,0,0,17,ch119data}; + +/* char: 0x76 'v' */ + +static const GLubyte ch118data[] = { +0x4,0x0,0xe,0x0,0xe,0x0,0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80, +0x30,0x80,0x60,0x80,0x60,0xc0,0xf1,0xe0, +}; + +static const BitmapCharRec ch118 = {11,12,0,0,11,ch118data}; + +/* char: 0x75 'u' */ + +static const GLubyte ch117data[] = { +0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0, +}; + +static const BitmapCharRec ch117 = {11,12,-1,0,13,ch117data}; + +/* char: 0x74 't' */ + +static const GLubyte ch116data[] = { +0x1c,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x70,0x30,0x10, +}; + +static const BitmapCharRec ch116 = {7,15,0,0,7,ch116data}; + +/* char: 0x73 's' */ + +static const GLubyte ch115data[] = { +0xf8,0xc6,0x83,0x3,0x7,0x1e,0x7c,0x70,0xe0,0xc2,0x66,0x3e, +}; + +static const BitmapCharRec ch115 = {8,12,-1,0,10,ch115data}; + +/* char: 0x72 'r' */ + +static const GLubyte ch114data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x76,0x6e,0xe6, +}; + +static const BitmapCharRec ch114 = {7,12,-1,0,8,ch114data}; + +/* char: 0x71 'q' */ + +static const GLubyte ch113data[] = { +0x3,0xc0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1d,0x80,0x73,0x80,0x61,0x80, +0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x73,0x80, +0x1d,0x80, +}; + +static const BitmapCharRec ch113 = {10,17,-1,5,12,ch113data}; + +/* char: 0x70 'p' */ + +static const GLubyte ch112data[] = { +0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, +0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, +0xee,0x0, +}; + +static const BitmapCharRec ch112 = {10,17,-1,5,12,ch112data}; + +/* char: 0x6f 'o' */ + +static const GLubyte ch111data[] = { +0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0, +}; + +static const BitmapCharRec ch111 = {10,12,-1,0,12,ch111data}; + +/* char: 0x6e 'n' */ + +static const GLubyte ch110data[] = { +0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0, +}; + +static const BitmapCharRec ch110 = {11,12,-1,0,13,ch110data}; + +/* char: 0x6d 'm' */ + +static const GLubyte ch109data[] = { +0xf1,0xe3,0xc0,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60, +0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x71,0xe3,0x80,0x6f,0x9f, +0x0,0xe7,0xe,0x0, +}; + +static const BitmapCharRec ch109 = {18,12,-1,0,20,ch109data}; + +/* char: 0x6c 'l' */ + +static const GLubyte ch108data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, +0xe0, +}; + +static const BitmapCharRec ch108 = {4,17,-1,0,6,ch108data}; + +/* char: 0x6b 'k' */ + +static const GLubyte ch107data[] = { +0xf3,0xe0,0x61,0xc0,0x63,0x80,0x67,0x0,0x6e,0x0,0x6c,0x0,0x78,0x0,0x68,0x0, +0x64,0x0,0x66,0x0,0x63,0x0,0x67,0xc0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, +0xe0,0x0, +}; + +static const BitmapCharRec ch107 = {11,17,-1,0,12,ch107data}; + +/* char: 0x6a 'j' */ + +static const GLubyte ch106data[] = { +0xc0,0xe0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0x70,0x0,0x0,0x0,0x30,0x30, +}; + +static const BitmapCharRec ch106 = {4,22,0,5,6,ch106data}; + +/* char: 0x69 'i' */ + +static const GLubyte ch105data[] = { +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x0,0x0,0x60, +0x60, +}; + +static const BitmapCharRec ch105 = {4,17,-1,0,6,ch105data}; + +/* char: 0x68 'h' */ + +static const GLubyte ch104data[] = { +0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x71,0xc0,0x6f,0x80,0x67,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, +0xe0,0x0, +}; + +static const BitmapCharRec ch104 = {11,17,-1,0,13,ch104data}; + +/* char: 0x67 'g' */ + +static const GLubyte ch103data[] = { +0x3f,0x0,0xf1,0xc0,0xc0,0x60,0xc0,0x20,0x60,0x60,0x3f,0xc0,0x7f,0x0,0x60,0x0, +0x30,0x0,0x3e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, +0x1f,0xc0, +}; + +static const BitmapCharRec ch103 = {11,17,-1,5,12,ch103data}; + +/* char: 0x66 'f' */ + +static const GLubyte ch102data[] = { +0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x30,0x30,0x30,0x16, +0xe, +}; + +static const BitmapCharRec ch102 = {7,17,0,0,7,ch102data}; + +/* char: 0x65 'e' */ + +static const GLubyte ch101data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, +0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0, +}; + +static const BitmapCharRec ch101 = {9,12,-1,0,11,ch101data}; + +/* char: 0x64 'd' */ + +static const GLubyte ch100data[] = { +0x1e,0xc0,0x73,0x80,0x61,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80, +0xc1,0x80,0x61,0x80,0x73,0x80,0x1d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, +0x3,0x80, +}; + +static const BitmapCharRec ch100 = {10,17,-1,0,12,ch100data}; + +/* char: 0x63 'c' */ + +static const GLubyte ch99data[] = { +0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0x41,0x80,0x63,0x80,0x1f,0x0, +}; + +static const BitmapCharRec ch99 = {9,12,-1,0,11,ch99data}; + +/* char: 0x62 'b' */ + +static const GLubyte ch98data[] = { +0x5e,0x0,0x73,0x80,0x61,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, +0x60,0xc0,0x61,0x80,0x73,0x80,0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, +0xe0,0x0, +}; + +static const BitmapCharRec ch98 = {10,17,-1,0,12,ch98data}; + +/* char: 0x61 'a' */ + +static const GLubyte ch97data[] = { +0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, +0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0, +}; + +static const BitmapCharRec ch97 = {9,12,-1,0,11,ch97data}; + +/* char: 0x60 '`' */ + +static const GLubyte ch96data[] = { +0x60,0xe0,0x80,0xc0,0x60, +}; + +static const BitmapCharRec ch96 = {3,5,-2,-12,7,ch96data}; + +/* char: 0x5f '_' */ + +static const GLubyte ch95data[] = { +0xff,0xf8,0xff,0xf8, +}; + +static const BitmapCharRec ch95 = {13,2,0,5,13,ch95data}; + +/* char: 0x5e '^' */ + +static const GLubyte ch94data[] = { +0x80,0x80,0xc1,0x80,0x41,0x0,0x63,0x0,0x22,0x0,0x36,0x0,0x14,0x0,0x1c,0x0, +0x8,0x0, +}; + +static const BitmapCharRec ch94 = {9,9,-1,-8,11,ch94data}; + +/* char: 0x5d ']' */ + +static const GLubyte ch93data[] = { +0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0xf8, +}; + +static const BitmapCharRec ch93 = {5,21,-1,4,8,ch93data}; + +/* char: 0x5c '\' */ + +static const GLubyte ch92data[] = { +0x6,0x6,0x4,0xc,0xc,0x8,0x18,0x18,0x10,0x30,0x30,0x20,0x60,0x60,0x40,0xc0, +0xc0, +}; + +static const BitmapCharRec ch92 = {7,17,0,0,7,ch92data}; + +/* char: 0x5b '[' */ + +static const GLubyte ch91data[] = { +0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0xc0,0xc0,0xf8, +}; + +static const BitmapCharRec ch91 = {5,21,-2,4,8,ch91data}; + +/* char: 0x5a 'Z' */ + +static const GLubyte ch90data[] = { +0xff,0xf8,0xe0,0x18,0x70,0x8,0x30,0x8,0x38,0x0,0x18,0x0,0x1c,0x0,0xe,0x0, +0x6,0x0,0x7,0x0,0x3,0x0,0x3,0x80,0x1,0xc0,0x80,0xc0,0x80,0xe0,0xc0,0x70, +0xff,0xf0, +}; + +static const BitmapCharRec ch90 = {13,17,-1,0,15,ch90data}; + +/* char: 0x59 'Y' */ + +static const GLubyte ch89data[] = { +0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, +0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, +0xfc,0x3f, +}; + +static const BitmapCharRec ch89 = {16,17,0,0,16,ch89data}; + +/* char: 0x58 'X' */ + +static const GLubyte ch88data[] = { +0xfc,0xf,0xc0,0x30,0x3,0x80,0x18,0x7,0x0,0x8,0xe,0x0,0x4,0xc,0x0,0x6, +0x18,0x0,0x2,0x38,0x0,0x1,0x70,0x0,0x0,0xe0,0x0,0x0,0xc0,0x0,0x1,0xc0, +0x0,0x3,0xa0,0x0,0x3,0x10,0x0,0x6,0x8,0x0,0xe,0xc,0x0,0x1c,0x6,0x0, +0x7e,0xf,0x80, +}; + +static const BitmapCharRec ch88 = {18,17,0,0,18,ch88data}; + +/* char: 0x57 'W' */ + +static const GLubyte ch87data[] = { +0x1,0x83,0x0,0x1,0x83,0x0,0x1,0x83,0x80,0x3,0x87,0x80,0x3,0x46,0x80,0x3, +0x46,0xc0,0x6,0x46,0x40,0x6,0x4c,0x40,0x6,0x4c,0x60,0xc,0x2c,0x60,0xc,0x2c, +0x20,0x18,0x2c,0x20,0x18,0x18,0x30,0x18,0x18,0x10,0x30,0x18,0x10,0x30,0x18,0x18, +0xfc,0x7e,0x7e, +}; + +static const BitmapCharRec ch87 = {23,17,0,0,23,ch87data}; + +/* char: 0x56 'V' */ + +static const GLubyte ch86data[] = { +0x1,0x80,0x0,0x1,0x80,0x0,0x1,0x80,0x0,0x3,0xc0,0x0,0x3,0x40,0x0,0x3, +0x60,0x0,0x6,0x20,0x0,0x6,0x20,0x0,0x6,0x30,0x0,0xc,0x10,0x0,0xc,0x18, +0x0,0x18,0x8,0x0,0x18,0x8,0x0,0x18,0xc,0x0,0x30,0x4,0x0,0x30,0x6,0x0, +0xfc,0x1f,0x80, +}; + +static const BitmapCharRec ch86 = {17,17,0,0,17,ch86data}; + +/* char: 0x55 'U' */ + +static const GLubyte ch85data[] = { +0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, +0xfc,0x1f, +}; + +static const BitmapCharRec ch85 = {16,17,-1,0,18,ch85data}; + +/* char: 0x54 'T' */ + +static const GLubyte ch84data[] = { +0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0, +0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x83,0x4,0x83,0x4,0xc3,0xc, +0xff,0xfc, +}; + +static const BitmapCharRec ch84 = {14,17,-1,0,16,ch84data}; + +/* char: 0x53 'S' */ + +static const GLubyte ch83data[] = { +0x9e,0x0,0xf1,0x80,0xc0,0xc0,0x80,0x60,0x80,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0, +0xf,0x80,0x1e,0x0,0x78,0x0,0xe0,0x0,0xc0,0x40,0xc0,0x40,0xc0,0xc0,0x63,0xc0, +0x1e,0x40, +}; + +static const BitmapCharRec ch83 = {11,17,-1,0,13,ch83data}; + +/* char: 0x52 'R' */ + +static const GLubyte ch82data[] = { +0xfc,0x1e,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0x60,0x30,0xc0,0x31,0xc0,0x33,0x80, +0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x38,0x30,0x18,0x30,0x38,0x30,0x30,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch82 = {15,17,-1,0,16,ch82data}; + +/* char: 0x51 'Q' */ + +static const GLubyte ch81data[] = { +0x0,0xf,0x0,0x38,0x0,0x70,0x0,0xe0,0x1,0xc0,0x7,0xe0,0x1c,0x38,0x38,0x1c, +0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38,0x7,0xe0, +}; + +static const BitmapCharRec ch81 = {16,22,-1,5,18,ch81data}; + +/* char: 0x50 'P' */ + +static const GLubyte ch80data[] = { +0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch80 = {13,17,-1,0,15,ch80data}; + +/* char: 0x4f 'O' */ + +static const GLubyte ch79data[] = { +0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, +0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, +0x7,0xe0, +}; + +static const BitmapCharRec ch79 = {16,17,-1,0,18,ch79data}; + +/* char: 0x4e 'N' */ + +static const GLubyte ch78data[] = { +0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, +0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, +0xf0,0x1f, +}; + +static const BitmapCharRec ch78 = {16,17,-1,0,18,ch78data}; + +/* char: 0x4d 'M' */ + +static const GLubyte ch77data[] = { +0xf8,0x21,0xf8,0x20,0x60,0x60,0x20,0x60,0x60,0x20,0xd0,0x60,0x20,0xd0,0x60,0x21, +0x88,0x60,0x21,0x88,0x60,0x23,0x8,0x60,0x23,0x4,0x60,0x26,0x4,0x60,0x26,0x2, +0x60,0x2c,0x2,0x60,0x2c,0x2,0x60,0x38,0x1,0x60,0x38,0x1,0x60,0x30,0x0,0xe0, +0xf0,0x0,0xf8, +}; + +static const BitmapCharRec ch77 = {21,17,-1,0,22,ch77data}; + +/* char: 0x4c 'L' */ + +static const GLubyte ch76data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, +0xfc,0x0, +}; + +static const BitmapCharRec ch76 = {13,17,-1,0,14,ch76data}; + +/* char: 0x4b 'K' */ + +static const GLubyte ch75data[] = { +0xfc,0x1f,0x30,0xe,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0xe0,0x31,0xc0,0x33,0x80, +0x3f,0x0,0x3e,0x0,0x33,0x0,0x31,0x80,0x30,0xc0,0x30,0x60,0x30,0x30,0x30,0x18, +0xfc,0x7e, +}; + +static const BitmapCharRec ch75 = {16,17,-1,0,17,ch75data}; + +/* char: 0x4a 'J' */ + +static const GLubyte ch74data[] = { +0x78,0x0,0xcc,0x0,0xc6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +0x1f,0x80, +}; + +static const BitmapCharRec ch74 = {9,17,-1,0,11,ch74data}; + +/* char: 0x49 'I' */ + +static const GLubyte ch73data[] = { +0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0xfc, +}; + +static const BitmapCharRec ch73 = {6,17,-1,0,8,ch73data}; + +/* char: 0x48 'H' */ + +static const GLubyte ch72data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30, +0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x3f,0xfe,0x0,0x30,0x6,0x0,0x30,0x6, +0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0, +0xfc,0x1f,0x80, +}; + +static const BitmapCharRec ch72 = {17,17,-1,0,19,ch72data}; + +/* char: 0x47 'G' */ + +static const GLubyte ch71data[] = { +0x7,0xe0,0x1e,0x38,0x38,0x1c,0x60,0xc,0x60,0xc,0xc0,0xc,0xc0,0xc,0xc0,0x3f, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, +0x7,0xe4, +}; + +static const BitmapCharRec ch71 = {16,17,-1,0,18,ch71data}; + +/* char: 0x46 'F' */ + +static const GLubyte ch70data[] = { +0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x20,0x30,0x20, +0x3f,0xe0,0x30,0x20,0x30,0x20,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0, +}; + +static const BitmapCharRec ch70 = {12,17,-1,0,14,ch70data}; + +/* char: 0x45 'E' */ + +static const GLubyte ch69data[] = { +0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, +0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, +0xff,0xf0, +}; + +static const BitmapCharRec ch69 = {13,17,-1,0,15,ch69data}; + +/* char: 0x44 'D' */ + +static const GLubyte ch68data[] = { +0xff,0xc0,0x30,0x70,0x30,0x38,0x30,0xc,0x30,0xc,0x30,0x6,0x30,0x6,0x30,0x6, +0x30,0x6,0x30,0x6,0x30,0x6,0x30,0x6,0x30,0xc,0x30,0xc,0x30,0x38,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch68 = {15,17,-1,0,17,ch68data}; + +/* char: 0x43 'C' */ + +static const GLubyte ch67data[] = { +0x7,0xe0,0x1e,0x38,0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, +0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, +0x7,0xe4, +}; + +static const BitmapCharRec ch67 = {14,17,-1,0,16,ch67data}; + +/* char: 0x42 'B' */ + +static const GLubyte ch66data[] = { +0xff,0xe0,0x30,0x78,0x30,0x18,0x30,0xc,0x30,0xc,0x30,0xc,0x30,0x18,0x30,0x38, +0x3f,0xe0,0x30,0x40,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, +0xff,0xc0, +}; + +static const BitmapCharRec ch66 = {14,17,-1,0,16,ch66data}; + +/* char: 0x41 'A' */ + +static const GLubyte ch65data[] = { +0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, +0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, +0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, +0x0,0x80,0x0, +}; + +static const BitmapCharRec ch65 = {17,17,0,0,17,ch65data}; + +/* char: 0x40 '@' */ + +static const GLubyte ch64data[] = { +0x3,0xf0,0x0,0xe,0xc,0x0,0x18,0x0,0x0,0x30,0x0,0x0,0x61,0xde,0x0,0x63, +0x7b,0x0,0xc6,0x39,0x80,0xc6,0x18,0x80,0xc6,0x18,0xc0,0xc6,0x18,0x40,0xc6,0xc, +0x40,0xc3,0xc,0x40,0xc3,0x8c,0x40,0xe1,0xfc,0x40,0x60,0xec,0xc0,0x70,0x0,0x80, +0x38,0x1,0x80,0x1c,0x3,0x0,0xf,0xe,0x0,0x3,0xf8,0x0, +}; + +static const BitmapCharRec ch64 = {18,20,-2,3,22,ch64data}; + +/* char: 0x3f '?' */ + +static const GLubyte ch63data[] = { +0x30,0x30,0x0,0x0,0x10,0x10,0x10,0x18,0x18,0xc,0xe,0x7,0xc3,0xc3,0x83,0xc6, +0x7c, +}; + +static const BitmapCharRec ch63 = {8,17,-2,0,11,ch63data}; + +/* char: 0x3e '>' */ + +static const GLubyte ch62data[] = { +0xc0,0x0,0x70,0x0,0x1c,0x0,0x7,0x0,0x1,0xc0,0x0,0x60,0x1,0xc0,0x7,0x0, +0x1c,0x0,0x70,0x0,0xc0,0x0, +}; + +static const BitmapCharRec ch62 = {11,11,-1,-1,13,ch62data}; + +/* char: 0x3d '=' */ + +static const GLubyte ch61data[] = { +0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0, +}; + +static const BitmapCharRec ch61 = {12,6,-1,-4,14,ch61data}; + +/* char: 0x3c '<' */ + +static const GLubyte ch60data[] = { +0x0,0x60,0x1,0xc0,0x7,0x0,0x1c,0x0,0x70,0x0,0xc0,0x0,0x70,0x0,0x1c,0x0, +0x7,0x0,0x1,0xc0,0x0,0x60, +}; + +static const BitmapCharRec ch60 = {11,11,-1,-1,13,ch60data}; + +/* char: 0x3b ';' */ + +static const GLubyte ch59data[] = { +0xc0,0x60,0x20,0xe0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch59 = {3,14,-2,3,7,ch59data}; + +/* char: 0x3a ':' */ + +static const GLubyte ch58data[] = { +0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, +}; + +static const BitmapCharRec ch58 = {2,11,-2,0,6,ch58data}; + +/* char: 0x39 '9' */ + +static const GLubyte ch57data[] = { +0xf0,0x0,0x1c,0x0,0x6,0x0,0x3,0x0,0x3,0x80,0x1,0x80,0x1d,0x80,0x73,0xc0, +0x61,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0x61,0x80,0x77,0x80, +0x1e,0x0, +}; + +static const BitmapCharRec ch57 = {10,17,-1,0,12,ch57data}; + +/* char: 0x38 '8' */ + +static const GLubyte ch56data[] = { +0x1e,0x0,0x73,0x80,0xe1,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x41,0xc0,0x61,0x80, +0x37,0x0,0x1e,0x0,0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, +0x1e,0x0, +}; + +static const BitmapCharRec ch56 = {10,17,-1,0,12,ch56data}; + +/* char: 0x37 '7' */ + +static const GLubyte ch55data[] = { +0x18,0x0,0x18,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0x4,0x0,0x6,0x0,0x6,0x0, +0x2,0x0,0x3,0x0,0x3,0x0,0x1,0x0,0x1,0x80,0x81,0x80,0xc0,0xc0,0xff,0xc0, +0x7f,0xc0, +}; + +static const BitmapCharRec ch55 = {10,17,-1,0,12,ch55data}; + +/* char: 0x36 '6' */ + +static const GLubyte ch54data[] = { +0x1e,0x0,0x7b,0x80,0x61,0x80,0xe0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc1,0x80,0xf3,0x80,0xee,0x0,0x60,0x0,0x70,0x0,0x30,0x0,0x18,0x0,0xe,0x0, +0x3,0xc0, +}; + +static const BitmapCharRec ch54 = {10,17,-1,0,12,ch54data}; + +/* char: 0x35 '5' */ + +static const GLubyte ch53data[] = { +0x7e,0x0,0xe3,0x80,0xc1,0x80,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x1,0xc0, +0x3,0x80,0xf,0x80,0x7e,0x0,0x78,0x0,0x60,0x0,0x20,0x0,0x20,0x0,0x1f,0x80, +0x1f,0xc0, +}; + +static const BitmapCharRec ch53 = {10,17,-1,0,12,ch53data}; + +/* char: 0x34 '4' */ + +static const GLubyte ch52data[] = { +0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0xff,0xc0,0xff,0xc0,0xc3,0x0,0x43,0x0, +0x63,0x0,0x23,0x0,0x33,0x0,0x13,0x0,0x1b,0x0,0xb,0x0,0x7,0x0,0x7,0x0, +0x3,0x0, +}; + +static const BitmapCharRec ch52 = {10,17,-1,0,12,ch52data}; + +/* char: 0x33 '3' */ + +static const GLubyte ch51data[] = { +0x78,0x0,0xe6,0x0,0xc3,0x0,0x1,0x0,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0x80, +0x7,0x0,0x1e,0x0,0xc,0x0,0x6,0x0,0x83,0x0,0x83,0x0,0x47,0x0,0x7e,0x0, +0x1c,0x0, +}; + +static const BitmapCharRec ch51 = {9,17,-1,0,12,ch51data}; + +/* char: 0x32 '2' */ + +static const GLubyte ch50data[] = { +0xff,0x80,0xff,0xc0,0x60,0x40,0x30,0x0,0x18,0x0,0xc,0x0,0x4,0x0,0x6,0x0, +0x3,0x0,0x3,0x0,0x1,0x80,0x1,0x80,0x81,0x80,0x81,0x80,0x43,0x80,0x7f,0x0, +0x1c,0x0, +}; + +static const BitmapCharRec ch50 = {10,17,-1,0,12,ch50data}; + +/* char: 0x31 '1' */ + +static const GLubyte ch49data[] = { +0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x18, +0x8, +}; + +static const BitmapCharRec ch49 = {8,17,-2,0,12,ch49data}; + +/* char: 0x30 '0' */ + +static const GLubyte ch48data[] = { +0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0xe1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x61,0x80,0x61,0x80,0x33,0x0, +0x1e,0x0, +}; + +static const BitmapCharRec ch48 = {10,17,-1,0,12,ch48data}; + +/* char: 0x2f '/' */ + +static const GLubyte ch47data[] = { +0xc0,0xc0,0xc0,0x60,0x60,0x20,0x30,0x30,0x10,0x18,0x18,0x8,0xc,0xc,0x4,0x6, +0x6,0x3,0x3,0x3, +}; + +static const BitmapCharRec ch47 = {8,20,1,3,7,ch47data}; + +/* char: 0x2e '.' */ + +static const GLubyte ch46data[] = { +0xc0,0xc0, +}; + +static const BitmapCharRec ch46 = {2,2,-2,0,6,ch46data}; + +/* char: 0x2d '-' */ + +static const GLubyte ch45data[] = { +0xff,0xf0,0xff,0xf0, +}; + +static const BitmapCharRec ch45 = {12,2,-1,-6,14,ch45data}; + +/* char: 0x2c ',' */ + +static const GLubyte ch44data[] = { +0xc0,0x60,0x20,0xe0,0xc0, +}; + +static const BitmapCharRec ch44 = {3,5,-2,3,7,ch44data}; + +/* char: 0x2b '+' */ + +static const GLubyte ch43data[] = { +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xff,0xf0,0xff,0xf0,0x6,0x0, +0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, +}; + +static const BitmapCharRec ch43 = {12,12,-1,-1,14,ch43data}; + +/* char: 0x2a '*' */ + +static const GLubyte ch42data[] = { +0x8,0x0,0x1c,0x0,0xc9,0x80,0xeb,0x80,0x1c,0x0,0xeb,0x80,0xc9,0x80,0x1c,0x0, +0x8,0x0, +}; + +static const BitmapCharRec ch42 = {9,9,-2,-8,12,ch42data}; + +/* char: 0x29 ')' */ + +static const GLubyte ch41data[] = { +0x80,0x40,0x20,0x30,0x10,0x18,0x18,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0x18, +0x18,0x10,0x30,0x20,0x40,0x80, +}; + +static const BitmapCharRec ch41 = {6,22,-1,5,8,ch41data}; + +/* char: 0x28 '(' */ + +static const GLubyte ch40data[] = { +0x4,0x8,0x10,0x30,0x20,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60, +0x60,0x20,0x30,0x10,0x8,0x4, +}; + +static const BitmapCharRec ch40 = {6,22,-1,5,8,ch40data}; + +/* char: 0x27 ''' */ + +static const GLubyte ch39data[] = { +0xc0,0x60,0x20,0xe0,0xc0, +}; + +static const BitmapCharRec ch39 = {3,5,-3,-12,8,ch39data}; + +/* char: 0x26 '&' */ + +static const GLubyte ch38data[] = { +0x3c,0x3c,0x7f,0x7e,0xe1,0xe1,0xc0,0xc0,0xc1,0xc0,0xc1,0xa0,0x63,0x20,0x37,0x10, +0x1e,0x18,0xe,0x3e,0xf,0x0,0x1d,0x80,0x18,0xc0,0x18,0x40,0x18,0x40,0xc,0xc0, +0x7,0x80, +}; + +static const BitmapCharRec ch38 = {16,17,-1,0,18,ch38data}; + +/* char: 0x25 '%' */ + +static const GLubyte ch37data[] = { +0x30,0x3c,0x0,0x18,0x72,0x0,0xc,0x61,0x0,0x4,0x60,0x80,0x6,0x60,0x80,0x3, +0x30,0x80,0x1,0x19,0x80,0x1,0x8f,0x0,0x78,0xc0,0x0,0xe4,0x40,0x0,0xc2,0x60, +0x0,0xc1,0x30,0x0,0xc1,0x10,0x0,0x61,0x18,0x0,0x33,0xfc,0x0,0x1e,0xc,0x0, +}; + +static const BitmapCharRec ch37 = {17,16,-1,0,19,ch37data}; + +/* char: 0x24 '$' */ + +static const GLubyte ch36data[] = { +0x4,0x0,0x4,0x0,0x3f,0x0,0xe5,0xc0,0xc4,0xc0,0x84,0x60,0x84,0x60,0x4,0x60, +0x4,0xe0,0x7,0xc0,0x7,0x80,0x1e,0x0,0x3c,0x0,0x74,0x0,0x64,0x0,0x64,0x20, +0x64,0x60,0x34,0xe0,0x1f,0x80,0x4,0x0,0x4,0x0, +}; + +static const BitmapCharRec ch36 = {11,21,0,2,12,ch36data}; + +/* char: 0x23 '#' */ + +static const GLubyte ch35data[] = { +0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0xff,0xc0,0xff,0xc0,0x11,0x0, +0x11,0x0,0x11,0x0,0x7f,0xe0,0x7f,0xe0,0x8,0x80,0x8,0x80,0x8,0x80,0x8,0x80, +0x8,0x80, +}; + +static const BitmapCharRec ch35 = {11,17,-1,0,13,ch35data}; + +/* char: 0x22 '"' */ + +static const GLubyte ch34data[] = { +0x88,0xcc,0xcc,0xcc,0xcc, +}; + +static const BitmapCharRec ch34 = {6,5,-1,-12,10,ch34data}; + +/* char: 0x21 '!' */ + +static const GLubyte ch33data[] = { +0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, +0xc0, +}; + +static const BitmapCharRec ch33 = {2,17,-3,0,8,ch33data}; + +/* char: 0x20 ' ' */ + +#ifdef _WIN32 +/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with + a height or width of zero does not advance the raster position + as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ +static const GLubyte ch32data[] = { 0x0 }; +static const BitmapCharRec ch32 = {1,1,0,0,6,ch32data}; +#else +static const BitmapCharRec ch32 = {0,0,0,0,6,0}; +#endif + +static const BitmapCharRec * const chars[] = { +&ch32, +&ch33, +&ch34, +&ch35, +&ch36, +&ch37, +&ch38, +&ch39, +&ch40, +&ch41, +&ch42, +&ch43, +&ch44, +&ch45, +&ch46, +&ch47, +&ch48, +&ch49, +&ch50, +&ch51, +&ch52, +&ch53, +&ch54, +&ch55, +&ch56, +&ch57, +&ch58, +&ch59, +&ch60, +&ch61, +&ch62, +&ch63, +&ch64, +&ch65, +&ch66, +&ch67, +&ch68, +&ch69, +&ch70, +&ch71, +&ch72, +&ch73, +&ch74, +&ch75, +&ch76, +&ch77, +&ch78, +&ch79, +&ch80, +&ch81, +&ch82, +&ch83, +&ch84, +&ch85, +&ch86, +&ch87, +&ch88, +&ch89, +&ch90, +&ch91, +&ch92, +&ch93, +&ch94, +&ch95, +&ch96, +&ch97, +&ch98, +&ch99, +&ch100, +&ch101, +&ch102, +&ch103, +&ch104, +&ch105, +&ch106, +&ch107, +&ch108, +&ch109, +&ch110, +&ch111, +&ch112, +&ch113, +&ch114, +&ch115, +&ch116, +&ch117, +&ch118, +&ch119, +&ch120, +&ch121, +&ch122, +&ch123, +&ch124, +&ch125, +&ch126, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +&ch160, +&ch161, +&ch162, +&ch163, +&ch164, +&ch165, +&ch166, +&ch167, +&ch168, +&ch169, +&ch170, +&ch171, +&ch172, +&ch173, +&ch174, +&ch175, +&ch176, +&ch177, +&ch178, +&ch179, +&ch180, +&ch181, +&ch182, +&ch183, +&ch184, +&ch185, +&ch186, +&ch187, +&ch188, +&ch189, +&ch190, +&ch191, +&ch192, +&ch193, +&ch194, +&ch195, +&ch196, +&ch197, +&ch198, +&ch199, +&ch200, +&ch201, +&ch202, +&ch203, +&ch204, +&ch205, +&ch206, +&ch207, +&ch208, +&ch209, +&ch210, +&ch211, +&ch212, +&ch213, +&ch214, +&ch215, +&ch216, +&ch217, +&ch218, +&ch219, +&ch220, +&ch221, +&ch222, +&ch223, +&ch224, +&ch225, +&ch226, +&ch227, +&ch228, +&ch229, +&ch230, +&ch231, +&ch232, +&ch233, +&ch234, +&ch235, +&ch236, +&ch237, +&ch238, +&ch239, +&ch240, +&ch241, +&ch242, +&ch243, +&ch244, +&ch245, +&ch246, +&ch247, +&ch248, +&ch249, +&ch250, +&ch251, +&ch252, +&ch253, +&ch254, +&ch255, +}; + +const BitmapFontRec glutBitmapTimesRoman24 = { +"-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", +224, +32, +chars +}; + diff --git a/xc/extras/Mesa/src-glut/glut_util.c b/xc/extras/Mesa/src-glut/glut_util.c new file mode 100644 index 000000000..e18a47fb8 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_util.c @@ -0,0 +1,86 @@ + +/* 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 <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <stdio.h> + +#include "glutint.h" + +/* strdup is actually not a standard ANSI C or POSIX routine + so implement a private one for GLUT. OpenVMS does not have a + strdup; Linux's standard libc doesn't declare strdup by default + (unless BSD or SVID interfaces are requested). */ +char * +__glutStrdup(const char *string) +{ + char *copy; + + copy = (char*) malloc(strlen(string) + 1); + if (copy == NULL) + return NULL; + strcpy(copy, string); + return copy; +} + +void +__glutWarning(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Warning in %s: ", + __glutProgramName ? __glutProgramName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); +} + +/* CENTRY */ +void APIENTRY +glutReportErrors(void) +{ + GLenum error; + + while ((error = glGetError()) != GL_NO_ERROR) + __glutWarning("GL error: %s", gluErrorString(error)); +} +/* ENDCENTRY */ + +void +__glutFatalError(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Fatal Error in %s: ", + __glutProgramName ? __glutProgramName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); +#ifdef _WIN32 + if (__glutExitFunc) { + __glutExitFunc(1); + } +#endif + exit(1); +} + +void +__glutFatalUsage(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Fatal API Usage in %s: ", + __glutProgramName ? __glutProgramName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); + abort(); +} diff --git a/xc/extras/Mesa/src-glut/glut_vidresize.c b/xc/extras/Mesa/src-glut/glut_vidresize.c new file mode 100644 index 000000000..5b8257347 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_vidresize.c @@ -0,0 +1,230 @@ + +/* Copyright (c) Mark J. Kilgard, 1996. */ + +/* 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 <stdlib.h> + +#if !defined(_WIN32) +#include <GL/glx.h> +#endif + +#ifdef __sgi +#include <dlfcn.h> +#endif + +#include "glutint.h" + +/* Grumble. The IRIX 6.3 and early IRIX 6.4 OpenGL headers + support the video resize extension, but failed to define + GLX_SGIX_video_resize. */ +#ifdef GLX_SYNC_FRAME_SGIX +#define GLX_SGIX_video_resize 1 +#endif + +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) +static int canVideoResize = -1; +static int videoResizeChannel; +#else +static int canVideoResize = 0; +#endif +static int videoResizeInUse = 0; +static int dx = -1, dy = -1, dw = -1, dh = -1; + +/* XXX Note that IRIX 6.2, 6.3, and some 6.4 versions have a + bug where programs seg-fault when they attempt video + resizing from an indirect OpenGL context (either local or + over a network). */ + +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + +static volatile int errorCaught; + +/* ARGSUSED */ +static +catchXSGIvcErrors(Display * dpy, XErrorEvent * event) +{ + errorCaught = 1; + return 0; +} +#endif + +/* CENTRY */ +int APIENTRY +glutVideoResizeGet(GLenum param) +{ +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + if (canVideoResize < 0) { + canVideoResize = __glutIsSupportedByGLX("GLX_SGIX_video_resize"); + if (canVideoResize) { +#if __sgi + /* This is a hack because IRIX 6.2, 6.3, and some 6.4 + versions were released with GLX_SGIX_video_resize + being advertised by the X server though the video + resize extension is not actually supported. We try to + determine if the libGL.so we are using actually has a + video resize entrypoint before we try to use the + feature. */ + void (*func) (void); + void *glxDso = dlopen("libGL.so", RTLD_LAZY); + + func = (void (*)(void)) dlsym(glxDso, "glXQueryChannelDeltasSGIX"); + if (!func) { + canVideoResize = 0; + } else +#endif + { + char *channelString; + int (*handler) (Display *, XErrorEvent *); + + channelString = getenv("GLUT_VIDEO_RESIZE_CHANNEL"); + videoResizeChannel = channelString ? atoi(channelString) : 0; + + /* Work around another annoying problem with SGI's + GLX_SGIX_video_resize implementation. Early IRIX + 6.4 OpenGL's advertise the extension and have the + video resize API, but an XSGIvc X protocol errors + result trying to use the API. Set up an error + handler to intercept what would otherwise be a fatal + error. If an error was recieved, do not report that + video resize is possible. */ + handler = XSetErrorHandler(catchXSGIvcErrors); + + errorCaught = 0; + + glXQueryChannelDeltasSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, &dx, &dy, &dw, &dh); + + /* glXQueryChannelDeltasSGIX is an inherent X server + round-trip so we know we will have gotten either the + correct reply or and error by this time. */ + XSetErrorHandler(handler); + + /* Still yet another work around. In IRIX 6.4 betas, + glXQueryChannelDeltasSGIX will return as if it + succeeded, but the values are filled with junk. + Watch to make sure the delta variables really make + sense. */ + if (errorCaught || + dx < 0 || dy < 0 || dw < 0 || dh < 0 || + dx > 2048 || dy > 2048 || dw > 2048 || dh > 2048) { + canVideoResize = 0; + } + } + } + } +#endif /* GLX_SGIX_video_resize */ + + switch (param) { + case GLUT_VIDEO_RESIZE_POSSIBLE: + return canVideoResize; + case GLUT_VIDEO_RESIZE_IN_USE: + return videoResizeInUse; + case GLUT_VIDEO_RESIZE_X_DELTA: + return dx; + case GLUT_VIDEO_RESIZE_Y_DELTA: + return dy; + case GLUT_VIDEO_RESIZE_WIDTH_DELTA: + return dw; + case GLUT_VIDEO_RESIZE_HEIGHT_DELTA: + return dh; + case GLUT_VIDEO_RESIZE_X: + case GLUT_VIDEO_RESIZE_Y: + case GLUT_VIDEO_RESIZE_WIDTH: + case GLUT_VIDEO_RESIZE_HEIGHT: +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + if (videoResizeInUse) { + int x, y, width, height; + + glXQueryChannelRectSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, &x, &y, &width, &height); + switch (param) { + case GLUT_VIDEO_RESIZE_X: + return x; + case GLUT_VIDEO_RESIZE_Y: + return y; + case GLUT_VIDEO_RESIZE_WIDTH: + return width; + case GLUT_VIDEO_RESIZE_HEIGHT: + return height; + } + } +#endif + return -1; + default: + __glutWarning("invalid glutVideoResizeGet parameter: %d", param); + return -1; + } +} + +void APIENTRY +glutSetupVideoResizing(void) +{ +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + if (glutVideoResizeGet(GLUT_VIDEO_RESIZE_POSSIBLE)) { + glXBindChannelToWindowSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, __glutCurrentWindow->win); + videoResizeInUse = 1; + } else +#endif + __glutFatalError("glutEstablishVideoResizing: video resizing not possible.\n"); +} + +void APIENTRY +glutStopVideoResizing(void) +{ +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + if (glutVideoResizeGet(GLUT_VIDEO_RESIZE_POSSIBLE)) { + if (videoResizeInUse) { + glXBindChannelToWindowSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, None); + videoResizeInUse = 0; + } + } +#endif +} + +/* ARGSUSED */ +void APIENTRY +glutVideoResize(int x, int y, int width, int height) +{ +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + if (videoResizeInUse) { +#ifdef GLX_SYNC_SWAP_SGIX + /* glXChannelRectSyncSGIX introduced in a patch to IRIX + 6.2; the original unpatched IRIX 6.2 behavior is always + GLX_SYNC_SWAP_SGIX. */ + glXChannelRectSyncSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, GLX_SYNC_SWAP_SGIX); +#endif + glXChannelRectSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, x, y, width, height); + } +#endif +} + +/* ARGSUSED */ +void APIENTRY +glutVideoPan(int x, int y, int width, int height) +{ +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) + if (videoResizeInUse) { +#ifdef GLX_SYNC_FRAME_SGIX + /* glXChannelRectSyncSGIX introduced in a patch to IRIX + 6.2; the original unpatched IRIX 6.2 behavior is always + GLX_SYNC_SWAP_SGIX. We just ignore that we cannot + accomplish GLX_SYNC_FRAME_SGIX on IRIX unpatched 6.2; + this means you'd need a glutSwapBuffers to actually + realize the video resize. */ + glXChannelRectSyncSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, GLX_SYNC_FRAME_SGIX); +#endif + glXChannelRectSGIX(__glutDisplay, __glutScreen, + videoResizeChannel, x, y, width, height); + } +#endif +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_warp.c b/xc/extras/Mesa/src-glut/glut_warp.c new file mode 100644 index 000000000..fa55f7591 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_warp.c @@ -0,0 +1,23 @@ + +/* Copyright (c) Mark J. Kilgard, 1996, 1997. */ + +/* 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 <stdlib.h> +#include <stdarg.h> +#include <stdio.h> + +#include "glutint.h" + +/* CENTRY */ +void APIENTRY +glutWarpPointer(int x, int y) +{ + XWarpPointer(__glutDisplay, None, __glutCurrentWindow->win, + 0, 0, 0, 0, x, y); + XFlush(__glutDisplay); +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glut_win.c b/xc/extras/Mesa/src-glut/glut_win.c new file mode 100644 index 000000000..883bacb08 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_win.c @@ -0,0 +1,1007 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* 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 <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <assert.h> +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#endif + +#include "glutint.h" + +GLUTwindow *__glutCurrentWindow = NULL; +GLUTwindow **__glutWindowList = NULL; +int __glutWindowListSize = 0; +#if !defined(_WIN32) +GLUTstale *__glutStaleWindowList = NULL; +#endif +GLUTwindow *__glutMenuWindow = NULL; + +void (*__glutFreeOverlayFunc) (GLUToverlay *); +XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle, + Criterion * requiredCriteria, int nRequired, int requiredMask, void** fbc) = NULL; + +static Criterion requiredWindowCriteria[] = +{ + {LEVEL, EQ, 0}, + {TRANSPARENT, EQ, 0} +}; +static int numRequiredWindowCriteria = sizeof(requiredWindowCriteria) / sizeof(Criterion); +static int requiredWindowCriteriaMask = (1 << LEVEL) | (1 << TRANSPARENT); + +static void +cleanWindowWorkList(GLUTwindow * window) +{ + GLUTwindow **pEntry = &__glutWindowWorkList; + GLUTwindow *entry = __glutWindowWorkList; + + /* Tranverse singly-linked window work list look for the + window. */ + while (entry) { + if (entry == window) { + /* Found it; delete it. */ + *pEntry = entry->prevWorkWin; + return; + } else { + pEntry = &entry->prevWorkWin; + entry = *pEntry; + } + } +} + +#if !defined(_WIN32) + +static void +cleanStaleWindowList(GLUTwindow * window) +{ + GLUTstale **pEntry = &__glutStaleWindowList; + GLUTstale *entry = __glutStaleWindowList; + + /* Tranverse singly-linked stale window list look for the + window ID. */ + while (entry) { + if (entry->window == window) { + /* Found it; delete it. */ + *pEntry = entry->next; + free(entry); + return; + } else { + pEntry = &entry->next; + entry = *pEntry; + } + } +} + +#endif + +static GLUTwindow *__glutWindowCache = NULL; + +GLUTwindow * +__glutGetWindow(Window win) +{ + int i; + + /* Does win belong to the last window ID looked up? */ + if (__glutWindowCache && (win == __glutWindowCache->win || + (__glutWindowCache->overlay && win == + __glutWindowCache->overlay->win))) { + return + __glutWindowCache; + } + /* Otherwise scan the window list looking for the window ID. */ + for (i = 0; i < __glutWindowListSize; i++) { + if (__glutWindowList[i]) { + if (win == __glutWindowList[i]->win) { + __glutWindowCache = __glutWindowList[i]; + return __glutWindowCache; + } + if (__glutWindowList[i]->overlay) { + if (win == __glutWindowList[i]->overlay->win) { + __glutWindowCache = __glutWindowList[i]; + return __glutWindowCache; + } + } + } + } +#if !defined(_WIN32) + { + GLUTstale *entry; + + /* Scan through destroyed overlay window IDs for which no + DestroyNotify has yet been received. */ + for (entry = __glutStaleWindowList; entry; entry = entry->next) { + if (entry->win == win) + return entry->window; + } + } +#endif + return NULL; +} + +/* CENTRY */ +int APIENTRY +glutGetWindow(void) +{ + if (__glutCurrentWindow) { + return __glutCurrentWindow->num + 1; + } else { + return 0; + } +} +/* ENDCENTRY */ + +void +__glutSetWindow(GLUTwindow * window) +{ + /* It is tempting to try to short-circuit the call to + glXMakeCurrent if we "know" we are going to make current + to a window we are already current to. In fact, this + assumption breaks when GLUT is expected to integrated with + other OpenGL windowing APIs that also make current to + OpenGL contexts. Since glXMakeCurrent short-circuits the + "already bound" case, GLUT avoids the temptation to do so + too. */ + __glutCurrentWindow = window; + + MAKE_CURRENT_LAYER(__glutCurrentWindow); + +#if !defined(_WIN32) + /* We should be careful to force a finish between each + iteration through the GLUT main loop if indirect OpenGL + contexts are in use; indirect contexts tend to have much + longer latency because lots of OpenGL extension requests + can queue up in the X protocol stream. We accomplish this + by posting GLUT_FINISH_WORK to be done. */ + if (!__glutCurrentWindow->isDirect) + __glutPutOnWorkList(__glutCurrentWindow, GLUT_FINISH_WORK); +#endif + + /* If debugging is enabled, we'll want to check this window + for any OpenGL errors every iteration through the GLUT + main loop. To accomplish this, we post the + GLUT_DEBUG_WORK to be done on this window. */ + if (__glutDebug) { + __glutPutOnWorkList(__glutCurrentWindow, GLUT_DEBUG_WORK); + } +} + +/* CENTRY */ +void APIENTRY +glutSetWindow(int win) +{ + GLUTwindow *window; + + if (win < 1 || win > __glutWindowListSize) { + __glutWarning("glutSetWindow attempted on bogus window."); + return; + } + window = __glutWindowList[win - 1]; + if (!window) { + __glutWarning("glutSetWindow attempted on bogus window."); + return; + } + __glutSetWindow(window); +} +/* ENDCENTRY */ + +static int +getUnusedWindowSlot(void) +{ + int i; + + /* Look for allocated, unused slot. */ + for (i = 0; i < __glutWindowListSize; i++) { + if (!__glutWindowList[i]) { + return i; + } + } + /* Allocate a new slot. */ + __glutWindowListSize++; + if (__glutWindowList) { + __glutWindowList = (GLUTwindow **) + realloc(__glutWindowList, + __glutWindowListSize * sizeof(GLUTwindow *)); + } else { + /* XXX Some realloc's do not correctly perform a malloc + when asked to perform a realloc on a NULL pointer, + though the ANSI C library spec requires this. */ + __glutWindowList = (GLUTwindow **) + malloc(sizeof(GLUTwindow *)); + } + if (!__glutWindowList) + __glutFatalError("out of memory."); + __glutWindowList[__glutWindowListSize - 1] = NULL; + return __glutWindowListSize - 1; +} + +static XVisualInfo * +getVisualInfoCI(unsigned int mode) +{ + static int bufSizeList[] = + {16, 12, 8, 4, 2, 1, 0}; + XVisualInfo *vi; + int list[32]; + int i, n = 0; + + /* Should not be looking at display mode mask if + __glutDisplayString is non-NULL. */ + assert(!__glutDisplayString); + + list[n++] = GLX_BUFFER_SIZE; + list[n++] = 1; + if (GLUT_WIND_IS_DOUBLE(mode)) { + list[n++] = GLX_DOUBLEBUFFER; + } + if (GLUT_WIND_IS_STEREO(mode)) { + list[n++] = GLX_STEREO; + } + if (GLUT_WIND_HAS_DEPTH(mode)) { + list[n++] = GLX_DEPTH_SIZE; + list[n++] = 1; + } + if (GLUT_WIND_HAS_STENCIL(mode)) { + list[n++] = GLX_STENCIL_SIZE; + list[n++] = 1; + } + list[n] = (int) None; /* terminate list */ + + /* glXChooseVisual specify GLX_BUFFER_SIZE prefers the + "smallest index buffer of at least the specified size". + This would be reasonable if GLUT allowed the user to + specify the required buffe size, but GLUT's display mode + is too simplistic (easy to use?). GLUT should try to find + the "largest". So start with a large buffer size and + shrink until we find a matching one that exists. */ + + for (i = 0; bufSizeList[i]; i++) { + /* XXX Assumes list[1] is where GLX_BUFFER_SIZE parameter + is. */ + list[1] = bufSizeList[i]; + vi = glXChooseVisual(__glutDisplay, + __glutScreen, list); + if (vi) + return vi; + } + return NULL; +} + +static XVisualInfo * +getVisualInfoRGB(unsigned int mode) +{ + int list[32]; + int n = 0; + + /* Should not be looking at display mode mask if + __glutDisplayString is non-NULL. */ + assert(!__glutDisplayString); + + /* XXX Would a caching mechanism to minize the calls to + glXChooseVisual? You'd have to reference count + XVisualInfo* pointers. Would also have to properly + interact with glutInitDisplayString. */ + + list[n++] = GLX_RGBA; + list[n++] = GLX_RED_SIZE; + list[n++] = 1; + list[n++] = GLX_GREEN_SIZE; + list[n++] = 1; + list[n++] = GLX_BLUE_SIZE; + list[n++] = 1; + if (GLUT_WIND_HAS_ALPHA(mode)) { + list[n++] = GLX_ALPHA_SIZE; + list[n++] = 1; + } + if (GLUT_WIND_IS_DOUBLE(mode)) { + list[n++] = GLX_DOUBLEBUFFER; + } + if (GLUT_WIND_IS_STEREO(mode)) { + list[n++] = GLX_STEREO; + } + if (GLUT_WIND_HAS_DEPTH(mode)) { + list[n++] = GLX_DEPTH_SIZE; + list[n++] = 1; + } + if (GLUT_WIND_HAS_STENCIL(mode)) { + list[n++] = GLX_STENCIL_SIZE; + list[n++] = 1; + } + if (GLUT_WIND_HAS_ACCUM(mode)) { + list[n++] = GLX_ACCUM_RED_SIZE; + list[n++] = 1; + list[n++] = GLX_ACCUM_GREEN_SIZE; + list[n++] = 1; + list[n++] = GLX_ACCUM_BLUE_SIZE; + list[n++] = 1; + if (GLUT_WIND_HAS_ALPHA(mode)) { + list[n++] = GLX_ACCUM_ALPHA_SIZE; + list[n++] = 1; + } + } +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) + if (GLUT_WIND_IS_MULTISAMPLE(mode)) { + if (!__glutIsSupportedByGLX("GLX_SGIS_multisample")) + return NULL; + list[n++] = GLX_SAMPLES_SGIS; + /* XXX Is 4 a reasonable minimum acceptable number of + samples? */ + list[n++] = 4; + } +#endif + list[n] = (int) None; /* terminate list */ + + return glXChooseVisual(__glutDisplay, + __glutScreen, list); +} + +XVisualInfo * +__glutGetVisualInfo(unsigned int mode) +{ + /* XXX GLUT_LUMINANCE not implemented for GLUT 3.0. */ + if (GLUT_WIND_IS_LUMINANCE(mode)) + return NULL; + + if (GLUT_WIND_IS_RGB(mode)) + return getVisualInfoRGB(mode); + else + return getVisualInfoCI(mode); +} + +XVisualInfo * +__glutDetermineVisual( + unsigned int displayMode, + Bool * treatAsSingle, + XVisualInfo * (getVisualInfo) (unsigned int)) +{ + XVisualInfo *vis; + + /* Should not be looking at display mode mask if + __glutDisplayString is non-NULL. */ + assert(!__glutDisplayString); + + *treatAsSingle = GLUT_WIND_IS_SINGLE(displayMode); + vis = getVisualInfo(displayMode); + if (!vis) { + /* Fallback cases when can't get exactly what was asked + for... */ + if (GLUT_WIND_IS_SINGLE(displayMode)) { + /* If we can't find a single buffered visual, try looking + for a double buffered visual. We can treat a double + buffered visual as a single buffer visual by changing + the draw buffer to GL_FRONT and treating any swap + buffers as no-ops. */ + displayMode |= GLUT_DOUBLE; + vis = getVisualInfo(displayMode); + *treatAsSingle = True; + } + if (!vis && GLUT_WIND_IS_MULTISAMPLE(displayMode)) { + /* If we can't seem to get multisampling (ie, not Reality + Engine class graphics!), go without multisampling. It + is up to the application to query how many multisamples + were allocated (0 equals no multisampling) if the + application is going to use multisampling for more than + just antialiasing. */ + displayMode &= ~GLUT_MULTISAMPLE; + vis = getVisualInfo(displayMode); + } + } + return vis; +} + +void GLUTCALLBACK +__glutDefaultDisplay(void) +{ + /* XXX Remove the warning after GLUT 3.0. */ + __glutWarning("The following is a new check for GLUT 3.0; update your code."); + __glutFatalError( + "redisplay needed for window %d, but no display callback.", + __glutCurrentWindow->num + 1); +} + +void GLUTCALLBACK +__glutDefaultReshape(int width, int height) +{ + GLUToverlay *overlay; + + /* Adjust the viewport of the window (and overlay if one + exists). */ + MAKE_CURRENT_WINDOW(__glutCurrentWindow); + glViewport(0, 0, (GLsizei) width, (GLsizei) height); + overlay = __glutCurrentWindow->overlay; + if (overlay) { + MAKE_CURRENT_OVERLAY(overlay); + glViewport(0, 0, (GLsizei) width, (GLsizei) height); + } + /* Make sure we are current to the current layer (application + should be able to count on the current layer not changing + unless the application explicitly calls glutUseLayer). */ + MAKE_CURRENT_LAYER(__glutCurrentWindow); +} + +XVisualInfo * +__glutDetermineWindowVisual(Bool * treatAsSingle, Bool * visAlloced, void **fbc) +{ + if (__glutDisplayString) { + + /* __glutDisplayString should be NULL except if + glutInitDisplayString has been called to register a + different display string. Calling glutInitDisplayString + means using a string instead of an integer mask determine + the visual to use. Using the function pointer variable + __glutDetermineVisualFromString below avoids linking in + the code for implementing glutInitDisplayString (ie, + glut_dstr.o) unless glutInitDisplayString gets called by + the application. */ + + assert(__glutDetermineVisualFromString); + *visAlloced = False; + *fbc = NULL; + return __glutDetermineVisualFromString(__glutDisplayString, treatAsSingle, + requiredWindowCriteria, numRequiredWindowCriteria, requiredWindowCriteriaMask, fbc); + } else { + *visAlloced = True; + *fbc = NULL; + return __glutDetermineVisual(__glutDisplayMode, + treatAsSingle, __glutGetVisualInfo); + } +} + +/* ARGSUSED5 */ /* Only Win32 uses gameMode parameter. */ +GLUTwindow * +__glutCreateWindow(GLUTwindow * parent, + int x, int y, int width, int height, int gameMode) +{ + GLUTwindow *window; + XSetWindowAttributes wa; + unsigned long attribMask; + int winnum; + int i; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + GLXFBConfigSGIX fbc; +#else + void *fbc; +#endif + +#if defined(_WIN32) + WNDCLASS wc; + int style; + + if (!GetClassInfo(GetModuleHandle(NULL), "GLUT", &wc)) { + __glutOpenWin32Connection(NULL); + } +#else + if (!__glutDisplay) { + __glutOpenXConnection(NULL); + } +#endif + if (__glutGameModeWindow) { + __glutFatalError("cannot create windows in game mode."); + } + winnum = getUnusedWindowSlot(); + window = (GLUTwindow *) malloc(sizeof(GLUTwindow)); + if (!window) { + __glutFatalError("out of memory."); + } + window->num = winnum; + +#if !defined(_WIN32) + window->vis = __glutDetermineWindowVisual(&window->treatAsSingle, + &window->visAlloced, (void**) &fbc); + if (!window->vis) { + __glutFatalError( + "visual with necessary capabilities not found."); + } + __glutSetupColormap(window->vis, &window->colormap, &window->cmap); +#endif + window->eventMask = StructureNotifyMask | ExposureMask; + + attribMask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask; + wa.background_pixmap = None; + wa.border_pixel = 0; + wa.colormap = window->cmap; + wa.event_mask = window->eventMask; + if (parent) { + if (parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) + wa.event_mask |= GLUT_HACK_STOP_PROPAGATE_MASK; + attribMask |= CWDontPropagate; + wa.do_not_propagate_mask = parent->eventMask & GLUT_DONT_PROPAGATE_FILTER_MASK; + } else { + wa.do_not_propagate_mask = 0; + } + + /* Stash width and height before Win32's __glutAdjustCoords + possibly overwrites the values. */ + window->width = width; + window->height = height; + window->forceReshape = True; + window->ignoreKeyRepeat = False; + +#if defined(_WIN32) + __glutAdjustCoords(parent ? parent->win : NULL, + &x, &y, &width, &height); + if (parent) { + style = WS_CHILD; + } else { + if (gameMode) { + /* Game mode window should be a WS_POPUP window to + ensure that the taskbar is hidden by it. A standard + WS_OVERLAPPEDWINDOW does not hide the task bar. */ + style = WS_POPUP | WS_MAXIMIZE; + } else { + /* A standard toplevel window with borders and such. */ + style = WS_OVERLAPPEDWINDOW; + } + } + window->win = CreateWindow("GLUT", "GLUT", + WS_CLIPSIBLINGS | WS_CLIPCHILDREN | style, + x, y, width, height, parent ? parent->win : __glutRoot, + NULL, GetModuleHandle(NULL), 0); + window->hdc = GetDC(window->win); + /* Must set the XHDC for fake glXChooseVisual & fake + glXCreateContext & fake XAllocColorCells. */ + XHDC = window->hdc; + window->vis = __glutDetermineWindowVisual(&window->treatAsSingle, + &window->visAlloced, &fbc); + if (!window->vis) { + __glutFatalError( + "pixel format with necessary capabilities not found."); + } + if (!SetPixelFormat(window->hdc, + ChoosePixelFormat(window->hdc, window->vis), + window->vis)) { + __glutFatalError("SetPixelFormat failed during window create."); + } + __glutSetupColormap(window->vis, &window->colormap, &window->cmap); + /* Make sure subwindows get a windowStatus callback. */ + if (parent) { + PostMessage(parent->win, WM_ACTIVATE, 0, 0); + } + window->renderDc = window->hdc; +#else + window->win = XCreateWindow(__glutDisplay, + parent == NULL ? __glutRoot : parent->win, + x, y, width, height, 0, + window->vis->depth, InputOutput, window->vis->visual, + attribMask, &wa); +#endif + window->renderWin = window->win; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + if (fbc) { + window->ctx = glXCreateContextWithConfigSGIX(__glutDisplay, fbc, + GLX_RGBA_TYPE_SGIX, None, __glutTryDirect); + } else +#endif + { + window->ctx = glXCreateContext(__glutDisplay, window->vis, + None, __glutTryDirect); + } + if (!window->ctx) { + __glutFatalError( + "failed to create OpenGL rendering context."); + } + window->renderCtx = window->ctx; +#if !defined(_WIN32) + window->isDirect = glXIsDirect(__glutDisplay, window->ctx); + if (__glutForceDirect) { + if (!window->isDirect) + __glutFatalError("direct rendering not possible."); + } +#endif + + window->parent = parent; + if (parent) { + window->siblings = parent->children; + parent->children = window; + } else { + window->siblings = NULL; + } + window->overlay = NULL; + window->children = NULL; + window->display = __glutDefaultDisplay; + window->reshape = __glutDefaultReshape; + window->mouse = NULL; + window->motion = NULL; + window->passive = NULL; + window->entry = NULL; + window->keyboard = NULL; + window->keyboardUp = NULL; + window->windowStatus = NULL; + window->visibility = NULL; + window->special = NULL; + window->specialUp = NULL; + window->buttonBox = NULL; + window->dials = NULL; + window->spaceMotion = NULL; + window->spaceRotate = NULL; + window->spaceButton = NULL; + window->tabletMotion = NULL; + window->tabletButton = NULL; +#ifdef _WIN32 + window->joystick = NULL; + window->joyPollInterval = 0; +#endif + window->tabletPos[0] = -1; + window->tabletPos[1] = -1; + window->shownState = 0; + window->visState = -1; /* not VisibilityUnobscured, + VisibilityPartiallyObscured, or + VisibilityFullyObscured */ + window->entryState = -1; /* not EnterNotify or LeaveNotify */ + + window->desiredConfMask = 0; + window->buttonUses = 0; + window->cursor = GLUT_CURSOR_INHERIT; + + /* Setup window to be mapped when glutMainLoop starts. */ + window->workMask = GLUT_MAP_WORK; +#ifdef _WIN32 + if (gameMode) { + /* When mapping a game mode window, just show + the window. We have already created the game + mode window with a maximize flag at creation + time. Doing a ShowWindow(window->win, SW_SHOWNORMAL) + would be wrong for a game mode window since it + would unmaximize the window. */ + window->desiredMapState = GameModeState; + } else { + window->desiredMapState = NormalState; + } +#else + window->desiredMapState = NormalState; +#endif + window->prevWorkWin = __glutWindowWorkList; + __glutWindowWorkList = window; + + /* Initially, no menus attached. */ + for (i = 0; i < GLUT_MAX_MENUS; i++) { + window->menu[i] = 0; + } + + /* Add this new window to the window list. */ + __glutWindowList[winnum] = window; + + /* Make the new window the current window. */ + __glutSetWindow(window); + + __glutDetermineMesaSwapHackSupport(); + + if (window->treatAsSingle) { + /* We do this because either the window really is single + buffered (in which case this is redundant, but harmless, + because this is the initial single-buffered context + state); or we are treating a double buffered window as a + single-buffered window because the system does not appear + to export any suitable single- buffered visuals (in which + the following are necessary). */ + glDrawBuffer(GL_FRONT); + glReadBuffer(GL_FRONT); + } + return window; +} + +/* CENTRY */ +int APIENTRY +glutCreateWindow(const char *title) +{ + static int firstWindow = 1; + GLUTwindow *window; +#if !defined(_WIN32) + XWMHints *wmHints; +#endif + Window win; + XTextProperty textprop; + + if (__glutGameModeWindow) { + __glutFatalError("cannot create windows in game mode."); + } + window = __glutCreateWindow(NULL, + __glutSizeHints.x, __glutSizeHints.y, + __glutInitWidth, __glutInitHeight, + /* not game mode */ 0); + win = window->win; + /* Setup ICCCM properties. */ + textprop.value = (unsigned char *) title; + textprop.encoding = XA_STRING; + textprop.format = 8; + textprop.nitems = strlen(title); +#if defined(_WIN32) + SetWindowText(win, title); + if (__glutIconic) { + window->desiredMapState = IconicState; + } +#else + wmHints = XAllocWMHints(); + wmHints->initial_state = + __glutIconic ? IconicState : NormalState; + wmHints->flags = StateHint; + XSetWMProperties(__glutDisplay, win, &textprop, &textprop, + /* Only put WM_COMMAND property on first window. */ + firstWindow ? __glutArgv : NULL, + firstWindow ? __glutArgc : 0, + &__glutSizeHints, wmHints, NULL); + XFree(wmHints); + XSetWMProtocols(__glutDisplay, win, &__glutWMDeleteWindow, 1); +#endif + firstWindow = 0; + return window->num + 1; +} + +#ifdef _WIN32 +int APIENTRY +__glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)) +{ + __glutExitFunc = exitfunc; + return glutCreateWindow(title); +} +#endif + +int APIENTRY +glutCreateSubWindow(int win, int x, int y, int width, int height) +{ + GLUTwindow *window; + + window = __glutCreateWindow(__glutWindowList[win - 1], + x, y, width, height, /* not game mode */ 0); +#if !defined(_WIN32) + { + GLUTwindow *toplevel; + + toplevel = __glutToplevelOf(window); + if (toplevel->cmap != window->cmap) { + __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); + } + } +#endif + return window->num + 1; +} +/* ENDCENTRY */ + +void +__glutDestroyWindow(GLUTwindow * window, + GLUTwindow * initialWindow) +{ + GLUTwindow **prev, *cur, *parent, *siblings; + + /* Recursively destroy any children. */ + cur = window->children; + while (cur) { + siblings = cur->siblings; + __glutDestroyWindow(cur, initialWindow); + cur = siblings; + } + /* Remove from parent's children list (only necessary for + non-initial windows and subwindows!). */ + parent = window->parent; + if (parent && parent == initialWindow->parent) { + prev = &parent->children; + cur = parent->children; + while (cur) { + if (cur == window) { + *prev = cur->siblings; + break; + } + prev = &(cur->siblings); + cur = cur->siblings; + } + } + /* Unbind if bound to this window. */ + if (window == __glutCurrentWindow) { + UNMAKE_CURRENT(); + __glutCurrentWindow = NULL; + } + /* Begin tearing down window itself. */ + if (window->overlay) { + __glutFreeOverlayFunc(window->overlay); + } + XDestroyWindow(__glutDisplay, window->win); + glXDestroyContext(__glutDisplay, window->ctx); + if (window->colormap) { + /* Only color index windows have colormap data structure. */ + __glutFreeColormap(window->colormap); + } + /* NULLing the __glutWindowList helps detect is a window + instance has been destroyed, given a window number. */ + __glutWindowList[window->num] = NULL; + + /* Cleanup data structures that might contain window. */ + cleanWindowWorkList(window); +#if !defined(_WIN32) + cleanStaleWindowList(window); +#endif + /* Remove window from the "get window cache" if it is there. */ + if (__glutWindowCache == window) + __glutWindowCache = NULL; + + if (window->visAlloced) { + /* Only free XVisualInfo* gotten from glXChooseVisual. */ + XFree(window->vis); + } + + if (window == __glutGameModeWindow) { + /* Destroying the game mode window should implicitly + have GLUT leave game mode. */ + __glutCloseDownGameMode(); + } + + free(window); +} + +/* CENTRY */ +void APIENTRY +glutDestroyWindow(int win) +{ + GLUTwindow *window = __glutWindowList[win - 1]; + + if (__glutMappedMenu && __glutMenuWindow == window) { + __glutFatalUsage("destroying menu window not allowed while menus in use"); + } +#if !defined(_WIN32) + /* If not a toplevel window... */ + if (window->parent) { + /* Destroying subwindows may change colormap requirements; + recalculate toplevel window's WM_COLORMAP_WINDOWS + property. */ + __glutPutOnWorkList(__glutToplevelOf(window->parent), + GLUT_COLORMAP_WORK); + } +#endif + __glutDestroyWindow(window, window); + XFlush(__glutDisplay); +} +/* ENDCENTRY */ + +void +__glutChangeWindowEventMask(long eventMask, Bool add) +{ + if (add) { + /* Add eventMask to window's event mask. */ + if ((__glutCurrentWindow->eventMask & eventMask) != + eventMask) { + __glutCurrentWindow->eventMask |= eventMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_EVENT_MASK_WORK); + } + } else { + /* Remove eventMask from window's event mask. */ + if (__glutCurrentWindow->eventMask & eventMask) { + __glutCurrentWindow->eventMask &= ~eventMask; + __glutPutOnWorkList(__glutCurrentWindow, + GLUT_EVENT_MASK_WORK); + } + } +} + +void APIENTRY +glutDisplayFunc(GLUTdisplayCB displayFunc) +{ + /* XXX Remove the warning after GLUT 3.0. */ + if (!displayFunc) + __glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code."); + __glutCurrentWindow->display = displayFunc; +} + +void APIENTRY +glutMouseFunc(GLUTmouseCB mouseFunc) +{ + if (__glutCurrentWindow->mouse) { + if (!mouseFunc) { + /* Previous mouseFunc being disabled. */ + __glutCurrentWindow->buttonUses--; + __glutChangeWindowEventMask( + ButtonPressMask | ButtonReleaseMask, + __glutCurrentWindow->buttonUses > 0); + } + } else { + if (mouseFunc) { + /* Previously no mouseFunc, new one being installed. */ + __glutCurrentWindow->buttonUses++; + __glutChangeWindowEventMask( + ButtonPressMask | ButtonReleaseMask, True); + } + } + __glutCurrentWindow->mouse = mouseFunc; +} + +void APIENTRY +glutMotionFunc(GLUTmotionCB motionFunc) +{ + /* Hack. Some window managers (4Dwm by default) will mask + motion events if the client is not selecting for button + press and release events. So we select for press and + release events too (being careful to use reference + counting). */ + if (__glutCurrentWindow->motion) { + if (!motionFunc) { + /* previous mouseFunc being disabled */ + __glutCurrentWindow->buttonUses--; + __glutChangeWindowEventMask( + ButtonPressMask | ButtonReleaseMask, + __glutCurrentWindow->buttonUses > 0); + } + } else { + if (motionFunc) { + /* Previously no mouseFunc, new one being installed. */ + __glutCurrentWindow->buttonUses++; + __glutChangeWindowEventMask( + ButtonPressMask | ButtonReleaseMask, True); + } + } + /* Real work of selecting for passive mouse motion. */ + __glutChangeWindowEventMask( + Button1MotionMask | Button2MotionMask | Button3MotionMask, + motionFunc != NULL); + __glutCurrentWindow->motion = motionFunc; +} + +void APIENTRY +glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc) +{ + __glutChangeWindowEventMask(PointerMotionMask, + passiveMotionFunc != NULL); + + /* Passive motion also requires watching enters and leaves so + that a fake passive motion event can be generated on an + enter. */ + __glutChangeWindowEventMask(EnterWindowMask | LeaveWindowMask, + __glutCurrentWindow->entry != NULL || passiveMotionFunc != NULL); + + __glutCurrentWindow->passive = passiveMotionFunc; +} + +void APIENTRY +glutEntryFunc(GLUTentryCB entryFunc) +{ + __glutChangeWindowEventMask(EnterWindowMask | LeaveWindowMask, + entryFunc != NULL || __glutCurrentWindow->passive); + __glutCurrentWindow->entry = entryFunc; + if (!entryFunc) { + __glutCurrentWindow->entryState = -1; + } +} + +void APIENTRY +glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc) +{ + __glutChangeWindowEventMask(VisibilityChangeMask, + windowStatusFunc != NULL); + __glutCurrentWindow->windowStatus = windowStatusFunc; + if (!windowStatusFunc) { + /* Make state invalid. */ + __glutCurrentWindow->visState = -1; + } +} + +static void GLUTCALLBACK +visibilityHelper(int status) +{ + if (status == GLUT_HIDDEN || status == GLUT_FULLY_COVERED) + __glutCurrentWindow->visibility(GLUT_NOT_VISIBLE); + else + __glutCurrentWindow->visibility(GLUT_VISIBLE); +} + +void APIENTRY +glutVisibilityFunc(GLUTvisibilityCB visibilityFunc) +{ + __glutCurrentWindow->visibility = visibilityFunc; + if (visibilityFunc) + glutWindowStatusFunc(visibilityHelper); + else + glutWindowStatusFunc(NULL); +} + +void APIENTRY +glutReshapeFunc(GLUTreshapeCB reshapeFunc) +{ + if (reshapeFunc) { + __glutCurrentWindow->reshape = reshapeFunc; + } else { + __glutCurrentWindow->reshape = __glutDefaultReshape; + } +} diff --git a/xc/extras/Mesa/src-glut/glut_winmisc.c b/xc/extras/Mesa/src-glut/glut_winmisc.c new file mode 100644 index 000000000..5a9d199a5 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glut_winmisc.c @@ -0,0 +1,120 @@ + +/* 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 <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> /* for XA_STRING atom */ +#endif + +#include "glutint.h" + +/* CENTRY */ +void APIENTRY +glutSetWindowTitle(const char *title) +{ + XTextProperty textprop; + + assert(!__glutCurrentWindow->parent); + IGNORE_IN_GAME_MODE(); + textprop.value = (unsigned char *) title; + textprop.encoding = XA_STRING; + textprop.format = 8; + textprop.nitems = strlen(title); + XSetWMName(__glutDisplay, + __glutCurrentWindow->win, &textprop); + XFlush(__glutDisplay); +} + +void APIENTRY +glutSetIconTitle(const char *title) +{ + XTextProperty textprop; + + assert(!__glutCurrentWindow->parent); + IGNORE_IN_GAME_MODE(); + textprop.value = (unsigned char *) title; + textprop.encoding = XA_STRING; + textprop.format = 8; + textprop.nitems = strlen(title); + XSetWMIconName(__glutDisplay, + __glutCurrentWindow->win, &textprop); + XFlush(__glutDisplay); +} + +void APIENTRY +glutPositionWindow(int x, int y) +{ + IGNORE_IN_GAME_MODE(); + __glutCurrentWindow->desiredX = x; + __glutCurrentWindow->desiredY = y; + __glutCurrentWindow->desiredConfMask |= CWX | CWY; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); +} + +void APIENTRY +glutReshapeWindow(int w, int h) +{ + IGNORE_IN_GAME_MODE(); + if (w <= 0 || h <= 0) + __glutWarning("glutReshapeWindow: non-positive width or height not allowed"); + + __glutCurrentWindow->desiredWidth = w; + __glutCurrentWindow->desiredHeight = h; + __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); +} + +void APIENTRY +glutPopWindow(void) +{ + IGNORE_IN_GAME_MODE(); + __glutCurrentWindow->desiredStack = Above; + __glutCurrentWindow->desiredConfMask |= CWStackMode; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); +} + +void APIENTRY +glutPushWindow(void) +{ + IGNORE_IN_GAME_MODE(); + __glutCurrentWindow->desiredStack = Below; + __glutCurrentWindow->desiredConfMask |= CWStackMode; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); +} + +void APIENTRY +glutIconifyWindow(void) +{ + IGNORE_IN_GAME_MODE(); + assert(!__glutCurrentWindow->parent); + __glutCurrentWindow->desiredMapState = IconicState; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); +} + +void APIENTRY +glutShowWindow(void) +{ + IGNORE_IN_GAME_MODE(); + __glutCurrentWindow->desiredMapState = NormalState; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); +} + +void APIENTRY +glutHideWindow(void) +{ + IGNORE_IN_GAME_MODE(); + __glutCurrentWindow->desiredMapState = WithdrawnState; + __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); +} + +/* ENDCENTRY */ diff --git a/xc/extras/Mesa/src-glut/glutbitmap.h b/xc/extras/Mesa/src-glut/glutbitmap.h new file mode 100644 index 000000000..9584bb129 --- /dev/null +++ b/xc/extras/Mesa/src-glut/glutbitmap.h @@ -0,0 +1,32 @@ +#ifndef __glutbitmap_h__ +#define __glutbitmap_h__ + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* 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. */ + +#define GLUT_NO_LIB_PRAGMA /* Avoid auto library linking when building + the GLUT library itself. */ +#include <GL/glut.h> + +typedef struct { + const GLsizei width; + const GLsizei height; + const GLfloat xorig; + const GLfloat yorig; + const GLfloat advance; + const GLubyte *bitmap; +} BitmapCharRec, *BitmapCharPtr; + +typedef struct { + const char *name; + const int num_chars; + const int first; + const BitmapCharRec * const *ch; +} BitmapFontRec, *BitmapFontPtr; + +typedef void *GLUTbitmapFont; + +#endif /* __glutbitmap_h__ */ diff --git a/xc/extras/Mesa/src-glut/glutint.h b/xc/extras/Mesa/src-glut/glutint.h new file mode 100644 index 000000000..71dceecee --- /dev/null +++ b/xc/extras/Mesa/src-glut/glutint.h @@ -0,0 +1,768 @@ +#ifndef __glutint_h__ +#define __glutint_h__ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ + +/* 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. */ + +#if defined(__CYGWIN32__) +#include <sys/time.h> +#endif + +#define SUPPORT_FORTRAN /* With GLUT 3.7, everyone supports Fortran. */ + +#if defined(_WIN32) +#include "glutwin32.h" +#else +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <GL/glx.h> +#endif + +#define GLUT_BUILDING_LIB /* Building the GLUT library itself. */ +#include <GL/glut.h> + +#if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__) +#include <gl/mesa_wgl.h> +#endif + +#ifndef _WIN32 +/* added by BrianP: */ +#ifndef APIENTRY +#define APIENTRY GLAPIENTRY +#endif +#define __cdecl GLAPIENTRY +#define CDECL GLAPIENTRY +#endif + +/* GLUT_BUILDING_LIB is used by <GL/glut.h> to 1) not #pragma link + with the GLUT library, and 2) avoid the Win32 atexit hack. */ + +/* This must be done after <GL/gl.h> is included. MESA is defined + if the <GL/gl.h> is supplied by Brian Paul's Mesa library. */ +#if defined(MESA) && defined(_WIN32) +/* Mesa implements "wgl" versions of GDI entry points needed for + using OpenGL. Map these "wgl" versions to the GDI names via + macros. */ +#define ChoosePixelFormat wglChoosePixelFormat +#define DescribePixelFormat wglDescribePixelFormat +#define GetPixelFormat wglGetPixelFormat +#define SetPixelFormat wglSetPixelFormat +#define SwapBuffers wglSwapBuffers +#define GetCurrentContext wglGetCurrentContext +#define GetCurrentDC wglGetCurrentDC +#define MakeCurrent wglMakeCurrent +#define CreateContext wglCreateContext +#define DeleteContext wglDeleteContext +#endif /* MESA */ + +#ifdef SUPPORT_FORTRAN +#include <GL/glutf90.h> +#endif + +#ifdef __vms +#if ( __VMS_VER < 70000000 ) +struct timeval { + __int64 val; +}; +extern int sys$gettim(struct timeval *); +#else +#include <time.h> +#endif +#else +#include <sys/types.h> +#if !defined(_WIN32) || defined(__CYGWIN32__) +#include <sys/time.h> +#else +#include <winsock.h> +#endif +#endif +#if defined(__vms) && ( __VMS_VER < 70000000 ) + +/* For VMS6.2 or lower : + One TICK on VMS is 100 nanoseconds; 0.1 microseconds or + 0.0001 milliseconds. This means that there are 0.01 + ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000 + ticks/second. */ + +#define TICKS_PER_MILLISECOND 10000 +#define TICKS_PER_SECOND 10000000 + +#define GETTIMEOFDAY(_x) (void) sys$gettim (_x); + +#define ADD_TIME(dest, src1, src2) { \ + (dest).val = (src1).val + (src2).val; \ +} + +#define TIMEDELTA(dest, src1, src2) { \ + (dest).val = (src1).val - (src2).val; \ +} + +#define IS_AFTER(t1, t2) ((t2).val > (t1).val) + +#define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val) + +#else +#if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but + wants 2 args. */ +#define GETTIMEOFDAY(_x) gettimeofday(_x) +#else +#define GETTIMEOFDAY(_x) gettimeofday(_x, NULL) +#endif +#define ADD_TIME(dest, src1, src2) { \ + if(((dest).tv_usec = \ + (src1).tv_usec + (src2).tv_usec) >= 1000000) { \ + (dest).tv_usec -= 1000000; \ + (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \ + } else { \ + (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \ + if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \ + (dest).tv_sec --;(dest).tv_usec += 1000000; \ + } \ + } \ +} +#define TIMEDELTA(dest, src1, src2) { \ + if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \ + (dest).tv_usec += 1000000; \ + (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \ + } else { \ + (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \ + } \ +} +#define IS_AFTER(t1, t2) \ + (((t2).tv_sec > (t1).tv_sec) || \ + (((t2).tv_sec == (t1).tv_sec) && \ + ((t2).tv_usec > (t1).tv_usec))) +#define IS_AT_OR_AFTER(t1, t2) \ + (((t2).tv_sec > (t1).tv_sec) || \ + (((t2).tv_sec == (t1).tv_sec) && \ + ((t2).tv_usec >= (t1).tv_usec))) +#endif + +#define IGNORE_IN_GAME_MODE() \ + { if (__glutGameModeWindow) return; } + +#define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0) +#define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0) +#define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0) +#define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0) +#define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0) +#define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0) +#define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0) +#define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0) +#define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0) +#define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0) +#define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0) +#define GLUT_MAP_WORK (1 << 0) +#define GLUT_EVENT_MASK_WORK (1 << 1) +#define GLUT_REDISPLAY_WORK (1 << 2) +#define GLUT_CONFIGURE_WORK (1 << 3) +#define GLUT_COLORMAP_WORK (1 << 4) +#define GLUT_DEVICE_MASK_WORK (1 << 5) +#define GLUT_FINISH_WORK (1 << 6) +#define GLUT_DEBUG_WORK (1 << 7) +#define GLUT_DUMMY_WORK (1 << 8) +#define GLUT_FULL_SCREEN_WORK (1 << 9) +#define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10) +#define GLUT_REPAIR_WORK (1 << 11) +#define GLUT_OVERLAY_REPAIR_WORK (1 << 12) + +/* Frame buffer capability macros and types. */ +#define RGBA 0 +#define BUFFER_SIZE 1 +#define DOUBLEBUFFER 2 +#define STEREO 3 +#define AUX_BUFFERS 4 +#define RED_SIZE 5 /* Used as mask bit for + "color selected". */ +#define GREEN_SIZE 6 +#define BLUE_SIZE 7 +#define ALPHA_SIZE 8 +#define DEPTH_SIZE 9 +#define STENCIL_SIZE 10 +#define ACCUM_RED_SIZE 11 /* Used as mask bit for + "acc selected". */ +#define ACCUM_GREEN_SIZE 12 +#define ACCUM_BLUE_SIZE 13 +#define ACCUM_ALPHA_SIZE 14 +#define LEVEL 15 + +#define NUM_GLXCAPS (LEVEL + 1) + +#define XVISUAL (NUM_GLXCAPS + 0) +#define TRANSPARENT (NUM_GLXCAPS + 1) +#define SAMPLES (NUM_GLXCAPS + 2) +#define XSTATICGRAY (NUM_GLXCAPS + 3) /* Used as + mask bit + for "any + visual type + selected". */ +#define XGRAYSCALE (NUM_GLXCAPS + 4) +#define XSTATICCOLOR (NUM_GLXCAPS + 5) +#define XPSEUDOCOLOR (NUM_GLXCAPS + 6) +#define XTRUECOLOR (NUM_GLXCAPS + 7) +#define XDIRECTCOLOR (NUM_GLXCAPS + 8) +#define SLOW (NUM_GLXCAPS + 9) +#define CONFORMANT (NUM_GLXCAPS + 10) + +#define NUM_CAPS (NUM_GLXCAPS + 11) + +/* Frame buffer capablities that don't have a corresponding + FrameBufferMode entry. These get used as mask bits. */ +#define NUM (NUM_CAPS + 0) +#define RGBA_MODE (NUM_CAPS + 1) +#define CI_MODE (NUM_CAPS + 2) +#define LUMINANCE_MODE (NUM_CAPS + 3) + +#define NONE 0 +#define EQ 1 +#define NEQ 2 +#define LTE 3 +#define GTE 4 +#define GT 5 +#define LT 6 +#define MIN 7 + +typedef struct _Criterion { + int capability; + int comparison; + int value; +} Criterion; + +typedef struct _FrameBufferMode { + XVisualInfo *vi; +#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) + + /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable + (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows + the visual's fbconfig is OpenGL-capable. The reason for this is typically + an RGBA luminance fbconfig such as 16-bit StaticGray that could + not be advertised as a GLX visual since StaticGray visuals are + required (by the GLX specification) to be color index. The + SGIX_fbconfig allows StaticGray visuals to instead advertised as + fbconfigs that can provide RGBA luminance support. */ + + GLXFBConfigSGIX fbc; +#endif + int valid; + int cap[NUM_CAPS]; +} FrameBufferMode; + +/* DisplayMode capability macros for game mode. */ +#define DM_WIDTH 0 /* "width" */ +#define DM_HEIGHT 1 /* "height" */ +#define DM_PIXEL_DEPTH 2 /* "bpp" (bits per pixel) */ +#define DM_HERTZ 3 /* "hertz" */ +#define DM_NUM 4 /* "num" */ + +#define NUM_DM_CAPS (DM_NUM+1) + +typedef struct _DisplayMode { +#ifdef _WIN32 + DEVMODE devmode; +#else + /* XXX The X Window System does not have a standard + mechanism for display setting changes. On SGI + systems, GLUT could use the XSGIvc (SGI X video + control extension). Perhaps this can be done in + a future release of GLUT. */ +#endif + int valid; + int cap[NUM_DM_CAPS]; +} DisplayMode; + +/* 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); /* DEPRICATED. */ +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 buttonMask, int x, int y, int z); + +typedef struct _GLUTcolorcell GLUTcolorcell; +struct _GLUTcolorcell { + /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */ + GLfloat component[3]; +}; + +typedef struct _GLUTcolormap GLUTcolormap; +struct _GLUTcolormap { + Visual *visual; /* visual of the colormap */ + Colormap cmap; /* X colormap ID */ + int refcnt; /* number of windows using colormap */ + int size; /* number of cells in colormap */ + int transparent; /* transparent pixel, or -1 if opaque */ + GLUTcolorcell *cells; /* array of cells */ + GLUTcolormap *next; /* next colormap in list */ +}; + +typedef struct _GLUTwindow GLUTwindow; +typedef struct _GLUToverlay GLUToverlay; +struct _GLUTwindow { + int num; /* Small integer window id (0-based). */ + + /* Window system related state. */ +#if defined(_WIN32) + int pf; /* Pixel format. */ + HDC hdc; /* Window's Win32 device context. */ +#endif + Window win; /* X window for GLUT window */ + GLXContext ctx; /* OpenGL context GLUT glut window */ + XVisualInfo *vis; /* visual for window */ + Bool visAlloced; /* if vis needs deallocate on destroy */ + Colormap cmap; /* RGB colormap for window; None if CI */ + GLUTcolormap *colormap; /* colormap; NULL if RGBA */ + GLUToverlay *overlay; /* overlay; NULL if no overlay */ +#if defined(_WIN32) + HDC renderDc; /* Win32's device context for rendering. */ +#endif + Window renderWin; /* X window for rendering (might be + overlay) */ + GLXContext renderCtx; /* OpenGL context for rendering (might + be overlay) */ + /* GLUT settable or visible window state. */ + int width; /* window width in pixels */ + int height; /* window height in pixels */ + int cursor; /* cursor name */ + int visState; /* visibility state (-1 is unknown) */ + int shownState; /* if window mapped */ + int entryState; /* entry state (-1 is unknown) */ +#define GLUT_MAX_MENUS 3 + + int menu[GLUT_MAX_MENUS]; /* attatched menu nums */ + /* Window relationship state. */ + GLUTwindow *parent; /* parent window */ + GLUTwindow *children; /* list of children */ + GLUTwindow *siblings; /* list of siblings */ + /* Misc. non-API visible (hidden) state. */ + Bool treatAsSingle; /* treat this window as single-buffered + (it might be "fake" though) */ + Bool forceReshape; /* force reshape before display */ +#if !defined(_WIN32) + Bool isDirect; /* if direct context (X11 only) */ +#endif + Bool usedSwapBuffers; /* if swap buffers used last display */ + long eventMask; /* mask of X events selected for */ + int buttonUses; /* number of button uses, ref cnt */ + int tabletPos[2]; /* tablet position (-1 is invalid) */ + /* Work list related state. */ + unsigned int workMask; /* mask of window work to be done */ + GLUTwindow *prevWorkWin; /* link list of windows to work on */ + Bool desiredMapState; /* how to mapped window if on map work + list */ + Bool ignoreKeyRepeat; /* if window ignores autorepeat */ + int desiredConfMask; /* mask of desired window configuration + */ + int desiredX; /* desired X location */ + int desiredY; /* desired Y location */ + int desiredWidth; /* desired window width */ + int desiredHeight; /* desired window height */ + int desiredStack; /* desired window stack */ + /* 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 */ +#ifdef _WIN32 + GLUTjoystickCB joystick; /* joystick */ + int joyPollInterval; /* joystick polling interval */ +#endif +#ifdef SUPPORT_FORTRAN + GLUTdisplayFCB fdisplay; /* Fortran display */ + GLUTreshapeFCB freshape; /* Fortran reshape */ + GLUTmouseFCB fmouse; /* Fortran mouse */ + GLUTmotionFCB fmotion; /* Fortran motion */ + GLUTpassiveFCB fpassive; /* Fortran passive */ + GLUTentryFCB fentry; /* Fortran entry */ + GLUTkeyboardFCB fkeyboard; /* Fortran keyboard */ + GLUTkeyboardFCB fkeyboardUp; /* Fortran keyboard up */ + GLUTwindowStatusFCB fwindowStatus; /* Fortran window status */ + GLUTvisibilityFCB fvisibility; /* Fortran visibility */ + GLUTspecialFCB fspecial; /* special key */ + GLUTspecialFCB fspecialUp; /* special key up */ + GLUTbuttonBoxFCB fbuttonBox; /* button box */ + GLUTdialsFCB fdials; /* dials */ + GLUTspaceMotionFCB fspaceMotion; /* Spaceball motion */ + GLUTspaceRotateFCB fspaceRotate; /* Spaceball rotate */ + GLUTspaceButtonFCB fspaceButton; /* Spaceball button */ + GLUTtabletMotionFCB ftabletMotion; /* tablet motion */ + GLUTtabletButtonFCB ftabletButton; /* tablet button */ +#ifdef _WIN32 + GLUTjoystickFCB fjoystick; /* joystick */ +#endif +#endif +}; + +struct _GLUToverlay { +#if defined(_WIN32) + int pf; + HDC hdc; +#endif + Window win; + GLXContext ctx; + XVisualInfo *vis; /* visual for window */ + Bool visAlloced; /* if vis needs deallocate on destroy */ + Colormap cmap; /* RGB colormap for window; None if CI */ + GLUTcolormap *colormap; /* colormap; NULL if RGBA */ + int shownState; /* if overlay window mapped */ + Bool treatAsSingle; /* treat as single-buffered */ +#if !defined(_WIN32) + Bool isDirect; /* if direct context */ +#endif + int transparentPixel; /* transparent pixel value */ + GLUTdisplayCB display; /* redraw */ +#ifdef SUPPORT_FORTRAN + GLUTdisplayFCB fdisplay; /* redraw */ +#endif +}; + +typedef struct _GLUTstale GLUTstale; +struct _GLUTstale { + GLUTwindow *window; + Window win; + GLUTstale *next; +}; + +extern GLUTstale *__glutStaleWindowList; + +#define GLUT_OVERLAY_EVENT_FILTER_MASK \ + (ExposureMask | \ + StructureNotifyMask | \ + EnterWindowMask | \ + LeaveWindowMask) +#define GLUT_DONT_PROPAGATE_FILTER_MASK \ + (ButtonReleaseMask | \ + ButtonPressMask | \ + KeyPressMask | \ + KeyReleaseMask | \ + PointerMotionMask | \ + Button1MotionMask | \ + Button2MotionMask | \ + Button3MotionMask) +#define GLUT_HACK_STOP_PROPAGATE_MASK \ + (KeyPressMask | \ + KeyReleaseMask) + +typedef struct _GLUTmenu GLUTmenu; +typedef struct _GLUTmenuItem GLUTmenuItem; +struct _GLUTmenu { + int id; /* small integer menu id (0-based) */ + Window win; /* X window for the menu */ + GLUTselectCB select; /* function of menu */ + GLUTmenuItem *list; /* list of menu entries */ + int num; /* number of entries */ +#if !defined(_WIN32) + Bool managed; /* are the InputOnly windows size + validated? */ + Bool searched; /* help detect menu loops */ + int pixheight; /* height of menu in pixels */ + int pixwidth; /* width of menu in pixels */ +#endif + int submenus; /* number of submenu entries */ + GLUTmenuItem *highlighted; /* pointer to highlighted menu + entry, NULL not highlighted */ + GLUTmenu *cascade; /* currently cascading this menu */ + GLUTmenuItem *anchor; /* currently anchored to this entry */ + int x; /* current x origin relative to the + root window */ + int y; /* current y origin relative to the + root window */ +#ifdef SUPPORT_FORTRAN + GLUTselectFCB fselect; /* function of menu */ +#endif +}; + +struct _GLUTmenuItem { + Window win; /* InputOnly X window for entry */ + GLUTmenu *menu; /* menu entry belongs to */ + Bool isTrigger; /* is a submenu trigger? */ + int value; /* value to return for selecting this + entry; doubles as submenu id + (0-base) if submenu trigger */ +#if defined(_WIN32) + UINT unique; /* unique menu item id (Win32 only) */ +#endif + char *label; /* __glutStrdup'ed label string */ + int len; /* length of label string */ + int pixwidth; /* width of X window in pixels */ + GLUTmenuItem *next; /* next menu entry on list for menu */ +}; + +typedef struct _GLUTtimer GLUTtimer; +struct _GLUTtimer { + GLUTtimer *next; /* list of timers */ + struct timeval timeout; /* time to be called */ + GLUTtimerCB func; /* timer (value) */ + int value; /* return value */ +#ifdef SUPPORT_FORTRAN + GLUTtimerFCB ffunc; /* Fortran timer */ +#endif +}; + +typedef struct _GLUTeventParser GLUTeventParser; +struct _GLUTeventParser { + int (*func) (XEvent *); + GLUTeventParser *next; +}; + +/* Declarations to implement glutFullScreen support with + mwm/4Dwm. */ + +/* The following X property format is defined in Motif 1.1's + Xm/MwmUtils.h, but GLUT should not depend on that header + file. Note: Motif 1.2 expanded this structure with + uninteresting fields (to GLUT) so just stick with the + smaller Motif 1.1 structure. */ +typedef struct { +#define MWM_HINTS_DECORATIONS 2 + long flags; + long functions; + long decorations; + long input_mode; +} MotifWmHints; + +/* Make current and buffer swap macros. */ +#ifdef _WIN32 +#define MAKE_CURRENT_LAYER(window) \ + { \ + HGLRC currentContext = GetCurrentContext(); \ + HDC currentDc = GetCurrentDC(); \ + \ + if (currentContext != window->renderCtx \ + || currentDc != window->renderDc) { \ + MakeCurrent(window->renderDc, window->renderCtx); \ + } \ + } +#define MAKE_CURRENT_WINDOW(window) \ + { \ + HGLRC currentContext = GetCurrentContext(); \ + HDC currentDc = GetCurrentDC(); \ + \ + if (currentContext != window->ctx || currentDc != window->hdc) { \ + MakeCurrent(window->hdc, window->ctx); \ + } \ + } +#define MAKE_CURRENT_OVERLAY(overlay) \ + MakeCurrent(overlay->hdc, overlay->ctx) +#define UNMAKE_CURRENT() \ + MakeCurrent(NULL, NULL) +#define SWAP_BUFFERS_WINDOW(window) \ + SwapBuffers(window->hdc) +#define SWAP_BUFFERS_LAYER(window) \ + SwapBuffers(window->renderDc) +#else +#define MAKE_CURRENT_LAYER(window) \ + glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx) +#define MAKE_CURRENT_WINDOW(window) \ + glXMakeCurrent(__glutDisplay, window->win, window->ctx) +#define MAKE_CURRENT_OVERLAY(overlay) \ + glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx) +#define UNMAKE_CURRENT() \ + glXMakeCurrent(__glutDisplay, None, NULL) +#define SWAP_BUFFERS_WINDOW(window) \ + glXSwapBuffers(__glutDisplay, window->win) +#define SWAP_BUFFERS_LAYER(window) \ + glXSwapBuffers(__glutDisplay, window->renderWin) +#endif + +/* private variables from glut_event.c */ +extern GLUTwindow *__glutWindowWorkList; +extern int __glutWindowDamaged; +#ifdef SUPPORT_FORTRAN +extern GLUTtimer *__glutTimerList; +extern GLUTtimer *__glutNewTimer; +#endif +extern GLUTmenu *__glutMappedMenu; + +extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *); +#if !defined(_WIN32) +extern void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item, + int num, int type); +extern void (*__glutFinishMenu)(Window win, int x, int y); +extern void (*__glutPaintMenu)(GLUTmenu * menu); +extern void (*__glutStartMenu)(GLUTmenu * menu, + GLUTwindow * window, int x, int y, int x_win, int y_win); +extern GLUTmenu * (*__glutGetMenuByNum)(int menunum); +extern GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu, + Window win, int *which); +extern GLUTmenu * (*__glutGetMenu)(Window win); +#endif + +/* private variables from glut_init.c */ +extern Atom __glutWMDeleteWindow; +extern Display *__glutDisplay; +extern unsigned int __glutDisplayMode; +extern char *__glutDisplayString; +extern XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle, + Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc); +extern GLboolean __glutDebug; +extern GLboolean __glutForceDirect; +extern GLboolean __glutIconic; +extern GLboolean __glutTryDirect; +extern Window __glutRoot; +extern XSizeHints __glutSizeHints; +extern char **__glutArgv; +extern char *__glutProgramName; +extern int __glutArgc; +extern int __glutConnectionFD; +extern int __glutInitHeight; +extern int __glutInitWidth; +extern int __glutInitX; +extern int __glutInitY; +extern int __glutScreen; +extern int __glutScreenHeight; +extern int __glutScreenWidth; +extern Atom __glutMotifHints; +extern unsigned int __glutModifierMask; +#ifdef _WIN32 +extern void (__cdecl *__glutExitFunc)(int retval); +#endif + +/* private variables from glut_menu.c */ +extern GLUTmenuItem *__glutItemSelected; +extern GLUTmenu **__glutMenuList; +extern void (GLUTCALLBACK *__glutMenuStatusFunc) (int, int, int); +extern void __glutMenuModificationError(void); +extern void __glutSetMenuItem(GLUTmenuItem * item, + const char *label, int value, Bool isTrigger); + +/* private variables from glut_win.c */ +extern GLUTwindow **__glutWindowList; +extern GLUTwindow *__glutCurrentWindow; +extern GLUTwindow *__glutMenuWindow; +extern GLUTmenu *__glutCurrentMenu; +extern int __glutWindowListSize; +extern void (*__glutFreeOverlayFunc) (GLUToverlay *); +extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle, + Bool * visAlloced, void **fbc); + +/* private variables from glut_mesa.c */ +extern int __glutMesaSwapHackSupport; + +/* private variables from glut_gamemode.c */ +extern GLUTwindow *__glutGameModeWindow; + +/* private routines from glut_cindex.c */ +extern GLUTcolormap * __glutAssociateNewColormap(XVisualInfo * vis); +extern void __glutFreeColormap(GLUTcolormap *); + +/* private routines from glut_cmap.c */ +extern void __glutSetupColormap( + XVisualInfo * vi, + GLUTcolormap ** colormap, + Colormap * cmap); +#if !defined(_WIN32) +extern void __glutEstablishColormapsProperty( + GLUTwindow * window); +extern GLUTwindow *__glutToplevelOf(GLUTwindow * window); +#endif + +/* private routines from glut_cursor.c */ +extern void __glutSetCursor(GLUTwindow *window); + +/* private routines from glut_event.c */ +extern void __glutPutOnWorkList(GLUTwindow * window, + int work_mask); +extern void __glutRegisterEventParser(GLUTeventParser * parser); +extern void __glutPostRedisplay(GLUTwindow * window, int layerMask); + +/* private routines from glut_init.c */ +#if !defined(_WIN32) +extern void __glutOpenXConnection(char *display); +#else +extern void __glutOpenWin32Connection(char *display); +#endif +extern void __glutInitTime(struct timeval *beginning); + +/* private routines for glut_menu.c (or win32_menu.c) */ +#if defined(_WIN32) +extern GLUTmenu *__glutGetMenu(Window win); +extern GLUTmenu *__glutGetMenuByNum(int menunum); +extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu, + Window win, int *which); +extern void __glutStartMenu(GLUTmenu * menu, + GLUTwindow * window, int x, int y, int x_win, int y_win); +extern void __glutFinishMenu(Window win, int x, int y); +#endif +extern void __glutSetMenu(GLUTmenu * menu); + +/* 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,...); + +/* private routines from glut_win.c */ +extern GLUTwindow *__glutGetWindow(Window win); +extern void __glutChangeWindowEventMask(long mask, Bool add); +extern XVisualInfo *__glutDetermineVisual( + unsigned int mode, + Bool * fakeSingle, + XVisualInfo * (getVisualInfo) (unsigned int)); +extern XVisualInfo *__glutGetVisualInfo(unsigned int mode); +extern void __glutSetWindow(GLUTwindow * window); +extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc, + int callingConvention); +extern void GLUTCALLBACK __glutDefaultReshape(int, int); +extern GLUTwindow *__glutCreateWindow( + GLUTwindow * parent, + int x, int y, int width, int height, int gamemode); +extern void __glutDestroyWindow( + GLUTwindow * window, + GLUTwindow * initialWindow); + +#if !defined(_WIN32) +/* private routines from glut_glxext.c */ +extern int __glutIsSupportedByGLX(char *); +#endif + +/* private routines from glut_input.c */ +extern void __glutUpdateInputDeviceMask(GLUTwindow * window); + +/* private routines from glut_mesa.c */ +extern void __glutDetermineMesaSwapHackSupport(void); + +/* private routines from glut_gameglut.c */ +extern void GLUTAPIENTRYV __glutCloseDownGameMode(void); + +#if defined(_WIN32) +/* private routines from win32_*.c */ +extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l); +extern HDC XHDC; +#endif + +#endif /* __glutint_h__ */ diff --git a/xc/extras/Mesa/src-glut/glutstroke.h b/xc/extras/Mesa/src-glut/glutstroke.h new file mode 100644 index 000000000..cbc9e156f --- /dev/null +++ b/xc/extras/Mesa/src-glut/glutstroke.h @@ -0,0 +1,42 @@ +#ifndef __glutstroke_h__ +#define __glutstroke_h__ + +/* 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. */ + +#if defined(_WIN32) +#pragma warning (disable:4244) /* disable bogus conversion warnings */ +#pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ +#endif + +typedef struct { + float x; + float y; +} CoordRec, *CoordPtr; + +typedef struct { + int num_coords; + const CoordRec *coord; +} StrokeRec, *StrokePtr; + +typedef struct { + int num_strokes; + const StrokeRec *stroke; + float center; + float right; +} StrokeCharRec, *StrokeCharPtr; + +typedef struct { + const char *name; + int num_chars; + const StrokeCharRec *ch; + float top; + float bottom; +} StrokeFontRec, *StrokeFontPtr; + +typedef void *GLUTstrokeFont; + +#endif /* __glutstroke_h__ */ diff --git a/xc/extras/Mesa/src-glut/glutwin32.h b/xc/extras/Mesa/src-glut/glutwin32.h new file mode 100644 index 000000000..304eeb20a --- /dev/null +++ b/xc/extras/Mesa/src-glut/glutwin32.h @@ -0,0 +1,96 @@ +#ifndef __glutwin32_h__ +#define __glutwin32_h__ + +/* Copyright (c) Nate Robins, 1997. */ + +/* 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 "win32_x11.h" +#include "win32_glx.h" + +/* We have to undef some things because Microsoft likes to pollute the + global namespace. */ +#undef TRANSPARENT + +/* Win32 "equivalent" cursors - eventually, the X glyphs should be + converted to Win32 cursors -- then they will look the same */ +#define XC_arrow IDC_ARROW +#define XC_top_left_arrow IDC_ARROW +#define XC_hand1 IDC_SIZEALL +#define XC_pirate IDC_NO +#define XC_question_arrow IDC_HELP +#define XC_exchange IDC_NO +#define XC_spraycan IDC_SIZEALL +#define XC_watch IDC_WAIT +#define XC_xterm IDC_IBEAM +#define XC_crosshair IDC_CROSS +#define XC_sb_v_double_arrow IDC_SIZENS +#define XC_sb_h_double_arrow IDC_SIZEWE +#define XC_top_side IDC_UPARROW +#define XC_bottom_side IDC_SIZENS +#define XC_left_side IDC_SIZEWE +#define XC_right_side IDC_SIZEWE +#define XC_top_left_corner IDC_SIZENWSE +#define XC_top_right_corner IDC_SIZENESW +#define XC_bottom_right_corner IDC_SIZENWSE +#define XC_bottom_left_corner IDC_SIZENESW + +#define XA_STRING 0 + +/* Private routines from win32_util.c */ +#ifndef __CYGWIN32__ +extern int gettimeofday(struct timeval* tp, void* tzp); +#endif +extern void *__glutFont(void *font); +extern int __glutGetTransparentPixel(Display *dpy, XVisualInfo *vinfo); +extern void __glutAdjustCoords(Window parent, int *x, int *y, int *width, int *height); + + +/* Cygwin B20.1 misses the following definitions */ +#ifdef __CYGWIN32__ + +/* from winuser.h */ +#define CDS_FULLSCREEN 4 + +/* from mmsystem.h */ +#define WINMMAPI __declspec(dllimport) +typedef UINT MMRESULT; + +#define MM_JOY1MOVE 0x3A0 +#define MM_JOY1ZMOVE 0x3A2 +#define MM_JOY1BUTTONDOWN 0x3B5 +#define MM_JOY1BUTTONUP 0x3B7 + +#define JOYERR_NOERROR 0 +#define JOYERR_PARMS 165 + +#define JOY_RETURNALL 0x000000ffl + +#define JOYSTICKID1 0 + +typedef struct joyinfoex_tag { + DWORD dwSize; /* size of structure */ + DWORD dwFlags; /* flags to indicate what to return */ + DWORD dwXpos; /* x position */ + DWORD dwYpos; /* y position */ + DWORD dwZpos; /* z position */ + DWORD dwRpos; /* rudder/4th axis position */ + DWORD dwUpos; /* 5th axis position */ + DWORD dwVpos; /* 6th axis position */ + DWORD dwButtons; /* button states */ + DWORD dwButtonNumber; /* current button number pressed */ + DWORD dwPOV; /* point of view state */ + DWORD dwReserved1; /* reserved for communication between winmm & driver */ + DWORD dwReserved2; /* reserved for future expansion */ +} JOYINFOEX, *PJOYINFOEX, /* NEAR */ *NPJOYINFOEX, /* FAR */ *LPJOYINFOEX; + +WINMMAPI MMRESULT WINAPI joyGetPosEx( UINT uJoyID, LPJOYINFOEX pji); +WINMMAPI MMRESULT WINAPI joyReleaseCapture( UINT uJoyID); +WINMMAPI MMRESULT WINAPI joySetCapture( HWND hwnd, UINT uJoyID, UINT uPeriod, BOOL fChanged); +WINMMAPI MMRESULT WINAPI joySetThreshold( UINT uJoyID, UINT uThreshold); + +#endif + +#endif /* __glutwin32_h__ */ diff --git a/xc/extras/Mesa/src-glut/layerutil.c b/xc/extras/Mesa/src-glut/layerutil.c new file mode 100644 index 000000000..26ba0b602 --- /dev/null +++ b/xc/extras/Mesa/src-glut/layerutil.c @@ -0,0 +1,204 @@ + +/* Copyright (c) Mark J. Kilgard, 1993, 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. */ + +/* Based on XLayerUtil.c: Revision: 1.5 */ + +#include <stdio.h> +#include <stdlib.h> +#include "layerutil.h" + +/* SGI optimization introduced in IRIX 6.3 to avoid X server + round trips for interning common X atoms. */ +#include <X11/Xatom.h> +#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) +#include <X11/SGIFastAtom.h> +#else +#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) +#endif + +static Bool layersRead = False; +static OverlayInfo **overlayInfoPerScreen; +static unsigned long *numOverlaysPerScreen; + +static void +findServerOverlayVisualsInfo(Display * dpy) +{ + static Atom overlayVisualsAtom; + Atom actualType; + Status status; + unsigned long sizeData, bytesLeft; + Window root; + int actualFormat, numScreens, i; + + if (layersRead == False) { + overlayVisualsAtom = XSGIFastInternAtom(dpy, + "SERVER_OVERLAY_VISUALS", SGI_XA_SERVER_OVERLAY_VISUALS, True); + if (overlayVisualsAtom != None) { + numScreens = ScreenCount(dpy); + overlayInfoPerScreen = (OverlayInfo **) + malloc(numScreens * sizeof(OverlayInfo *)); + numOverlaysPerScreen = (unsigned long *) + malloc(numScreens * sizeof(unsigned long)); + if (overlayInfoPerScreen != NULL && + numOverlaysPerScreen != NULL) { + for (i = 0; i < numScreens; i++) { + root = RootWindow(dpy, i); + status = XGetWindowProperty(dpy, root, + overlayVisualsAtom, 0L, (long) 10000, False, + overlayVisualsAtom, &actualType, &actualFormat, + &sizeData, &bytesLeft, + (unsigned char **) &overlayInfoPerScreen[i]); + if (status != Success || + actualType != overlayVisualsAtom || + actualFormat != 32 || sizeData < 4) + numOverlaysPerScreen[i] = 0; + else + /* Four 32-bit quantities per + SERVER_OVERLAY_VISUALS entry. */ + numOverlaysPerScreen[i] = sizeData / 4; + } + layersRead = True; + } else { + if (overlayInfoPerScreen != NULL) + free(overlayInfoPerScreen); + if (numOverlaysPerScreen != NULL) + free(numOverlaysPerScreen); + } + } + } +} + +int +__glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) +{ + int i, screen = vinfo->screen; + OverlayInfo *overlayInfo; + + findServerOverlayVisualsInfo(dpy); + if (layersRead) { + for (i = 0; i < numOverlaysPerScreen[screen]; i++) { + overlayInfo = &overlayInfoPerScreen[screen][i]; + if (vinfo->visualid == overlayInfo->overlay_visual) { + if (overlayInfo->transparent_type == TransparentPixel) { + return (int) overlayInfo->value; + } else { + return -1; + } + } + } + } + return -1; +} + +XLayerVisualInfo * +__glutXGetLayerVisualInfo(Display * dpy, long lvinfo_mask, + XLayerVisualInfo * lvinfo_template, int *nitems_return) +{ + XVisualInfo *vinfo; + XLayerVisualInfo *layerInfo; + int numVisuals, count, i, j; + + vinfo = XGetVisualInfo(dpy, lvinfo_mask & VisualAllMask, + &lvinfo_template->vinfo, nitems_return); + if (vinfo == NULL) + return NULL; + numVisuals = *nitems_return; + findServerOverlayVisualsInfo(dpy); + layerInfo = (XLayerVisualInfo *) + malloc(numVisuals * sizeof(XLayerVisualInfo)); + if (layerInfo == NULL) { + XFree(vinfo); + return NULL; + } + count = 0; + for (i = 0; i < numVisuals; i++) { + XVisualInfo *pVinfo = &vinfo[i]; + int screen = pVinfo->screen; + OverlayInfo *overlayInfo = NULL; + + overlayInfo = NULL; + if (layersRead) { + for (j = 0; j < numOverlaysPerScreen[screen]; j++) + if (pVinfo->visualid == + overlayInfoPerScreen[screen][j].overlay_visual) { + overlayInfo = &overlayInfoPerScreen[screen][j]; + break; + } + } + if (lvinfo_mask & VisualLayerMask) { + if (overlayInfo == NULL) { + if (lvinfo_template->layer != 0) + continue; + } else if (lvinfo_template->layer != overlayInfo->layer) + continue; + } + if (lvinfo_mask & VisualTransparentType) { + if (overlayInfo == NULL) { + if (lvinfo_template->type != None) + continue; + } else if (lvinfo_template->type != + overlayInfo->transparent_type) + continue; + } + if (lvinfo_mask & VisualTransparentValue) { + if (overlayInfo == NULL) + /* Non-overlay visuals have no sense of + TransparentValue. */ + continue; + else if (lvinfo_template->value != overlayInfo->value) + continue; + } + layerInfo[count].vinfo = *pVinfo; + if (overlayInfo == NULL) { + layerInfo[count].layer = 0; + layerInfo[count].type = None; + layerInfo[count].value = 0; /* meaningless */ + } else { + layerInfo[count].layer = overlayInfo->layer; + layerInfo[count].type = overlayInfo->transparent_type; + layerInfo[count].value = overlayInfo->value; + } + count++; + } + XFree(vinfo); + *nitems_return = count; + if (count == 0) { + XFree(layerInfo); + return NULL; + } else + return layerInfo; +} + +#if 0 /* Unused by GLUT. */ +Status +__glutXMatchLayerVisualInfo(Display * dpy, int screen, + int depth, int visualClass, int layer, + XLayerVisualInfo * lvinfo_return) +{ + XLayerVisualInfo *lvinfo; + XLayerVisualInfo lvinfoTemplate; + int nitems; + + lvinfoTemplate.vinfo.screen = screen; + lvinfoTemplate.vinfo.depth = depth; +#if defined(__cplusplus) || defined(c_plusplus) + lvinfoTemplate.vinfo.c_class = visualClass; +#else + lvinfoTemplate.vinfo.class = visualClass; +#endif + lvinfoTemplate.layer = layer; + lvinfo = __glutXGetLayerVisualInfo(dpy, + VisualScreenMask | VisualDepthMask | + VisualClassMask | VisualLayerMask, + &lvinfoTemplate, &nitems); + if (lvinfo != NULL && nitems > 0) { + *lvinfo_return = *lvinfo; + return 1; + } else + return 0; +} +#endif diff --git a/xc/extras/Mesa/src-glut/layerutil.h b/xc/extras/Mesa/src-glut/layerutil.h new file mode 100644 index 000000000..346107740 --- /dev/null +++ b/xc/extras/Mesa/src-glut/layerutil.h @@ -0,0 +1,55 @@ +#ifndef __layerutil_h__ +#define __layerutil_h__ + +/* Copyright (c) Mark J. Kilgard, 1993, 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. */ + +/* Based on XLayerUtil.h: Revision: 1.3 */ + +#if !defined(_WIN32) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xmd.h> +#endif /* !_WIN32 */ + +/* Transparent type values */ +/* None 0 */ +#define TransparentPixel 1 +#define TransparentMask 2 + +/* layered visual info template flags */ +#define VisualLayerMask 0x200 +#define VisualTransparentType 0x400 +#define VisualTransparentValue 0x800 +#define VisualAllLayerMask 0xFFF + +/* layered visual info structure */ +typedef struct _XLayerVisualInfo { + XVisualInfo vinfo; + long layer; + long type; + unsigned long value; +} XLayerVisualInfo; + +/* SERVER_OVERLAY_VISUALS property element */ +typedef struct _OverlayInfo { + /* Avoid 64-bit portability problems by being careful to use + longs due to the way XGetWindowProperty is specified. Note + that these parameters are passed as CARD32s over X + protocol. */ + long overlay_visual; + long transparent_type; + long value; + long layer; +} OverlayInfo; + +extern int __glutGetTransparentPixel(Display *, XVisualInfo *); +extern XLayerVisualInfo *__glutXGetLayerVisualInfo(Display *, + long, XLayerVisualInfo *, int *); +extern Status __glutXMatchLayerVisualInfo(Display *, + int, int, int, int, XLayerVisualInfo *); + +#endif /* __layerutil_h__ */ diff --git a/xc/extras/Mesa/src-glut/mms_depend b/xc/extras/Mesa/src-glut/mms_depend new file mode 100644 index 000000000..bb0cffc1d --- /dev/null +++ b/xc/extras/Mesa/src-glut/mms_depend @@ -0,0 +1,72 @@ +# DO NOT DELETE + +glut_8x13.obj : glutbitmap.h [-.include.gl]gl.h +glut_9x15.obj : glutbitmap.h [-.include.gl]gl.h +glut_bitmap.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_bitmap.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_bitmap.obj : glutbitmap.h +glut_bwidth.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_bwidth.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_bwidth.obj : glutbitmap.h +glut_cindex.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_cindex.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_cindex.obj : layerutil.h +glut_cursor.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_cursor.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_dials.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_dials.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h [-.include.gl]glu.h +glut_dstr.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_dstr.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h [-.include.gl]glu.h +glut_event.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_event.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_ext.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_ext.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_fullscrn.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_fullscrn.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h +glut_fullscrn.obj : [-.include.gl]glu.h +glut_get.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_get.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_hel10.obj : glutbitmap.h [-.include.gl]gl.h +glut_hel12.obj : glutbitmap.h [-.include.gl]gl.h +glut_hel18.obj : glutbitmap.h [-.include.gl]gl.h +glut_init.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_init.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_menu.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_menu.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h layerutil.h +glut_mesa.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_mesa.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h [-.include.gl]glu.h +glut_modifier.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_modifier.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h +glut_modifier.obj : [-.include.gl]glu.h +glut_mroman.obj : glutstroke.h +glut_overlay.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_overlay.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_overlay.obj : layerutil.h +glut_roman.obj : glutstroke.h +glut_shapes.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_shapes.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_space.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_space.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h [-.include.gl]glu.h +glut_stroke.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_stroke.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_stroke.obj : glutstroke.h +glut_swidth.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_swidth.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_swidth.obj : glutstroke.h +glut_tablet.obj : glutint.h [-.include.gl]glx.h [-.include.gl]gl.h +glut_tablet.obj : [-.include.gl]xmesa.h [-.include.gl]glut.h [-.include.gl]glu.h +glut_teapot.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_tr10.obj : glutbitmap.h [-.include.gl]gl.h +glut_tr24.obj : glutbitmap.h [-.include.gl]gl.h +glut_util.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_util.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_vidresize.obj : [-.include.gl]glx.h [-.include.gl]gl.h +glut_vidresize.obj : [-.include.gl]xmesa.h glutint.h [-.include.gl]glut.h +glut_vidresize.obj : [-.include.gl]glu.h +glut_warp.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_warp.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_win.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_win.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +glut_winmisc.obj : [-.include.gl]glut.h [-.include.gl]gl.h [-.include.gl]glu.h +glut_winmisc.obj : glutint.h [-.include.gl]glx.h [-.include.gl]xmesa.h +layerutil.obj : layerutil.h diff --git a/xc/extras/Mesa/src-glut/stroke.h b/xc/extras/Mesa/src-glut/stroke.h new file mode 100644 index 000000000..fc29680be --- /dev/null +++ b/xc/extras/Mesa/src-glut/stroke.h @@ -0,0 +1,134 @@ +/* $XConsortium: wfont.h,v 5.1 91/02/16 09:46:37 rws Exp $ */ + +/***************************************************************** +Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc. and the X Consortium. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Sun Microsystems, +the X Consortium, and MIT not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT +SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef WFONT_INCLUDED +#define WFONT_INCLUDED + +#define WFONT_MAGIC 0x813 +#define WFONT_MAGIC_PLUS 0x715 +#define WFONT_MAGIC_PEX 0x70686e74 +#define START_PROPS 0x100 +#define START_DISPATCH(_num_props) (START_PROPS + 160 * _num_props) +#define START_PATH(_num_ch_, _num_props) (START_DISPATCH(_num_props) + sizeof(Dispatch) * _num_ch_) +#define NUM_DISPATCH 128 + +typedef struct { + unsigned short x; + unsigned short y; +} Path_point2dpx; + +typedef struct { + float x; + float y; +} Path_point2df; + +typedef struct { + int x; + int y; + int z; +} Path_point3di; + +typedef struct { + float x; + float y; + float z; +} Path_point3df; + +typedef struct { + float x; + float y; + float z; + float w; +} Path_point4df; + +typedef union { + Path_point2dpx *pt2dpx; + Path_point2df *pt2df; + Path_point3di *pt3di; + Path_point3df *pt3df; + Path_point4df *pt4df; +} Path_pt_ptr; + +typedef enum { + PATH_2DF, + PATH_2DPX, + PATH_3DF, + PATH_3DI, + PATH_4DF +} Path_type; + +typedef struct { + int n_pts; /* number of points in the subpath */ + Path_pt_ptr pts; /* pointer to them */ + int closed; /* true if the subpath is closed */ + int dcmp_flag; /* flag for pgon dcmp, pgon type + * and dcmped triangle type */ +} Path_subpath; + +typedef struct { + Path_type type; /* type of vertices in this path */ + int n_subpaths; /* number of subpaths */ + int n_vertices; /* total number of vertices */ + Path_subpath *subpaths; /* array of subpaths */ +} Path; + +typedef Path *Path_handle; + +typedef struct { + char propname[80]; /* font property name */ + char propvalue[80]; /* font property value */ +} Property; + +typedef struct { + int magic; /* magic number */ + char name[80]; /* name of this font */ + float top, /* extreme values */ + bottom, max_width; + int num_ch; /* no. of fonts in the set */ + int num_props; /* no. of font properties */ + Property *properties; /* array of properties */ +} Font_header; + +typedef struct { + float center, /* center of the character */ + right; /* right edge */ + long offset; /* offset in the file of the character + * * description */ +} Dispatch; + +typedef struct { + float center, right; + Path strokes; +} Ch_font; + +typedef struct { + char name[80]; + float top, bottom, max_width; + int num_ch; /* # characters in the font */ + Ch_font **ch_data; +} Phg_font; + +#endif /*WFONT_INCLUDED */ diff --git a/xc/extras/Mesa/src-glut/win32_glx.c b/xc/extras/Mesa/src-glut/win32_glx.c new file mode 100644 index 000000000..ecfff44b9 --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_glx.c @@ -0,0 +1,256 @@ + +/* Copyright (c) Nate Robins, 1997. */ + +/* 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 <stdio.h> +#include "glutint.h" +#include "win32_glx.h" + +/* global current HDC */ +extern HDC XHDC; + +GLXContext +glXCreateContext(Display * display, XVisualInfo * visinfo, + GLXContext share, Bool direct) +{ + /* KLUDGE: GLX really expects a display pointer to be passed + in as the first parameter, but Win32 needs an HDC instead, + so BE SURE that the global XHDC is set before calling this + routine. */ + HGLRC context; + + context = CreateContext(XHDC); + +#if 0 + /* XXX GLUT doesn't support it now, so don't worry about display list + and texture object sharing. */ + if (share) { + wglShareLists(share, context); + } +#endif + + /* Since direct rendering is implicit, the direct flag is + ignored. */ + + return context; +} + +int +glXGetConfig(Display * display, XVisualInfo * visual, int attrib, int *value) +{ + if (!visual) + return GLX_BAD_VISUAL; + + switch (attrib) { + case GLX_USE_GL: + if (visual->dwFlags & (PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW)) { + /* XXX Brad's Matrix Millenium II has problems creating + color index windows in 24-bit mode (lead to GDI crash) + and 32-bit mode (lead to black window). The cColorBits + filed of the PIXELFORMATDESCRIPTOR returned claims to + have 24 and 32 bits respectively of color indices. 2^24 + and 2^32 are ridiculously huge writable colormaps. + Assume that if we get back a color index + PIXELFORMATDESCRIPTOR with 24 or more bits, the + PIXELFORMATDESCRIPTOR doesn't really work and skip it. + -mjk */ + if (visual->iPixelType == PFD_TYPE_COLORINDEX + && visual->cColorBits >= 24) { + *value = 0; + } else { + *value = 1; + } + } else { + *value = 0; + } + break; + case GLX_BUFFER_SIZE: + /* KLUDGE: if we're RGBA, return the number of bits/pixel, + otherwise, return 8 (we guessed at 256 colors in CI + mode). */ + if (visual->iPixelType == PFD_TYPE_RGBA) + *value = visual->cColorBits; + else + *value = 8; + break; + case GLX_LEVEL: + /* The bReserved flag of the pfd contains the + overlay/underlay info. */ + *value = visual->bReserved; + break; + case GLX_RGBA: + *value = visual->iPixelType == PFD_TYPE_RGBA; + break; + case GLX_DOUBLEBUFFER: + *value = visual->dwFlags & PFD_DOUBLEBUFFER; + break; + case GLX_STEREO: + *value = visual->dwFlags & PFD_STEREO; + break; + case GLX_AUX_BUFFERS: + *value = visual->cAuxBuffers; + break; + case GLX_RED_SIZE: + *value = visual->cRedBits; + break; + case GLX_GREEN_SIZE: + *value = visual->cGreenBits; + break; + case GLX_BLUE_SIZE: + *value = visual->cBlueBits; + break; + case GLX_ALPHA_SIZE: + *value = visual->cAlphaBits; + break; + case GLX_DEPTH_SIZE: + *value = visual->cDepthBits; + break; + case GLX_STENCIL_SIZE: + *value = visual->cStencilBits; + break; + case GLX_ACCUM_RED_SIZE: + *value = visual->cAccumRedBits; + break; + case GLX_ACCUM_GREEN_SIZE: + *value = visual->cAccumGreenBits; + break; + case GLX_ACCUM_BLUE_SIZE: + *value = visual->cAccumBlueBits; + break; + case GLX_ACCUM_ALPHA_SIZE: + *value = visual->cAccumAlphaBits; + break; + default: + return GLX_BAD_ATTRIB; + } + return 0; +} + +XVisualInfo * +glXChooseVisual(Display * display, int screen, int *attribList) +{ + /* KLUDGE: since we need the HDC, MAKE SURE to set XHDC + before calling this routine. */ + + int *p = attribList; + int pf; + PIXELFORMATDESCRIPTOR pfd; + PIXELFORMATDESCRIPTOR *match = NULL; + int stereo = 0; + + /* Avoid seg-faults. */ + if (!p) + return NULL; + + memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); + pfd.nSize = (sizeof(PIXELFORMATDESCRIPTOR)); + pfd.nVersion = 1; + + /* Defaults. */ + pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; + pfd.iPixelType = PFD_TYPE_COLORINDEX; + pfd.cColorBits = 32; + pfd.cDepthBits = 0; + + while (*p) { + switch (*p) { + case GLX_USE_GL: + pfd.dwFlags |= PFD_SUPPORT_OPENGL; + break; + case GLX_BUFFER_SIZE: + pfd.cColorBits = *(++p); + break; + case GLX_LEVEL: + /* the bReserved flag of the pfd contains the + overlay/underlay info. */ + pfd.bReserved = *(++p); + break; + case GLX_RGBA: + pfd.iPixelType = PFD_TYPE_RGBA; + break; + case GLX_DOUBLEBUFFER: + pfd.dwFlags |= PFD_DOUBLEBUFFER; + break; + case GLX_STEREO: + stereo = 1; + pfd.dwFlags |= PFD_STEREO; + break; + case GLX_AUX_BUFFERS: + pfd.cAuxBuffers = *(++p); + break; + case GLX_RED_SIZE: + pfd.cRedBits = 8; /* Try to get the maximum. */ + ++p; + break; + case GLX_GREEN_SIZE: + pfd.cGreenBits = 8; + ++p; + break; + case GLX_BLUE_SIZE: + pfd.cBlueBits = 8; + ++p; + break; + case GLX_ALPHA_SIZE: + pfd.cAlphaBits = 8; + ++p; + break; + case GLX_DEPTH_SIZE: + pfd.cDepthBits = 32; + ++p; + break; + case GLX_STENCIL_SIZE: + pfd.cStencilBits = *(++p); + break; + case GLX_ACCUM_RED_SIZE: + case GLX_ACCUM_GREEN_SIZE: + case GLX_ACCUM_BLUE_SIZE: + case GLX_ACCUM_ALPHA_SIZE: + /* I believe that WGL only used the cAccumRedBits, + cAccumBlueBits, cAccumGreenBits, and cAccumAlphaBits fields + when returning info about the accumulation buffer precision. + Only cAccumBits is used for requesting an accumulation + buffer. */ + pfd.cAccumBits = 1; + ++p; + break; + } + ++p; + } + + /* Let Win32 choose one for us. */ + pf = ChoosePixelFormat(XHDC, &pfd); + if (pf > 0) { + match = (PIXELFORMATDESCRIPTOR *) malloc(sizeof(PIXELFORMATDESCRIPTOR)); + DescribePixelFormat(XHDC, pf, sizeof(PIXELFORMATDESCRIPTOR), match); + + /* ChoosePixelFormat is dumb in that it will return a pixel + format that doesn't have stereo even if it was requested + so we need to make sure that if stereo was selected, we + got it. */ + if (stereo) { + if (!(match->dwFlags & PFD_STEREO)) { + free(match); + return NULL; + } + } + /* XXX Brad's Matrix Millenium II has problems creating + color index windows in 24-bit mode (lead to GDI crash) + and 32-bit mode (lead to black window). The cColorBits + filed of the PIXELFORMATDESCRIPTOR returned claims to + have 24 and 32 bits respectively of color indices. 2^24 + and 2^32 are ridiculously huge writable colormaps. + Assume that if we get back a color index + PIXELFORMATDESCRIPTOR with 24 or more bits, the + PIXELFORMATDESCRIPTOR doesn't really work and skip it. + -mjk */ + if (match->iPixelType == PFD_TYPE_COLORINDEX + && match->cColorBits >= 24) { + free(match); + return NULL; + } + } + return match; +} diff --git a/xc/extras/Mesa/src-glut/win32_glx.h b/xc/extras/Mesa/src-glut/win32_glx.h new file mode 100644 index 000000000..d3630e7a1 --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_glx.h @@ -0,0 +1,58 @@ +#ifndef __win32_glx_h__ +#define __win32_glx_h__ + +/* Copyright (c) Nate Robins, 1997. */ + +/* 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 "win32_x11.h" + +/* Type definitions (conversions). */ +typedef HGLRC GLXContext; + +#define GLX_USE_GL 1 /* support GLX rendering */ +#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ +#define GLX_LEVEL 3 /* level in plane stacking */ +#define GLX_RGBA 4 /* true if RGBA mode */ +#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ +#define GLX_STEREO 6 /* stereo buffering supported */ +#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ +#define GLX_RED_SIZE 8 /* number of red component bits */ +#define GLX_GREEN_SIZE 9 /* number of green component bits */ +#define GLX_BLUE_SIZE 10 /* number of blue component bits */ +#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ +#define GLX_DEPTH_SIZE 12 /* number of depth bits */ +#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ +#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ +#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ +#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ +#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ + +#define GLX_BAD_ATTRIB 2 +#define GLX_BAD_VISUAL 4 + +/* Functions emulated by macros. */ + +#define glXDestroyContext(display, context) \ + wglDeleteContext(context) + +/* Function prototypes. */ + +extern GLXContext glXCreateContext( + Display* display, + XVisualInfo* visinfo, + GLXContext share, + Bool direct); +extern int glXGetConfig( + Display* display, + XVisualInfo* visual, + int attrib, + int* value); +extern XVisualInfo* glXChooseVisual( + Display* display, + int screen, + int* attribList); + +#endif /* __win32_glx_h__ */ diff --git a/xc/extras/Mesa/src-glut/win32_menu.c b/xc/extras/Mesa/src-glut/win32_menu.c new file mode 100644 index 000000000..20485eea6 --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_menu.c @@ -0,0 +1,531 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ +/* Copyright (c) Nate Robins, 1997. */ + +/* 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. */ + +/* This file completely re-implements glut_menu.c and glut_menu2.c + for Win32. Note that neither glut_menu.c nor glut_menu2.c are + compiled into Win32 GLUT. */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> +#include <assert.h> + +#include "glutint.h" + +void (GLUTCALLBACK *__glutMenuStatusFunc) (int, int, int); +GLUTmenu *__glutMappedMenu; +GLUTwindow *__glutMenuWindow; +GLUTmenuItem *__glutItemSelected; +unsigned __glutMenuButton; + +static GLUTmenu **menuList = NULL; +static int menuListSize = 0; +static UINT uniqueMenuHandler = 1; + +/* DEPRICATED, use glutMenuStatusFunc instead. */ +void APIENTRY +glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) +{ + __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; +} + +void APIENTRY +glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) +{ + __glutMenuStatusFunc = menuStatusFunc; +} + +void +__glutSetMenu(GLUTmenu * menu) +{ + __glutCurrentMenu = menu; +} + +static void +unmapMenu(GLUTmenu * menu) +{ + if (menu->cascade) { + unmapMenu(menu->cascade); + menu->cascade = NULL; + } + menu->anchor = NULL; + menu->highlighted = NULL; +} + +void +__glutFinishMenu(Window win, int x, int y) +{ + + unmapMenu(__glutMappedMenu); + + /* XXX Put in a GdiFlush just in case. Probably unnecessary. -mjk */ + GdiFlush(); + + if (__glutMenuStatusFunc) { + __glutSetWindow(__glutMenuWindow); + __glutSetMenu(__glutMappedMenu); + + /* Setting __glutMappedMenu to NULL permits operations that + change menus or destroy the menu window again. */ + __glutMappedMenu = NULL; + + __glutMenuStatusFunc(GLUT_MENU_NOT_IN_USE, x, y); + } + /* Setting __glutMappedMenu to NULL permits operations that + change menus or destroy the menu window again. */ + __glutMappedMenu = NULL; + + /* If an item is selected and it is not a submenu trigger, + generate menu callback. */ + if (__glutItemSelected && !__glutItemSelected->isTrigger) { + __glutSetWindow(__glutMenuWindow); + /* When menu callback is triggered, current menu should be + set to the callback menu. */ + __glutSetMenu(__glutItemSelected->menu); + __glutItemSelected->menu->select(__glutItemSelected->value); + } + __glutMenuWindow = NULL; +} + +static void +mapMenu(GLUTmenu * menu, int x, int y) +{ + TrackPopupMenu((HMENU) menu->win, TPM_LEFTALIGN | + (__glutMenuButton == TPM_RIGHTBUTTON) ? TPM_RIGHTBUTTON : TPM_LEFTBUTTON, + x, y, 0, __glutCurrentWindow->win, NULL); +} + +void +__glutStartMenu(GLUTmenu * menu, GLUTwindow * window, + int x, int y, int x_win, int y_win) +{ + assert(__glutMappedMenu == NULL); + __glutMappedMenu = menu; + __glutMenuWindow = window; + __glutItemSelected = NULL; + if (__glutMenuStatusFunc) { + __glutSetMenu(menu); + __glutSetWindow(window); + __glutMenuStatusFunc(GLUT_MENU_IN_USE, x_win, y_win); + } + mapMenu(menu, x, y); +} + +GLUTmenuItem * +__glutGetUniqueMenuItem(GLUTmenu * menu, UINT unique) +{ + GLUTmenuItem *item; + int i; + + i = menu->num; + item = menu->list; + while (item) { + if (item->unique == unique) { + return item; + } + if (item->isTrigger) { + GLUTmenuItem *subitem; + subitem = __glutGetUniqueMenuItem(menuList[item->value], unique); + if (subitem) { + return subitem; + } + } + i--; + item = item->next; + } + return NULL; +} + +GLUTmenuItem * +__glutGetMenuItem(GLUTmenu * menu, Window win, int *which) +{ + GLUTmenuItem *item; + int i; + + i = menu->num; + item = menu->list; + while (item) { + if (item->win == win) { + *which = i; + return item; + } + if (item->isTrigger) { + GLUTmenuItem *subitem; + + subitem = __glutGetMenuItem(menuList[item->value], + win, which); + if (subitem) { + return subitem; + } + } + i--; + item = item->next; + } + return NULL; +} + +GLUTmenu * +__glutGetMenu(Window win) +{ + GLUTmenu *menu; + + menu = __glutMappedMenu; + while (menu) { + if (win == menu->win) { + return menu; + } + menu = menu->cascade; + } + return NULL; +} + +GLUTmenu * +__glutGetMenuByNum(int menunum) +{ + if (menunum < 1 || menunum > menuListSize) { + return NULL; + } + return menuList[menunum - 1]; +} + +static int +getUnusedMenuSlot(void) +{ + int i; + + /* Look for allocated, unused slot. */ + for (i = 0; i < menuListSize; i++) { + if (!menuList[i]) { + return i; + } + } + /* Allocate a new slot. */ + menuListSize++; + if (menuList) { + menuList = (GLUTmenu **) + realloc(menuList, menuListSize * sizeof(GLUTmenu *)); + } else { + /* XXX Some realloc's do not correctly perform a malloc + when asked to perform a realloc on a NULL pointer, + though the ANSI C library spec requires this. */ + menuList = (GLUTmenu **) malloc(sizeof(GLUTmenu *)); + } + if (!menuList) { + __glutFatalError("out of memory."); + } + menuList[menuListSize - 1] = NULL; + return menuListSize - 1; +} + +static void +menuModificationError(void) +{ + /* XXX Remove the warning after GLUT 3.0. */ + __glutWarning("The following is a new check for GLUT 3.0; update your code."); + __glutFatalError("menu manipulation not allowed while menus in use."); +} + +int APIENTRY +glutCreateMenu(GLUTselectCB selectFunc) +{ + GLUTmenu *menu; + int menuid; + + if (__glutMappedMenu) { + menuModificationError(); + } + menuid = getUnusedMenuSlot(); + menu = (GLUTmenu *) malloc(sizeof(GLUTmenu)); + if (!menu) { + __glutFatalError("out of memory."); + } + menu->id = menuid; + menu->num = 0; + menu->submenus = 0; + menu->select = selectFunc; + menu->list = NULL; + menu->cascade = NULL; + menu->highlighted = NULL; + menu->anchor = NULL; + menu->win = (HWND) CreatePopupMenu(); + menuList[menuid] = menu; + __glutSetMenu(menu); + return menuid + 1; +} + +int APIENTRY +__glutCreateMenuWithExit(GLUTselectCB selectFunc, void (__cdecl *exitfunc)(int)) +{ + __glutExitFunc = exitfunc; + return glutCreateMenu(selectFunc); +} + +void APIENTRY +glutDestroyMenu(int menunum) +{ + GLUTmenu *menu = __glutGetMenuByNum(menunum); + GLUTmenuItem *item, *next; + + if (__glutMappedMenu) { + menuModificationError(); + } + assert(menu->id == menunum - 1); + DestroyMenu( (HMENU) menu->win); + menuList[menunum - 1] = NULL; + /* free all menu entries */ + item = menu->list; + while (item) { + assert(item->menu == menu); + next = item->next; + free(item->label); + free(item); + item = next; + } + if (__glutCurrentMenu == menu) { + __glutCurrentMenu = NULL; + } + free(menu); +} + +int APIENTRY +glutGetMenu(void) +{ + if (__glutCurrentMenu) { + return __glutCurrentMenu->id + 1; + } else { + return 0; + } +} + +void APIENTRY +glutSetMenu(int menuid) +{ + GLUTmenu *menu; + + if (menuid < 1 || menuid > menuListSize) { + __glutWarning("glutSetMenu attempted on bogus menu."); + return; + } + menu = menuList[menuid - 1]; + if (!menu) { + __glutWarning("glutSetMenu attempted on bogus menu."); + return; + } + __glutSetMenu(menu); +} + +static void +setMenuItem(GLUTmenuItem * item, const char *label, + int value, Bool isTrigger) +{ + GLUTmenu *menu; + + menu = item->menu; + item->label = __glutStrdup(label); + if (!item->label) { + __glutFatalError("out of memory."); + } + item->isTrigger = isTrigger; + item->len = (int) strlen(label); + item->value = value; + item->unique = uniqueMenuHandler++; + if (isTrigger) { + AppendMenu((HMENU) menu->win, MF_POPUP, (UINT)item->win, label); + } else { + AppendMenu((HMENU) menu->win, MF_STRING, item->unique, label); + } +} + +void APIENTRY +glutAddMenuEntry(const char *label, int value) +{ + GLUTmenuItem *entry; + + if (__glutMappedMenu) { + menuModificationError(); + } + entry = (GLUTmenuItem *) malloc(sizeof(GLUTmenuItem)); + if (!entry) { + __glutFatalError("out of memory."); + } + entry->menu = __glutCurrentMenu; + setMenuItem(entry, label, value, FALSE); + __glutCurrentMenu->num++; + entry->next = __glutCurrentMenu->list; + __glutCurrentMenu->list = entry; +} + +void APIENTRY +glutAddSubMenu(const char *label, int menu) +{ + GLUTmenuItem *submenu; + GLUTmenu *popupmenu; + + if (__glutMappedMenu) { + menuModificationError(); + } + submenu = (GLUTmenuItem *) malloc(sizeof(GLUTmenuItem)); + if (!submenu) { + __glutFatalError("out of memory."); + } + __glutCurrentMenu->submenus++; + submenu->menu = __glutCurrentMenu; + popupmenu = __glutGetMenuByNum(menu); + if (popupmenu) { + submenu->win = popupmenu->win; + } + setMenuItem(submenu, label, /* base 0 */ menu - 1, TRUE); + __glutCurrentMenu->num++; + submenu->next = __glutCurrentMenu->list; + __glutCurrentMenu->list = submenu; +} + +void APIENTRY +glutChangeToMenuEntry(int num, const char *label, int value) +{ + GLUTmenuItem *item; + int i; + + if (__glutMappedMenu) { + menuModificationError(); + } + i = __glutCurrentMenu->num; + item = __glutCurrentMenu->list; + while (item) { + if (i == num) { + if (item->isTrigger) { + /* If changing a submenu trigger to a menu entry, we + need to account for submenus. */ + item->menu->submenus--; + /* Nuke the Win32 menu. */ + DestroyMenu((HMENU) item->win); + } + free(item->label); + + item->label = strdup(label); + if (!item->label) + __glutFatalError("out of memory"); + item->isTrigger = FALSE; + item->len = (int) strlen(label); + item->value = value; + item->unique = uniqueMenuHandler++; + ModifyMenu((HMENU) __glutCurrentMenu->win, (UINT) i - 1, + MF_BYPOSITION | MFT_STRING, item->unique, label); + + return; + } + i--; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +void APIENTRY +glutChangeToSubMenu(int num, const char *label, int menu) +{ + GLUTmenu *popupmenu; + GLUTmenuItem *item; + int i; + + if (__glutMappedMenu) { + menuModificationError(); + } + i = __glutCurrentMenu->num; + item = __glutCurrentMenu->list; + while (item) { + if (i == num) { + if (!item->isTrigger) { + /* If changing a menu entry to as submenu trigger, we + need to account for submenus. */ + item->menu->submenus++; + item->win = (HWND) CreatePopupMenu(); + } + free(item->label); + + item->label = strdup(label); + if (!item->label) + __glutFatalError("out of memory"); + item->isTrigger = TRUE; + item->len = (int) strlen(label); + item->value = menu - 1; + item->unique = uniqueMenuHandler++; + popupmenu = __glutGetMenuByNum(menu); + if (popupmenu) + item->win = popupmenu->win; + ModifyMenu((HMENU) __glutCurrentMenu->win, (UINT) i - 1, + MF_BYPOSITION | MF_POPUP, (UINT) item->win, label); + return; + } + i--; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +void APIENTRY +glutRemoveMenuItem(int num) +{ + GLUTmenuItem *item, **prev; + int i; + + if (__glutMappedMenu) { + menuModificationError(); + } + i = __glutCurrentMenu->num; + prev = &__glutCurrentMenu->list; + item = __glutCurrentMenu->list; + while (item) { + if (i == num) { + /* Found the menu item in list to remove. */ + __glutCurrentMenu->num--; + + /* Patch up menu's item list. */ + *prev = item->next; + + RemoveMenu((HMENU) __glutCurrentMenu->win, (UINT) i - 1, MF_BYPOSITION); + + free(item->label); + free(item); + return; + } + i--; + prev = &item->next; + item = item->next; + } + __glutWarning("Current menu has no %d item.", num); +} + +void APIENTRY +glutAttachMenu(int button) +{ + if (__glutCurrentWindow == __glutGameModeWindow) { + __glutWarning("cannot attach menus in game mode."); + return; + } + if (__glutMappedMenu) { + menuModificationError(); + } + if (__glutCurrentWindow->menu[button] < 1) { + __glutCurrentWindow->buttonUses++; + } + __glutCurrentWindow->menu[button] = __glutCurrentMenu->id + 1; +} + +void APIENTRY +glutDetachMenu(int button) +{ + if (__glutMappedMenu) { + menuModificationError(); + } + if (__glutCurrentWindow->menu[button] > 0) { + __glutCurrentWindow->buttonUses--; + __glutCurrentWindow->menu[button] = 0; + } +} + diff --git a/xc/extras/Mesa/src-glut/win32_util.c b/xc/extras/Mesa/src-glut/win32_util.c new file mode 100644 index 000000000..d05d1d1e8 --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_util.c @@ -0,0 +1,120 @@ + +/* Copyright (c) Nate Robins, 1997. */ + +/* portions Copyright (c) Mark Kilgard, 1997, 1998. */ + +/* 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 "glutint.h" +#include "glutstroke.h" +#include "glutbitmap.h" +#include <sys/timeb.h> + +/* The following added by Paul Garceau <pgarceau@teleport.com> */ +#if defined(__MINGW32__) +#include <time.h> +#include <windows.h> +struct timeval; +#endif + +extern StrokeFontRec glutStrokeRoman, glutStrokeMonoRoman; +extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18; + +#ifndef __CYGWIN32__ +int +gettimeofday(struct timeval* tp, void* tzp) +{ + struct timeb tb; + + ftime(&tb); + tp->tv_sec = tb.time; + tp->tv_usec = tb.millitm * 1000; + + /* 0 indicates that the call succeeded. */ + return 0; +} +#endif + +/* To get around the fact that Microsoft DLLs only allow functions + to be exported and now data addresses (as Unix DSOs support), the + GLUT API constants such as GLUT_STROKE_ROMAN have to get passed + through a case statement to get mapped to the actual data structure + address. */ +void* +__glutFont(void *font) +{ + switch((int)font) { + case (int)GLUT_STROKE_ROMAN: + return &glutStrokeRoman; + case (int)GLUT_STROKE_MONO_ROMAN: + return &glutStrokeMonoRoman; + case (int)GLUT_BITMAP_9_BY_15: + return &glutBitmap9By15; + case (int)GLUT_BITMAP_8_BY_13: + return &glutBitmap8By13; + case (int)GLUT_BITMAP_TIMES_ROMAN_10: + return &glutBitmapTimesRoman10; + case (int)GLUT_BITMAP_TIMES_ROMAN_24: + return &glutBitmapTimesRoman24; + case (int)GLUT_BITMAP_HELVETICA_10: + return &glutBitmapHelvetica10; + case (int)GLUT_BITMAP_HELVETICA_12: + return &glutBitmapHelvetica12; + case (int)GLUT_BITMAP_HELVETICA_18: + return &glutBitmapHelvetica18; + } + __glutFatalError("out of memory."); + /* NOTREACHED */ + return NULL; /* MSVC compiler complains if there is no return at all */ +} + +int +__glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) +{ + /* the transparent pixel on Win32 is always index number 0. So if + we put this routine in this file, we can avoid compiling the + whole of layerutil.c which is where this routine normally comes + from. */ + return 0; +} + +void +__glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height) +{ + RECT rect; + + /* adjust the window rectangle because Win32 thinks that the x, y, + width & height are the WHOLE window (including decorations), + whereas GLUT treats the x, y, width & height as only the CLIENT + area of the window. */ + rect.left = *x; rect.top = *y; + rect.right = *x + *width; rect.bottom = *y + *height; + + /* must adjust the coordinates according to the correct style + because depending on the style, there may or may not be + borders. */ + AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | + (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW), + FALSE); + /* FALSE in the third parameter = window has no menu bar */ + + /* readjust if the x and y are offscreen */ + if(rect.left < 0) { + *x = 0; + } else { + *x = rect.left; + } + + if(rect.top < 0) { + *y = 0; + } else { + *y = rect.top; + } + + *width = rect.right - rect.left; /* adjusted width */ + *height = rect.bottom - rect.top; /* adjusted height */ +} + diff --git a/xc/extras/Mesa/src-glut/win32_winproc.c b/xc/extras/Mesa/src-glut/win32_winproc.c new file mode 100644 index 000000000..945b7eb9c --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_winproc.c @@ -0,0 +1,785 @@ + +/* Copyright (c) Nate Robins, 1997. */ +/* portions Copyright (c) Mark Kilgard, 1997, 1998. */ + +/* 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 "glutint.h" +#include <sys/timeb.h> + +#if defined(_WIN32) && !defined(__CYGWIN32__) +#include <mmsystem.h> /* Win32 Multimedia API header. */ +#endif + +extern unsigned __glutMenuButton; +extern GLUTidleCB __glutIdleFunc; +extern GLUTtimer *__glutTimerList; +extern void handleTimeouts(void); +extern GLUTmenuItem *__glutGetUniqueMenuItem(GLUTmenu * menu, int unique); +static HMENU __glutHMenu; + +void +updateWindowState(GLUTwindow *window, int visState) +{ + GLUTwindow* child; + + /* XXX shownState and visState are the same in Win32. */ + window->shownState = visState; + if (visState != window->visState) { + if (window->windowStatus) { + window->visState = visState; + __glutSetWindow(window); + window->windowStatus(visState); + } + } + /* Since Win32 only sends an activate for the toplevel window, + update the visibility for all the child windows. */ + child = window->children; + while (child) { + updateWindowState(child, visState); + child = child->siblings; + } +} + +LONG WINAPI +__glutWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + POINT point; /* Point structure. */ + PAINTSTRUCT ps; /* Paint structure. */ + LPMINMAXINFO minmax; /* Minimum/maximum info structure. */ + GLUTwindow* window; /* GLUT window associated with message. */ + GLUTmenu* menu; /* GLUT menu associated with message. */ + int x, y, width, height, key; + int button = -1; + + switch(msg) { + case WM_CREATE: + return 0; + case WM_CLOSE: + if (__glutExitFunc) { + __glutExitFunc(0); + } + exit(0); + break; +#if 0 + case WM_DESTROY: + /* XXX NVidia's NT OpenGL can have problems closing down + its OpenGL internal data structures if we just allow + the process to terminate without unbinding and deleting + the windows context. Apparently, DirectDraw unloads + before OPENGL32.DLL in the close down sequence, but + NVidia's NT OpenGL needs DirectDraw to close down its + data structures. */ + window = __glutGetWindow(hwnd); + if (window) { + if (window->ctx) { + wglMakeCurrent(NULL, NULL); + wglDeleteContext(window->ctx); + } + } + return 0; +#endif + case WM_PAINT: + window = __glutGetWindow(hwnd); + if (window) { + BeginPaint(hwnd, &ps); /* Must have this for some Win32 reason. */ + EndPaint(hwnd, &ps); + if (window->win == hwnd) { + __glutPostRedisplay(window, GLUT_REPAIR_WORK); + } else if (window->overlay && window->overlay->win == hwnd) { + __glutPostRedisplay(window, GLUT_OVERLAY_REPAIR_WORK); + } + } + return 0; + + case WM_SYSKEYUP: + case WM_KEYUP: + window = __glutGetWindow(hwnd); + if (!window) { + break; + } + /* Win32 is dumb and sends these messages only to the parent + window. Therefore, find out if we're in a child window and + call the child windows keyboard callback if we are. */ + if (window->parent) { + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + hwnd = ChildWindowFromPoint(hwnd, point); + window = __glutGetWindow(hwnd); + } + if (window->specialUp || window->keyboardUp) { + GetCursorPos(&point); + ScreenToClient(window->win, &point); + __glutSetWindow(window); + __glutModifierMask = 0; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ + __glutModifierMask |= ShiftMask; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ + __glutModifierMask |= ControlMask; + if (GetKeyState(VK_MENU) < 0) + __glutModifierMask |= Mod1Mask; + switch (wParam) { + /* *INDENT-OFF* */ + case VK_F1: key = GLUT_KEY_F1; break; + case VK_F2: key = GLUT_KEY_F2; break; + case VK_F3: key = GLUT_KEY_F3; break; + case VK_F4: key = GLUT_KEY_F4; break; + case VK_F5: key = GLUT_KEY_F5; break; + case VK_F6: key = GLUT_KEY_F6; break; + case VK_F7: key = GLUT_KEY_F7; break; + case VK_F8: key = GLUT_KEY_F8; break; + case VK_F9: key = GLUT_KEY_F9; break; + case VK_F10: key = GLUT_KEY_F10; break; + case VK_F11: key = GLUT_KEY_F11; break; + case VK_F12: key = GLUT_KEY_F12; break; + case VK_LEFT: key = GLUT_KEY_LEFT; break; + case VK_UP: key = GLUT_KEY_UP; break; + case VK_RIGHT: key = GLUT_KEY_RIGHT; break; + case VK_DOWN: key = GLUT_KEY_DOWN; break; + case VK_PRIOR: key = GLUT_KEY_PAGE_UP; break; + case VK_NEXT: key = GLUT_KEY_PAGE_DOWN; break; + case VK_HOME: key = GLUT_KEY_HOME; break; + case VK_END: key = GLUT_KEY_END; break; + case VK_INSERT: key = GLUT_KEY_INSERT; break; + case VK_DELETE: + /* Delete is an ASCII character. */ + if (window->keyboardUp) { + window->keyboardUp((unsigned char) 127, point.x, point.y); + } + return 0; + /* *INDENT-ON* */ + default: + if (window->keyboardUp) { + key = MapVirtualKey(wParam, 2); /* Map to ASCII. */ + if (isascii(key) && (key != 0)) { + + /* XXX Attempt to determine modified ASCII character + is quite incomplete. Digits, symbols, CapsLock, + Ctrl, and numeric keypad are all ignored. Fix this. */ + + if (!(__glutModifierMask & ShiftMask)) + key = tolower(key); + window->keyboardUp((unsigned char) key, point.x, point.y); + } + } + __glutModifierMask = (unsigned int) ~0; + return 0; + } + if (window->specialUp) { + window->specialUp(key, point.x, point.y); + } + __glutModifierMask = (unsigned int) ~0; + } + return 0; + + case WM_SYSCHAR: + case WM_CHAR: + window = __glutGetWindow(hwnd); + if (!window) { + break; + } + + /* Bit 30 of lParam is set if key already held down. If + we are ignoring auto repeated key strokes for the window, bail. */ + if (window->ignoreKeyRepeat && (lParam & (1 << 30)) ) { + break; + } + + /* Win32 is dumb and sends these messages only to the parent + window. Therefore, find out if we're in a child window and + call the child windows keyboard callback if we are. */ + if (window->parent) { + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + hwnd = ChildWindowFromPoint(hwnd, point); + window = __glutGetWindow(hwnd); + } + if (window->keyboard) { + GetCursorPos(&point); + ScreenToClient(window->win, &point); + __glutSetWindow(window); + __glutModifierMask = 0; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ + __glutModifierMask |= ShiftMask; + if (GetKeyState(VK_CONTROL) < 0) + __glutModifierMask |= ControlMask; + if (GetKeyState(VK_MENU) < 0) + __glutModifierMask |= Mod1Mask; + window->keyboard((unsigned char)wParam, point.x, point.y); + __glutModifierMask = (unsigned int) ~0; + } + return 0; + + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + window = __glutGetWindow(hwnd); + if (!window) { + break; + } + + /* Bit 30 of lParam is set if key already held down. If + we are ignoring auto repeated key strokes for the window, bail. */ + if (window->ignoreKeyRepeat && (lParam & (1 << 30)) ) { + break; + } + + /* Win32 is dumb and sends these messages only to the parent + window. Therefore, find out if we're in a child window and + call the child windows keyboard callback if we are. */ + if (window->parent) { + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + hwnd = ChildWindowFromPoint(hwnd, point); + window = __glutGetWindow(hwnd); + } + if (window->special) { + switch (wParam) { + /* *INDENT-OFF* */ + /* function keys */ + case VK_F1: key = GLUT_KEY_F1; break; + case VK_F2: key = GLUT_KEY_F2; break; + case VK_F3: key = GLUT_KEY_F3; break; + case VK_F4: key = GLUT_KEY_F4; break; + case VK_F5: key = GLUT_KEY_F5; break; + case VK_F6: key = GLUT_KEY_F6; break; + case VK_F7: key = GLUT_KEY_F7; break; + case VK_F8: key = GLUT_KEY_F8; break; + case VK_F9: key = GLUT_KEY_F9; break; + case VK_F10: key = GLUT_KEY_F10; break; + case VK_F11: key = GLUT_KEY_F11; break; + case VK_F12: key = GLUT_KEY_F12; break; + /* directional keys */ + case VK_LEFT: key = GLUT_KEY_LEFT; break; + case VK_UP: key = GLUT_KEY_UP; break; + case VK_RIGHT: key = GLUT_KEY_RIGHT; break; + case VK_DOWN: key = GLUT_KEY_DOWN; break; + /* *INDENT-ON* */ + + case VK_PRIOR: + /* VK_PRIOR is Win32's Page Up */ + key = GLUT_KEY_PAGE_UP; + break; + case VK_NEXT: + /* VK_NEXT is Win32's Page Down */ + key = GLUT_KEY_PAGE_DOWN; + break; + case VK_HOME: + key = GLUT_KEY_HOME; + break; + case VK_END: + key = GLUT_KEY_END; + break; + case VK_INSERT: + key = GLUT_KEY_INSERT; + break; + case VK_DELETE: + goto handleDelete; + default: + goto defproc; + } + GetCursorPos(&point); + ScreenToClient(window->win, &point); + __glutSetWindow(window); + __glutModifierMask = 0; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ + __glutModifierMask |= ShiftMask; + if (GetKeyState(VK_CONTROL) < 0) + __glutModifierMask |= ControlMask; + if (GetKeyState(VK_MENU) < 0) + __glutModifierMask |= Mod1Mask; + window->special(key, point.x, point.y); + __glutModifierMask = (unsigned int) ~0; + } else if (window->keyboard) { + /* Specially handle any keys that match ASCII values but + do not generate Windows WM_SYSCHAR or WM_CHAR messages. */ + switch (wParam) { + case VK_DELETE: + handleDelete: + /* Delete is an ASCII character. */ + GetCursorPos(&point); + ScreenToClient(window->win, &point); + __glutSetWindow(window); + __glutModifierMask = 0; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ + __glutModifierMask |= ShiftMask; + if (GetKeyState(VK_CONTROL) < 0) + __glutModifierMask |= ControlMask; + if (GetKeyState(VK_MENU) < 0) + __glutModifierMask |= Mod1Mask; + window->keyboard((unsigned char) 127, point.x, point.y); + __glutModifierMask = (unsigned int) ~0; + return 0; + default: + /* Let the following WM_SYSCHAR or WM_CHAR message generate + the keyboard callback. */ + break; + } + } + return 0; + + case WM_LBUTTONDOWN: + button = GLUT_LEFT_BUTTON; + case WM_MBUTTONDOWN: + if (button < 0) + button = GLUT_MIDDLE_BUTTON; + case WM_RBUTTONDOWN: + if (button < 0) + button = GLUT_RIGHT_BUTTON; + + /* finish the menu if we get a button down message (user must have + cancelled the menu). */ + if (__glutMappedMenu) { + /* TODO: take this out once the menu on middle mouse stuff works + properly. */ + if (button == GLUT_MIDDLE_BUTTON) + return 0; + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + __glutItemSelected = NULL; + __glutFinishMenu(hwnd, point.x, point.y); + return 0; + } + + /* set the capture so we can get mouse events outside the window */ + SetCapture(hwnd); + + /* Win32 doesn't return the same numbers as X does when the mouse + goes beyond the upper or left side of the window. roll the + Win32's 0..2^16 pointer co-ord range to 0 +/- 2^15. */ + x = LOWORD(lParam); + y = HIWORD(lParam); + if(x & 1 << 15) x -= (1 << 16); + if(y & 1 << 15) y -= (1 << 16); + + window = __glutGetWindow(hwnd); + if (window) { + menu = __glutGetMenuByNum(window->menu[button]); + if (menu) { + point.x = LOWORD(lParam); point.y = HIWORD(lParam); + ClientToScreen(window->win, &point); + __glutMenuButton = button == GLUT_RIGHT_BUTTON ? TPM_RIGHTBUTTON : + button == GLUT_LEFT_BUTTON ? TPM_LEFTBUTTON : + 0x0001; + __glutStartMenu(menu, window, point.x, point.y, x, y); + } else if (window->mouse) { + + __glutSetWindow(window); + __glutModifierMask = 0; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on. */ + __glutModifierMask |= ShiftMask; + if (GetKeyState(VK_CONTROL) < 0) + __glutModifierMask |= ControlMask; + if (GetKeyState(VK_MENU) < 0) + __glutModifierMask |= Mod1Mask; + window->mouse(button, GLUT_DOWN, x, y); + __glutModifierMask = (unsigned int)~0; + } else { + /* Stray mouse events. Ignore. */ + } + } + return 0; + + case WM_LBUTTONUP: + button = GLUT_LEFT_BUTTON; + case WM_MBUTTONUP: + if (button < 0) + button = GLUT_MIDDLE_BUTTON; + case WM_RBUTTONUP: + if (button < 0) + button = GLUT_RIGHT_BUTTON; + + /* Bail out if we're processing a menu. */ + if (__glutMappedMenu) { + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + /* if we're getting the middle button up signal, then something + on the menu was selected. */ + if (button == GLUT_MIDDLE_BUTTON) { + return 0; + /* For some reason, the code below always returns -1 even + though the point IS IN THE ITEM! Therefore, just bail out if + we get a middle mouse up. The user must select using the + left mouse button. Stupid Win32. */ +#if 0 + int item = MenuItemFromPoint(hwnd, __glutHMenu, point); + if (item != -1) + __glutItemSelected = (GLUTmenuItem*)GetMenuItemID(__glutHMenu, item); + else + __glutItemSelected = NULL; + __glutFinishMenu(hwnd, point.x, point.y); +#endif + } else { + __glutItemSelected = NULL; + __glutFinishMenu(hwnd, point.x, point.y); + } + return 0; + } + + /* Release the mouse capture. */ + ReleaseCapture(); + + window = __glutGetWindow(hwnd); + if (window && window->mouse) { + /* Win32 doesn't return the same numbers as X does when the + mouse goes beyond the upper or left side of the window. roll + the Win32's 0..2^16 pointer co-ord range to 0 +/- 2^15. */ + x = LOWORD(lParam); + y = HIWORD(lParam); + if(x & 1 << 15) x -= (1 << 16); + if(y & 1 << 15) y -= (1 << 16); + + __glutSetWindow(window); + __glutModifierMask = 0; + if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ + __glutModifierMask |= ShiftMask; + if (GetKeyState(VK_CONTROL) < 0) + __glutModifierMask |= ControlMask; + if (GetKeyState(VK_MENU) < 0) + __glutModifierMask |= Mod1Mask; + window->mouse(button, GLUT_UP, x, y); + __glutModifierMask = (unsigned int)~0; + } else { + /* Window might have been destroyed and all the + events for the window may not yet be received. */ + } + return 0; + + case WM_ENTERMENULOOP: + /* KLUDGE: create a timer that fires every 100 ms when we start a + menu so that we can still process the idle & timer events (that + way, the timers will fire during a menu pick and so will the + idle func. */ + SetTimer(hwnd, 1, 1, NULL); + return 0; + + case WM_TIMER: +#if 0 + /* If the timer id is 2, then this is the timer that is set up in + the main glut message processing loop, and we don't want to do + anything but acknowledge that we got it. It is used to prevent + CPU spiking when an idle function is installed. */ + if (wParam == 2) + return 0; +#endif + + /* only worry about the idle function and the timeouts, since + these are the only events we expect to process during + processing of a menu. */ + /* we no longer process the idle functions (as outlined in the + README), since drawing can't be done until the menu has + finished...it's pretty lame when the animation goes on, but + doesn't update, so you get this weird jerkiness. */ +#if 0 + if (__glutIdleFunc) + __glutIdleFunc(); +#endif + if (__glutTimerList) + handleTimeouts(); + return 0; + + case WM_EXITMENULOOP: + /* nuke the above created timer...we don't need it anymore, since + the menu is gone now. */ + KillTimer(hwnd, 1); + return 0; + + case WM_MENUSELECT: + if (lParam != 0) + __glutHMenu = (HMENU)lParam; + return 0; + + case WM_COMMAND: + if (__glutMappedMenu) { + if (GetSubMenu(__glutHMenu, LOWORD(wParam))) + __glutItemSelected = NULL; + else + __glutItemSelected = + __glutGetUniqueMenuItem(__glutMappedMenu, LOWORD(wParam)); + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + __glutFinishMenu(hwnd, point.x, point.y); + } + return 0; + + case WM_MOUSEMOVE: + if (!__glutMappedMenu) { + window = __glutGetWindow(hwnd); + if (window) { + /* If motion function registered _and_ buttons held * + down, call motion function... */ + x = LOWORD(lParam); + y = HIWORD(lParam); + + /* Win32 doesn't return the same numbers as X does when the + mouse goes beyond the upper or left side of the window. + roll the Win32's 0..2^16 pointer co-ord range to 0..+/-2^15. */ + if(x & 1 << 15) x -= (1 << 16); + if(y & 1 << 15) y -= (1 << 16); + + if (window->motion && wParam & + (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { + __glutSetWindow(window); + window->motion(x, y); + } + /* If passive motion function registered _and_ + buttons not held down, call passive motion + function... */ + else if (window->passive && + ((wParam & + (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == + 0)) { + __glutSetWindow(window); + window->passive(x, y); + } + } + } else { + /* Motion events are thrown away when a pop up menu is + active. */ + } + return 0; + + case WM_GETMINMAXINFO: + /* this voodoo is brought to you by Win32 (again). It allows the + window to be bigger than the screen, and smaller than 100x100 + (although it doesn't seem to help the y minimum). */ + minmax = (LPMINMAXINFO)lParam; + minmax->ptMaxSize.x = __glutScreenWidth; + minmax->ptMaxSize.y = __glutScreenHeight; + minmax->ptMinTrackSize.x = 0; + minmax->ptMinTrackSize.y = 0; + minmax->ptMaxTrackSize.x = __glutScreenWidth + + GetSystemMetrics(SM_CXSIZE) * 2; + minmax->ptMaxTrackSize.y = __glutScreenHeight + + GetSystemMetrics(SM_CXSIZE) * 2 + GetSystemMetrics(SM_CYCAPTION); + return 0; + + case WM_SIZE: + window = __glutGetWindow(hwnd); + if (window) { + width = LOWORD(lParam); + height = HIWORD(lParam); + if (width != window->width || height != window->height) { +#if 0 /* Win32 GLUT does not support overlays for now. */ + if (window->overlay) { + XResizeWindow(__glutDisplay, window->overlay->win, width, height); + } +#endif + window->width = width; + window->height = height; + __glutSetWindow(window); + /* Do not execute OpenGL out of sequence with respect + to the SetWindowPos request! */ + GdiFlush(); + window->reshape(width, height); + window->forceReshape = FALSE; + /* A reshape should be considered like posting a + repair request. */ + __glutPostRedisplay(window, GLUT_REPAIR_WORK); + } + } + return 0; + + case WM_SETCURSOR: + /* If the cursor is not in the client area, then we want to send + this message to the default window procedure ('cause its + probably in the border or title, and we don't handle that + cursor. otherwise, set our cursor. Win32 makes us set the + cursor every time the mouse moves (DUMB!). */ + if(LOWORD(lParam) != HTCLIENT) { + goto defproc; + } + window = __glutGetWindow(hwnd); + if (window) { + __glutSetCursor(window); + } + /* TODO: check out the info in DevStudio on WM_SETCURSOR in the + DefaultAction section. */ + return 1; + + case WM_SETFOCUS: + window = __glutGetWindow(hwnd); + if (window) { + window->entryState = WM_SETFOCUS; + if (window->entry) { + __glutSetWindow(window); + window->entry(GLUT_ENTERED); + /* XXX Generation of fake passive notify? See how much + work the X11 code does to support fake passive notify + callbacks. */ + } + if (window->joystick && __glutCurrentWindow) { + if (__glutCurrentWindow->joyPollInterval > 0) { + MMRESULT result; + + /* Because Win32 will only let one window capture the + joystick at a time, we must capture it when we get the + focus and release it when we lose the focus. */ + result = joySetCapture(__glutCurrentWindow->win, + JOYSTICKID1, 0, TRUE); + if (result != JOYERR_NOERROR) { + return 0; + } + (void) joySetThreshold(JOYSTICKID1, + __glutCurrentWindow->joyPollInterval); + } + } + } + return 0; + + case WM_KILLFOCUS: + window = __glutGetWindow(hwnd); + if (window) { + window->entryState = WM_KILLFOCUS; + if (window->entry) { + __glutSetWindow(window); + window->entry(GLUT_LEFT); + } + if (window->joystick && __glutCurrentWindow) { + if (__glutCurrentWindow->joyPollInterval > 0) { + /* Because Win32 will only let one window capture the + joystick at a time, we must capture it when we get the + focus and release it when we lose the focus. */ + (void) joyReleaseCapture(JOYSTICKID1); + } + } + } + return 0; + case WM_ACTIVATE: + window = __glutGetWindow(hwnd); + /* Make sure we re-select the correct palette if needed. */ + if (LOWORD(wParam)) { + PostMessage(hwnd, WM_PALETTECHANGED, 0, 0); + } + if (window) { + int visState; + + /* HIWORD(wParam) is the minimized flag. */ + visState = !HIWORD(wParam); + updateWindowState(window, visState); + } + return 0; + + /* Colour Palette Management */ + case WM_PALETTECHANGED: + if (hwnd == (HWND)wParam) { + /* Don't respond to the message that we sent! */ + break; + } + /* fall through to WM_QUERYNEWPALETTE */ + + case WM_QUERYNEWPALETTE: + window = __glutGetWindow(hwnd); + if (window && window->colormap) { + UnrealizeObject(window->colormap->cmap); + SelectPalette(window->hdc, window->colormap->cmap, FALSE); + RealizePalette(window->hdc); + return TRUE; + } + return FALSE; + + case MM_JOY1MOVE: + case MM_JOY1ZMOVE: + window = __glutGetWindow(hwnd); + if (window->joystick) { + JOYINFOEX jix; + int x, y, z; + + /* Because WIN32 only supports messages for X, Y, and Z + translations, we must poll for the rest */ + jix.dwSize = sizeof(jix); + jix.dwFlags = JOY_RETURNALL; + joyGetPosEx(JOYSTICKID1,&jix); + +#define SCALE(v) ((int) ((v - 32767)/32.768)) + + /* Convert to integer for scaling. */ + x = jix.dwXpos; + y = jix.dwYpos; + z = jix.dwZpos; + window->joystick(jix.dwButtons, SCALE(x), SCALE(y), SCALE(z)); + + return TRUE; + } + return FALSE; + case MM_JOY1BUTTONDOWN: + case MM_JOY1BUTTONUP: + window = __glutGetWindow(hwnd); + if (window->joystick) { + JOYINFOEX jix; + + /* Because WIN32 only supports messages for X, Y, and Z + translations, we must poll for the rest */ + jix.dwSize = sizeof(jix); + jix.dwFlags = JOY_RETURNALL; + joyGetPosEx(JOYSTICKID1,&jix); + + return TRUE; + } + return FALSE; + +#if 0 + /* Miscellaneous messages (don't really need to enumerate them, + but it's good to know what you're not getting sometimes). */ + case WM_DISPLAYCHANGE: + break; + case WM_NCHITTEST: + /* This event is generated by every mouse move event. */ + goto defproc; + case WM_NCMOUSEMOVE: + goto defproc; + case WM_NCACTIVATE: + goto defproc; + case WM_NCPAINT: + goto defproc; + case WM_NCCALCSIZE: + goto defproc; + case WM_NCCREATE: + goto defproc; + case WM_NCDESTROY: + goto defproc; + case WM_NCLBUTTONDOWN: + goto defproc; + case WM_SETTEXT: + goto defproc; + case WM_GETTEXT: + goto defproc; + case WM_ACTIVATEAPP: + goto defproc; + case WM_GETICON: + goto defproc; + case WM_ERASEBKGND: + goto defproc; + case WM_WINDOWPOSCHANGING: + goto defproc; + case WM_WINDOWPOSCHANGED: + goto defproc; + case WM_MOUSEACTIVATE: + goto defproc; + case WM_SHOWWINDOW: + goto defproc; + case WM_MOVING: + goto defproc; + case WM_MOVE: + goto defproc; + case WM_KEYUP: + goto defproc; + case WM_CAPTURECHANGED: + goto defproc; + case WM_SYSCOMMAND: + goto defproc; + case WM_ENTERSIZEMOVE: + goto defproc; + case WM_ENTERIDLE: + goto defproc; +#endif + + default: + goto defproc; + } + +defproc: + return DefWindowProc(hwnd, msg, wParam, lParam); +} diff --git a/xc/extras/Mesa/src-glut/win32_x11.c b/xc/extras/Mesa/src-glut/win32_x11.c new file mode 100644 index 000000000..1d138cfa2 --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_x11.c @@ -0,0 +1,400 @@ + +/* Copyright (c) Nate Robins, 1997. */ +/* portions Copyright (c) Mark Kilgard, 1998. */ + +/* 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 "glutint.h" + +/* global variable that must be set for some functions to operate + correctly. */ +HDC XHDC; + +XVisualInfo* +XGetVisualInfo(Display* display, long mask, XVisualInfo* template, int* nitems) +{ + /* KLUDGE: this function needs XHDC to be set to the HDC currently + being operated on before it is invoked! */ + + PIXELFORMATDESCRIPTOR* pfds; + int i, n; + + n = DescribePixelFormat(XHDC, 0, 0, NULL); + pfds = (PIXELFORMATDESCRIPTOR*)malloc(sizeof(PIXELFORMATDESCRIPTOR) * n); + memset(pfds, 0, sizeof(PIXELFORMATDESCRIPTOR) * n); + + for (i = 0; i < n; i++) { + DescribePixelFormat(XHDC, i + 1, sizeof(PIXELFORMATDESCRIPTOR), &pfds[i]); + } + + *nitems = n; + return pfds; +} + +Colormap +XCreateColormap(Display* display, Window root, Visual* visual, int alloc) +{ + /* KLUDGE: this function needs XHDC to be set to the HDC currently + being operated on before it is invoked! */ + + PIXELFORMATDESCRIPTOR pfd; + LOGPALETTE *logical; + HPALETTE palette; + int n; + + /* grab the pixel format */ + memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); + DescribePixelFormat(XHDC, GetPixelFormat(XHDC), + sizeof(PIXELFORMATDESCRIPTOR), &pfd); + + if (!(pfd.dwFlags & PFD_NEED_PALETTE || + pfd.iPixelType == PFD_TYPE_COLORINDEX)) + { + return 0; + } + + n = 1 << pfd.cColorBits; + + /* allocate a bunch of memory for the logical palette (assume 256 + colors in a Win32 palette */ + logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + + sizeof(PALETTEENTRY) * n); + memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n); + + /* set the entries in the logical palette */ + logical->palVersion = 0x300; + logical->palNumEntries = n; + + /* start with a copy of the current system palette */ + GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]); + + if (pfd.iPixelType == PFD_TYPE_RGBA) { + int redMask = (1 << pfd.cRedBits) - 1; + int greenMask = (1 << pfd.cGreenBits) - 1; + int blueMask = (1 << pfd.cBlueBits) - 1; + int i; + + /* fill in an RGBA color palette */ + for (i = 0; i < n; ++i) { + logical->palPalEntry[i].peRed = + (((i >> pfd.cRedShift) & redMask) * 255) / redMask; + logical->palPalEntry[i].peGreen = + (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; + logical->palPalEntry[i].peBlue = + (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask; + logical->palPalEntry[i].peFlags = 0; + } + } + + palette = CreatePalette(logical); + free(logical); + + SelectPalette(XHDC, palette, FALSE); + RealizePalette(XHDC); + + return palette; +} + +void +XAllocColorCells(Display* display, Colormap colormap, Bool contig, + unsigned long plane_masks_return[], unsigned int nplanes, + unsigned long pixels_return[], unsigned int npixels) +{ + /* NOP -- we did all the allocating in XCreateColormap! */ +} + +void +XStoreColor(Display* display, Colormap colormap, XColor* color) +{ + /* KLUDGE: set XHDC to 0 if the palette should NOT be realized after + setting the color. set XHDC to the correct HDC if it should. */ + + PALETTEENTRY pe; + + /* X11 stores color from 0-65535, Win32 expects them to be 0-256, so + twiddle the bits ( / 256). */ + pe.peRed = color->red / 256; + pe.peGreen = color->green / 256; + pe.peBlue = color->blue / 256; + + /* make sure we use this flag, otherwise the colors might get mapped + to another place in the colormap, and when we glIndex() that + color, it may have moved (argh!!) */ + pe.peFlags = PC_NOCOLLAPSE; + + /* the pixel field of the XColor structure is the index into the + colormap */ + SetPaletteEntries(colormap, color->pixel, 1, &pe); + + if (XHDC) { + UnrealizeObject(colormap); + SelectPalette(XHDC, colormap, FALSE); + RealizePalette(XHDC); + } +} + +void +XSetWindowColormap(Display* display, Window window, Colormap colormap) +{ + HDC hdc = GetDC(window); + + /* if the third parameter is FALSE, the logical colormap is copied + into the device palette when the application is in the + foreground, if it is TRUE, the colors are mapped into the current + palette in the best possible way. */ + SelectPalette(hdc, colormap, FALSE); + RealizePalette(hdc); + + /* note that we don't have to release the DC, since our window class + uses the WC_OWNDC flag! */ +} + +Bool +XTranslateCoordinates(Display *display, Window src, Window dst, + int src_x, int src_y, + int* dest_x_return, int* dest_y_return, + Window* child_return) +{ + /* KLUDGE: this isn't really a translate coordinates into some other + windows coordinate system...it only translates coordinates into the + root window (screen) coordinate system. */ + + POINT point; + + point.x = src_x; + point.y = src_y; + + ClientToScreen(src, &point); + + *dest_x_return = point.x; + *dest_y_return = point.y; + + /* just to make compilers happy...we don't use the return value. */ + return True; +} + +Status +XGetGeometry(Display* display, Window window, Window* root_return, + int* x_return, int* y_return, + unsigned int* width_return, unsigned int* height_return, + unsigned int *border_width_return, unsigned int* depth_return) +{ + /* KLUDGE: doesn't return the border_width or depth or root, x & y + are in screen coordinates. */ + + RECT rect; + POINT point; + + GetClientRect(window, &rect); + + point.x = 0; + point.y = 0; + ClientToScreen(window, &point); + + *x_return = point.x; + *y_return = point.y; + *width_return = rect.right; + *height_return = rect.bottom; + + /* just to make compilers happy...we don't use the return value. */ + return 1; +} + +int +DisplayWidthMM(Display* display, int screen) +{ + int width; + HWND hwnd = GetDesktopWindow(); + HDC hdc = GetDC(hwnd); + + width = GetDeviceCaps(hdc, HORZSIZE); + + /* make sure to release this DC (it's the desktops, not ours) */ + ReleaseDC(hwnd, hdc); + + return width; +} + +int +DisplayHeightMM(Display* display, int screen) +{ + int height; + HWND hwnd = GetDesktopWindow(); + HDC hdc = GetDC(hwnd); + + height = GetDeviceCaps(hdc, VERTSIZE); + + /* make sure to release this DC (it's the desktops, not ours) */ + ReleaseDC(hwnd, hdc); + + return height; +} + +void +XWarpPointer(Display* display, Window src, Window dst, + int src_x, int src_y, int src_width, int src_height, + int dst_x, int dst_y) +{ + /* KLUDGE: this isn't really a warp pointer into some other windows + coordinate system...it only warps the pointer into the root window + (screen) coordinate system. */ + + POINT point; + + point.x = dst_x; + point.y = dst_y; + ClientToScreen(dst, &point); + + SetCursorPos(point.x, point.y); +} + +int +XPending(Display* display) +{ + /* similar functionality...I don't think that it is exact, but this + will have to do. */ + MSG msg; + + return PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); +} + +/* the following function was stolen from the X sources as indicated. */ + +/* Copyright Massachusetts Institute of Technology 1985, 1986, 1987 */ +/* $XConsortium: XParseGeom.c,v 11.18 91/02/21 17:23:05 rws Exp $ */ + +/* +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. M.I.T. makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. +*/ + +/* + * XParseGeometry parses strings of the form + * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where + * width, height, xoffset, and yoffset are unsigned integers. + * Example: "=80x24+300-49" + * The equal sign is optional. + * It returns a bitmask that indicates which of the four values + * were actually found in the string. For each value found, + * the corresponding argument is updated; for each value + * not found, the corresponding argument is left unchanged. + */ + +static int +ReadInteger(char *string, char **NextString) +{ + register int Result = 0; + int Sign = 1; + + if (*string == '+') + string++; + else if (*string == '-') + { + string++; + Sign = -1; + } + for (; (*string >= '0') && (*string <= '9'); string++) + { + Result = (Result * 10) + (*string - '0'); + } + *NextString = string; + if (Sign >= 0) + return (Result); + else + return (-Result); +} + +int XParseGeometry(char *string, int *x, int *y, unsigned int *width, unsigned int *height) +{ + int mask = NoValue; + register char *strind; + unsigned int tempWidth, tempHeight; + int tempX, tempY; + char *nextCharacter; + + if ( (string == NULL) || (*string == '\0')) return(mask); + if (*string == '=') + string++; /* ignore possible '=' at beg of geometry spec */ + + strind = (char *)string; + if (*strind != '+' && *strind != '-' && *strind != 'x') { + tempWidth = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= WidthValue; + } + + if (*strind == 'x' || *strind == 'X') { + strind++; + tempHeight = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= HeightValue; + } + + if ((*strind == '+') || (*strind == '-')) { + if (*strind == '-') { + strind++; + tempX = -ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= XNegative; + + } + else + { strind++; + tempX = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + } + mask |= XValue; + if ((*strind == '+') || (*strind == '-')) { + if (*strind == '-') { + strind++; + tempY = -ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + mask |= YNegative; + + } + else + { + strind++; + tempY = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + } + mask |= YValue; + } + } + + /* If strind isn't at the end of the string the it's an invalid + geometry specification. */ + + if (*strind != '\0') return (0); + + if (mask & XValue) + *x = tempX; + if (mask & YValue) + *y = tempY; + if (mask & WidthValue) + *width = tempWidth; + if (mask & HeightValue) + *height = tempHeight; + return (mask); +} diff --git a/xc/extras/Mesa/src-glut/win32_x11.h b/xc/extras/Mesa/src-glut/win32_x11.h new file mode 100644 index 000000000..bb4997731 --- /dev/null +++ b/xc/extras/Mesa/src-glut/win32_x11.h @@ -0,0 +1,319 @@ +#ifndef __win32_x11_h__ +#define __win32_x11_h__ + +/* Copyright (c) Nate Robins, 1997. */ + +/* 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 <stdlib.h> +#include <windows.h> + +/* Type definitions (conversions) */ +typedef int Visual; /* Win32 equivalent of X11 type */ +typedef HWND Window; +typedef HPALETTE Colormap; +typedef PIXELFORMATDESCRIPTOR XVisualInfo; +typedef BOOL Bool; +typedef MSG XEvent; +typedef HDC Display; +typedef HCURSOR Cursor; + +typedef int Atom; /* dummies */ +typedef int XDevice; +typedef int Status; + +#define True TRUE /* Win32 equivalents of X11 booleans */ +#define False FALSE + +#define None 0L /* universal null resource or null atom */ + +/* Input Event Masks. Used as event-mask window attribute and as arguments + to Grab requests. Not to be confused with event names. */ + +#define NoEventMask 0L +#define KeyPressMask (1L<<0) +#define KeyReleaseMask (1L<<1) +#define ButtonPressMask (1L<<2) +#define ButtonReleaseMask (1L<<3) +#define EnterWindowMask (1L<<4) +#define LeaveWindowMask (1L<<5) +#define PointerMotionMask (1L<<6) +#define PointerMotionHintMask (1L<<7) +#define Button1MotionMask (1L<<8) +#define Button2MotionMask (1L<<9) +#define Button3MotionMask (1L<<10) +#define Button4MotionMask (1L<<11) +#define Button5MotionMask (1L<<12) +#define ButtonMotionMask (1L<<13) +#define KeymapStateMask (1L<<14) +#define ExposureMask (1L<<15) +#define VisibilityChangeMask (1L<<16) +#define StructureNotifyMask (1L<<17) +#define ResizeRedirectMask (1L<<18) +#define SubstructureNotifyMask (1L<<19) +#define SubstructureRedirectMask (1L<<20) +#define FocusChangeMask (1L<<21) +#define PropertyChangeMask (1L<<22) +#define ColormapChangeMask (1L<<23) +#define OwnerGrabButtonMask (1L<<24) + +/* Key masks. Used as modifiers to GrabButton and GrabKey, results of + QueryPointer, state in various key-, mouse-, and button-related + events. */ + +#define ShiftMask (1<<0) +#define LockMask (1<<1) +#define ControlMask (1<<2) +#define Mod1Mask (1<<3) +#define Mod2Mask (1<<4) +#define Mod3Mask (1<<5) +#define Mod4Mask (1<<6) +#define Mod5Mask (1<<7) + +/* Window classes used by CreateWindow */ +/* Note that CopyFromParent is already defined as 0 above */ + +#define InputOutput 1 +#define InputOnly 2 + +/* Window attributes for CreateWindow and ChangeWindowAttributes */ + +#define CWBackPixmap (1L<<0) +#define CWBackPixel (1L<<1) +#define CWBorderPixmap (1L<<2) +#define CWBorderPixel (1L<<3) +#define CWBitGravity (1L<<4) +#define CWWinGravity (1L<<5) +#define CWBackingStore (1L<<6) +#define CWBackingPlanes (1L<<7) +#define CWBackingPixel (1L<<8) +#define CWOverrideRedirect (1L<<9) +#define CWSaveUnder (1L<<10) +#define CWEventMask (1L<<11) +#define CWDontPropagate (1L<<12) +#define CWColormap (1L<<13) +#define CWCursor (1L<<14) + +/* ConfigureWindow structure */ + +#define CWX (1<<0) +#define CWY (1<<1) +#define CWWidth (1<<2) +#define CWHeight (1<<3) +#define CWBorderWidth (1<<4) +#define CWSibling (1<<5) +#define CWStackMode (1<<6) + + +/* Used in GetWindowAttributes reply */ + +#define IsUnmapped 0 +#define IsUnviewable 1 +#define IsViewable 2 + +/* Window stacking method (in configureWindow) */ + +#define Above 0 +#define Below 1 +#define TopIf 2 +#define BottomIf 3 +#define Opposite 4 + +/* For CreateColormap */ + +#define AllocNone 0 /* create map with no entries */ +#define AllocAll 1 /* allocate entire map writeable */ + + +/* Flags used in StoreNamedColor, StoreColors */ + +#define DoRed (1<<0) +#define DoGreen (1<<1) +#define DoBlue (1<<2) + +/* + * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding + * value (x, y, width, height) was found in the parsed string. + */ +#define NoValue 0x0000 +#define XValue 0x0001 +#define YValue 0x0002 +#define WidthValue 0x0004 +#define HeightValue 0x0008 +#define AllValues 0x000F +#define XNegative 0x0010 +#define YNegative 0x0020 + +/* flags argument in size hints */ +#define USPosition (1L << 0) /* user specified x, y */ +#define USSize (1L << 1) /* user specified width, height */ + +/* definitions for initial window state */ +#define WithdrawnState 0 /* for windows that are not mapped */ +#define NormalState 1 /* most applications want to start this way */ +#define IconicState 3 /* application wants to start as an icon */ +#define GameModeState 4 /* Win32 GLUT only (not in Xlib!). */ + +/* Type definitions */ + +typedef struct { + unsigned int background_pixmap; /* background pixmap */ + unsigned long background_pixel; /* background pixel */ + unsigned long border_pixel; /* border pixel value */ + long event_mask; /* set of events that should be saved */ + long do_not_propagate_mask; /* set of events that should not propagate */ + Bool override_redirect; /* boolean value for override-redirect */ + Colormap colormap; /* color map to be associated with window */ +} XSetWindowAttributes; + +typedef struct { + unsigned long pixel; + unsigned short red, green, blue; + char flags; /* do_red, do_green, do_blue */ +} XColor; + +typedef struct { + unsigned char *value; /* same as Property routines */ + Atom encoding; /* prop type */ + int format; /* prop data format: 8, 16, or 32 */ + unsigned long nitems; /* number of data items in value */ +} XTextProperty; + +typedef struct { + long flags; /* marks which fields in this structure are defined */ + int x, y; /* obsolete for new window mgrs, but clients */ + int width, height; /* should set so old wm's don't mess up */ +} XSizeHints; + +/* Functions emulated by macros. */ + +#define XFreeColormap(display, colormap) \ + DeleteObject(colormap) + +#define XCreateFontCursor(display, shape) \ + LoadCursor(NULL, shape) + +#define XDefineCursor(display, window, cursor) \ + SetCursor(cursor) + +#define XFlush(display) \ + /* Nothing. */ + +#define DisplayWidth(display, screen) \ + GetSystemMetrics(SM_CXSCREEN) + +#define DisplayHeight(display, screen) \ + GetSystemMetrics(SM_CYSCREEN) + +#define XMapWindow(display, window) \ + ShowWindow(window, SW_SHOWNORMAL) + +#define XUnmapWindow(display, window) \ + ShowWindow(window, SW_HIDE) + +#define XIconifyWindow(display, window, screen) \ + ShowWindow(window, SW_MINIMIZE) + +#define XWithdrawWindow(display, window, screen) \ + ShowWindow(window, SW_HIDE) + +#define XLowerWindow(display, window) \ + SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) + +#define XSetWMName(display, window, tp) \ + SetWindowText(window, (tp)->value) + +/* There really isn't a way to set the icon name separate from the + windows name in Win32, so, just set the windows name. */ +#define XSetWMIconName(display, window, tp) \ + XSetWMName(display, window, tp) + +#define XDestroyWindow(display, window) \ + DestroyWindow(window) + +/* Anything that needs to be freed was allocated with malloc in our + fake X windows library for Win32, so free it with plain old + free(). */ +#define XFree(data) \ + free(data) + +/* Nothing to be done for this...the pointer is always 'ungrabbed' + in Win32. */ +#define XUngrabPointer(display, time) \ + /* Nothing. */ + +/* Function prototypes. */ + +extern XVisualInfo* XGetVisualInfo( + Display* display, + long mask, + XVisualInfo* ttemplate, /* Avoid class with C++ keyword. */ + int*nitems); + +extern Colormap XCreateColormap( + Display* display, + Window root, + Visual* visual, + int alloc); + +extern void XAllocColorCells( + Display* display, + Colormap colormap, + Bool contig, + unsigned long plane_masks_return[], + unsigned int nplanes, + unsigned long pixels_return[], + unsigned int npixels); + +extern void XStoreColor( + Display* display, + Colormap colormap, + XColor* color); + +extern void XSetWindowColormap( + Display* display, + Window window, + Colormap colormap); + +extern Bool XTranslateCoordinates( + Display *display, + Window src, Window dst, + int src_x, int src_y, + int* dest_x_return, int* dest_y_return, + Window* child_return); + +extern Status XGetGeometry( + Display* display, + Window window, + Window* root_return, + int* x_return, int* y_return, + unsigned int* width_return, unsigned int* height_return, + unsigned int *border_width_return, + unsigned int* depth_return); + +extern int DisplayWidthMM( + Display* display, + int screen); + +extern int DisplayHeightMM( + Display* display, + int screen); + +extern void XWarpPointer( + Display* display, + Window src, Window dst, + int src_x, int src_y, + int src_width, int src_height, + int dst_x, int dst_y); + +extern int XParseGeometry( + char* string, + int* x, int* y, + unsigned int* width, unsigned int* height); + +extern int XPending( + Display* display); + +#endif /* __win32_x11_h__ */ diff --git a/xc/extras/Mesa/src/.cvsignore b/xc/extras/Mesa/src/.cvsignore new file mode 100644 index 000000000..b7c80bebb --- /dev/null +++ b/xc/extras/Mesa/src/.cvsignore @@ -0,0 +1,9 @@ +.deps +.libs +Makefile.in +*.lo +*.o +*.la +profile +mesasyms +depend diff --git a/xc/extras/Mesa/src/BeOS/Makefile.am b/xc/extras/Mesa/src/BeOS/Makefile.am new file mode 100644 index 000000000..1a4878452 --- /dev/null +++ b/xc/extras/Mesa/src/BeOS/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src + +if HAVE_BEOS +# Build a libtool convenience library. +noinst_LTLIBRARIES = libMesaBeOS.la +endif + +libMesaBeOS_la_SOURCES = GLView.cpp + +libMesaBeOS_la_LIBADD = diff --git a/xc/extras/Mesa/src/FX/.cvsignore b/xc/extras/Mesa/src/FX/.cvsignore new file mode 100644 index 000000000..8447f87e7 --- /dev/null +++ b/xc/extras/Mesa/src/FX/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile.in +*.lo +*.o +*.la diff --git a/xc/extras/Mesa/src/FX/Makefile.am b/xc/extras/Mesa/src/FX/Makefile.am index c852d92ec..8d08efa3e 100644 --- a/xc/extras/Mesa/src/FX/Makefile.am +++ b/xc/extras/Mesa/src/FX/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src $(FX_CFLAGS) diff --git a/xc/extras/Mesa/src/FX/X86/.cvsignore b/xc/extras/Mesa/src/FX/X86/.cvsignore new file mode 100644 index 000000000..8ca7ed2e8 --- /dev/null +++ b/xc/extras/Mesa/src/FX/X86/.cvsignore @@ -0,0 +1 @@ +fx_regoff.h diff --git a/xc/extras/Mesa/src/FX/X86/Makefile.am b/xc/extras/Mesa/src/FX/X86/Makefile.am index cb28ae9d5..3564a9def 100644 --- a/xc/extras/Mesa/src/FX/X86/Makefile.am +++ b/xc/extras/Mesa/src/FX/X86/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src $(FX_CFLAGS) diff --git a/xc/extras/Mesa/src/FX/fxcva.c b/xc/extras/Mesa/src/FX/fxcva.c index 188210add..44c15c5aa 100644 --- a/xc/extras/Mesa/src/FX/fxcva.c +++ b/xc/extras/Mesa/src/FX/fxcva.c @@ -395,7 +395,11 @@ void fxDDCheckMergeAndRender( GLcontext *ctx, struct gl_pipeline_stage *d ) GLuint inputs = ctx->RenderFlags & ~ctx->CVA.pre.outputs; if (!(ctx->TriangleCaps & DD_TRI_UNFILLED) && +#ifdef VAO + (ctx->Array.Current->Summary & VERT_OBJ_ANY)) +#else (ctx->Array.Summary & VERT_OBJ_ANY)) +#endif { d->inputs = (VERT_SETUP_PART | VERT_ELT | inputs); d->outputs = 0; diff --git a/xc/extras/Mesa/src/FX/fxdrv.h b/xc/extras/Mesa/src/FX/fxdrv.h index c85c73d8e..19c0d6bab 100644 --- a/xc/extras/Mesa/src/FX/fxdrv.h +++ b/xc/extras/Mesa/src/FX/fxdrv.h @@ -274,7 +274,7 @@ typedef struct { } tfxMipMapLevel; typedef struct tfxTexInfo_t { - struct tfxTexInfo *next; + struct tfxTexInfo_t *next; struct gl_texture_object *tObj; GLuint lastTimeUsed; diff --git a/xc/extras/Mesa/src/FX/fxpipeline.c b/xc/extras/Mesa/src/FX/fxpipeline.c index cf4c9ebbc..e7821fa56 100644 --- a/xc/extras/Mesa/src/FX/fxpipeline.c +++ b/xc/extras/Mesa/src/FX/fxpipeline.c @@ -217,7 +217,11 @@ GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ) if (fxMesa->is_in_hardware && fxMesa->render_index == 0 && (ctx->Enabled & ILLEGAL_ENABLES) == 0 && +#ifdef VAO + (ctx->Array.Current->Flags & (VERT_OBJ_234| +#else (ctx->Array.Flags & (VERT_OBJ_234| +#endif VERT_TEX0_4| VERT_TEX1_4| VERT_ELT)) == (VERT_OBJ_23|VERT_ELT)) @@ -236,6 +240,7 @@ GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ) if (fxMesa->using_fast_path) { +#if 0 if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_DRIVER)) fprintf(stderr, "fxMesa: fall back to full pipeline %x %x %x %x %x\n", fxMesa->is_in_hardware, @@ -243,11 +248,16 @@ GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ) (ctx->Enabled & ILLEGAL_ENABLES), (ctx->Array.Summary & (VERT_OBJ_23)), (ctx->Array.Summary & (VERT_OBJ_4|VERT_TEX0_4|VERT_TEX1_4))); +#endif fxMesa->using_fast_path = 0; ctx->CVA.VB->ClipOrMask = 0; ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS; +#ifdef VAO + ctx->Array.NewArrayState |= ctx->Array.Current->Summary; +#else ctx->Array.NewArrayState |= ctx->Array.Summary; +#endif return 0; } @@ -272,7 +282,11 @@ void fxDDOptimizePrecalcPipeline( GLcontext *ctx, struct gl_pipeline *pipe ) if (fxMesa->is_in_hardware && fxMesa->render_index == 0 && (ctx->Enabled & ILLEGAL_ENABLES) == 0 && +#ifdef VAO + (ctx->Array.Current->Summary & VERT_ELT)) +#else (ctx->Array.Summary & VERT_ELT)) +#endif { pipe->stages[0] = &fx_fast_stage; pipe->stages[1] = 0; diff --git a/xc/extras/Mesa/src/FX/fxrender.c b/xc/extras/Mesa/src/FX/fxrender.c index 5935998f8..b07a67ce7 100644 --- a/xc/extras/Mesa/src/FX/fxrender.c +++ b/xc/extras/Mesa/src/FX/fxrender.c @@ -215,7 +215,7 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, #define RENDER_POINTS( start, count ) \ (void) gWin; \ (void) VB; \ - (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count-1 ) + (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count ) #define RENDER_LINE( i1, i ) \ do { \ @@ -278,7 +278,7 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, #define RENDER_POINTS( start, count ) \ (void) gWin; \ (void) cullmask; \ - (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count-1 ) + (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count ) #define RENDER_LINE( i1, i ) \ @@ -376,7 +376,7 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ GLubyte *clipmask = VB->ClipMask; \ GLuint i; \ - for (i = start ; i <= count ; i++) \ + for (i = start ; i < count ; i++) \ if (clipmask[i] == 0) { \ RVB_COLOR(i); \ FX_grDrawPoint( (GrVertex *)gWin[i].f );\ @@ -435,7 +435,7 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ GLuint e; \ GLubyte *clipmask = VB->ClipMask; \ - for(e=start;e<=count;e++) \ + for(e=start;e<count;e++) \ if(clipmask[elt[e]]==0) { \ FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \ } \ @@ -482,7 +482,7 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ GLuint e; \ GLubyte *clipmask = VB->ClipMask; \ - for(e=start;e<=count;e++) \ + for(e=start;e<count;e++) \ if(clipmask[elt[e]]==0) { \ FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \ } \ @@ -532,7 +532,7 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, #define RENDER_POINTS( start, count ) \ do { \ GLuint e; \ - for(e=start;e<=count;e++) { \ + for(e=start;e<count;e++) { \ FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \ } \ } while (0) diff --git a/xc/extras/Mesa/src/FX/fxvsetup.c b/xc/extras/Mesa/src/FX/fxvsetup.c index 5b075f404..e8207a37a 100644 --- a/xc/extras/Mesa/src/FX/fxvsetup.c +++ b/xc/extras/Mesa/src/FX/fxvsetup.c @@ -378,7 +378,11 @@ void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) /* Indirect triangles must be rendered via the immediate pipeline. * If all rasterization is software, no need to set up. */ +#ifdef VAO + if ((ctx->Array.Current->Summary & VERT_OBJ_ANY) == 0) +#else if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) +#endif return; if ((ctx->IndirectTriangles & DD_SW_SETUP) || @@ -386,7 +390,11 @@ void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) return; if ((ctx->Texture.ReallyEnabled & 0xf) && +#ifdef VAO + !(ctx->Array.Current->Flags & VERT_TEX0_ANY)) +#else !(ctx->Array.Flags & VERT_TEX0_ANY)) +#endif { if (ctx->TextureMatrix[0].type == MATRIX_GENERAL || ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE || @@ -397,7 +405,11 @@ void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) } if ((ctx->Texture.ReallyEnabled & 0xf0) && +#ifdef VAO + !(ctx->Array.Current->Flags & VERT_TEX1_ANY)) +#else !(ctx->Array.Flags & VERT_TEX1_ANY)) +#endif { if (ctx->TextureMatrix[1].type == MATRIX_GENERAL || ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE || @@ -420,27 +432,27 @@ void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) */ void fxDDPartialRasterSetup( struct vertex_buffer *VB ) { - GLuint new = VB->pipeline->new_outputs; + GLuint newOut = VB->pipeline->new_outputs; fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; GLuint ind = 0; FX_DRIVER_DATA(VB)->last_vert = FX_DRIVER_DATA(VB)->verts + VB->Count; - if (new & VERT_WIN) { - new = VB->pipeline->outputs; + if (newOut & VERT_WIN) { + newOut = VB->pipeline->outputs; ind |= SETUP_XY|SETUP_W|SETUP_Z; } - if (new & VERT_TEX0_ANY) + if (newOut & VERT_TEX0_ANY) ind |= SETUP_W | fxMesa->tex_dest[0]; - if (new & VERT_TEX1_ANY) + if (newOut & VERT_TEX1_ANY) ind |= SETUP_W | fxMesa->tex_dest[1]; - if (new & VERT_RGBA) + if (newOut & VERT_RGBA) ind |= SETUP_W|SETUP_RGBA; - if ((new & VERT_WIN) == 0) + if ((newOut & VERT_WIN) == 0) ind &= ~(fxMesa->setupdone & SETUP_W); fxMesa->setupdone &= ~ind; diff --git a/xc/extras/Mesa/src/Imakefile b/xc/extras/Mesa/src/Imakefile new file mode 100644 index 000000000..443e83c8f --- /dev/null +++ b/xc/extras/Mesa/src/Imakefile @@ -0,0 +1,126 @@ +#define DoNormalLib NO
+#define DoSharedLib YES
+#define DoDebugLib NO
+#define DoProfileLib NO
+#define LibName MESAGL
+#define SoRev SOX11REV
+#define LibHeaders NO
+
+#include <Threads.tmpl>
+
+REQUIREDLIBS = $(X11ROOT)\\XFree86\\lib\\ Xext X11
+BUILDLIBDIR = $(TOP)\\lib
+
+INCLUDES = -I$(TOP)\\include
+
+SRCS = \
+accum.c \
+alpha.c \
+alphabuf.c \
+api1.c \
+api2.c \
+attrib.c \
+bitmap.c \
+blend.c \
+bresenhm.c \
+clip.c \
+context.c \
+copypix.c \
+dd.c \
+depth.c \
+draw.c \
+drawpix.c \
+enable.c \
+eval2.c \
+feedback.c \
+fog.c \
+fortran.c \
+get.c \
+hash.c \
+glx.c \
+interp.c \
+light.c \
+lines.c \
+list.c \
+logic.c \
+masking.c \
+misc.c \
+osmesa.c \
+pb.c \
+pixel.c \
+points.c \
+polygons.c \
+readpix.c \
+scissor.c \
+span.c \
+stencil.c \
+svgamesa.c \
+texture.c \
+varray.c \
+vb.c \
+vertex.c \
+xfonts.c \
+xform.c \
+xmesa1.c \
+xmesa2.c \
+xmesa3.c
+
+OBJS = \
+accum.o \
+alpha.o \
+alphabuf.o \
+api1.o \
+api2.o \
+attrib.o \
+bitmap.o \
+blend.o \
+bresenhm.o \
+clip.o \
+context.o \
+copypix.o \
+dd.o \
+depth.o \
+draw.o \
+drawpix.o \
+enable.o \
+eval2.o \
+feedback.o \
+fog.o \
+fortran.o \
+get.o \
+hash.o \
+glx.o \
+interp.o \
+light.o \
+lines.o \
+list.o \
+logic.o \
+masking.o \
+misc.o \
+osmesa.o \
+pb.o \
+pixel.o \
+points.o \
+polygons.o \
+readpix.o \
+scissor.o \
+span.o \
+stencil.o \
+svgamesa.o \
+texture.o \
+varray.o \
+vb.o \
+vertex.o \
+xfonts.o \
+xform.o \
+xmesa1.o \
+xmesa2.o \
+xmesa3.o
+xmesa4.o
+
+LINTLIBS =
+
+#include <Library.tmpl>
+
+DependTarget()
+
diff --git a/xc/extras/Mesa/src/Makefile.BeOS-R4 b/xc/extras/Mesa/src/Makefile.BeOS-R4 index 280198e15..67ac3bd0b 100755 --- a/xc/extras/Mesa/src/Makefile.BeOS-R4 +++ b/xc/extras/Mesa/src/Makefile.BeOS-R4 @@ -1,9 +1,9 @@ -# $Id: Makefile.BeOS-R4,v 1.1.1.1 2000/11/30 17:31:31 dawes Exp $ +# $Id: Makefile.BeOS-R4,v 1.1.1.2 2000/12/05 16:38:39 dawes Exp $ # Mesa 3-D graphics library -# Version: 3.3 +# Version: 3.4 # -# Copyright (C) 1999 Brian Paul All Rights Reserved. +# Copyright (C) 1999-2000 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"), @@ -98,6 +98,7 @@ CORE_SOURCES = \ teximage.c \ texobj.c \ texstate.c \ + texture.c \ texutil.c \ translate.c \ triangle.c \ @@ -114,6 +115,7 @@ CORE_SOURCES = \ xform.c \ zoom.c + DRIVER_SOURCES = OSmesa/osmesa.c BeOS/GLView.cpp OBJECTS = $(CORE_SOURCES:.c=.o) OSmesa/osmesa.o BeOS/GLView.o diff --git a/xc/extras/Mesa/src/Makefile.am b/xc/extras/Mesa/src/Makefile.am index c23549e21..45642a080 100644 --- a/xc/extras/Mesa/src/Makefile.am +++ b/xc/extras/Mesa/src/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies INCLUDES = -I$(top_srcdir)/include diff --git a/xc/extras/Mesa/src/OSmesa/.cvsignore b/xc/extras/Mesa/src/OSmesa/.cvsignore new file mode 100644 index 000000000..dcae4aa9c --- /dev/null +++ b/xc/extras/Mesa/src/OSmesa/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +*.la diff --git a/xc/extras/Mesa/src/OSmesa/Makefile.am b/xc/extras/Mesa/src/OSmesa/Makefile.am index 9f71106c5..1ff552057 100644 --- a/xc/extras/Mesa/src/OSmesa/Makefile.am +++ b/xc/extras/Mesa/src/OSmesa/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c index 4cc3e29d5..09e6ed0e9 100644 --- a/xc/extras/Mesa/src/OSmesa/osmesa.c +++ b/xc/extras/Mesa/src/OSmesa/osmesa.c @@ -102,7 +102,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist ) OSMesaContext osmesa; GLint rshift, gshift, bshift, ashift; GLint rind, gind, bind; - GLint indexBits, alphaBits; + GLint indexBits, alphaBits = 0; GLboolean rgbmode; GLboolean swalpha; GLuint i4 = 1; diff --git a/xc/extras/Mesa/src/X/.cvsignore b/xc/extras/Mesa/src/X/.cvsignore new file mode 100644 index 000000000..dcae4aa9c --- /dev/null +++ b/xc/extras/Mesa/src/X/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +*.la diff --git a/xc/extras/Mesa/src/X/Makefile.am b/xc/extras/Mesa/src/X/Makefile.am index bae8b2379..f0d65fd8f 100644 --- a/xc/extras/Mesa/src/X/Makefile.am +++ b/xc/extras/Mesa/src/X/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src $(X_CFLAGS) $(FX_CFLAGS) diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index a20f52f3f..6c9f04aee 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -22,7 +22,7 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/X/fakeglx.c,v 1.8 2000/11/13 21:55:37 dawes Exp $ */ + /* * This is an emulation of the GLX API which allows Mesa/GLX-based programs @@ -560,7 +560,7 @@ static XVisualInfo *choose_x_visual( Display *dpy, int screen, int preferred_class ) { XVisualInfo *vis; - int xclass, visclass; + int xclass, visclass = 0; int depth; if (rgba) { @@ -1862,7 +1862,7 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) { int size = sizeof(struct _glxapi_table) / sizeof(void *); (void) size; - assert(_glxapi_get_dispatch_table_size() >= size); + assert((GLint) _glxapi_get_dispatch_table_size() >= size); } /* initialize the whole table to no-ops */ diff --git a/xc/extras/Mesa/src/X/xfonts.c b/xc/extras/Mesa/src/X/xfonts.c index 9b1148db9..b56d2471a 100644 --- a/xc/extras/Mesa/src/X/xfonts.c +++ b/xc/extras/Mesa/src/X/xfonts.c @@ -179,7 +179,7 @@ fill_bitmap (Display *dpy, Window win, GC gc, static XCharStruct *isvalid(XFontStruct *fs, int which) { unsigned int rows,pages; - int byte1,byte2; + int byte1 = 0,byte2 = 0; int i,valid = 1; rows = fs->max_byte1 - fs->min_byte1 + 1; diff --git a/xc/extras/Mesa/src/X/xmesa3.c b/xc/extras/Mesa/src/X/xmesa3.c index 51265944c..ca8912718 100644 --- a/xc/extras/Mesa/src/X/xmesa3.c +++ b/xc/extras/Mesa/src/X/xmesa3.c @@ -61,7 +61,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, GLuint first, GLuint last ) if (xmesa->xm_visual->gl_visual->RGBAflag) { /* RGB mode */ - for (i=first;i<=last;i++) { + for (i=first;i<last;i++) { if (VB->ClipMask[i]==0) { register int x, y; const GLubyte *color = VB->ColorPtr->data[i]; diff --git a/xc/extras/Mesa/src/X86/.cvsignore b/xc/extras/Mesa/src/X86/.cvsignore new file mode 100644 index 000000000..dcae4aa9c --- /dev/null +++ b/xc/extras/Mesa/src/X86/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +*.la diff --git a/xc/extras/Mesa/src/X86/3dnow.c b/xc/extras/Mesa/src/X86/3dnow.c index 7b642dc04..e52809493 100644 --- a/xc/extras/Mesa/src/X86/3dnow.c +++ b/xc/extras/Mesa/src/X86/3dnow.c @@ -30,6 +30,7 @@ #include "glheader.h" #include "context.h" +#include "shade.h" #include "types.h" #include "vertices.h" #include "xform.h" @@ -170,6 +171,18 @@ void gl_init_3dnow_transform_asm( void ) #endif } +void gl_init_3dnow_shade_asm( void ) +{ +#ifdef USE_3DNOW_ASM + /* When the time comes, initialize optimized lighting here. + */ + +#if 0 + gl_test_all_shade_functions( "3DNow!" ); +#endif +#endif +} + void gl_init_3dnow_vertex_asm( void ) { #ifdef USE_3DNOW_ASM diff --git a/xc/extras/Mesa/src/X86/3dnow.h b/xc/extras/Mesa/src/X86/3dnow.h index 6e34b6ce4..a65c51060 100644 --- a/xc/extras/Mesa/src/X86/3dnow.h +++ b/xc/extras/Mesa/src/X86/3dnow.h @@ -31,9 +31,8 @@ #ifndef __3DNOW_H__ #define __3DNOW_H__ -#include "xform.h" - void gl_init_3dnow_transform_asm( void ); +void gl_init_3dnow_shade_asm( void ); void gl_init_3dnow_vertex_asm( void ); #endif diff --git a/xc/extras/Mesa/src/X86/Makefile.am b/xc/extras/Mesa/src/X86/Makefile.am index d4d4f2ebd..96c377198 100644 --- a/xc/extras/Mesa/src/X86/Makefile.am +++ b/xc/extras/Mesa/src/X86/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies x3dnow_files = \ 3dnow.c \ diff --git a/xc/extras/Mesa/src/X86/common_x86.c b/xc/extras/Mesa/src/X86/common_x86.c index 68b7403c2..d64484d52 100644 --- a/xc/extras/Mesa/src/X86/common_x86.c +++ b/xc/extras/Mesa/src/X86/common_x86.c @@ -53,6 +53,108 @@ static void message( const char *msg ) } } +#if defined(USE_KATMAI_ASM) && defined(__linux__) +/* + * GH: This is a hack. Try to determine at runtime what version of the + * Linux kernel we're running on, and disable the SSE assembly if the + * kernel is too old and doesn't correctly support the code. + * + * Magic versions tested for are: + * + * - 2.2.18-pre19 and newer + * - 2.4.0-test11 and newer + * + * If we find a version older than this, or can't correctly determine + * the version, disable the code to be safe. + */ +static void verify_linux_kernel_version( void ) +{ + FILE *fd; + int major, minor, teeny, extra; + int use_sse = 0; + int ret; + + fd = fopen( "/proc/sys/kernel/osrelease", "r" ); + if ( fd == NULL ) { + /* If we can't test the kernel version, disable the code. + */ + message( "couldn't open /proc/sys/kernel/osrelease, disabling SSE." ); + gl_x86_cpu_features &= ~(X86_FEATURE_XMM); + return; + } + + fscanf( fd, "%d.%d.%d", &major, &minor, &teeny ); + + if ( major == 2 ) { + if ( minor == 2 ) { + /* Test 2.2 kernel versions. 2.2.18-pre19 and newer are okay. + */ + if ( teeny == 18 ) { + ret = fscanf( fd, "-pre%d", &extra ); + switch ( ret ) { + case 1: + if ( extra >= 19 ) { + message( "kernel 2.2.18-pre19 or newer, enabling SSE." ); + use_sse = 1; + } else { + message( "kernel older than 2.2.18-pre19, disabling SSE." ); + } + break; + case 0: + message( "kernel 2.2.18 or newer, enabling SSE." ); + use_sse = 1; + break; + } + } else if ( teeny > 18 ) { + message( "kernel 2.2.19 or newer, enabling SSE." ); + use_sse = 1; + } else { + message( "kernel older than 2.2.18, disabling SSE." ); + } + + } else if ( minor == 3 ) { + message( "kernel older than 2.4.0-test11, disabling SSE." ); + } else if ( minor == 4 ) { + /* Test 2.4 kernel versions. 2.4.0-test11 and newer are okay. + */ + if ( teeny == 0 ) { + ret = fscanf( fd, "-test%d", &extra ); + switch ( ret ) { + case 1: + if ( extra >= 11 ) { + message( "kernel 2.4.0-test11 or newer, enabling SSE." ); + use_sse = 1; + } else { + message( "kernel older than 2.4.0-test11, disabling SSE." ); + } + break; + case 0: + message( "kernel 2.4.0 or newer, enabling SSE." ); + use_sse = 1; + break; + } + } else if ( teeny > 0 ) { + message( "kernel 2.4.1 or newer, enabling SSE." ); + use_sse = 1; + } + } else if ( minor >= 5 ) { + /* This test should be removed eventually, but cover ourselves + * just in case. + */ + message( "kernel 2.5.0 or newer, enabling SSE." ); + use_sse = 1; + } else { + message( "kernel older than 2.2.18-pre19, disabling SSE." ); + } + } + + fclose( fd ); + + if ( !use_sse ) { + gl_x86_cpu_features &= ~(X86_FEATURE_XMM); + } +} +#endif void gl_init_all_x86_transform_asm( void ) { @@ -89,6 +191,12 @@ void gl_init_all_x86_transform_asm( void ) #endif #ifdef USE_KATMAI_ASM +#ifdef __linux__ + /* HACK: Check the version of the Linux kernel we're being run on, + * and disable 'cpu_has_xmm' if user-space SSE is not supported. + */ + verify_linux_kernel_version(); +#endif if ( cpu_has_xmm ) { if ( getenv( "MESA_NO_KATMAI" ) == 0 ) { message( "Katmai cpu detected." ); @@ -104,6 +212,21 @@ void gl_init_all_x86_transform_asm( void ) /* Note: the above function must be called before this one, so that * gl_x86_cpu_features gets correctly initialized. */ +void gl_init_all_x86_shade_asm( void ) +{ +#ifdef USE_X86_ASM + if ( gl_x86_cpu_features ) { + /* Nothing here yet... */ + } + +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow && getenv( "MESA_NO_3DNOW" ) == 0 ) { + gl_init_3dnow_shade_asm(); + } +#endif +#endif +} + void gl_init_all_x86_vertex_asm( void ) { #ifdef USE_X86_ASM diff --git a/xc/extras/Mesa/src/X86/common_x86_asm.h b/xc/extras/Mesa/src/X86/common_x86_asm.h index f781d503e..cf1116f8d 100644 --- a/xc/extras/Mesa/src/X86/common_x86_asm.h +++ b/xc/extras/Mesa/src/X86/common_x86_asm.h @@ -57,6 +57,7 @@ extern int gl_x86_cpu_features; extern void gl_init_all_x86_transform_asm( void ); +extern void gl_init_all_x86_shade_asm( void ); extern void gl_init_all_x86_vertex_asm( void ); #endif diff --git a/xc/extras/Mesa/src/X86/katmai.c b/xc/extras/Mesa/src/X86/katmai.c index ec40bd6db..d0aa79e27 100644 --- a/xc/extras/Mesa/src/X86/katmai.c +++ b/xc/extras/Mesa/src/X86/katmai.c @@ -22,7 +22,6 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/X86/katmai.c,v 1.6 2000/11/13 23:31:11 dawes Exp $ */ /* * PentiumIII-SIMD (SSE) optimizations contributed by diff --git a/xc/extras/Mesa/src/X86/katmai.h b/xc/extras/Mesa/src/X86/katmai.h index 0deeb629b..e1149e8a0 100644 --- a/xc/extras/Mesa/src/X86/katmai.h +++ b/xc/extras/Mesa/src/X86/katmai.h @@ -31,8 +31,6 @@ #ifndef __KATMAI_H__ #define __KATMAI_H__ -#include "xform.h" - void gl_init_katmai_transform_asm( void ); void gl_init_katmai_vertex_asm( void ); diff --git a/xc/extras/Mesa/src/X86/x86_cliptest.S b/xc/extras/Mesa/src/X86/x86_cliptest.S index a98026c31..992fec3d7 100644 --- a/xc/extras/Mesa/src/X86/x86_cliptest.S +++ b/xc/extras/Mesa/src/X86/x86_cliptest.S @@ -1,4 +1,3 @@ -/* $Id: x86_cliptest.S,v 1.1.1.1 2000/11/30 17:31:35 dawes Exp $ */ /* * Mesa 3-D graphics library diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c index 425c03b1d..d4bb469e1 100644 --- a/xc/extras/Mesa/src/colortab.c +++ b/xc/extras/Mesa/src/colortab.c @@ -357,7 +357,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, _mesa_unpack_float_color_span(ctx, width, table->Format, tempTab, /* dest */ format, type, data, - &ctx->Unpack, GL_TRUE, GL_FALSE); + &ctx->Unpack, GL_FALSE, GL_FALSE); table->TableType = GL_FLOAT; table->Table = MALLOC(comps * width * sizeof(GLfloat)); @@ -421,7 +421,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, _mesa_unpack_ubyte_color_span(ctx, width, table->Format, (GLubyte *) table->Table, /* dest */ format, type, data, - &ctx->Unpack, GL_TRUE); + &ctx->Unpack, GL_FALSE); } /* floatTable */ } /* proxy */ @@ -533,7 +533,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, if (table->TableType == GL_UNSIGNED_BYTE) { GLubyte *dest = (GLubyte *) table->Table + start * comps * sizeof(GLubyte); _mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest, - format, type, data, &ctx->Unpack, GL_TRUE); + format, type, data, &ctx->Unpack, GL_FALSE); } else { GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4]; @@ -545,7 +545,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, _mesa_unpack_float_color_span(ctx, count, table->Format, tempTab, /* dest */ format, type, data, - &ctx->Unpack, GL_TRUE, GL_FALSE); + &ctx->Unpack, GL_FALSE, GL_FALSE); tableF = (GLfloat *) table->Table; @@ -625,7 +625,9 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat, width = MAX_WIDTH; /* read the data from framebuffer */ + RENDER_START(ctx); gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + RENDER_FINISH(ctx); /* Restore reading from draw buffer (the default) */ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, @@ -654,7 +656,9 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start, width = MAX_WIDTH; /* read the data from framebuffer */ + RENDER_START(ctx); gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + RENDER_FINISH(ctx); /* Restore reading from draw buffer (the default) */ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index 4d4a5974c..43219cd28 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -412,10 +412,10 @@ one_time_init( void ) _mesa_init_fog(); _mesa_init_math(); gl_init_lists(); - gl_init_shade(); gl_init_texture(); gl_init_transformation(); gl_init_translate(); + gl_init_shade(); gl_init_vbrender(); gl_init_vbxform(); gl_init_vertices(); @@ -456,6 +456,9 @@ alloc_shared_state( void ) ss->DisplayList = _mesa_NewHashTable(); ss->TexObjects = _mesa_NewHashTable(); +#ifdef VAO + ss->ArrayObjects = _mesa_NewHashTable(); +#endif /* Default Texture objects */ outOfMemory = GL_FALSE; @@ -1188,6 +1191,13 @@ init_attrib_groups( GLcontext *ctx ) ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; /* Vertex arrays */ +#ifdef VAO + { + struct gl_array_object *arrayObj; + arrayObj = _mesa_alloc_vertex_array_object(ctx, 0); + ctx->Array.Current = arrayObj; + } +#else ctx->Array.Vertex.Size = 4; ctx->Array.Vertex.Type = GL_FLOAT; ctx->Array.Vertex.Stride = 0; @@ -1223,6 +1233,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Array.EdgeFlag.StrideB = 0; ctx->Array.EdgeFlag.Ptr = NULL; ctx->Array.EdgeFlag.Enabled = GL_FALSE; +#endif ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ /* Pixel transfer */ diff --git a/xc/extras/Mesa/src/copypix.c b/xc/extras/Mesa/src/copypix.c index 2d3c3594a..c69a92715 100644 --- a/xc/extras/Mesa/src/copypix.c +++ b/xc/extras/Mesa/src/copypix.c @@ -431,7 +431,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; - if (!ctx->ReadBuffer->DepthBuffer || !ctx->DrawBuffer->DepthBuffer) { + if (!ctx->Visual->DepthBits) { gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } @@ -538,7 +538,7 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; GLint overlapping; - if (!ctx->DrawBuffer->Stencil || !ctx->ReadBuffer->Stencil) { + if (!ctx->Visual->StencilBits) { gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } diff --git a/xc/extras/Mesa/src/cva.c b/xc/extras/Mesa/src/cva.c index f4f1a7ba2..1f1c83358 100644 --- a/xc/extras/Mesa/src/cva.c +++ b/xc/extras/Mesa/src/cva.c @@ -201,7 +201,11 @@ void gl_merge_cva( struct vertex_buffer *VB, GLcontext *ctx = VB->ctx; GLuint *elt = VB->EltPtr->start; GLuint count = VB->Count - VB->Start; +#ifdef VAO + GLuint available = ctx->CVA.pre.outputs | ctx->Array.Current->Summary; +#else GLuint available = ctx->CVA.pre.outputs | ctx->Array.Summary; +#endif GLuint required = ctx->CVA.elt.inputs; GLuint flags; @@ -391,6 +395,17 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) { struct gl_cva *cva = &ctx->CVA; +#ifdef VAO + if (!ctx->Array.Current->LockCount) { + ctx->Array.NewArrayState = ~0; + ctx->CVA.lock_changed ^= 1; + ctx->NewState |= NEW_CLIENT_STATE; + } + + ctx->Array.Current->LockFirst = first; + ctx->Array.Current->LockCount = count; + ctx->CompileCVAFlag = !ctx->CompileFlag; +#else if (!ctx->Array.LockCount) { ctx->Array.NewArrayState = ~0; ctx->CVA.lock_changed ^= 1; @@ -400,6 +415,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) ctx->Array.LockFirst = first; ctx->Array.LockCount = count; ctx->CompileCVAFlag = !ctx->CompileFlag; +#endif if (!cva->VB) { cva->VB = gl_vb_create_for_cva( ctx, ctx->Const.MaxArrayLockSize ); @@ -409,14 +425,23 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) } else { +#ifdef VAO + if (ctx->Array.Current->LockCount) { +#else if (ctx->Array.LockCount) { +#endif ctx->CVA.lock_changed ^= 1; ctx->NewState |= NEW_CLIENT_STATE; } +#ifdef VAO + ctx->Array.Current->LockFirst = 0; + ctx->Array.Current->LockCount = 0; +#else ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; +#endif ctx->CompileCVAFlag = 0; } } @@ -433,13 +458,22 @@ _mesa_UnlockArraysEXT( void ) if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glUnlockArrays\n"); +#ifdef VAO + if (ctx->Array.Current->LockCount) { +#else if (ctx->Array.LockCount) { +#endif ctx->CVA.lock_changed ^= 1; ctx->NewState |= NEW_CLIENT_STATE; } +#ifdef VAO + ctx->Array.Current->LockFirst = 0; + ctx->Array.Current->LockCount = 0; +#else ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; +#endif ctx->CompileCVAFlag = 0; } @@ -477,11 +511,19 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; struct gl_cva *cva = &ctx->CVA; +#ifdef VAO + GLuint start = ctx->Array.Current->LockFirst; + GLuint n = ctx->Array.Current->LockCount; + GLuint enable = ((ctx->Array.NewArrayState & ctx->Array.Current->Summary) | + VB->pipeline->fallback); + GLuint disable = ctx->Array.NewArrayState & ~enable; +#else GLuint start = ctx->Array.LockFirst; GLuint n = ctx->Array.LockCount; GLuint enable = ((ctx->Array.NewArrayState & ctx->Array.Summary) | VB->pipeline->fallback); GLuint disable = ctx->Array.NewArrayState & ~enable; +#endif GLuint i; if (MESA_VERBOSE&VERBOSE_PIPELINE) { @@ -519,7 +561,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) elt->start = VEC_ELT(elt, GLuint, 0); elt->count = cva->elt_count; +#ifdef VAO + fallback |= (cva->pre.new_inputs & ~ctx->Array.Current->Summary); +#else fallback |= (cva->pre.new_inputs & ~ctx->Array.Summary); +#endif enable |= fallback; disable &= ~fallback; if (MESA_VERBOSE&VERBOSE_PIPELINE) { @@ -532,7 +578,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) { GLvector4ub *col = &cva->v.Color; +#ifdef VAO + client_data = &ctx->Array.Current->Color; +#else client_data = &ctx->Array.Color; +#endif if (fallback & VERT_RGBA) client_data = &ctx->Fallback.Color; VB->Color[0] = VB->Color[1] = VB->ColorPtr = &cva->v.Color; @@ -542,7 +592,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) { col->data = cva->store.Color; col->stride = 4 * sizeof(GLubyte); +#ifdef VAO + ctx->Array.Current->ColorFunc( col->data, client_data, start, n ); +#else ctx->Array.ColorFunc( col->data, client_data, start, n ); +#endif col->flags = VEC_WRITABLE|VEC_GOOD_STRIDE; } else { col->data = (GLubyte (*)[4]) client_data->Ptr; @@ -560,14 +614,22 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) GLvector1ui *index = VB->IndexPtr = &cva->v.Index; VB->Index[0] = VB->Index[1] = VB->IndexPtr; +#ifdef VAO + client_data = &ctx->Array.Current->Index; +#else client_data = &ctx->Array.Index; +#endif if (fallback & VERT_INDEX) client_data = &ctx->Fallback.Index; if (client_data->Type != GL_UNSIGNED_INT) { index->data = cva->store.Index; index->stride = sizeof(GLuint); +#ifdef VAO + ctx->Array.Current->IndexFunc( index->data, client_data, start, n ); +#else ctx->Array.IndexFunc( index->data, client_data, start, n ); +#endif index->flags = VEC_WRITABLE|VEC_GOOD_STRIDE; } else { index->data = (GLuint *) client_data->Ptr; @@ -584,7 +646,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) if (enable & PIPE_TEX(i)) { GLvector4f *tc = VB->TexCoordPtr[i] = &cva->v.TexCoord[i]; +#ifdef VAO + client_data = &ctx->Array.Current->TexCoord[i]; +#else client_data = &ctx->Array.TexCoord[i]; +#endif if (fallback & PIPE_TEX(i)) { client_data = &ctx->Fallback.TexCoord[i]; @@ -604,7 +670,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) } else { tc->data = cva->store.TexCoord[i]; tc->stride = 4 * sizeof(GLfloat); +#ifdef VAO + ctx->Array.Current->TexCoordFunc[i]( tc->data, client_data, start, n ); +#else ctx->Array.TexCoordFunc[i]( tc->data, client_data, start, n ); +#endif tc->flags = VEC_WRITABLE|VEC_GOOD_STRIDE; } tc->count = n; @@ -616,6 +686,24 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) { GLvector4f *obj = VB->ObjPtr = &cva->v.Obj; +#ifdef VAO + if (ctx->Array.Current->Vertex.Type == GL_FLOAT) + { + obj->data = (GLfloat (*)[4]) ctx->Array.Current->Vertex.Ptr; + obj->stride = ctx->Array.Current->Vertex.StrideB; + obj->flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; + if (obj->stride != 4 * sizeof(GLfloat)) + obj->flags ^= VEC_STRIDE_FLAGS; + } else { + obj->data = cva->store.Obj; + obj->stride = 4 * sizeof(GLfloat); + ctx->Array.Current->VertexFunc( obj->data, &ctx->Array.Current->Vertex, start, n ); + obj->flags = VEC_WRITABLE|VEC_GOOD_STRIDE; + } + obj->count = n; + obj->start = VEC_ELT(obj, GLfloat, start); + obj->size = ctx->Array.Current->Vertex.Size; +#else if (ctx->Array.Vertex.Type == GL_FLOAT) { obj->data = (GLfloat (*)[4]) ctx->Array.Vertex.Ptr; @@ -632,13 +720,18 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) obj->count = n; obj->start = VEC_ELT(obj, GLfloat, start); obj->size = ctx->Array.Vertex.Size; +#endif } if (enable & VERT_NORM) { GLvector3f *norm = VB->NormalPtr = &cva->v.Normal; +#ifdef VAO + client_data = &ctx->Array.Current->Normal; +#else client_data = &ctx->Array.Normal; +#endif if (fallback & VERT_NORM) client_data = &ctx->Fallback.Normal; @@ -651,7 +744,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) } else { norm->data = cva->store.Normal; norm->stride = 3 * sizeof(GLfloat); +#ifdef VAO + ctx->Array.Current->NormalFunc( norm->data, client_data, start, n ); +#else ctx->Array.NormalFunc( norm->data, client_data, start, n ); +#endif } norm->flags = 0; norm->count = n; @@ -662,7 +759,11 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) { GLvector1ub *edge = VB->EdgeFlagPtr = &cva->v.EdgeFlag; +#ifdef VAO + client_data = &ctx->Array.Current->EdgeFlag; +#else client_data = &ctx->Array.EdgeFlag; +#endif if (fallback & VERT_EDGE) client_data = &ctx->Fallback.EdgeFlag; @@ -693,12 +794,20 @@ void gl_prepare_arrays_cva( struct vertex_buffer *VB ) if (ctx->Enabled & ENABLE_LIGHT) { +#ifdef VAO + if (ctx->Array.Current->Flags != VB->Flag[0]) +#else if (ctx->Array.Flags != VB->Flag[0]) +#endif VB->FlagMax = 0; if (VB->FlagMax < n) { for (i = VB->FlagMax ; i < n ; i++) +#ifdef VAO + VB->Flag[i] = ctx->Array.Current->Flags; +#else VB->Flag[i] = ctx->Array.Flags; +#endif VB->Flag[i] = 0; VB->FlagMax = n; } diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index aaf577b1a..1de2d32ac 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -432,22 +432,46 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) * CLIENT STATE!!! */ case GL_VERTEX_ARRAY: +#ifdef VAO + ctx->Array.Current->Vertex.Enabled = state; +#else ctx->Array.Vertex.Enabled = state; +#endif break; case GL_NORMAL_ARRAY: +#ifdef VAO + ctx->Array.Current->Normal.Enabled = state; +#else ctx->Array.Normal.Enabled = state; +#endif break; case GL_COLOR_ARRAY: +#ifdef VAO + ctx->Array.Current->Color.Enabled = state; +#else ctx->Array.Color.Enabled = state; +#endif break; case GL_INDEX_ARRAY: +#ifdef VAO + ctx->Array.Current->Index.Enabled = state; +#else ctx->Array.Index.Enabled = state; +#endif break; case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + ctx->Array.Current->TexCoord[ctx->Array.ActiveTexture].Enabled = state; +#else ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; +#endif break; case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + ctx->Array.Current->EdgeFlag.Enabled = state; +#else ctx->Array.EdgeFlag.Enabled = state; +#endif break; /* GL_HP_occlusion_test */ @@ -700,17 +724,41 @@ _mesa_IsEnabled( GLenum cap ) * CLIENT STATE!!! */ case GL_VERTEX_ARRAY: +#ifdef VAO + return ctx->Array.Current->Vertex.Enabled; +#else return ctx->Array.Vertex.Enabled; +#endif case GL_NORMAL_ARRAY: +#ifdef VAO + return ctx->Array.Current->Normal.Enabled; +#else return ctx->Array.Normal.Enabled; +#endif case GL_COLOR_ARRAY: +#ifdef VAO + return ctx->Array.Current->Color.Enabled; +#else return ctx->Array.Color.Enabled; +#endif case GL_INDEX_ARRAY: +#ifdef VAO + return ctx->Array.Current->Index.Enabled; +#else return ctx->Array.Index.Enabled; +#endif case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + return ctx->Array.Current->TexCoord[ctx->Array.ActiveTexture].Enabled; +#else return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; +#endif case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + return ctx->Array.Current->EdgeFlag.Enabled; +#else return ctx->Array.EdgeFlag.Enabled; +#endif /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: @@ -776,22 +824,46 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) switch (cap) { case GL_VERTEX_ARRAY: +#ifdef VAO + ctx->Array.Current->Vertex.Enabled = state; +#else ctx->Array.Vertex.Enabled = state; +#endif break; case GL_NORMAL_ARRAY: +#ifdef VAO + ctx->Array.Current->Normal.Enabled = state; +#else ctx->Array.Normal.Enabled = state; +#endif break; case GL_COLOR_ARRAY: +#ifdef VAO + ctx->Array.Current->Color.Enabled = state; +#else ctx->Array.Color.Enabled = state; +#endif break; case GL_INDEX_ARRAY: +#ifdef VAO + ctx->Array.Current->Index.Enabled = state; +#else ctx->Array.Index.Enabled = state; +#endif break; case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + ctx->Array.Current->TexCoord[ctx->Array.ActiveTexture].Enabled = state; +#else ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; +#endif break; case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + ctx->Array.Current->EdgeFlag.Enabled = state; +#else ctx->Array.EdgeFlag.Enabled = state; +#endif break; default: gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index 59e86056a..3f3897411 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -874,79 +874,159 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.ZoomY); break; case GL_VERTEX_ARRAY: +#ifdef VAO + *params = ctx->Array.Current->Vertex.Enabled; +#else *params = ctx->Array.Vertex.Enabled; +#endif break; case GL_VERTEX_ARRAY_SIZE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->Vertex.Size); +#else *params = INT_TO_BOOL(ctx->Array.Vertex.Size); +#endif break; case GL_VERTEX_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_BOOL(ctx->Array.Current->Vertex.Type); +#else *params = ENUM_TO_BOOL(ctx->Array.Vertex.Type); +#endif break; case GL_VERTEX_ARRAY_STRIDE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->Vertex.Stride); +#else *params = INT_TO_BOOL(ctx->Array.Vertex.Stride); +#endif break; case GL_VERTEX_ARRAY_COUNT_EXT: *params = INT_TO_BOOL(0); break; case GL_NORMAL_ARRAY: +#ifdef VAO + *params = ctx->Array.Current->Normal.Enabled; +#else *params = ctx->Array.Normal.Enabled; +#endif break; case GL_NORMAL_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_BOOL(ctx->Array.Current->Normal.Type); +#else *params = ENUM_TO_BOOL(ctx->Array.Normal.Type); +#endif break; case GL_NORMAL_ARRAY_STRIDE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->Normal.Stride); +#else *params = INT_TO_BOOL(ctx->Array.Normal.Stride); +#endif break; case GL_NORMAL_ARRAY_COUNT_EXT: *params = INT_TO_BOOL(0); break; case GL_COLOR_ARRAY: +#ifdef VAO + *params = ctx->Array.Current->Color.Enabled; +#else *params = ctx->Array.Color.Enabled; +#endif break; case GL_COLOR_ARRAY_SIZE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->Color.Size); +#else *params = INT_TO_BOOL(ctx->Array.Color.Size); +#endif break; case GL_COLOR_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_BOOL(ctx->Array.Current->Color.Type); +#else *params = ENUM_TO_BOOL(ctx->Array.Color.Type); +#endif break; case GL_COLOR_ARRAY_STRIDE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->Color.Stride); +#else *params = INT_TO_BOOL(ctx->Array.Color.Stride); +#endif break; case GL_COLOR_ARRAY_COUNT_EXT: *params = INT_TO_BOOL(0); break; case GL_INDEX_ARRAY: +#ifdef VAO + *params = ctx->Array.Current->Index.Enabled; +#else *params = ctx->Array.Index.Enabled; +#endif break; case GL_INDEX_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_BOOL(ctx->Array.Current->Index.Type); +#else *params = ENUM_TO_BOOL(ctx->Array.Index.Type); +#endif break; case GL_INDEX_ARRAY_STRIDE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->Index.Stride); +#else *params = INT_TO_BOOL(ctx->Array.Index.Stride); +#endif break; case GL_INDEX_ARRAY_COUNT_EXT: *params = INT_TO_BOOL(0); break; case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + *params = ctx->Array.Current->TexCoord[texUnit].Enabled; +#else *params = ctx->Array.TexCoord[texUnit].Enabled; +#endif break; case GL_TEXTURE_COORD_ARRAY_SIZE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->TexCoord[texUnit].Size); +#else *params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Size); +#endif break; case GL_TEXTURE_COORD_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_BOOL(ctx->Array.Current->TexCoord[texUnit].Type); +#else *params = ENUM_TO_BOOL(ctx->Array.TexCoord[texUnit].Type); +#endif break; case GL_TEXTURE_COORD_ARRAY_STRIDE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->TexCoord[texUnit].Stride); +#else *params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Stride); +#endif break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: *params = INT_TO_BOOL(0); break; case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + *params = ctx->Array.Current->EdgeFlag.Enabled; +#else *params = ctx->Array.EdgeFlag.Enabled; +#endif break; case GL_EDGE_FLAG_ARRAY_STRIDE: +#ifdef VAO + *params = INT_TO_BOOL(ctx->Array.Current->EdgeFlag.Stride); +#else *params = INT_TO_BOOL(ctx->Array.EdgeFlag.Stride); +#endif break; /* GL_ARB_multitexture */ @@ -1057,10 +1137,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: +#ifdef VAO + *params = ctx->Array.Current->LockFirst ? GL_TRUE : GL_FALSE; +#else *params = ctx->Array.LockFirst ? GL_TRUE : GL_FALSE; +#endif break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: +#ifdef VAO + *params = ctx->Array.Current->LockCount ? GL_TRUE : GL_FALSE; +#else *params = ctx->Array.LockCount ? GL_TRUE : GL_FALSE; +#endif break; /* GL_ARB_transpose_matrix */ @@ -2020,79 +2108,159 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.ZoomY; break; case GL_VERTEX_ARRAY: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Vertex.Enabled; +#else *params = (GLdouble) ctx->Array.Vertex.Enabled; +#endif break; case GL_VERTEX_ARRAY_SIZE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Vertex.Size; +#else *params = (GLdouble) ctx->Array.Vertex.Size; +#endif break; case GL_VERTEX_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_DOUBLE(ctx->Array.Current->Vertex.Type); +#else *params = ENUM_TO_DOUBLE(ctx->Array.Vertex.Type); +#endif break; case GL_VERTEX_ARRAY_STRIDE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Vertex.Stride; +#else *params = (GLdouble) ctx->Array.Vertex.Stride; +#endif break; case GL_VERTEX_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_NORMAL_ARRAY: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Normal.Enabled; +#else *params = (GLdouble) ctx->Array.Normal.Enabled; +#endif break; case GL_NORMAL_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_DOUBLE(ctx->Array.Current->Normal.Type); +#else *params = ENUM_TO_DOUBLE(ctx->Array.Normal.Type); +#endif break; case GL_NORMAL_ARRAY_STRIDE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Normal.Stride; +#else *params = (GLdouble) ctx->Array.Normal.Stride; +#endif break; case GL_NORMAL_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_COLOR_ARRAY: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Color.Enabled; +#else *params = (GLdouble) ctx->Array.Color.Enabled; +#endif break; case GL_COLOR_ARRAY_SIZE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Color.Size; +#else *params = (GLdouble) ctx->Array.Color.Size; +#endif break; case GL_COLOR_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_DOUBLE(ctx->Array.Current->Color.Type); +#else *params = ENUM_TO_DOUBLE(ctx->Array.Color.Type); +#endif break; case GL_COLOR_ARRAY_STRIDE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Color.Stride; +#else *params = (GLdouble) ctx->Array.Color.Stride; +#endif break; case GL_COLOR_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_INDEX_ARRAY: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Index.Enabled; +#else *params = (GLdouble) ctx->Array.Index.Enabled; +#endif break; case GL_INDEX_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_DOUBLE(ctx->Array.Current->Index.Type); +#else *params = ENUM_TO_DOUBLE(ctx->Array.Index.Type); +#endif break; case GL_INDEX_ARRAY_STRIDE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->Index.Stride; +#else *params = (GLdouble) ctx->Array.Index.Stride; +#endif break; case GL_INDEX_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->TexCoord[texUnit].Enabled; +#else *params = (GLdouble) ctx->Array.TexCoord[texUnit].Enabled; +#endif break; case GL_TEXTURE_COORD_ARRAY_SIZE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->TexCoord[texUnit].Size; +#else *params = (GLdouble) ctx->Array.TexCoord[texUnit].Size; +#endif break; case GL_TEXTURE_COORD_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_DOUBLE(ctx->Array.Current->TexCoord[texUnit].Type); +#else *params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[texUnit].Type); +#endif break; case GL_TEXTURE_COORD_ARRAY_STRIDE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->TexCoord[texUnit].Stride; +#else *params = (GLdouble) ctx->Array.TexCoord[texUnit].Stride; +#endif break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->EdgeFlag.Enabled; +#else *params = (GLdouble) ctx->Array.EdgeFlag.Enabled; +#endif break; case GL_EDGE_FLAG_ARRAY_STRIDE: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->EdgeFlag.Stride; +#else *params = (GLdouble) ctx->Array.EdgeFlag.Stride; +#endif break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: *params = 0.0; @@ -2206,10 +2374,18 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->LockFirst; +#else *params = (GLdouble) ctx->Array.LockFirst; +#endif break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: +#ifdef VAO + *params = (GLdouble) ctx->Array.Current->LockCount; +#else *params = (GLdouble) ctx->Array.LockCount; +#endif break; /* GL_ARB_transpose_matrix */ @@ -3168,79 +3344,159 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.ZoomY; break; case GL_VERTEX_ARRAY: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Vertex.Enabled; +#else *params = (GLfloat) ctx->Array.Vertex.Enabled; +#endif break; case GL_VERTEX_ARRAY_SIZE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Vertex.Size; +#else *params = (GLfloat) ctx->Array.Vertex.Size; +#endif break; case GL_VERTEX_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_FLOAT(ctx->Array.Current->Vertex.Type); +#else *params = ENUM_TO_FLOAT(ctx->Array.Vertex.Type); +#endif break; case GL_VERTEX_ARRAY_STRIDE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Vertex.Stride; +#else *params = (GLfloat) ctx->Array.Vertex.Stride; +#endif break; case GL_VERTEX_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_NORMAL_ARRAY: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Normal.Enabled; +#else *params = (GLfloat) ctx->Array.Normal.Enabled; +#endif break; case GL_NORMAL_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_FLOAT(ctx->Array.Current->Normal.Type); +#else *params = ENUM_TO_FLOAT(ctx->Array.Normal.Type); +#endif break; case GL_NORMAL_ARRAY_STRIDE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Normal.Stride; +#else *params = (GLfloat) ctx->Array.Normal.Stride; +#endif break; case GL_NORMAL_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_COLOR_ARRAY: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Color.Enabled; +#else *params = (GLfloat) ctx->Array.Color.Enabled; +#endif break; case GL_COLOR_ARRAY_SIZE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Color.Size; +#else *params = (GLfloat) ctx->Array.Color.Size; +#endif break; case GL_COLOR_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_FLOAT(ctx->Array.Current->Color.Type); +#else *params = ENUM_TO_FLOAT(ctx->Array.Color.Type); +#endif break; case GL_COLOR_ARRAY_STRIDE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Color.Stride; +#else *params = (GLfloat) ctx->Array.Color.Stride; +#endif break; case GL_COLOR_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_INDEX_ARRAY: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Index.Enabled; +#else *params = (GLfloat) ctx->Array.Index.Enabled; +#endif break; case GL_INDEX_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_FLOAT(ctx->Array.Current->Index.Type); +#else *params = ENUM_TO_FLOAT(ctx->Array.Index.Type); +#endif break; case GL_INDEX_ARRAY_STRIDE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->Index.Stride; +#else *params = (GLfloat) ctx->Array.Index.Stride; +#endif break; case GL_INDEX_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->TexCoord[texUnit].Enabled; +#else *params = (GLfloat) ctx->Array.TexCoord[texUnit].Enabled; +#endif break; case GL_TEXTURE_COORD_ARRAY_SIZE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->TexCoord[texUnit].Size; +#else *params = (GLfloat) ctx->Array.TexCoord[texUnit].Size; +#endif break; case GL_TEXTURE_COORD_ARRAY_TYPE: +#ifdef VAO + *params = ENUM_TO_FLOAT(ctx->Array.Current->TexCoord[texUnit].Type); +#else *params = ENUM_TO_FLOAT(ctx->Array.TexCoord[texUnit].Type); +#endif break; case GL_TEXTURE_COORD_ARRAY_STRIDE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->TexCoord[texUnit].Stride; +#else *params = (GLfloat) ctx->Array.TexCoord[texUnit].Stride; +#endif break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: *params = 0.0; break; case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->EdgeFlag.Enabled; +#else *params = (GLfloat) ctx->Array.EdgeFlag.Enabled; +#endif break; case GL_EDGE_FLAG_ARRAY_STRIDE: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->EdgeFlag.Stride; +#else *params = (GLfloat) ctx->Array.EdgeFlag.Stride; +#endif break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: *params = 0.0; @@ -3354,10 +3610,18 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->LockFirst; +#else *params = (GLfloat) ctx->Array.LockFirst; +#endif break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: +#ifdef VAO + *params = (GLfloat) ctx->Array.Current->LockCount; +#else *params = (GLfloat) ctx->Array.LockCount; +#endif break; /* GL_ARB_transpose_matrix */ @@ -4291,79 +4555,159 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.ZoomY; break; case GL_VERTEX_ARRAY: +#ifdef VAO + *params = (GLint) ctx->Array.Current->Vertex.Enabled; +#else *params = (GLint) ctx->Array.Vertex.Enabled; +#endif break; case GL_VERTEX_ARRAY_SIZE: +#ifdef VAO + *params = ctx->Array.Current->Vertex.Size; +#else *params = ctx->Array.Vertex.Size; +#endif break; case GL_VERTEX_ARRAY_TYPE: +#ifdef VAO + *params = ctx->Array.Current->Vertex.Type; +#else *params = ctx->Array.Vertex.Type; +#endif break; case GL_VERTEX_ARRAY_STRIDE: +#ifdef VAO + *params = ctx->Array.Current->Vertex.Stride; +#else *params = ctx->Array.Vertex.Stride; +#endif break; case GL_VERTEX_ARRAY_COUNT_EXT: *params = 0; break; case GL_NORMAL_ARRAY: +#ifdef VAO + *params = (GLint) ctx->Array.Current->Normal.Enabled; +#else *params = (GLint) ctx->Array.Normal.Enabled; +#endif break; case GL_NORMAL_ARRAY_TYPE: +#ifdef VAO + *params = ctx->Array.Current->Normal.Type; +#else *params = ctx->Array.Normal.Type; +#endif break; case GL_NORMAL_ARRAY_STRIDE: +#ifdef VAO + *params = ctx->Array.Current->Normal.Stride; +#else *params = ctx->Array.Normal.Stride; +#endif break; case GL_NORMAL_ARRAY_COUNT_EXT: *params = 0; break; case GL_COLOR_ARRAY: +#ifdef VAO + *params = (GLint) ctx->Array.Current->Color.Enabled; +#else *params = (GLint) ctx->Array.Color.Enabled; +#endif break; case GL_COLOR_ARRAY_SIZE: +#ifdef VAO + *params = ctx->Array.Current->Color.Size; +#else *params = ctx->Array.Color.Size; +#endif break; case GL_COLOR_ARRAY_TYPE: +#ifdef VAO + *params = ctx->Array.Current->Color.Type; +#else *params = ctx->Array.Color.Type; +#endif break; case GL_COLOR_ARRAY_STRIDE: +#ifdef VAO + *params = ctx->Array.Current->Color.Stride; +#else *params = ctx->Array.Color.Stride; +#endif break; case GL_COLOR_ARRAY_COUNT_EXT: *params = 0; break; case GL_INDEX_ARRAY: +#ifdef VAO + *params = (GLint) ctx->Array.Current->Index.Enabled; +#else *params = (GLint) ctx->Array.Index.Enabled; +#endif break; case GL_INDEX_ARRAY_TYPE: +#ifdef VAO + *params = ctx->Array.Current->Index.Type; +#else *params = ctx->Array.Index.Type; +#endif break; case GL_INDEX_ARRAY_STRIDE: +#ifdef VAO + *params = ctx->Array.Current->Index.Stride; +#else *params = ctx->Array.Index.Stride; +#endif break; case GL_INDEX_ARRAY_COUNT_EXT: *params = 0; break; case GL_TEXTURE_COORD_ARRAY: +#ifdef VAO + *params = (GLint) ctx->Array.Current->TexCoord[texUnit].Enabled; +#else *params = (GLint) ctx->Array.TexCoord[texUnit].Enabled; +#endif break; case GL_TEXTURE_COORD_ARRAY_SIZE: +#ifdef VAO + *params = ctx->Array.Current->TexCoord[texUnit].Size; +#else *params = ctx->Array.TexCoord[texUnit].Size; +#endif break; case GL_TEXTURE_COORD_ARRAY_TYPE: +#ifdef VAO + *params = ctx->Array.Current->TexCoord[texUnit].Type; +#else *params = ctx->Array.TexCoord[texUnit].Type; +#endif break; case GL_TEXTURE_COORD_ARRAY_STRIDE: +#ifdef VAO + *params = ctx->Array.Current->TexCoord[texUnit].Stride; +#else *params = ctx->Array.TexCoord[texUnit].Stride; +#endif break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: *params = 0; break; case GL_EDGE_FLAG_ARRAY: +#ifdef VAO + *params = (GLint) ctx->Array.Current->EdgeFlag.Enabled; +#else *params = (GLint) ctx->Array.EdgeFlag.Enabled; +#endif break; case GL_EDGE_FLAG_ARRAY_STRIDE: +#ifdef VAO + *params = ctx->Array.Current->EdgeFlag.Stride; +#else *params = ctx->Array.EdgeFlag.Stride; +#endif break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: *params = 0; @@ -4477,10 +4821,18 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: +#ifdef VAO + *params = ctx->Array.Current->LockFirst; +#else *params = ctx->Array.LockFirst; +#endif break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: +#ifdef VAO + *params = ctx->Array.Current->LockCount; +#else *params = ctx->Array.LockCount; +#endif break; /* GL_ARB_transpose_matrix */ @@ -4669,22 +5021,46 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) switch (pname) { case GL_VERTEX_ARRAY_POINTER: +#ifdef VAO + *params = ctx->Array.Current->Vertex.Ptr; +#else *params = ctx->Array.Vertex.Ptr; +#endif break; case GL_NORMAL_ARRAY_POINTER: +#ifdef VAO + *params = ctx->Array.Current->Normal.Ptr; +#else *params = ctx->Array.Normal.Ptr; +#endif break; case GL_COLOR_ARRAY_POINTER: +#ifdef VAO + *params = ctx->Array.Current->Color.Ptr; +#else *params = ctx->Array.Color.Ptr; +#endif break; case GL_INDEX_ARRAY_POINTER: +#ifdef VAO + *params = ctx->Array.Current->Index.Ptr; +#else *params = ctx->Array.Index.Ptr; +#endif break; case GL_TEXTURE_COORD_ARRAY_POINTER: +#ifdef VAO + *params = ctx->Array.Current->TexCoord[texUnit].Ptr; +#else *params = ctx->Array.TexCoord[texUnit].Ptr; +#endif break; case GL_EDGE_FLAG_ARRAY_POINTER: +#ifdef VAO + *params = ctx->Array.Current->EdgeFlag.Ptr; +#else *params = ctx->Array.EdgeFlag.Ptr; +#endif break; case GL_FEEDBACK_BUFFER_POINTER: *params = ctx->Feedback.Buffer; diff --git a/xc/extras/Mesa/src/hash.c b/xc/extras/Mesa/src/hash.c index a682180ba..efa5c25e5 100644 --- a/xc/extras/Mesa/src/hash.c +++ b/xc/extras/Mesa/src/hash.c @@ -100,7 +100,6 @@ void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) const struct HashEntry *entry; assert(table); - assert(key); pos = key & (TABLE_SIZE-1); entry = table->Table[pos]; @@ -129,7 +128,6 @@ void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) struct HashEntry *entry; assert(table); - assert(key); _glthread_LOCK_MUTEX(table->Mutex); @@ -171,7 +169,6 @@ void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) struct HashEntry *entry, *prev; assert(table); - assert(key); _glthread_LOCK_MUTEX(table->Mutex); diff --git a/xc/extras/Mesa/src/imaging.c b/xc/extras/Mesa/src/imaging.c index 27fb58a6a..c6d7d9bdf 100644 --- a/xc/extras/Mesa/src/imaging.c +++ b/xc/extras/Mesa/src/imaging.c @@ -1254,7 +1254,7 @@ void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { GLenum baseFormat; - GLfloat rgba[MAX_CONVOLUTION_WIDTH][4]; + GLubyte rgba[MAX_CONVOLUTION_WIDTH][4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter1D"); @@ -1275,7 +1275,9 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi } /* read pixels from framebuffer */ + RENDER_START(ctx); gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLubyte (*)[4]) rgba); + RENDER_FINISH(ctx); /* store as convolution filter */ _mesa_ConvolutionFilter1D(target, internalFormat, width, @@ -1289,7 +1291,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi GLenum baseFormat; GLint i; struct gl_pixelstore_attrib packSave; - GLfloat rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; + GLubyte rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter2D"); @@ -1314,10 +1316,12 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi } /* read pixels from framebuffer */ + RENDER_START(ctx); for (i = 0; i < height; i++) { gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i, (GLubyte (*)[4]) rgba[i]); } + RENDER_FINISH(ctx); /* * store as convolution filter @@ -1343,6 +1347,8 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { + const struct gl_convolution_attrib *filter; + GLint row; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionFilter"); @@ -1361,8 +1367,31 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im return; } - (void) image; - /* XXX store image */ + switch (target) { + case GL_CONVOLUTION_1D: + filter = &(ctx->Convolution1D); + break; + case GL_CONVOLUTION_2D: + filter = &(ctx->Convolution2D); + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); + return; + } + + for (row = 0; row < filter->Height; row++) { + GLvoid *dst = _mesa_image_address( &ctx->Pack, image, filter->Width, + filter->Height, format, type, + 0, row, 0); + const GLfloat *src = filter->Filter + row * filter->Width * 4; + GLubyte img[MAX_WIDTH * 4]; + GLint i; + for (i = 0; i < filter->Width * 4; i++) { + img[i] = (GLint) (CLAMP(src[i], 0.0, 1.0) * 255.0); + } + _mesa_pack_rgba_span(ctx, filter->Width, (const GLubyte (*)[4]) img, + format, type, dst, &ctx->Pack, 0); + } } diff --git a/xc/extras/Mesa/src/pipeline.c b/xc/extras/Mesa/src/pipeline.c index 0a469894d..2873fe68c 100644 --- a/xc/extras/Mesa/src/pipeline.c +++ b/xc/extras/Mesa/src/pipeline.c @@ -1,3 +1,4 @@ +/* $Id: pipeline.c,v 1.1.1.5 2000/12/05 16:38:41 dawes Exp $*/ /* * Mesa 3-D graphics library @@ -219,11 +220,19 @@ static void build_full_precalc_pipeline( GLcontext *ctx ) GLuint changed_ops = 0; GLuint oldoutputs = pre->outputs; GLuint oldinputs = pre->inputs; +#ifdef VAO + GLuint fallback = (VERT_CURRENT_DATA & ctx->Current.Flag & + ~ctx->Array.Current->Summary); + GLuint changed_outputs = (ctx->Array.NewArrayState | + (fallback & cva->orflag)); + GLuint available = fallback | ctx->Array.Current->Flags; +#else GLuint fallback = (VERT_CURRENT_DATA & ctx->Current.Flag & ~ctx->Array.Summary); GLuint changed_outputs = (ctx->Array.NewArrayState | (fallback & cva->orflag)); GLuint available = fallback | ctx->Array.Flags; +#endif pre->cva_state_change = 0; pre->ops = 0; @@ -232,10 +241,18 @@ static void build_full_precalc_pipeline( GLcontext *ctx ) pre->forbidden_inputs = 0; pre->fallback = 0; +#ifdef VAO + if (ctx->Array.Current->Summary & VERT_ELT) +#else if (ctx->Array.Summary & VERT_ELT) +#endif cva->orflag &= VERT_MATERIAL; +#ifdef VAO + cva->orflag &= ~(ctx->Array.Current->Summary & ~VERT_OBJ_ANY); +#else cva->orflag &= ~(ctx->Array.Summary & ~VERT_OBJ_ANY); +#endif available &= ~cva->orflag; pre->outputs = available; @@ -429,7 +446,11 @@ void gl_update_pipelines( GLcontext *ctx ) if (newstate || cva->lock_changed || cva->orflag != cva->last_orflag || +#ifdef VAO + ctx->Array.Current->Flags != cva->last_array_flags) +#else ctx->Array.Flags != cva->last_array_flags) +#endif { GLuint flags = VERT_WIN; @@ -470,13 +491,25 @@ void gl_update_pipelines( GLcontext *ctx ) cva->lock_changed = 0; } +#ifdef VAO + if (ctx->Array.NewArrayState != cva->last_array_new_state) +#else if (ctx->Array.NewArrayState != cva->last_array_new_state) +#endif cva->pre.pipeline_valid = 0; cva->pre.data_valid = 0; +#ifdef VAO cva->last_array_new_state = ctx->Array.NewArrayState; +#else + cva->last_array_new_state = ctx->Array.NewArrayState; +#endif cva->last_orflag = cva->orflag; +#ifdef VAO + cva->last_array_flags = ctx->Array.Current->Flags; +#else cva->last_array_flags = ctx->Array.Flags; +#endif } void gl_run_pipeline( struct vertex_buffer *VB ) diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c index 96a3f11b2..96df972cd 100644 --- a/xc/extras/Mesa/src/readpix.c +++ b/xc/extras/Mesa/src/readpix.c @@ -38,6 +38,7 @@ #include "pixel.h" #include "readpix.h" #include "span.h" +#include "state.h" #include "stencil.h" #include "types.h" #endif @@ -700,6 +701,10 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, return; } + if (ctx->NewState) { + gl_update_state(ctx); + } + if (ctx->Driver.ReadPixels && (*ctx->Driver.ReadPixels)(ctx, x, y, width, height, format, type, &ctx->Pack, pixels)) diff --git a/xc/extras/Mesa/src/shade.c b/xc/extras/Mesa/src/shade.c index e2516ece7..5c45a6e7e 100644 --- a/xc/extras/Mesa/src/shade.c +++ b/xc/extras/Mesa/src/shade.c @@ -38,6 +38,10 @@ #include "types.h" #endif +#if defined(USE_X86_ASM) +#include "X86/common_x86_asm.h" +#endif + /* Lerp between adjacent values in the f(x) lookup table, giving a * continuous function, with adequeate overall accuracy. (Though @@ -196,6 +200,10 @@ void gl_init_shade( void ) init_shade_tab_two_sided_masked(); init_shade_tab_two_sided_compacted(); init_shade_tab_two_sided_masked_compacted(); + +#ifdef USE_X86_ASM + gl_init_all_x86_shade_asm(); +#endif } void gl_update_lighting_function( GLcontext *ctx ) diff --git a/xc/extras/Mesa/src/shade.h b/xc/extras/Mesa/src/shade.h index ec90a4ec6..59109114b 100644 --- a/xc/extras/Mesa/src/shade.h +++ b/xc/extras/Mesa/src/shade.h @@ -2,19 +2,19 @@ /* * Mesa 3-D graphics library * Version: 3.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 @@ -39,7 +39,11 @@ extern void gl_update_lighting_function( GLcontext *ctx ); extern void gl_init_shade( void ); -extern gl_shade_func gl_shade_func_tab[]; +extern gl_shade_func gl_shade_tab[0x10]; +extern gl_shade_func gl_shade_fast_tab[0x10]; +extern gl_shade_func gl_shade_fast_single_tab[0x10]; +extern gl_shade_func gl_shade_spec_tab[0x10]; +extern gl_shade_func gl_shade_ci_tab[0x10]; void gl_shade_rastpos( GLcontext *ctx, @@ -49,4 +53,3 @@ void gl_shade_rastpos( GLcontext *ctx, GLuint *index ); #endif - diff --git a/xc/extras/Mesa/src/stages.c b/xc/extras/Mesa/src/stages.c index adf614270..8597108c3 100644 --- a/xc/extras/Mesa/src/stages.c +++ b/xc/extras/Mesa/src/stages.c @@ -93,10 +93,18 @@ void gl_update_materials( struct vertex_buffer *VB ) void gl_clean_color( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; +#ifdef VAO + struct gl_client_array *client_data = &ctx->Array.Current->Color; +#else struct gl_client_array *client_data = &ctx->Array.Color; +#endif GLvector4ub *col; +#ifdef VAO + if (!(ctx->Array.Current->Summary & VERT_RGBA)) +#else if (!(ctx->Array.Summary & VERT_RGBA)) +#endif client_data = &ctx->Fallback.Color; if (VB->Type == VB_CVA_PRECALC) { @@ -116,10 +124,18 @@ void gl_clean_color( struct vertex_buffer *VB ) static void clean_index( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; +#ifdef VAO + struct gl_client_array *client_data = &ctx->Array.Current->Index; +#else struct gl_client_array *client_data = &ctx->Array.Index; +#endif GLvector1ui *index; +#ifdef VAO + if (!(ctx->Array.Current->Summary & VERT_INDEX)) +#else if (!(ctx->Array.Summary & VERT_INDEX)) +#endif client_data = &ctx->Fallback.Color; if (VB->Type == VB_CVA_PRECALC) { @@ -140,10 +156,18 @@ static void clean_index( struct vertex_buffer *VB ) static void clean_edgeflag( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; +#ifdef VAO + struct gl_client_array *client_data = &ctx->Array.Current->EdgeFlag; +#else struct gl_client_array *client_data = &ctx->Array.EdgeFlag; +#endif GLvector1ub *edge; +#ifdef VAO + if (!(ctx->Array.Current->Summary & VERT_EDGE)) +#else if (!(ctx->Array.Summary & VERT_EDGE)) +#endif client_data = &ctx->Fallback.EdgeFlag; if (VB->Type == VB_CVA_PRECALC) { @@ -164,11 +188,19 @@ static void clean_edgeflag( struct vertex_buffer *VB ) static void clean_texcoord( struct vertex_buffer *VB, GLuint i ) { GLcontext *ctx = VB->ctx; +#ifdef VAO + struct gl_client_array *client_data = &ctx->Array.Current->TexCoord[i]; +#else struct gl_client_array *client_data = &ctx->Array.TexCoord[i]; +#endif GLvector4f *tc; GLuint flag = PIPE_TEX(i); +#ifdef VAO + if (!(ctx->Array.Current->Summary & flag)) +#else if (!(ctx->Array.Summary & flag)) +#endif client_data = &ctx->Fallback.TexCoord[i]; if (VB->Type == VB_CVA_PRECALC) { diff --git a/xc/extras/Mesa/src/stencil.c b/xc/extras/Mesa/src/stencil.c index 5e0494328..74e03af38 100644 --- a/xc/extras/Mesa/src/stencil.c +++ b/xc/extras/Mesa/src/stencil.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.4 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -1350,11 +1350,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) const GLstencil clearVal = (ctx->Stencil.Clear & mask); GLstencil stencil[MAX_WIDTH]; GLint i; - (*ctx->Driver.ReadStencilSpan)(ctx, x, y, width, stencil); + (*ctx->Driver.ReadStencilSpan)(ctx, width, x, y, stencil); for (i = 0; i < width; i++) { stencil[i] = (stencil[i] & invMask) | clearVal; } - (*ctx->Driver.WriteStencilSpan)(ctx, x, y, width, stencil, NULL); + (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); } } else { @@ -1365,7 +1365,7 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) stencil[i] = ctx->Stencil.Clear; } for (y = ctx->DrawBuffer->Ymin; y <= ctx->DrawBuffer->Ymax; y++) { - (*ctx->Driver.WriteStencilSpan)(ctx, x, y, width, stencil, NULL); + (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); } } } @@ -1383,11 +1383,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) for (y = 0; y < height; y++) { GLstencil stencil[MAX_WIDTH]; GLuint i; - (*ctx->Driver.ReadStencilSpan)(ctx, x, y, width, stencil); + (*ctx->Driver.ReadStencilSpan)(ctx, width, x, y, stencil); for (i = 0; i < width; i++) { stencil[i] = (stencil[i] & invMask) | clearVal; } - (*ctx->Driver.WriteStencilSpan)(ctx, x, y, width, stencil, NULL); + (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); } } else { @@ -1401,7 +1401,7 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) stencil[i] = ctx->Stencil.Clear; } for (y = 0; y < height; y++) { - (*ctx->Driver.WriteStencilSpan)(ctx, x, y, width, stencil, NULL); + (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); } } } diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index ecbc0d7fe..ac4066e14 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -2486,6 +2486,8 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, /* XXX TODO we have to apply pixel transfer ops here! */ + RENDER_START(ctx); + dst = image; stride = width * 4 * sizeof(GLubyte); for (i = 0; i < height; i++) { @@ -2494,6 +2496,8 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, dst += stride; } + RENDER_FINISH(ctx); + /* Read from draw buffer (the default) */ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer ); diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index 86d438c47..d568eadd7 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -69,6 +69,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, obj->Priority = 1.0F; obj->WrapS = GL_REPEAT; obj->WrapT = GL_REPEAT; + obj->WrapR = GL_REPEAT; obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; obj->MagFilter = GL_LINEAR; obj->MinLod = -1000.0; @@ -551,6 +552,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) return; } + ctx->NewState |= NEW_TEXTURING; + if (oldTexObj->Name == texName) return; @@ -611,17 +614,12 @@ _mesa_BindTexture( GLenum target, GLuint texName ) || (oldTexObj->Image[0] && newTexObj->Image[0] && (oldTexObj->Image[0]->Format!=newTexObj->Image[0]->Format)))) { - ctx->NewState |= (NEW_RASTER_OPS | NEW_TEXTURING); + ctx->NewState |= NEW_RASTER_OPS; } - if (oldTexObj->Complete != newTexObj->Complete) - ctx->NewState |= NEW_TEXTURING; - /* Pass BindTexture call to device driver */ if (ctx->Driver.BindTexture) { (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); - /* Make sure the Driver.UpdateState() function gets called! */ - ctx->NewState |= NEW_TEXTURING; } if (oldTexObj->Name > 0) { diff --git a/xc/extras/Mesa/src/texutil.c b/xc/extras/Mesa/src/texutil.c index a64aada5b..313ef1455 100644 --- a/xc/extras/Mesa/src/texutil.c +++ b/xc/extras/Mesa/src/texutil.c @@ -822,15 +822,21 @@ _mesa_convert_texsubimage(MesaIntTexFormat dstFormat, const GLubyte *src = (const GLubyte *) _mesa_image_address(packing, srcImage, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, + const GLint srcRowStride = _mesa_image_row_stride(packing, width, srcFormat, srcType); GLubyte *dst = (GLubyte *) dstImage + dstYoffset * dstRowStride + dstXoffset; + const GLint rowSize = width * sizeof(GLubyte); GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, width * sizeof(GLubyte)); - dst += dstRowStride; - src += srcStride; + if (dstRowStride == srcRowStride && dstRowStride == rowSize) { + MEMCPY(dst, src, rowSize * height); + } + else { + for (row = 0; row < height; row++) { + MEMCPY(dst, src, rowSize); + dst += dstRowStride; + src += srcRowStride; + } } } else { diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h index 9b1e832d7..092760aa5 100644 --- a/xc/extras/Mesa/src/types.h +++ b/xc/extras/Mesa/src/types.h @@ -1037,8 +1037,51 @@ typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], GLuint n ); +/*#define VAO*/ +#ifdef VAO +struct gl_array_object { + GLuint Name; + GLuint RefCount; + + struct gl_client_array Vertex; /* client data descriptors */ + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; + struct gl_client_array EdgeFlag; + + trans_4f_func VertexFunc; /* conversion functions */ + trans_3f_func NormalFunc; + trans_4ub_func ColorFunc; + trans_1ui_func IndexFunc; + trans_4f_func TexCoordFunc[MAX_TEXTURE_UNITS]; + trans_1ub_func EdgeFlagFunc; + + trans_elt_4f_func VertexEltFunc; /* array elt conversion functions */ + trans_elt_3f_func NormalEltFunc; + trans_elt_4ub_func ColorEltFunc; + trans_elt_1ui_func IndexEltFunc; + trans_elt_4f_func TexCoordEltFunc[MAX_TEXTURE_UNITS]; + trans_elt_1ub_func EdgeFlagEltFunc; + + GLint TexCoordInterleaveFactor; + + GLuint LockFirst; + GLuint LockCount; + + GLuint Flag[VB_SIZE]; /* crock */ + GLuint Flags; + GLuint Summary; /* Like flags, but no size information */ +}; +#endif + struct gl_array_attrib { +#ifdef VAO + struct gl_array_object *Current; + GLint ActiveTexture; /* Client Active Texture */ + GLuint NewArrayState; /* Tracks which arrays have been changed. */ +#else struct gl_client_array Vertex; /* client data descriptors */ struct gl_client_array Normal; struct gl_client_array Color; @@ -1070,6 +1113,7 @@ struct gl_array_attrib { GLuint Flags; GLuint Summary; /* Like flags, but no size information */ GLuint NewArrayState; /* Tracks which arrays have been changed. */ +#endif }; @@ -1261,6 +1305,9 @@ struct gl_shared_state { GLint RefCount; /* Reference count */ struct _mesa_HashTable *DisplayList; /* Display lists hash table */ struct _mesa_HashTable *TexObjects; /* Texture objects hash table */ +#ifdef VAO + struct _mesa_HashTable *ArrayObjects; /* GL_EXT_vertex_array_set */ +#endif struct gl_texture_object *TexObjectList;/* Linked list of texture objects */ struct gl_texture_object *DirtyTexObjList; /* List of dirty tex objects */ diff --git a/xc/extras/Mesa/src/varray.c b/xc/extras/Mesa/src/varray.c index 7547ea3bf..ec8b98db9 100644 --- a/xc/extras/Mesa/src/varray.c +++ b/xc/extras/Mesa/src/varray.c @@ -29,11 +29,13 @@ #include "glheader.h" #include "context.h" #include "cva.h" +#include "dlist.h" #include "enable.h" #include "enums.h" -#include "dlist.h" +#include "hash.h" #include "light.h" #include "macros.h" +#include "mem.h" #include "mmath.h" #include "pipeline.h" #include "state.h" @@ -70,26 +72,55 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) gl_lookup_enum_by_nr( type ), stride); +#ifdef VAO + ctx->Array.Current->Vertex.StrideB = stride; +#else ctx->Array.Vertex.StrideB = stride; +#endif if (!stride) { switch (type) { case GL_SHORT: +#ifdef VAO + ctx->Array.Current->Vertex.StrideB = size*sizeof(GLshort); +#else ctx->Array.Vertex.StrideB = size*sizeof(GLshort); +#endif break; case GL_INT: +#ifdef VAO + ctx->Array.Current->Vertex.StrideB = size*sizeof(GLint); +#else ctx->Array.Vertex.StrideB = size*sizeof(GLint); +#endif break; case GL_FLOAT: +#ifdef VAO + ctx->Array.Current->Vertex.StrideB = size*sizeof(GLfloat); +#else ctx->Array.Vertex.StrideB = size*sizeof(GLfloat); +#endif break; case GL_DOUBLE: +#ifdef VAO + ctx->Array.Current->Vertex.StrideB = size*sizeof(GLdouble); +#else ctx->Array.Vertex.StrideB = size*sizeof(GLdouble); +#endif break; default: gl_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); return; } } +#ifdef VAO + ctx->Array.Current->Vertex.Size = size; + ctx->Array.Current->Vertex.Type = type; + ctx->Array.Current->Vertex.Stride = stride; + ctx->Array.Current->Vertex.Ptr = (void *) ptr; + ctx->Array.Current->VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)]; + ctx->Array.Current->VertexEltFunc = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; + ctx->Array.NewArrayState |= VERT_OBJ_ANY; +#else ctx->Array.Vertex.Size = size; ctx->Array.Vertex.Type = type; ctx->Array.Vertex.Stride = stride; @@ -97,6 +128,7 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.VertexEltFunc = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_OBJ_ANY; +#endif ctx->NewState |= NEW_CLIENT_STATE; } @@ -118,34 +150,66 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) gl_lookup_enum_by_nr( type ), stride); +#ifdef VAO + ctx->Array.Current->Normal.StrideB = stride; +#else ctx->Array.Normal.StrideB = stride; +#endif if (!stride) { switch (type) { case GL_BYTE: +#ifdef VAO + ctx->Array.Current->Normal.StrideB = 3*sizeof(GLbyte); +#else ctx->Array.Normal.StrideB = 3*sizeof(GLbyte); +#endif break; case GL_SHORT: +#ifdef VAO + ctx->Array.Current->Normal.StrideB = 3*sizeof(GLshort); +#else ctx->Array.Normal.StrideB = 3*sizeof(GLshort); +#endif break; case GL_INT: +#ifdef VAO + ctx->Array.Current->Normal.StrideB = 3*sizeof(GLint); +#else ctx->Array.Normal.StrideB = 3*sizeof(GLint); +#endif break; case GL_FLOAT: +#ifdef VAO + ctx->Array.Current->Normal.StrideB = 3*sizeof(GLfloat); +#else ctx->Array.Normal.StrideB = 3*sizeof(GLfloat); +#endif break; case GL_DOUBLE: +#ifdef VAO + ctx->Array.Current->Normal.StrideB = 3*sizeof(GLdouble); +#else ctx->Array.Normal.StrideB = 3*sizeof(GLdouble); +#endif break; default: gl_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); return; } } +#ifdef VAO + ctx->Array.Current->Normal.Type = type; + ctx->Array.Current->Normal.Stride = stride; + ctx->Array.Current->Normal.Ptr = (void *) ptr; + ctx->Array.Current->NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)]; + ctx->Array.Current->NormalEltFunc = gl_trans_elt_3f_tab[TYPE_IDX(type)]; +#else ctx->Array.Normal.Type = type; ctx->Array.Normal.Stride = stride; ctx->Array.Normal.Ptr = (void *) ptr; ctx->Array.NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)]; ctx->Array.NormalEltFunc = gl_trans_elt_3f_tab[TYPE_IDX(type)]; +#endif ctx->Array.NewArrayState |= VERT_NORM; ctx->NewState |= NEW_CLIENT_STATE; } @@ -171,44 +235,89 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) gl_lookup_enum_by_nr( type ), stride); +#ifdef VAO + ctx->Array.Current->Color.StrideB = stride; +#else ctx->Array.Color.StrideB = stride; +#endif if (!stride) { switch (type) { case GL_BYTE: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLbyte); +#else ctx->Array.Color.StrideB = size*sizeof(GLbyte); +#endif break; case GL_UNSIGNED_BYTE: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLubyte); +#else ctx->Array.Color.StrideB = size*sizeof(GLubyte); +#endif break; case GL_SHORT: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLshort); +#else ctx->Array.Color.StrideB = size*sizeof(GLshort); +#endif break; case GL_UNSIGNED_SHORT: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLushort); +#else ctx->Array.Color.StrideB = size*sizeof(GLushort); +#endif break; case GL_INT: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLint); +#else ctx->Array.Color.StrideB = size*sizeof(GLint); +#endif break; case GL_UNSIGNED_INT: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLuint); +#else ctx->Array.Color.StrideB = size*sizeof(GLuint); +#endif break; case GL_FLOAT: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLfloat); +#else ctx->Array.Color.StrideB = size*sizeof(GLfloat); +#endif break; case GL_DOUBLE: +#ifdef VAO + ctx->Array.Current->Color.StrideB = size*sizeof(GLdouble); +#else ctx->Array.Color.StrideB = size*sizeof(GLdouble); +#endif break; default: gl_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); return; } } +#ifdef VAO + ctx->Array.Current->Color.Size = size; + ctx->Array.Current->Color.Type = type; + ctx->Array.Current->Color.Stride = stride; + ctx->Array.Current->Color.Ptr = (void *) ptr; + ctx->Array.Current->ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; + ctx->Array.Current->ColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; +#else ctx->Array.Color.Size = size; ctx->Array.Color.Type = type; ctx->Array.Color.Stride = stride; ctx->Array.Color.Ptr = (void *) ptr; ctx->Array.ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.ColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; +#endif ctx->Array.NewArrayState |= VERT_RGBA; ctx->NewState |= NEW_CLIENT_STATE; } @@ -225,34 +334,66 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) return; } +#ifdef VAO + ctx->Array.Current->Index.StrideB = stride; +#else ctx->Array.Index.StrideB = stride; +#endif if (!stride) { switch (type) { case GL_UNSIGNED_BYTE: +#ifdef VAO + ctx->Array.Current->Index.StrideB = sizeof(GLubyte); +#else ctx->Array.Index.StrideB = sizeof(GLubyte); +#endif break; case GL_SHORT: +#ifdef VAO + ctx->Array.Current->Index.StrideB = sizeof(GLshort); +#else ctx->Array.Index.StrideB = sizeof(GLshort); +#endif break; case GL_INT: +#ifdef VAO + ctx->Array.Current->Index.StrideB = sizeof(GLint); +#else ctx->Array.Index.StrideB = sizeof(GLint); +#endif break; case GL_FLOAT: +#ifdef VAO + ctx->Array.Current->Index.StrideB = sizeof(GLfloat); +#else ctx->Array.Index.StrideB = sizeof(GLfloat); +#endif break; case GL_DOUBLE: +#ifdef VAO + ctx->Array.Current->Index.StrideB = sizeof(GLdouble); +#else ctx->Array.Index.StrideB = sizeof(GLdouble); +#endif break; default: gl_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); return; } } +#ifdef VAO + ctx->Array.Current->Index.Type = type; + ctx->Array.Current->Index.Stride = stride; + ctx->Array.Current->Index.Ptr = (void *) ptr; + ctx->Array.Current->IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; + ctx->Array.Current->IndexEltFunc = gl_trans_elt_1ui_tab[TYPE_IDX(type)]; +#else ctx->Array.Index.Type = type; ctx->Array.Index.Stride = stride; ctx->Array.Index.Ptr = (void *) ptr; ctx->Array.IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; ctx->Array.IndexEltFunc = gl_trans_elt_1ui_tab[TYPE_IDX(type)]; +#endif ctx->Array.NewArrayState |= VERT_INDEX; ctx->NewState |= NEW_CLIENT_STATE; } @@ -283,26 +424,55 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr gl_lookup_enum_by_nr( type ), stride); +#ifdef VAO + ctx->Array.Current->TexCoord[texUnit].StrideB = stride; +#else ctx->Array.TexCoord[texUnit].StrideB = stride; +#endif if (!stride) { switch (type) { case GL_SHORT: +#ifdef VAO + ctx->Array.Current->TexCoord[texUnit].StrideB = size*sizeof(GLshort); +#else ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLshort); +#endif break; case GL_INT: +#ifdef VAO + ctx->Array.Current->TexCoord[texUnit].StrideB = size*sizeof(GLint); +#else ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLint); +#endif break; case GL_FLOAT: +#ifdef VAO + ctx->Array.Current->TexCoord[texUnit].StrideB = size*sizeof(GLfloat); +#else ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLfloat); +#endif break; case GL_DOUBLE: +#ifdef VAO + ctx->Array.Current->TexCoord[texUnit].StrideB = size*sizeof(GLdouble); +#else ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLdouble); +#endif break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); return; } } +#ifdef VAO + ctx->Array.Current->TexCoord[texUnit].Size = size; + ctx->Array.Current->TexCoord[texUnit].Type = type; + ctx->Array.Current->TexCoord[texUnit].Stride = stride; + ctx->Array.Current->TexCoord[texUnit].Ptr = (void *) ptr; + + ctx->Array.Current->TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; + ctx->Array.Current->TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; +#else ctx->Array.TexCoord[texUnit].Size = size; ctx->Array.TexCoord[texUnit].Type = type; ctx->Array.TexCoord[texUnit].Stride = stride; @@ -310,6 +480,7 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ctx->Array.TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; +#endif ctx->Array.NewArrayState |= PIPE_TEX(texUnit); ctx->NewState |= NEW_CLIENT_STATE; } @@ -327,6 +498,17 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); return; } +#ifdef VAO + ctx->Array.Current->EdgeFlag.Stride = stride; + ctx->Array.Current->EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean); + ctx->Array.Current->EdgeFlag.Ptr = (GLboolean *) ptr; + if (stride != sizeof(GLboolean)) { + ctx->Array.Current->EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; + } else { + ctx->Array.Current->EdgeFlagFunc = 0; + } + ctx->Array.Current->EdgeFlagEltFunc = gl_trans_elt_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; +#else ctx->Array.EdgeFlag.Stride = stride; ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean); ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr; @@ -336,6 +518,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) ctx->Array.EdgeFlagFunc = 0; } ctx->Array.EdgeFlagEltFunc = gl_trans_elt_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; +#endif ctx->Array.NewArrayState |= VERT_EDGE; ctx->NewState |= NEW_CLIENT_STATE; } @@ -439,12 +622,59 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM, { GLuint *flags = IM->Flag; GLuint *elts = IM->Elt; +#ifdef VAO + GLuint translate = ctx->Array.Current->Flags; +#else GLuint translate = ctx->Array.Flags; +#endif GLuint i; if (MESA_VERBOSE&VERBOSE_IMMEDIATE) fprintf(stderr, "exec_array_elements %d .. %d\n", start, count); +#ifdef VAO + if (translate & VERT_OBJ_ANY) + (ctx->Array.Current->VertexEltFunc)( IM->Obj, + &ctx->Array.Current->Vertex, + flags, elts, (VERT_ELT|VERT_OBJ_ANY), + start, count); + + if (translate & VERT_NORM) + (ctx->Array.Current->NormalEltFunc)( IM->Normal, + &ctx->Array.Current->Normal, + flags, elts, (VERT_ELT|VERT_NORM), + start, count); + + if (translate & VERT_EDGE) + (ctx->Array.Current->EdgeFlagEltFunc)( IM->EdgeFlag, + &ctx->Array.Current->EdgeFlag, + flags, elts, (VERT_ELT|VERT_EDGE), + start, count); + + if (translate & VERT_RGBA) + (ctx->Array.Current->ColorEltFunc)( IM->Color, + &ctx->Array.Current->Color, + flags, elts, (VERT_ELT|VERT_RGBA), + start, count); + + if (translate & VERT_INDEX) + (ctx->Array.Current->IndexEltFunc)( IM->Index, + &ctx->Array.Current->Index, + flags, elts, (VERT_ELT|VERT_INDEX), + start, count); + + if (translate & VERT_TEX0_ANY) + (ctx->Array.Current->TexCoordEltFunc[0])( IM->TexCoord[0], + &ctx->Array.Current->TexCoord[0], + flags, elts, (VERT_ELT|VERT_TEX0_ANY), + start, count); + + if (translate & VERT_TEX1_ANY) + (ctx->Array.Current->TexCoordEltFunc[1])( IM->TexCoord[1], + &ctx->Array.Current->TexCoord[1], + flags, elts, (VERT_ELT|VERT_TEX1_ANY), + start, count); +#else if (translate & VERT_OBJ_ANY) (ctx->Array.VertexEltFunc)( IM->Obj, &ctx->Array.Vertex, @@ -486,7 +716,7 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM, &ctx->Array.TexCoord[1], flags, elts, (VERT_ELT|VERT_TEX1_ANY), start, count); - +#endif for (i = start ; i < count ; i++) if (flags[i] & VERT_ELT) @@ -543,8 +773,11 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) return; } - if (!ctx->CompileFlag && ctx->Array.Vertex.Enabled) - { +#ifdef VAO + if (!ctx->CompileFlag && ctx->Array.Current->Vertex.Enabled) { +#else + if (!ctx->CompileFlag && ctx->Array.Vertex.Enabled) { +#endif GLint remaining = count; GLint i; struct gl_client_array *Normal; @@ -574,11 +807,86 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) gl_build_immediate_pipeline( ctx ); required = elt->inputs; +#ifdef VAO + fallback = (elt->inputs & ~ctx->Array.Current->Summary); +#else fallback = (elt->inputs & ~ctx->Array.Summary); +#endif /* The translate function doesn't do anything about size. It * just ensures that type and stride come out right. */ +#ifdef VAO + IM->v.Obj.size = ctx->Array.Current->Vertex.Size; + + if (required & VERT_RGBA) + { + Color = &ctx->Array.Current->Color; + if (fallback & VERT_RGBA) { + Color = &ctx->Fallback.Color; + ctx->Array.Current->ColorFunc = + gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)]; + } + } + + if (required & VERT_INDEX) + { + Index = &ctx->Array.Current->Index; + if (fallback & VERT_INDEX) { + Index = &ctx->Fallback.Index; + ctx->Array.Current->IndexFunc = gl_trans_1ui_tab[TYPE_IDX(GL_UNSIGNED_INT)]; + } + } + + for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) + { + GLuint flag = VERT_TEX_ANY(i); + + if (required & flag) { + TexCoord[i] = &ctx->Array.Current->TexCoord[i]; + + if (fallback & flag) + { + TexCoord[i] = &ctx->Fallback.TexCoord[i]; + TexCoord[i]->Size = gl_texcoord_size( ctx->Current.Flag, i ); + + ctx->Array.Current->TexCoordFunc[i] = + gl_trans_4f_tab[TexCoord[i]->Size][TYPE_IDX(GL_FLOAT)]; + } + } + } + + if (ctx->Array.Current->Flags != ctx->Array.Current->Flag[0]) + for (i = 0 ; i < VB_MAX ; i++) + ctx->Array.Current->Flag[i] = ctx->Array.Current->Flags; + + + if (required & VERT_NORM) + { + Normal = &ctx->Array.Current->Normal; + if (fallback & VERT_NORM) { + Normal = &ctx->Fallback.Normal; + ctx->Array.Current->NormalFunc = gl_trans_3f_tab[TYPE_IDX(GL_FLOAT)]; + } + } + + if ( required & VERT_EDGE ) + { + if (mode == GL_TRIANGLES || + mode == GL_QUADS || + mode == GL_POLYGON) + { + EdgeFlag = &ctx->Array.Current->EdgeFlag; + if (fallback & VERT_EDGE) { + EdgeFlag = &ctx->Fallback.EdgeFlag; + ctx->Array.Current->EdgeFlagFunc = + gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; + } + } + else + required &= ~VERT_EDGE; + } +#else IM->v.Obj.size = ctx->Array.Vertex.Size; if (required & VERT_RGBA) @@ -648,6 +956,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) else required &= ~VERT_EDGE; } +#endif VB->Primitive = IM->Primitive; VB->NextPrimitive = IM->NextPrimitive; @@ -669,6 +978,42 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->CullMode = 0; +#ifdef VAO + ctx->Array.Current->VertexFunc( IM->Obj + VB_START, + &ctx->Array.Current->Vertex, start, n ); + + if (required & VERT_NORM) { + ctx->Array.Current->NormalFunc( IM->Normal + VB_START, + Normal, start, n ); + } + + if (required & VERT_EDGE) { + ctx->Array.Current->EdgeFlagFunc( IM->EdgeFlag + VB_START, + EdgeFlag, start, n ); + } + + if (required & VERT_RGBA) { + ctx->Array.Current->ColorFunc( IM->Color + VB_START, + Color, start, n ); + } + + if (required & VERT_INDEX) { + ctx->Array.Current->IndexFunc( IM->Index + VB_START, + Index, start, n ); + } + + if (required & VERT_TEX0_ANY) { + IM->v.TexCoord[0].size = TexCoord[0]->Size; + ctx->Array.Current->TexCoordFunc[0]( IM->TexCoord[0] + VB_START, + TexCoord[0], start, n ); + } + + if (required & VERT_TEX1_ANY) { + IM->v.TexCoord[1].size = TexCoord[1]->Size; + ctx->Array.Current->TexCoordFunc[1]( IM->TexCoord[1] + VB_START, + TexCoord[1], start, n ); + } +#else ctx->Array.VertexFunc( IM->Obj + VB_START, &ctx->Array.Vertex, start, n ); @@ -703,7 +1048,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) ctx->Array.TexCoordFunc[1]( IM->TexCoord[1] + VB_START, TexCoord[1], start, n ); } - +#endif VB->ObjPtr = &IM->v.Obj; VB->NormalPtr = &IM->v.Normal; VB->ColorPtr = &IM->v.Color; @@ -713,8 +1058,13 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->TexCoordPtr[0] = &IM->v.TexCoord[0]; VB->TexCoordPtr[1] = &IM->v.TexCoord[1]; +#ifdef VAO + VB->Flag = ctx->Array.Current->Flag; + VB->OrFlag = ctx->Array.Current->Flags; +#else VB->Flag = ctx->Array.Flag; VB->OrFlag = ctx->Array.Flags; +#endif VB->Start = IM->Start = VB_START; count = VB->Count = IM->Count = VB_START + n; @@ -737,15 +1087,24 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->NextPrimitive[VB->CopyStart] = VB->Count; VB->Primitive[VB->CopyStart] = mode; +#ifdef VAO + ctx->Array.Current->Flag[count] |= VERT_END_VB; +#else ctx->Array.Flag[count] |= VERT_END_VB; +#endif /* Transform and render. */ gl_run_pipeline( VB ); gl_reset_vb( VB ); +#ifdef VAO + ctx->Array.Current->Flag[count] = ctx->Array.Current->Flags; + ctx->Array.Current->Flag[VB_START] = ctx->Array.Current->Flags; +#else ctx->Array.Flag[count] = ctx->Array.Flags; ctx->Array.Flag[VB_START] = ctx->Array.Flags; +#endif start += n; remaining -= n; @@ -758,7 +1117,11 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) elt->pipeline_valid = 0; } } - else if (ctx->Array.Vertex.Enabled) +#ifdef VAO + else if (ctx->Array.Current->Vertex.Enabled) +#else + else if (ctx->Array.Vertex.Enabled) +#endif { /* The GL_COMPILE and GL_COMPILE_AND_EXECUTE cases. These * could be handled by the above code, but it gets a little @@ -896,8 +1259,13 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice /* Treat VERT_ELT like a special client array. */ ctx->Array.NewArrayState |= VERT_ELT; +#ifdef VAO + ctx->Array.Current->Summary |= VERT_ELT; + ctx->Array.Current->Flags |= VERT_ELT; +#else ctx->Array.Summary |= VERT_ELT; ctx->Array.Flags |= VERT_ELT; +#endif cva->elt_mode = mode; cva->elt_count = count; @@ -917,8 +1285,13 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice */ if (ctx->CVA.pre.ops & PIPE_OP_RENDER) { ctx->Array.NewArrayState |= VERT_ELT; +#ifdef VAO + ctx->Array.Current->Summary &= ~VERT_ELT; + ctx->Array.Current->Flags &= ~VERT_ELT; +#else ctx->Array.Summary &= ~VERT_ELT; ctx->Array.Flags &= ~VERT_ELT; +#endif return; } @@ -933,7 +1306,11 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice case GL_UNSIGNED_BYTE: { GLubyte *ub_indices = (GLubyte *) indices; +#ifdef VAO + if (ctx->Array.Current->Summary & VERT_OBJ_ANY) { +#else if (ctx->Array.Summary & VERT_OBJ_ANY) { +#endif draw_elt_ubyte( ctx, mode, ub_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) ub_indices[count-1] ); @@ -943,7 +1320,11 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice case GL_UNSIGNED_SHORT: { GLushort *us_indices = (GLushort *) indices; +#ifdef VAO + if (ctx->Array.Current->Summary & VERT_OBJ_ANY) { +#else if (ctx->Array.Summary & VERT_OBJ_ANY) { +#endif draw_elt_ushort( ctx, mode, us_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) us_indices[count-1] ); @@ -953,7 +1334,11 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice case GL_UNSIGNED_INT: { GLuint *ui_indices = (GLuint *) indices; +#ifdef VAO + if (ctx->Array.Current->Summary & VERT_OBJ_ANY) { +#else if (ctx->Array.Summary & VERT_OBJ_ANY) { +#endif draw_elt_uint( ctx, mode, ui_indices, count ); } else { gl_ArrayElement( ctx, ui_indices[count-1] ); @@ -967,7 +1352,11 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice if (ctx->CompileCVAFlag) { ctx->Array.NewArrayState |= VERT_ELT; +#ifdef VAO + ctx->Array.Current->Summary &= ~VERT_ELT; +#else ctx->Array.Summary &= ~VERT_ELT; +#endif } } @@ -1116,7 +1505,11 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) coordUnitSave = ctx->Array.ActiveTexture; if (tflag) { GLint i; +#ifdef VAO + GLint factor = ctx->Array.Current->TexCoordInterleaveFactor; +#else GLint factor = ctx->Array.TexCoordInterleaveFactor; +#endif for (i = 0; i < factor; i++) { _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY ); @@ -1214,10 +1607,31 @@ void gl_update_client_state( GLcontext *ctx ) VERT_TEX0_123, VERT_TEX0_1234 }; +#ifdef VAO + ctx->Array.Current->Flags = 0; + ctx->Array.Current->Summary = 0; +#else ctx->Array.Flags = 0; ctx->Array.Summary = 0; +#endif ctx->input->ArrayIncr = 0; +#ifdef VAO + if (ctx->Array.Current->Normal.Enabled) ctx->Array.Current->Flags |= VERT_NORM; + if (ctx->Array.Current->Color.Enabled) ctx->Array.Current->Flags |= VERT_RGBA; + if (ctx->Array.Current->Index.Enabled) ctx->Array.Current->Flags |= VERT_INDEX; + if (ctx->Array.Current->EdgeFlag.Enabled) ctx->Array.Current->Flags |= VERT_EDGE; + if (ctx->Array.Current->Vertex.Enabled) { + ctx->Array.Current->Flags |= sz_flags[ctx->Array.Current->Vertex.Size]; + ctx->input->ArrayIncr = 1; + } + if (ctx->Array.Current->TexCoord[0].Enabled) { + ctx->Array.Current->Flags |= tc_flags[ctx->Array.Current->TexCoord[0].Size]; + } + if (ctx->Array.Current->TexCoord[1].Enabled) { + ctx->Array.Current->Flags |= (tc_flags[ctx->Array.Current->TexCoord[1].Size] << NR_TEXSIZE_BITS); + } +#else if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM; if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA; if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX; @@ -1232,11 +1646,219 @@ void gl_update_client_state( GLcontext *ctx ) if (ctx->Array.TexCoord[1].Enabled) { ctx->Array.Flags |= (tc_flags[ctx->Array.TexCoord[1].Size] << NR_TEXSIZE_BITS); } +#endif /* Not really important any more: */ +#ifdef VAO + ctx->Array.Current->Summary = ctx->Array.Current->Flags & VERT_DATA; + ctx->input->ArrayAndFlags = ~ctx->Array.Current->Flags; +#else ctx->Array.Summary = ctx->Array.Flags & VERT_DATA; ctx->input->ArrayAndFlags = ~ctx->Array.Flags; +#endif ctx->input->ArrayEltFlush = !(ctx->CompileCVAFlag); } + + +/**********************************************************************/ +/* Vertex Array Objects extension */ +/**********************************************************************/ + +#ifdef VAO + +struct gl_array_object * +_mesa_alloc_vertex_array_object(GLcontext *ctx, GLuint name) +{ + struct gl_array_object *arrayObj; + + arrayObj = MALLOC_STRUCT(gl_array_object); + if (arrayObj) { + GLuint i; + arrayObj->Name = name; + arrayObj->RefCount = 1; + arrayObj->Vertex.Size = 4; + arrayObj->Vertex.Type = GL_FLOAT; + arrayObj->Vertex.Stride = 0; + arrayObj->Vertex.StrideB = 0; + arrayObj->Vertex.Ptr = NULL; + arrayObj->Vertex.Enabled = GL_FALSE; + arrayObj->Normal.Type = GL_FLOAT; + arrayObj->Normal.Stride = 0; + arrayObj->Normal.StrideB = 0; + arrayObj->Normal.Ptr = NULL; + arrayObj->Normal.Enabled = GL_FALSE; + arrayObj->Color.Size = 4; + arrayObj->Color.Type = GL_FLOAT; + arrayObj->Color.Stride = 0; + arrayObj->Color.StrideB = 0; + arrayObj->Color.Ptr = NULL; + arrayObj->Color.Enabled = GL_FALSE; + arrayObj->Index.Type = GL_FLOAT; + arrayObj->Index.Stride = 0; + arrayObj->Index.StrideB = 0; + arrayObj->Index.Ptr = NULL; + arrayObj->Index.Enabled = GL_FALSE; + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + arrayObj->TexCoord[i].Size = 4; + arrayObj->TexCoord[i].Type = GL_FLOAT; + arrayObj->TexCoord[i].Stride = 0; + arrayObj->TexCoord[i].StrideB = 0; + arrayObj->TexCoord[i].Ptr = NULL; + arrayObj->TexCoord[i].Enabled = GL_FALSE; + } + arrayObj->TexCoordInterleaveFactor = 1; + arrayObj->EdgeFlag.Stride = 0; + arrayObj->EdgeFlag.StrideB = 0; + arrayObj->EdgeFlag.Ptr = NULL; + arrayObj->EdgeFlag.Enabled = GL_FALSE; + + /* Put into hash table */ + _mesa_HashInsert(ctx->Shared->ArrayObjects, name, arrayObj); + } + return arrayObj; +} + + +void +glGenArraySetsEXT(GLsizei n, GLuint *arrayset) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint first; + GLint i; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenArraySetsEXT"); + + if (n < 0) { + gl_error(ctx, GL_INVALID_VALUE, "glGenArraySetsEXT"); + return; + } + + if (!arrayset) + return; + + /* + * This must be atomic (generation and allocation of texture IDs) + */ + /*XXX _glthread_LOCK_MUTEX(GenTexturesLock);*/ + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ArrayObjects, n); + + /* Return the object names */ + for (i = 0; i < n; i++) { + arrayset[i] = first + i; + } + + /* Allocate new array objects */ + for (i = 0; i < n; i++) { + struct gl_array_object *arrayObj; + GLuint name = first + i; + arrayObj = _mesa_alloc_vertex_array_object(ctx, name); + if (!arrayObj) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glGenArraySetsEXT"); + break; + } + } + + /*XXX _glthread_UNLOCK_MUTEX(GenTexturesLock);*/ +} + + +void +glBindArraySetEXT(GLuint arraySet) +{ + struct gl_array_object *arrayObj; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindArraySetEXT"); + + if (arraySet < 0) { + gl_error(ctx, GL_INVALID_OPERATION, "glBindArraySetEXT"); + return; + } + + ctx->Array.Current->RefCount--; + if (ctx->Array.Current->RefCount == 0) { + _mesa_HashRemove(ctx->Shared->ArrayObjects, arraySet); + FREE(ctx->Array.Current); + } + + arrayObj = (struct gl_array_object *) _mesa_HashLookup(ctx->Shared->ArrayObjects, arraySet); + if (arrayObj) { + ctx->Array.Current = arrayObj; + } + else { + /* create the array object and insert into hash table */ + arrayObj = _mesa_alloc_vertex_array_object(ctx, arraySet); + if (!arrayObj) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glBindArraySetEXT"); + return; + } + ctx->Array.Current = (struct gl_array_object *) _mesa_HashLookup(ctx->Shared->ArrayObjects, 0); + } + + ctx->Array.Current->RefCount++; + + /* Signal new state */ + /* ctx->Array.NewArrayState = ~0;*/ + ctx->NewState |= NEW_CLIENT_STATE; + +#if 0 + printf("Bind %d\n", ctx->Array.Current->Name); + printf("Vertex array size: %d\n", ctx->Array.Current->Vertex.Size); + printf("Vertex array enable: %d\n", ctx->Array.Current->Vertex.Enabled); + + printf("Normal array size: %d\n", ctx->Array.Current->Normal.Size); + printf("Normal array enable: %d\n", ctx->Array.Current->Normal.Enabled); + printf("Lock first %d count %d\n", ctx->Array.Current->LockFirst, + ctx->Array.Current->LockCount); +#endif +} + + +void +glDeleteArraySetsEXT(GLsizei n, const GLuint *arraySet) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteArraySetsEXT"); + + if (n < 0) { + gl_error(ctx, GL_INVALID_OPERATION, "glDeleteArraySetEXT"); + return; + } + + for (i = 0; i < n; i++) { + if (arraySet[i] > 0) { + struct gl_array_object *arrayObj; + arrayObj = (struct gl_array_object *) _mesa_HashLookup(ctx->Shared->ArrayObjects, arraySet[i]); + if (arrayObj) { + arrayObj->RefCount--; + if (arrayObj->RefCount == 0) { + _mesa_HashRemove(ctx->Shared->ArrayObjects, arraySet[i]); + FREE(arrayObj); + } + } + } + } +} + + +GLboolean +glIsArraySetEXT(GLuint arraySet) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsArraySetEXT", + GL_FALSE); + + if (arraySet > 0 && _mesa_HashLookup(ctx->Shared->ArrayObjects, arraySet)) { + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + +#endif diff --git a/xc/extras/Mesa/src/vbxform.c b/xc/extras/Mesa/src/vbxform.c index 13d47a398..dc3e3e709 100644 --- a/xc/extras/Mesa/src/vbxform.c +++ b/xc/extras/Mesa/src/vbxform.c @@ -269,8 +269,13 @@ void gl_reset_input( GLcontext *ctx ) VERT_BEGIN_0, IM->Start, gl_lookup_enum_by_nr(ctx->Current.Primitive)); +#ifdef VAO + IM->ArrayAndFlags = ~ctx->Array.Current->Flags; + IM->ArrayIncr = ctx->Array.Current->Vertex.Enabled; +#else IM->ArrayAndFlags = ~ctx->Array.Flags; IM->ArrayIncr = ctx->Array.Vertex.Enabled; +#endif IM->ArrayEltFlush = !(ctx->CompileCVAFlag); } diff --git a/xc/extras/Mesa/util/.cvsignore b/xc/extras/Mesa/util/.cvsignore new file mode 100644 index 000000000..10e05e0da --- /dev/null +++ b/xc/extras/Mesa/util/.cvsignore @@ -0,0 +1,5 @@ +.deps +.libs +Makefile.in +*.lo +*.o diff --git a/xc/extras/Mesa/util/Makefile.am b/xc/extras/Mesa/util/Makefile.am index f797d1b20..cc9285d79 100644 --- a/xc/extras/Mesa/util/Makefile.am +++ b/xc/extras/Mesa/util/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = no-dependencies +#AUTOMAKE_OPTIONS = no-dependencies INCLUDES = -I$(top_srcdir)/include $(GLUT_CFLAGS) diff --git a/xc/extras/Mesa/util/imagesgi.cpp b/xc/extras/Mesa/util/imagesgi.cpp new file mode 100644 index 000000000..f5128aabe --- /dev/null +++ b/xc/extras/Mesa/util/imagesgi.cpp @@ -0,0 +1,369 @@ +/****************************************************************************** +** Filename : imageSgi.cpp +** UNCLASSIFIED +** +** Description : Utility to read SGI image format files. This code was +** originally a SGI image loading utility provided with the +** Mesa 3D library @ http://www.mesa3d.org by Brain Paul. +** This has been extended to read all SGI image formats +** (e.g. INT, INTA, RGB, RGBA). +** +** Revision History: +** Date Name Description +** 06/07/99 BRC Initial Release +** +** Note: +** +** The SGI Image Data (if not RLE) +** +** If the image is stored verbatim (without RLE), then image data directly +** follows the 512 byte header. The data for each scanline of the first +** channel is written first. If the image has more than 1 channel, all +** the data for the first channel is written, followed by the remaining +** channels. If the BPC value is 1, then each scanline is written as XSIZE +** bytes. If the BPC value is 2, then each scanline is written as XSIZE +** shorts. These shorts are stored in the byte order described above. +** +******************************************************************************/ +#define __IMAGESGI_CPP + +#include "imagesgi.h" + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <assert.h> + +struct sImageSgiRaw +{ + struct sImageSgiHeader header; + unsigned char *chan0; + unsigned char *chan1; + unsigned char *chan2; + unsigned char *chan3; + unsigned int *rowStart; + int *rowSize; +}; + +// Static routines +static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName); +static void ImageSgiRawClose(struct sImageSgiRaw *raw); +static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf, + int y, int z); +static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi +*final); +static void *SwitchEndian16(void *value); +static void *SwitchEndian32(void *value); + +// Static variables +FILE *mFp = NULL; +unsigned char *mChanTmp = NULL; + + +/*****************************************************************************/ +struct sImageSgi *ImageSgiOpen(char const * const fileName) +{ + struct sImageSgiRaw *raw = NULL; + struct sImageSgi *final = NULL; + + raw = ImageSgiRawOpen(fileName); + final = new struct sImageSgi; + + assert(final); + if(final) + { + final->header = raw->header; + final->data = NULL; + ImageSgiRawGetData(raw, final); + ImageSgiRawClose(raw); + } + + return final; +} // ImageSgiRawOpen + + +/*****************************************************************************/ +void ImageSgiClose(struct sImageSgi *image) +{ + + if(image) + { + if(image->data) + delete[] image->data; + image->data = NULL; + delete image; + } + image = NULL; + + return; +} // ImageSgiClose + + +/*****************************************************************************/ +static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName) +{ + struct sImageSgiRaw *raw = NULL; + int x; + int i; + bool swapFlag = false; + union + { + int testWord; + char testByte[4]; + } endianTest; + endianTest.testWord = 1; + + // Determine endianess of platform. + if(endianTest.testByte[0] == 1) + swapFlag = true; + else + swapFlag = false; + + raw = new struct sImageSgiRaw; + + assert(raw); + if(raw) + { + raw->chan0 = NULL; + raw->chan1 = NULL; + raw->chan2 = NULL; + raw->chan3 = NULL; + raw->rowStart = NULL; + raw->rowSize = NULL; + mFp = fopen(fileName, "rb"); + assert(mFp); + + fread(&raw->header, sizeof(struct sImageSgiHeader), 1, mFp); + if(swapFlag == true) + { + SwitchEndian16(&raw->header.magic); + SwitchEndian16(&raw->header.type); + SwitchEndian16(&raw->header.dim); + SwitchEndian16(&raw->header.xsize); + SwitchEndian16(&raw->header.ysize); + SwitchEndian16(&raw->header.zsize); + } + + mChanTmp = new unsigned char[raw->header.xsize * raw->header.ysize]; + assert(mChanTmp); + switch(raw->header.zsize) + { + case 4: + raw->chan3 = new unsigned char[raw->header.xsize * +raw->header.ysize]; + assert(raw->chan3); + case 3: + raw->chan2 = new unsigned char[raw->header.xsize * +raw->header.ysize]; + assert(raw->chan2); + case 2: + raw->chan1 = new unsigned char[raw->header.xsize * +raw->header.ysize]; + assert(raw->chan1); + case 1: + raw->chan0 = new unsigned char[raw->header.xsize * +raw->header.ysize]; + assert(raw->chan0); + } + + if(raw->header.type == IMAGE_SGI_TYPE_RLE) + { + x = raw->header.ysize * raw->header.zsize * sizeof(unsigned int); + raw->rowStart = new unsigned int[x]; + raw->rowSize = new int[x]; + + fseek(mFp, sizeof(struct sImageSgiHeader), SEEK_SET); + fread(raw->rowStart, 1, x, mFp); + fread(raw->rowSize, 1, x, mFp); + + if(swapFlag == true) + { + for(i=0; i<x/sizeof(unsigned int); i++) + SwitchEndian32(&raw->rowStart[i]); + for(i=0; i<x/sizeof(int); i++) + SwitchEndian32(&raw->rowSize[i]); + } + + } + + } + + return raw; +} // ImageSgiRawOpen + + +/*****************************************************************************/ +static void ImageSgiRawClose(struct sImageSgiRaw *raw) +{ + + fclose(mFp); + mFp = NULL; + + if(mChanTmp) + delete[] mChanTmp; + mChanTmp = NULL; + + if(raw->chan0) + delete[] raw->chan0; + raw->chan0 = NULL; + + if(raw->chan1) + delete[] raw->chan1; + raw->chan1 = NULL; + + if(raw->chan2) + delete[] raw->chan2; + raw->chan2 = NULL; + + if(raw->chan3) + delete[] raw->chan3; + raw->chan3 = NULL; + + if(raw) + delete raw; + raw = NULL; + + return; +} // ImageSgiRawClose + + +/*****************************************************************************/ +static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf, + int y, int z) +{ + unsigned char *iPtr = NULL; + unsigned char *oPtr = NULL; + unsigned char pixel; + int count; + + if((raw->header.type & 0xFF00) == 0x0100) + { + fseek(mFp, raw->rowStart[y+z*raw->header.ysize], SEEK_SET); + fread(mChanTmp, 1, (unsigned int)raw->rowSize[y+z*raw->header.ysize], +mFp); + iPtr = mChanTmp; + oPtr = buf; + while(1) + { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if(!count) + { + return; + } + if (pixel & 0x80) + { + while (count--) + { + *oPtr++ = *iPtr++; + } + } + else + { + pixel = *iPtr++; + while (count--) + { + *oPtr++ = pixel; + } + } + } + } + else + { + fseek(mFp, + sizeof(struct sImageSgiHeader)+(y*raw->header.xsize) + + (z*raw->header.xsize*raw->header.ysize), + SEEK_SET); + fread(buf, 1, raw->header.xsize, mFp); + } + + return; +} // ImageSgiRawGetRow + + +/*****************************************************************************/ +static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi +*final) +{ + unsigned char *ptr = NULL; + int i, j; + + final->data = + new unsigned +char[raw->header.xsize*raw->header.ysize*raw->header.zsize]; + assert(final->data); + + ptr = final->data; + for(i=0; i<raw->header.ysize; i++) + { + switch(raw->header.zsize) + { + case 1: + ImageSgiRawGetRow(raw, raw->chan0, i, 0); + for(j=0; j<raw->header.xsize; j++) + *(ptr++) = raw->chan0[j]; + break; + case 2: + ImageSgiRawGetRow(raw, raw->chan0, i, 0); + ImageSgiRawGetRow(raw, raw->chan1, i, 1); + for(j=0; j<raw->header.xsize; j++) + { + *(ptr++) = raw->chan0[j]; + *(ptr++) = raw->chan1[j]; + } + break; + case 3: + ImageSgiRawGetRow(raw, raw->chan0, i, 0); + ImageSgiRawGetRow(raw, raw->chan1, i, 1); + ImageSgiRawGetRow(raw, raw->chan2, i, 2); + for(j=0; j<raw->header.xsize; j++) + { + *(ptr++) = raw->chan0[j]; + *(ptr++) = raw->chan1[j]; + *(ptr++) = raw->chan2[j]; + } + break; + case 4: + ImageSgiRawGetRow(raw, raw->chan0, i, 0); + ImageSgiRawGetRow(raw, raw->chan1, i, 1); + ImageSgiRawGetRow(raw, raw->chan2, i, 2); + ImageSgiRawGetRow(raw, raw->chan3, i, 3); + for(j=0; j<raw->header.xsize; j++) + { + *(ptr++) = raw->chan0[j]; + *(ptr++) = raw->chan1[j]; + *(ptr++) = raw->chan2[j]; + *(ptr++) = raw->chan3[j]; + } + break; + } + } + + return; +} // ImageSgiRawGetData + + +/*****************************************************************************/ +static void *SwitchEndian16(void *value) +{ + short value16 = *(short *) value; + value16 = ((value16 & 0xff00) >> 8L) + + ((value16 & 0x00ff) << 8L); + *(short *)value = value16; + return value; +} // SwitchEndian16 + + +/*****************************************************************************/ +static void *SwitchEndian32(void *value) +{ + int value32 = *(int *) value; + value32 = ((value32 & 0xff000000) >> 24L) + + ((value32 & 0x00ff0000) >> 8) + + ((value32 & 0x0000ff00) << 8) + + ((value32 & 0x000000ff) << 24L); + *(int *)value = value32; + return value; +} // SwitchEndian32 + diff --git a/xc/extras/Mesa/xdemos/.cvsignore b/xc/extras/Mesa/xdemos/.cvsignore new file mode 100644 index 000000000..a745dcd65 --- /dev/null +++ b/xc/extras/Mesa/xdemos/.cvsignore @@ -0,0 +1,18 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.o +glthreads +glxdemo +glxdpyinfo +glxheads +glxinfo +glxpixmap +manywin +offset +shape +wincopy +xdemo +xfont diff --git a/xc/extras/Mesa/xdemos/Makefile.X11 b/xc/extras/Mesa/xdemos/Makefile.X11 new file mode 100644 index 000000000..d717db41b --- /dev/null +++ b/xc/extras/Mesa/xdemos/Makefile.X11 @@ -0,0 +1,67 @@ +# $Id: Makefile.X11,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ + +# Mesa 3-D graphics library +# Version: 3.3 +# Copyright (C) 1995-2000 Brian Paul + +# Makefile for non-GLUT (X11, SVGA, etc) demo programs + + +##### MACROS ##### + +INCDIR = ../include +LIBDIR = ../lib + +GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(APP_LIB_DEPS) + +LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB) + +PROGS = glthreads \ + glxdemo \ + glxheads \ + glxinfo \ + glxpixmap \ + manywin \ + offset \ + wincopy \ + xdemo \ + xfont + + + +##### RULES ##### + +.SUFFIXES: +.SUFFIXES: .c + +.c: $(LIB_DEP) + $(CC) -I$(INCDIR) $(CFLAGS) $< $(GL_LIBS) -o $@ + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + +clean: + -rm *.o *~ + +realclean: + -rm $(PROGS) + -rm *.o *~ + +targets: $(PROGS) + +# execute all programs +exec: $(PROGS) + @for prog in $(PROGS) ; \ + do \ + echo -n "Running $$prog ..." ; \ + $$prog ; \ + echo ; \ + done + + +include ../Make-config + diff --git a/xc/extras/Mesa/xdemos/Makefile.am b/xc/extras/Mesa/xdemos/Makefile.am new file mode 100644 index 000000000..dcdfa1bc6 --- /dev/null +++ b/xc/extras/Mesa/xdemos/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to produce Makefile.in + +#AUTOMAKE_OPTIONS = no-dependencies + +INCLUDES = -I$(top_srcdir)/include $(GLUT_CFLAGS) $(X_CFLAGS) $(SVGA_CFLAGS) + +if HAVE_SVGA +SVGA_PROG = vgears vindex vtest +endif + +EXTRA_PROGRAMS = shape xfont + +check_PROGRAMS = glthreads glxdemo glxheads glxinfo glxpixmap manywin offset \ + xdemo wincopy $(SVGA_PROG) + +LDADD = $(GLUT_LIBS) $(top_builddir)/src-glu/libGLU.la \ + $(top_builddir)/src/libGL.la -lm +LDFLAGS = -no-install + +# execute all programs +exec: $(check_PROGRAMS) + @for prog in $(check_PROGRAMS); \ + do \ + echo -n "Running $$prog ..." ; \ + ./$$prog ; \ + echo ; \ + done diff --git a/xc/extras/Mesa/xdemos/descrip.mms b/xc/extras/Mesa/xdemos/descrip.mms new file mode 100644 index 000000000..aa56c1cec --- /dev/null +++ b/xc/extras/Mesa/xdemos/descrip.mms @@ -0,0 +1,79 @@ +# Makefile for demo programs for VMS +# contributed by Jouk Jansen joukj@crys.chem.uva.nl + + +.first + define gl [-.include.gl] + +.include [-]mms-config. + +##### MACROS ##### + +INCDIR = [-.include] +CFLAGS = /include=$(INCDIR)/define=(FBIND=1) + +GL_LIBS = [-.lib]libMesaaux/l,libMesatk/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) + +LIB_DEP = [-.lib]$(GL_LIB) [-.lib]$(GLU_LIB) [-.lib]$(TK_LIB) [-.lib]$(AUX_LIB) + +PROGS = bounce.exe;,gamma.exe;,gears.exe;,glxdemo.exe;,glxpixmap.exe;,\ + isosurf.exe;,offset.exe;,osdemo.exe;,spin.exe;,test0.exe;,\ + texobj.exe;,xdemo.exe;,reflect.exe;,winpos.exe; + + + +##### RULES ##### + + +##### TARGETS ##### +default : + mms $(PROGS) + +clean : + delete *.obj;* + +realclean : + delete $(PROGS) + delete *.obj;* + +bounce.exe; : bounce.obj $(LIB_DEP) + link bounce,$(GL_LIBS) + +gamma.exe; : gamma.obj $(LIB_DEP) + link gamma,$(GL_LIBS) + +gears.exe; : gears.obj $(LIB_DEP) + link gears,$(GL_LIBS) + +glxdemo.exe; : glxdemo.obj $(LIB_DEP) + link glxdemo,$(GL_LIBS) + +glxpixmap.exe; : glxpixmap.obj $(LIB_DEP) + link glxpixmap,$(GL_LIBS) + +isosurf.exe; : isosurf.obj $(LIB_DEP) + link isosurf,$(GL_LIBS) + +offset.exe; : offset.obj $(LIB_DEP) + link offset,$(GL_LIBS) + +osdemo.exe; : osdemo.obj $(LIB_DEP) + link osdemo,$(GL_LIBS) + +spin.exe; : spin.obj $(LIB_DEP) + link spin,$(GL_LIBS) + +test0.exe; : test0.obj $(LIB_DEP) + link test0,$(GL_LIBS) + +texobj.exe; : texobj.obj $(LIB_DEP) + link texobj,$(GL_LIBS) + +xdemo.exe; : xdemo.obj $(LIB_DEP) + link xdemo,$(GL_LIBS) + +reflect.exe; : reflect.obj $(LIB_DEP) + link reflect,$(GL_LIBS) + +winpos.exe; : winpos.obj $(LIB_DEP) + link winpos,$(GL_LIBS) diff --git a/xc/extras/Mesa/xdemos/glthreads.c b/xc/extras/Mesa/xdemos/glthreads.c new file mode 100644 index 000000000..32f308464 --- /dev/null +++ b/xc/extras/Mesa/xdemos/glthreads.c @@ -0,0 +1,420 @@ +/* $Id: glthreads.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Copyright (C) 2000 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. + */ + + +/* + * This program tests GLX thread safety. + * Command line options: + * -n <num threads> Number of threads to create (default is 2) + * -display <display name> Specify X display (default is :0.0) + * + * Brian Paul 20 July 2000 + */ + + +#if defined(PTHREADS) /* defined by Mesa on Linux and other platforms */ + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <pthread.h> + + +/* + * Each window/thread/context: + */ +struct winthread { + Display *Dpy; + int Index; + pthread_t Thread; + Window Win; + GLXContext Context; + float Angle; + int WinWidth, WinHeight; + GLboolean NewSize; +}; + + +#define MAX_WINTHREADS 100 +static struct winthread WinThreads[MAX_WINTHREADS]; +static int NumWinThreads = 0; +static GLboolean ExitFlag = GL_FALSE; + + + +static void +Error(const char *msg) +{ + fprintf(stderr, "Error: %s\n", msg); + exit(1); +} + + +/* draw a colored cube */ +static void +draw_object(void) +{ + glPushMatrix(); + glScalef(0.75, 0.75, 0.75); + + glColor3f(1, 0, 0); + glBegin(GL_POLYGON); + glVertex3f(1, -1, -1); + glVertex3f(1, 1, -1); + glVertex3f(1, 1, 1); + glVertex3f(1, -1, 1); + glEnd(); + + glColor3f(0, 1, 1); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, -1); + glVertex3f(-1, 1, -1); + glVertex3f(-1, 1, 1); + glVertex3f(-1, -1, 1); + glEnd(); + + glColor3f(0, 1, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, 1, -1); + glVertex3f( 1, 1, -1); + glVertex3f( 1, 1, 1); + glVertex3f(-1, 1, 1); + glEnd(); + + glColor3f(1, 0, 1); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, -1); + glVertex3f( 1, -1, -1); + glVertex3f( 1, -1, 1); + glVertex3f(-1, -1, 1); + glEnd(); + + glColor3f(0, 0, 1); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 1); + glVertex3f( 1, -1, 1); + glVertex3f( 1, 1, 1); + glVertex3f(-1, 1, 1); + glEnd(); + + glColor3f(1, 1, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, -1); + glVertex3f( 1, -1, -1); + glVertex3f( 1, 1, -1); + glVertex3f(-1, 1, -1); + glEnd(); + glPopMatrix(); +} + + +/* signal resize of given window */ +static void +resize(struct winthread *wt, int w, int h) +{ + wt->NewSize = GL_TRUE; + wt->WinWidth = w; + wt->WinHeight = h; +} + + +/* + * We have an instance of this for each thread. + */ +static void +draw_loop(struct winthread *wt) +{ + while (!ExitFlag) { + + glXMakeCurrent(wt->Dpy, wt->Win, wt->Context); + + glEnable(GL_DEPTH_TEST); + + if (wt->NewSize) { + GLfloat w = (float) wt->WinWidth / (float) wt->WinHeight; + glViewport(0, 0, wt->WinWidth, wt->WinHeight); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-w, w, -1.0, 1.0, 1.5, 10); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0, 0, -2.5); + wt->NewSize = GL_FALSE; + } + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(wt->Angle, 0, 0, 1); + glRotatef(wt->Angle, 1, 0, 0); + glScalef(0.7, 0.7, 0.7); + draw_object(); + glPopMatrix(); + + glXSwapBuffers(wt->Dpy, wt->Win); + + wt->Angle += 1.0; + } +} + + +/* + * The main process thread runs this loop. + */ +static void +event_loop(Display *dpy) +{ + while (!ExitFlag) { + static long mask = StructureNotifyMask | ExposureMask | KeyPressMask; + XEvent event; + int i; + + for (i = 0; i < NumWinThreads; i++) { + struct winthread *wt = &WinThreads[i]; + while (XCheckWindowEvent(dpy, wt->Win, mask, &event)) { + if (event.xany.window == wt->Win) { + switch (event.type) { + case ConfigureNotify: + resize(wt, event.xconfigure.width, + event.xconfigure.height); + break; + case KeyPress: + /* tell all threads to exit */ + ExitFlag = GL_TRUE; + /*printf("exit draw_loop %d\n", wt->Index);*/ + return; + default: + /*no-op*/ ; + } + } + else { + printf("window mismatch\n"); + } + } + } + } +} + + +/* + * we'll call this once for each thread, before the threads are created. + */ +static void +create_window(struct winthread *wt) +{ + Window win; + GLXContext ctx; + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DEPTH_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + XVisualInfo *visinfo; + int width = 80, height = 80; + int xpos = (wt->Index % 10) * 90; + int ypos = (wt->Index / 10) * 100; + + scrnum = DefaultScreen(wt->Dpy); + root = RootWindow(wt->Dpy, scrnum); + + visinfo = glXChooseVisual(wt->Dpy, scrnum, attrib); + if (!visinfo) { + Error("Unable to find RGB, Z, double-buffered visual"); + } + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap(wt->Dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow(wt->Dpy, root, xpos, ypos, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr); + if (!win) { + Error("Couldn't create window"); + } + + { + XSizeHints sizehints; + sizehints.x = xpos; + sizehints.y = ypos; + sizehints.width = width; + sizehints.height = height; + sizehints.flags = USSize | USPosition; + XSetNormalHints(wt->Dpy, win, &sizehints); + XSetStandardProperties(wt->Dpy, win, "glthreads", "glthreads", + None, (char **)NULL, 0, &sizehints); + } + + + ctx = glXCreateContext(wt->Dpy, visinfo, NULL, True); + if (!ctx) { + Error("Couldn't create GLX context"); + } + + XMapWindow(wt->Dpy, win); + XSync(wt->Dpy, 0); + + /* save the info for this window/context */ + wt->Win = win; + wt->Context = ctx; + wt->Angle = 0.0; + wt->WinWidth = width; + wt->WinHeight = height; + wt->NewSize = GL_TRUE; +} + + +/* + * Called by pthread_create() + */ +static void * +thread_function(void *p) +{ + struct winthread *wt = (struct winthread *) p; + draw_loop(wt); + return NULL; +} + + +/* + * called before exit to wait for all threads to finish + */ +static void +clean_up(void) +{ + int i; + + /* wait for threads to finish */ + for (i = 0; i < NumWinThreads; i++) { + pthread_join(WinThreads[i].Thread, NULL); + } + + for (i = 0; i < NumWinThreads; i++) { + glXDestroyContext(WinThreads[i].Dpy, WinThreads[i].Context); + XDestroyWindow(WinThreads[i].Dpy, WinThreads[i].Win); + } +} + + + +int +main(int argc, char *argv[]) +{ + char *displayName = ":0.0"; + int numThreads = 2; + Display *dpy; + int i; + Status threadStat; + + if (argc == 1) { + printf("threadgl: test of GL thread safety (any key = exit)\n"); + printf("Usage:\n"); + printf(" threadgl [-display dpyName] [-n numthreads]\n"); + } + else { + int i; + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) { + displayName = argv[i + 1]; + i++; + } + else if (strcmp(argv[i], "-n") == 0 && i + 1 < argc) { + numThreads = atoi(argv[i + 1]); + if (numThreads < 1) + numThreads = 1; + else if (numThreads > MAX_WINTHREADS) + numThreads = MAX_WINTHREADS; + i++; + } + } + } + + /* + * VERY IMPORTANT: call XInitThreads() before any other Xlib functions. + */ + threadStat = XInitThreads(); + if (threadStat) { + printf("XInitThreads() returned %d (success)\n", (int) threadStat); + } + else { + printf("XInitThreads() returned 0 (failure- this program may fail)\n"); + } + + + dpy = XOpenDisplay(displayName); + if (!dpy) { + fprintf(stderr, "Unable to open display %s\n", displayName); + return -1; + } + + NumWinThreads = numThreads; + + /* Create the GLX windows and contexts */ + for (i = 0; i < numThreads; i++) { + WinThreads[i].Dpy = dpy; + WinThreads[i].Index = i; + create_window(&WinThreads[i]); + } + + /* Create the threads */ + for (i = 0; i < numThreads; i++) { + pthread_create(&WinThreads[i].Thread, NULL, thread_function, + (void*) &WinThreads[i]); + printf("Created Thread %p\n", WinThreads[i].Thread); + } + + event_loop(dpy); + + clean_up(); + + XCloseDisplay(dpy); + + return 0; +} + + +#else /* PTHREADS */ + + +#include <stdio.h> + +int +main(int argc, char *argv[]) +{ + printf("Sorry, this program wasn't compiled with PTHREADS defined.\n"); + return 0; +} + + +#endif /* PTHREADS */ diff --git a/xc/extras/Mesa/xdemos/glxdemo.c b/xc/extras/Mesa/xdemos/glxdemo.c new file mode 100644 index 000000000..ce8fd4cc9 --- /dev/null +++ b/xc/extras/Mesa/xdemos/glxdemo.c @@ -0,0 +1,139 @@ +/* $Id: glxdemo.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + + +/* + * A demonstration of using the GLX functions. This program is in the + * public domain. + * + * Brian Paul + */ + + +/* + * $Log: glxdemo.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.1.1.1 1999/08/19 00:55:43 jtg + * Imported sources + * + * Revision 3.0 1998/02/21 02:16:54 brianp + * initial rev + * + */ + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> + + + +static void redraw( Display *dpy, Window w ) +{ + printf("Redraw event\n"); + + glClear( GL_COLOR_BUFFER_BIT ); + + glColor3f( 1.0, 1.0, 0.0 ); + glRectf( -0.8, -0.8, 0.8, 0.8 ); + + glXSwapBuffers( dpy, w ); +} + + + +static void resize( unsigned int width, unsigned int height ) +{ + printf("Resize event\n"); + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); +} + + + +static Window make_rgb_db_window( Display *dpy, + unsigned int width, unsigned int height ) +{ + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + Window win; + GLXContext ctx; + XVisualInfo *visinfo; + + scrnum = DefaultScreen( dpy ); + root = RootWindow( dpy, scrnum ); + + visinfo = glXChooseVisual( dpy, scrnum, attrib ); + if (!visinfo) { + printf("Error: couldn't get an RGB, Double-buffered visual\n"); + exit(1); + } + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow( dpy, root, 0, 0, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr ); + + ctx = glXCreateContext( dpy, visinfo, NULL, True ); + + glXMakeCurrent( dpy, win, ctx ); + + return win; +} + + +static void event_loop( Display *dpy ) +{ + XEvent event; + + while (1) { + XNextEvent( dpy, &event ); + + switch (event.type) { + case Expose: + redraw( dpy, event.xany.window ); + break; + case ConfigureNotify: + resize( event.xconfigure.width, event.xconfigure.height ); + break; + } + } +} + + + +int main( int argc, char *argv[] ) +{ + Display *dpy; + Window win; + + dpy = XOpenDisplay(NULL); + + win = make_rgb_db_window( dpy, 300, 300 ); + + glShadeModel( GL_FLAT ); + glClearColor( 0.5, 0.5, 0.5, 1.0 ); + + XMapWindow( dpy, win ); + + event_loop( dpy ); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/glxheads.c b/xc/extras/Mesa/xdemos/glxheads.c new file mode 100644 index 000000000..a502179e8 --- /dev/null +++ b/xc/extras/Mesa/xdemos/glxheads.c @@ -0,0 +1,286 @@ +/* $Id: glxheads.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Exercise multiple GLX connections on multiple X displays. + * Direct GLX contexts are attempted first, then indirect. + * Each window will display a spinning green triangle. + * + * Copyright (C) 2000 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. + */ + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + + +/* + * Each display/window/context: + */ +struct head { + char DisplayName[1000]; + Display *Dpy; + Window Win; + GLXContext Context; + float Angle; + char Renderer[1000]; + char Vendor[1000]; + char Version[1000]; +}; + + +#define MAX_HEADS 20 +static struct head Heads[MAX_HEADS]; +static int NumHeads = 0; + + +static void +Error(const char *display, const char *msg) +{ + fprintf(stderr, "Error on display %s - %s\n", display, msg); + exit(1); +} + + +static struct head * +AddHead(const char *displayName) +{ + Display *dpy; + Window win; + GLXContext ctx; + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + XVisualInfo *visinfo; + int width = 300, height = 300; + int xpos = 10, ypos = 10; + + if (NumHeads >= MAX_HEADS) + return NULL; + + dpy = XOpenDisplay(displayName); + if (!dpy) { + Error(displayName, "Unable to open display"); + return NULL; + } + + scrnum = DefaultScreen(dpy); + root = RootWindow(dpy, scrnum); + + visinfo = glXChooseVisual(dpy, scrnum, attrib); + if (!visinfo) { + Error(displayName, "Unable to find RGB, double-buffered visual"); + return NULL; + } + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow(dpy, root, 0, 0, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr); + if (!win) { + Error(displayName, "Couldn't create window"); + return NULL; + } + + { + XSizeHints sizehints; + sizehints.x = xpos; + sizehints.y = ypos; + sizehints.width = width; + sizehints.height = height; + sizehints.flags = USSize | USPosition; + XSetNormalHints(dpy, win, &sizehints); + XSetStandardProperties(dpy, win, displayName, displayName, + None, (char **)NULL, 0, &sizehints); + } + + + ctx = glXCreateContext(dpy, visinfo, NULL, True); + if (!ctx) { + Error(displayName, "Couldn't create GLX context"); + return NULL; + } + + XMapWindow(dpy, win); + + if (!glXMakeCurrent(dpy, win, ctx)) { + Error(displayName, "glXMakeCurrent failed"); + printf("glXMakeCurrent failed in Redraw()\n"); + return NULL; + } + + /* save the info for this head */ + { + struct head *h = &Heads[NumHeads]; + strcpy(h->DisplayName, displayName); + h->Dpy = dpy; + h->Win = win; + h->Context = ctx; + h->Angle = 0.0; + strcpy(h->Version, (char *) glGetString(GL_VERSION)); + strcpy(h->Vendor, (char *) glGetString(GL_VENDOR)); + strcpy(h->Renderer, (char *) glGetString(GL_RENDERER)); + NumHeads++; + return &Heads[NumHeads-1]; + } + +} + + +static void +Redraw(struct head *h) +{ + if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { + Error(h->DisplayName, "glXMakeCurrent failed"); + printf("glXMakeCurrent failed in Redraw()\n"); + return; + } + + h->Angle += 1.0; + + glShadeModel(GL_FLAT); + glClearColor(0.5, 0.5, 0.5, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* draw green triangle */ + glColor3f(0.0, 1.0, 0.0); + glPushMatrix(); + glRotatef(h->Angle, 0, 0, 1); + glBegin(GL_TRIANGLES); + glVertex2f(0, 0.8); + glVertex2f(-0.8, -0.7); + glVertex2f(0.8, -0.7); + glEnd(); + glPopMatrix(); + + glXSwapBuffers(h->Dpy, h->Win); +} + + + +static void +Resize(const struct head *h, unsigned int width, unsigned int height) +{ + if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { + Error(h->DisplayName, "glXMakeCurrent failed in Resize()"); + return; + } + glFlush(); + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); +} + + + +static void +EventLoop(void) +{ + while (1) { + int i; + for (i = 0; i < NumHeads; i++) { + struct head *h = &Heads[i]; + while (XPending(h->Dpy) > 0) { + XEvent event; + XNextEvent(h->Dpy, &event); + if (event.xany.window == h->Win) { + switch (event.type) { + case Expose: + Redraw(h); + break; + case ConfigureNotify: + Resize(h, event.xconfigure.width, event.xconfigure.height); + break; + case KeyPress: + return; + default: + /*no-op*/ ; + } + } + else { + printf("window mismatch\n"); + } + } + Redraw(h); + } + usleep(1); + } +} + + + +static void +PrintInfo(const struct head *h) +{ + printf("Name: %s\n", h->DisplayName); + printf(" Display: 0x%x\n", h->Dpy); + printf(" Window: 0x%x\n", h->Win); + printf(" Context: 0x%x\n", h->Context); + printf(" GL_VERSION: %s\n", h->Version); + printf(" GL_VENDOR: %s\n", h->Vendor); + printf(" GL_RENDERER: %s\n", h->Renderer); +} + + +int +main(int argc, char *argv[]) +{ + int i; + if (argc == 1) { + struct head *h; + printf("glxheads: exercise multiple GLX connections (any key = exit)\n"); + printf("Usage:\n"); + printf(" glxheads xdisplayname ...\n"); + printf("Example:\n"); + printf(" glxheads :0 mars:0 venus:1\n"); + h = AddHead(":0"); + if (h) + PrintInfo(h); + } + else { + for (i = 1; i < argc; i++) { + const char *name = argv[i]; + struct head *h = AddHead(name); + if (h) { + PrintInfo(h); + } + } + } + + EventLoop(); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/glxinfo.c b/xc/extras/Mesa/xdemos/glxinfo.c new file mode 100644 index 000000000..eb9c5eb9f --- /dev/null +++ b/xc/extras/Mesa/xdemos/glxinfo.c @@ -0,0 +1,532 @@ +/* $Id: glxinfo.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * 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. + */ + + +/* + * This program is a work-alike of the IRIX glxinfo program. + * Command line options: + * -t print wide table + * -v print verbose information + * -display DisplayName specify the X display to interogate + * + * Brian Paul 26 January 2000 + */ + + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <GL/gl.h> +#include <GL/glu.h> +#include <GL/glx.h> +#include <stdio.h> +#include <string.h> + + +typedef enum +{ + Normal, + Wide, + Verbose +} InfoMode; + + +struct visual_attribs +{ + /* X visual attribs */ + int id; + int klass; + int depth; + int redMask, greenMask, blueMask; + int colormapSize; + int bitsPerRGB; + + /* GL visual attribs */ + int supportsGL; + int transparent; + int bufferSize; + int level; + int rgba; + int doubleBuffer; + int stereo; + int auxBuffers; + int redSize, greenSize, blueSize, alphaSize; + int depthSize; + int stencilSize; + int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize; + int numSamples, numMultisample; + int visualCaveat; +}; + + +/* + * Print a list of extensions, with word-wrapping. + */ +static void +print_extension_list(const char *ext) +{ + const char *indentString = " "; + const int indent = 4; + const int max = 79; + int width, i, j; + + if (!ext || !ext[0]) + return; + + width = indent; + printf(indentString); + i = j = 0; + while (1) { + if (ext[j] == ' ' || ext[j] == 0) { + /* found end of an extension name */ + const int len = j - i; + if (width + len > max) { + /* start a new line */ + printf("\n"); + width = indent; + printf(indentString); + } + /* print the extension name between ext[i] and ext[j] */ + while (i < j) { + printf("%c", ext[i]); + i++; + } + /* either we're all done, or we'll continue with next extension */ + width += len + 1; + if (ext[j] == 0) { + break; + } + else { + i++; + j++; + if (ext[j] == 0) + break; + printf(", "); + width += 2; + } + } + j++; + } + printf("\n"); +} + + +static void +print_screen_info(Display *dpy, int scrnum) +{ + Window win; + int attribSingle[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + None }; + int attribDouble[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + + XSetWindowAttributes attr; + unsigned long mask; + Window root; + GLXContext ctx; + XVisualInfo *visinfo; + int width = 100, height = 100; + + root = RootWindow(dpy, scrnum); + + visinfo = glXChooseVisual(dpy, scrnum, attribSingle); + if (!visinfo) { + visinfo = glXChooseVisual(dpy, scrnum, attribDouble); + if (!visinfo) { + fprintf(stderr, "Error: couldn't find RGB GLX visual\n"); + return; + } + } + + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + win = XCreateWindow(dpy, root, 0, 0, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr); + + ctx = glXCreateContext( dpy, visinfo, NULL, True ); + if (!ctx) { + fprintf(stderr, "Error: glXCreateContext failed\n"); + XDestroyWindow(dpy, win); + return; + } + + if (glXMakeCurrent(dpy, win, ctx)) { + const char *serverVendor = glXQueryServerString(dpy, scrnum, GLX_VENDOR); + const char *serverVersion = glXQueryServerString(dpy, scrnum, GLX_VERSION); + const char *serverExtensions = glXQueryServerString(dpy, scrnum, GLX_EXTENSIONS); + const char *clientVendor = glXGetClientString(dpy, GLX_VENDOR); + const char *clientVersion = glXGetClientString(dpy, GLX_VERSION); + const char *clientExtensions = glXGetClientString(dpy, GLX_EXTENSIONS); + const char *glxExtensions = glXQueryExtensionsString(dpy, scrnum); + const char *glVendor = (const char *) glGetString(GL_VENDOR); + const char *glRenderer = (const char *) glGetString(GL_RENDERER); + const char *glVersion = (const char *) glGetString(GL_VERSION); + const char *glExtensions = (const char *) glGetString(GL_EXTENSIONS); + const char *gluVersion = (const char *) gluGetString(GLU_VERSION); + const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS); + printf("display: %s screen:%d\n", DisplayString(dpy), scrnum); + printf("direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No"); + printf("server glx vendor string: %s\n", serverVendor); + printf("server glx version string: %s\n", serverVersion); + printf("server glx extensions:\n"); + print_extension_list(serverExtensions); + printf("client glx vendor string: %s\n", clientVendor); + printf("client glx version string: %s\n", clientVersion); + printf("client glx extensions:\n"); + print_extension_list(clientExtensions); + printf("GLX extensions:\n"); + print_extension_list(glxExtensions); + printf("OpenGL vendor string: %s\n", glVendor); + printf("OpenGL renderer string: %s\n", glRenderer); + printf("OpenGL version string: %s\n", glVersion); + printf("OpenGL extensions:\n"); + print_extension_list(glExtensions); + printf("glu version: %s\n", gluVersion); + printf("glu extensions:\n"); + print_extension_list(gluExtensions); + } + else { + fprintf(stderr, "Error: glXMakeCurrent failed\n"); + } + + glXDestroyContext(dpy, ctx); + XDestroyWindow(dpy, win); +} + + +static const char * +visual_class_name(int cls) +{ + switch (cls) { + case StaticColor: + return "StaticColor"; + case PseudoColor: + return "PseudoColor"; + case StaticGray: + return "StaticGray"; + case GrayScale: + return "GrayScale"; + case TrueColor: + return "TrueColor"; + case DirectColor: + return "DirectColor"; + default: + return ""; + } +} + + +static const char * +visual_class_abbrev(int cls) +{ + switch (cls) { + case StaticColor: + return "sc"; + case PseudoColor: + return "pc"; + case StaticGray: + return "sg"; + case GrayScale: + return "gs"; + case TrueColor: + return "tc"; + case DirectColor: + return "dc"; + default: + return ""; + } +} + + +static void +get_visual_attribs(Display *dpy, XVisualInfo *vInfo, + struct visual_attribs *attribs) +{ + const char *ext = glXQueryExtensionsString(dpy, vInfo->screen); + + memset(attribs, 0, sizeof(struct visual_attribs)); + + attribs->id = vInfo->visualid; +#if defined(__cplusplus) || defined(c_plusplus) + attribs->klass = vInfo->c_class; +#else + attribs->klass = vInfo->class; +#endif + attribs->depth = vInfo->depth; + attribs->redMask = vInfo->red_mask; + attribs->greenMask = vInfo->green_mask; + attribs->blueMask = vInfo->blue_mask; + attribs->colormapSize = vInfo->colormap_size; + attribs->bitsPerRGB = vInfo->bits_per_rgb; + + if (glXGetConfig(dpy, vInfo, GLX_USE_GL, &attribs->supportsGL) != 0) + return; + glXGetConfig(dpy, vInfo, GLX_BUFFER_SIZE, &attribs->bufferSize); + glXGetConfig(dpy, vInfo, GLX_LEVEL, &attribs->level); + glXGetConfig(dpy, vInfo, GLX_RGBA, &attribs->rgba); + glXGetConfig(dpy, vInfo, GLX_DOUBLEBUFFER, &attribs->doubleBuffer); + glXGetConfig(dpy, vInfo, GLX_STEREO, &attribs->stereo); + glXGetConfig(dpy, vInfo, GLX_AUX_BUFFERS, &attribs->auxBuffers); + glXGetConfig(dpy, vInfo, GLX_RED_SIZE, &attribs->redSize); + glXGetConfig(dpy, vInfo, GLX_GREEN_SIZE, &attribs->greenSize); + glXGetConfig(dpy, vInfo, GLX_BLUE_SIZE, &attribs->blueSize); + glXGetConfig(dpy, vInfo, GLX_ALPHA_SIZE, &attribs->alphaSize); + glXGetConfig(dpy, vInfo, GLX_DEPTH_SIZE, &attribs->depthSize); + glXGetConfig(dpy, vInfo, GLX_STENCIL_SIZE, &attribs->stencilSize); + glXGetConfig(dpy, vInfo, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize); + glXGetConfig(dpy, vInfo, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize); + glXGetConfig(dpy, vInfo, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize); + glXGetConfig(dpy, vInfo, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize); + + /* transparent pixel value not implemented yet */ + attribs->transparent = 0; + + /* multisample tests not implemented yet */ + attribs->numSamples = 0; + attribs->numMultisample = 0; + +#if defined(GLX_EXT_visual_rating) + if (ext && strstr(ext, "GLX_EXT_visual_rating")) { + glXGetConfig(dpy, vInfo, GLX_VISUAL_CAVEAT_EXT, &attribs->visualCaveat); + } + else { + attribs->visualCaveat = GLX_NONE_EXT; + } +#else + attribs->visualCaveat = 0; +#endif +} + + +static void +print_visual_attribs_verbose(const struct visual_attribs *attribs) +{ + printf("Visual ID: %x depth=%d class=%s\n", + attribs->id, attribs->depth, visual_class_name(attribs->klass)); + printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n", + attribs->bufferSize, attribs->level, attribs->rgba ? "rgba" : "ci", + attribs->doubleBuffer, attribs->stereo); + printf(" rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", + attribs->redSize, attribs->greenSize, + attribs->blueSize, attribs->alphaSize); + printf(" auxBuffers=%d depthSize=%d stencilSize=%d\n", + attribs->auxBuffers, attribs->depthSize, attribs->stencilSize); + printf(" accum: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", + attribs->accumRedSize, attribs->accumGreenSize, + attribs->accumBlueSize, attribs->accumAlphaSize); + printf(" multiSample=%d multiSampleBuffers=%d\n", + attribs->numSamples, attribs->numMultisample); +#ifdef GLX_EXT_visual_rating + if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0) + printf(" visualCaveat=None\n"); + else if (attribs->visualCaveat == GLX_SLOW_VISUAL_EXT) + printf(" visualCaveat=Slow\n"); + else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT) + printf(" visualCaveat=Nonconformant\n"); +#endif + printf(" %s\n", attribs->transparent ? "Transparent." : "Opaque."); +} + + +static void +print_visual_attribs_short_header(void) +{ + printf(" visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav\n"); + printf(" id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat\n"); + printf("----------------------------------------------------------------------\n"); +} + + +static void +print_visual_attribs_short(const struct visual_attribs *attribs) +{ + char *caveat; +#ifdef GLX_EXT_visual_rating + if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0) + caveat = "None"; + else if (attribs->visualCaveat == GLX_SLOW_VISUAL_EXT) + caveat = "Slow"; + else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT) + caveat = "Ncon"; +#else + caveat = "None"; +#endif + + printf("0x%2x %2d %2s %2d %2d %2d %1s %2s %2s %2d %2d %2d %2d %2d %2d %2d", + attribs->id, + attribs->depth, + visual_class_abbrev(attribs->klass), + attribs->transparent, + attribs->bufferSize, + attribs->level, + attribs->rgba ? "r" : "c", + attribs->doubleBuffer ? "y" : ".", + attribs->stereo ? "y" : ".", + attribs->redSize, attribs->greenSize, + attribs->blueSize, attribs->alphaSize, + attribs->auxBuffers, + attribs->depthSize, + attribs->stencilSize + ); + + printf(" %2d %2d %2d %2d %2d %1d %s\n", + attribs->accumRedSize, attribs->accumGreenSize, + attribs->accumBlueSize, attribs->accumAlphaSize, + attribs->numSamples, attribs->numMultisample, + caveat + ); +} + + +static void +print_visual_attribs_long_header(void) +{ + printf("Vis Vis Visual Trans buff lev render DB ste r g b a aux dep ste accum buffers MS MS\n"); + printf(" ID Depth Type parent size el type reo sz sz sz sz buf th ncl r g b a num bufs\n"); + printf("----------------------------------------------------------------------------------------------------\n"); +} + + +static void +print_visual_attribs_long(const struct visual_attribs *attribs) +{ + printf("0x%2x %2d %-11s %2d %2d %2d %4s %3d %3d %3d %3d %3d %3d", + attribs->id, + attribs->depth, + visual_class_name(attribs->klass), + attribs->transparent, + attribs->bufferSize, + attribs->level, + attribs->rgba ? "rgba" : "ci ", + attribs->doubleBuffer, + attribs->stereo, + attribs->redSize, attribs->greenSize, + attribs->blueSize, attribs->alphaSize + ); + + printf(" %3d %4d %2d %3d %3d %3d %3d %2d %2d\n", + attribs->auxBuffers, + attribs->depthSize, + attribs->stencilSize, + attribs->accumRedSize, attribs->accumGreenSize, + attribs->accumBlueSize, attribs->accumAlphaSize, + attribs->numSamples, attribs->numMultisample + ); +} + + +static void +print_visual_info(Display *dpy, int scrnum, InfoMode mode) +{ + XVisualInfo template; + XVisualInfo *visuals; + int numVisuals; + long mask; + int i; + + /* get list of all visuals on this screen */ + template.screen = scrnum; + mask = VisualScreenMask; + visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals); + + if (mode == Verbose) { + for (i = 0; i < numVisuals; i++) { + struct visual_attribs attribs; + get_visual_attribs(dpy, &visuals[i], &attribs); + print_visual_attribs_verbose(&attribs); + } + } + else if (mode == Normal) { + print_visual_attribs_short_header(); + for (i = 0; i < numVisuals; i++) { + struct visual_attribs attribs; + get_visual_attribs(dpy, &visuals[i], &attribs); + print_visual_attribs_short(&attribs); + } + } + else if (mode == Wide) { + print_visual_attribs_long_header(); + for (i = 0; i < numVisuals; i++) { + struct visual_attribs attribs; + get_visual_attribs(dpy, &visuals[i], &attribs); + print_visual_attribs_long(&attribs); + } + } + + XFree(visuals); +} + + +int +main(int argc, char *argv[]) +{ + char *displayName = ":0"; + Display *dpy; + int numScreens, scrnum; + InfoMode mode = Normal; + int i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) { + displayName = argv[i + 1]; + i++; + } + else if (strcmp(argv[i], "-t") == 0) { + mode = Wide; + } + else if (strcmp(argv[i], "-v") == 0) { + mode = Verbose; + } + } + + dpy = XOpenDisplay(displayName); + if (!dpy) { + fprintf(stderr, "Error: unable to open display %s\n", displayName); + return -1; + } + + numScreens = ScreenCount(dpy); + for (scrnum = 0; scrnum < numScreens; scrnum++) { + print_screen_info(dpy, scrnum); + printf("\n"); + print_visual_info(dpy, scrnum, mode); + if (scrnum + 1 < numScreens) + printf("\n\n"); + } + + XCloseDisplay(dpy); + + return 0; +} diff --git a/xc/extras/Mesa/xdemos/glxpixmap.c b/xc/extras/Mesa/xdemos/glxpixmap.c new file mode 100644 index 000000000..ab7f93647 --- /dev/null +++ b/xc/extras/Mesa/xdemos/glxpixmap.c @@ -0,0 +1,186 @@ +/* $Id: glxpixmap.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + + +/* + * A demonstration of using the GLXPixmap functions. This program is in + * the public domain. + * + * Brian Paul + */ + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static GLXContext ctx; +static XVisualInfo *visinfo; +static GC gc; + + + +static Window make_rgb_window( Display *dpy, + unsigned int width, unsigned int height ) +{ + const int sbAttrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + None }; + const int dbAttrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + Window win; + + scrnum = DefaultScreen( dpy ); + root = RootWindow( dpy, scrnum ); + + visinfo = glXChooseVisual( dpy, scrnum, (int *) sbAttrib ); + if (!visinfo) { + visinfo = glXChooseVisual( dpy, scrnum, (int *) dbAttrib ); + if (!visinfo) { + printf("Error: couldn't get an RGB visual\n"); + exit(1); + } + } + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + /* TODO: share root colormap if possible */ + attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow( dpy, root, 0, 0, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr ); + + /* make an X GC so we can do XCopyArea later */ + gc = XCreateGC( dpy, win, 0, NULL ); + + /* need indirect context */ + ctx = glXCreateContext( dpy, visinfo, NULL, False ); + if (!ctx) { + printf("Error: glXCreateContext failed\n"); + exit(-1); + } + + printf("Direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No"); + + return win; +} + + +static GLXPixmap make_pixmap( Display *dpy, Window win, + unsigned int width, unsigned int height, + Pixmap *pixmap) +{ + Pixmap pm; + GLXPixmap glxpm; + XWindowAttributes attr; + + pm = XCreatePixmap( dpy, win, width, height, visinfo->depth ); + if (!pm) { + printf("Error: XCreatePixmap failed\n"); + exit(-1); + } + + XGetWindowAttributes( dpy, win, &attr ); + + /* + * IMPORTANT: + * Use the glXCreateGLXPixmapMESA funtion when using Mesa because + * Mesa needs to know the colormap associated with a pixmap in order + * to render correctly. This is because Mesa allows RGB rendering + * into any kind of visual, not just TrueColor or DirectColor. + */ +#ifdef GLX_MESA_pixmap_colormap + if (strstr(glXQueryExtensionsString(dpy, 0), "GLX_MESA_pixmap_colormap")) { + /* stand-alone Mesa, specify the colormap */ + glxpm = glXCreateGLXPixmapMESA( dpy, visinfo, pm, attr.colormap ); + } + else { + glxpm = glXCreateGLXPixmap( dpy, visinfo, pm ); + } +#else + /* This will work with Mesa too if the visual is TrueColor or DirectColor */ + glxpm = glXCreateGLXPixmap( dpy, visinfo, pm ); +#endif + + if (!glxpm) { + printf("Error: GLXCreateGLXPixmap failed\n"); + exit(-1); + } + + *pixmap = pm; + + return glxpm; +} + + + +static void event_loop( Display *dpy, GLXPixmap pm ) +{ + XEvent event; + + while (1) { + XNextEvent( dpy, &event ); + + switch (event.type) { + case Expose: + printf("Redraw\n"); + /* copy the image from GLXPixmap to window */ + XCopyArea( dpy, pm, event.xany.window, /* src, dest */ + gc, 0, 0, 300, 300, /* gc, src pos, size */ + 0, 0 ); /* dest pos */ + break; + case ConfigureNotify: + /* nothing */ + break; + } + } +} + + + +int main( int argc, char *argv[] ) +{ + Display *dpy; + Window win; + Pixmap pm; + GLXPixmap glxpm; + + dpy = XOpenDisplay(NULL); + + win = make_rgb_window( dpy, 300, 300 ); + glxpm = make_pixmap( dpy, win, 300, 300, &pm ); + + glXMakeCurrent( dpy, glxpm, ctx ); + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + /* Render an image into the pixmap */ + glShadeModel( GL_FLAT ); + glClearColor( 0.5, 0.5, 0.5, 1.0 ); + glClear( GL_COLOR_BUFFER_BIT ); + glViewport( 0, 0, 300, 300 ); + glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); + glColor3f( 0.0, 1.0, 1.0 ); + glRectf( -0.75, -0.75, 0.75, 0.75 ); + glFlush(); + + XMapWindow( dpy, win ); + + event_loop( dpy, pm ); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/manywin.c b/xc/extras/Mesa/xdemos/manywin.c new file mode 100644 index 000000000..33f257928 --- /dev/null +++ b/xc/extras/Mesa/xdemos/manywin.c @@ -0,0 +1,289 @@ +/* $Id: manywin.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Create N GLX windows/contexts and render to them in round-robin + * order. + * + * Copyright (C) 2000 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. + */ + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +/* + * Each display/window/context: + */ +struct head { + char DisplayName[1000]; + Display *Dpy; + Window Win; + GLXContext Context; + float Angle; + char Renderer[1000]; + char Vendor[1000]; + char Version[1000]; +}; + + +#define MAX_HEADS 200 +static struct head Heads[MAX_HEADS]; +static int NumHeads = 0; + + +static void +Error(const char *display, const char *msg) +{ + fprintf(stderr, "Error on display %s - %s\n", display, msg); + exit(1); +} + + +static struct head * +AddHead(const char *displayName, const char *name) +{ + Display *dpy; + Window win; + GLXContext ctx; + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + XVisualInfo *visinfo; + int width = 90, height = 90; + int xpos = 0, ypos = 0; + + if (NumHeads >= MAX_HEADS) + return NULL; + + dpy = XOpenDisplay(displayName); + if (!dpy) { + Error(displayName, "Unable to open display"); + return NULL; + } + + scrnum = DefaultScreen(dpy); + root = RootWindow(dpy, scrnum); + + visinfo = glXChooseVisual(dpy, scrnum, attrib); + if (!visinfo) { + Error(displayName, "Unable to find RGB, double-buffered visual"); + return NULL; + } + + /* window attributes */ + xpos = (NumHeads % 10) * 100; + ypos = (NumHeads / 10) * 100; + printf("%d, %d\n", xpos, ypos); + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow(dpy, root, xpos, ypos, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr); + if (!win) { + Error(displayName, "Couldn't create window"); + return NULL; + } + + { + XSizeHints sizehints; + sizehints.x = xpos; + sizehints.y = ypos; + sizehints.width = width; + sizehints.height = height; + sizehints.flags = USSize | USPosition; + XSetNormalHints(dpy, win, &sizehints); + XSetStandardProperties(dpy, win, name, name, + None, (char **)NULL, 0, &sizehints); + } + + + ctx = glXCreateContext(dpy, visinfo, NULL, True); + if (!ctx) { + Error(displayName, "Couldn't create GLX context"); + return NULL; + } + + XMapWindow(dpy, win); + + if (!glXMakeCurrent(dpy, win, ctx)) { + Error(displayName, "glXMakeCurrent failed"); + printf("glXMakeCurrent failed in Redraw()\n"); + return; + } + + /* save the info for this head */ + { + struct head *h = &Heads[NumHeads]; + strcpy(h->DisplayName, name); + h->Dpy = dpy; + h->Win = win; + h->Context = ctx; + h->Angle = 0.0; + strcpy(h->Version, (char *) glGetString(GL_VERSION)); + strcpy(h->Vendor, (char *) glGetString(GL_VENDOR)); + strcpy(h->Renderer, (char *) glGetString(GL_RENDERER)); + NumHeads++; + return &Heads[NumHeads-1]; + } + +} + + +static void +Redraw(struct head *h) +{ + if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { + Error(h->DisplayName, "glXMakeCurrent failed"); + printf("glXMakeCurrent failed in Redraw()\n"); + return; + } + + h->Angle += 1.0; + + glShadeModel(GL_FLAT); + glClearColor(0.5, 0.5, 0.5, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* draw green triangle */ + glColor3f(0.0, 1.0, 0.0); + glPushMatrix(); + glRotatef(h->Angle, 0, 0, 1); + glBegin(GL_TRIANGLES); + glVertex2f(0, 0.8); + glVertex2f(-0.8, -0.7); + glVertex2f(0.8, -0.7); + glEnd(); + glPopMatrix(); + + glXSwapBuffers(h->Dpy, h->Win); +} + + + +static void +Resize(const struct head *h, unsigned int width, unsigned int height) +{ + if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { + Error(h->DisplayName, "glXMakeCurrent failed in Resize()"); + return; + } + glFlush(); + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); +} + + + +static void +EventLoop(void) +{ + while (1) { + int i; + for (i = 0; i < NumHeads; i++) { + struct head *h = &Heads[i]; + while (XPending(h->Dpy) > 0) { + XEvent event; + XNextEvent(h->Dpy, &event); + if (event.xany.window == h->Win) { + switch (event.type) { + case Expose: + Redraw(h); + break; + case ConfigureNotify: + Resize(h, event.xconfigure.width, event.xconfigure.height); + break; + case KeyPress: + return; + default: + /*no-op*/ ; + } + } + else { + printf("window mismatch\n"); + } + } + Redraw(h); + } + usleep(1); + } +} + + + +static void +PrintInfo(const struct head *h) +{ + printf("Name: %s\n", h->DisplayName); + printf(" Display: 0x%x\n", h->Dpy); + printf(" Window: 0x%x\n", h->Win); + printf(" Context: 0x%x\n", h->Context); + printf(" GL_VERSION: %s\n", h->Version); + printf(" GL_VENDOR: %s\n", h->Vendor); + printf(" GL_RENDERER: %s\n", h->Renderer); +} + + +int +main(int argc, char *argv[]) +{ + int i; + if (argc == 1) { + struct head *h; + printf("manywin: open N simultaneous glx windows\n"); + printf("Usage:\n"); + printf(" manywin numWindows\n"); + printf("Example:\n"); + printf(" manywin 10\n"); + return 0; + } + else { + int n = atoi(argv[1]); + printf("%d windows\n", n); + for (i = 0; i < n; i++) { + char name[100]; + struct head *h; + sprintf(name, "%d", i); + h = AddHead(":0", name); + if (h) { + PrintInfo(h); + } + } + } + + EventLoop(); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/offset.c b/xc/extras/Mesa/xdemos/offset.c new file mode 100644 index 000000000..3e92e68da --- /dev/null +++ b/xc/extras/Mesa/xdemos/offset.c @@ -0,0 +1,323 @@ +/**************************************************************************** +Copyright 1995 by Silicon Graphics Incorporated, Mountain View, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +****************************************************************************/ + +/* + * Derived from code written by Kurt Akeley, November 1992 + * + * Uses PolygonOffset to draw hidden-line images. PolygonOffset + * shifts the z values of polygons an amount that is + * proportional to their slope in screen z. This keeps + * the lines, which are drawn without displacement, from + * interacting with their respective polygons, and + * thus eliminates line dropouts. + * + * The left image shows an ordinary antialiased wireframe image. + * The center image shows an antialiased hidden-line image without + * PolygonOffset. + * The right image shows an antialiased hidden-line image using + * PolygonOffset to reduce artifacts. + * + * Drag with a mouse button pressed to rotate the models. + * Press the escape key to exit. + */ + +/* + * Modified for OpenGL 1.1 glPolygonOffset() conventions + */ + + +#include <GL/glx.h> +#include <GL/glu.h> +#include <X11/keysym.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#undef GL_EXT_polygon_offset /* use GL 1.1 version instead of extension */ + + +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif + +#define MAXQUAD 6 + +typedef float Vertex[3]; + +typedef Vertex Quad[4]; + +/* data to define the six faces of a unit cube */ +Quad quads[MAXQUAD] = { + { {0,0,0}, {1,0,0}, {1,1,0}, {0,1,0} }, + { {0,0,1}, {1,0,1}, {1,1,1}, {0,1,1} }, + { {0,0,0}, {1,0,0}, {1,0,1}, {0,0,1} }, + { {0,1,0}, {1,1,0}, {1,1,1}, {0,1,1} }, + { {0,0,0}, {0,0,1}, {0,1,1}, {0,1,0} }, + { {1,0,0}, {1,0,1}, {1,1,1}, {1,1,0} } +}; + +#define WIREFRAME 0 +#define HIDDEN_LINE 1 + +static void error(const char* prog, const char* msg); +static void cubes(int mx, int my, int mode); +static void fill(Quad quad); +static void outline(Quad quad); +static void draw_hidden(Quad quad, int mode); +static void process_input(Display *dpy, Window win); +static int query_extension(char* extName); + +static int attributeList[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 1, None }; + +static int dimension = 3; + +int main(int argc, char** argv) { + Display *dpy; + XVisualInfo *vi; + XSetWindowAttributes swa; + Window win; + GLXContext cx; + + dpy = XOpenDisplay(0); + if (!dpy) error(argv[0], "can't open display"); + + vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList); + if (!vi) error(argv[0], "no suitable visual"); + + cx = glXCreateContext(dpy, vi, 0, GL_TRUE); + + swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), + vi->visual, AllocNone); + + swa.border_pixel = 0; + swa.event_mask = ExposureMask | StructureNotifyMask | KeyPressMask | + ButtonPressMask | ButtonMotionMask; + win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 900, 300, + 0, vi->depth, InputOutput, vi->visual, + CWBorderPixel|CWColormap|CWEventMask, &swa); + XStoreName(dpy, win, "hiddenline"); + XMapWindow(dpy, win); + + glXMakeCurrent(dpy, win, cx); + + /* check for the polygon offset extension */ +#ifndef GL_VERSION_1_1 + if (!query_extension("GL_EXT_polygon_offset")) + error(argv[0], "polygon_offset extension is not available"); +#else + (void) query_extension; +#endif + + /* set up viewing parameters */ + glMatrixMode(GL_PROJECTION); + gluPerspective(20, 1, 0.1, 20); + glMatrixMode(GL_MODELVIEW); + glTranslatef(0, 0, -15); + + /* set other relevant state information */ + glEnable(GL_DEPTH_TEST); + +#ifdef GL_EXT_polygon_offset + printf("using 1.0 offset extension\n"); + glPolygonOffsetEXT( 1.0, 0.00001 ); +#else + printf("using 1.1 offset\n"); + glPolygonOffset( 1.0, 0.5 ); +#endif + + glShadeModel( GL_FLAT ); + glDisable( GL_DITHER ); + + /* process events until the user presses ESC */ + while (1) process_input(dpy, win); + + return 0; +} + +static void +draw_scene(int mx, int my) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glTranslatef(-1.7, 0.0, 0.0); + cubes(mx, my, WIREFRAME); + glPopMatrix(); + + glPushMatrix(); + cubes(mx, my, HIDDEN_LINE); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(1.7, 0.0, 0.0); +#ifdef GL_EXT_polygon_offset + glEnable(GL_POLYGON_OFFSET_EXT); +#else + glEnable(GL_POLYGON_OFFSET_FILL); +#endif + cubes(mx, my, HIDDEN_LINE); +#ifdef GL_EXT_polygon_offset + glDisable(GL_POLYGON_OFFSET_EXT); +#else + glDisable(GL_POLYGON_OFFSET_FILL); +#endif + glPopMatrix(); +} + + +static void +cubes(int mx, int my, int mode) { + int x, y, z, i; + + /* track the mouse */ + glRotatef(mx / 2.0, 0, 1, 0); + glRotatef(my / 2.0, 1, 0, 0); + + /* draw the lines as hidden polygons */ + glTranslatef(-0.5, -0.5, -0.5); + glScalef(1.0/dimension, 1.0/dimension, 1.0/dimension); + for (z = 0; z < dimension; z++) { + for (y = 0; y < dimension; y++) { + for (x = 0; x < dimension; x++) { + glPushMatrix(); + glTranslatef(x, y, z); + glScalef(0.8, 0.8, 0.8); + for (i = 0; i < MAXQUAD; i++) + draw_hidden(quads[i], mode); + glPopMatrix(); + } + } + } +} + +static void +fill(Quad quad) { + /* draw a filled polygon */ + glBegin(GL_QUADS); + glVertex3fv(quad[0]); + glVertex3fv(quad[1]); + glVertex3fv(quad[2]); + glVertex3fv(quad[3]); + glEnd(); +} + +static void +outline(Quad quad) { + /* draw an outlined polygon */ + glBegin(GL_LINE_LOOP); + glVertex3fv(quad[0]); + glVertex3fv(quad[1]); + glVertex3fv(quad[2]); + glVertex3fv(quad[3]); + glEnd(); +} + +static void +draw_hidden(Quad quad, int mode) { + if (mode == HIDDEN_LINE) { + glColor3f(0, 0, 0); + fill(quad); + } + + /* draw the outline using white, optionally fill the interior with black */ + glColor3f(1, 1, 1); + outline(quad); +} + +static void +process_input(Display *dpy, Window win) { + XEvent event; + static int prevx, prevy; + static int deltax = 90, deltay = 40; + + do { + char buf[31]; + KeySym keysym; + + XNextEvent(dpy, &event); + switch(event.type) { + case Expose: + break; + case ConfigureNotify: { + /* this approach preserves a 1:1 viewport aspect ratio */ + int vX, vY, vW, vH; + int eW = event.xconfigure.width, eH = event.xconfigure.height; + if (eW >= eH) { + vX = 0; + vY = (eH - eW) >> 1; + vW = vH = eW; + } else { + vX = (eW - eH) >> 1; + vY = 0; + vW = vH = eH; + } + glViewport(vX, vY, vW, vH); + } + break; + case KeyPress: + (void) XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL); + switch (keysym) { + case XK_Escape: + exit(EXIT_SUCCESS); + default: + break; + } + case ButtonPress: + prevx = event.xbutton.x; + prevy = event.xbutton.y; + break; + case MotionNotify: + deltax += (event.xbutton.x - prevx); prevx = event.xbutton.x; + deltay += (event.xbutton.y - prevy); prevy = event.xbutton.y; + break; + default: + break; + } + } while (XPending(dpy)); + + draw_scene(deltax, deltay); + glXSwapBuffers(dpy, win); +} + +static void +error(const char *prog, const char *msg) { + fprintf(stderr, "%s: %s\n", prog, msg); + exit(EXIT_FAILURE); +} + +static int +query_extension(char* extName) { + char *p = (char *) glGetString(GL_EXTENSIONS); + char *end = p + strlen(p); + while (p < end) { + int n = strcspn(p, " "); + if ((strlen(extName) == n) && (strncmp(extName, p, n) == 0)) + return GL_TRUE; + p += (n + 1); + } + return GL_FALSE; +} + diff --git a/xc/extras/Mesa/xdemos/shape.c b/xc/extras/Mesa/xdemos/shape.c new file mode 100644 index 000000000..279a9694d --- /dev/null +++ b/xc/extras/Mesa/xdemos/shape.c @@ -0,0 +1,384 @@ +/* $Id: shape.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Example of using the X "shape" extension with OpenGL: render a spinning + * cube inside of a non-rectangular window. + * + * Press ESC to exit. Press up/down to change window shape. + * + * To compile add "shape" to the PROGS list in Makefile. + * + * Brian Paul + * June 16, 1997 + * + * This program is in the public domain. + */ + + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/keysym.h> +#include <X11/extensions/shape.h> +#include <GL/glx.h> + +#ifndef PI +#define PI 3.1415926 +#endif + + +static int Width=500, Height=500; + +static float Xangle = 0.0, Yangle = 0.0; +static int Redraw = 0; +static int Sides = 5; +static int MinSides = 3; +static int MaxSides = 20; + + +/* + * Draw the OpenGL stuff and do a SwapBuffers. + */ +static void display(Display *dpy, Window win) +{ + float scale = 1.7; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + + glScalef(scale, scale, scale); + glRotatef(Xangle, 1.0, 0.0, 0.0); + glRotatef(Yangle, 0.0, 1.0, 0.0); + + /* + * wireframe box + */ + glColor3f(1.0, 1.0, 1.0); + glBegin(GL_LINE_LOOP); + glVertex3f(-1.0, -1.0, -1.0); + glVertex3f( 1.0, -1.0, -1.0); + glVertex3f( 1.0, 1.0, -1.0); + glVertex3f(-1.0, 1.0, -1.0); + glEnd(); + + glBegin(GL_LINE_LOOP); + glVertex3f(-1.0, -1.0, 1.0); + glVertex3f( 1.0, -1.0, 1.0); + glVertex3f( 1.0, 1.0, 1.0); + glVertex3f(-1.0, 1.0, 1.0); + glEnd(); + + glBegin(GL_LINES); + glVertex3f(-1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, 1.0); + glVertex3f( 1.0, -1.0, -1.0); glVertex3f( 1.0, -1.0, 1.0); + glVertex3f( 1.0, 1.0, -1.0); glVertex3f( 1.0, 1.0, 1.0); + glVertex3f(-1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, 1.0); + glEnd(); + + /* + * Solid box + */ + glPushMatrix(); + glScalef(0.75, 0.75, 0.75); + + glColor3f(1, 0, 0); + glBegin(GL_POLYGON); + glVertex3f(1, -1, -1); + glVertex3f(1, 1, -1); + glVertex3f(1, 1, 1); + glVertex3f(1, -1, 1); + glEnd(); + + glColor3f(0, 1, 1); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, -1); + glVertex3f(-1, 1, -1); + glVertex3f(-1, 1, 1); + glVertex3f(-1, -1, 1); + glEnd(); + + glColor3f(0, 1, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, 1, -1); + glVertex3f( 1, 1, -1); + glVertex3f( 1, 1, 1); + glVertex3f(-1, 1, 1); + glEnd(); + + glColor3f(1, 0, 1); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, -1); + glVertex3f( 1, -1, -1); + glVertex3f( 1, -1, 1); + glVertex3f(-1, -1, 1); + glEnd(); + + glColor3f(0, 0, 1); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 1); + glVertex3f( 1, -1, 1); + glVertex3f( 1, 1, 1); + glVertex3f(-1, 1, 1); + glEnd(); + + glColor3f(1, 1, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, -1); + glVertex3f( 1, -1, -1); + glVertex3f( 1, 1, -1); + glVertex3f(-1, 1, -1); + glEnd(); + glPopMatrix(); + + + glPopMatrix(); + + glXSwapBuffers(dpy, win); +} + + +/* + * Called when no events are pending. + */ +static void idle(void) +{ + Xangle += 2.0; + Yangle += 3.3; + Redraw = 1; +} + + +/* + * This is called when we have to recompute the window shape bitmask. + * We just generate an n-sided regular polygon here but any other shape + * would be possible. + */ +static void make_shape_mask(Display *dpy, Window win, int width, int height, + int sides) +{ + Pixmap shapeMask; + XGCValues xgcv; + GC gc; + + /* allocate 1-bit deep pixmap and a GC */ + shapeMask = XCreatePixmap(dpy, win, width, height, 1); + gc = XCreateGC(dpy, shapeMask, 0, &xgcv); + + /* clear shapeMask to zeros */ + XSetForeground(dpy, gc, 0); + XFillRectangle(dpy, shapeMask, gc, 0, 0, width, height); + + /* draw mask */ + XSetForeground(dpy, gc, 1); + { + int cx = width / 2; + int cy = height / 2; + float angle = 0.0; + float step = 2.0 * PI / sides; + float radius = width / 2; + int i; + XPoint points[100]; + for (i=0;i<sides;i++) { + int x = cx + radius * sin(angle); + int y = cy - radius * cos(angle); + points[i].x = x; + points[i].y = y; + angle += step; + } + XFillPolygon(dpy, shapeMask, gc, points, sides, Convex, CoordModeOrigin); + } + + /* This is the only SHAPE extension call- simple! */ + XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, shapeMask, ShapeSet); + + XFreeGC(dpy, gc); + XFreePixmap(dpy, shapeMask); +} + + +/* + * Called when window is resized. Do OpenGL viewport and projection stuff. + */ +static void reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 3.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -10.0); + + glEnable(GL_DEPTH_TEST); +} + + +/* + * Process X events. + */ +static void event_loop(Display *dpy, Window win) +{ + while (1) { + XEvent event; + if (XPending(dpy)) { + XNextEvent(dpy, &event); + switch (event.type) { + case Expose: + display(dpy, event.xexpose.window); + break; + case ConfigureNotify: + Width = event.xconfigure.width; + Height = event.xconfigure.height, + make_shape_mask(dpy, win, Width, Height, Sides); + reshape(Width, Height); + break; + case KeyPress: + { + char buf[100]; + KeySym keySym; + XComposeStatus stat; + XLookupString(&event.xkey, buf, sizeof(buf), &keySym, &stat); + switch (keySym) { + case XK_Escape: + exit(0); + break; + case XK_Up: + Sides++; + if (Sides>MaxSides) Sides = MaxSides; + make_shape_mask(dpy, win, Width, Height, Sides); + break; + case XK_Down: + Sides--; + if (Sides<MinSides) Sides = MinSides; + make_shape_mask(dpy, win, Width, Height, Sides); + break; + } + } + break; + default: + ;; + } + } + else { + idle(); + if (Redraw) { + display(dpy, win); + Redraw = 0; + } + } + } +} + + +/* + * Allocate a "nice" colormap. This could be better (HP-CR support, etc). + */ +static Colormap alloc_colormap(Display *dpy, Window parent, Visual *vis) +{ + Screen *scr = DefaultScreenOfDisplay(dpy); + int scrnum = DefaultScreen(dpy); + + if (MaxCmapsOfScreen(scr)==1 && vis==DefaultVisual(dpy, scrnum)) { + /* The window and root are of the same visual type so */ + /* share the root colormap. */ + return DefaultColormap(dpy, scrnum); + } + else { + return XCreateColormap(dpy, parent, vis, AllocNone); + } +} + + +int main(int argc, char *argv[]) +{ + static int glAttribs[] = { + GLX_DOUBLEBUFFER, + GLX_RGBA, + GLX_DEPTH_SIZE, 1, + None + }; + Display *dpy; + XVisualInfo *visInfo; + int scrn; + Window root; + Colormap cmap; + Window win; + XSetWindowAttributes winAttribs; + unsigned long winAttribsMask; + GLXContext glCtx; + int ignore; + const char *name = "OpenGL in a Shaped Window"; + + dpy = XOpenDisplay(NULL); + if (!dpy) { + fprintf(stderr, "Couldn't open default display\n"); + return 1; + } + + /* check that we can use the shape extension */ + if (!XQueryExtension(dpy, "SHAPE", &ignore, &ignore, &ignore )) { + fprintf(stderr, "Display doesn't support shape extension\n"); + return 1; + } + + scrn = DefaultScreen(dpy); + + root = RootWindow(dpy, scrn); + + visInfo = glXChooseVisual(dpy, scrn, glAttribs); + if (!visInfo) { + fprintf(stderr, "Couldn't get RGB, DB, Z visual\n"); + return 1; + } + + glCtx = glXCreateContext(dpy, visInfo, 0, True); + if (!glCtx) { + fprintf(stderr, "Couldn't create GL context\n"); + return 1; + } + + cmap = alloc_colormap(dpy, root, visInfo->visual); + if (!cmap) { + fprintf(stderr, "Couln't create colormap\n"); + return 1; + } + + winAttribs.border_pixel = 0; + winAttribs.colormap = cmap; + winAttribs.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + winAttribsMask = CWBorderPixel | CWColormap | CWEventMask; + win = XCreateWindow(dpy, root, 0, 0, Width, Height, 0, + visInfo->depth, InputOutput, + visInfo->visual, + winAttribsMask, &winAttribs); + + { + XSizeHints sizehints; + /* + sizehints.x = xpos; + sizehints.y = ypos; + sizehints.width = width; + sizehints.height = height; + */ + sizehints.flags = 0; + XSetNormalHints(dpy, win, &sizehints); + XSetStandardProperties(dpy, win, name, name, + None, (char **)NULL, 0, &sizehints); + } + + + XMapWindow(dpy, win); + + glXMakeCurrent(dpy, win, glCtx); + + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("Press ESC to exit.\n"); + printf("Press up/down to change window shape.\n"); + + event_loop(dpy, win); + + return 0; +} diff --git a/xc/extras/Mesa/xdemos/vgears.c b/xc/extras/Mesa/xdemos/vgears.c new file mode 100644 index 000000000..13d030a8b --- /dev/null +++ b/xc/extras/Mesa/xdemos/vgears.c @@ -0,0 +1,282 @@ +/* $ID$ */ + +/* + * Spinning gears demo for Linux SVGA/Mesa interface in 32K color mode. + * + * Compile with: gcc vgears.c -I../include -L../lib -lMesaGL -lX11 -lXext + * -lvga -lm -o vgears + * + * This program is in the public domain. + * Brian Paul, January 1996 + */ + + +#include <vga.h> +#include <math.h> +#include "GL/svgamesa.h" +#include "GL/gl.h" + + +int width = 800, height = 600; + +SVGAMesaContext vmc; + + + +/* + * Draw a gear wheel. You'll probably want to call this function when + * building a display list since we do a lot of trig here. + * + * Input: inner_radius - radius of hole at center + * outer_radius - radius at center of teeth + * width - width of gear + * teeth - number of teeth + * tooth_depth - depth of tooth + */ +static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width, + GLint teeth, GLfloat tooth_depth ) +{ + GLint i; + GLfloat r0, r1, r2; + GLfloat angle, da; + GLfloat u, v, len; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth/2.0; + r2 = outer_radius + tooth_depth/2.0; + + da = 2.0*M_PI / teeth / 4.0; + + glShadeModel( GL_FLAT ); + + glNormal3f( 0.0, 0.0, 1.0 ); + + /* draw front face */ + glBegin( GL_QUAD_STRIP ); + for (i=0;i<=teeth;i++) { + angle = i * 2.0*M_PI / teeth; + glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 ); + glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 ); + glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 ); + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 ); + } + glEnd(); + + /* draw front sides of teeth */ + glBegin( GL_QUADS ); + da = 2.0*M_PI / teeth / 4.0; + for (i=0;i<teeth;i++) { + angle = i * 2.0*M_PI / teeth; + + glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 ); + glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 ); + glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 ); + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 ); + } + glEnd(); + + + glNormal3f( 0.0, 0.0, -1.0 ); + + /* draw back face */ + glBegin( GL_QUAD_STRIP ); + for (i=0;i<=teeth;i++) { + angle = i * 2.0*M_PI / teeth; + glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 ); + glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 ); + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 ); + glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 ); + } + glEnd(); + + /* draw back sides of teeth */ + glBegin( GL_QUADS ); + da = 2.0*M_PI / teeth / 4.0; + for (i=0;i<teeth;i++) { + angle = i * 2.0*M_PI / teeth; + + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 ); + glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 ); + glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 ); + glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 ); + } + glEnd(); + + + /* draw outward faces of teeth */ + glBegin( GL_QUAD_STRIP ); + for (i=0;i<teeth;i++) { + angle = i * 2.0*M_PI / teeth; + + glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 ); + glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 ); + u = r2*cos(angle+da) - r1*cos(angle); + v = r2*sin(angle+da) - r1*sin(angle); + len = sqrt( u*u + v*v ); + u /= len; + v /= len; + glNormal3f( v, -u, 0.0 ); + glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 ); + glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 ); + glNormal3f( cos(angle), sin(angle), 0.0 ); + glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 ); + glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 ); + u = r1*cos(angle+3*da) - r2*cos(angle+2*da); + v = r1*sin(angle+3*da) - r2*sin(angle+2*da); + glNormal3f( v, -u, 0.0 ); + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 ); + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 ); + glNormal3f( cos(angle), sin(angle), 0.0 ); + } + + glVertex3f( r1*cos(0), r1*sin(0), width*0.5 ); + glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 ); + + glEnd(); + + + glShadeModel( GL_SMOOTH ); + + /* draw inside radius cylinder */ + glBegin( GL_QUAD_STRIP ); + for (i=0;i<=teeth;i++) { + angle = i * 2.0*M_PI / teeth; + glNormal3f( -cos(angle), -sin(angle), 0.0 ); + glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 ); + glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 ); + } + glEnd(); + +} + + +static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0; +static GLint gear1, gear2, gear3; +static GLfloat angle = 0.0; + +static GLuint limit; +static GLuint count = 1; + + +static void draw( void ) +{ + angle += 2.0; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glPushMatrix(); + glRotatef( view_rotx, 1.0, 0.0, 0.0 ); + glRotatef( view_roty, 0.0, 1.0, 0.0 ); + glRotatef( view_rotz, 0.0, 0.0, 1.0 ); + + glPushMatrix(); + glTranslatef( -3.0, -2.0, 0.0 ); + glRotatef( angle, 0.0, 0.0, 1.0 ); + glCallList(gear1); + glPopMatrix(); + + glPushMatrix(); + glTranslatef( 3.1, -2.0, 0.0 ); + glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 ); + glCallList(gear2); + glPopMatrix(); + + glPushMatrix(); + glTranslatef( -3.1, 4.2, 0.0 ); + glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 ); + glCallList(gear3); + glPopMatrix(); + + glPopMatrix(); + + SVGAMesaSwapBuffers(); +} + + +static void init( void ) +{ + static GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0 }; + static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 }; + static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 }; + static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 }; + + GLfloat w = (float) width / (float) height; + GLfloat h = 1.0; + + glLightfv( GL_LIGHT0, GL_POSITION, pos ); + glEnable( GL_CULL_FACE ); + glEnable( GL_LIGHTING ); + glEnable( GL_LIGHT0 ); + glEnable( GL_DEPTH_TEST ); + + /* make the gears */ + gear1 = glGenLists(1); + glNewList(gear1, GL_COMPILE); + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red ); + gear( 1.0, 4.0, 1.0, 20, 0.7 ); + glEndList(); + + gear2 = glGenLists(1); + glNewList(gear2, GL_COMPILE); + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green ); + gear( 0.5, 2.0, 2.0, 10, 0.7 ); + glEndList(); + + gear3 = glGenLists(1); + glNewList(gear3, GL_COMPILE); + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue ); + gear( 1.3, 2.0, 0.5, 10, 0.7 ); + glEndList(); + + glEnable( GL_NORMALIZE ); + + + glViewport( 0, 0, width, height ); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (width>height) { + GLfloat w = (GLfloat) width / (GLfloat) height; + glFrustum( -w, w, -1.0, 1.0, 5.0, 60.0 ); + } + else { + GLfloat h = (GLfloat) height / (GLfloat) width; + glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 ); + } + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -40.0 ); +} + +void setup( void ) +{ + vga_init(); + + vga_setmode(G800x600x32K); +/* gl_setcontextvga(G800x600x32K);*/ + + vmc = SVGAMesaCreateContext(GL_TRUE); + SVGAMesaMakeCurrent( vmc ); +} + + +void end( void ) +{ + SVGAMesaDestroyContext( vmc ); + + vga_setmode( TEXT ); +} + + +int main( int argc, char *argv[] ) +{ + int i; + + setup(); + init(); + for (i=0;i<4;i++) { + draw(); /*SVGAMesaSwapBuffers();*/ + } + end(); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/vindex.c b/xc/extras/Mesa/xdemos/vindex.c new file mode 100644 index 000000000..0ff2457a4 --- /dev/null +++ b/xc/extras/Mesa/xdemos/vindex.c @@ -0,0 +1,66 @@ +/* $Id: vindex.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Test Linux 8-bit SVGA/Mesa color index mode + * + * Compile with: gcc vindex.c -I../include -L../lib -lMesaGL -lX11 -lXext + * -lvga -lm -o vindex + * + * This program is in the public domain. + * Brian Paul, January 1996 + */ + + + +#include <vga.h> +#include "GL/svgamesa.h" +#include "GL/gl.h" + + + +static GLint width = 640, height = 480; + + + +static void display( void ) +{ + int i, j; + int w, h; + + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0.0, (GLfloat) width, 0.0, (GLfloat) height, -1.0, 1.0 ); + + glClear( GL_COLOR_BUFFER_BIT ); + + w = width / 16; + h = height / 16; + for (i=0;i<16;i++) { + for (j=0;j<16;j++) { + glIndexi( i*16+j ); + glRecti( i*w, j*h, i*w+w, j*h+h ); + } + } +} + + + +int main( int argc, char *argv[] ) +{ + SVGAMesaContext vmc; + int i; + + vga_init(); + vga_setmode( G640x480x256 ); + + vmc = SVGAMesaCreateContext( GL_FALSE ); + SVGAMesaMakeCurrent( vmc ); + + display(); + sleep(3); + + SVGAMesaDestroyContext( vmc ); + vga_setmode( TEXT ); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/vtest.c b/xc/extras/Mesa/xdemos/vtest.c new file mode 100644 index 000000000..7d10579af --- /dev/null +++ b/xc/extras/Mesa/xdemos/vtest.c @@ -0,0 +1,83 @@ +/* $Id: vtest.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Test SVGA/Mesa interface in 32K color mode. + * + * Compile with: gcc vtest.c -I../include -L../lib -lMesaGL -lX11 -lXext + * -lvga -lm -o vtest + * + * This program is in the public domain. + * Brian Paul, January 1996 + */ + + + +#include <vga.h> +#include "GL/svgamesa.h" +#include "GL/gl.h" + + +SVGAMesaContext vmc; + + + +void setup( void ) +{ + vga_init(); + + vga_setmode(G800x600x32K); +/* gl_setcontextvga(G800x600x32K);*/ + + vmc = SVGAMesaCreateContext( GL_FALSE ); /* single buffered */ + SVGAMesaMakeCurrent( vmc ); +} + + +void test( void ) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); + glMatrixMode(GL_MODELVIEW); + + glClear( GL_COLOR_BUFFER_BIT ); + + glBegin( GL_LINES ); + glColor3f( 1.0, 0.0, 0.0 ); + glVertex2f( -0.5, 0.5 ); + glVertex2f( 0.5, 0.5 ); + glColor3f( 0.0, 1.0, 0.0 ); + glVertex2f( -0.5, 0.25 ); + glVertex2f( 0.5, 0.25 ); + glColor3f( 0.0, 0.0, 1.0 ); + glVertex2f( -0.5, 0.0 ); + glVertex2f( 0.5, 0.0 ); + glEnd(); + + glBegin( GL_POLYGON ); + glColor3f( 1.0, 0.0, 0.0 ); + glVertex2f( 0.0, 0.7 ); + glColor3f( 0.0, 1.0, 0.0 ); + glVertex2f( -0.5, -0.5 ); + glColor3f( 0.0, 0.0, 1.0 ); + glVertex2f( 0.5, -0.5 ); + glEnd(); + + sleep(3); +} + +void end( void ) +{ + SVGAMesaDestroyContext( vmc ); + + vga_setmode( TEXT ); +} + + +int main( int argc, char *argv[] ) +{ + setup(); + test(); + end(); + return 0; +} diff --git a/xc/extras/Mesa/xdemos/wincopy.c b/xc/extras/Mesa/xdemos/wincopy.c new file mode 100644 index 000000000..fda2165e6 --- /dev/null +++ b/xc/extras/Mesa/xdemos/wincopy.c @@ -0,0 +1,270 @@ +/* $Id: wincopy.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * 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. + */ + + +/* + * This program opens two GLX windows, renders into one and uses + * glCopyPixels to copy the image from the first window into the + * second by means of the GLX 1.3 function glxMakeContextCurrent(). + * This function works just like the glXMakeCurrentReadSGI() function + * in the GLX_SGI_make_current_read extension. + */ + + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +#ifdef GLX_VERSION_1_3 + + +static Display *Dpy; +static int ScrNum; +static GLXContext Context; +static Window Win[2]; /* Win[0] = source, Win[1] = dest */ +static GLint Width[2], Height[2]; + +static GLfloat Angle = 0.0; + + + +static Window +CreateWindow(Display *dpy, int scrnum, XVisualInfo *visinfo, + int xpos, int ypos, int width, int height, + const char *name) +{ + Window win; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + + root = RootWindow(dpy, scrnum); + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow(dpy, root, xpos, ypos, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr); + if (win) { + XSizeHints sizehints; + sizehints.x = xpos; + sizehints.y = ypos; + sizehints.width = width; + sizehints.height = height; + sizehints.flags = USSize | USPosition; + XSetNormalHints(dpy, win, &sizehints); + XSetStandardProperties(dpy, win, name, name, + None, (char **)NULL, 0, &sizehints); + + XMapWindow(dpy, win); + } + return win; +} + + +static void +Redraw(void) +{ + /* make the first window the current one */ + if (!glXMakeContextCurrent(Dpy, Win[0], Win[0], Context)) { + printf("glXMakeContextCurrent failed in Redraw()\n"); + return; + } + + Angle += 1.0; + + glViewport(0, 0, Width[0], Height[0]); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + + glShadeModel(GL_FLAT); + glClearColor(0.5, 0.5, 0.5, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* draw blue quad */ + glColor3f(0.3, 0.3, 1.0); + glPushMatrix(); + glRotatef(Angle, 0, 0, 1); + glBegin(GL_POLYGON); + glVertex2f(-0.5, -0.25); + glVertex2f( 0.5, -0.25); + glVertex2f( 0.5, 0.25); + glVertex2f(-0.5, 0.25); + glEnd(); + glPopMatrix(); + + glXSwapBuffers(Dpy, Win[0]); + + + /* copy image from window 0 to window 1 */ + if (!glXMakeContextCurrent(Dpy, Win[1], Win[0], Context)) { + printf("glXMakeContextCurrent failed in Redraw()\n"); + return; + } + + /* raster pos setup */ + glViewport(0, 0, Width[1], Height[1]); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-1, 1, -1, 1, -1, 1); + glRasterPos2f(-1, -1); + + /* copy the image between windows */ + glDrawBuffer(GL_FRONT); + glCopyPixels(0, 0, Width[0], Height[0], GL_COLOR); + glDrawBuffer(GL_BACK); + + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +} + + + +static void +Resize(Window win, unsigned int width, unsigned int height) +{ + int i; + if (win == Win[0]) { + i = 0; + } + else { + i = 1; + } + Width[i] = width; + Height[i] = height; + if (!glXMakeCurrent(Dpy, Win[i], Context)) { + printf("glXMakeCurrent failed in Resize()\n"); + return; + } +} + + + +static void +EventLoop(void) +{ + XEvent event; + while (1) { + if (XPending(Dpy) > 0) { + XNextEvent( Dpy, &event ); + switch (event.type) { + case Expose: + Redraw(); + break; + case ConfigureNotify: + Resize(event.xany.window, event.xconfigure.width, event.xconfigure.height); + break; + case KeyPress: + return; + default: + /*no-op*/ ; + } + } + else { + /* animate */ + Redraw(); + } + } +} + + +static void +Init(void) +{ + XVisualInfo *visinfo; + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + + Dpy = XOpenDisplay(NULL); + if (!Dpy) { + printf("Couldn't open default display!\n"); + exit(1); + } + + ScrNum = DefaultScreen(Dpy); + + visinfo = glXChooseVisual(Dpy, ScrNum, attrib); + if (!visinfo) { + printf("Unable to find RGB, double-buffered visual\n"); + exit(1); + } + + Context = glXCreateContext(Dpy, visinfo, NULL, True); + if (!Context) { + printf("Couldn't create GLX context\n"); + exit(1); + } + + + Win[0] = CreateWindow(Dpy, ScrNum, visinfo, + 0, 0, 300, 300, "source window"); + + Win[1] = CreateWindow(Dpy, ScrNum, visinfo, + 350, 0, 300, 300, "dest window"); + +} + + +int +main(int argc, char *argv[]) +{ + Init(); + EventLoop(); + return 0; +} + + +#else + + +int +main(int argc, char *argv[]) +{ + printf("This program requires GLX 1.3!\n"); + return 0; +} + + +#endif /* GLX_VERSION_1_3 */ diff --git a/xc/extras/Mesa/xdemos/xdemo.c b/xc/extras/Mesa/xdemos/xdemo.c new file mode 100644 index 000000000..21c443ecd --- /dev/null +++ b/xc/extras/Mesa/xdemos/xdemo.c @@ -0,0 +1,355 @@ +/* $Id: xdemo.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + + +/* + * Very simple demo of how to use the Mesa/X11 interface instead of the + * glx, tk or aux toolkits. I highly recommend using the GLX interface + * instead of the X/Mesa interface, however. + * + * This program is in the public domain. + * + * Brian Paul + */ + + +/* + * $Log: xdemo.c,v $ + * Revision 1.1.1.1 2000/12/05 16:38:37 dawes + * Import of XFree86 4.0.1g + * + * Revision 1.2 2000/04/05 22:09:58 brianp + * new arguments to XMesaCreateVisual() + * + * Revision 1.1.1.1 1999/08/19 00:55:43 jtg + * Imported sources + * + * Revision 3.0 1998/02/21 02:16:54 brianp + * initial rev + * + */ + + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include "GL/xmesa.h" +#include "GL/gl.h" + + + +static GLint Black, Red, Green, Blue; + + + +static void make_window( char *title, int color_flag ) +{ + int x = 10, y = 10, width = 400, height = 300; + Display *dpy; + int scr; + Window root, win; + Colormap cmap; + XColor xcolor; + int attr_flags; + XVisualInfo *visinfo; + XSetWindowAttributes attr; + XTextProperty tp; + XSizeHints sh; + XEvent e; + XMesaContext context; + XMesaVisual visual; + XMesaBuffer buffer; + + + /* + * Do the usual X things to make a window. + */ + + dpy = XOpenDisplay(NULL); + if (!dpy) { + printf("Couldn't open default display!\n"); + exit(1); + } + + scr = DefaultScreen(dpy); + root = RootWindow(dpy, scr); + + /* alloc visinfo struct */ + visinfo = (XVisualInfo *) malloc( sizeof(XVisualInfo) ); + + /* Get a visual and colormap */ + if (color_flag) { + /* Open TrueColor window */ + +/* + if (!XMatchVisualInfo( dpy, scr, 24, TrueColor, visinfo )) { + printf("Couldn't get 24-bit TrueColor visual!\n"); + exit(1); + } +*/ + if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) { + printf("Couldn't get 8-bit PseudoColor visual!\n"); + exit(1); + } + + cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone ); + Black = Red = Green = Blue = 0; + } + else { + /* Open color index window */ + + if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) { + printf("Couldn't get 8-bit PseudoColor visual\n"); + exit(1); + } + + cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone ); + + /* Allocate colors */ + xcolor.red = 0x0; + xcolor.green = 0x0; + xcolor.blue = 0x0; + xcolor.flags = DoRed | DoGreen | DoBlue; + if (!XAllocColor( dpy, cmap, &xcolor )) { + printf("Couldn't allocate black!\n"); + exit(1); + } + Black = xcolor.pixel; + + xcolor.red = 0xffff; + xcolor.green = 0x0; + xcolor.blue = 0x0; + xcolor.flags = DoRed | DoGreen | DoBlue; + if (!XAllocColor( dpy, cmap, &xcolor )) { + printf("Couldn't allocate red!\n"); + exit(1); + } + Red = xcolor.pixel; + + xcolor.red = 0x0; + xcolor.green = 0xffff; + xcolor.blue = 0x0; + xcolor.flags = DoRed | DoGreen | DoBlue; + if (!XAllocColor( dpy, cmap, &xcolor )) { + printf("Couldn't allocate green!\n"); + exit(1); + } + Green = xcolor.pixel; + + xcolor.red = 0x0; + xcolor.green = 0x0; + xcolor.blue = 0xffff; + xcolor.flags = DoRed | DoGreen | DoBlue; + if (!XAllocColor( dpy, cmap, &xcolor )) { + printf("Couldn't allocate blue!\n"); + exit(1); + } + Blue = xcolor.pixel; + } + + /* set window attributes */ + attr.colormap = cmap; + attr.event_mask = ExposureMask | StructureNotifyMask; + attr.border_pixel = BlackPixel( dpy, scr ); + attr.background_pixel = BlackPixel( dpy, scr ); + attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel; + + /* Create the window */ + win = XCreateWindow( dpy, root, x,y, width, height, 0, + visinfo->depth, InputOutput, + visinfo->visual, + attr_flags, &attr); + if (!win) { + printf("Couldn't open window!\n"); + exit(1); + } + + XStringListToTextProperty(&title, 1, &tp); + sh.flags = USPosition | USSize; + XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0); + XMapWindow(dpy, win); + while (1) { + XNextEvent( dpy, &e ); + if (e.type == MapNotify && e.xmap.window == win) { + break; + } + } + + + /* + * Now do the special Mesa/Xlib stuff! + */ + + visual = XMesaCreateVisual( dpy, visinfo, + (GLboolean) color_flag, + GL_FALSE, /* alpha_flag */ + GL_FALSE, /* db_flag */ + GL_FALSE, /* stereo flag */ + GL_FALSE, /* ximage_flag */ + 0, /* depth size */ + 0, /* stencil size */ + 0,0,0,0, /* accum_size */ + 0, /* num samples */ + 0, /* level */ + 0 /* caveat */ + ); + if (!visual) { + printf("Couldn't create Mesa/X visual!\n"); + exit(1); + } + + /* Create a Mesa rendering context */ + context = XMesaCreateContext( visual, + NULL /* share_list */ + ); + if (!context) { + printf("Couldn't create Mesa/X context!\n"); + exit(1); + } + + buffer = XMesaCreateWindowBuffer( visual, win ); + if (!buffer) { + printf("Couldn't create Mesa/X buffer!\n"); + exit(1); + } + + + XMesaMakeCurrent( context, buffer ); + + /* Ready to render! */ +} + + + +static void draw_cube( void ) +{ + /* X faces */ + glIndexi( Red ); + glColor3f( 1.0, 0.0, 0.0 ); + glBegin( GL_POLYGON ); + glVertex3f( 1.0, 1.0, 1.0 ); + glVertex3f( 1.0, -1.0, 1.0 ); + glVertex3f( 1.0, -1.0, -1.0 ); + glVertex3f( 1.0, 1.0, -1.0 ); + glEnd(); + + glBegin( GL_POLYGON ); + glVertex3f( -1.0, 1.0, 1.0 ); + glVertex3f( -1.0, 1.0, -1.0 ); + glVertex3f( -1.0, -1.0, -1.0 ); + glVertex3f( -1.0, -1.0, 1.0 ); + glEnd(); + + /* Y faces */ + glIndexi( Green ); + glColor3f( 0.0, 1.0, 0.0 ); + glBegin( GL_POLYGON ); + glVertex3f( 1.0, 1.0, 1.0 ); + glVertex3f( 1.0, 1.0, -1.0 ); + glVertex3f( -1.0, 1.0, -1.0 ); + glVertex3f( -1.0, 1.0, 1.0 ); + glEnd(); + + glBegin( GL_POLYGON ); + glVertex3f( 1.0, -1.0, 1.0 ); + glVertex3f( -1.0, -1.0, 1.0 ); + glVertex3f( -1.0, -1.0, -1.0 ); + glVertex3f( 1.0, -1.0, -1.0 ); + glEnd(); + + /* Z faces */ + glIndexi( Blue ); + glColor3f( 0.0, 0.0, 1.0 ); + glBegin( GL_POLYGON ); + glVertex3f( 1.0, 1.0, 1.0 ); + glVertex3f( -1.0, 1.0, 1.0 ); + glVertex3f( -1.0, -1.0, 1.0 ); + glVertex3f( 1.0, -1.0, 1.0 ); + glEnd(); + + glBegin( GL_POLYGON ); + glVertex3f( 1.0, 1.0, -1.0 ); + glVertex3f( 1.0,-1.0, -1.0 ); + glVertex3f( -1.0,-1.0, -1.0 ); + glVertex3f( -1.0, 1.0, -1.0 ); + glEnd(); +} + + + + +static void display_loop( void ) +{ + GLfloat xrot, yrot, zrot; + + xrot = yrot = zrot = 0.0; + + glClearColor( 0.0, 0.0, 0.0, 0.0 ); + glClearIndex( Black ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 10.0 ); + glTranslatef( 0.0, 0.0, -5.0 ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + glCullFace( GL_BACK ); + glEnable( GL_CULL_FACE ); + + glShadeModel( GL_FLAT ); + + while (1) { + glClear( GL_COLOR_BUFFER_BIT ); + glPushMatrix(); + glRotatef( xrot, 1.0, 0.0, 0.0 ); + glRotatef( yrot, 0.0, 1.0, 0.0 ); + glRotatef( zrot, 0.0, 0.0, 1.0 ); + + draw_cube(); + + glPopMatrix(); + glFinish(); + + xrot += 10.0; + yrot += 7.0; + zrot -= 3.0; + } + +} + + + + +int main( int argc, char *argv[] ) +{ + int mode = 0; + + if (argc >= 2) + { + if (strcmp(argv[1],"-ci")==0) + mode = 0; + else if (strcmp(argv[1],"-rgb")==0) + mode = 1; + else + { + printf("Bad flag: %s\n", argv[1]); + printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n"); + exit(1); + } + } + else + { + printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n"); + printf("Defaulting to 8-bit color index\n"); + } + + make_window( argv[0], mode ); + + display_loop(); + return 0; +} + diff --git a/xc/extras/Mesa/xdemos/xfont.c b/xc/extras/Mesa/xdemos/xfont.c new file mode 100644 index 000000000..ed342782b --- /dev/null +++ b/xc/extras/Mesa/xdemos/xfont.c @@ -0,0 +1,207 @@ +/* $Id: xfont.c,v 1.1.1.1 2000/12/05 16:38:37 dawes Exp $ */ + +/* + * Mesa 3-D graphics library + * + * 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. + */ + + +/* + * Example of using glXUseXFont(). + * 5 November 1999 + * Brian Paul + */ + + +#include <GL/gl.h> +#include <GL/glx.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static const char *ProgramName = "xfont"; + +static const char *FontName = "fixed"; + +static GLuint FontBase = 0; + + + +static void redraw( Display *dpy, Window w ) +{ + static const char *text = "This is glXUseXFont()"; + + glClear( GL_COLOR_BUFFER_BIT ); + + /* triangle */ + glColor3f( 0.2, 0.2, 1.0 ); + glBegin(GL_TRIANGLES); + glVertex2f( 0, 0.8 ); + glVertex2f( -0.8, -0.7 ); + glVertex2f( 0.8, -0.7 ); + glEnd(); + + /* text */ + glColor3f( 1, 1, 1 ); + glRasterPos2f(-0.8, 0); + glListBase(FontBase); + glCallLists(strlen(text), GL_UNSIGNED_BYTE, (GLubyte *) text); + + glXSwapBuffers( dpy, w ); +} + + + +static void resize( unsigned int width, unsigned int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); +} + + + +static void setup_font( Display *dpy ) +{ + XFontStruct *fontInfo; + Font id; + unsigned int first, last; + + fontInfo = XLoadQueryFont(dpy, FontName); + if (!fontInfo) { + printf("Error: font %s not found\n", FontName); + exit(0); + } + + id = fontInfo->fid; + first = fontInfo->min_char_or_byte2; + last = fontInfo->max_char_or_byte2; + + FontBase = glGenLists((GLuint) last + 1); + if (!FontBase) { + printf("Error: unable to allocate display lists\n"); + exit(0); + } + glXUseXFont(id, first, last - first + 1, FontBase + first); +} + +static Window make_rgb_db_window( Display *dpy, int xpos, int ypos, + unsigned int width, unsigned int height ) +{ + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + Window win; + GLXContext ctx; + XVisualInfo *visinfo; + + scrnum = DefaultScreen( dpy ); + root = RootWindow( dpy, scrnum ); + + visinfo = glXChooseVisual( dpy, scrnum, attrib ); + if (!visinfo) { + printf("Error: couldn't get an RGB, Double-buffered visual\n"); + exit(1); + } + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow( dpy, root, 0, 0, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr ); + + { + XSizeHints sizehints; + sizehints.x = xpos; + sizehints.y = ypos; + sizehints.width = width; + sizehints.height = height; + sizehints.flags = USSize | USPosition; + XSetNormalHints(dpy, win, &sizehints); + XSetStandardProperties(dpy, win, ProgramName, ProgramName, + None, (char **)NULL, 0, &sizehints); + } + + + ctx = glXCreateContext( dpy, visinfo, NULL, True ); + + glXMakeCurrent( dpy, win, ctx ); + + return win; +} + + +static void event_loop( Display *dpy ) +{ + XEvent event; + + while (1) { + XNextEvent( dpy, &event ); + + switch (event.type) { + case Expose: + redraw( dpy, event.xany.window ); + break; + case ConfigureNotify: + resize( event.xconfigure.width, event.xconfigure.height ); + break; + case KeyPress: + exit(0); + default: + ; /* no-op */ + } + } +} + + + +int main( int argc, char *argv[] ) +{ + Display *dpy; + Window win; + + dpy = XOpenDisplay(NULL); + + win = make_rgb_db_window( dpy, 0, 0, 300, 300 ); + setup_font( dpy ); + + glShadeModel( GL_FLAT ); + glClearColor( 0.5, 0.5, 1.0, 1.0 ); + + XMapWindow( dpy, win ); + + event_loop( dpy ); + return 0; +} diff --git a/xc/extras/rman/rman.c b/xc/extras/rman/rman.c index b82f43872..32a1c1f59 100644 --- a/xc/extras/rman/rman.c +++ b/xc/extras/rman/rman.c @@ -16,7 +16,7 @@ static char rcsid[] = "Header: /home/cs/phelps/spine/rman/RCS/rman.c,v 1.144 199 source interpretation added September 24, 1996 renamed PolyglotMan due to lawsuit by Rosetta, Inc. August 8, 1997 */ -/* $XFree86: xc/extras/rman/rman.c,v 1.11 2000/08/09 23:40:11 dawes Exp $ */ +/* $XFree86: xc/extras/rman/rman.c,v 1.12 2000/12/01 18:48:08 dawes Exp $ */ /* TO DO **** @@ -4263,7 +4263,7 @@ source_command(char *p) int ie=0; int cond,invcond=0; char delim,op; - char if0[80], if1[80]; + char if0[MAXBUF], if1[MAXBUF]; float nif0, nif1; int insertat; char macrobuf[MAXBUF]; /* local so can have nested macros */ @@ -4443,8 +4443,18 @@ source_command(char *p) } else if (!isalpha(*p)) { /* usually quote, ^G in Digital UNIX */ /* gobble up comparators between delimiters */ delim = *p++; - q = if0; while (*p!=delim) { *q++=*p++; } *q='\0'; p++; - q = if1; while (*p!=delim) { *q++=*p++; } *q='\0'; p++; + q = if0; + while (*p && *p!=delim) { + *q++=*p++; + } + *q='\0'; + p++; + q = if1; + while (*p && *p!=delim) { + *q++=*p++; + } + *q='\0'; + p++; cond = (strcmp(if0,if1)==0); } else cond=0; /* a guess, seems to be right bettern than half the time */ if (invcond) cond=1-cond; diff --git a/xc/lib/GL/mesa/src/drv/Imakefile b/xc/lib/GL/mesa/src/drv/Imakefile index b01e433ff..88b259502 100644 --- a/xc/lib/GL/mesa/src/drv/Imakefile +++ b/xc/lib/GL/mesa/src/drv/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.15 2000/08/24 22:20:06 tsi Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.16 2000/12/04 18:54:13 dawes Exp $ #define DoNormalLib NormalLibGlx #define DoSharedLib SharedLibGlx @@ -33,29 +33,42 @@ DRIVER += sis #endif SUBDIRS = $(DRIVER) -#else + +#else /* GlxUseBuiltInDRIDriver */ + #if defined(i386Architecture) || defined(ia64Architecture) -SUBDIRS += gamma -#if HasGlide3 -SUBDIRS += tdfx -#endif + SUBDIRS += common +SUBDIRS += gamma SUBDIRS += mga SUBDIRS += i810 SUBDIRS += r128 SUBDIRS += sis -#elif defined(AlphaArchitecture) -SUBDIRS += gamma #if HasGlide3 SUBDIRS += tdfx #endif + +#elif defined(AlphaArchitecture) + SUBDIRS += common +SUBDIRS += gamma SUBDIRS += mga SUBDIRS += r128 +#if HasGlide3 +SUBDIRS += tdfx +#endif + #elif defined(SparcArchitecture) + SUBDIRS += ffb -#endif -#endif + +#else + +SUBDIRS = + +#endif /* architecture */ + +#endif /* GlxUseBuiltInDRIDriver */ MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/xc/lib/GL/mesa/src/drv/common/depthtmp.h b/xc/lib/GL/mesa/src/drv/common/depthtmp.h index 3aa307904..0c10eae19 100644 --- a/xc/lib/GL/mesa/src/drv/common/depthtmp.h +++ b/xc/lib/GL/mesa/src/drv/common/depthtmp.h @@ -1,12 +1,20 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.4 2000/12/04 22:43:20 dawes Exp $ */ + #ifndef DBG #define DBG 0 #endif +#ifndef HAVE_HW_DEPTH_SPANS +#define HAVE_HW_DEPTH_SPANS 0 +#endif +#ifndef HAVE_HW_DEPTH_PIXELS +#define HAVE_HW_DEPTH_PIXELS 0 +#endif static void TAG(WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth *depth, + const GLdepth *depth, const GLubyte mask[] ) { HW_LOCK() @@ -15,39 +23,45 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, GLint n1; LOCAL_DEPTH_VARS; - y = Y_FLIP(y); + y = Y_FLIP( y ); - HW_CLIPLOOP() +#if HAVE_HW_DEPTH_SPANS + (void) x1; (void) n1; + + if ( DBG ) fprintf( stderr, "WriteDepthSpan 0..%d (x1 %d)\n", + (int)n, (int)x ); + + WRITE_DEPTH_SPAN(); +#else + HW_CLIPLOOP() { GLint i = 0; - CLIPSPAN(x,y,n,x1,n1,i); + CLIPSPAN( x, y, n, x1, n1, i ); - if (DBG) fprintf(stderr, "WriteDepthSpan %d..%d (x1 %d)\n", - (int)i, (int)n1, (int)x1); + if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1 ); - if (mask) - { - for (;i<n1;i++,x1++) - if (mask[i]) - WRITE_DEPTH( x1, y, depth[i] ); - } - else - { - for (;i<n1;i++,x1++) + if ( mask ) { + for ( ; i < n1 ; i++, x1++ ) { + if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] ); + } + } else { + for ( ; i < n1 ; i++, x1++ ) { WRITE_DEPTH( x1, y, depth[i] ); + } } } HW_ENDCLIPLOOP(); +#endif } HW_UNLOCK(); } - static void TAG(WriteDepthPixels)( GLcontext *ctx, - GLuint n, - const GLint x[], + GLuint n, + const GLint x[], const GLint y[], - const GLdepth depth[], + const GLdepth depth[], const GLubyte mask[] ) { HW_LOCK() @@ -55,55 +69,64 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, GLint i; LOCAL_DEPTH_VARS; - if (DBG) fprintf(stderr, "WriteDepthPixels\n"); + if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" ); + +#if HAVE_HW_DEPTH_PIXELS + (void) i; + WRITE_DEPTH_PIXELS(); +#else HW_CLIPLOOP() { - for (i=0;i<n;i++) - { - if (mask[i]) { - const int fy = Y_FLIP(y[i]); - if (CLIPPIXEL(x[i],fy)) + for ( i = 0 ; i < n ; i++ ) { + if ( mask[i] ) { + const int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) WRITE_DEPTH( x[i], fy, depth[i] ); } } } HW_ENDCLIPLOOP(); +#endif } HW_UNLOCK(); } - - /* Read depth spans and pixels */ static void TAG(ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLdepth depth[]) + GLdepth depth[] ) { HW_LOCK() { - GLint x1,n1; + GLint x1, n1; LOCAL_DEPTH_VARS; - y = Y_FLIP(y); + y = Y_FLIP( y ); - if (DBG) fprintf(stderr, "ReadDepthSpan\n"); + if ( DBG ) fprintf( stderr, "ReadDepthSpan\n" ); - HW_CLIPLOOP() +#if HAVE_HW_DEPTH_SPANS + (void) x1; (void) n1; + + READ_DEPTH_SPAN(); +#else + HW_CLIPLOOP() { GLint i = 0; - CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++) + CLIPSPAN( x, y, n, x1, n1, i ); + for ( ; i < n1 ; i++ ) READ_DEPTH( depth[i], (x1+i), y ); } HW_ENDCLIPLOOP(); +#endif } HW_UNLOCK(); } -static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, +static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[] ) { @@ -112,22 +135,34 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, GLint i; LOCAL_DEPTH_VARS; - if (DBG) fprintf(stderr, "ReadDepthPixels\n"); - + if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" ); + +#if HAVE_HW_DEPTH_PIXELS + (void) i; + + READ_DEPTH_PIXELS(); +#else HW_CLIPLOOP() { - for (i=0;i<n;i++) { + for ( i = 0 ; i < n ;i++ ) { int fy = Y_FLIP( y[i] ); - if (CLIPPIXEL( x[i], fy )) + if ( CLIPPIXEL( x[i], fy ) ) READ_DEPTH( depth[i], x[i], fy ); } } HW_ENDCLIPLOOP(); +#endif } HW_UNLOCK(); } - +#if HAVE_HW_DEPTH_SPANS +#undef WRITE_DEPTH_SPAN +#undef WRITE_DEPTH_PIXELS +#undef READ_DEPTH_SPAN +#undef READ_DEPTH_PIXELS +#else #undef WRITE_DEPTH #undef READ_DEPTH +#endif #undef TAG diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.h b/xc/lib/GL/mesa/src/drv/i810/i810tris.h index ae7f906b2..a83adad95 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810tris.h +++ b/xc/lib/GL/mesa/src/drv/i810/i810tris.h @@ -15,14 +15,14 @@ * 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 - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS 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 + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS 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. * * */ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.7 2000/11/13 23:31:27 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.8 2000/12/04 19:21:43 dawes Exp $ */ #ifndef I810TRIS_INC #define I810TRIS_INC @@ -37,7 +37,7 @@ extern void i810DDTrifuncInit( void ); #define I810_FLAT_BIT 0x1 -#define I810_OFFSET_BIT 0x2 +#define I810_OFFSET_BIT 0x2 #define I810_TWOSIDE_BIT 0x4 #define I810_FALLBACK_BIT 0x8 @@ -45,13 +45,13 @@ extern void i810DDTrifuncInit( void ); static void __inline__ i810_draw_triangle( i810ContextPtr imesa, - i810VertexPtr v0, - i810VertexPtr v1, + i810VertexPtr v0, + i810VertexPtr v1, i810VertexPtr v2 ) { GLuint vertsize = imesa->vertsize; GLuint *vb = i810AllocDwordsInline( imesa, 3 * vertsize ); - int j; + int j; #if defined(USE_X86_ASM) __asm__ __volatile__( "rep ; movsl" @@ -67,23 +67,22 @@ static void __inline__ i810_draw_triangle( i810ContextPtr imesa, : "0" (vertsize), "S" ((long)v2) : "memory" ); #else + for (j = 0 ; j < vertsize ; j++) + vb[j] = v0->ui[j]; - for (j = 0 ; j < vertsize ; j++) - vb[j] = v0->ui[j]; - - vb += vertsize; - for (j = 0 ; j < vertsize ; j++) - vb[j] = v1->ui[j]; + vb += vertsize; + for (j = 0 ; j < vertsize ; j++) + vb[j] = v1->ui[j]; - vb += vertsize; - for (j = 0 ; j < vertsize ; j++) - vb[j] = v2->ui[j]; + vb += vertsize; + for (j = 0 ; j < vertsize ; j++) + vb[j] = v2->ui[j]; #endif } static __inline__ void i810_draw_point( i810ContextPtr imesa, - i810VertexPtr tmp, + i810VertexPtr tmp, float sz ) { int vertsize = imesa->vertsize; @@ -127,8 +126,8 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa, } -static __inline__ void i810_draw_line( i810ContextPtr imesa, - i810VertexPtr v0, +static __inline__ void i810_draw_line( i810ContextPtr imesa, + i810VertexPtr v0, i810VertexPtr v1 ) { GLuint vertsize = imesa->vertsize; @@ -136,21 +135,21 @@ static __inline__ void i810_draw_line( i810ContextPtr imesa, int j; #if defined(USE_X86_ASM) - __asm__ __volatile__( "rep ; movsl" - : "=%c" (j) - : "0" (vertsize), "D" ((long)vb), "S" ((long)v0) - : "memory" ); - __asm__ __volatile__( "rep ; movsl" - : "=%c" (j) - : "0" (vertsize), "S" ((long)v1) - : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "D" ((long)vb), "S" ((long)v0) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v1) + : "memory" ); #else - for (j = 0 ; j < vertsize ; j++) - vb[j] = v0->ui[j]; + for (j = 0 ; j < vertsize ; j++) + vb[j] = v0->ui[j]; - vb += vertsize; - for (j = 0 ; j < vertsize ; j++) - vb[j] = v1->ui[j]; + vb += vertsize; + for (j = 0 ; j < vertsize ; j++) + vb[j] = v1->ui[j]; #endif } diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile b/xc/lib/GL/mesa/src/drv/r128/Imakefile index f73c0477d..fac037986 100644 --- a/xc/lib/GL/mesa/src/drv/r128/Imakefile +++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.9 2000/11/13 23:31:30 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.10 2000/12/04 19:21:44 dawes Exp $ #include <Threads.tmpl> @@ -45,31 +45,31 @@ MESA_INCLUDES = -I. -I.. -I../../include \ DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - R128SRCS = r128_cce.c \ - r128_clear.c \ - r128_context.c \ + R128SRCS = r128_context.c \ r128_dd.c \ r128_fastpath.c \ + r128_eltpath.c \ + r128_ioctl.c \ + r128_lock.c \ r128_pipeline.c \ r128_screen.c \ r128_span.c \ r128_state.c \ - r128_swap.c \ r128_tex.c \ r128_tris.c \ r128_vb.c \ r128_xmesa.c - R128OBJS = r128_cce.o \ - r128_clear.o \ - r128_context.o \ + R128OBJS = r128_context.o \ r128_dd.o \ r128_fastpath.o \ + r128_eltpath.o \ + r128_ioctl.o \ + r128_lock.o \ r128_pipeline.o \ r128_screen.o \ r128_span.o \ r128_state.o \ - r128_swap.o \ r128_tex.o \ r128_tris.o \ r128_vb.o \ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.c b/xc/lib/GL/mesa/src/drv/r128/r128_context.c index 169cf212b..e7be00853 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_context.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.2 2000/08/25 13:42:28 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.3 2000/12/04 19:21:44 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,16 +28,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ #include <stdlib.h> -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_cce.h" +#include "r128_ioctl.h" #include "r128_dd.h" #include "r128_state.h" #include "r128_span.h" @@ -47,6 +46,19 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "context.h" #include "simple_list.h" +#include "mem.h" + +#ifndef R128_DEBUG +int R128_DEBUG = (0 +/* | DEBUG_ALWAYS_SYNC */ +/* | DEBUG_VERBOSE_API */ +/* | DEBUG_VERBOSE_MSG */ +/* | DEBUG_VERBOSE_LRU */ +/* | DEBUG_VERBOSE_DRI */ +/* | DEBUG_VERBOSE_IOCTL */ +/* | DEBUG_VERBOSE_2D */ + ); +#endif /* Create the device specific context */ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, @@ -54,21 +66,30 @@ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, { r128ContextPtr r128ctx; r128ScreenPtr r128scrn; - GLcontext *glCtx = driContextPriv->mesaContext; + GLcontext *ctx = driContextPriv->mesaContext; int i; char *v; + __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - r128ctx = (r128ContextPtr)Xmalloc(sizeof(*r128ctx)); + r128ctx = (r128ContextPtr)Xcalloc(1, sizeof(*r128ctx)); if (!r128ctx) return GL_FALSE; /* Initialize r128Context */ - r128ctx->glCtx = glCtx; - r128ctx->display = dpy; - r128ctx->driContext = driContextPriv; - r128ctx->driDrawable = NULL; /* Set by XMesaMakeCurrent */ + r128ctx->glCtx = ctx; + r128ctx->display = dpy; + + r128ctx->driContext = driContextPriv; + r128ctx->driScreen = sPriv; + r128ctx->driDrawable = NULL; /* Set by XMesaMakeCurrent */ + + r128ctx->hHWContext = driContextPriv->hHWContext; + r128ctx->driFd = sPriv->fd; + r128ctx->driHwLock = &sPriv->pSAREA->lock; + + r128scrn = r128ctx->r128Screen = (r128ScreenPtr)(sPriv->private); - r128scrn = r128ctx->r128Screen = - (r128ScreenPtr)(driContextPriv->driScreenPriv->private); + r128ctx->sarea = (R128SAREAPriv *)((char *)sPriv->pSAREA + + sizeof(XF86DRISAREARec)); r128ctx->CurrentTexObj[0] = NULL; r128ctx->CurrentTexObj[1] = NULL; @@ -78,16 +99,27 @@ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, r128ctx->texHeap[i] = mmInit(0, r128scrn->texSize[i]); r128ctx->lastTexAge[i] = -1; } + r128ctx->lastTexHeap = r128scrn->NRTexHeaps; - r128ctx->lastSwapAge = 0; + r128ctx->BufferSize = glVisual->DepthBits; + r128ctx->DepthSize = glVisual->DepthBits; + r128ctx->StencilSize = glVisual->StencilBits; - r128ctx->useFastPath = GL_FALSE; + r128ctx->useFastPath = GL_FALSE; + r128ctx->lod_bias = 0x3f; - r128ctx->vert_buf = NULL; + r128ctx->num_verts = 0; + r128ctx->vert_buf = NULL; - r128ctx->CCEbuf = (CARD32 *)malloc(sizeof(*r128ctx->CCEbuf) * - r128scrn->ringEntries); - r128ctx->CCEcount = 0; + r128ctx->elt_buf = NULL; + r128ctx->retained_buf = NULL; + r128ctx->vert_heap = r128ctx->r128Screen->buffers->list->address; + +#if 0 + r128ctx->CCEbuf= (CARD32 *)MALLOC(sizeof(*r128ctx->CCEbuf) * + r128scrn->ringEntries); + r128ctx->CCEcount = 0; +#endif if ((v = getenv("LIBGL_CCE_TIMEOUT"))) r128ctx->CCEtimeout = strtoul(v, NULL, 10); @@ -97,45 +129,27 @@ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, if (r128ctx->CCEtimeout <= 0) r128ctx->CCEtimeout = 1; /* Initialize GLcontext */ - glCtx->DriverCtx = (void *)r128ctx; + ctx->DriverCtx = (void *)r128ctx; - r128DDInitExtensions(glCtx); + r128DDInitExtensions(ctx); - r128DDInitDriverFuncs(glCtx); - r128DDInitStateFuncs(glCtx); - r128DDInitSpanFuncs(glCtx); - r128DDInitTextureFuncs(glCtx); + r128DDInitDriverFuncs(ctx); + r128DDInitIoctlFuncs(ctx); + r128DDInitStateFuncs(ctx); + r128DDInitSpanFuncs(ctx); + r128DDInitTextureFuncs(ctx); - /* Do this after initialization of r128ctx->Fallback in InitState(). - */ - if (getenv("LIBGL_SOFTWARE_RENDERING")) - r128ctx->Fallback |= R128_FALLBACK_SWONLY; - - /* KW: No vertex buffer code for PCI cards -- for now fallback to - * software always. - * GTH: There is support there, but I'm seeing strange behaviour - * with it enabled. I'll leave the software fallbacks in place - * for now. - */ - if (r128scrn->IsPCI) - r128ctx->Fallback |= R128_FALLBACK_SWONLY; - - if (getenv("LIBGL_NO_SOFTWARE_FALLBACKS")) - r128ctx->SWfallbackDisable = GL_TRUE; - else - r128ctx->SWfallbackDisable = GL_FALSE; - - glCtx->Driver.TriangleCaps = (DD_TRI_CULL - | DD_TRI_LIGHT_TWOSIDE - | DD_TRI_OFFSET); + ctx->Driver.TriangleCaps = (DD_TRI_CULL + | DD_TRI_LIGHT_TWOSIDE + | DD_TRI_OFFSET); /* Ask Mesa to clip fog coordinates for us */ - glCtx->TriangleCaps |= DD_CLIP_FOG_COORD; + ctx->TriangleCaps |= DD_CLIP_FOG_COORD; /* Reset Mesa's current 2D texture pointers to the driver's textures */ - glCtx->Shared->DefaultD[2][0].DriverData = NULL; - glCtx->Shared->DefaultD[2][1].DriverData = NULL; + ctx->Shared->DefaultD[2][0].DriverData = NULL; + ctx->Shared->DefaultD[2][1].DriverData = NULL; /* KW: Set the maximum texture size small enough that we can * guarentee that both texture units can bind a maximal texture @@ -143,17 +157,17 @@ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, * Gareth: Please check these numbers are OK) */ if (r128scrn->texSize[0] < 2*1024*1024) { - glCtx->Const.MaxTextureLevels = 9; - glCtx->Const.MaxTextureSize = 1<<8; + ctx->Const.MaxTextureLevels = 9; + ctx->Const.MaxTextureSize = 1<<8; } else if (r128scrn->texSize[0] < 8*1024*1024) { - glCtx->Const.MaxTextureLevels = 10; - glCtx->Const.MaxTextureSize = 1<<9; + ctx->Const.MaxTextureLevels = 10; + ctx->Const.MaxTextureSize = 1<<9; } else { - glCtx->Const.MaxTextureLevels = 11; - glCtx->Const.MaxTextureSize = 1<<10; + ctx->Const.MaxTextureLevels = 11; + ctx->Const.MaxTextureSize = 1<<10; } - glCtx->Const.MaxTextureUnits = 2; + ctx->Const.MaxTextureUnits = 2; #if ENABLE_PERF_BOXES if (getenv("LIBGL_PERFORMANCE_BOXES")) @@ -164,14 +178,14 @@ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, /* If Mesa has current a vertex buffer, make sure the driver's VB data is up to date */ - if (glCtx->VB) r128DDRegisterVB(glCtx->VB); + if (ctx->VB) r128DDRegisterVB(ctx->VB); /* Register the fast path */ - if (glCtx->NrPipelineStages) - glCtx->NrPipelineStages = - r128DDRegisterPipelineStages(glCtx->PipelineStage, - glCtx->PipelineStage, - glCtx->NrPipelineStages); + if (ctx->NrPipelineStages) + ctx->NrPipelineStages = + r128DDRegisterPipelineStages(ctx->PipelineStage, + ctx->PipelineStage, + ctx->NrPipelineStages); r128DDInitState(r128ctx); @@ -187,7 +201,9 @@ void r128DestroyContext(r128ContextPtr r128ctx) r128TexObjPtr t, next_t; int i; - free(r128ctx->CCEbuf); +#if 0 + FREE( r128ctx->CCEbuf ); +#endif for (i = 0; i < r128ctx->r128Screen->NRTexHeaps; i++) { foreach_s (t, next_t, &r128ctx->TexObjList[i]) @@ -199,6 +215,10 @@ void r128DestroyContext(r128ContextPtr r128ctx) Xfree(r128ctx); } + +#if 0 + glx_fini_prof(); +#endif } /* Load the device specific context into the hardware. The actual @@ -209,16 +229,17 @@ r128ContextPtr r128MakeCurrent(r128ContextPtr oldCtx, { if (oldCtx) { if (!R128CCE_USE_RING_BUFFER(newCtx->r128Screen->CCEMode)) - newCtx->dirty |= R128_REQUIRE_QUIESCENCE; + newCtx->dirty |= R128_REQUIRE_QUIESCENCE; if (oldCtx != newCtx) { - newCtx->dirty |= R128_UPDATE_CONTEXT; - newCtx->dirty_context |= R128_CTX_ALL_DIRTY; + newCtx->new_state |= R128_NEW_CONTEXT; + newCtx->dirty = R128_UPLOAD_ALL; + } + if (oldCtx->driDrawable != dPriv) { + newCtx->new_state |= R128_NEW_WINDOW; } - if (oldCtx->driDrawable != dPriv) - newCtx->dirty |= R128_UPDATE_WINPOS; } else { - newCtx->dirty |= R128_UPDATE_CONTEXT; - newCtx->dirty_context |= R128_CTX_ALL_DIRTY; + newCtx->new_state |= R128_NEW_CONTEXT; + newCtx->dirty = R128_UPLOAD_ALL; } newCtx->driDrawable = dPriv; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h index 5d80eb0a5..1b62681eb 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.2 2000/08/25 13:42:28 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.3 2000/12/04 19:21:44 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -37,197 +38,203 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING +#include <X11/Xlibint.h> + +#include "dri_mesaint.h" +#include "dri_tmm.h" + +#include "xf86drm.h" +#include "xf86drmR128.h" + +#include "types.h" + +#include "r128_sarea.h" +#include "r128_reg.h" + struct r128_context; typedef struct r128_context r128ContextRec; typedef struct r128_context *r128ContextPtr; +#include "r128_lock.h" #include "r128_texobj.h" +#include "r128_screen.h" -/* Flags for what needs to be updated before a new primitive is rendered */ -#define R128_CLEAN 0x0000 -#define R128_REQUIRE_QUIESCENCE 0x0001 -#define R128_UPDATE_CONTEXT 0x0002 -#define R128_UPDATE_WINPOS 0x0004 -#define R128_UPDATE_TEX0IMAGES 0x0008 -#define R128_UPDATE_TEX1IMAGES 0x0010 -#define R128_UPDATE_TEXSTATE 0x0020 -#define R128_ALL_DIRTY 0xffff - -/* Flags for what context state needs to be updated */ -#define R128_CTX_CLEAN 0x0000 -#define R128_CTX_MISC 0x0001 -#define R128_CTX_ENGINESTATE 0x0002 -#define R128_CTX_TEX0STATE 0x0004 -#define R128_CTX_TEX1STATE 0x0008 -#define R128_CTX_TEXENVSTATE 0x0010 -#define R128_CTX_FOGSTATE 0x0020 -#define R128_CTX_ZSTENSTATE 0x0080 -#define R128_CTX_SCISSORS 0x0100 -#define R128_CTX_ALPHASTATE 0x0200 -#define R128_CTX_SETUPSTATE 0x0400 -#define R128_CTX_WIN_Z_POS 0x0800 -#define R128_CTX_FLUSH_PIX_CACHE 0x1000 -#define R128_CTX_ALL_DIRTY 0xffff - -/* Flags for software fallback cases */ -#define R128_FALLBACK_TEXTURE 0x0001 -#define R128_FALLBACK_DRAW_BUFFER 0x0002 -#define R128_FALLBACK_READ_BUFFER 0x0004 -#define R128_FALLBACK_COLORMASK 0x0008 -#define R128_FALLBACK_STIPPLE 0x0010 -#define R128_FALLBACK_SWONLY 0x0020 -#define R128_FALLBACK_RENDER_MODE 0x0040 -#define R128_FALLBACK_MULTIDRAW 0x0080 -#define R128_FALLBACK_LOGICOP 0x0100 - -typedef void (*r128InterpFunc)( GLfloat t, - GLfloat *result, - const GLfloat *in, - const GLfloat *out ); - -/* NOTE: The groups below need to be kept together so that a single - memcpy can be used to transfer data to the ring buffer */ -typedef struct { - CARD32 scale_3d_cntl; /* 0x1a00 */ - - CARD32 aux_sc_cntl; /* 0x1660 */ - CARD32 aux1_sc_left; - CARD32 aux1_sc_right; - CARD32 aux1_sc_top; - CARD32 aux1_sc_bottom; - CARD32 aux2_sc_left; - CARD32 aux2_sc_right; - CARD32 aux2_sc_top; - CARD32 aux2_sc_bottom; - CARD32 aux3_sc_left; - CARD32 aux3_sc_right; - CARD32 aux3_sc_top; - CARD32 aux3_sc_bottom; /* 0x1690 */ - - CARD32 dst_pitch_offset_c; /* 0x1c80 */ - CARD32 dp_gui_master_cntl; - CARD32 sc_top_left_c; - CARD32 sc_bottom_right_c; - CARD32 z_offset_c; - CARD32 z_pitch_c; - CARD32 z_sten_cntl_c; - CARD32 tex_cntl_c; - CARD32 misc_3d_state_cntl_reg; - CARD32 texture_clr_cmp_clr_c; - CARD32 texture_clr_cmp_msk_c; - CARD32 fog_color_c; - CARD32 prim_tex_cntl_c; - CARD32 prim_texture_combine_cntl_c; - CARD32 tex_size_pitch_c; - CARD32 prim_tex_offset[R128_TEX_MAXLEVELS]; /* 0x1ce4 */ - - CARD32 sec_tex_cntl_c; /* 0x1d00 */ - CARD32 sec_tex_combine_cntl_c; - CARD32 sec_tex_offset[R128_TEX_MAXLEVELS]; - CARD32 constant_color_c; - CARD32 prim_texture_border_color_c; - CARD32 sec_texture_border_color_c; - CARD32 sten_ref_mask_c; - CARD32 plane_3d_mask_c; /* 0x1d44 */ - - CARD32 setup_cntl; /* 0x1bc4 */ - - CARD32 pm4_vc_fpu_setup; /* 0x071c */ - - CARD32 window_xy_offset; /* 0x1bcc */ - - CARD32 dp_write_mask; /* 0x16cc */ - - CARD32 pc_gui_ctlstat; /* 0x1748 */ -} r128ContextRegs; - -struct r128_context { - GLcontext *glCtx; /* Mesa context */ - int dirty; /* Hardware state to be updated */ - int dirty_context; /* Context state to be updated */ - - int vertsize; /* Size of current vertices */ - CARD32 vc_format; /* Format of current vertices */ - int multitex; - GLfloat depth_scale; +/* Flags for what context state needs to be updated: + */ +#define R128_NEW_ALPHA 0x0001 +#define R128_NEW_DEPTH 0x0002 +#define R128_NEW_FOG 0x0004 +#define R128_NEW_CLIP 0x0008 +#define R128_NEW_CULL 0x0010 +#define R128_NEW_MASKS 0x0020 +#define R128_NEW_RENDER 0x0040 +#define R128_NEW_WINDOW 0x0080 +#define R128_NEW_TEXTURE 0x0100 +#define R128_NEW_CONTEXT 0x0200 +#define R128_NEW_ALL 0x03ff + +/* Flags for software fallback cases: + */ +#define R128_FALLBACK_TEXTURE 0x0001 +#define R128_FALLBACK_DRAW_BUFFER 0x0002 +#define R128_FALLBACK_READ_BUFFER 0x0004 +#define R128_FALLBACK_STENCIL 0x0008 +#define R128_FALLBACK_RENDER_MODE 0x0010 +#define R128_FALLBACK_MULTIDRAW 0x0020 +#define R128_FALLBACK_LOGICOP 0x0040 + +/* Reasons why the GL_BLEND fallback mightn't work: + */ +#define R128_BLEND_ENV_COLOR 0x1 +#define R128_BLEND_MULTITEX 0x2 - int SWfallbackDisable; /* Disable software fallbacks */ +/* Subpixel offsets for window coordinates: + */ +#define SUBPIXEL_X (-0.5F) +#define SUBPIXEL_Y (-0.5F + 0.125) - r128TexObjPtr CurrentTexObj[2]; /* Ptr to current texture - object associated with - each texture unit */ - /* List of tex swapped in per heap*/ - r128TexObj TexObjList[R128_NR_TEX_HEAPS]; - r128TexObj SwappedOut; /* List of textures swapped out */ - memHeap_t *texHeap[R128_NR_TEX_HEAPS]; /* Global tex heaps */ - /* Last known global tex heap ages */ - int lastTexAge[R128_NR_TEX_HEAPS]; +typedef void (*r128_interp_func)( GLfloat t, + GLfloat *result, + const GLfloat *in, + const GLfloat *out ); - CARD32 lastSwapAge; /* Last known swap age */ +struct r128_elt_tab { + void (*emit_unclipped_verts)( struct vertex_buffer *VB ); - int Scissor; - XF86DRIClipRectRec ScissorRect; /* Current software scissor */ + void (*build_tri_verts)( r128ContextPtr r128ctx, + struct vertex_buffer *VB, + GLfloat *O, GLuint *elt ); - int useFastPath; /* Currently using Fast Path code */ - int SetupIndex; /* Raster setup function index */ - int SetupDone; /* Partial raster setup done? */ - int RenderIndex; /* Render state function index */ - r128InterpFunc interp; /* Current vert interp function */ + void (*interp)( GLfloat t, GLfloat *O, + const GLfloat *I, const GLfloat *J ); - drmBufPtr vert_buf; /* VB currently being filled */ + void (*project_and_emit_verts)( r128ContextPtr r128ctx, + const GLfloat *verts, + GLuint *elts, + int nr ); +}; +struct r128_context { + GLcontext *glCtx; /* Mesa context */ + + /* Driver and hardware state management + */ + GLuint new_state; + GLuint dirty; /* Hardware state to be updated */ + r128_context_regs_t setup; + + GLuint vertsize; + CARD32 vc_format; + GLfloat depth_scale; + + CARD32 Color; /* Current draw color */ + CARD32 ClearColor; /* Color used to clear color buffer */ + CARD32 ClearDepth; /* Value used to clear depth buffer */ + CARD32 ClearStencil; /* Value used to clear stencil */ + + /* Map GL texture units onto hardware + */ + GLint multitex; + GLint tmu_source[2]; + GLint tex_dest[2]; + GLuint blend_flags; + CARD32 env_color; + GLint lod_bias; + + /* Texture object bookkeeping + */ + r128TexObjPtr CurrentTexObj[2]; + r128TexObj TexObjList[R128_NR_TEX_HEAPS]; + r128TexObj SwappedOut; + memHeap_t *texHeap[R128_NR_TEX_HEAPS]; + GLint lastTexAge[R128_NR_TEX_HEAPS]; + GLint lastTexHeap; + + /* Current rendering state, fallbacks + */ + points_func PointsFunc; + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; + + CARD32 IndirectTriangles; + CARD32 Fallback; + + /* Fast path + */ + GLuint useFastPath; + GLuint SetupIndex; + GLuint SetupDone; + GLuint RenderIndex; + r128_interp_func interp; + + /* Vertex buffers + */ + drmBufPtr vert_buf; + GLuint num_verts; + + /* Elt path + */ + drmBufPtr elt_buf, retained_buf; + GLushort *first_elt, *next_elt; + GLfloat *next_vert, *vert_heap; + GLushort next_vert_index; + GLushort first_vert_index; + GLuint elt_vertsize; + struct r128_elt_tab *elt_tab; + GLfloat device_matrix[16]; + + /* CCE command packets + */ #if 0 - drmBufPtr elt_buf, retained_buf, index_buf; - GLushort *first_elt, *next_elt, *last_elt; - GLfloat *next_vert, *last_vert; - CARD32 next_vert_index; - CARD32 first_vert_index; - struct r128_elt_tab *elt_tab; - GLfloat device_matrix[16]; + CARD32 *CCEbuf; /* buffer to submit to CCE */ + GLuint CCEcount; /* number of dwords in CCEbuf */ #endif - - points_func PointsFunc; /* Current Points, Line, Triangle */ - line_func LineFunc; /* and Quad rendering functions */ - triangle_func TriangleFunc; - quad_func QuadFunc; - - CARD32 IndirectTriangles; /* Flags for point, line, - tri and quad software - fallbacks */ - CARD32 Fallback; /* Need software fallback */ - - r128ContextRegs regs; /* Hardware state */ - CARD32 Color; /* Current draw color */ - CARD32 ClearColor; /* Color used to clear color buffer */ - CARD32 ClearDepth; /* Value used to clear depth buffer */ - - int drawX; /* x-offset to current draw buffer */ - int drawY; /* y-offset to current draw buffer */ - - int readX; /* x-offset to current read buffer */ - int readY; /* y-offset to current read buffer */ - - CARD32 *CCEbuf; /* buffer to submit to CCE */ - int CCEcount; /* number of dwords in CCEbuf */ - - int CCEtimeout; /* number of times to loop + GLint CCEtimeout; /* number of times to loop before exiting */ - Display *display; /* X server display */ - - __DRIcontextPrivate *driContext; /* DRI context */ - __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */ - - r128ScreenPtr r128Screen; /* Screen private DRI data */ - - /* Performance counters: */ - int boxes; /* Draw performance boxes */ - int hardwareWentIdle; - int c_clears; - int c_drawWaits; - int c_textureSwaps; - int c_textureBytes; - int c_vertexBuffers; + /* Visual, drawable, cliprect and scissor information + */ + GLint BufferSize; /* Bits in color buffer */ + GLint DepthSize; /* Bits in depth buffer */ + GLint StencilSize; /* Bits in stencil buffer */ + + GLenum DrawBuffer; /* Optimize draw buffer update */ + GLint drawOffset, drawPitch; + GLint drawX, drawY; + GLint readOffset, readPitch; + GLint readX, readY; + + GLuint numClipRects; /* Cliprects for the draw buffer */ + XF86DRIClipRectPtr pClipRects; + + GLuint scissor; + XF86DRIClipRectRec ScissorRect; /* Current software scissor */ + + /* Mirrors of some DRI state + */ + Display *display; /* X server display */ + + __DRIcontextPrivate *driContext; /* DRI context */ + __DRIscreenPrivate *driScreen; /* DRI screen */ + __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */ + + drmContext hHWContext; + drmLock *driHwLock; + int driFd; + + r128ScreenPtr r128Screen; /* Screen private DRI data */ + R128SAREAPriv *sarea; /* Private SAREA data */ + + /* Performance counters + */ + GLuint boxes; /* Draw performance boxes */ + GLuint hardwareWentIdle; + GLuint c_clears; + GLuint c_drawWaits; + GLuint c_textureSwaps; + GLuint c_textureBytes; + GLuint c_vertexBuffers; }; #define R128_CONTEXT(ctx) ((r128ContextPtr)(ctx->DriverCtx)) @@ -236,6 +243,14 @@ struct r128_context { #define R128_DRIDRAWABLE(r128ctx) ((r128ctx)->driDrawable) #define R128_DRISCREEN(r128ctx) ((r128ctx)->r128Screen->driScreen) +#define R128_IS_PLAIN( r128ctx ) \ + (r128ctx->r128Screen->chipset == R128_CARD_TYPE_R128) +#define R128_IS_PRO( r128ctx ) \ + (r128ctx->r128Screen->chipset == R128_CARD_TYPE_R128_PRO) +#define R128_IS_MOBILITY( r128ctx ) \ + (r128ctx->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY) + + extern GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual, __DRIcontextPrivate *driContextPriv); extern void r128DestroyContext(r128ContextPtr r128ctx); @@ -243,5 +258,27 @@ extern r128ContextPtr r128MakeCurrent(r128ContextPtr oldCtx, r128ContextPtr newCtx, __DRIdrawablePrivate *dPriv); + +/* ================================================================ + * Debugging: + */ +#define DEBUG 0 +#define DEBUG_LOCKING 0 +#define ENABLE_PERF_BOXES 0 + +#if DEBUG +extern int R128_DEBUG; +#else +#define R128_DEBUG 0 +#endif + +#define DEBUG_ALWAYS_SYNC 0x01 +#define DEBUG_VERBOSE_API 0x02 +#define DEBUG_VERBOSE_MSG 0x04 +#define DEBUG_VERBOSE_LRU 0x08 +#define DEBUG_VERBOSE_DRI 0x10 +#define DEBUG_VERBOSE_IOCTL 0x20 +#define DEBUG_VERBOSE_2D 0x40 + #endif #endif /* _R128_CONTEXT_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c index f0698e21b..636b712a8 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.2 2000/08/25 13:42:28 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.3 2000/12/04 19:21:45 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,174 +28,184 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_lock.h" -#include "r128_cce.h" -#include "r128_clear.h" +#include "r128_ioctl.h" #include "r128_state.h" -#include "r128_swap.h" #include "r128_vb.h" #include "r128_pipeline.h" #include "r128_dd.h" #include "extensions.h" - -/* Driver entry point for clearing color and ancillary buffers */ -static GLbitfield r128DDClear(GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint x, GLint y, GLint width, GLint height) -{ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - - if (mask & DD_FRONT_LEFT_BIT) { - r128ClearColorBuffer(r128ctx, all, x, y, width, height, - r128ctx->r128Screen->fbX, - r128ctx->r128Screen->fbY); - mask &= ~DD_FRONT_LEFT_BIT; - } - - if (mask & DD_BACK_LEFT_BIT) { - r128ClearColorBuffer(r128ctx, all, x, y, width, height, - r128ctx->r128Screen->backX, - r128ctx->r128Screen->backY); - mask &= ~DD_BACK_LEFT_BIT; - } - - if (mask & DD_DEPTH_BIT) { - r128ClearDepthBuffer(r128ctx, all, x, y, width, height); - mask &= ~DD_DEPTH_BIT; - } - -#if 0 - /* FIXME: Add stencil support */ - if (mask & DD_STENCIL_BIT) { - r128ClearStencilBuffer(r128ctx, all, x, y, width, height); - mask &= ~DD_STENCIL_BIT; - } +#if defined(USE_X86_ASM) || defined(USE_3DNOW_ASM) || defined(USE_KATMAI_ASM) +#include "X86/common_x86_asm.h" #endif - return mask; -} +#define R128_DATE "20001201" /* Return the current color buffer size */ -static void r128DDGetBufferSize(GLcontext *ctx, GLuint *width, GLuint *height) +static void r128DDGetBufferSize( GLcontext *ctx, + GLuint *width, GLuint *height ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - *width = r128ctx->driDrawable->w; - *height = r128ctx->driDrawable->h; + *width = r128ctx->driDrawable->w; + *height = r128ctx->driDrawable->h; } /* Return various strings for glGetString() */ -static const GLubyte *r128DDGetString(GLcontext *ctx, GLenum name) +static const GLubyte *r128DDGetString( GLcontext *ctx, GLenum name ) { - switch (name) { - case GL_VENDOR: - return (GLubyte *)"Precision Insight, Inc."; - case GL_RENDERER: - return (GLubyte *)"Mesa DRI Rage128 20000630"; - default: - return NULL; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + static GLubyte buffer[128]; + + switch ( name ) { + case GL_VENDOR: + return "VA Linux Systems, Inc."; + + case GL_RENDERER: + sprintf( buffer, "Mesa DRI Rage128 " R128_DATE ); + + /* Append any chipset-specific information. + */ + if ( R128_IS_PRO( r128ctx ) ) { + strncat( buffer, " Pro", 4 ); + } + if ( R128_IS_MOBILITY( r128ctx ) ) { + strncat( buffer, " M3", 3 ); + } + + /* Append any AGP-specific information. + */ + switch ( r128ctx->r128Screen->AGPMode ) { + case 1: + strncat( buffer, " AGP 1x", 7 ); + break; + case 2: + strncat( buffer, " AGP 2x", 7 ); + break; + case 4: + strncat( buffer, " AGP 4x", 7 ); + break; + } + + /* Append any CPU-specific information. + */ +#ifdef USE_X86_ASM + if ( gl_x86_cpu_features ) { + strncat( buffer, " x86", 4 ); + } +#endif +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow ) { + strncat( buffer, "/3DNow!", 7 ); + } +#endif +#ifdef USE_KATMAI_ASM + if ( cpu_has_xmm ) { + strncat( buffer, "/SSE", 4 ); + } +#endif + return buffer; + + default: + return NULL; + } } /* Send all commands to the hardware. If vertex buffers or indirect - buffers are in use, then we need to make sure they are sent to the - hardware. All commands that are normally sent to the ring are - already considered `flushed'. */ -static void r128DDFlush(GLcontext *ctx) + * buffers are in use, then we need to make sure they are sent to the + * hardware. All commands that are normally sent to the ring are + * already considered `flushed'. + */ +static void r128DDFlush( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - FLUSH_BATCH(r128ctx); + FLUSH_BATCH( r128ctx ); #if ENABLE_PERF_BOXES - if (r128ctx->boxes) { - LOCK_HARDWARE(r128ctx); - r128PerformanceBoxesLocked(r128ctx); - UNLOCK_HARDWARE(r128ctx); - } - - /* Log the performance counters if necessary */ - r128PerformanceCounters(r128ctx); + if ( r128ctx->boxes ) { + LOCK_HARDWARE( r128ctx ); + r128PerformanceBoxesLocked( r128ctx ); + UNLOCK_HARDWARE( r128ctx ); + } + + /* Log the performance counters if necessary */ + r128PerformanceCounters( r128ctx ); #endif } /* Make sure all commands have been sent to the hardware and have - completed processing. */ -static void r128DDFinish(GLcontext *ctx) + * completed processing. + */ +static void r128DDFinish( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); #if ENABLE_PERF_BOXES - /* Bump the performance counter */ - r128ctx->c_drawWaits++; + /* Bump the performance counter */ + r128ctx->c_drawWaits++; #endif - r128DDFlush(ctx); - r128WaitForIdle(r128ctx); + r128DDFlush( ctx ); + r128WaitForIdle( r128ctx ); } /* Return various parameters requested by Mesa (this is deprecated) */ -static GLint r128DDGetParameteri(const GLcontext *ctx, GLint param) +static GLint r128DDGetParameteri( const GLcontext *ctx, GLint param ) { - switch (param) { - /* Hardware fog isn't working yet -- however returning zero - * here means that it looks like fog is working in some cases. - * It is less confusing to simply have it never work until it - * is actually fixed. - */ - case DD_HAVE_HARDWARE_FOG: return 1; - default: return 0; - } + switch (param) { + case DD_HAVE_HARDWARE_FOG: + return 1; + default: + return 0; + } } /* Initialize the extensions supported by this driver */ -void r128DDInitExtensions(GLcontext *ctx) +void r128DDInitExtensions( GLcontext *ctx ) { - /* FIXME: Are there other extensions to enable/disable??? */ - gl_extensions_disable(ctx, "GL_EXT_shared_texture_palette"); - gl_extensions_disable(ctx, "GL_EXT_paletted_texture"); - gl_extensions_disable(ctx, "GL_EXT_point_parameters"); - gl_extensions_disable(ctx, "ARB_imaging"); - gl_extensions_disable(ctx, "GL_EXT_blend_minmax"); - gl_extensions_disable(ctx, "GL_EXT_blend_logic_op"); - gl_extensions_disable(ctx, "GL_EXT_blend_subtract"); - gl_extensions_disable(ctx, "GL_INGR_blend_func_separate"); - - if (getenv("LIBGL_NO_MULTITEXTURE")) - gl_extensions_disable(ctx, "GL_ARB_multitexture"); - - gl_extensions_disable( ctx, "GL_SGI_color_matrix" ); - gl_extensions_disable( ctx, "GL_SGI_color_table" ); - gl_extensions_disable( ctx, "GL_SGIX_pixel_texture" ); - gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); - gl_extensions_disable( ctx, "GL_ARB_texture_compression" ); - gl_extensions_disable( ctx, "GL_EXT_convolution" ); + /* FIXME: Are there other extensions to enable/disable??? */ + gl_extensions_disable( ctx, "GL_EXT_shared_texture_palette" ); + gl_extensions_disable( ctx, "GL_EXT_paletted_texture" ); + gl_extensions_disable( ctx, "GL_EXT_point_parameters" ); + gl_extensions_disable( ctx, "ARB_imaging" ); + gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); + gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); + gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); + gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + + if ( getenv( "LIBGL_NO_MULTITEXTURE" ) ) + gl_extensions_disable( ctx, "GL_ARB_multitexture" ); + + gl_extensions_disable( ctx, "GL_SGI_color_matrix" ); + gl_extensions_disable( ctx, "GL_SGI_color_table" ); + gl_extensions_disable( ctx, "GL_SGIX_pixel_texture" ); + gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); + gl_extensions_disable( ctx, "GL_ARB_texture_compression" ); + gl_extensions_disable( ctx, "GL_EXT_convolution" ); } /* Initialize the driver's misc functions */ -void r128DDInitDriverFuncs(GLcontext *ctx) +void r128DDInitDriverFuncs( GLcontext *ctx ) { - ctx->Driver.Clear = r128DDClear; - - ctx->Driver.GetBufferSize = r128DDGetBufferSize; - ctx->Driver.GetString = r128DDGetString; - ctx->Driver.Finish = r128DDFinish; - ctx->Driver.Flush = r128DDFlush; + ctx->Driver.GetBufferSize = r128DDGetBufferSize; + ctx->Driver.GetString = r128DDGetString; + ctx->Driver.Finish = r128DDFinish; + ctx->Driver.Flush = r128DDFlush; - ctx->Driver.Error = NULL; - ctx->Driver.GetParameteri = r128DDGetParameteri; + ctx->Driver.Error = NULL; + ctx->Driver.GetParameteri = r128DDGetParameteri; - ctx->Driver.DrawPixels = NULL; - ctx->Driver.Bitmap = NULL; + ctx->Driver.DrawPixels = NULL; + ctx->Driver.Bitmap = NULL; - ctx->Driver.RegisterVB = r128DDRegisterVB; - ctx->Driver.UnregisterVB = r128DDUnregisterVB; - ctx->Driver.BuildPrecalcPipeline = r128DDBuildPrecalcPipeline; + ctx->Driver.RegisterVB = r128DDRegisterVB; + ctx->Driver.UnregisterVB = r128DDUnregisterVB; + ctx->Driver.BuildPrecalcPipeline = r128DDBuildPrecalcPipeline; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.h b/xc/lib/GL/mesa/src/drv/r128/r128_dd.h index f58dbd39a..447745c43 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.h @@ -1,8 +1,8 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.h,v 1.1 2000/06/17 00:03:05 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.h,v 1.2 2000/12/04 19:21:45 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., - Cedar Park, Texas. + Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c b/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c new file mode 100644 index 000000000..c02196ef9 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c @@ -0,0 +1,552 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c,v 1.1 2000/12/04 19:21:46 dawes Exp $ */ +/* + * GLX Hardware Device Driver for Matrox G400 + * Copyright (C) 1999 Keith Whitwell + * + * 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 + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS 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. + * + */ + +#include <stdio.h> + +#include "r128_context.h" +#include "r128_pipeline.h" +#include "r128_ioctl.h" +#include "r128_tris.h" +#include "r128_state.h" +#include "r128_vb.h" + +#include "types.h" +#include "enums.h" +#include "cva.h" +#include "vertices.h" +#include "mmath.h" +#include "xform.h" + +#define DEBUG_ELTPATH 0 + +/* Always use a full-sized stride for vertices. [FIXME] + * Stride in the buffers must be a quadword multiple. + */ +#define CLIP_STRIDE 10 + +static void fire_elts( r128ContextPtr r128ctx ) +{ + int vertsize = r128ctx->vertsize; + + LOCK_HARDWARE( r128ctx ); + + if ( DEBUG_ELTPATH ) + fprintf( stderr, "\n%s: elt=%p ret=%p vs=%d\n", + __FUNCTION__, r128ctx->elt_buf, + r128ctx->retained_buf, vertsize ); + + /* Fire queued elements and discard that buffer if its contents + * won't be referenced by future elements. + */ + if ( r128ctx->elt_buf ) + { + GLuint retain = (r128ctx->elt_buf == r128ctx->retained_buf); + + if ( r128ctx->first_elt != r128ctx->next_elt ) { + r128FireEltsLocked( r128ctx, + ((GLuint)r128ctx->first_elt - + (GLuint)r128ctx->elt_buf->address), + ((GLuint)r128ctx->next_elt - + (GLuint)r128ctx->elt_buf->address), + !retain ); + } else if ( !retain ) { + r128ReleaseBufLocked( r128ctx, r128ctx->elt_buf ); + } + + r128ctx->elt_buf = 0; + } + else if ( r128ctx->vert_buf ) + { + r128FlushVerticesLocked( r128ctx ); + } + + r128GetEltBufLocked( r128ctx ); + + UNLOCK_HARDWARE( r128ctx ); + + /* Give the compiler a chance to optimize the divisions. + */ + switch ( vertsize ) { + case 8: + r128ctx->next_vert_index = (GLushort) + (((r128ctx->elt_buf->idx + 1) * + R128_BUFFER_SIZE / (8 * sizeof(GLuint))) - 1); + r128ctx->next_vert = (GLfloat *) + ((GLuint)r128ctx->vert_heap + + r128ctx->next_vert_index * 8 * sizeof(GLfloat)); + break; + + case 10: + r128ctx->next_vert_index = (GLushort) + (((r128ctx->elt_buf->idx + 1) * + R128_BUFFER_SIZE / (10 * sizeof(GLuint))) - 1); + r128ctx->next_vert = (GLfloat *) + ((GLuint)r128ctx->vert_heap + + r128ctx->next_vert_index * 10 * sizeof(GLfloat)); + break; + } + + r128ctx->first_elt = r128ctx->next_elt = (GLushort *) + ((GLubyte *)r128ctx->elt_buf->address + R128_INDEX_PRIM_OFFSET); + + r128ctx->elt_vertsize = vertsize; + + if ( DEBUG_ELTPATH ) + fprintf( stderr, "new elt=%p idx=%d tot=%d next=%p idx=%d\n\n", + r128ctx->elt_buf, r128ctx->elt_buf->idx, + r128ctx->elt_buf->total, + r128ctx->next_vert, r128ctx->next_vert_index ); +} + + +static void release_bufs( r128ContextPtr r128ctx ) +{ + if ( DEBUG_ELTPATH ) + fprintf( stderr, "%s: %d idx=%d\n", + __FUNCTION__, + r128ctx->retained_buf && + r128ctx->retained_buf != r128ctx->elt_buf, + r128ctx->retained_buf ? r128ctx->retained_buf->idx : -1 ); + + if ( r128ctx->retained_buf && r128ctx->retained_buf != r128ctx->elt_buf ) + { + LOCK_HARDWARE( r128ctx ); + if ( r128ctx->first_elt != r128ctx->next_elt ) { + r128FireEltsLocked( r128ctx, + ((GLuint)r128ctx->first_elt - + (GLuint)r128ctx->elt_buf->address), + ((GLuint)r128ctx->next_elt - + (GLuint)r128ctx->elt_buf->address), + 0 ); + + ALIGN_NEXT_ELT( r128ctx ); + r128ctx->first_elt = r128ctx->next_elt; + } + + r128ReleaseBufLocked( r128ctx, r128ctx->retained_buf ); + UNLOCK_HARDWARE( r128ctx ); + } + + r128ctx->retained_buf = 0; +} + + + + +#define NEGATIVE(f) (f < 0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) +#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) ) + + +#define INTERP_RGBA(t, out, a, b) { \ + int i; \ + for (i = 0; i < 4; i++) { \ + GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a[i]); \ + GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b[i]); \ + GLfloat fo = LINTERP(t, fa, fb); \ + FLOAT_COLOR_TO_UBYTE_COLOR(out[i], fo); \ + } \ +} + + +#define CLIP(SGN,V,PLANE) \ +if (mask & PLANE) { \ + GLuint *indata = inlist[in]; \ + GLuint *outdata = inlist[in ^= 1]; \ + GLuint nr = n; \ + GLfloat *J = verts[indata[nr-1]]; \ + GLfloat dpJ = (SGN J[V]) + J[3]; \ + \ + for (i = n = 0 ; i < nr ; i++) { \ + GLuint elt_i = indata[i]; \ + GLfloat *I = verts[elt_i]; \ + GLfloat dpI = (SGN I[V]) + I[3]; \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + GLfloat *O = verts[next_vert]; \ + outdata[n++] = next_vert++; \ + \ + if (NEGATIVE(dpI)) { \ + GLfloat t = dpI / (dpI - dpJ); \ + interp(t, O, I, J); \ + } \ + else \ + { \ + GLfloat t = dpJ / (dpJ - dpI); \ + interp(t, O, J, I); \ + } \ + } \ + \ + if (!NEGATIVE(dpI)) \ + outdata[n++] = elt_i; \ + \ + J = I; \ + dpJ = dpI; \ + } \ + \ + if (n < 3) return; \ +} + + +static void r128_tri_clip( r128ContextPtr r128ctx, + struct vertex_buffer *VB, + GLuint *elt, + GLubyte mask ) +{ + struct r128_elt_tab *tab = r128ctx->elt_tab; + r128_interp_func interp = tab->interp; + int vertsize = r128ctx->vertsize; + GLuint inlist[2][VB_MAX_CLIPPED_VERTS]; + GLuint in = 0; + GLuint n = 3, next_vert = 3; + GLuint i; + GLfloat verts[VB_MAX_CLIPPED_VERTS][CLIP_STRIDE]; + + /* Build temporary vertices in clipspace. This is the potential + * downside to this path. + */ + tab->build_tri_verts( r128ctx, VB, (GLfloat *)verts, elt ); + + inlist[0][0] = 0; + inlist[0][1] = 1; + inlist[0][2] = 2; + + CLIP(-,0,CLIP_RIGHT_BIT); + CLIP(+,0,CLIP_LEFT_BIT); + CLIP(-,1,CLIP_TOP_BIT); + CLIP(+,1,CLIP_BOTTOM_BIT); + CLIP(-,2,CLIP_FAR_BIT); + CLIP(+,2,CLIP_NEAR_BIT); + + + { + GLuint *out = inlist[in]; + GLint space = (GLint)((GLuint)r128ctx->next_vert - + (GLuint)r128ctx->next_elt); + + if ( DEBUG_ELTPATH ) + fprintf( stderr, " clip nv=%p ne=%p space=%d thresh=%d %d\n", + r128ctx->next_vert, r128ctx->next_elt, + space, n * (vertsize + 2) * sizeof(GLuint), + space < n * (vertsize + 2) * sizeof(GLuint) ); + + if ( space < n * (vertsize + 2) * sizeof(GLuint) ) { + fire_elts( r128ctx ); + } + + /* Project the new vertices and emit to dma buffers. Translate + * out values to physical addresses for setup dma. + */ + tab->project_and_emit_verts( r128ctx, (GLfloat *)verts, out, n ); + + /* Convert the planar polygon to a list of triangles and emit to + * elt buffers. + */ + for (i = 2 ; i < n ; i++) { + r128ctx->next_elt[0] = (GLushort) out[0]; + r128ctx->next_elt[1] = (GLushort) out[i-1]; + r128ctx->next_elt[2] = (GLushort) out[i]; + r128ctx->next_elt += 3; + } + } +} + + + + +/* Build a table of functions to clip each primitive type. These + * produce a list of elements in the appropriate 'reduced' primitive, + * ie (points, lines, triangles) containing all the clipped and + * unclipped primitives from the original list. + */ + +#define INIT(x) + +#define TRI_THRESHOLD (GLint)(2 * sizeof(GLuint)) + +#define UNCLIPPED_VERT(x) (GLushort)(r128ctx->first_vert_index - x) + +#define TRIANGLE( e2, e1, e0 ) \ +do { \ + if ( DEBUG_ELTPATH ) \ + fprintf( stderr, " tri nv=%p ne=%p space=%d thresh=%d %d\n", \ + r128ctx->next_vert, r128ctx->next_elt, \ + (GLint)((GLuint)r128ctx->next_vert - \ + (GLuint)r128ctx->next_elt), TRI_THRESHOLD, \ + ( (GLint)((GLuint)r128ctx->next_vert - \ + (GLuint)r128ctx->next_elt) < TRI_THRESHOLD ) );\ + if ( (GLint)((GLuint)r128ctx->next_vert - \ + (GLuint)r128ctx->next_elt) < TRI_THRESHOLD ) { \ + if ( DEBUG_ELTPATH ) \ + fprintf( stderr, " firing elts...\n" ); \ + fire_elts( r128ctx ); \ + } \ + r128ctx->next_elt[0] = UNCLIPPED_VERT( e2 ); \ + r128ctx->next_elt[1] = UNCLIPPED_VERT( e1 ); \ + r128ctx->next_elt[2] = UNCLIPPED_VERT( e0 ); \ + if ( 0 ) \ + fprintf( stderr, " tri %d,%d,%d -> %hd,%hd,%hd\n", \ + e2, e1, e0, r128ctx->next_elt[0], \ + r128ctx->next_elt[1], r128ctx->next_elt[2]); \ + r128ctx->next_elt += 3; \ +} while (0) + +#define CLIP_TRIANGLE( e2, e1, e0 ) \ +do { \ + GLubyte ormask = mask[e2] | mask[e1] | mask[e0]; \ + if ( ormask == 0 ) { \ + TRIANGLE( e2, e1, e0 ); \ + } else if ( (mask[e2] & mask[e1] & mask[e0]) == 0 ) { \ + out[0] = e2; \ + out[1] = e1; \ + out[2] = e0; \ + r128_tri_clip( r128ctx, VB, out, ormask ); \ + } \ +} while (0) + +#define LOCAL_VARS \ + r128ContextPtr r128ctx = R128_CONTEXT( VB->ctx ); \ + GLuint *elt = VB->EltPtr->data; \ + GLuint out[VB_MAX_CLIPPED_VERTS]; \ + GLubyte *mask = VB->ClipMask; \ + (void) mask; (void) out; (void) elt; (void) r128ctx; + + + +#define RENDER_POINTS( start, count ) +#define RENDER_LINE( i1, i0 ) +#define RENDER_TRI( i2, i1, i0, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ + if (parity) e2 = elt[i1], e1 = elt[i2]; \ + CLIP_TRIANGLE( e2, e1, e0 ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i0, pv ) \ + CLIP_TRIANGLE( elt[i3], elt[i2], elt[i0] ); \ + CLIP_TRIANGLE( elt[i2], elt[i1], elt[i0] ) + +#define TAG(x) r128_##x##_elt +#include "render_tmp.h" + + + +#define LOCAL_VARS \ + r128ContextPtr r128ctx = R128_CONTEXT( VB->ctx ); \ + GLuint *elt = VB->EltPtr->data; \ + (void) elt; (void) r128ctx; + +#define RENDER_POINTS( start, count ) +#define RENDER_LINE( i1, i0 ) +#define RENDER_TRI( i2, i1, i0, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ + if (parity) e2 = elt[i1], e1 = elt[i2]; \ + TRIANGLE( e2, e1, e0 ); \ +} while (0) + +#define RENDER_QUAD(i3, i2, i1, i0, pv ) \ + TRIANGLE( elt[i3], elt[i2], elt[i0] ); \ + TRIANGLE( elt[i2], elt[i1], elt[i0] ) + +#define TAG(x) r128_##x##_elt_unclipped +#include "render_tmp.h" + + + + +static void refresh_projection_matrix( GLcontext *ctx ) +{ + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + GLmatrix *mat = &ctx->Viewport.WindowMap; + GLfloat *m = r128ctx->device_matrix; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX]; + m[MAT_SY] = -mat->m[MAT_SY]; + m[MAT_TY] = -mat->m[MAT_TY] + r128ctx->driDrawable->h; + m[MAT_SZ] = mat->m[MAT_SZ] * r128ctx->depth_scale; + m[MAT_TZ] = mat->m[MAT_TZ] * r128ctx->depth_scale; +} + +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_R 2 +#define CLIP_UBYTE_A 3 + + +#define TYPE (0) +#define TAG(x) x +#include "r128_elttmp.h" + +#define TYPE (R128_RGBA_BIT) +#define TAG(x) x##_RGBA +#include "r128_elttmp.h" + +#define TYPE (R128_TEX0_BIT) +#define TAG(x) x##_TEX0 +#include "r128_elttmp.h" + +#define TYPE (R128_RGBA_BIT|R128_TEX0_BIT) +#define TAG(x) x##_RGBA_TEX0 +#include "r128_elttmp.h" + +#define TYPE (R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT) +#define TAG(x) x##_RGBA_TEX0_TEX1 +#include "r128_elttmp.h" + +#define TYPE (R128_TEX0_BIT|R128_TEX1_BIT) +#define TAG(x) x##_TEX0_TEX1 +#include "r128_elttmp.h" + + +/* Very sparsely popluated array - fix the indices. + */ +static struct r128_elt_tab r128EltTab[0x80]; + +void r128DDEltPathInit( void ) +{ + r128_render_init_elt(); + r128_render_init_elt_unclipped(); + + r128_init_eltpath( &r128EltTab[0] ); + r128_init_eltpath_RGBA( &r128EltTab[R128_RGBA_BIT] ); + r128_init_eltpath_TEX0( &r128EltTab[R128_TEX0_BIT] ); + r128_init_eltpath_RGBA_TEX0( &r128EltTab[R128_RGBA_BIT|R128_TEX0_BIT] ); + r128_init_eltpath_TEX0_TEX1( &r128EltTab[R128_TEX0_BIT|R128_TEX1_BIT] ); + r128_init_eltpath_RGBA_TEX0_TEX1( &r128EltTab[R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT] ); +} + +#define VALID_SETUP (R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT) + + + +/* Use a temporary array for device coordinates, so that we can easily + * tap into existing mesa assembly. Otherwise consider emitting + * device coordinates to dma buffers directly from the project/cliptest + * routine. (requires output stride, potential loss of writecombining + * efficiency?) + * + * This path is a lot closer to the standard vertex path in the + * initial stages than the original fastpath. A slightly more optimal + * path could be constructed, but would require us to write new + * assembly. + */ +void r128DDEltPath( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLenum prim = ctx->CVA.elt_mode; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + struct r128_elt_tab *tab = &r128EltTab[r128ctx->SetupIndex & VALID_SETUP]; + GLint vertsize = r128ctx->vertsize; + GLint space; + + if ( DEBUG_ELTPATH ) + fprintf( stderr, "\n%s: count=%d space=%d\n", + __FUNCTION__, VB->Count, + (GLint)((GLuint)r128ctx->next_vert - + (GLuint)r128ctx->next_elt) ); + + VB->ClipPtr = TransformRaw( &VB->Clip, + &ctx->ModelProjectMatrix, + VB->ObjPtr ); + + refresh_projection_matrix( ctx ); + + VB->ClipAndMask = ~0; + VB->ClipOrMask = 0; + VB->Projected = gl_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &VB->Win, + VB->ClipMask, + &VB->ClipOrMask, + &VB->ClipAndMask ); + + if ( VB->ClipAndMask ) { + if ( DEBUG_ELTPATH ) + fprintf( stderr, " clipped, returning...\n" ); + return; + } + if ( r128ctx->vert_buf ) { + r128FlushVertices( r128ctx ); + } + if ( r128ctx->new_state ) { + r128DDUpdateHWState( ctx ); + } + + space = (GLint)((GLuint)r128ctx->next_vert - + (GLuint)r128ctx->next_elt); + + /* Allocate a single buffer to hold unclipped vertices. All + * unclipped vertices must be contiguous. + */ + if ( DEBUG_ELTPATH ) + fprintf( stderr, " top nv=%p ne=%p space=%d reqd=%d count=%d clip=0x%x\n\n", + r128ctx->next_vert, r128ctx->next_elt, space, + VB->Count * vertsize * sizeof(GLuint), + VB->Count, VB->ClipOrMask ); + + /* Because we need to adjust the next_elt pointer to accomodate the + * CCE packet header, we can sometimes go past the next_vert pointer + * and thus have negative space. + */ + if ( space < VB->Count * vertsize * sizeof(GLuint) || + space < 0 || r128ctx->vertsize != r128ctx->elt_vertsize ) { + fire_elts( r128ctx ); + } + + r128ctx->retained_buf = r128ctx->elt_buf; + + /* Emit unclipped vertices to the buffer. + */ + tab->emit_unclipped_verts( VB ); + + /* Emit indices and clipped vertices to one or more buffers. + */ + if ( VB->ClipOrMask ) { + r128ctx->elt_tab = tab; + r128_render_tab_elt[prim]( VB, 0, VB->EltPtr->count, 0 ); + } else { + r128_render_tab_elt_unclipped[prim]( VB, 0, VB->EltPtr->count, 0 ); + } + + /* Send to hardware and release the elt buffer. + */ + release_bufs( r128ctx ); + + /* This indicates that there is no cached data to reuse. + */ + VB->pipeline->data_valid = 0; + VB->pipeline->new_state = 0; + + if ( 0 ) { + FLUSH_BATCH( r128ctx ); + + LOCK_HARDWARE( r128ctx ); + drmR128WaitForIdleCCE( r128ctx->driFd ); + UNLOCK_HARDWARE( r128ctx ); + + __asm__ __volatile__ ( "int $3" ); + } +} diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_elttmp.h b/xc/lib/GL/mesa/src/drv/r128/r128_elttmp.h new file mode 100644 index 000000000..ba82a261f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/r128_elttmp.h @@ -0,0 +1,274 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_elttmp.h,v 1.1 2000/12/04 19:21:46 dawes Exp $ */ +/* + * DRI Hardware Device Driver for G200/G400 + * Copyright (C) 1999 Keith Whitwell + * + * 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 + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS 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. + * + */ + +/* Buffers fill from high addresses down with vertices and from low + * addresses up with elements. + */ + + +/* Emit the bulk of the vertices to the first dma buffer. Leave + * empty slots for clipped vertices so that we can still address + * vertices by index. + */ +static void TAG(emit_unclipped_verts)( struct vertex_buffer *VB ) +{ + GLuint i; + r128ContextPtr r128ctx = R128_CONTEXT(VB->ctx); + GLfloat *dev = VB->Projected->start; + GLubyte *color = VB->ColorPtr->start; + GLfloat *tex0_data = VB->TexCoordPtr[0]->start; + GLfloat *tex1_data = VB->TexCoordPtr[1]->start; + GLuint color_stride = VB->ColorPtr->stride; + GLuint tex0_stride = VB->TexCoordPtr[0]->stride; + GLuint tex1_stride = VB->TexCoordPtr[1]->stride; + GLuint buffer_stride = r128ctx->vertsize; + + GLfloat *f = r128ctx->next_vert; + GLuint count = VB->Count; + GLubyte *clipmask = VB->ClipMask; + + const GLfloat *m = r128ctx->device_matrix; + const GLfloat sx = m[0], sy = m[5], sz = m[10]; + const GLfloat tx = m[12], ty = m[13], tz = m[14]; + + if ( 0 ) + fprintf( stderr, "%s: stride=%d\n", __FUNCTION__, buffer_stride ); + + r128ctx->retained_buf = r128ctx->elt_buf; + r128ctx->first_vert_index = r128ctx->next_vert_index; + + for ( i = 0 ; i < count ; f -= buffer_stride, i++ ) + { + if ( !clipmask[i] ) + { + if ( 0 ) + fprintf( stderr, "vert=%d addr=%p space=0x%x\n", + i, f, (GLuint)f - (GLuint)r128ctx->elt_buf->address ); + + f[0] = sx * dev[0] + tx; + f[1] = sy * dev[1] + ty; + f[2] = sz * dev[2] + tz; + f[3] = dev[3]; + + if (TYPE & R128_RGBA_BIT) { +#if 0 /*defined(USE_X86_ASM)*/ + __asm__ ( + "movl (%%edx),%%eax \n" + "bswap %%eax \n" + "rorl $8,%%eax \n" + "movl %%eax,16(%%edi) \n" + : + : "d" (color), "D" (f) + : "%eax" ); +#else + GLubyte *b = (GLubyte *)&f[4]; + b[CLIP_UBYTE_B] = color[2]; + b[CLIP_UBYTE_G] = color[1]; + b[CLIP_UBYTE_R] = color[0]; + b[CLIP_UBYTE_A] = color[3]; +#endif + } + + if (TYPE & R128_TEX0_BIT) { + *(int*)&f[6] = *(int*)&tex0_data[0]; + *(int*)&f[7] = *(int*)&tex0_data[1]; + } + + if (TYPE & R128_TEX1_BIT) { + *(int*)&f[8] = *(int*)&tex1_data[0]; + *(int*)&f[9] = *(int*)&tex1_data[1]; + } + } + + STRIDE_F(dev, 16); + if (TYPE & R128_RGBA_BIT) color += color_stride; + if (TYPE & R128_TEX0_BIT) STRIDE_F(tex0_data, tex0_stride); + if (TYPE & R128_TEX1_BIT) STRIDE_F(tex1_data, tex1_stride); + } + + r128ctx->next_vert = f; + r128ctx->next_vert_index -= count; +} + + +/* Build three temporary clipspace vertex for clipping a triangle. + * Recreate from the VB data rather than trying to read back from + * uncached memory. + */ +static void TAG(build_tri_verts)( r128ContextPtr r128ctx, + struct vertex_buffer *VB, + GLfloat *O, + GLuint *elt ) +{ + int i; + + for ( i = 0 ; i < 3 ; i++, O += CLIP_STRIDE ) { + GLfloat *clip = VB->Clip.start + elt[i]*4; + + O[0] = clip[0]; + O[1] = clip[1]; + O[2] = clip[2]; + O[3] = clip[3]; + + if (TYPE & R128_RGBA_BIT) { + GLubyte *col = VEC_ELT(VB->ColorPtr, GLubyte, elt[i]); + GLubyte *b = (GLubyte *)&O[4]; + b[CLIP_UBYTE_R] = col[0]; + b[CLIP_UBYTE_G] = col[1]; + b[CLIP_UBYTE_B] = col[2]; + b[CLIP_UBYTE_A] = col[3]; + } + + if ( 0 ) + fprintf(stderr, + "build_tri_vert elt[%d]=%d index=0x%x (first_index=0x%x)\n", + i, elt[i], (GLuint)UNCLIPPED_VERT(elt[i]), + (GLuint)r128ctx->first_vert_index); + + *(GLuint *)&O[5] = UNCLIPPED_VERT(elt[i]); + + if (TYPE & R128_TEX0_BIT) { + GLfloat *tex0_data = VEC_ELT(VB->TexCoordPtr[0], GLfloat, elt[i]); + *(int*)&O[6] = *(int*)&tex0_data[0]; + *(int*)&O[7] = *(int*)&tex0_data[1]; + } + + if (TYPE & R128_TEX1_BIT) { + GLfloat *tex1_data = VEC_ELT(VB->TexCoordPtr[1], GLfloat, elt[i]); + *(int*)&O[8] = *(int*)&tex1_data[0]; + *(int*)&O[9] = *(int*)&tex1_data[1]; + } + } +} + + +/* Interpolate between two of the vertices constructed above. + */ +static void TAG(interp)( GLfloat t, + GLfloat *O, + const GLfloat *I, + const GLfloat *J ) +{ + O[0] = LINTERP(t, I[0], J[0]); + O[1] = LINTERP(t, I[1], J[1]); + O[2] = LINTERP(t, I[2], J[2]); + O[3] = LINTERP(t, I[3], J[3]); + + if (TYPE & R128_RGBA_BIT) { + INTERP_RGBA(t, + ((GLubyte *)&(O[4])), + ((GLubyte *)&(I[4])), + ((GLubyte *)&(J[4]))); + } + + if (0) fprintf(stderr, "setting 0x%x to ~0\n", (GLuint)&O[5]); + + *(GLuint *)&O[5] = ~0; /* note that this is a new vertex */ + + if (TYPE & R128_TEX0_BIT) { + O[6] = LINTERP(t, I[6], J[6]); + O[7] = LINTERP(t, I[7], J[7]); + } + + if (TYPE & R128_TEX1_BIT) { + O[8] = LINTERP(t, I[8], J[8]); + O[9] = LINTERP(t, I[9], J[9]); + } +} + + + +/* When clipping is complete, scan the final vertex list and emit any + * new ones to dma buffers. Update the element list to a format + * suitable for sending to hardware. + */ +static void TAG(project_and_emit_verts)( r128ContextPtr r128ctx, + const GLfloat *verts, + GLuint *elt, + int nr) +{ + GLfloat *O = r128ctx->next_vert; + GLushort index = r128ctx->next_vert_index; + GLuint buffer_stride = r128ctx->vertsize; + + const GLfloat *m = r128ctx->device_matrix; + const GLfloat sx = m[0], sy = m[5], sz = m[10]; + const GLfloat tx = m[12], ty = m[13], tz = m[14]; + GLuint i; + + for (i = 0 ; i < nr ; i++) { + const GLfloat *I = &verts[elt[i] * CLIP_STRIDE]; + GLuint tmp = *(GLuint *)&I[5]; + + if (0) fprintf(stderr, "elt[%d] (tmp 0x%x %d) %d --> ", + i, (GLuint)&I[5], tmp, elt[i]); + + if ((elt[i] = tmp) == ~0) + { + GLfloat oow = 1.0/I[3]; + + elt[i] = index--; + + O[0] = sx * I[0] * oow + tx; + O[1] = sy * I[1] * oow + ty; + O[2] = sz * I[2] * oow + tz; + O[3] = oow; + + if (TYPE & R128_RGBA_BIT) { + *(int*)&O[4] = *(int*)&I[4]; + } + + if (TYPE & R128_TEX0_BIT) { + *(int*)&O[6] = *(int*)&I[6]; + *(int*)&O[7] = *(int*)&I[7]; + } + + if (TYPE & R128_TEX1_BIT) { + *(int*)&O[8] = *(int*)&I[8]; + *(int*)&O[9] = *(int*)&I[9]; + } + + O -= buffer_stride; + } + if (0) fprintf(stderr, "0x%x\n", elt[i]); + } + + r128ctx->next_vert = O; + r128ctx->next_vert_index = index; +} + + + +static void TAG(r128_init_eltpath)( struct r128_elt_tab *tab ) +{ + tab->emit_unclipped_verts = TAG(emit_unclipped_verts); + tab->build_tri_verts = TAG(build_tri_verts); + tab->interp = TAG(interp); + tab->project_and_emit_verts = TAG(project_and_emit_verts); +} + +#undef TYPE +#undef TAG +#undef STRIDE diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_fastpath.c b/xc/lib/GL/mesa/src/drv/r128/r128_fastpath.c index 2bcf901d0..57dab53a9 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_fastpath.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_fastpath.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_fastpath.c,v 1.3 2000/11/13 23:31:30 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_fastpath.c,v 1.4 2000/12/04 19:21:46 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,21 +28,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Keith Whitwell <keithw@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" #include "r128_state.h" #include "r128_vb.h" -#include "r128_cce.h" -#include "r128_tris.h" #include "r128_pipeline.h" +#include "r128_ioctl.h" +#include "r128_tris.h" #include "mmath.h" #include "cva.h" #include "vertices.h" +/* HACK: Declare this global for now */ +static GLfloat m[16] __attribute__ ((aligned (16))); + /* FIXME: These routines were copied from the i810 driver, and were only slightly modified for the Rage 128. They still need to be optmizied and cleaned up. Also, support for USE_RHW2 needs to be added. @@ -51,59 +55,57 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. isn't necesary here. */ -typedef void (*r128BuildVerticesFunc)( struct vertex_buffer *VB, - GLuint do_cliptest ); +struct r128_fast_tab { + void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest ); + void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ); +}; -typedef struct r128_fast_table { - r128BuildVerticesFunc build_vertices; - r128InterpFunc interp; -} r128FastPathTable; +#define POINT(x) r128_draw_point( r128ctx, &vert[x], psize ) +#define LINE(x,y) r128_draw_line( r128ctx, &vert[x], &vert[y], lwidth ) +#define TRI(x,y,z) r128_draw_triangle( r128ctx, &vert[x], &vert[y], &vert[z] ) -#define POINT(x) r128DrawPointVB(r128ctx, &vert[x], psize) -#define LINE(x,y) r128DrawLineVB(r128ctx, &vert[x], &vert[y], lwidth) -#define TRI(x,y,z) r128DrawTriangleVB(r128ctx, &vert[x], &vert[y], &vert[z]) /* Direct, and no clipping required. The clip funcs have not been written yet, so this is only useful for the fast path. */ -#define RENDER_POINTS(start, count) \ -do { \ - GLuint e; \ - for (e = start; e < count; e++) \ - POINT(elt[e]); \ +#define RENDER_POINTS(start, count) \ +do { \ + GLuint e; \ + for (e = start; e < count; e++) \ + POINT(elt[e]); \ } while (0) -#define RENDER_LINE(i1, i) \ -do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - LINE(e1, e); \ +#define RENDER_LINE(i1, i) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE(e1, e); \ } while (0) -#define RENDER_TRI(i2, i1, i, pv, parity) \ -do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) { \ - GLuint tmp = e2; \ - e2 = e1; \ - e1 = tmp; \ - } \ - TRI(e2, e1, e); \ +#define RENDER_TRI(i2, i1, i, pv, parity) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if (parity) { \ + GLuint tmp = e2; \ + e2 = e1; \ + e1 = tmp; \ + } \ + TRI(e2, e1, e); \ } while (0) -#define RENDER_QUAD(i3, i2, i1, i, pv) \ -do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - TRI(e3, e2, e); \ - TRI(e2, e1, e); \ +#define RENDER_QUAD(i3, i2, i1, i, pv) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI(e3, e2, e); \ + TRI(e2, e1, e); \ } while (0) -#define LOCAL_VARS \ - r128VertexPtr vert = R128_DRIVER_DATA(VB)->verts; \ - const GLuint *elt = VB->EltPtr->data; \ - GLcontext *ctx = VB->ctx; \ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ - const GLfloat lwidth = ctx->Line.Width; \ - const GLfloat psize = ctx->Point.Size; \ - (void) lwidth; (void)psize; (void) vert; +#define LOCAL_VARS \ + r128VertexPtr vert = R128_DRIVER_DATA(VB)->verts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; #define TAG(x) r128_##x##_smooth_indirect #include "render_tmp.h" @@ -115,196 +117,196 @@ do { \ #define LINTERP(T, A, B) ((A) + (T) * ((B) - (A))) -#define INTERP_RGBA(t, out, a, b) \ -do { \ - int i; \ - for (i = 0; i < 4; i++) { \ - GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a[i]); \ - GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b[i]); \ - GLfloat fo = LINTERP(t, fa, fb); \ - FLOAT_COLOR_TO_UBYTE_COLOR(out[i], fo); \ - } \ +#define INTERP_RGBA(t, out, a, b) \ +do { \ + int i; \ + for (i = 0; i < 4; i++) { \ + GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a[i]); \ + GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b[i]); \ + GLfloat fo = LINTERP(t, fa, fb); \ + FLOAT_COLOR_TO_UBYTE_COLOR(out[i], fo); \ + } \ } while (0) -#define CLIP(SGN, V, PLANE) \ -do { \ - if (mask & PLANE) { \ - GLuint *indata = inlist[in]; \ - GLuint *outdata = inlist[in ^= 1]; \ - GLuint nr = n; \ - GLfloat *J = verts[indata[nr-1]].f; \ - GLfloat dpJ = (SGN J[V]) + J[3]; \ - \ - inlist[0] = vlist1; \ - for (i = n = 0 ; i < nr ; i++) { \ - GLuint elt_i = indata[i]; \ - GLfloat *I = verts[elt_i].f; \ - GLfloat dpI = (SGN I[V]) + I[3]; \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLfloat *O = verts[next_vert].f; \ - GLfloat t, *in, *out; \ - \ - if (NEGATIVE(dpI)) { \ - t = dpI / (dpI - dpJ); \ - in = I; \ - out = J; \ - } else { \ - t = dpJ / (dpJ - dpI); \ - in = J; \ - out = I; \ - } \ - \ - interp(t, O, in, out); \ - \ - clipmask[next_vert] = 0; \ - outdata[n++] = next_vert++; \ - } \ - \ - clipmask[elt_i] |= PLANE; /* don't set up */ \ - \ - if (!NEGATIVE(dpI)) { \ - outdata[n++] = elt_i; \ - clipmask[elt_i] &= ~PLANE; /* set up after all */ \ - } \ - \ - J = I; \ - dpJ = dpI; \ - } \ - \ - if (n < 3) return; \ - } \ +#define CLIP(SGN, V, PLANE) \ +do { \ + if (mask & PLANE) { \ + GLuint *indata = inlist[in]; \ + GLuint *outdata = inlist[in ^= 1]; \ + GLuint nr = n; \ + GLfloat *J = verts[indata[nr-1]].f; \ + GLfloat dpJ = (SGN J[V]) + J[3]; \ + \ + inlist[0] = vlist1; \ + for (i = n = 0 ; i < nr ; i++) { \ + GLuint elt_i = indata[i]; \ + GLfloat *I = verts[elt_i].f; \ + GLfloat dpI = (SGN I[V]) + I[3]; \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t, *in, *out; \ + \ + if (NEGATIVE(dpI)) { \ + t = dpI / (dpI - dpJ); \ + in = I; \ + out = J; \ + } else { \ + t = dpJ / (dpJ - dpI); \ + in = J; \ + out = I; \ + } \ + \ + interp(t, O, in, out); \ + \ + clipmask[next_vert] = 0; \ + outdata[n++] = next_vert++; \ + } \ + \ + clipmask[elt_i] |= PLANE; /* don't set up */ \ + \ + if (!NEGATIVE(dpI)) { \ + outdata[n++] = elt_i; \ + clipmask[elt_i] &= ~PLANE; /* set up after all */ \ + } \ + \ + J = I; \ + dpJ = dpI; \ + } \ + \ + if (n < 3) return; \ + } \ } while (0) -#define LINE_CLIP(x,y,z,w,PLANE) \ -do { \ - if (mask & PLANE) { \ - GLfloat dpI = DOT4V(I,x,y,z,w); \ - GLfloat dpJ = DOT4V(J,x,y,z,w); \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLfloat *O = verts[next_vert].f; \ - GLfloat t = dpI / (dpI - dpJ); \ - \ - interp(t, O, I, J); \ - \ - clipmask[next_vert] = 0; \ - \ - if (NEGATIVE(dpI)) { \ - clipmask[elts[0]] |= PLANE; \ - I = O; \ - elts[0] = next_vert++; \ - } else { \ - clipmask[elts[1]] |= PLANE; \ - J = O; \ - elts[1] = next_vert++; \ - } \ - } else if (NEGATIVE(dpI)) return; \ - } \ +#define LINE_CLIP(x,y,z,w,PLANE) \ +do { \ + if (mask & PLANE) { \ + GLfloat dpI = DOT4V(I,x,y,z,w); \ + GLfloat dpJ = DOT4V(J,x,y,z,w); \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t = dpI / (dpI - dpJ); \ + \ + interp(t, O, I, J); \ + \ + clipmask[next_vert] = 0; \ + \ + if (NEGATIVE(dpI)) { \ + clipmask[elts[0]] |= PLANE; \ + I = O; \ + elts[0] = next_vert++; \ + } else { \ + clipmask[elts[1]] |= PLANE; \ + J = O; \ + elts[1] = next_vert++; \ + } \ + } else if (NEGATIVE(dpI)) return; \ + } \ } while (0) -static void r128TriClip(GLuint **p_elts, - r128Vertex *verts, - GLubyte *clipmask, - GLuint *p_next_vert, - GLubyte mask, - r128InterpFunc interp) +static __inline void r128_tri_clip( GLuint **p_elts, + r128Vertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + r128_interp_func interp ) { - GLuint *elts = *p_elts; - GLuint next_vert = *p_next_vert; - GLuint in = 0; - GLuint n = 3; - GLuint vlist1[VB_MAX_CLIPPED_VERTS]; - GLuint vlist2[VB_MAX_CLIPPED_VERTS]; - GLuint *inlist[2]; - GLuint *out; - GLuint i; - - inlist[0] = elts; - inlist[1] = vlist2; - - CLIP(-,0,CLIP_RIGHT_BIT); - CLIP(+,0,CLIP_LEFT_BIT); - CLIP(-,1,CLIP_TOP_BIT); - CLIP(+,1,CLIP_BOTTOM_BIT); - CLIP(-,2,CLIP_FAR_BIT); - CLIP(+,2,CLIP_NEAR_BIT); - - /* Convert the planar polygon to a list of triangles */ - out = inlist[in]; - - for (i = 2 ; i < n ; i++) { - elts[0] = out[0]; - elts[1] = out[i-1]; - elts[2] = out[i]; - elts += 3; - } - - *p_next_vert = next_vert; - *p_elts = elts; + GLuint *elts = *p_elts; + GLuint next_vert = *p_next_vert; + GLuint in = 0; + GLuint n = 3; + GLuint vlist1[VB_MAX_CLIPPED_VERTS]; + GLuint vlist2[VB_MAX_CLIPPED_VERTS]; + GLuint *inlist[2]; + GLuint *out; + GLuint i; + + inlist[0] = elts; + inlist[1] = vlist2; + + CLIP( -, 0, CLIP_RIGHT_BIT ); + CLIP( +, 0, CLIP_LEFT_BIT ); + CLIP( -, 1, CLIP_TOP_BIT ); + CLIP( +, 1, CLIP_BOTTOM_BIT ); + CLIP( -, 2, CLIP_FAR_BIT ); + CLIP( +, 2, CLIP_NEAR_BIT ); + + /* Convert the planar polygon to a list of triangles */ + out = inlist[in]; + + for (i = 2 ; i < n ; i++) { + elts[0] = out[0]; + elts[1] = out[i-1]; + elts[2] = out[i]; + elts += 3; + } + + *p_next_vert = next_vert; + *p_elts = elts; } -static void r128LineClip(GLuint **p_elts, - r128Vertex *verts, - GLubyte *clipmask, - GLuint *p_next_vert, - GLubyte mask, - r128InterpFunc interp) +static __inline void r128_line_clip( GLuint **p_elts, + r128Vertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + r128_interp_func interp ) { - GLuint *elts = *p_elts; - GLfloat *I = verts[elts[0]].f; - GLfloat *J = verts[elts[1]].f; - GLuint next_vert = *p_next_vert; - - LINE_CLIP(1,0,0,-1,CLIP_LEFT_BIT); - LINE_CLIP(-1,0,0,1,CLIP_RIGHT_BIT); - LINE_CLIP(0,1,0,-1,CLIP_TOP_BIT); - LINE_CLIP(0,-1,0,1,CLIP_BOTTOM_BIT); - LINE_CLIP(0,0,1,-1,CLIP_FAR_BIT); - LINE_CLIP(0,0,-1,1,CLIP_NEAR_BIT); - - *p_next_vert = next_vert; - *p_elts += 2; + GLuint *elts = *p_elts; + GLfloat *I = verts[elts[0]].f; + GLfloat *J = verts[elts[1]].f; + GLuint next_vert = *p_next_vert; + + LINE_CLIP( 1, 0, 0, -1, CLIP_LEFT_BIT ); + LINE_CLIP( -1, 0, 0, 1, CLIP_RIGHT_BIT ); + LINE_CLIP( 0, 1, 0, -1, CLIP_TOP_BIT ); + LINE_CLIP( 0, -1, 0, 1, CLIP_BOTTOM_BIT ); + LINE_CLIP( 0, 0, 1, -1, CLIP_FAR_BIT ); + LINE_CLIP( 0, 0, -1, 1, CLIP_NEAR_BIT ); + + *p_next_vert = next_vert; + *p_elts += 2; } -#define CLIP_POINT(e) \ -do { \ - if (mask[e]) *out++ = e; \ +#define CLIP_POINT(e) \ +do { \ + if (mask[e]) *out++ = e; \ } while (0) -#define CLIP_LINE(e1, e0) \ -do { \ - GLubyte ormask = mask[e0] | mask[e1]; \ - out[0] = e1; \ - out[1] = e0; \ - out += 2; \ - if (ormask) { \ - out-=2; \ - if (!(mask[e0] & mask[e1])) { \ - r128LineClip(&out, verts, mask, &next_vert, ormask, interp); \ - } \ - } \ +#define CLIP_LINE(e1, e0) \ +do { \ + GLubyte ormask = mask[e0] | mask[e1]; \ + out[0] = e1; \ + out[1] = e0; \ + out += 2; \ + if (ormask) { \ + out-=2; \ + if (!(mask[e0] & mask[e1])) { \ + r128_line_clip(&out, verts, mask, &next_vert, ormask, interp); \ + } \ + } \ } while (0) -#define CLIP_TRIANGLE(e2, e1, e0) \ -do { \ - GLubyte ormask; \ - out[0] = e2; \ - out[1] = e1; \ - out[2] = e0; \ - out += 3; \ - ormask = mask[e2] | mask[e1] | mask[e0]; \ - if (ormask) { \ - out -= 3; \ - if (!(mask[e2] & mask[e1] & mask[e0])) { \ - r128TriClip(&out, verts, mask, &next_vert, ormask, interp); \ - } \ - } \ +#define CLIP_TRIANGLE(e2, e1, e0) \ +do { \ + GLubyte ormask; \ + out[0] = e2; \ + out[1] = e1; \ + out[2] = e0; \ + out += 3; \ + ormask = mask[e2] | mask[e1] | mask[e0]; \ + if (ormask) { \ + out -= 3; \ + if (!(mask[e2] & mask[e1] & mask[e0])) { \ + r128_tri_clip(&out, verts, mask, &next_vert, ormask, interp); \ + } \ + } \ } while (0) @@ -314,64 +316,65 @@ do { \ * ie (points, lines, triangles) containing all the clipped and * unclipped primitives from the original list. */ -#define LOCAL_VARS \ - r128ContextPtr r128ctx = R128_CONTEXT(VB->ctx); \ - r128VertexBufferPtr r128VB = R128_DRIVER_DATA(VB); \ - GLuint *elt = VB->EltPtr->data; \ - r128Vertex *verts = r128VB->verts; \ - GLuint next_vert = r128VB->last_vert; \ - GLuint *out = r128VB->clipped_elements.data; \ - GLubyte *mask = VB->ClipMask; \ - r128InterpFunc interp = r128ctx->interp; \ - (void) interp; (void) verts; - -#define POSTFIX \ - r128VB->clipped_elements.count = out - r128VB->clipped_elements.data; \ - r128VB->last_vert = next_vert; +#define LOCAL_VARS \ + r128ContextPtr r128ctx = R128_CONTEXT(VB->ctx); \ + r128VertexBufferPtr r128VB = R128_DRIVER_DATA(VB); \ + GLuint *elt = VB->EltPtr->data; \ + r128Vertex *verts = r128VB->verts; \ + GLuint next_vert = r128VB->last_vert; \ + GLuint *out = r128VB->clipped_elements.data; \ + GLubyte *mask = VB->ClipMask; \ + r128_interp_func interp = r128ctx->interp; \ + (void) interp; (void) verts; + +#define POSTFIX \ + r128VB->clipped_elements.count = out - r128VB->clipped_elements.data; \ + r128VB->last_vert = next_vert; #define INIT(x) -#define RENDER_POINTS(start, count) \ -do { \ - GLuint i; \ - for (i = start; i < count; i++) \ - CLIP_POINT(elt[i]); \ +#define RENDER_POINTS(start, count) \ +do { \ + GLuint i; \ + for (i = start; i < count; i++) \ + CLIP_POINT(elt[i]); \ } while (0) -#define RENDER_LINE(i1, i0) \ -do { \ - CLIP_LINE(elt[i1], elt[i0]); \ +#define RENDER_LINE(i1, i0) \ +do { \ + CLIP_LINE(elt[i1], elt[i0]); \ } while (0) -#define RENDER_TRI(i2, i1, i0, pv, parity) \ -do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ - if (parity) e2 = elt[i1], e1 = elt[i2]; \ - CLIP_TRIANGLE(e2, e1, e0); \ +#define RENDER_TRI(i2, i1, i0, pv, parity) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ + if (parity) e2 = elt[i1], e1 = elt[i2]; \ + CLIP_TRIANGLE(e2, e1, e0); \ } while (0) -#define RENDER_QUAD(i3, i2, i1, i0, pv) \ -do { \ - CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \ - CLIP_TRIANGLE(elt[i2], elt[i1], elt[i0]); \ +#define RENDER_QUAD(i3, i2, i1, i0, pv) \ +do { \ + CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \ + CLIP_TRIANGLE(elt[i2], elt[i1], elt[i0]); \ } while (0) #define TAG(x) r128_##x##_clip_elt #include "render_tmp.h" + /* Pack rgba and/or texture into the remaining half of a 32 byte vertex. */ -#define CLIP_UBYTE_COLOR 4 -#define CLIP_UBYTE_B 0 -#define CLIP_UBYTE_G 1 -#define CLIP_UBYTE_R 2 -#define CLIP_UBYTE_A 3 -#define CLIP_S0 6 -#define CLIP_T0 7 -#define CLIP_S1 8 -#define CLIP_T1 9 +#define CLIP_UBYTE_COLOR 4 +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_R 2 +#define CLIP_UBYTE_A 3 +#define CLIP_S0 6 +#define CLIP_T0 7 +#define CLIP_S1 8 +#define CLIP_T1 9 #define TYPE (0) #define TAG(x) x @@ -404,135 +407,136 @@ do { \ /* Render elements directly from original list of vertices. */ -static void r128RenderElementsDirect(struct vertex_buffer *VB) +static void r128_render_elements_direct( struct vertex_buffer *VB ) { - GLcontext *ctx = VB->ctx; - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - GLenum prim = ctx->CVA.elt_mode; - GLuint nr = VB->EltPtr->count; - render_func func = r128_render_tab_smooth_indirect[prim]; - GLuint p = 0; - - if (r128ctx->dirty) r128UpdateHWState(r128ctx); - - do { - func(VB, 0, nr, 0); - } while (ctx->Driver.MultipassFunc && - ctx->Driver.MultipassFunc(VB, ++p)); + GLcontext *ctx = VB->ctx; + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = r128_render_tab_smooth_indirect[prim]; + GLuint p = 0; + + if ( r128ctx->new_state ) + r128DDUpdateHWState( ctx ); + + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); } /* Project vertices from clip to device space */ -static void r128ProjectVertices(struct vertex_buffer *VB) +static void r128_project_vertices( struct vertex_buffer *VB ) { - GLcontext *ctx = VB->ctx; - GLmatrix *mat = &ctx->Viewport.WindowMap; - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128VertexBufferPtr r128VB = R128_DRIVER_DATA(VB); - GLfloat m[16]; - - m[MAT_SX] = mat->m[MAT_SX]; - m[MAT_TX] = mat->m[MAT_TX]; - m[MAT_SY] = -mat->m[MAT_SY]; - m[MAT_TY] = -mat->m[MAT_TY] + r128ctx->driDrawable->h; - m[MAT_SZ] = mat->m[MAT_SZ] * r128ctx->depth_scale; - m[MAT_TZ] = mat->m[MAT_TZ] * r128ctx->depth_scale; - - gl_project_v16(r128VB->verts[VB->CopyStart].f, + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128VertexBufferPtr r128VB = R128_DRIVER_DATA(VB); + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX]; + m[MAT_SY] = -mat->m[MAT_SY]; + m[MAT_TY] = -mat->m[MAT_TY] + r128ctx->driDrawable->h; + m[MAT_SZ] = mat->m[MAT_SZ] * r128ctx->depth_scale; + m[MAT_TZ] = mat->m[MAT_TZ] * r128ctx->depth_scale; + + gl_project_v16( r128VB->verts[VB->CopyStart].f, r128VB->verts[r128VB->last_vert].f, m, - 16 * 4); + 16 * 4 ); } /* Project clipped vertices from clip to device space */ -static void r128ProjectClippedVertices(struct vertex_buffer *VB) +static void r128_project_clipped_vertices( struct vertex_buffer *VB ) { - GLcontext *ctx = VB->ctx; - GLmatrix *mat = &ctx->Viewport.WindowMap; - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128VertexBufferPtr r128VB = R128_DRIVER_DATA(VB); - GLfloat m[16]; - - m[MAT_SX] = mat->m[MAT_SX]; - m[MAT_TX] = mat->m[MAT_TX]; - m[MAT_SY] = -mat->m[MAT_SY]; - m[MAT_TY] = -mat->m[MAT_TY] + r128ctx->driDrawable->h; - m[MAT_SZ] = mat->m[MAT_SZ] * r128ctx->depth_scale; - m[MAT_TZ] = mat->m[MAT_TZ] * r128ctx->depth_scale; - - gl_project_clipped_v16(r128VB->verts[VB->CopyStart].f, + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128VertexBufferPtr r128VB = R128_DRIVER_DATA(VB); + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX]; + m[MAT_SY] = -mat->m[MAT_SY]; + m[MAT_TY] = -mat->m[MAT_TY] + r128ctx->driDrawable->h; + m[MAT_SZ] = mat->m[MAT_SZ] * r128ctx->depth_scale; + m[MAT_TZ] = mat->m[MAT_TZ] * r128ctx->depth_scale; + + gl_project_clipped_v16( r128VB->verts[VB->CopyStart].f, r128VB->verts[r128VB->last_vert].f, m, 16 * 4, - VB->ClipMask + VB->CopyStart); + VB->ClipMask + VB->CopyStart ); } -static r128FastPathTable r128FastTab[0x80]; +static struct r128_fast_tab r128FastTab[0x80]; /* Initialize the table of fast path support functions */ -void r128DDFastPathInit(void) +void r128DDFastPathInit( void ) { r128_render_init_clip_elt(); r128_render_init_smooth_indirect(); - r128_init_fastpath(&r128FastTab[0]); - r128_init_fastpath_RGBA(&r128FastTab[R128_RGBA_BIT]); - r128_init_fastpath_TEX0(&r128FastTab[R128_TEX0_BIT]); - r128_init_fastpath_RGBA_TEX0(&r128FastTab[R128_RGBA_BIT|R128_TEX0_BIT]); - r128_init_fastpath_TEX0_TEX1(&r128FastTab[R128_TEX0_BIT|R128_TEX1_BIT]); - r128_init_fastpath_RGBA_TEX0_TEX1(&r128FastTab[R128_RGBA_BIT|R128_TEX0_BIT| - R128_TEX1_BIT]); + r128_init_fastpath( &r128FastTab[0] ); + r128_init_fastpath_RGBA( &r128FastTab[R128_RGBA_BIT] ); + r128_init_fastpath_TEX0( &r128FastTab[R128_TEX0_BIT] ); + r128_init_fastpath_RGBA_TEX0( &r128FastTab[R128_RGBA_BIT|R128_TEX0_BIT] ); + r128_init_fastpath_TEX0_TEX1( &r128FastTab[R128_TEX0_BIT|R128_TEX1_BIT] ); + r128_init_fastpath_RGBA_TEX0_TEX1( &r128FastTab[R128_RGBA_BIT|R128_TEX0_BIT| + R128_TEX1_BIT] ); } #define VALID_SETUP (R128_RGBA_BIT | R128_TEX0_BIT | R128_TEX1_BIT) -void r128DDFastPath(struct vertex_buffer *VB) +void r128DDFastPath( struct vertex_buffer *VB ) { - GLcontext *ctx = VB->ctx; - GLenum prim = ctx->CVA.elt_mode; - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128FastPathTable *tab = &r128FastTab[r128ctx->SetupIndex & VALID_SETUP]; - GLuint do_cliptest = 1; - - gl_prepare_arrays_cva(VB); /* still need this */ - -#if 0 - if ((gl_reduce_prim[prim] == GL_TRIANGLES) && - (VB->Count < (r128ctx->r128Screen->vbBufSize / 48)) && - (ctx->ModelProjectMatrix.flags & (MAT_FLAG_GENERAL| - MAT_FLAG_PERSPECTIVE))) - { - r128EltPath( VB ); - return; - } -#endif - - /* Reserve enough space for the pathological case */ - if (VB->EltPtr->count * 12 > R128_DRIVER_DATA(VB)->size) { - r128DDResizeVB(VB, VB->EltPtr->count * 12); - do_cliptest = 1; - } - - tab->build_vertices(VB, do_cliptest); /* object->clip space */ - - if (r128ctx->dirty) r128UpdateHWState(r128ctx); - - if (VB->ClipOrMask) { - if (!VB->ClipAndMask) { - render_func *clip = r128_render_tab_clip_elt; - - r128ctx->interp = tab->interp; - clip[prim](VB, 0, VB->EltPtr->count, 0); /* build new elts */ - ctx->CVA.elt_mode = gl_reduce_prim[prim]; - VB->EltPtr = &(R128_DRIVER_DATA(VB)->clipped_elements); - r128ProjectClippedVertices(VB); /* clip->device space */ - r128RenderElementsDirect(VB); /* render using new list */ - } - } else { - r128ProjectVertices(VB); /* clip->device space */ - r128RenderElementsDirect(VB); /* render using orig list */ - } - - /* This indicates that there is no cached data to reuse */ - VB->pipeline->data_valid = 0; - VB->pipeline->new_state = 0; + GLcontext *ctx = VB->ctx; + GLenum prim = ctx->CVA.elt_mode; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + struct r128_fast_tab *tab = &r128FastTab[r128ctx->SetupIndex & VALID_SETUP]; + GLuint do_cliptest = 1; + + gl_prepare_arrays_cva( VB ); /* still need this */ + + if ( ( gl_reduce_prim[prim] == GL_TRIANGLES ) && + ( VB->Count < (R128_BUFFER_SIZE / (10 * sizeof(GLuint))) ) && + ( ctx->ModelProjectMatrix.flags & (MAT_FLAG_GENERAL| + MAT_FLAG_PERSPECTIVE) ) ) + { + r128DDEltPath( VB ); + return; + } + + /* Reserve enough space for the pathological case */ + if ( VB->EltPtr->count * 12 > R128_DRIVER_DATA(VB)->size ) { + r128DDResizeVB( VB, VB->EltPtr->count * 12 ); + do_cliptest = 1; + } + + tab->build_vertices( VB, do_cliptest ); /* object->clip space */ + + if ( r128ctx->new_state ) + r128DDUpdateHWState( ctx ); + + if ( VB->ClipOrMask ) { + if ( !VB->ClipAndMask ) { + render_func *clip = r128_render_tab_clip_elt; + + r128ctx->interp = tab->interp; + + clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */ + + ctx->CVA.elt_mode = gl_reduce_prim[prim]; + VB->EltPtr = &(R128_DRIVER_DATA(VB)->clipped_elements); + + r128_project_clipped_vertices( VB ); /* clip->device space */ + r128_render_elements_direct( VB ); /* render using new list */ + } + } else { + r128_project_vertices( VB ); /* clip->device space */ + r128_render_elements_direct( VB ); /* render using orig list */ + } + + /* This indicates that there is no cached data to reuse */ + VB->pipeline->data_valid = 0; + VB->pipeline->new_state = 0; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_fasttmp.h b/xc/lib/GL/mesa/src/drv/r128/r128_fasttmp.h index 8f0350e12..8f51fe74c 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_fasttmp.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_fasttmp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_fasttmp.h,v 1.1 2000/06/17 00:03:05 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_fasttmp.h,v 1.2 2000/12/04 19:21:46 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Keith Whitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -181,7 +182,7 @@ static void TAG(r128_interp_vert)(GLfloat t, } -static void TAG(r128_init_fastpath)(r128FastPathTable *tab) +static void TAG(r128_init_fastpath)(struct r128_fast_tab *tab) { tab->build_vertices = TAG(r128_setup_full); tab->interp = TAG(r128_interp_vert); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c new file mode 100644 index 000000000..067beff4e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c @@ -0,0 +1,763 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.1 2000/12/04 19:21:46 dawes Exp $ */ +/************************************************************************** + +Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., + Cedar Park, Texas. +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "r128_context.h" +#include "r128_state.h" +#include "r128_ioctl.h" + +#include "mem.h" + +#define R128_TIMEOUT 2000000 + + +/* ============================================================= + * Hardware vertex buffer handling + */ + +/* Get a new VB from the pool of vertex buffers in AGP space. + */ +drmBufPtr r128GetBufferLocked( r128ContextPtr r128ctx ) +{ + int fd = r128ctx->r128Screen->driScreen->fd; + int index = 0; + int size = 0; + drmDMAReq dma; + drmBufPtr buf = NULL; + int to = 0; + int ret; + + dma.context = r128ctx->hHWContext; + dma.send_count = 0; + dma.send_list = NULL; + dma.send_sizes = NULL; + dma.flags = 0; + dma.request_count = 1; + dma.request_size = R128_BUFFER_SIZE; + dma.request_list = &index; + dma.request_sizes = &size; + dma.granted_count = 0; + + while ( !buf && ( to++ < r128ctx->CCEtimeout ) ) { + ret = drmDMA( fd, &dma ); + + if ( ret == 0 ) { + buf = &r128ctx->r128Screen->buffers->list[index]; + buf->used = 0; +#if ENABLE_PERF_BOXES + /* Bump the performance counter */ + r128ctx->c_vertexBuffers++; +#endif + return buf; + } + } + + if ( !buf ) { + drmR128EngineReset( fd ); + fprintf( stderr, "Error: Could not get new VB... exiting\n" ); + exit( -1 ); + } + + return buf; +} + +void r128FlushVerticesLocked( r128ContextPtr r128ctx ) +{ + XF86DRIClipRectPtr pbox = r128ctx->pClipRects; + int nbox = r128ctx->numClipRects; + drmBufPtr buffer = r128ctx->vert_buf; + int count = r128ctx->num_verts; + int prim = R128_TRIANGLES; + int fd = r128ctx->driScreen->fd; + int i; + + if ( 0 ) + fprintf( stderr, "%s: buf=%d count=%d\n", + __FUNCTION__, buffer ? buffer->idx : -1, count ); + + r128ctx->num_verts = 0; + r128ctx->vert_buf = NULL; + + if ( !buffer ) { + return; + } + + if ( r128ctx->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128EmitHwStateLocked( r128ctx ); + } + + if ( !nbox ) { + count = 0; + } + if ( nbox >= R128_NR_SAREA_CLIPRECTS ) { + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + } + + if ( !count || !(r128ctx->dirty & R128_UPLOAD_CLIPRECTS) ) + { + if ( nbox < 3 ) { + r128ctx->sarea->nbox = 0; + } else { + r128ctx->sarea->nbox = nbox; + } + + drmR128FlushVertexBuffer( fd, prim, buffer->idx, count, 1 ); + } + else + { + for (i = 0 ; i < nbox ; ) { + int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox ); + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + int discard = 0; + + r128ctx->sarea->nbox = nr - i; + for ( ; i < nr ; i++) { + *b++ = pbox[i]; + } + + /* Finished with the buffer? + */ + if ( nr == nbox ) { + discard = 1; + } + + r128ctx->sarea->dirty |= R128_UPLOAD_CLIPRECTS; + drmR128FlushVertexBuffer( fd, prim, buffer->idx, count, discard ); + } + } + + r128ctx->dirty &= ~R128_UPLOAD_CLIPRECTS; +} + + + +/* ================================================================ + * Indexed vertex buffer handling + */ + +void r128GetEltBufLocked( r128ContextPtr r128ctx ) +{ + r128ctx->elt_buf = r128GetBufferLocked( r128ctx ); +} + +void r128FireEltsLocked( r128ContextPtr r128ctx, + GLuint start, GLuint end, + GLuint discard ) +{ + XF86DRIClipRectPtr pbox = r128ctx->pClipRects; + int nbox = r128ctx->numClipRects; + drmBufPtr buffer = r128ctx->elt_buf; + int prim = R128_TRIANGLES; + int fd = r128ctx->driScreen->fd; + int i; + + if ( 0 ) + fprintf( stderr, "%s: start=%d end=%d discard=%d\n", + __FUNCTION__, start, end, discard ); + + if ( !buffer ) { + return; + } + + if ( r128ctx->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128EmitHwStateLocked( r128ctx ); + } + + if ( !nbox ) { + end = start; + } + if ( nbox >= R128_NR_SAREA_CLIPRECTS ) { + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + } + + if ( start == end || !(r128ctx->dirty & R128_UPLOAD_CLIPRECTS) ) + { + if ( nbox < 3 ) { + r128ctx->sarea->nbox = 0; + } else { + r128ctx->sarea->nbox = nbox; + } + + drmR128FlushIndices( fd, prim, buffer->idx, start, end, discard ); + } + else + { + for (i = 0 ; i < nbox ; ) { + int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox ); + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + int d = 0; + + r128ctx->sarea->nbox = nr - i; + for ( ; i < nr ; i++) { + *b++ = pbox[i]; + } + + /* Finished with the buffer? + */ + if ( nr == nbox ) { + d = discard; + } + + r128ctx->sarea->dirty |= R128_UPLOAD_CLIPRECTS; + drmR128FlushIndices( fd, prim, buffer->idx, start, end, discard ); + } + } + + if ( R128_DEBUG & DEBUG_ALWAYS_SYNC ) { + drmR128WaitForIdleCCE( r128ctx->driFd ); + } + + r128ctx->dirty &= ~R128_UPLOAD_CLIPRECTS; +} + +void r128FlushEltsLocked( r128ContextPtr r128ctx ) +{ + if ( r128ctx->first_elt != r128ctx->next_elt ) { + r128FireEltsLocked( r128ctx, + ((GLuint)r128ctx->first_elt - + (GLuint)r128ctx->elt_buf->address), + ((GLuint)r128ctx->next_elt - + (GLuint)r128ctx->elt_buf->address), + 0 ); + + ALIGN_NEXT_ELT( r128ctx ); + r128ctx->first_elt = r128ctx->next_elt; + } +} + +void r128ReleaseBufLocked( r128ContextPtr r128ctx, drmBufPtr buffer ) +{ + int fd = r128ctx->driScreen->fd; + + if ( 0 ) + fprintf( stderr, "%s: buffer=%p\n", + __FUNCTION__, buffer ); + + if ( !buffer ) { + return; + } + drmR128FlushVertexBuffer( fd, R128_TRIANGLES, buffer->idx, 0, 1 ); +} + + +/* Allocate some space in the current vertex buffer. If the current + * buffer is full, flush it and grab another one. + */ +CARD32 *r128AllocVertices( r128ContextPtr r128ctx, int count ) +{ + return r128AllocVerticesInline( r128ctx, count ); +} + + + +/* ================================================================ + * Texture uploads + */ + +void r128FireBlitLocked( r128ContextPtr r128ctx, drmBufPtr buffer, + GLint offset, GLint pitch, GLint format, + GLint x, GLint y, GLint width, GLint height ) +{ + GLint ret; + + ret = drmR128TextureBlit( r128ctx->driFd, buffer->idx, + offset, pitch, format, + x, y, width, height ); + + if ( ret ) { + fprintf( stderr, "drmR128TextureBlit: return = %d\n", ret ); + exit( 1 ); + } +} + + +/* ================================================================ + * SwapBuffers with client-side throttling + */ + +static void delay( void ) { +/* Prevent an optimizing compiler from removing a spin loop */ +} + +#define R128_MAX_OUTSTANDING 2 + +/* Throttle the frame rate -- only allow one pending swap buffers + * request at a time. + * GH: We probably don't want a timeout here, as we can wait as + * long as we want for a frame to complete. If it never does, then + * the card has locked. + */ +static int r128WaitForFrameCompletion( r128ContextPtr r128ctx ) +{ + unsigned char *R128MMIO = r128ctx->r128Screen->mmio; + CARD32 frame; + int i; + int wait = 0; + + while ( 1 ) { + frame = INREG( R128_LAST_FRAME_REG ); + if ( r128ctx->sarea->last_frame - frame <= R128_MAX_OUTSTANDING ) { + break; + } + + /* Spin in place a bit so we aren't hammering the register */ + wait++; + for ( i = 0 ; i < 1024 ; i++ ) { + delay(); + } + } + + return wait; +} + +/* Copy the back color buffer to the front color buffer */ +void r128SwapBuffers( r128ContextPtr r128ctx ) +{ + GLint nbox = r128ctx->numClipRects; + GLint i; + GLint ret; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "\n********************************\n" ); + fprintf( stderr, "\n%s( %p )\n\n", + __FUNCTION__, r128ctx->glCtx ); + fflush( stderr ); + } + + /* Flush any outstanding vertex buffers */ + FLUSH_BATCH( r128ctx ); + + LOCK_HARDWARE( r128ctx ); + + /* Throttle the frame rate -- only allow one pending swap buffers + * request at a time. + */ + if ( !r128WaitForFrameCompletion( r128ctx ) ) { + r128ctx->hardwareWentIdle = 1; + } else { + r128ctx->hardwareWentIdle = 0; + } + + for ( i = 0 ; i < nbox ; ) { + GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , nbox ); + XF86DRIClipRectPtr box = r128ctx->pClipRects; + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + GLint n = 0; + + for ( ; i < nr ; i++ ) { + *b++ = *(XF86DRIClipRectRec *)&box[i]; + n++; + } + r128ctx->sarea->nbox = n; + + ret = drmR128SwapBuffers( r128ctx->driFd ); + + if ( ret ) { + fprintf( stderr, "drmR128SwapBuffers: return = %d\n", ret ); + exit( 1 ); + } + } + + if ( R128_DEBUG & DEBUG_ALWAYS_SYNC ) { + drmR128WaitForIdleCCE( r128ctx->driFd ); + } + + UNLOCK_HARDWARE( r128ctx ); + + r128ctx->new_state |= R128_NEW_CONTEXT; + r128ctx->dirty |= (R128_UPLOAD_CONTEXT | + R128_UPLOAD_MASKS | + R128_UPLOAD_CLIPRECTS); + +#if ENABLE_PERF_BOXES + /* Log the performance counters if necessary */ + r128PerformanceCounters( r128ctx ); +#endif +} + + +/* ================================================================ + * Buffer clear + */ + +static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint cx, GLint cy, GLint cw, GLint ch ) +{ + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; + GLuint flags = 0; + GLint i; + GLint ret; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s:\n", __FUNCTION__ ); + } + + FLUSH_BATCH( r128ctx ); + + /* Update and emit any new state. We need to do this here to catch + * changes to the masks. + * FIXME: Just update the masks? + */ + if ( r128ctx->new_state ) + r128DDUpdateHWState( ctx ); + + if ( mask & DD_FRONT_LEFT_BIT ) { + flags |= DRM_R128_FRONT; + mask &= ~DD_FRONT_LEFT_BIT; + } + + if ( mask & DD_BACK_LEFT_BIT ) { + flags |= DRM_R128_BACK; + mask &= ~DD_BACK_LEFT_BIT; + } + + if ( ( mask & DD_DEPTH_BIT ) && ctx->Depth.Mask ) { + flags |= DRM_R128_DEPTH; + mask &= ~DD_DEPTH_BIT; + } +#if 0 + /* FIXME: Add stencil support */ + if ( mask & DD_STENCIL_BIT ) { + flags |= DRM_R128_DEPTH; + mask &= ~DD_STENCIL_BIT; + } +#endif + + /* Flip top to bottom */ + cx += dPriv->x; + cy = dPriv->y + dPriv->h - cy - ch; + + LOCK_HARDWARE( r128ctx ); + + if ( r128ctx->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128EmitHwStateLocked( r128ctx ); + } + + for ( i = 0 ; i < r128ctx->numClipRects ; ) { + GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , r128ctx->numClipRects ); + XF86DRIClipRectPtr box = r128ctx->pClipRects; + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + GLint n = 0; + + if ( !all ) { + for ( ; i < nr ; i++ ) { + GLint x = box[i].x1; + GLint y = box[i].y1; + GLint w = box[i].x2 - x; + GLint h = box[i].y2 - y; + + if ( x < cx ) w -= cx - x, x = cx; + if ( y < cy ) h -= cy - y, y = cy; + if ( x + w > cx + cw ) w = cx + cw - x; + if ( y + h > cy + ch ) h = cy + ch - y; + if ( w <= 0 ) continue; + if ( h <= 0 ) continue; + + b->x1 = x; + b->y1 = y; + b->x2 = x + w; + b->y2 = y + h; + b++; + n++; + } + } else { + for ( ; i < nr ; i++ ) { + *b++ = *(XF86DRIClipRectRec *)&box[i]; + n++; + } + } + + r128ctx->sarea->nbox = n; + + if ( R128_DEBUG & DEBUG_VERBOSE_IOCTL ) { + fprintf( stderr, + "drmR128Clear: flag 0x%x color %x depth %x nbox %d\n", + flags, + (GLuint)r128ctx->ClearColor, + (GLuint)r128ctx->ClearDepth, + r128ctx->sarea->nbox ); + } + + ret = drmR128Clear( r128ctx->driFd, flags, + cx, cy, cw, ch, + r128ctx->ClearColor, r128ctx->ClearDepth, + 0xffffffff, 0xffffffff ); + + if ( ret ) { + fprintf( stderr, "drmR128Clear: return = %d\n", ret ); + exit( 1 ); + } + } + + UNLOCK_HARDWARE( r128ctx ); + + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + + return mask; +} + + +/* ================================================================ + * Depth spans, pixels + */ + +void r128WriteDepthSpanLocked( r128ContextPtr r128ctx, + GLuint n, GLint x, GLint y, + const GLdepth depth[], + const GLubyte mask[] ) +{ + XF86DRIClipRectPtr pbox = r128ctx->pClipRects; + int nbox = r128ctx->numClipRects; + int fd = r128ctx->driScreen->fd; + int i; + + if ( !nbox || !n ) { + return; + } + if ( nbox >= R128_NR_SAREA_CLIPRECTS ) { + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + } + + if ( !(r128ctx->dirty & R128_UPLOAD_CLIPRECTS) ) + { + if ( nbox < 3 ) { + r128ctx->sarea->nbox = 0; + } else { + r128ctx->sarea->nbox = nbox; + } + + drmR128WriteDepthSpan( fd, n, x, y, depth, mask ); + } + else + { + for (i = 0 ; i < nbox ; ) { + int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox ); + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + + r128ctx->sarea->nbox = nr - i; + for ( ; i < nr ; i++) { + *b++ = pbox[i]; + } + + r128ctx->sarea->dirty |= R128_UPLOAD_CLIPRECTS; + drmR128WriteDepthSpan( fd, n, x, y, depth, mask ); + } + } + + r128ctx->dirty &= ~R128_UPLOAD_CLIPRECTS; +} + +void r128WriteDepthPixelsLocked( r128ContextPtr r128ctx, GLuint n, + const GLint x[], const GLint y[], + const GLdepth depth[], + const GLubyte mask[] ) +{ + XF86DRIClipRectPtr pbox = r128ctx->pClipRects; + int nbox = r128ctx->numClipRects; + int fd = r128ctx->driScreen->fd; + int i; + + if ( !nbox || !n ) { + return; + } + if ( nbox >= R128_NR_SAREA_CLIPRECTS ) { + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + } + + if ( !(r128ctx->dirty & R128_UPLOAD_CLIPRECTS) ) + { + if ( nbox < 3 ) { + r128ctx->sarea->nbox = 0; + } else { + r128ctx->sarea->nbox = nbox; + } + + drmR128WriteDepthPixels( fd, n, x, y, depth, mask ); + } + else + { + for (i = 0 ; i < nbox ; ) { + int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox ); + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + + r128ctx->sarea->nbox = nr - i; + for ( ; i < nr ; i++) { + *b++ = pbox[i]; + } + + r128ctx->sarea->dirty |= R128_UPLOAD_CLIPRECTS; + drmR128WriteDepthPixels( fd, n, x, y, depth, mask ); + } + } + + r128ctx->dirty &= ~R128_UPLOAD_CLIPRECTS; +} + +void r128ReadDepthSpanLocked( r128ContextPtr r128ctx, + GLuint n, GLint x, GLint y ) +{ + XF86DRIClipRectPtr pbox = r128ctx->pClipRects; + int nbox = r128ctx->numClipRects; + int fd = r128ctx->driScreen->fd; + int i; + + if ( !nbox || !n ) { + return; + } + if ( nbox >= R128_NR_SAREA_CLIPRECTS ) { + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + } + + if ( !(r128ctx->dirty & R128_UPLOAD_CLIPRECTS) ) + { + if ( nbox < 3 ) { + r128ctx->sarea->nbox = 0; + } else { + r128ctx->sarea->nbox = nbox; + } + + drmR128ReadDepthSpan( fd, n, x, y ); + } + else + { + for (i = 0 ; i < nbox ; ) { + int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox ); + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + + r128ctx->sarea->nbox = nr - i; + for ( ; i < nr ; i++) { + *b++ = pbox[i]; + } + + r128ctx->sarea->dirty |= R128_UPLOAD_CLIPRECTS; + drmR128ReadDepthSpan( fd, n, x, y ); + } + } + + r128ctx->dirty &= ~R128_UPLOAD_CLIPRECTS; +} + +void r128ReadDepthPixelsLocked( r128ContextPtr r128ctx, GLuint n, + const GLint x[], const GLint y[] ) +{ + XF86DRIClipRectPtr pbox = r128ctx->pClipRects; + int nbox = r128ctx->numClipRects; + int fd = r128ctx->driScreen->fd; + int i; + + if ( !nbox || !n ) { + return; + } + if ( nbox >= R128_NR_SAREA_CLIPRECTS ) { + r128ctx->dirty |= R128_UPLOAD_CLIPRECTS; + } + + if ( !(r128ctx->dirty & R128_UPLOAD_CLIPRECTS) ) + { + if ( nbox < 3 ) { + r128ctx->sarea->nbox = 0; + } else { + r128ctx->sarea->nbox = nbox; + } + + drmR128ReadDepthPixels( fd, n, x, y ); + } + else + { + for (i = 0 ; i < nbox ; ) { + int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox ); + XF86DRIClipRectPtr b = r128ctx->sarea->boxes; + + r128ctx->sarea->nbox = nr - i; + for ( ; i < nr ; i++) { + *b++ = pbox[i]; + } + + r128ctx->sarea->dirty |= R128_UPLOAD_CLIPRECTS; + drmR128ReadDepthPixels( fd, n, x, y ); + } + } + + r128ctx->dirty &= ~R128_UPLOAD_CLIPRECTS; +} + + +/* ================================================================ + * Deprecated function... + */ +void r128SubmitPacketLocked( r128ContextPtr r128ctx, + CARD32 *buf, GLuint count ) +{ + CARD32 *b; + int c = count; + int fd = r128ctx->r128Screen->driScreen->fd; + int to = 0; + int ret; + + do { + b = buf + (count - c); + ret = drmR128SubmitPacket( fd, b, &c, 0 ); + } while ( ( ret == -EBUSY ) && ( to++ < r128ctx->CCEtimeout ) ); + + if ( ret < 0 ) { + drmR128EngineReset( fd ); + fprintf( stderr, "Error: Could not submit packet... exiting\n" ); + exit( -1 ); + } +} + + + +void r128WaitForIdleLocked( r128ContextPtr r128ctx ) +{ + int fd = r128ctx->r128Screen->driScreen->fd; + int to = 0; + int ret; + + do { + ret = drmR128WaitForIdleCCE( fd ); + } while ( ( ret == -EBUSY ) && ( to++ < r128ctx->CCEtimeout ) ); + + if ( ret < 0 ) { + drmR128EngineReset( fd ); + fprintf( stderr, "Error: Rage 128 timed out... exiting\n" ); + exit( -1 ); + } +} + + +void r128DDInitIoctlFuncs( GLcontext *ctx ) +{ + ctx->Driver.Clear = r128DDClear; +} diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h new file mode 100644 index 000000000..43b77659b --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h @@ -0,0 +1,217 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h,v 1.1 2000/12/04 19:21:46 dawes Exp $ */ +/************************************************************************** + +Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., + Cedar Park, Texas. +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __R128_IOCTL_H__ +#define __R128_IOCTL_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "r128_dri.h" +#include "r128_reg.h" +#include "r128_lock.h" + +#include "xf86drm.h" +#include "xf86drmR128.h" + +#define R128_DEFAULT_TOTAL_CCE_TIMEOUT 1000000 /* usecs */ + +#define R128_BUFFER_MAX_DWORDS (R128_BUFFER_SIZE / sizeof(CARD32)) + + +#define FLUSH_BATCH( r128ctx ) \ +do { \ + if ( R128_DEBUG & DEBUG_VERBOSE_IOCTL ) \ + fprintf( stderr, "FLUSH_BATCH in %s\n", __FUNCTION__ ); \ + if ( r128ctx->vert_buf ) { \ + r128FlushVertices( r128ctx ); \ + } else if ( r128ctx->next_elt != r128ctx->first_elt ) { \ + r128FlushElts( r128ctx ); \ + } \ +} while (0) + +#define r128FlushVertices( r128ctx ) \ +do { \ + LOCK_HARDWARE( r128ctx ); \ + r128FlushVerticesLocked( r128ctx ); \ + UNLOCK_HARDWARE( r128ctx ); \ +} while (0) + + +extern drmBufPtr r128GetBufferLocked( r128ContextPtr r128ctx ); +extern void r128FlushVerticesLocked( r128ContextPtr r128ctx ); + + +#define r128FlushElts( r128ctx ) \ +do { \ + LOCK_HARDWARE( r128ctx ); \ + r128FlushEltsLocked( r128ctx ); \ + UNLOCK_HARDWARE( r128ctx ); \ +} while (0) + +extern void r128GetEltBufLocked( r128ContextPtr r128ctx ); +extern void r128FlushEltsLocked( r128ContextPtr r128ctx ); +extern void r128FireEltsLocked( r128ContextPtr r128ctx, + GLuint start, GLuint end, + GLuint discard ); +extern void r128ReleaseBufLocked( r128ContextPtr r128ctx, drmBufPtr buffer ); + + +/* 64-bit align the next element address, and then make room for the + * next indexed prim packet header. + */ +#define ALIGN_NEXT_ELT( r128ctx ) \ +do { \ + r128ctx->next_elt = (GLushort *) \ + (((GLuint)r128ctx->next_elt + 7) & ~0x7); \ + r128ctx->next_elt = (GLushort *) \ + ((GLubyte *)r128ctx->next_elt + R128_INDEX_PRIM_OFFSET); \ +} while (0) + + +/* Make this available as both a regular and an inline function. + */ +extern CARD32 *r128AllocVertices( r128ContextPtr r128ctx, int count ); + +static __inline CARD32 *r128AllocVerticesInline( r128ContextPtr r128ctx, + int count ) +{ + int bytes = count * r128ctx->vertsize * sizeof(CARD32); + CARD32 *head; + + if ( !r128ctx->vert_buf ) { + LOCK_HARDWARE( r128ctx ); + + if ( r128ctx->first_elt != r128ctx->next_elt ) { + r128FlushEltsLocked( r128ctx ); + } + + r128ctx->vert_buf = r128GetBufferLocked( r128ctx ); + + UNLOCK_HARDWARE( r128ctx ); + } else if ( r128ctx->vert_buf->used + bytes > r128ctx->vert_buf->total ) { + LOCK_HARDWARE( r128ctx ); + + r128FlushVerticesLocked( r128ctx ); + r128ctx->vert_buf = r128GetBufferLocked( r128ctx ); + + UNLOCK_HARDWARE( r128ctx ); + } + + head = (CARD32 *)((char *)r128ctx->vert_buf->address + + r128ctx->vert_buf->used); + + r128ctx->num_verts += count; + r128ctx->vert_buf->used += bytes; + return head; +} + + +extern void r128FireBlitLocked( r128ContextPtr r128ctx, drmBufPtr buffer, + GLint offset, GLint pitch, GLint format, + GLint x, GLint y, GLint width, GLint height ); + + +extern void r128WriteDepthSpanLocked( r128ContextPtr r128ctx, + GLuint n, GLint x, GLint y, + const GLdepth depth[], + const GLubyte mask[] ); +extern void r128WriteDepthPixelsLocked( r128ContextPtr r128ctx, GLuint n, + const GLint x[], const GLint y[], + const GLdepth depth[], + const GLubyte mask[] ); +extern void r128ReadDepthSpanLocked( r128ContextPtr r128ctx, + GLuint n, GLint x, GLint y ); +extern void r128ReadDepthPixelsLocked( r128ContextPtr r128ctx, GLuint n, + const GLint x[], const GLint y[] ); + + +extern void r128SwapBuffers( r128ContextPtr r128ctx ); + + +#define r128WaitForIdle( r128ctx ) \ +do { \ + LOCK_HARDWARE( r128ctx ); \ + r128WaitForIdleLocked( r128ctx ); \ + UNLOCK_HARDWARE( r128ctx ); \ +} while (0) + +extern void r128WaitForIdleLocked( r128ContextPtr r128ctx ); + + +extern void r128DDInitIoctlFuncs( GLcontext *ctx ); + + + +/* ================================================================ + * Deprecated functions: + */ + +typedef union { + float f; + int i; +} floatTOint; + +/* Insert an integer value into the CCE ring buffer. */ +#define R128CCE(v) \ +do { \ + r128ctx->CCEbuf[r128ctx->CCEcount] = (v); \ + r128ctx->CCEcount++; \ +} while (0) + +/* Insert an floating point value into the CCE ring buffer. */ +#define R128CCEF(v) \ +do { \ + floatTOint fTi; \ + fTi.f = (v); \ + r128ctx->CCEbuf[r128ctx->CCEcount] = fTi.i; \ + r128ctx->CCEcount++; \ +} while (0) + +/* Insert a type-[0123] packet header into the ring buffer */ +#define R128CCE0(p,r,n) R128CCE((p) | ((n) << 16) | ((r) >> 2)) +#define R128CCE1(p,r1,r2) R128CCE((p) | (((r2) >> 2) << 11) | ((r1) >> 2)) +#define R128CCE2(p) R128CCE((p)) +#define R128CCE3(p,n) R128CCE((p) | ((n) << 16)) + +#define R128CCE_SUBMIT_PACKET() \ +do { \ + r128SubmitPacketLocked( r128ctx, r128ctx->CCEbuf, r128ctx->CCEcount ); \ + r128ctx->CCEcount = 0; \ +} while (0) + +extern void r128SubmitPacketLocked( r128ContextPtr r128ctx, + CARD32 *buf, GLuint count ); + +#endif +#endif /* __R128_IOCTL_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c new file mode 100644 index 000000000..6c9331c74 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c @@ -0,0 +1,93 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.c,v 1.1 2000/12/04 19:21:46 dawes Exp $ */ +/************************************************************************** + +Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., + Cedar Park, Texas. +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "r128_context.h" +#include "r128_lock.h" +#include "r128_tex.h" + +#if DEBUG_LOCKING +char *prevLockFile = NULL; +int prevLockLine = 0; +#endif + + +/* Update the hardware state. This is called if another context has + * grabbed the hardware lock, which includes the X server. This + * function also updates the driver's window state after the X server + * moves, resizes or restacks a window -- the change will be reflected + * in the drawable position and clip rects. Since the X server grabs + * the hardware lock when it changes the window state, this routine will + * automatically be called after such a change. + */ +void r128GetLock( r128ContextPtr r128ctx, GLuint flags ) +{ + __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; + __DRIscreenPrivate *sPriv = r128ctx->driScreen; + R128SAREAPriv *sarea = r128ctx->sarea; + int stamp = dPriv->lastStamp; + int i; + + drmGetLock( r128ctx->driFd, r128ctx->hHWContext, flags ); + + /* The window might have moved, so we might need to get new clip + * rects. + * + * NOTE: This releases and regrabs the hw lock to allow the X server + * to respond to the DRI protocol request for new drawable info. + * Since the hardware state depends on having the latest drawable + * clip rects, all state checking must be done _after_ this call. + */ + XMESA_VALIDATE_DRAWABLE_INFO( r128ctx->display, sPriv, dPriv ); + + if ( stamp != dPriv->lastStamp ) { + r128ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP; + r128ctx->SetupDone = 0; + } + + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_CLIPRECTS; + + r128ctx->numClipRects = dPriv->numClipRects; + r128ctx->pClipRects = dPriv->pClipRects; + + if ( sarea->ctxOwner != r128ctx->hHWContext ) { + sarea->ctxOwner = r128ctx->hHWContext; + r128ctx->dirty = R128_UPLOAD_ALL; + } + + for ( i = 0 ; i < r128ctx->lastTexHeap ; i++ ) { + if ( sarea->texAge[i] != r128ctx->lastTexAge[i] ) { + r128AgeTextures( r128ctx, i ); + } + } +} diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.h b/xc/lib/GL/mesa/src/drv/r128/r128_lock.h index 82d27a91b..57ec768bb 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_lock.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_lock.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.1 2000/06/17 00:03:06 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.2 2000/12/04 19:21:46 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -37,6 +38,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING +extern void r128GetLock( r128ContextPtr r128ctx, GLuint flags ); + + /* Turn DEBUG_LOCKING on to find locking conflicts (see r128_init.h) */ #if DEBUG_LOCKING extern char *prevLockFile; @@ -78,57 +82,28 @@ extern int prevLockLine; * do not do any drawing !!! */ -/* Lock the hardware using the current context */ -#define LOCK_HARDWARE(CC) \ - do { \ - char __ret = 0; \ - __DRIcontextPrivate *cPriv = CC->driContext; \ - __DRIscreenPrivate *sPriv = CC->r128Screen->driScreen; \ - \ - DEBUG_CHECK_LOCK(); \ - DRM_CAS(&sPriv->pSAREA->lock, cPriv->hHWContext, \ - DRM_LOCK_HELD|cPriv->hHWContext, __ret); \ - if (__ret) { \ - /* We lost the context, so we need to request the lock from \ - the kernel and update our state. */ \ - drmGetLock(sPriv->fd, cPriv->hHWContext, 0); \ - XMesaUpdateState(cPriv); \ - } \ - DEBUG_LOCK(); \ - } while (0) - -/* Unlock the hardware using the current context */ -#define UNLOCK_HARDWARE(CC) \ - do { \ - __DRIcontextPrivate *cPriv = CC->driContext; \ - __DRIscreenPrivate *sPriv = CC->r128Screen->driScreen; \ - \ - DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, cPriv->hHWContext); \ - DEBUG_RESET(); \ - } while (0) - -/* - * This pair of macros makes a loop over the drawing operations, so it - * is not self contained and does not have the nice single statement - * semantics of most macros. +/* Lock the hardware and validate our state. */ -#define BEGIN_CLIP_LOOP(CC) \ - do { \ - __DRIdrawablePrivate *_dPriv = CC->driDrawable; \ - XF86DRIClipRectPtr _pc = _dPriv->pClipRects; \ - int _nc, _sc; \ - \ - for (_nc = _dPriv->numClipRects; _nc > 0; _nc -= 3, _pc += 3) { \ - _sc = (_nc <= 3) ? _nc : 3; \ - r128SetClipRects(CC, _pc, _sc) - -/* FIXME: This should be a function call to turn off aux clipping */ -#define END_CLIP_LOOP(CC) \ - R128CCE0(R128_CCE_PACKET0, R128_AUX_SC_CNTL, 0); \ - R128CCE(0x00000000); \ - R128CCE_SUBMIT_PACKET(); \ - } \ - } while (0) +#define LOCK_HARDWARE( r128ctx ) \ + do { \ + char __ret = 0; \ + DEBUG_CHECK_LOCK(); \ + DRM_CAS( r128ctx->driHwLock, r128ctx->hHWContext, \ + (DRM_LOCK_HELD | r128ctx->hHWContext), __ret ); \ + if ( __ret ) \ + r128GetLock( r128ctx, 0 ); \ + DEBUG_LOCK(); \ + } while (0) + +/* Unlock the hardware. + */ +#define UNLOCK_HARDWARE( r128ctx ) \ + do { \ + DRM_UNLOCK( r128ctx->driFd, \ + r128ctx->driHwLock, \ + r128ctx->hHWContext ); \ + DEBUG_RESET(); \ + } while (0) #endif #endif /* _R128_LOCK_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.c b/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.c index 325c1978a..4b17e5636 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_pipeline.c,v 1.2 2000/08/25 13:42:29 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_pipeline.c,v 1.3 2000/12/04 19:21:46 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,11 +28,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" +#include "r128_context.h" #include "r128_vb.h" #include "r128_pipeline.h" @@ -95,6 +96,7 @@ GLboolean r128DDBuildPrecalcPipeline( GLcontext *ctx ) return GL_FALSE; } + /* Still do the normal fixup and copy-to-current, so this isn't so * bad. */ @@ -120,6 +122,7 @@ static void r128DDCheckRasterSetup( GLcontext *ctx, d->type = PIPE_IMMEDIATE; } + /* Register the pipeline with our stages included */ GLuint r128DDRegisterPipelineStages( struct gl_pipeline_stage *out, const struct gl_pipeline_stage *in, diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.h b/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.h index 3afb0947c..84c667240 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_pipeline.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_pipeline.h,v 1.2 2000/08/25 13:42:29 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_pipeline.h,v 1.3 2000/12/04 19:21:46 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -43,4 +44,7 @@ extern GLuint r128DDRegisterPipelineStages( struct gl_pipeline_stage *out, extern void r128DDFastPathInit( void ); extern void r128DDFastPath( struct vertex_buffer *VB ); +extern void r128DDEltPathInit( void ); +extern void r128DDEltPath( struct vertex_buffer *VB ); + #endif /* _R128_PIPELINE_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c index 315891274..139e7fbc3 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.2 2000/08/25 13:42:29 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.3 2000/12/04 19:21:46 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,28 +28,41 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ #include "r128_dri.h" -#include "r128_reg.h" -#include "r128_init.h" #include "r128_context.h" -#include "r128_xmesa.h" -#include "r128_cce.h" +#include "r128_ioctl.h" #include "r128_tris.h" #include "r128_vb.h" #include "r128_pipeline.h" #include <sys/mman.h> +#if 1 +/* Including xf86PciInfo.h introduces a bunch of errors... + */ +#define PCI_CHIP_RAGE128LE 0x4C45 +#define PCI_CHIP_RAGE128LF 0x4C46 +#define PCI_CHIP_RAGE128PF 0x5046 +#define PCI_CHIP_RAGE128PR 0x5052 +#define PCI_CHIP_RAGE128RE 0x5245 +#define PCI_CHIP_RAGE128RF 0x5246 +#define PCI_CHIP_RAGE128RK 0x524B +#define PCI_CHIP_RAGE128RL 0x524C +#endif + + /* Create the device specific screen private data struct */ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) { r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; + int cpp; /* Allocate the private area */ r128Screen = (r128ScreenPtr)Xmalloc(sizeof(*r128Screen)); @@ -93,29 +106,12 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) return NULL; } - r128Screen->vbRgn.handle = r128DRIPriv->vbHandle; - r128Screen->vbRgn.size = r128DRIPriv->vbMapSize; - r128Screen->vbOffset = r128DRIPriv->vbOffset; - if (drmMap(sPriv->fd, - r128Screen->vbRgn.handle, - r128Screen->vbRgn.size, - (drmAddressPtr)&r128Screen->vb)) { - drmUnmap((drmAddress)r128Screen->ringReadPtr, - r128Screen->ringReadRgn.size); - drmUnmap((drmAddress)r128Screen->ring, r128Screen->ringRgn.size); - drmUnmap((drmAddress)r128Screen->mmio, r128Screen->mmioRgn.size); - Xfree(r128Screen); - return NULL; - } - r128Screen->vbOffset = r128DRIPriv->vbOffset; - - r128Screen->indRgn.handle = r128DRIPriv->indHandle; - r128Screen->indRgn.size = r128DRIPriv->indMapSize; + r128Screen->bufRgn.handle = r128DRIPriv->bufHandle; + r128Screen->bufRgn.size = r128DRIPriv->bufMapSize; if (drmMap(sPriv->fd, - r128Screen->indRgn.handle, - r128Screen->indRgn.size, - (drmAddressPtr)&r128Screen->ind)) { - drmUnmap((drmAddress)r128Screen->vb, r128Screen->vbRgn.size); + r128Screen->bufRgn.handle, + r128Screen->bufRgn.size, + (drmAddressPtr)&r128Screen->buf)) { drmUnmap((drmAddress)r128Screen->ringReadPtr, r128Screen->ringReadRgn.size); drmUnmap((drmAddress)r128Screen->ring, r128Screen->ringRgn.size); @@ -123,6 +119,7 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) Xfree(r128Screen); return NULL; } + r128Screen->bufOffset = r128DRIPriv->bufOffset; r128Screen->agpTexRgn.handle = r128DRIPriv->agpTexHandle; r128Screen->agpTexRgn.size = r128DRIPriv->agpTexMapSize; @@ -130,8 +127,7 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) r128Screen->agpTexRgn.handle, r128Screen->agpTexRgn.size, (drmAddressPtr)&r128Screen->agpTex)) { - drmUnmap((drmAddress)r128Screen->ind, r128Screen->indRgn.size); - drmUnmap((drmAddress)r128Screen->vb, r128Screen->vbRgn.size); + drmUnmap((drmAddress)r128Screen->buf, r128Screen->bufRgn.size); drmUnmap((drmAddress)r128Screen->ringReadPtr, r128Screen->ringReadRgn.size); drmUnmap((drmAddress)r128Screen->ring, r128Screen->ringRgn.size); @@ -141,11 +137,10 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) } r128Screen->agpTexOffset = r128DRIPriv->agpTexOffset; - if (!(r128Screen->vbBufs = drmMapBufs(sPriv->fd))) { + if (!(r128Screen->buffers = drmMapBufs(sPriv->fd))) { drmUnmap((drmAddress)r128Screen->agpTex, r128Screen->agpTexRgn.size); - drmUnmap((drmAddress)r128Screen->ind, r128Screen->indRgn.size); - drmUnmap((drmAddress)r128Screen->vb, r128Screen->vbRgn.size); + drmUnmap((drmAddress)r128Screen->buf, r128Screen->bufRgn.size); drmUnmap((drmAddress)r128Screen->ringReadPtr, r128Screen->ringReadRgn.size); drmUnmap((drmAddress)r128Screen->ring, r128Screen->ringRgn.size); @@ -159,37 +154,34 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) * the ring walker method, ie. the vertex buffer data is actually part * of the command stream. */ - r128Screen->vbMapSize = r128DRIPriv->vbMapSize; - r128Screen->vbBufSize = r128DRIPriv->vbBufSize; + r128Screen->bufMapSize = r128DRIPriv->bufMapSize; r128Screen->deviceID = r128DRIPriv->deviceID; - r128Screen->width = r128DRIPriv->width; - r128Screen->height = r128DRIPriv->height; r128Screen->depth = r128DRIPriv->depth; r128Screen->bpp = r128DRIPriv->bpp; r128Screen->pixel_code = (r128Screen->bpp != 16 ? r128Screen->bpp : r128Screen->depth); + cpp = r128Screen->bpp / 8; + r128Screen->fb = sPriv->pFB; r128Screen->fbOffset = sPriv->fbOrigin; r128Screen->fbStride = sPriv->fbStride; r128Screen->fbSize = sPriv->fbSize; - r128Screen->fbX = r128DRIPriv->fbX; - r128Screen->fbY = r128DRIPriv->fbY; - r128Screen->backX = r128DRIPriv->backX; - r128Screen->backY = r128DRIPriv->backY; - r128Screen->depthX = r128DRIPriv->depthX; - r128Screen->depthY = r128DRIPriv->depthY; + r128Screen->frontOffset = r128DRIPriv->frontOffset; + r128Screen->frontPitch = r128DRIPriv->frontPitch; + r128Screen->backOffset = r128DRIPriv->backOffset; + r128Screen->backPitch = r128DRIPriv->backPitch; + r128Screen->depthOffset = r128DRIPriv->depthOffset; + r128Screen->depthPitch = r128DRIPriv->depthPitch; + r128Screen->spanOffset = r128DRIPriv->spanOffset; - r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = (r128DRIPriv->textureY * - r128Screen->fbStride + - r128DRIPriv->textureX * - (r128Screen->bpp/8)); - r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize; - r128Screen->log2TexGran[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran; + r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset; + r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize; + r128Screen->log2TexGran[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran; if (r128Screen->IsPCI) { r128Screen->texOffset[R128_AGP_TEX_HEAP] = 0; @@ -205,15 +197,7 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) r128Screen->NRTexHeaps = R128_NR_TEX_HEAPS; } -#if 1 - /* FIXME: For testing only */ - if (getenv("LIBGL_SHOW_BUFFERS")) { - r128Screen->backX = 0; - r128Screen->backY = r128DRIPriv->height/2; - r128Screen->depthX = r128DRIPriv->width/2; - r128Screen->depthY = r128DRIPriv->height/2; - } -#endif + r128Screen->AGPMode = r128DRIPriv->AGPMode; r128Screen->CCEMode = r128DRIPriv->CCEMode; r128Screen->CCEFifoSize = r128DRIPriv->CCEFifoSize; @@ -230,14 +214,29 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) r128Screen->CCEFifoAddr = R128_PM4_FIFO_DATA_EVEN; - r128Screen->SAREA = (R128SAREAPrivPtr)((char *)sPriv->pSAREA + - sizeof(XF86DRISAREARec)); - r128Screen->driScreen = sPriv; - r128InitVertexBuffers(r128Screen); + switch ( r128DRIPriv->deviceID ) { + case PCI_CHIP_RAGE128RE: + case PCI_CHIP_RAGE128RF: + case PCI_CHIP_RAGE128RK: + case PCI_CHIP_RAGE128RL: + r128Screen->chipset = R128_CARD_TYPE_R128; + break; + case PCI_CHIP_RAGE128PF: + r128Screen->chipset = R128_CARD_TYPE_R128_PRO; + break; + case PCI_CHIP_RAGE128LE: + case PCI_CHIP_RAGE128LF: + r128Screen->chipset = R128_CARD_TYPE_R128_MOBILITY; + break; + default: + r128Screen->chipset = R128_CARD_TYPE_R128; + break; + } r128DDFastPathInit(); + r128DDEltPathInit(); r128DDTriangleFuncsInit(); r128DDSetupInit(); @@ -250,11 +249,10 @@ void r128DestroyScreen(__DRIscreenPrivate *sPriv) r128ScreenPtr r128Screen = (r128ScreenPtr)sPriv->private; if (!r128Screen->IsPCI) { - drmUnmapBufs(r128Screen->vbBufs); + drmUnmapBufs(r128Screen->buffers); drmUnmap((drmAddress)r128Screen->agpTex, r128Screen->agpTexRgn.size); - drmUnmap((drmAddress)r128Screen->ind, r128Screen->indRgn.size); - drmUnmap((drmAddress)r128Screen->vb, r128Screen->vbRgn.size); + drmUnmap((drmAddress)r128Screen->buf, r128Screen->bufRgn.size); drmUnmap((drmAddress)r128Screen->ringReadPtr, r128Screen->ringReadRgn.size); drmUnmap((drmAddress)r128Screen->ring, r128Screen->ringRgn.size); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.h b/xc/lib/GL/mesa/src/drv/r128/r128_screen.h index b8a904043..4fd6b7ac7 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.h,v 1.2 2000/08/25 13:42:30 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.h,v 1.3 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -56,17 +57,12 @@ typedef struct { /* CCE ring read pointer data */ r128RegionRec ringReadRgn; - /* CCE vertex buffer data */ - r128RegionRec vbRgn; - unsigned char *vb; - int vbOffset; - int vbMapSize; - int vbBufSize; - drmBufMapPtr vbBufs; - - /* CCE indirect buffer data */ - r128RegionRec indRgn; - unsigned char *ind; + /* CCE vertex/indirect buffer data */ + r128RegionRec bufRgn; + unsigned char *buf; + int bufOffset; + int bufMapSize; + drmBufMapPtr buffers; /* CCE AGP Texture data */ r128RegionRec agpTexRgn; @@ -79,7 +75,17 @@ typedef struct { int fbStride; int fbSize; + unsigned int frontX, frontY; /* Start of front buffer */ + unsigned int frontOffset, frontPitch; + unsigned int backX, backY; /* Start of shared back buffer */ + unsigned int backOffset, backPitch; + unsigned int depthX, depthY; /* Start of shared depth buffer */ + unsigned int depthOffset, depthPitch; + unsigned int spanOffset; + + int chipset; int IsPCI; /* Current card is a PCI card */ + int AGPMode; int CCEMode; /* CCE mode that server/clients use */ int CCEFifoSize; /* Size of the CCE command FIFO */ @@ -93,19 +99,10 @@ typedef struct { /* DRI screen private data */ int deviceID; /* PCI device ID */ - int width; /* Width in pixels of display */ - int height; /* Height in scanlines of display */ int depth; /* Depth of display (8, 15, 16, 24) */ int bpp; /* Bit depth of disp (8, 16, 24, 32) */ int pixel_code; /* 8, 15, 16, 24, 32 */ - int fbX; /* Start of frame buffer */ - int fbY; - int backX; /* Start of shared back buffer */ - int backY; - int depthX; /* Start of shared depth buffer */ - int depthY; - /* Shared texture data */ int NRTexHeaps; int texOffset[R128_NR_TEX_HEAPS]; @@ -118,8 +115,6 @@ typedef struct { int CCEFifoAddr; /* MMIO offset to write next CCE value (only used when CCE is in PIO mode). */ - R128SAREAPrivPtr SAREA; /* Pointer to SAREA private data */ - __DRIscreenPrivate *driScreen; } r128ScreenRec, *r128ScreenPtr; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.c b/xc/lib/GL/mesa/src/drv/r128/r128_span.c index 8ac51c32c..925b874e4 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_span.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_span.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.2 2000/08/25 13:42:30 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.3 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,111 +28,109 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * Gareth Hughes <gareth@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_lock.h" +#include "r128_ioctl.h" #include "r128_state.h" -#include "r128_reg.h" -#include "r128_cce.h" #include "r128_span.h" -#define DBG 0 - -#define LOCAL_VARS \ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ - r128ScreenPtr r128scrn = r128ctx->r128Screen; \ - __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ - GLuint pitch = r128scrn->fbStride; \ - GLuint height = dPriv->h; \ - char *buf = (char *)(r128scrn->fb + \ - (r128ctx->drawX + dPriv->x) * (r128scrn->bpp/8) + \ - (r128ctx->drawY + dPriv->y) * pitch); \ - char *read_buf = (char *)(r128scrn->fb + \ - (r128ctx->readX + dPriv->x) * (r128scrn->bpp/8)+\ - (r128ctx->readY + dPriv->y) * pitch); \ - GLushort p; \ - (void) read_buf; (void) buf; (void) p - -#define LOCAL_DEPTH_VARS \ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ - r128ScreenPtr r128scrn = r128ctx->r128Screen; \ - __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ - GLuint pitch = r128scrn->fbStride; \ - GLuint height = dPriv->h; \ - char *buf = (char *)(r128scrn->fb + \ - (r128scrn->depthX + dPriv->x) * (r128scrn->bpp/8) + \ - (r128scrn->depthY + dPriv->y) * pitch); \ - (void) buf - -#define INIT_MONO_PIXEL(p) \ - p = R128_CONTEXT(ctx)->Color - -#define CLIPPIXEL(_x, _y) \ - ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy)) - - -#define CLIPSPAN(_x, _y, _n, _x1, _n1, _i) \ - if (( _y < miny) || (_y >= maxy)) { \ - _n1 = 0, _x1 = x; \ - } else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ - } - -#define Y_FLIP(_y) (height - _y - 1) - - -#define HW_LOCK() \ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ - FLUSH_BATCH(r128ctx); \ - LOCK_HARDWARE(r128ctx); \ - r128WaitForIdleLocked(r128ctx); - -#define HW_CLIPLOOP() \ - do { \ - __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ - int _nc = dPriv->numClipRects; \ - \ - while (_nc--) { \ - int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ - int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ - int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ - int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; - -#define HW_ENDCLIPLOOP() \ - } \ - } while (0) - -#define HW_UNLOCK() \ - UNLOCK_HARDWARE(r128ctx) +#include "pb.h" +#define DBG 0 - -/* 16 bit, RGB565 color spanline and pixel functions */ -#define WRITE_RGBA(_x, _y, r, g, b, a) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \ - (((int)g & 0xfc) << 3) | \ - (((int)b & 0xf8) >> 3) ) - -#define WRITE_PIXEL(_x, _y, p) \ +#define HAVE_HW_DEPTH_SPANS 1 +#define HAVE_HW_DEPTH_PIXELS 1 + +#define LOCAL_VARS \ + r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ + GLuint pitch = r128scrn->fbStride; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(r128scrn->fb + \ + r128ctx->drawOffset + \ + (dPriv->x * r128scrn->bpp/8) + \ + (dPriv->y * pitch)); \ + char *read_buf = (char *)(r128scrn->fb + \ + r128ctx->readOffset + \ + (dPriv->x * r128scrn->bpp/8) + \ + (dPriv->y * pitch)); \ + GLushort p; \ + (void) read_buf; (void) buf; (void) p + +#define LOCAL_DEPTH_VARS \ + r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ + __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ + GLuint height = dPriv->h; \ + (void) height + +#define INIT_MONO_PIXEL( p ) \ + p = r128ctx->Color + +#define CLIPPIXEL( _x, _y ) \ + ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy)) + + +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if (( _y < miny) || (_y >= maxy)) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ + if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ + } + +#define Y_FLIP( _y ) (height - _y - 1) + + +#define HW_LOCK() \ + r128ContextPtr r128ctx = R128_CONTEXT(ctx); \ + FLUSH_BATCH( r128ctx ); \ + LOCK_HARDWARE( r128ctx ); \ + r128WaitForIdleLocked( r128ctx ); + +#define HW_CLIPLOOP() \ + do { \ + __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ + int _nc = dPriv->numClipRects; \ + \ + while ( _nc-- ) { \ + int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; + +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) + +#define HW_UNLOCK() \ + UNLOCK_HARDWARE( r128ctx ) \ + + + +/* 16 bit, RGB565 color spanline and pixel functions */ \ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA(rgba, _x, _y) \ - do { \ - GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 8) & 0xf8; \ - rgba[1] = (p >> 3) & 0xfc; \ - rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = 0xff; \ +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ + rgba[0] = (p >> 8) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 0xff; \ } while (0) #define TAG(x) r128##x##_RGB565 @@ -141,22 +139,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 15 bit, ARGB1555 color spanline and pixel functions */ -#define WRITE_RGBA(_x, _y, r, g, b, a) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \ - ((g & 0xf8) << 2) | \ - ((b & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \ + ((g & 0xf8) << 2) | \ + ((b & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) -#define WRITE_PIXEL(_x, _y, p) \ +#define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA(rgba, _x, _y) \ - do { \ - GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 7) & 0xf8; \ - rgba[1] = (p >> 2) & 0xf8; \ - rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = (p & 0x8000) ? 0xff : 0; \ +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ + rgba[0] = (p >> 7) & 0xf8; \ + rgba[1] = (p >> 2) & 0xf8; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = (p & 0x8000) ? 0xff : 0; \ } while (0) #define TAG(x) r128##x##_ARGB1555 @@ -164,166 +162,339 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. -/* 16 bit depthbuffer functions */ -#define WRITE_DEPTH(_x, _y, d) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = d; - -#define READ_DEPTH(d, _x, _y) \ - d = *(GLushort *)(buf + _x*2 + _y*pitch) - -#define TAG(x) r128##x##_16 -#include "depthtmp.h" - - - /* 24 bit, RGB888 color spanline and pixel functions */ -#define WRITE_RGBA(_x, _y, r, g, b, a) \ - *(GLuint *)(buf + _x*3 + _y*pitch) = ((r << 16) | \ - (g << 8) | \ - (b << 0)) - -#define WRITE_PIXEL(_x, _y, p) \ - *(GLuint *)(buf + _x*3 + _y*pitch) = p - -#define READ_RGBA(rgba, _x, _y) \ - do { \ - GLuint p = *(GLuint *)(read_buf + _x*3 + _y*pitch); \ - rgba[0] = (p >> 16) & 0xff; \ - rgba[1] = (p >> 8) & 0xff; \ - rgba[2] = (p >> 0) & 0xff; \ - rgba[3] = 0xff; \ - } while (0) +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(read_buf + _x*3 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ +} while (0) #define TAG(x) r128##x##_RGB888 #include "spantmp.h" -/* 24 bit depthbuffer functions */ -#define WRITE_DEPTH(_x, _y, d) \ - *(GLuint *)(buf + _x*3 + _y*pitch) = d +/* 32 bit, ARGB8888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16) | \ + (a << 24) ) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ +} while (0) -#define READ_DEPTH(d, _x, _y) \ - d = *(GLuint *)(buf + _x*3 + _y*pitch) +#define TAG(x) r128##x##_ARGB8888 +#include "spantmp.h" -#define TAG(x) r128##x##_24 -#include "depthtmp.h" +/* 16-bit depth buffer functions */ + +#define WRITE_DEPTH_SPAN() \ + r128WriteDepthSpanLocked( r128ctx, n, x, y, depth, mask ); + +#define WRITE_DEPTH_PIXELS() \ +do { \ + GLint fy[PB_SIZE]; \ + for ( i = 0 ; i < n ; i++ ) { \ + fy[i] = Y_FLIP( y[i] ); \ + } \ + r128WriteDepthPixelsLocked( r128ctx, n, x, fy, depth, mask ); \ +} while (0) + +#define READ_DEPTH_SPAN() \ +do { \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + GLushort *buf = (GLushort *)((GLubyte *)r128scrn->fb + \ + r128scrn->spanOffset); \ + GLint i; \ + \ + r128ReadDepthSpanLocked( r128ctx, n, x, y ); \ + r128WaitForIdleLocked( r128ctx ); \ + \ + for ( i = 0 ; i < n ; i++ ) { \ + depth[i] = buf[i]; \ + } \ +} while (0) + +#define READ_DEPTH_PIXELS() \ +do { \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + GLushort *buf = (GLushort *)((GLubyte *)r128scrn->fb + \ + r128scrn->spanOffset); \ + GLint i, remaining = n; \ + \ + while ( remaining > 0 ) { \ + GLint fy[PB_SIZE]; \ + GLint count; \ + \ + if ( remaining <= 128 ) { \ + count = remaining; \ + } else { \ + count = 128; \ + } \ + for ( i = 0 ; i < count ; i++ ) { \ + fy[i] = Y_FLIP( y[i] ); \ + } \ + \ + r128ReadDepthPixelsLocked( r128ctx, count, x, fy ); \ + r128WaitForIdleLocked( r128ctx ); \ + \ + for ( i = 0 ; i < count ; i++ ) { \ + depth[i] = buf[i]; \ + } \ + depth += count; \ + x += count; \ + y += count; \ + remaining -= count; \ + } \ +} while (0) -/* 32 bit, ARGB8888 color spanline and pixel functions */ -#define WRITE_RGBA(_x, _y, r, g, b, a) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = ((r << 16) | \ - (g << 8) | \ - (b << 0) | \ - (a << 24) ) - -#define WRITE_PIXEL(_x, _y, p) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = p - -#define READ_RGBA(rgba, _x, _y) \ - do { \ - GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \ - rgba[0] = (p >> 16) & 0xff; \ - rgba[1] = (p >> 8) & 0xff; \ - rgba[2] = (p >> 0) & 0xff; \ - rgba[3] = (p >> 24) & 0xff; \ - } while (0) +#define TAG(x) r128##x##_16 +#include "depthtmp.h" -#define TAG(x) r128##x##_ARGB8888 -#include "spantmp.h" +/* 24-bit depth, 8-bit stencil buffer functions */ + +#define WRITE_DEPTH_SPAN() \ + r128WriteDepthSpanLocked( r128ctx, n, x, y, depth, mask ); + +#define WRITE_DEPTH_PIXELS() \ +do { \ + GLint fy[PB_SIZE]; \ + for ( i = 0 ; i < n ; i++ ) { \ + fy[i] = Y_FLIP( y[i] ); \ + } \ + r128WriteDepthPixelsLocked( r128ctx, n, x, fy, depth, mask ); \ +} while (0) + +#define READ_DEPTH_SPAN() \ +do { \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + GLuint *buf = (GLuint *)((GLubyte *)r128scrn->fb + \ + r128scrn->spanOffset); \ + GLint i; \ + \ + r128ReadDepthSpanLocked( r128ctx, n, x, y ); \ + r128WaitForIdleLocked( r128ctx ); \ + \ + for ( i = 0 ; i < n ; i++ ) { \ + depth[i] = buf[i] & 0x00ffffff; \ + } \ +} while (0) + + +#define READ_DEPTH_PIXELS() \ +do { \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + GLuint *buf = (GLuint *)((GLubyte *)r128scrn->fb + \ + r128scrn->spanOffset); \ + GLint i, remaining = n; \ + \ + while ( remaining > 0 ) { \ + GLint fy[PB_SIZE]; \ + GLint count; \ + \ + if ( remaining <= 128 ) { \ + count = remaining; \ + } else { \ + count = 128; \ + } \ + for ( i = 0 ; i < count ; i++ ) { \ + fy[i] = Y_FLIP( y[i] ); \ + } \ + \ + r128ReadDepthPixelsLocked( r128ctx, count, x, fy ); \ + r128WaitForIdleLocked( r128ctx ); \ + \ + for ( i = 0 ; i < count ; i++ ) { \ + depth[i] = buf[i] & 0x00ffffff; \ + } \ + depth += count; \ + x += count; \ + y += count; \ + remaining -= count; \ + } \ +} while (0) + +#define TAG(x) r128##x##_24_8 +#include "depthtmp.h" + -/* 32 bit depthbuffer functions */ -#define WRITE_DEPTH(_x, _y, d) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = d -#define READ_DEPTH(d, _x, _y) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch) +/* 32-bit depth buffer functions */ + +#define WRITE_DEPTH_SPAN() \ + r128WriteDepthSpanLocked( r128ctx, n, x, y, depth, mask ); + +#define WRITE_DEPTH_PIXELS() \ +do { \ + GLint fy[PB_SIZE]; \ + for ( i = 0 ; i < n ; i++ ) { \ + fy[i] = Y_FLIP( y[i] ); \ + } \ + r128WriteDepthPixelsLocked( r128ctx, n, x, fy, depth, mask ); \ +} while (0) + +#define READ_DEPTH_SPAN() \ +do { \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + GLuint *buf = (GLuint *)((GLubyte *)r128scrn->fb + \ + r128scrn->spanOffset); \ + GLint i; \ + \ + r128ReadDepthSpanLocked( r128ctx, n, x, y ); \ + r128WaitForIdleLocked( r128ctx ); \ + \ + for ( i = 0 ; i < n ; i++ ) { \ + depth[i] = buf[i]; \ + } \ +} while (0) + +#define READ_DEPTH_PIXELS() \ +do { \ + r128ScreenPtr r128scrn = r128ctx->r128Screen; \ + GLuint *buf = (GLuint *)((GLubyte *)r128scrn->fb + \ + r128scrn->spanOffset); \ + GLint i, remaining = n; \ + \ + while ( remaining > 0 ) { \ + GLint fy[PB_SIZE]; \ + GLint count; \ + \ + if ( remaining <= 128 ) { \ + count = remaining; \ + } else { \ + count = 128; \ + } \ + for ( i = 0 ; i < count ; i++ ) { \ + fy[i] = Y_FLIP( y[i] ); \ + } \ + \ + r128ReadDepthPixelsLocked( r128ctx, count, x, fy ); \ + r128WaitForIdleLocked( r128ctx ); \ + \ + for ( i = 0 ; i < count ; i++ ) { \ + depth[i] = buf[i]; \ + } \ + depth += count; \ + x += count; \ + y += count; \ + remaining -= count; \ + } \ +} while (0) #define TAG(x) r128##x##_32 #include "depthtmp.h" -void r128DDInitSpanFuncs(GLcontext *ctx) + +void r128DDInitSpanFuncs( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - - switch (r128ctx->r128Screen->pixel_code) { - case 8: /* Color Index mode not supported */ - break; - - case 15: - ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_ARGB1555; - ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_ARGB1555; - ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_ARGB1555; - ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_ARGB1555; - ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_ARGB1555; - ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_ARGB1555; - ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_ARGB1555; - - ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_16; - ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_16; - ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_16; - ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_16; - break; - - case 16: - ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_RGB565; - ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_RGB565; - ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_RGB565; - ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_RGB565; - ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_RGB565; - ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_RGB565; - ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_RGB565; - - ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_16; - ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_16; - ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_16; - ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_16; - break; - - case 24: - ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_RGB888; - ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_RGB888; - ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_RGB888; - ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_RGB888; - ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_RGB888; - ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_RGB888; - ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_RGB888; - - ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_24; - ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_24; - ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_24; - ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_24; - break; - - case 32: - ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_ARGB8888; - ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_ARGB8888; - ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_ARGB8888; - ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_ARGB8888; - ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_ARGB8888; - ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_ARGB8888; - ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_ARGB8888; - - ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_32; - ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_32; - ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_32; - ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_32; - break; - - default: - break; - } - - ctx->Driver.WriteCI8Span = NULL; - ctx->Driver.WriteCI32Span = NULL; - ctx->Driver.WriteMonoCISpan = NULL; - ctx->Driver.WriteCI32Pixels = NULL; - ctx->Driver.WriteMonoCIPixels = NULL; - ctx->Driver.ReadCI32Span = NULL; - ctx->Driver.ReadCI32Pixels = NULL; + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + + switch ( r128ctx->BufferSize ) { + case 8: /* Color Index mode not supported */ + break; + + case 15: + ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_ARGB1555; + ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_ARGB1555; + ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_ARGB1555; + ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_ARGB1555; + ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_ARGB1555; + ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_ARGB1555; + ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_ARGB1555; + break; + + case 16: + ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_RGB565; + ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_RGB565; + ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_RGB565; + ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_RGB565; + ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_RGB565; + ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_RGB565; + ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_RGB565; + break; + + case 24: + ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_RGB888; + ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_RGB888; + ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_RGB888; + ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_RGB888; + ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_RGB888; + ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_RGB888; + ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_RGB888; + break; + + case 32: + ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_ARGB8888; + ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_ARGB8888; + ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_ARGB8888; + ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_ARGB8888; + ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_ARGB8888; + ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_ARGB8888; + break; + + default: + break; + } + + switch ( r128ctx->DepthSize ) { + case 16: + ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_16; + ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_16; + ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_16; + ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_16; + break; + + case 24: + ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_24_8; + ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_24_8; + ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_24_8; + ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_24_8; + break; + + case 32: + ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_32; + ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_32; + ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_32; + ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_32; + break; + + default: + break; + } + + ctx->Driver.WriteCI8Span = NULL; + ctx->Driver.WriteCI32Span = NULL; + ctx->Driver.WriteMonoCISpan = NULL; + ctx->Driver.WriteCI32Pixels = NULL; + ctx->Driver.WriteMonoCIPixels = NULL; + ctx->Driver.ReadCI32Span = NULL; + ctx->Driver.ReadCI32Pixels = NULL; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.h b/xc/lib/GL/mesa/src/drv/r128/r128_span.h index e1cab0a48..486445d31 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_span.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_span.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.h,v 1.1 2000/06/17 00:03:07 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.h,v 1.2 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,8 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Gareth Hughes <gareth@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.c b/xc/lib/GL/mesa/src/drv/r128/r128_state.c index 06584784a..0aa8fef33 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_state.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_state.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.4 2000/08/25 13:42:30 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.5 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,715 +28,537 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> * */ -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_lock.h" #include "r128_state.h" -#include "r128_reg.h" -#include "r128_cce.h" +#include "r128_ioctl.h" #include "r128_tris.h" #include "r128_vb.h" #include "r128_tex.h" #include "mmath.h" #include "pb.h" +#include "enums.h" -#define INTERESTED (~(NEW_MODELVIEW | \ - NEW_PROJECTION | \ - NEW_TEXTURE_MATRIX | \ - NEW_USER_CLIP | \ - NEW_CLIENT_STATE | \ - NEW_TEXTURE_ENABLE)) -static void r128DDUpdateState(GLcontext *ctx) -{ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) { - fprintf(stderr, "r128DDUpdateState(%p)\n", ctx); - } - - /* Need to do this here to detect texture fallbacks before - * setting triangle functions. - */ - if (r128ctx->dirty & R128_UPDATE_TEXSTATE) - r128UpdateHWState(r128ctx); - - if (ctx->NewState & INTERESTED) { - r128DDChooseRenderState(ctx); - r128DDChooseRasterSetupFunc(ctx); - } - - if (!r128ctx->Fallback) { - ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; - ctx->IndirectTriangles |= r128ctx->IndirectTriangles; - - ctx->Driver.PointsFunc = r128ctx->PointsFunc; - ctx->Driver.LineFunc = r128ctx->LineFunc; - ctx->Driver.TriangleFunc = r128ctx->TriangleFunc; - ctx->Driver.QuadFunc = r128ctx->QuadFunc; - ctx->Driver.RectFunc = NULL; - } -} +/* ============================================================= + * Alpha blending + */ -static void r128DDUpdateHWState(GLcontext *ctx) +static void r128UpdateAlphaMode( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - - /* FIXME: state is being updated too often */ - if (r128ctx->dirty) - r128UpdateHWState(r128ctx); -} - + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + CARD32 a = r128ctx->setup.misc_3d_state_cntl_reg; + CARD32 t = r128ctx->setup.tex_cntl_c; + + if ( ctx->Color.AlphaEnabled ) { + GLubyte ref = ctx->Color.AlphaRef; + + a &= ~(R128_ALPHA_TEST_MASK | R128_REF_ALPHA_MASK); + + switch ( ctx->Color.AlphaFunc ) { + case GL_NEVER: + a |= R128_ALPHA_TEST_NEVER; + ref = 0; + break; + case GL_LESS: + a |= R128_ALPHA_TEST_LESS; + break; + case GL_LEQUAL: + a |= R128_ALPHA_TEST_LESSEQUAL; + break; + case GL_EQUAL: + a |= R128_ALPHA_TEST_EQUAL; + break; + case GL_GEQUAL: + a |= R128_ALPHA_TEST_GREATEREQUAL; + break; + case GL_GREATER: + a |= R128_ALPHA_TEST_GREATER; + break; + case GL_NOTEQUAL: + a |= R128_ALPHA_TEST_NEQUAL; + break; + case GL_ALWAYS: + a |= R128_ALPHA_TEST_ALWAYS; + break; + } -/* This is called when mesa switches between rendering triangle - * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc), - * and lines, points and bitmaps. - * - * As the r128 uses triangles to render lines and points, it is - * necessary to turn off hardware culling when rendering these - * primitives. - */ -static void r128DDReducedPrimitiveChange(GLcontext *ctx, GLenum prim) -{ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 f = r128ctx->regs.pm4_vc_fpu_setup; + a |= ref & R128_REF_ALPHA_MASK; + t |= R128_ALPHA_TEST_ENABLE; + } else { + t &= ~R128_ALPHA_TEST_ENABLE; + } - f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID; + if ( ctx->Color.BlendEnabled ) { + a &= ~(R128_ALPHA_BLEND_SRC_MASK | R128_ALPHA_BLEND_DST_MASK); + + switch ( ctx->Color.BlendSrcRGB ) { + case GL_ZERO: + a |= R128_ALPHA_BLEND_SRC_ZERO; + break; + case GL_ONE: + a |= R128_ALPHA_BLEND_SRC_ONE; + break; + case GL_DST_COLOR: + a |= R128_ALPHA_BLEND_SRC_DESTCOLOR; + break; + case GL_ONE_MINUS_DST_COLOR: + a |= R128_ALPHA_BLEND_SRC_INVDESTCOLOR; + break; + case GL_SRC_ALPHA: + a |= R128_ALPHA_BLEND_SRC_SRCALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + a |= R128_ALPHA_BLEND_SRC_INVSRCALPHA; + break; + case GL_DST_ALPHA: + a |= R128_ALPHA_BLEND_SRC_DESTALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + a |= R128_ALPHA_BLEND_SRC_INVDESTALPHA; + break; + case GL_SRC_ALPHA_SATURATE: + a |= R128_ALPHA_BLEND_SRC_SRCALPHASAT; + break; + } - /* Should really use an intermediate value to hold this rather - * than recalculating all the time. - */ - if (prim == GL_POLYGON && ctx->Polygon.CullFlag) { - switch (ctx->Polygon.CullFaceMode) { - case GL_FRONT: f &= ~R128_FRONTFACE_SOLID; break; - case GL_BACK: f &= ~R128_BACKFACE_SOLID; break; - case GL_FRONT_AND_BACK: f &= ~(R128_BACKFACE_SOLID | - R128_FRONTFACE_SOLID); break; - default: break; + switch ( ctx->Color.BlendDstRGB ) { + case GL_ZERO: + a |= R128_ALPHA_BLEND_DST_ZERO; + break; + case GL_ONE: + a |= R128_ALPHA_BLEND_DST_ONE; + break; + case GL_SRC_COLOR: + a |= R128_ALPHA_BLEND_DST_SRCCOLOR; + break; + case GL_ONE_MINUS_SRC_COLOR: + a |= R128_ALPHA_BLEND_DST_INVSRCCOLOR; + break; + case GL_SRC_ALPHA: + a |= R128_ALPHA_BLEND_DST_SRCALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + a |= R128_ALPHA_BLEND_DST_INVSRCALPHA; + break; + case GL_DST_ALPHA: + a |= R128_ALPHA_BLEND_DST_DESTALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + a |= R128_ALPHA_BLEND_DST_INVDESTALPHA; + break; } - } - if (r128ctx->regs.pm4_vc_fpu_setup != f) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.pm4_vc_fpu_setup = f; + t |= R128_ALPHA_ENABLE; + } else { + t &= ~R128_ALPHA_ENABLE; + } - /* FIXME: Load into hardware now??? */ - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_SETUPSTATE; - } + if ( r128ctx->setup.misc_3d_state_cntl_reg != a ) { + r128ctx->setup.misc_3d_state_cntl_reg = a; + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + } + if ( r128ctx->setup.tex_cntl_c != t ) { + r128ctx->setup.tex_cntl_c = t; + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + } } -static void r128DDClearColor(GLcontext *ctx, - GLubyte r, GLubyte g, GLubyte b, GLubyte a) +static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLclampf ref ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - r128ctx->ClearColor = r128PackColor(r128ctx->r128Screen->depth, - r, g, b, a); + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_ALPHA; } -static void r128DDColor(GLcontext *ctx, - GLubyte r, GLubyte g, GLubyte b, GLubyte a) +static void r128DDBlendEquation( GLcontext *ctx, GLenum mode ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - r128ctx->Color = r128PackColor(r128ctx->r128Screen->depth, r, g, b, a); + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_ALPHA; } -static GLboolean r128DDSetDrawBuffer(GLcontext *ctx, GLenum mode) +static void r128DDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - int x = r128ctx->driDrawable->x; - int y = r128ctx->driDrawable->y; - int found; - - r128ctx->Fallback &= ~R128_FALLBACK_DRAW_BUFFER; - - switch (mode) { - case GL_FRONT_LEFT: - r128ctx->drawX = r128ctx->r128Screen->fbX; - r128ctx->drawY = r128ctx->r128Screen->fbY; - r128ctx->readX = r128ctx->r128Screen->fbX; - r128ctx->readY = r128ctx->r128Screen->fbY; - found = GL_TRUE; - break; - case GL_BACK_LEFT: - r128ctx->drawX = r128ctx->r128Screen->backX; - r128ctx->drawY = r128ctx->r128Screen->backY; - r128ctx->readX = r128ctx->r128Screen->fbX; - r128ctx->readY = r128ctx->r128Screen->fbY; - found = GL_TRUE; - break; - default: - r128ctx->Fallback |= R128_FALLBACK_DRAW_BUFFER; - found = GL_FALSE; - break; - } - - x += r128ctx->drawX; - y += r128ctx->drawY; - - FLUSH_BATCH(r128ctx); - - r128ctx->regs.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) | - (x << R128_WINDOW_X_SHIFT)); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - /* Recalculate the Z buffer offset since we might be drawing to the - back buffer and window_xy_offset affects both color buffer and - depth drawing */ - r128ctx->regs.z_offset_c = ((r128ctx->r128Screen->depthX - - r128ctx->drawX) * - (r128ctx->r128Screen->bpp/8) + - (r128ctx->r128Screen->depthY - - r128ctx->drawY) * - r128ctx->r128Screen->fbStride); - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_WIN_Z_POS; - return found; + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_ALPHA; } -static void r128DDSetReadBuffer(GLcontext *ctx, - GLframebuffer *colorBuffer, - GLenum mode) +static void r128DDBlendFuncSeparate( GLcontext *ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - - r128ctx->Fallback &= ~R128_FALLBACK_READ_BUFFER; - - switch (mode) { - case GL_FRONT_LEFT: - r128ctx->readX = r128ctx->r128Screen->fbX; - r128ctx->readY = r128ctx->r128Screen->fbY; - break; - case GL_BACK_LEFT: - r128ctx->readX = r128ctx->r128Screen->backX; - r128ctx->readY = r128ctx->r128Screen->backY; - break; - default: - r128ctx->Fallback |= R128_FALLBACK_READ_BUFFER; - break; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_ALPHA; } -static GLboolean r128DDColorMask(GLcontext *ctx, - GLboolean r, GLboolean g, - GLboolean b, GLboolean a) -{ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - GLuint mask = r128PackColor(r128ctx->r128Screen->pixel_code, - ctx->Color.ColorMask[RCOMP], - ctx->Color.ColorMask[GCOMP], - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP]); +/* ============================================================= + * Depth testing + */ - if (r128ctx->regs.plane_3d_mask_c != mask) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.plane_3d_mask_c = mask; +static void r128UpdateZMode( GLcontext *ctx ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + CARD32 z = r128ctx->setup.z_sten_cntl_c; + CARD32 t = r128ctx->setup.tex_cntl_c; + + if ( ctx->Depth.Test ) { + z &= ~R128_Z_TEST_MASK; + + switch ( ctx->Depth.Func ) { + case GL_NEVER: + z |= R128_Z_TEST_NEVER; + break; + case GL_ALWAYS: + z |= R128_Z_TEST_ALWAYS; + break; + case GL_LESS: + z |= R128_Z_TEST_LESS; + break; + case GL_LEQUAL: + z |= R128_Z_TEST_LESSEQUAL; + break; + case GL_EQUAL: + z |= R128_Z_TEST_EQUAL; + break; + case GL_GEQUAL: + z |= R128_Z_TEST_GREATEREQUAL; + break; + case GL_GREATER: + z |= R128_Z_TEST_GREATER; + break; + case GL_NOTEQUAL: + z |= R128_Z_TEST_NEQUAL; + break; + } - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_MISC; - } + t |= R128_Z_ENABLE; + } else { + t &= ~R128_Z_ENABLE; + } - return GL_TRUE; -} + if ( ctx->Depth.Mask ) { + t |= R128_Z_WRITE_ENABLE; + } else { + t &= ~R128_Z_WRITE_ENABLE; + } + if ( r128ctx->setup.z_sten_cntl_c != z ) { + r128ctx->setup.z_sten_cntl_c = z; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } + if ( r128ctx->setup.tex_cntl_c != t ) { + r128ctx->setup.tex_cntl_c = t; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } +} -static void r128DDDither(GLcontext *ctx, GLboolean enable) +static void r128DDDepthFunc( GLcontext *ctx, GLenum func ) { + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_DEPTH; } -static void r128DDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref) +static void r128DDDepthMask( GLcontext *ctx, GLboolean flag ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 a = r128ctx->regs.misc_3d_state_cntl_reg; - - a &= ~(R128_ALPHA_TEST_MASK | R128_REF_ALPHA_MASK); - a |= ctx->Color.AlphaRef & R128_REF_ALPHA_MASK; - - switch (func) { - case GL_NEVER: a |= R128_ALPHA_TEST_NEVER; break; - case GL_LESS: a |= R128_ALPHA_TEST_LESS; break; - case GL_LEQUAL: a |= R128_ALPHA_TEST_LESSEQUAL; break; - case GL_EQUAL: a |= R128_ALPHA_TEST_EQUAL; break; - case GL_GEQUAL: a |= R128_ALPHA_TEST_GREATEREQUAL; break; - case GL_GREATER: a |= R128_ALPHA_TEST_GREATER; break; - case GL_NOTEQUAL: a |= R128_ALPHA_TEST_NEQUAL; break; - case GL_ALWAYS: a |= R128_ALPHA_TEST_ALWAYS; - break; - default: - /* ERROR!!! */ - return; - } - - if (r128ctx->regs.misc_3d_state_cntl_reg != a) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.misc_3d_state_cntl_reg = a; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ALPHASTATE; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_DEPTH; } -static void r128DDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) +static void r128DDClearDepth( GLcontext *ctx, GLclampd d ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 b = r128ctx->regs.misc_3d_state_cntl_reg; - - b &= ~(R128_ALPHA_BLEND_SRC_MASK | R128_ALPHA_BLEND_DST_MASK); - - switch (sfactor) { - case GL_ZERO: b |= R128_ALPHA_BLEND_SRC_ZERO; - break; - case GL_ONE: b |= R128_ALPHA_BLEND_SRC_ONE; - break; - case GL_DST_COLOR: b |= R128_ALPHA_BLEND_SRC_DESTCOLOR; - break; - case GL_ONE_MINUS_DST_COLOR: b |= R128_ALPHA_BLEND_SRC_INVDESTCOLOR; - break; - case GL_SRC_ALPHA: b |= R128_ALPHA_BLEND_SRC_SRCALPHA; - break; - case GL_ONE_MINUS_SRC_ALPHA: b |= R128_ALPHA_BLEND_SRC_INVSRCALPHA; - break; - case GL_DST_ALPHA: b |= R128_ALPHA_BLEND_SRC_DESTALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: b |= R128_ALPHA_BLEND_SRC_INVDESTALPHA; - break; - case GL_SRC_ALPHA_SATURATE: b |= R128_ALPHA_BLEND_SRC_SRCALPHASAT; - break; -#if 0 - /* FIXME: These are not supported directly by the Rage 128. - They could be emulated using something like the TexEnv - modes. */ - case GL_CONSTANT_COLOR: b |= 0; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: b |= 0; - break; - case GL_CONSTANT_ALPHA: b |= 0; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: b |= 0; - break; -#endif - default: - /* ERROR!!! */ - return; - } - - switch (dfactor) { - case GL_ZERO: b |= R128_ALPHA_BLEND_DST_ZERO; - break; - case GL_ONE: b |= R128_ALPHA_BLEND_DST_ONE; - break; - case GL_SRC_COLOR: b |= R128_ALPHA_BLEND_DST_SRCCOLOR; - break; - case GL_ONE_MINUS_SRC_COLOR: b |= R128_ALPHA_BLEND_DST_INVSRCCOLOR; - break; - case GL_SRC_ALPHA: b |= R128_ALPHA_BLEND_DST_SRCALPHA; - break; - case GL_ONE_MINUS_SRC_ALPHA: b |= R128_ALPHA_BLEND_DST_INVSRCALPHA; - break; - case GL_DST_ALPHA: b |= R128_ALPHA_BLEND_DST_DESTALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: b |= R128_ALPHA_BLEND_DST_INVDESTALPHA; - break; -#if 0 - /* FIXME: These are not supported directly by the Rage 128. - They could be emulated using something like the TexEnv - modes. */ - case GL_CONSTANT_COLOR: b |= 0; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: b |= 0; - break; - case GL_CONSTANT_ALPHA: b |= 0; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: b |= 0; - break; -#endif - default: - /* ERROR!!! */ - return; - } - - if (r128ctx->regs.misc_3d_state_cntl_reg != b) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.misc_3d_state_cntl_reg = b; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ALPHASTATE; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + switch ( r128ctx->DepthSize ) { + case 16: + r128ctx->ClearDepth = d * 0x0000ffff; + break; + case 24: + r128ctx->ClearDepth = d * 0x00ffffff; + break; + case 32: + r128ctx->ClearDepth = d * 0xffffffff; + break; + } } -static void r128DDBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, - GLenum dfactorRGB, GLenum sfactorA, - GLenum dfactorA) + +/* ============================================================= + * Fog + */ + +static void r128UpdateFogAttrib( GLcontext *ctx ) { - if (sfactorRGB != sfactorA || dfactorRGB != dfactorA) { - /* ERROR!!! */ - return; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + CARD32 t = r128ctx->setup.tex_cntl_c; + GLubyte c[4]; + CARD32 col; + + if ( ctx->FogMode == FOG_FRAGMENT ) { + t |= R128_FOG_ENABLE; + } else { + t &= ~R128_FOG_ENABLE; + } + + FLOAT_RGBA_TO_UBYTE_RGBA( c, ctx->Fog.Color ); + col = r128PackColor( 32, c[0], c[1], c[2], c[3] ); - r128DDBlendFunc(ctx, sfactorRGB, dfactorRGB); + if ( r128ctx->setup.fog_color_c != col ) { + r128ctx->setup.fog_color_c = col; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } + if ( r128ctx->setup.tex_cntl_c != t ) { + r128ctx->setup.tex_cntl_c = t; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } } -static void r128DDClearDepth(GLcontext *ctx, GLclampd d) +static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - - switch (r128ctx->regs.z_sten_cntl_c & R128_Z_PIX_WIDTH_MASK) { - case R128_Z_PIX_WIDTH_16: r128ctx->ClearDepth = d * 0x0000ffff; break; - case R128_Z_PIX_WIDTH_24: r128ctx->ClearDepth = d * 0x00ffffff; break; - case R128_Z_PIX_WIDTH_32: r128ctx->ClearDepth = d * 0xffffffff; break; - default: return; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_FOG; } -static void r128DDCullFace(GLcontext *ctx, GLenum mode) + +/* ============================================================= + * Clipping + */ + +static void r128UpdateClipping( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 f = r128ctx->regs.pm4_vc_fpu_setup; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - if (!ctx->Polygon.CullFlag) return; + if ( r128ctx->driDrawable ) { + __DRIdrawablePrivate *drawable = r128ctx->driDrawable; + int x1 = 0; + int y1 = 0; + int x2 = r128ctx->driDrawable->w - 1; + int y2 = r128ctx->driDrawable->h - 1; + + if ( ctx->Scissor.Enabled ) { + if ( ctx->Scissor.X > x1 ) { + x1 = ctx->Scissor.X; + } + if ( drawable->h - ctx->Scissor.Y - ctx->Scissor.Height > y1 ) { + y1 = drawable->h - ctx->Scissor.Y - ctx->Scissor.Height; + } + if ( ctx->Scissor.X + ctx->Scissor.Width - 1 < x2 ) { + x2 = ctx->Scissor.X + ctx->Scissor.Width - 1; + } + if ( drawable->h - ctx->Scissor.Y - 1 < y2 ) { + y2 = drawable->h - ctx->Scissor.Y - 1; + } + } - f &= ~(R128_BACKFACE_MASK | R128_FRONTFACE_MASK); + x1 += r128ctx->driDrawable->x; + y1 += r128ctx->driDrawable->y; + x2 += r128ctx->driDrawable->x; + y2 += r128ctx->driDrawable->y; + + if ( 0 ) { + fprintf( stderr, "%s: drawable %3d %3d %3d %3d\n", + __FUNCTION__, + r128ctx->driDrawable->x, + r128ctx->driDrawable->y, + r128ctx->driDrawable->w, + r128ctx->driDrawable->h ); + fprintf( stderr, "%s: draw buf %3d %3d %3d %3d\n", + __FUNCTION__, + ctx->DrawBuffer->Xmin, + ctx->DrawBuffer->Ymin, + ctx->DrawBuffer->Xmax, + ctx->DrawBuffer->Ymax ); + fprintf( stderr, "%s: scissor %3d %3d %3d %3d\n", + __FUNCTION__, + ctx->Scissor.X, + ctx->Scissor.Y, + ctx->Scissor.Width, + ctx->Scissor.Height ); + fprintf( stderr, "%s: final %3d %3d %3d %3d\n", + __FUNCTION__, x1, y1, x2, y2 ); + fprintf( stderr, "\n" ); + } - switch (mode) { - case GL_FRONT: f |= R128_BACKFACE_SOLID; break; - case GL_BACK: f |= R128_FRONTFACE_SOLID; break; - case GL_FRONT_AND_BACK: break; - default: return; - } + r128ctx->setup.sc_top_left_c = ((x1 << 0) | + (y1 << 16)); + r128ctx->setup.sc_bottom_right_c = ((x2 << 0) | + (y2 << 16)); - if (r128ctx->regs.pm4_vc_fpu_setup != f) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.pm4_vc_fpu_setup = f; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } +} + +static void r128DDScissor( GLcontext *ctx, + GLint x, GLint y, GLsizei w, GLsizei h ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_SETUPSTATE; - } + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_CLIP; } -static void r128DDFrontFace(GLcontext *ctx, GLenum mode) + +/* ============================================================= + * Culling + */ + +static void r128UpdateCull( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 f = r128ctx->regs.pm4_vc_fpu_setup; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + CARD32 f = r128ctx->setup.pm4_vc_fpu_setup; - f &= ~R128_FRONT_DIR_MASK; + f &= ~R128_FRONT_DIR_MASK; - switch (mode) { - case GL_CW: f |= R128_FRONT_DIR_CW; break; - case GL_CCW: f |= R128_FRONT_DIR_CCW; break; - default: return; - } + switch ( ctx->Polygon.FrontFace ) { + case GL_CW: + f |= R128_FRONT_DIR_CW; + break; + case GL_CCW: + f |= R128_FRONT_DIR_CCW; + break; + } - if (r128ctx->regs.pm4_vc_fpu_setup != f) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.pm4_vc_fpu_setup = f; + f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID; - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_SETUPSTATE; - } + if ( ctx->Polygon.CullFlag && ctx->PB->primitive == GL_POLYGON ) { + switch ( ctx->Polygon.CullFaceMode ) { + case GL_FRONT: + f &= ~R128_FRONTFACE_SOLID; + break; + case GL_BACK: + f &= ~R128_BACKFACE_SOLID; + break; + case GL_FRONT_AND_BACK: + f &= ~(R128_BACKFACE_SOLID | + R128_FRONTFACE_SOLID); + break; + } + } + + if ( r128ctx->setup.pm4_vc_fpu_setup != f ) { + r128ctx->setup.pm4_vc_fpu_setup = f; + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_SETUP; + } } -static void r128DDDepthFunc(GLcontext *ctx, GLenum func) +static void r128DDCullFace( GLcontext *ctx, GLenum mode ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 z = r128ctx->regs.z_sten_cntl_c; - - z &= ~R128_Z_TEST_MASK; - - switch (func) { - case GL_NEVER: z |= R128_Z_TEST_NEVER; break; - case GL_LESS: z |= R128_Z_TEST_LESS; break; - case GL_LEQUAL: z |= R128_Z_TEST_LESSEQUAL; break; - case GL_EQUAL: z |= R128_Z_TEST_EQUAL; break; - case GL_GEQUAL: z |= R128_Z_TEST_GREATEREQUAL; break; - case GL_GREATER: z |= R128_Z_TEST_GREATER; break; - case GL_NOTEQUAL: z |= R128_Z_TEST_NEQUAL; break; - case GL_ALWAYS: z |= R128_Z_TEST_ALWAYS; break; - default: return; - } - - if (r128ctx->regs.z_sten_cntl_c != z) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.z_sten_cntl_c = z; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ZSTENSTATE; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_CULL; } -static void r128DDDepthMask(GLcontext *ctx, GLboolean flag) +static void r128DDFrontFace( GLcontext *ctx, GLenum mode ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 t = r128ctx->regs.tex_cntl_c; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - if (flag) t |= R128_Z_WRITE_ENABLE; - else t &= ~R128_Z_WRITE_ENABLE; + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_CULL; +} - if (r128ctx->regs.tex_cntl_c != t) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.tex_cntl_c = t; - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ENGINESTATE; - } -} +/* ============================================================= + * Masks + */ -static void r128DDLightModelfv(GLcontext *ctx, GLenum pname, - const GLfloat *param) +static void r128UpdateMasks( GLcontext *ctx ) { - if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) - { - r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - CARD32 t = r128ctx->regs.tex_cntl_c; - - if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) - t |= R128_SPEC_LIGHT_ENABLE; - else - t &= ~R128_SPEC_LIGHT_ENABLE; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - if (r128ctx->regs.tex_cntl_c != t) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.tex_cntl_c = t; + GLuint mask = r128PackColor( r128ctx->BufferSize, + ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP] ); - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ENGINESTATE; - } + if ( r128ctx->setup.plane_3d_mask_c != mask ) { + r128ctx->setup.plane_3d_mask_c = mask; + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; } } -static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +static GLboolean r128DDColorMask( GLcontext *ctx, + GLboolean r, GLboolean g, + GLboolean b, GLboolean a ) { - if (ctx->Color.ColorLogicOpEnabled) - { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - FLUSH_BATCH( r128ctx ); - - if (opcode == GL_COPY) - r128ctx->Fallback &= ~R128_FALLBACK_LOGICOP; - else - r128ctx->Fallback |= R128_FALLBACK_LOGICOP; - } + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_MASKS; + + return GL_TRUE; } -static void r128DDEnable(GLcontext *ctx, GLenum cap, GLboolean state) +/* ============================================================= + * Rendering attributes + * + * We really don't want to recalculate all this every time we bind a + * texture. These things shouldn't change all that often, so it makes + * sense to break them out of the core texture state update routines. + */ + +static void r128UpdateRenderAttrib( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - CARD32 t = r128ctx->regs.tex_cntl_c; - CARD32 f = r128ctx->regs.pm4_vc_fpu_setup; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) { - fprintf(stderr, "r128DDEnable( %p, 0x%x = %s )\n", - ctx, cap, state ? "GL_TRUE" : "GL_FALSE"); - } - - switch (cap) { - case GL_ALPHA_TEST: - if (state) t |= R128_ALPHA_TEST_ENABLE; - else t &= ~R128_ALPHA_TEST_ENABLE; - break; - - case GL_AUTO_NORMAL: return; - - case GL_BLEND: - if (state) t |= R128_ALPHA_ENABLE; - else t &= ~R128_ALPHA_ENABLE; - break; - - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - case GL_COLOR_MATERIAL: return; - - case GL_CULL_FACE: - if (ctx->PB->primitive == GL_POLYGON) { - f &= ~(R128_BACKFACE_MASK | R128_FRONTFACE_MASK); - if (state) { - switch (ctx->Polygon.CullFaceMode) { - case GL_FRONT: f |= R128_BACKFACE_SOLID; break; - case GL_BACK: f |= R128_FRONTFACE_SOLID; break; - case GL_FRONT_AND_BACK: break; - default: return; - } - } else { - f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID; - } - } - break; - - case GL_DEPTH_TEST: - if (state) t |= R128_Z_ENABLE; - else t &= ~R128_Z_ENABLE; - break; - - case GL_DITHER: - if (state) t |= R128_DITHER_ENABLE; - else t &= ~R128_DITHER_ENABLE; - break; - - case GL_FOG: - if (state) t |= R128_FOG_ENABLE; - else t &= ~R128_FOG_ENABLE; - break; - - case GL_INDEX_LOGIC_OP: - case GL_COLOR_LOGIC_OP: - FLUSH_BATCH( r128ctx ); - if (state && ctx->Color.LogicOp != GL_COPY) - r128ctx->Fallback |= R128_FALLBACK_LOGICOP; - else - r128ctx->Fallback &= ~R128_FALLBACK_LOGICOP; - break; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + CARD32 t = r128ctx->setup.tex_cntl_c; + CARD32 bias = r128ctx->lod_bias & 0xff;; - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - case GL_LIGHTING: - case GL_LINE_SMOOTH: - case GL_LINE_STIPPLE: - case GL_MAP1_COLOR_4: - case GL_MAP1_INDEX: - case GL_MAP1_NORMAL: - case GL_MAP1_TEXTURE_COORD_1: - case GL_MAP1_TEXTURE_COORD_2: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP1_VERTEX_3: - case GL_MAP1_VERTEX_4: - case GL_MAP2_COLOR_4: - case GL_MAP2_INDEX: - case GL_MAP2_NORMAL: - case GL_MAP2_TEXTURE_COORD_1: - case GL_MAP2_TEXTURE_COORD_2: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_3: - case GL_MAP2_VERTEX_4: - case GL_NORMALIZE: - case GL_POINT_SMOOTH: - case GL_POLYGON_SMOOTH: - case GL_POLYGON_STIPPLE: - case GL_POLYGON_OFFSET_POINT: - case GL_POLYGON_OFFSET_LINE: - case GL_POLYGON_OFFSET_FILL: - case GL_RESCALE_NORMAL_EXT: return; - - case GL_SCISSOR_TEST: - /* FIXME: Hook up the software scissor */ -#if 0 - r128ctx->Scissor = state; -#endif - break; - - case GL_SHARED_TEXTURE_PALETTE_EXT: - case GL_STENCIL_TEST: return; - - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - /* This is handled in r128UpdateTex[01]State() */ - r128ctx->dirty |= R128_UPDATE_TEXSTATE; - break; - - case GL_TEXTURE_GEN_Q: - case GL_TEXTURE_GEN_R: - case GL_TEXTURE_GEN_S: - case GL_TEXTURE_GEN_T: return; - - /* Client state */ - case GL_VERTEX_ARRAY: - case GL_NORMAL_ARRAY: - case GL_COLOR_ARRAY: - case GL_INDEX_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - case GL_EDGE_FLAG_ARRAY: return; - - default: return; - } - - if (r128ctx->regs.tex_cntl_c != t) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.tex_cntl_c = t; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ENGINESTATE; - } - if (r128ctx->regs.pm4_vc_fpu_setup != f) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.pm4_vc_fpu_setup = f; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_SETUPSTATE; - } + t &= ~R128_LOD_BIAS_MASK; + t |= (bias << R128_LOD_BIAS_SHIFT); -} + if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) { + t |= R128_SPEC_LIGHT_ENABLE; + } else { + t &= ~R128_SPEC_LIGHT_ENABLE; + } -static void r128DDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) -{ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - GLubyte c[4]; - CARD32 col; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) { - fprintf(stderr, "r128DDFogfv(%p, 0x%x)\n", ctx, pname); - } - - switch (pname) { - case GL_FOG_MODE: - case GL_FOG_DENSITY: - case GL_FOG_START: - case GL_FOG_END: - break; - - case GL_FOG_COLOR: - FLOAT_RGBA_TO_UBYTE_RGBA(c, ctx->Fog.Color); - col = r128PackColor(32, c[0], c[1], c[2], c[3]); - if (r128ctx->regs.fog_color_c != col) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.fog_color_c = col; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_FOGSTATE; - } - break; - - default: - return; - } + if ( ctx->Color.DitherFlag ) { + t |= R128_DITHER_ENABLE; + } else { + t &= ~R128_DITHER_ENABLE; + } + + if ( r128ctx->setup.tex_cntl_c != t ) { + r128ctx->setup.tex_cntl_c = t; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } } -static void r128DDScissor(GLcontext *ctx, - GLint x, GLint y, GLsizei w, GLsizei h) +static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, + const GLfloat *param ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - r128ctx->ScissorRect.x1 = x; - r128ctx->ScissorRect.y1 = r128ctx->driDrawable->h - (y + h); - r128ctx->ScissorRect.x2 = x + w; - r128ctx->ScissorRect.y2 = r128ctx->driDrawable->h - y; + if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) { + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_RENDER; + } } static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) { r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - CARD32 s = r128ctx->regs.pm4_vc_fpu_setup; + CARD32 s = r128ctx->setup.pm4_vc_fpu_setup; s &= ~R128_FPU_COLOR_MASK; @@ -751,636 +573,700 @@ static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) return; } - if ( r128ctx->regs.pm4_vc_fpu_setup != s ) { + if ( r128ctx->setup.pm4_vc_fpu_setup != s ) { FLUSH_BATCH( r128ctx ); - r128ctx->regs.pm4_vc_fpu_setup = s; + r128ctx->setup.pm4_vc_fpu_setup = s; - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_SETUPSTATE; + r128ctx->new_state |= R128_NEW_CONTEXT; + r128ctx->dirty |= R128_UPLOAD_SETUP; } } -/* Initialize the driver's state functions */ -void r128DDInitStateFuncs(GLcontext *ctx) + +/* ============================================================= + * Window position + */ + +void r128UpdateWindow( GLcontext *ctx ) { - ctx->Driver.UpdateState = r128DDUpdateState; - - ctx->Driver.ClearIndex = NULL; - ctx->Driver.ClearColor = r128DDClearColor; - ctx->Driver.Index = NULL; - ctx->Driver.Color = r128DDColor; - ctx->Driver.SetDrawBuffer = r128DDSetDrawBuffer; - ctx->Driver.SetReadBuffer = r128DDSetReadBuffer; - - ctx->Driver.IndexMask = NULL; - ctx->Driver.ColorMask = r128DDColorMask; - ctx->Driver.LogicOp = NULL; - ctx->Driver.Dither = r128DDDither; - - ctx->Driver.NearFar = NULL; - - ctx->Driver.RenderStart = r128DDUpdateHWState; - ctx->Driver.RenderFinish = NULL; - ctx->Driver.RasterSetup = NULL; - - ctx->Driver.RenderVBClippedTab = NULL; - ctx->Driver.RenderVBCulledTab = NULL; - ctx->Driver.RenderVBRawTab = NULL; - - ctx->Driver.ReducedPrimitiveChange = r128DDReducedPrimitiveChange; - ctx->Driver.MultipassFunc = NULL; - - ctx->Driver.AlphaFunc = r128DDAlphaFunc; - ctx->Driver.BlendEquation = NULL; - ctx->Driver.BlendFunc = r128DDBlendFunc; - ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate; - ctx->Driver.ClearDepth = r128DDClearDepth; - ctx->Driver.CullFace = r128DDCullFace; - ctx->Driver.FrontFace = r128DDFrontFace; - ctx->Driver.DepthFunc = r128DDDepthFunc; - ctx->Driver.DepthMask = r128DDDepthMask; - ctx->Driver.DepthRange = NULL; - ctx->Driver.Enable = r128DDEnable; - ctx->Driver.Fogfv = r128DDFogfv; - ctx->Driver.Hint = NULL; - ctx->Driver.Lightfv = NULL; - ctx->Driver.LogicOpcode = r128DDLogicOpCode; - ctx->Driver.LightModelfv = r128DDLightModelfv; - ctx->Driver.PolygonMode = NULL; - ctx->Driver.Scissor = r128DDScissor; - ctx->Driver.ShadeModel = r128DDShadeModel; - ctx->Driver.ClearStencil = NULL; - ctx->Driver.StencilFunc = NULL; - ctx->Driver.StencilMask = NULL; - ctx->Driver.StencilOp = NULL; - ctx->Driver.Viewport = NULL; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int x = r128ctx->driDrawable->x; + int y = r128ctx->driDrawable->y; + + r128ctx->setup.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) | + (x << R128_WINDOW_X_SHIFT)); + + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_WINDOW; } -/* Initialize the context's hardware state */ -void r128DDInitState(r128ContextPtr r128ctx) + +/* ============================================================= + * Miscellaneous + */ + +static void r128DDClearColor( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { - int dst_bpp, depth_bpp, pitch, i; - CARD32 depthClear; - - pitch = r128ctx->r128Screen->fbStride / r128ctx->r128Screen->bpp; - - switch (r128ctx->r128Screen->pixel_code) { - case 8: dst_bpp = R128_GMC_DST_8BPP_CI; break; - case 15: dst_bpp = R128_GMC_DST_15BPP; break; - case 16: dst_bpp = R128_GMC_DST_16BPP; break; - case 24: dst_bpp = R128_GMC_DST_24BPP; break; - case 32: dst_bpp = R128_GMC_DST_32BPP; break; - default: - fprintf(stderr, "Error: Unsupported pixel depth %d... exiting\n", - r128ctx->r128Screen->pixel_code); - exit(-1); - } - - /* FIXME: Figure out how to use 16bpp depth buffer in 32bpp mode */ - switch (r128ctx->glCtx->Visual->DepthBits) { - case 16: depthClear = 0x0000ffff; depth_bpp = R128_Z_PIX_WIDTH_16; break; - case 24: depthClear = 0x00ffffff; depth_bpp = R128_Z_PIX_WIDTH_24; break; - case 32: depthClear = 0xffffffff; depth_bpp = R128_Z_PIX_WIDTH_32; break; - default: - fprintf(stderr, "Error: Unsupported depth %d... exiting\n", - r128ctx->r128Screen->bpp); - exit(-1); - break; - } - - /* Precalculate the depth scale while we're here */ - switch (r128ctx->glCtx->Visual->DepthBits) { - case 16: r128ctx->depth_scale = 1.0 / 65536.0; break; - case 24: r128ctx->depth_scale = 1.0 / 16777216.0; break; - case 32: r128ctx->depth_scale = 1.0 / 4294967296.0; break; - default: r128ctx->depth_scale = 1.0 / 65536.0; break; - } - - r128ctx->dirty = R128_ALL_DIRTY; - r128ctx->dirty_context = R128_CTX_ALL_DIRTY; - - r128ctx->RenderIndex = R128_FALLBACK_BIT; - r128ctx->PointsFunc = NULL; - r128ctx->LineFunc = NULL; - r128ctx->TriangleFunc = NULL; - r128ctx->QuadFunc = NULL; - - r128ctx->IndirectTriangles = 0; - r128ctx->Fallback = 0; - - if (r128ctx->glCtx->Visual->DBflag) { - r128ctx->drawX = r128ctx->r128Screen->backX; - r128ctx->drawY = r128ctx->r128Screen->backY; - r128ctx->readX = r128ctx->r128Screen->backX; - r128ctx->readY = r128ctx->r128Screen->backY; - } else { - r128ctx->drawX = r128ctx->r128Screen->fbX; - r128ctx->drawY = r128ctx->r128Screen->fbY; - r128ctx->readX = r128ctx->r128Screen->fbX; - r128ctx->readY = r128ctx->r128Screen->fbY; - } - - r128ctx->ClearColor = 0x00000000; - r128ctx->ClearDepth = depthClear; - - r128ctx->regs.scale_3d_cntl = - R128_SCALE_DITHER_TABLE | - R128_TEX_CACHE_SIZE_FULL | - R128_DITHER_INIT_RESET | - R128_SCALE_3D_TEXMAP_SHADE | - R128_SCALE_PIX_REPLICATE | - R128_ALPHA_COMB_ADD_CLAMP | - R128_FOG_VERTEX | - R128_ALPHA_BLEND_SRC_ONE | - R128_ALPHA_BLEND_DST_ZERO | - R128_ALPHA_TEST_ALWAYS | - R128_COMPOSITE_SHADOW_CMP_EQUAL | - R128_TEX_MAP_ALPHA_IN_TEXTURE | - R128_TEX_CACHE_LINE_SIZE_8QW; - - r128ctx->regs.dst_pitch_offset_c = pitch << R128_PITCH_SHIFT; - - r128ctx->regs.dp_gui_master_cntl = - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_DST_CLIPPING | - R128_GMC_BRUSH_SOLID_COLOR | - dst_bpp | - R128_GMC_SRC_DATATYPE_COLOR | - R128_GMC_BYTE_MSB_TO_LSB | - R128_GMC_CONVERSION_TEMP_6500 | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_3D_FCN_EN | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS; - - r128ctx->regs.sc_top_left_c = 0x00000000; - r128ctx->regs.sc_bottom_right_c = 0x1fff1fff; - - r128ctx->regs.aux_sc_cntl = 0x00000000; - - r128ctx->regs.aux1_sc_left = 0x00000000; - r128ctx->regs.aux1_sc_right = 0x00001fff; - r128ctx->regs.aux1_sc_top = 0x00000000; - r128ctx->regs.aux1_sc_bottom = 0x00001fff; - - r128ctx->regs.aux2_sc_left = 0x00000000; - r128ctx->regs.aux2_sc_right = 0x00001fff; - r128ctx->regs.aux2_sc_top = 0x00000000; - r128ctx->regs.aux2_sc_bottom = 0x00001fff; - - r128ctx->regs.aux3_sc_left = 0x00000000; - r128ctx->regs.aux3_sc_right = 0x00001fff; - r128ctx->regs.aux3_sc_top = 0x00000000; - r128ctx->regs.aux3_sc_bottom = 0x00001fff; - - r128ctx->regs.z_offset_c = (r128ctx->r128Screen->depthX * - (r128ctx->r128Screen->bpp/8) + - r128ctx->r128Screen->depthY * - r128ctx->r128Screen->fbStride); - r128ctx->regs.z_pitch_c = pitch; - - r128ctx->regs.z_sten_cntl_c = - depth_bpp | - R128_Z_TEST_LESS | - R128_STENCIL_TEST_ALWAYS | - R128_STENCIL_S_FAIL_KEEP | - R128_STENCIL_ZPASS_KEEP | - R128_STENCIL_ZFAIL_KEEP; - - r128ctx->regs.tex_cntl_c = - R128_Z_WRITE_ENABLE | - R128_SHADE_ENABLE | - R128_DITHER_ENABLE | - R128_ALPHA_IN_TEX_COMPLETE_A | - R128_LIGHT_DIS | - R128_ALPHA_LIGHT_DIS | - R128_TEX_CACHE_FLUSH | - (0x0f << R128_LOD_BIAS_SHIFT); - - r128ctx->regs.misc_3d_state_cntl_reg = - R128_MISC_SCALE_3D_TEXMAP_SHADE | - R128_MISC_SCALE_PIX_REPLICATE | - R128_ALPHA_COMB_ADD_CLAMP | - R128_FOG_VERTEX | - R128_ALPHA_BLEND_SRC_ONE | - R128_ALPHA_BLEND_DST_ZERO | - R128_ALPHA_TEST_ALWAYS; - - r128ctx->regs.texture_clr_cmp_clr_c = 0x00000000; - r128ctx->regs.texture_clr_cmp_msk_c = 0xffffffff; - - r128ctx->regs.prim_tex_cntl_c = - R128_MIN_BLEND_NEAREST | - R128_MAG_BLEND_NEAREST | - R128_MIP_MAP_DISABLE | - R128_TEX_CLAMP_S_WRAP | - R128_TEX_CLAMP_T_WRAP; - - r128ctx->regs.prim_texture_combine_cntl_c = - R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA; - - r128ctx->regs.tex_size_pitch_c = - (0 << R128_TEX_PITCH_SHIFT) | - (0 << R128_TEX_SIZE_SHIFT) | - (0 << R128_TEX_HEIGHT_SHIFT) | - (0 << R128_TEX_MIN_SIZE_SHIFT) | - (0 << R128_SEC_TEX_PITCH_SHIFT) | - (0 << R128_SEC_TEX_SIZE_SHIFT) | - (0 << R128_SEC_TEX_HEIGHT_SHIFT) | - (0 << R128_SEC_TEX_MIN_SIZE_SHIFT); - - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.prim_tex_offset[i] = 0x00000000; - - r128ctx->regs.sec_tex_cntl_c = - R128_SEC_SELECT_PRIM_ST; - - r128ctx->regs.sec_tex_combine_cntl_c = - R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_DIS | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA; - - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.sec_tex_offset[i] = 0x00000000; - - r128ctx->regs.constant_color_c = 0x00ffffff; - r128ctx->regs.prim_texture_border_color_c = 0x00ffffff; - r128ctx->regs.sec_texture_border_color_c = 0x00ffffff; - r128ctx->regs.sten_ref_mask_c = 0xffff0000; - r128ctx->regs.plane_3d_mask_c = 0xffffffff; - - r128ctx->regs.setup_cntl = - R128_COLOR_GOURAUD | - R128_PRIM_TYPE_TRI | - R128_TEXTURE_ST_MULT_W | - R128_STARTING_VERTEX_1 | - R128_ENDING_VERTEX_3 | - R128_SU_POLY_LINE_NOT_LAST | - R128_SUB_PIX_4BITS; - - r128ctx->regs.pm4_vc_fpu_setup = - R128_FRONT_DIR_CCW | - R128_BACKFACE_SOLID | - R128_FRONTFACE_SOLID | - R128_FPU_COLOR_GOURAUD | - R128_FPU_SUB_PIX_4BITS | - R128_FPU_MODE_3D | - R128_TRAP_BITS_DISABLE | - R128_XFACTOR_2 | - R128_YFACTOR_2 | - R128_FLAT_SHADE_VERTEX_OGL | - R128_FPU_ROUND_TRUNCATE | - R128_WM_SEL_8DW; - - r128ctx->regs.fog_color_c = 0x00000000; - - r128ctx->regs.window_xy_offset = 0x00000000; - - r128ctx->regs.dp_write_mask = 0xffffffff; - - r128ctx->regs.pc_gui_ctlstat = R128_PC_FLUSH_GUI; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ALL_DIRTY; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + r128ctx->ClearColor = r128PackColor( r128ctx->r128Screen->depth, + r, g, b, a ); } -#if 0 -/* Upload the fog table for the current fog mode - * - * KW: I beleive that this can be made to work for all fog modes, - * given some constraints on the projection matrix. Please leave - * this code here for now... - */ -static void r128UploadFogTable(r128ContextPtr r128ctx) +static void r128DDColor( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { - int i; - - R128CCE0(R128_CCE_PACKET0, R128_FOG_TABLE_INDEX, 0); - R128CCE(0x00000000); - - R128CCE0(R128_CCE_PACKET0_ONE_REG_WR, R128_FOG_TABLE_DATA, 255); - - - if (0) - fprintf(stderr, "uploading fog table for %s\n", - gl_lookup_enum_by_nr(r128ctx->FogMode)); - - - /* KW: I'm not sure we're doing enough here - shouldn't density - * play a role in calculating the exp and exp2 tables -- is the - * card really doing exponent calculations of its own? Need to - * see the spec... - */ - switch (r128ctx->FogMode) { - case GL_LINEAR: - for (i = 0; i < 256; i++) { - R128CCE(255 - i); - } - break; - case GL_EXP: - for (i = 0; i < 256; i++) { - float arg = (255 - i)/255.0; - float exparg = exp(arg); - int result; - FLOAT_COLOR_TO_UBYTE_COLOR(result, exparg); - R128CCE(result); - } - break; - case GL_EXP2: - for (i = 0; i < 256; i++) { - float arg = (255 - i)/255.0; - float exparg = (exp(arg*arg) - 1) / (M_E - 1); /* range [0,1] */ - int result; - FLOAT_COLOR_TO_UBYTE_COLOR(result, exparg); - R128CCE(result); - } - break; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + r128ctx->Color = r128PackColor( r128ctx->r128Screen->depth, + r, g, b, a ); } -#endif -/* Load the current context's state into the hardware */ -/* NOTE: This function is only called while holding the hardware lock */ -static void r128LoadContext(r128ContextPtr r128ctx) +static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) { - int i; - int tex_size_pitch_done = GL_FALSE; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) { - fprintf(stderr, "r128LoadContext(%p)\n", r128ctx->glCtx); - } - -#if 0 - r128ctx->dirty_context = R128_CTX_ALL_DIRTY; -#endif - -#if 1 - /* FIXME: Why do these need to be updated even when they don't change? */ - r128ctx->dirty_context |= (R128_CTX_MISC | - R128_CTX_ENGINESTATE | - R128_CTX_ALPHASTATE); -#endif - -#if 1 - /* FIXME: Is this _really_ needed? */ - if (r128ctx->dirty_context) - if (!R128CCE_USE_RING_BUFFER(r128ctx->r128Screen->CCEMode)) - r128WaitForIdleLocked(r128ctx); -#endif - - if (r128ctx->dirty_context & R128_CTX_MISC) { - R128CCE1(R128_CCE_PACKET1, R128_SCALE_3D_CNTL, R128_DP_WRITE_MASK); - R128CCE(r128ctx->regs.scale_3d_cntl); - R128CCE(r128ctx->regs.dp_write_mask); - - R128CCE0(R128_CCE_PACKET0, R128_DST_PITCH_OFFSET_C, 1); - R128CCE(r128ctx->regs.dst_pitch_offset_c); - R128CCE(r128ctx->regs.dp_gui_master_cntl); - - R128CCE0(R128_CCE_PACKET0, R128_TEXTURE_CLR_CMP_CLR_C, 1); - R128CCE(r128ctx->regs.texture_clr_cmp_clr_c); - R128CCE(r128ctx->regs.texture_clr_cmp_msk_c); - - R128CCE0(R128_CCE_PACKET0, R128_STEN_REF_MASK_C, 1); - R128CCE(r128ctx->regs.sten_ref_mask_c); - R128CCE(r128ctx->regs.plane_3d_mask_c); - } - - if (r128ctx->dirty_context & R128_CTX_ENGINESTATE) { - R128CCE0(R128_CCE_PACKET0, R128_TEX_CNTL_C, 0); - R128CCE(r128ctx->regs.tex_cntl_c); - } - - if (r128ctx->dirty_context & R128_CTX_TEX0STATE) { - R128CCE0(R128_CCE_PACKET0, R128_PRIM_TEX_CNTL_C, 2+R128_TEX_MAXLEVELS); - R128CCE(r128ctx->regs.prim_tex_cntl_c); - R128CCE(r128ctx->regs.prim_texture_combine_cntl_c); - R128CCE(r128ctx->regs.tex_size_pitch_c); - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - R128CCE(r128ctx->regs.prim_tex_offset[i]); - - R128CCE0(R128_CCE_PACKET0, R128_PRIM_TEXTURE_BORDER_COLOR_C, 0); - R128CCE(r128ctx->regs.prim_texture_border_color_c); - - tex_size_pitch_done = GL_TRUE; - } - - if (r128ctx->dirty_context & R128_CTX_TEX1STATE) { - if (!tex_size_pitch_done) { - R128CCE0(R128_CCE_PACKET0, R128_TEX_SIZE_PITCH_C, 0); - R128CCE(r128ctx->regs.tex_size_pitch_c); - } - - R128CCE0(R128_CCE_PACKET0, R128_SEC_TEX_CNTL_C, 1+R128_TEX_MAXLEVELS); - R128CCE(r128ctx->regs.sec_tex_cntl_c); - R128CCE(r128ctx->regs.sec_tex_combine_cntl_c); - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - R128CCE(r128ctx->regs.sec_tex_offset[i]); - - R128CCE0(R128_CCE_PACKET0, R128_SEC_TEXTURE_BORDER_COLOR_C, 0); - R128CCE(r128ctx->regs.sec_texture_border_color_c); - } - - if (r128ctx->dirty_context & R128_CTX_TEXENVSTATE) { - R128CCE0(R128_CCE_PACKET0, R128_CONSTANT_COLOR_C, 0); - R128CCE(r128ctx->regs.constant_color_c); - } - - if (r128ctx->dirty_context & R128_CTX_FOGSTATE) { - R128CCE1(R128_CCE_PACKET0, R128_FOG_COLOR_C, 0); - R128CCE(r128ctx->regs.fog_color_c); - } - - if (r128ctx->dirty_context & R128_CTX_ZSTENSTATE) { - R128CCE0(R128_CCE_PACKET0, R128_Z_STEN_CNTL_C, 0); - R128CCE(r128ctx->regs.z_sten_cntl_c); - } - - if (r128ctx->dirty_context & R128_CTX_SCISSORS) { - R128CCE0(R128_CCE_PACKET0, R128_SC_TOP_LEFT_C, 1); - R128CCE(r128ctx->regs.sc_top_left_c); - R128CCE(r128ctx->regs.sc_bottom_right_c); - } - - if (r128ctx->dirty_context & (R128_CTX_ALPHASTATE | - R128_CTX_FOGSTATE)) { - R128CCE0(R128_CCE_PACKET0, R128_MISC_3D_STATE_CNTL_REG, 0); - R128CCE(r128ctx->regs.misc_3d_state_cntl_reg); - } - - if (r128ctx->dirty_context & R128_CTX_SETUPSTATE) { - R128CCE1(R128_CCE_PACKET1, R128_SETUP_CNTL, R128_PM4_VC_FPU_SETUP); - R128CCE(r128ctx->regs.setup_cntl); - R128CCE(r128ctx->regs.pm4_vc_fpu_setup); - } - - if (r128ctx->dirty_context & R128_CTX_WIN_Z_POS) { - R128CCE0(R128_CCE_PACKET0, R128_WINDOW_XY_OFFSET, 0); - R128CCE(r128ctx->regs.window_xy_offset); - - R128CCE0(R128_CCE_PACKET0, R128_Z_OFFSET_C, 1); - R128CCE(r128ctx->regs.z_offset_c); - R128CCE(r128ctx->regs.z_pitch_c); - } - -#if 0 - if (r128ctx->dirty_context & R128_CTX_FLUSH_PIX_CACHE) { - R128CCE0(R128_CCE_PACKET0, R128_PC_GUI_CTLSTAT, 0); - R128CCE(r128ctx->regs.pc_gui_ctlstat); - } -#endif - - R128CCE_SUBMIT_PACKET(); - - /* Turn off the texture cache flushing */ - r128ctx->regs.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; - - /* Turn off the pixel cache flushing */ - r128ctx->regs.pc_gui_ctlstat &= ~R128_PC_FLUSH_ALL; - - r128ctx->dirty_context = R128_CTX_CLEAN; + if ( ctx->Color.ColorLogicOpEnabled ) { + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + FLUSH_BATCH( r128ctx ); + + if ( opcode == GL_COPY ) { + r128ctx->Fallback &= ~R128_FALLBACK_LOGICOP; + } else { + r128ctx->Fallback |= R128_FALLBACK_LOGICOP; + } + } } -/* Set the hardware clip rects for drawing to the current color buffer */ -/* NOTE: This function is only called while holding the hardware lock */ -void r128SetClipRects(r128ContextPtr r128ctx, - XF86DRIClipRectPtr pc, int nc) +static GLboolean r128DDSetDrawBuffer( GLcontext *ctx, GLenum mode ) { - if (!pc) return; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int found = GL_TRUE; + + FLUSH_BATCH( r128ctx ); + + if ( r128ctx->DrawBuffer != mode ) { + r128ctx->DrawBuffer = mode; + r128ctx->Fallback &= ~R128_FALLBACK_DRAW_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + r128ctx->drawX = r128ctx->r128Screen->frontX; + r128ctx->drawY = r128ctx->r128Screen->frontY; + r128ctx->drawOffset = r128ctx->r128Screen->frontOffset; + r128ctx->drawPitch = r128ctx->r128Screen->frontPitch; + r128ctx->readX = r128ctx->r128Screen->frontX; + r128ctx->readY = r128ctx->r128Screen->frontY; + break; + case GL_BACK_LEFT: + r128ctx->drawX = r128ctx->r128Screen->backX; + r128ctx->drawY = r128ctx->r128Screen->backY; + r128ctx->drawOffset = r128ctx->r128Screen->backOffset; + r128ctx->drawPitch = r128ctx->r128Screen->backPitch; + r128ctx->readX = r128ctx->r128Screen->backX; + r128ctx->readY = r128ctx->r128Screen->backY; + break; + default: + r128ctx->Fallback |= R128_FALLBACK_DRAW_BUFFER; + found = GL_FALSE; + break; + } - /* Clear any previous auxiliary scissors */ - r128ctx->regs.aux_sc_cntl = 0x00000000; + r128ctx->setup.dst_pitch_offset_c = (((r128ctx->drawPitch/8) << 21) | + (r128ctx->drawOffset >> 5)); + r128ctx->new_state |= R128_NEW_WINDOW; + } - switch (nc) { - case 3: - R128CCE0(R128_CCE_PACKET0, R128_AUX3_SC_LEFT, 3); - R128CCE(pc[2].x1 + r128ctx->drawX); - R128CCE(pc[2].x2-1 + r128ctx->drawX); - R128CCE(pc[2].y1 + r128ctx->drawY); - R128CCE(pc[2].y2-1 + r128ctx->drawY); + return found; +} - r128ctx->regs.aux_sc_cntl |= R128_AUX3_SC_EN | R128_AUX3_SC_MODE_OR; +static void r128DDSetReadBuffer( GLcontext *ctx, + GLframebuffer *colorBuffer, + GLenum mode ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); - case 2: - R128CCE0(R128_CCE_PACKET0, R128_AUX2_SC_LEFT, 3); - R128CCE(pc[1].x1 + r128ctx->drawX); - R128CCE(pc[1].x2-1 + r128ctx->drawX); - R128CCE(pc[1].y1 + r128ctx->drawY); - R128CCE(pc[1].y2-1 + r128ctx->drawY); + r128ctx->Fallback &= ~R128_FALLBACK_READ_BUFFER; - r128ctx->regs.aux_sc_cntl |= R128_AUX2_SC_EN | R128_AUX2_SC_MODE_OR; + switch ( mode ) { + case GL_FRONT_LEFT: + r128ctx->readOffset = r128ctx->r128Screen->frontOffset; + r128ctx->readPitch = r128ctx->r128Screen->frontPitch; + r128ctx->readX = r128ctx->r128Screen->frontX; + r128ctx->readY = r128ctx->r128Screen->frontY; + break; + case GL_BACK_LEFT: + r128ctx->readOffset = r128ctx->r128Screen->backOffset; + r128ctx->readPitch = r128ctx->r128Screen->backPitch; + r128ctx->readX = r128ctx->r128Screen->backX; + r128ctx->readY = r128ctx->r128Screen->backY; + break; + default: + r128ctx->Fallback |= R128_FALLBACK_READ_BUFFER; + break; + } +} - case 1: - R128CCE0(R128_CCE_PACKET0, R128_AUX1_SC_LEFT, 3); - R128CCE(pc[0].x1 + r128ctx->drawX); - R128CCE(pc[0].x2-1 + r128ctx->drawX); - R128CCE(pc[0].y1 + r128ctx->drawY); - R128CCE(pc[0].y2-1 + r128ctx->drawY); - r128ctx->regs.aux_sc_cntl |= R128_AUX1_SC_EN | R128_AUX1_SC_MODE_OR; - break; +/* ============================================================= + * Polygon stipple + */ - default: - return; - } +static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + GLuint *stipple = (GLuint *)mask; + + FLUSH_BATCH( r128ctx ); + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; - R128CCE0(R128_CCE_PACKET0, R128_AUX_SC_CNTL, 0); - R128CCE(r128ctx->regs.aux_sc_cntl); + r128ctx->setup.dp_gui_master_cntl_c &= ~R128_GMC_BRUSH_NONE; + + if ( ctx->Polygon.StippleFlag && ctx->PB->primitive == GL_POLYGON ) { + r128ctx->setup.dp_gui_master_cntl_c |= R128_GMC_BRUSH_32x32_MONO_FG_LA; + } else { + r128ctx->setup.dp_gui_master_cntl_c |= R128_GMC_BRUSH_SOLID_COLOR; + } - R128CCE_SUBMIT_PACKET(); + LOCK_HARDWARE( r128ctx ); + + drmR128PolygonStipple( r128ctx->driFd, stipple ); + + UNLOCK_HARDWARE( r128ctx ); + + r128ctx->new_state |= R128_NEW_CONTEXT; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; } -/* Update the driver's notion of the window position */ -/* NOTE: This function is only called while holding the hardware lock */ -static void r128UpdateWindowPosition(r128ContextPtr r128ctx) + +/* ============================================================= + * State enable/disable + */ + +static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) { - int x = r128ctx->driDrawable->x + r128ctx->drawX; - int y = r128ctx->driDrawable->y + r128ctx->drawY; - -#if 0 - /* FIXME: Is this _really_ needed? */ - R128CCE_FLUSH_VB(r128ctx); -#endif - r128ctx->regs.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) | - (x << R128_WINDOW_X_SHIFT)); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %s = %s )\n", + __FUNCTION__, gl_lookup_enum_by_nr( cap ), + state ? "GL_TRUE" : "GL_FALSE" ); + } - /* Recalculate the Z buffer offset since we might be drawing to the - back buffer and window_xy_offset affects both color buffer and - depth drawing */ - r128ctx->regs.z_offset_c = ((r128ctx->r128Screen->depthX - - r128ctx->drawX) * - (r128ctx->r128Screen->bpp/8) + - (r128ctx->r128Screen->depthY - - r128ctx->drawY) * - r128ctx->r128Screen->fbStride); - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_WIN_Z_POS; + switch ( cap ) { + case GL_ALPHA_TEST: + case GL_BLEND: + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_ALPHA; + break; + + case GL_CULL_FACE: + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_CULL; + break; + + case GL_DEPTH_TEST: + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_DEPTH; + break; + + case GL_DITHER: + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_RENDER; + break; + + case GL_FOG: + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_FOG; + break; + + case GL_INDEX_LOGIC_OP: + case GL_COLOR_LOGIC_OP: + FLUSH_BATCH( r128ctx ); + if ( state && ctx->Color.LogicOp != GL_COPY ) { + r128ctx->Fallback |= R128_FALLBACK_LOGICOP; + } else { + r128ctx->Fallback &= ~R128_FALLBACK_LOGICOP; + } + break; + + case GL_SCISSOR_TEST: + FLUSH_BATCH( r128ctx ); + r128ctx->scissor = state; + r128ctx->new_state |= R128_NEW_CLIP; + break; + + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_TEXTURE; + break; + + case GL_POLYGON_STIPPLE: + if ( (ctx->Driver.TriangleCaps & DD_TRI_STIPPLE) && + ctx->PB->primitive == GL_POLYGON ) + { + FLUSH_BATCH( r128ctx ); + r128ctx->setup.dp_gui_master_cntl_c &= ~R128_GMC_BRUSH_NONE; + if ( state ) { + r128ctx->setup.dp_gui_master_cntl_c |= + R128_GMC_BRUSH_32x32_MONO_FG_LA; + } else { + r128ctx->setup.dp_gui_master_cntl_c |= + R128_GMC_BRUSH_SOLID_COLOR; + } + r128ctx->new_state |= R128_NEW_CONTEXT; + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } + break; + + default: + return; + } } -/* Update the hardware state */ -/* NOTE: This function is only called while holding the hardware lock */ -static void r128UpdateHWStateLocked(r128ContextPtr r128ctx) + +/* ============================================================= + * State initialization, management + */ + +static void r128DDPrintDirty( const char *msg, GLuint state ) { - if (r128ctx->dirty & R128_REQUIRE_QUIESCENCE) - r128WaitForIdleLocked(r128ctx); - - /* Update any state that might have changed recently */ - - /* Update the clip rects */ - if (r128ctx->dirty & R128_UPDATE_WINPOS) - r128UpdateWindowPosition(r128ctx); - - /* Update texture state and then upload the images */ - /* Note: Texture images can only be updated after the state has been set */ - if (r128ctx->dirty & R128_UPDATE_TEXSTATE) - r128UpdateTextureState(r128ctx); - if (r128ctx->dirty & R128_UPDATE_TEX0IMAGES) - r128UploadTexImages(r128ctx, r128ctx->CurrentTexObj[0]); - if (r128ctx->dirty & R128_UPDATE_TEX1IMAGES) - r128UploadTexImages(r128ctx, r128ctx->CurrentTexObj[1]); - - /* Load the state into the hardware */ - /* Note: This must be done after all other state has been set */ - if (r128ctx->dirty & R128_UPDATE_CONTEXT) - r128LoadContext(r128ctx); - - r128ctx->dirty = R128_CLEAN; + fprintf( stderr, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s\n", + msg, + state, + (state & R128_UPLOAD_CORE) ? "core, " : "", + (state & R128_UPLOAD_CONTEXT) ? "context, " : "", + (state & R128_UPLOAD_SETUP) ? "setup, " : "", + (state & R128_UPLOAD_TEX0) ? "tex0, " : "", + (state & R128_UPLOAD_TEX1) ? "tex1, " : "", + (state & R128_UPLOAD_TEX0IMAGES) ? "tex0 images, " : "", + (state & R128_UPLOAD_TEX1IMAGES) ? "tex1 images, " : "", + (state & R128_UPLOAD_MASKS) ? "masks, " : "", + (state & R128_UPLOAD_WINDOW) ? "window, " : "", + (state & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "", + (state & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); +} + +/* + * Load the current context's state into the hardware. + * + * NOTE: Be VERY careful about ensuring the context state is marked for + * upload, the only place it shouldn't be uploaded is when the setup + * state has changed in ReducedPrimitiveChange as this comes right after + * a state update. + * + * Blits of any type should always upload the context and masks after + * they are done. + */ +void r128EmitHwStateLocked( r128ContextPtr r128ctx ) +{ + R128SAREAPrivPtr sarea = r128ctx->sarea; + r128_context_regs_t *regs = &(r128ctx->setup); + r128TexObjPtr t0 = r128ctx->CurrentTexObj[0]; + r128TexObjPtr t1 = r128ctx->CurrentTexObj[1]; + + if ( R128_DEBUG & DEBUG_VERBOSE_MSG ) { + r128DDPrintDirty( "r128EmitHwStateLocked", r128ctx->dirty ); + } + + if ( r128ctx->dirty & R128_UPLOAD_TEX0IMAGES ) { + if ( t0 ) r128UploadTexImages( r128ctx, t0 ); + r128ctx->dirty &= ~R128_UPLOAD_TEX0IMAGES; + } + if ( r128ctx->dirty & R128_UPLOAD_TEX1IMAGES ) { + if ( t1 ) r128UploadTexImages( r128ctx, t1 ); + r128ctx->dirty &= ~R128_UPLOAD_TEX1IMAGES; + } + + if ( r128ctx->dirty & (R128_UPLOAD_CONTEXT | + R128_UPLOAD_SETUP | + R128_UPLOAD_MASKS | + R128_UPLOAD_WINDOW | + R128_UPLOAD_CORE | + R128_UPLOAD_TEX0) ) { + memcpy( &sarea->ContextState, regs, sizeof(sarea->ContextState) ); + } + + if ( (r128ctx->dirty & R128_UPLOAD_TEX0) && t0 ) { + memcpy( &sarea->TexState[0], &t0->setup, sizeof(sarea->TexState[0]) ); + } + + if ( (r128ctx->dirty & R128_UPLOAD_TEX1) && t1 ) { + memcpy( &sarea->TexState[1], &t1->setup, sizeof(sarea->TexState[1]) ); + } + + sarea->vertsize = r128ctx->vertsize; + sarea->vc_format = r128ctx->vc_format; + + /* Turn off the texture cache flushing */ + r128ctx->setup.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; + + sarea->dirty |= r128ctx->dirty; + r128ctx->dirty &= R128_UPLOAD_CLIPRECTS; +} + +static void r128DDPrintState( const char *msg, GLuint flags ) +{ + fprintf( stderr, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & R128_NEW_CONTEXT) ? "context, " : "", + (flags & R128_NEW_ALPHA) ? "alpha, " : "", + (flags & R128_NEW_DEPTH) ? "depth, " : "", + (flags & R128_NEW_FOG) ? "fog, " : "", + (flags & R128_NEW_CLIP) ? "clip, " : "", + (flags & R128_NEW_TEXTURE) ? "texture, " : "", + (flags & R128_NEW_CULL) ? "cull, " : "", + (flags & R128_NEW_MASKS) ? "masks, " : "", + (flags & R128_NEW_WINDOW) ? "window, " : "" ); } /* Update the hardware state */ -void r128UpdateHWState(r128ContextPtr r128ctx) +void r128DDUpdateHWState( GLcontext *ctx ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int new_state = r128ctx->new_state; + + if ( new_state ) + { + FLUSH_BATCH( r128ctx ); + + r128ctx->new_state = 0; + + if ( R128_DEBUG & DEBUG_VERBOSE_MSG ) + r128DDPrintState( "r128UpdateHwState", new_state ); + + /* Update the various parts of the context's state. + */ + if ( new_state & R128_NEW_ALPHA ) + r128UpdateAlphaMode( ctx ); + + if ( new_state & R128_NEW_DEPTH ) + r128UpdateZMode( ctx ); + + if ( new_state & R128_NEW_FOG ) + r128UpdateFogAttrib( ctx ); + + if ( new_state & R128_NEW_CLIP ) + r128UpdateClipping( ctx ); + + if ( new_state & R128_NEW_CULL ) + r128UpdateCull( ctx ); + + if ( new_state & R128_NEW_MASKS ) + r128UpdateMasks( ctx ); + + if ( new_state & R128_NEW_RENDER ) + r128UpdateRenderAttrib( ctx ); + + if ( new_state & R128_NEW_WINDOW ) + r128UpdateWindow( ctx ); + + if ( new_state & R128_NEW_TEXTURE ) + r128UpdateTextureState( ctx ); + } +} + +/* This is called when Mesa switches between rendering triangle + * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc), + * and lines, points and bitmaps. + * + * As the r128 uses triangles to render lines and points, it is + * necessary to turn off hardware culling when rendering these + * primitives. + */ +static void r128DDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + CARD32 f = r128ctx->setup.pm4_vc_fpu_setup; + + f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID; + + if ( ctx->Polygon.CullFlag && ctx->PB->primitive == GL_POLYGON ) { + switch ( ctx->Polygon.CullFaceMode ) { + case GL_FRONT: + f &= ~R128_FRONTFACE_SOLID; + break; + case GL_BACK: + f &= ~R128_BACKFACE_SOLID; + break; + case GL_FRONT_AND_BACK: + f &= ~(R128_BACKFACE_SOLID | + R128_FRONTFACE_SOLID); + break; + } + } + + if ( r128ctx->setup.pm4_vc_fpu_setup != f ) { + FLUSH_BATCH( r128ctx ); + r128ctx->setup.pm4_vc_fpu_setup = f; + + /* NOTE: Only upload the setup state, everything else has been + * uploaded by the usual means already. + */ + r128ctx->dirty |= R128_UPLOAD_SETUP; + } +} + + +#define INTERESTED (~(NEW_MODELVIEW | \ + NEW_PROJECTION | \ + NEW_TEXTURE_MATRIX | \ + NEW_USER_CLIP | \ + NEW_CLIENT_STATE)) + +void r128DDUpdateState( GLcontext *ctx ) { - LOCK_HARDWARE(r128ctx); - r128UpdateHWStateLocked(r128ctx); - UNLOCK_HARDWARE(r128ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + if ( ctx->NewState & INTERESTED ) { + r128DDChooseRenderState( ctx ); + r128DDChooseRasterSetupFunc( ctx ); + } + + /* Need to do this here to detect texture fallbacks before + * setting triangle functions. + */ + if ( r128ctx->new_state & R128_NEW_TEXTURE ) { + r128DDUpdateHWState( ctx ); + } + + if ( !r128ctx->Fallback ) { + ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; + ctx->IndirectTriangles |= r128ctx->IndirectTriangles; + + ctx->Driver.PointsFunc = r128ctx->PointsFunc; + ctx->Driver.LineFunc = r128ctx->LineFunc; + ctx->Driver.TriangleFunc = r128ctx->TriangleFunc; + ctx->Driver.QuadFunc = r128ctx->QuadFunc; + } } -/* Update the driver's state */ -/* NOTE: This function is only called while holding the hardware lock */ -void r128UpdateState(r128ContextPtr r128ctx, int winMoved) + +/* Initialize the context's hardware state */ +void r128DDInitState( r128ContextPtr r128ctx ) { - R128SAREAPrivPtr sarea = r128ctx->r128Screen->SAREA; - int i; + int dst_bpp, depth_bpp; + CARD32 bias; + + switch ( r128ctx->BufferSize ) { + case 8: dst_bpp = R128_GMC_DST_8BPP_CI; break; + case 15: dst_bpp = R128_GMC_DST_15BPP; break; + case 16: dst_bpp = R128_GMC_DST_16BPP; break; + case 24: dst_bpp = R128_GMC_DST_24BPP; break; + case 32: dst_bpp = R128_GMC_DST_32BPP; break; + default: + fprintf( stderr, "Error: Unsupported pixel depth %d... exiting\n", + r128ctx->BufferSize ); + exit( -1 ); + } + + switch ( r128ctx->DepthSize ) { + case 16: + r128ctx->ClearDepth = 0x0000ffff; + depth_bpp = R128_Z_PIX_WIDTH_16; + r128ctx->depth_scale = 1.0 / 65536.0; + break; + case 24: + r128ctx->ClearDepth = 0x00ffffff; + depth_bpp = R128_Z_PIX_WIDTH_24; + r128ctx->depth_scale = 1.0 / 16777216.0; + break; + case 32: + r128ctx->ClearDepth = 0xffffffff; + depth_bpp = R128_Z_PIX_WIDTH_32; + r128ctx->depth_scale = 1.0 / 4294967296.0; + break; + default: + fprintf( stderr, "Error: Unsupported depth %d... exiting\n", + r128ctx->DepthSize ); + exit( -1 ); + } - if (sarea->ctxOwner != r128ctx->driContext->hHWContext) { - sarea->ctxOwner = r128ctx->driContext->hHWContext; - r128ctx->dirty_context = R128_CTX_ALL_DIRTY; - r128LoadContext(r128ctx); - } + r128ctx->ClearColor = 0x00000000; + + r128ctx->RenderIndex = R128_FALLBACK_BIT; + r128ctx->PointsFunc = NULL; + r128ctx->LineFunc = NULL; + r128ctx->TriangleFunc = NULL; + r128ctx->QuadFunc = NULL; + + r128ctx->IndirectTriangles = 0; + r128ctx->Fallback = 0; + + if ( r128ctx->glCtx->Visual->DBflag ) { + r128ctx->DrawBuffer = GL_BACK_LEFT; + r128ctx->drawOffset = r128ctx->readOffset = + r128ctx->r128Screen->backOffset; + r128ctx->drawPitch = r128ctx->readPitch = + r128ctx->r128Screen->backPitch; + } else { + r128ctx->DrawBuffer = GL_FRONT_LEFT; + r128ctx->drawOffset = r128ctx->readOffset = + r128ctx->r128Screen->frontOffset; + r128ctx->drawPitch = r128ctx->readPitch = + r128ctx->r128Screen->frontPitch; + } - for (i = 0; i < r128ctx->r128Screen->NRTexHeaps; i++) - r128AgeTextures(r128ctx, i); + /* Harware state: + */ + r128ctx->setup.dst_pitch_offset_c = (((r128ctx->drawPitch/8) << 21) | + (r128ctx->drawOffset >> 5)); + + r128ctx->setup.dp_gui_master_cntl_c = (R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_DST_CLIPPING | + R128_GMC_BRUSH_SOLID_COLOR | + dst_bpp | + R128_GMC_SRC_DATATYPE_COLOR | + R128_GMC_BYTE_MSB_TO_LSB | + R128_GMC_CONVERSION_TEMP_6500 | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_3D_FCN_EN | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS); + + r128ctx->setup.sc_top_left_c = 0x00000000; + r128ctx->setup.sc_bottom_right_c = 0x1fff1fff; + + r128ctx->setup.z_offset_c = r128ctx->r128Screen->depthOffset; + r128ctx->setup.z_pitch_c = ((r128ctx->r128Screen->depthPitch >> 3) | + R128_Z_TILE); + + r128ctx->setup.z_sten_cntl_c = (depth_bpp | + R128_Z_TEST_LESS | + R128_STENCIL_TEST_ALWAYS | + R128_STENCIL_S_FAIL_KEEP | + R128_STENCIL_ZPASS_KEEP | + R128_STENCIL_ZFAIL_KEEP); + + bias = r128ctx->lod_bias & 0xff; + r128ctx->setup.tex_cntl_c = (R128_Z_WRITE_ENABLE | + R128_SHADE_ENABLE | + R128_DITHER_ENABLE | + R128_ALPHA_IN_TEX_COMPLETE_A | + R128_LIGHT_DIS | + R128_ALPHA_LIGHT_DIS | + R128_TEX_CACHE_FLUSH | + (bias << R128_LOD_BIAS_SHIFT)); + + r128ctx->setup.misc_3d_state_cntl_reg = (R128_MISC_SCALE_3D_TEXMAP_SHADE | + R128_MISC_SCALE_PIX_REPLICATE | + R128_ALPHA_COMB_ADD_CLAMP | + R128_FOG_VERTEX | + R128_ALPHA_BLEND_SRC_ONE | + R128_ALPHA_BLEND_DST_ZERO | + R128_ALPHA_TEST_ALWAYS); + + r128ctx->setup.texture_clr_cmp_clr_c = 0x00000000; + r128ctx->setup.texture_clr_cmp_msk_c = 0xffffffff; + + r128ctx->setup.fog_color_c = 0x00000000; + + r128ctx->setup.pm4_vc_fpu_setup = (R128_FRONT_DIR_CCW | + R128_BACKFACE_SOLID | + R128_FRONTFACE_SOLID | + R128_FPU_COLOR_GOURAUD | + R128_FPU_SUB_PIX_2BITS | + R128_FPU_MODE_3D | + R128_TRAP_BITS_DISABLE | + R128_XFACTOR_2 | + R128_YFACTOR_2 | + R128_FLAT_SHADE_VERTEX_OGL | + R128_FPU_ROUND_TRUNCATE | + R128_WM_SEL_8DW); + + r128ctx->setup.setup_cntl = (R128_COLOR_GOURAUD | + R128_PRIM_TYPE_TRI | + R128_TEXTURE_ST_MULT_W | + R128_STARTING_VERTEX_1 | + R128_ENDING_VERTEX_3 | + R128_SU_POLY_LINE_NOT_LAST | + R128_SUB_PIX_2BITS); + + r128ctx->setup.tex_size_pitch_c = 0x00000000; + r128ctx->setup.constant_color_c = 0x00ffffff; + + r128ctx->setup.dp_write_mask = 0xffffffff; + r128ctx->setup.sten_ref_mask_c = 0xffff0000; + r128ctx->setup.plane_3d_mask_c = 0xffffffff; + + r128ctx->setup.window_xy_offset = 0x00000000; + + r128ctx->setup.scale_3d_cntl = (R128_SCALE_DITHER_TABLE | + R128_TEX_CACHE_SIZE_FULL | + R128_DITHER_INIT_RESET | + R128_SCALE_3D_TEXMAP_SHADE | + R128_SCALE_PIX_REPLICATE | + R128_ALPHA_COMB_ADD_CLAMP | + R128_FOG_VERTEX | + R128_ALPHA_BLEND_SRC_ONE | + R128_ALPHA_BLEND_DST_ZERO | + R128_ALPHA_TEST_ALWAYS | + R128_COMPOSITE_SHADOW_CMP_EQUAL | + R128_TEX_MAP_ALPHA_IN_TEXTURE | + R128_TEX_CACHE_LINE_SIZE_4QW); + + r128ctx->new_state = R128_NEW_ALL; +} - if (winMoved) r128ctx->dirty |= R128_UPDATE_WINPOS; +/* Initialize the driver's state functions */ +void r128DDInitStateFuncs( GLcontext *ctx ) +{ + ctx->Driver.UpdateState = r128DDUpdateState; + + ctx->Driver.ClearIndex = NULL; + ctx->Driver.ClearColor = r128DDClearColor; + ctx->Driver.Index = NULL; + ctx->Driver.Color = r128DDColor; + ctx->Driver.SetDrawBuffer = r128DDSetDrawBuffer; + ctx->Driver.SetReadBuffer = r128DDSetReadBuffer; + + ctx->Driver.IndexMask = NULL; + ctx->Driver.ColorMask = r128DDColorMask; + ctx->Driver.LogicOp = NULL; + ctx->Driver.Dither = NULL; + + ctx->Driver.NearFar = NULL; + + ctx->Driver.RenderStart = r128DDUpdateHWState; + ctx->Driver.RenderFinish = NULL; + ctx->Driver.RasterSetup = NULL; + + ctx->Driver.RenderVBClippedTab = NULL; + ctx->Driver.RenderVBCulledTab = NULL; + ctx->Driver.RenderVBRawTab = NULL; + + ctx->Driver.ReducedPrimitiveChange = r128DDReducedPrimitiveChange; + ctx->Driver.MultipassFunc = NULL; + + ctx->Driver.AlphaFunc = r128DDAlphaFunc; + ctx->Driver.BlendEquation = r128DDBlendEquation; + ctx->Driver.BlendFunc = r128DDBlendFunc; + ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate; + ctx->Driver.ClearDepth = r128DDClearDepth; + ctx->Driver.CullFace = r128DDCullFace; + ctx->Driver.FrontFace = r128DDFrontFace; + ctx->Driver.DepthFunc = r128DDDepthFunc; + ctx->Driver.DepthMask = r128DDDepthMask; + ctx->Driver.DepthRange = NULL; + ctx->Driver.Enable = r128DDEnable; + ctx->Driver.Fogfv = r128DDFogfv; + ctx->Driver.Hint = NULL; + ctx->Driver.Lightfv = NULL; + ctx->Driver.LightModelfv = r128DDLightModelfv; + ctx->Driver.LogicOpcode = r128DDLogicOpCode; + ctx->Driver.PolygonMode = NULL; + ctx->Driver.PolygonStipple = r128DDPolygonStipple; + ctx->Driver.Scissor = r128DDScissor; + ctx->Driver.ShadeModel = r128DDShadeModel; + ctx->Driver.ClearStencil = NULL; + ctx->Driver.StencilFunc = NULL; + ctx->Driver.StencilMask = NULL; + ctx->Driver.StencilOp = NULL; + ctx->Driver.Viewport = NULL; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.h b/xc/lib/GL/mesa/src/drv/r128/r128_state.h index faa182a86..6d122879d 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_state.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_state.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.h,v 1.1 2000/06/17 00:03:07 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.h,v 1.2 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -37,14 +38,19 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING -extern void r128DDInitState(r128ContextPtr r128ctx); -extern void r128DDInitStateFuncs(GLcontext *ctx); +#include "r128_context.h" -extern void r128UpdateState(r128ContextPtr r128ctx, int winMoved); -extern void r128UpdateHWState(r128ContextPtr r128ctx); +extern void r128DDInitState( r128ContextPtr r128ctx ); +extern void r128DDInitStateFuncs( GLcontext *ctx ); -extern void r128SetClipRects(r128ContextPtr r128ctx, - XF86DRIClipRectPtr pc, int nc); +extern void r128DDUpdateState( GLcontext *ctx ); +extern void r128DDUpdateHWState( GLcontext *ctx ); + +extern void r128UpdateWindow( GLcontext *ctx ); +extern void r128SetClipRects( r128ContextPtr r128ctx, + XF86DRIClipRectPtr pc, int nc ); + +extern void r128EmitHwStateLocked( r128ContextPtr r128ctx ); #endif #endif /* _R128_STATE_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c index 537a88d8f..ff619fa46 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.5 2000/11/08 05:02:51 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.6 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,23 +28,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Gareth Hughes <gareth@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_lock.h" #include "r128_state.h" -#include "r128_reg.h" -#include "r128_cce.h" +#include "r128_ioctl.h" #include "r128_vb.h" #include "r128_tex.h" #include "mmath.h" #include "simple_list.h" +#include "enums.h" +#include "mem.h" + static void r128SetTexWrap(r128TexObjPtr t, GLenum srwap, GLenum twrap); static void r128SetTexFilter(r128TexObjPtr t, GLenum minf, GLenum magf); @@ -52,267 +51,309 @@ static void r128SetTexBorderColor(r128TexObjPtr t, GLubyte c[4]); /* Allocate and initialize hardware state associated with texture `t' */ /* NOTE: This function is only called while holding the hardware lock */ -static r128TexObjPtr r128CreateTexObj(r128ContextPtr r128ctx, - struct gl_texture_object *tObj) +static r128TexObjPtr r128CreateTexObj( r128ContextPtr r128ctx, + struct gl_texture_object *tObj ) { - r128TexObjPtr t; - struct gl_texture_image *image; - int log2Pitch, log2Height, log2Size, log2MinSize; - int totalSize; - int i; - - image = tObj->Image[0]; - if (!image) return NULL; /* ERROR!!! */ - - t = (r128TexObjPtr)calloc(1,sizeof(*t)); - if (!t) return NULL; /* ERROR!!! */ - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) - fprintf(stderr, "r128CreateTexObj(%p)\n", tObj); - - switch (image->Format) { - case GL_RGBA: - case GL_ALPHA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - if (r128ctx->r128Screen->bpp == 32) { - t->texelBytes = 4; - t->textureFormat = R128_DATATYPE_ARGB8888; - } else { - t->texelBytes = 2; - t->textureFormat = R128_DATATYPE_ARGB4444; - } - break; - - case GL_RGB: - if (r128ctx->r128Screen->bpp == 32) { - t->texelBytes = 4; - t->textureFormat = R128_DATATYPE_ARGB8888; - } else { - t->texelBytes = 2; - t->textureFormat = R128_DATATYPE_RGB565; - } - break; - - case GL_LUMINANCE: - if (r128ctx->r128Screen->bpp == 32) { - t->texelBytes = 4; - t->textureFormat = R128_DATATYPE_ARGB8888; - } else { - t->texelBytes = 2; - /* Use this to get true greys */ - t->textureFormat = R128_DATATYPE_ARGB1555; - } - break; - - case GL_COLOR_INDEX: - t->texelBytes = 1; - t->textureFormat = R128_DATATYPE_CI8; - break; - - default: - /* ERROR!!! */ - fprintf(stderr, "r128CreateTexObj: bad image->Format\n"); - free(t); - return NULL; - } - - /* Calculate dimensions in log domain */ - for (i = 1, log2Height = 0; i < image->Height; i *= 2) log2Height++; - for (i = 1, log2Pitch = 0; i < image->Width; i *= 2) log2Pitch++; - if (image->Width > image->Height) log2Size = log2Pitch; - else log2Size = log2Height; - - t->dirty_images = 0; - - /* Calculate mipmap offsets and dimensions */ - totalSize = 0; - for (i = 0; i <= log2Size && tObj->Image[i]; i++) { - t->image[i].offset = totalSize; - t->image[i].width = tObj->Image[i]->Width; - t->image[i].height = tObj->Image[i]->Height; - t->dirty_images |= 1 << i; - totalSize += (tObj->Image[i]->Height * - tObj->Image[i]->Width * - t->texelBytes); - - /* Offsets must be 32-byte aligned for host data blits */ - totalSize = (totalSize + 31) & ~31; - } - log2MinSize = log2Size - i + 1; - - t->totalSize = totalSize; - t->internFormat = image->IntFormat; - - t->bound = 0; - t->heap = 0; /* This is set in r128UploadTexImages */ - t->tObj = tObj; - - t->memBlock = NULL; - t->bufAddr = 0; - - t->regs.tex_cntl = t->textureFormat; - t->regs.size_pitch = ((log2Pitch << R128_TEX_PITCH_SHIFT) | - (log2Size << R128_TEX_SIZE_SHIFT) | - (log2Height << R128_TEX_HEIGHT_SHIFT) | - (log2MinSize << R128_TEX_MIN_SIZE_SHIFT)); - t->regs.border_color = 0x00000000; - - if (log2MinSize == log2Size || - log2MinSize != 0) - t->regs.tex_cntl |= R128_MIP_MAP_DISABLE; - - r128SetTexWrap(t, tObj->WrapS, tObj->WrapT); - r128SetTexFilter(t, tObj->MinFilter, tObj->MagFilter); - r128SetTexBorderColor(t, tObj->BorderColor); - - tObj->DriverData = t; - - make_empty_list(t); - - return t; + r128TexObjPtr t; + struct gl_texture_image *image; + int log2Pitch, log2Height, log2Size, log2MinSize; + int totalSize; + int i; + + image = tObj->Image[0]; + if ( !image ) + return NULL; + + t = (r128TexObjPtr)CALLOC( sizeof(*t) ); + if ( !t ) + return NULL; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) + fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj ); + + switch ( image->Format ) { + case GL_RGBA: + case GL_ALPHA: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + if ( r128ctx->r128Screen->bpp == 32 ) { + t->texelBytes = 4; + t->textureFormat = R128_DATATYPE_ARGB8888; + } else { + t->texelBytes = 2; + t->textureFormat = R128_DATATYPE_ARGB4444; + } + break; + + case GL_RGB: + if ( r128ctx->r128Screen->bpp == 32 ) { + t->texelBytes = 4; + t->textureFormat = R128_DATATYPE_ARGB8888; + } else { + t->texelBytes = 2; + t->textureFormat = R128_DATATYPE_RGB565; + } + break; + + case GL_LUMINANCE: + if ( r128ctx->r128Screen->bpp == 32 ) { + t->texelBytes = 4; + t->textureFormat = R128_DATATYPE_ARGB8888; + } else { + t->texelBytes = 2; + /* Use this to get true greys */ + t->textureFormat = R128_DATATYPE_ARGB1555; + } + break; + + case GL_COLOR_INDEX: + t->texelBytes = 1; + t->textureFormat = R128_DATATYPE_CI8; + break; + + default: + fprintf( stderr, "%s: bad image->Format\n", __FUNCTION__ ); + FREE( t ); + return NULL; + } + + /* Calculate dimensions in log domain */ + for ( i = 1, log2Height = 0 ; i < image->Height ; i *= 2 ) { + log2Height++; + } + for ( i = 1, log2Pitch = 0 ; i < image->Width ; i *= 2 ) { + log2Pitch++; + } + if ( image->Width > image->Height ) { + log2Size = log2Pitch; + } else { + log2Size = log2Height; + } + + t->dirty_images = 0; + + /* Calculate mipmap offsets and dimensions */ + totalSize = 0; + for ( i = 0 ; i <= log2Size && tObj->Image[i] ; i++ ) { + t->image[i].offset = totalSize; + t->image[i].width = tObj->Image[i]->Width; + t->image[i].height = tObj->Image[i]->Height; + + t->dirty_images |= (1 << i); + + totalSize += (tObj->Image[i]->Height * + tObj->Image[i]->Width * + t->texelBytes); + + /* Offsets must be 32-byte aligned for host data blits and tiling */ + totalSize = (totalSize + 31) & ~31; + } + log2MinSize = log2Size - i + 1; + + t->totalSize = totalSize; + t->internFormat = image->IntFormat; + + t->age = 0; + t->bound = 0; + t->heap = 0; + t->tObj = tObj; + + t->memBlock = NULL; + t->bufAddr = 0; + + /* Hardware state: + */ + t->setup.tex_cntl = (R128_MIN_BLEND_NEAREST | + R128_MAG_BLEND_NEAREST | + R128_TEX_CLAMP_S_WRAP | + R128_TEX_CLAMP_T_WRAP | + t->textureFormat); + + t->setup.tex_combine_cntl = 0x00000000; + + t->setup.tex_size_pitch = ((log2Pitch << R128_TEX_PITCH_SHIFT) | + (log2Size << R128_TEX_SIZE_SHIFT) | + (log2Height << R128_TEX_HEIGHT_SHIFT) | + (log2MinSize << R128_TEX_MIN_SIZE_SHIFT)); + + for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + t->setup.tex_offset[i] = 0x00000000; + } + t->setup.tex_border_color = 0x00000000; + + if ( ( log2MinSize == log2Size ) || ( log2MinSize != 0 ) ) { + t->setup.tex_cntl |= R128_MIP_MAP_DISABLE; + } + + r128SetTexWrap( t, tObj->WrapS, tObj->WrapT ); + r128SetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); + r128SetTexBorderColor( t, tObj->BorderColor ); + + tObj->DriverData = t; + + make_empty_list( t ); + + return t; } /* Destroy hardware state associated with texture `t' */ -/* NOTE: This function can be called while holding the hardware lock and - while not holding the lock*/ -void r128DestroyTexObj(r128ContextPtr r128ctx, r128TexObjPtr t) +void r128DestroyTexObj( r128ContextPtr r128ctx, r128TexObjPtr t ) { #if ENABLE_PERF_BOXES - /* Bump the performace counter */ - r128ctx->c_textureSwaps++; + /* Bump the performace counter */ + r128ctx->c_textureSwaps++; #endif - if (!t) return; + if ( !t ) return; - if (t->memBlock) { - mmFreeMem(t->memBlock); - t->memBlock = NULL; - } + if ( t->memBlock ) { + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + } - if (t->tObj) t->tObj->DriverData = NULL; - if (t->bound) r128ctx->CurrentTexObj[t->bound-1] = NULL; + if ( t->tObj ) + t->tObj->DriverData = NULL; + if ( t->bound ) + r128ctx->CurrentTexObj[t->bound-1] = NULL; - remove_from_list(t); - free(t); + remove_from_list( t ); + FREE( t ); } /* Keep track of swapped out texture objects */ -/* NOTE: This function is only called while holding the hardware lock */ -static void r128SwapOutTexObj(r128ContextPtr r128ctx, r128TexObjPtr t) +static void r128SwapOutTexObj( r128ContextPtr r128ctx, r128TexObjPtr t ) { #if ENABLE_PERF_BOXES - /* Bump the performace counter */ - r128ctx->c_textureSwaps++; + /* Bump the performace counter */ + r128ctx->c_textureSwaps++; #endif - if (t->memBlock) { - mmFreeMem(t->memBlock); - t->memBlock = NULL; - } + if ( t->memBlock ) { + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + } - t->dirty_images = ~0; - move_to_tail(&r128ctx->SwappedOut, t); + t->dirty_images = ~0; + move_to_tail( &r128ctx->SwappedOut, t ); } /* Print out debugging information about texture LRU */ -void r128PrintLocalLRU(r128ContextPtr r128ctx, int heap) +void r128PrintLocalLRU( r128ContextPtr r128ctx, int heap ) { - r128TexObjPtr t; - int sz = 1 << (r128ctx->r128Screen->log2TexGran[heap]); - - foreach(t, &r128ctx->TexObjList[heap]) { - if (!t->tObj) { - fprintf(stderr, "Placeholder %d at 0x%x sz 0x%x\n", - t->memBlock->ofs / sz, - t->memBlock->ofs, - t->memBlock->size); - } else { - fprintf(stderr, "Texture (bound %d) at 0x%x sz 0x%x\n", - t->bound, - t->memBlock->ofs, - t->memBlock->size); - } - } + r128TexObjPtr t; + int sz = 1 << (r128ctx->r128Screen->log2TexGran[heap]); + + fprintf( stderr, "\nLocal LRU, heap %d:\n", heap ); + + foreach( t, &r128ctx->TexObjList[heap] ) { + if ( !t->tObj ) { + fprintf( stderr, "Placeholder %d at 0x%x sz 0x%x\n", + t->memBlock->ofs / sz, + t->memBlock->ofs, + t->memBlock->size ); + } else { + fprintf( stderr, "Texture (bound %d) at 0x%x sz 0x%x\n", + t->bound, + t->memBlock->ofs, + t->memBlock->size ); + } + } + + fprintf( stderr, "\n" ); } -void r128PrintGlobalLRU(r128ContextPtr r128ctx, int heap) +void r128PrintGlobalLRU( r128ContextPtr r128ctx, int heap ) { - R128TexRegion *list = r128ctx->r128Screen->SAREA->texList[heap]; - int i, j; - - for (i = 0, j = R128_NR_TEX_REGIONS ; i < R128_NR_TEX_REGIONS ; i++) { - fprintf(stderr, "list[%d] age %d next %d prev %d\n", - j, list[j].age, list[j].next, list[j].prev); - j = list[j].next; - if (j == R128_NR_TEX_REGIONS) break; - } - - if (j != R128_NR_TEX_REGIONS) { - fprintf(stderr, "Loop detected in global LRU\n"); - } + r128_tex_region_t *list = r128ctx->sarea->texList[heap]; + int i, j; + + fprintf( stderr, "\nGlobal LRU, heap %d list %p:\n", heap, list ); + + for ( i = 0, j = R128_NR_TEX_REGIONS ; i < R128_NR_TEX_REGIONS ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d\n", + j, list[j].age, list[j].next, list[j].prev ); + j = list[j].next; + if ( j == R128_NR_TEX_REGIONS ) break; + } + + if ( j != R128_NR_TEX_REGIONS ) { + fprintf( stderr, "Loop detected in global LRU\n" ); + for ( i = 0 ; i < R128_NR_TEX_REGIONS ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d\n", + i, list[i].age, list[i].next, list[i].prev ); + } + } + + fprintf( stderr, "\n" ); } /* Reset the global texture LRU */ /* NOTE: This function is only called while holding the hardware lock */ -static void r128ResetGlobalLRU(r128ContextPtr r128ctx, int heap) +static void r128ResetGlobalLRU( r128ContextPtr r128ctx, int heap ) { - R128TexRegion *list = r128ctx->r128Screen->SAREA->texList[heap]; - int log2sz = 1 << r128ctx->r128Screen->log2TexGran[heap]; - int i; - - /* - * (Re)initialize the global circular LRU list. The last element in - * the array (R128_NR_TEX_REGIONS) is the sentinal. Keeping it at - * the end of the array allows it to be addressed rationally when - * looking up objects at a particular location in texture memory. - */ - - for (i = 0; (i+1) * log2sz <= r128ctx->r128Screen->texSize[heap]; i++) { - list[i].prev = i-1; - list[i].next = i+1; - list[i].age = 0; - } - - i--; - list[0].prev = R128_NR_TEX_REGIONS; - list[i].prev = i-1; - list[i].next = R128_NR_TEX_REGIONS; - list[R128_NR_TEX_REGIONS].prev = i; - list[R128_NR_TEX_REGIONS].next = 0; - r128ctx->r128Screen->SAREA->texAge[heap] = 0; + r128_tex_region_t *list = r128ctx->sarea->texList[heap]; + int sz = 1 << r128ctx->r128Screen->log2TexGran[heap]; + int i; + + /* (Re)initialize the global circular LRU list. The last element in + * the array (R128_NR_TEX_REGIONS) is the sentinal. Keeping it at + * the end of the array allows it to be addressed rationally when + * looking up objects at a particular location in texture memory. + */ + for ( i = 0 ; (i+1) * sz <= r128ctx->r128Screen->texSize[heap] ; i++ ) { + list[i].prev = i-1; + list[i].next = i+1; + list[i].age = 0; + } + + i--; + list[0].prev = R128_NR_TEX_REGIONS; + list[i].prev = i-1; + list[i].next = R128_NR_TEX_REGIONS; + list[R128_NR_TEX_REGIONS].prev = i; + list[R128_NR_TEX_REGIONS].next = 0; + r128ctx->sarea->texAge[heap] = 0; } /* Update the local and glock texture LRUs */ /* NOTE: This function is only called while holding the hardware lock */ -static void r128UpdateTexLRU(r128ContextPtr r128ctx, r128TexObjPtr t) +static void r128UpdateTexLRU( r128ContextPtr r128ctx, r128TexObjPtr t ) { - int heap = t->heap; - R128TexRegion *list = r128ctx->r128Screen->SAREA->texList[heap]; - int log2sz = r128ctx->r128Screen->log2TexGran[heap]; - - int start = t->memBlock->ofs >> log2sz; - int end = (t->memBlock->ofs + t->memBlock->size-1) >> log2sz; - int i; - - r128ctx->lastTexAge[heap] = ++r128ctx->r128Screen->SAREA->texAge[heap]; - - /* Update our local LRU */ - move_to_head(&r128ctx->TexObjList[heap], t); - - /* Update the global LRU */ - for (i = start ; i <= end ; i++) { - list[i].in_use = 1; - list[i].age = r128ctx->lastTexAge[heap]; - - /* remove_from_list(i) */ - list[(CARD32)list[i].next].prev = list[i].prev; - list[(CARD32)list[i].prev].next = list[i].next; - - /* insert_at_head(list, i) */ - list[i].prev = R128_NR_TEX_REGIONS; - list[i].next = list[R128_NR_TEX_REGIONS].next; - list[(CARD32)list[R128_NR_TEX_REGIONS].next].prev = i; - list[R128_NR_TEX_REGIONS].next = i; - } + int heap = t->heap; + r128_tex_region_t *list = r128ctx->sarea->texList[heap]; + int log2sz = r128ctx->r128Screen->log2TexGran[heap]; + int start = t->memBlock->ofs >> log2sz; + int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz; + int i; + + r128ctx->lastTexAge[heap] = ++r128ctx->sarea->texAge[heap]; + + if ( !t->memBlock ) { + fprintf( stderr, "no memblock\n\n" ); + return; + } + + /* Update our local LRU */ + move_to_head( &r128ctx->TexObjList[heap], t ); + + /* Update the global LRU */ + for ( i = start ; i <= end ; i++ ) { + list[i].in_use = 1; + list[i].age = r128ctx->lastTexAge[heap]; + + /* remove_from_list(i) */ + list[(CARD32)list[i].next].prev = list[i].prev; + list[(CARD32)list[i].prev].next = list[i].next; + + /* insert_at_head(list, i) */ + list[i].prev = R128_NR_TEX_REGIONS; + list[i].next = list[R128_NR_TEX_REGIONS].next; + list[(CARD32)list[R128_NR_TEX_REGIONS].next].prev = i; + list[R128_NR_TEX_REGIONS].next = i; + } + + if ( 0 ) { + r128PrintGlobalLRU( r128ctx, t->heap ); + r128PrintLocalLRU( r128ctx, t->heap ); + } } /* Update our notion of what textures have been changed since we last @@ -321,1557 +362,1330 @@ static void r128UpdateTexLRU(r128ContextPtr r128ctx, r128TexObjPtr t) textures by pushing a placeholder texture onto the LRU list -- these are denoted by (tObj == NULL). */ /* NOTE: This function is only called while holding the hardware lock */ -static void r128TexturesGone(r128ContextPtr r128ctx, int heap, - int offset, int size, int in_use) +static void r128TexturesGone( r128ContextPtr r128ctx, int heap, + int offset, int size, int in_use ) { - r128TexObjPtr t, tmp; - - foreach_s (t, tmp, &r128ctx->TexObjList[heap]) { - if (t->memBlock->ofs >= offset + size || - t->memBlock->ofs + t->memBlock->size <= offset) - continue; - - /* It overlaps - kick it out. Need to hold onto the currently - bound objects, however. */ - if (t->bound) r128SwapOutTexObj(r128ctx, t); - else r128DestroyTexObj(r128ctx, t); - } - - if (in_use) { - t = (r128TexObjPtr) calloc(1,sizeof(*t)); - if (!t) return; - - t->memBlock = mmAllocMem(r128ctx->texHeap[heap], size, 0, offset); - insert_at_head(&r128ctx->TexObjList[heap], t); - } + r128TexObjPtr t, tmp; + + foreach_s ( t, tmp, &r128ctx->TexObjList[heap] ) { + if ( t->memBlock->ofs >= offset + size || + t->memBlock->ofs + t->memBlock->size <= offset ) + continue; + + /* It overlaps - kick it out. Need to hold onto the currently + * bound objects, however. + */ + if ( t->bound ) { + r128SwapOutTexObj( r128ctx, t ); + } else { + r128DestroyTexObj( r128ctx, t ); + } + } + + if ( in_use ) { + t = (r128TexObjPtr) CALLOC( sizeof(*t) ); + if (!t) return; + + t->memBlock = mmAllocMem( r128ctx->texHeap[heap], size, 0, offset ); + if ( !t->memBlock ) { + fprintf( stderr, "Couldn't alloc placeholder sz %x ofs %x\n", + (int)size, (int)offset ); + mmDumpMemInfo( r128ctx->texHeap[heap] ); + return; + } + insert_at_head( &r128ctx->TexObjList[heap], t ); + } } /* Update our client's shared texture state. If another client has modified a region in which we have textures, then we need to figure out which of our textures has been removed, and update our global LRU. */ -void r128AgeTextures(r128ContextPtr r128ctx, int heap) +void r128AgeTextures( r128ContextPtr r128ctx, int heap ) { - R128SAREAPrivPtr sarea = r128ctx->r128Screen->SAREA; - - if (sarea->texAge[heap] != r128ctx->lastTexAge[heap]) { - int log2sz = 1 << r128ctx->r128Screen->log2TexGran[heap]; - int nr = 0; - int idx; - - for (idx = sarea->texList[heap][R128_NR_TEX_REGIONS].prev; - idx != R128_NR_TEX_REGIONS && nr < R128_NR_TEX_REGIONS; - idx = sarea->texList[heap][idx].prev, nr++) { - - /* If switching texturing schemes, then the SAREA might not - have been properly cleared, so we need to reset the - global texture LRU. */ - if (idx * log2sz > r128ctx->r128Screen->texSize[heap]) { - nr = R128_NR_TEX_REGIONS; - break; - } - - if (sarea->texList[heap][idx].age > r128ctx->lastTexAge[heap]) - r128TexturesGone(r128ctx, heap, idx * log2sz, log2sz, - sarea->texList[heap][idx].in_use); - } - - if (nr == R128_NR_TEX_REGIONS) { - r128TexturesGone(r128ctx, heap, - 0, r128ctx->r128Screen->texSize[heap], 0); - r128ResetGlobalLRU(r128ctx, heap); - } - - r128ctx->dirty |= R128_UPDATE_TEX0IMAGES; - r128ctx->dirty |= R128_UPDATE_TEX1IMAGES; - r128ctx->lastTexAge[heap] = sarea->texAge[heap]; - } + R128SAREAPriv *sarea = r128ctx->sarea; + + if ( sarea->texAge[heap] != r128ctx->lastTexAge[heap] ) { + int sz = 1 << r128ctx->r128Screen->log2TexGran[heap]; + int nr = 0; + int idx; + + /* Have to go right round from the back to ensure stuff ends up + * LRU in our local list... Fix with a cursor pointer. + */ + for ( idx = sarea->texList[heap][R128_NR_TEX_REGIONS].prev ; + idx != R128_NR_TEX_REGIONS && nr < R128_NR_TEX_REGIONS ; + idx = sarea->texList[heap][idx].prev, nr++ ) + { + /* If switching texturing schemes, then the SAREA might not + have been properly cleared, so we need to reset the + global texture LRU. */ + if ( idx * sz > r128ctx->r128Screen->texSize[heap] ) { + nr = R128_NR_TEX_REGIONS; + break; + } + + if ( sarea->texList[heap][idx].age > r128ctx->lastTexAge[heap] ) { + r128TexturesGone( r128ctx, heap, idx * sz, sz, + sarea->texList[heap][idx].in_use ); + } + } + + /* If switching texturing schemes, then the SAREA might not + * have been properly cleared, so we need to reset the + * global texture LRU. + */ + if ( nr == R128_NR_TEX_REGIONS ) { + r128TexturesGone( r128ctx, heap, 0, + r128ctx->r128Screen->texSize[heap], 0 ); + r128ResetGlobalLRU( r128ctx, heap ); + } + + if ( 0 ) { + r128PrintGlobalLRU( r128ctx, heap ); + r128PrintLocalLRU( r128ctx, heap ); + } + + r128ctx->dirty |= (R128_UPLOAD_CONTEXT | + R128_UPLOAD_TEX0IMAGES | + R128_UPLOAD_TEX1IMAGES); + r128ctx->lastTexAge[heap] = sarea->texAge[heap]; + } } /* Convert a block of Mesa-formatted texture to an 8bpp hardware format */ -static void r128ConvertTexture8bpp(r128ContextPtr r128ctx, - struct gl_texture_image *image, - int x, int y, int width, int height, - int pitch) +static void r128ConvertTexture8bpp( CARD32 *dst, + struct gl_texture_image *image, + int x, int y, int width, int height, + int pitch ) { - CARD8 *src; - CARD32 pix; - int i, j; - - switch (image->Format) { - case GL_RGB: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; - for (j = width >> 2; j; j--) { - pix = ((R128PACKCOLOR332( src[0], src[1], src[2]) ) | - (R128PACKCOLOR332( src[3], src[4], src[5]) << 8) | - (R128PACKCOLOR332( src[6], src[7], src[8]) << 16) | - (R128PACKCOLOR332( src[9], src[10], src[11]) << 24)); - R128CCE(pix); - src += 12; - } - } - break; - - case GL_ALPHA: - case GL_LUMINANCE: - case GL_INTENSITY: - case GL_COLOR_INDEX: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width >> 2; j; j--) { - pix = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); - R128CCE(pix); - src += 4; - } - } - break; - - default: - fprintf(stderr, "r128ConvertTexture8bpp: unsupported format 0x%x\n", - image->Format); - } + CARD8 *src; + int i, j; + + switch ( image->Format ) { + case GL_RGB: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; + for ( j = width >> 2 ; j ; j-- ) { + *dst++= ((R128PACKCOLOR332( src[0], src[1], src[2] )) | + (R128PACKCOLOR332( src[3], src[4], src[5] ) << 8) | + (R128PACKCOLOR332( src[6], src[7], src[8] ) << 16) | + (R128PACKCOLOR332( src[9], src[10], src[11] ) << 24)); + src += 12; + } + } + break; + + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + case GL_COLOR_INDEX: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width >> 2 ; j ; j-- ) { + *dst++ = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); + src += 4; + } + } + break; + + default: + fprintf( stderr, "%s: unsupported format 0x%x\n", + __FUNCTION__, image->Format ); + break; + } } /* Convert a block of Mesa-formatted texture to a 16bpp hardware format */ -static void r128ConvertTexture16bpp(r128ContextPtr r128ctx, - struct gl_texture_image *image, - int x, int y, int width, int height, - int pitch) +static void r128ConvertTexture16bpp( CARD32 *dst, + struct gl_texture_image *image, + int x, int y, int width, int height, + int pitch ) { - CARD8 *src; - CARD32 pix; - int i, j; - - switch (image->Format) { - case GL_RGB: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; - for (j = width >> 1; j; j--) { - pix = ((R128PACKCOLOR565(src[0], src[1], src[2]) ) | - (R128PACKCOLOR565(src[3], src[4], src[5]) << 16)); - R128CCE(pix); - src += 6; - } - } - break; - - case GL_RGBA: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; - for (j = width >> 1; j; j--) { - pix = - ((R128PACKCOLOR4444(src[0], src[1], src[2], src[3]) ) | - (R128PACKCOLOR4444(src[4], src[5], src[6], src[7])<<16)); - R128CCE(pix); - src += 8; - } - } - break; - - case GL_ALPHA: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width >> 1; j; j--) { - pix = ((R128PACKCOLOR4444(0xff, 0xff, 0xff, src[0]) ) | - (R128PACKCOLOR4444(0xff, 0xff, 0xff, src[1]) << 16)); - R128CCE(pix); - src += 2; - } - } - break; - - case GL_LUMINANCE: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width >> 1; j; j--) { - pix = ((R128PACKCOLOR1555(src[0], src[0], src[0], 0xff) ) | - (R128PACKCOLOR1555(src[1], src[1], src[1], 0xff)<<16)); - R128CCE(pix); - src += 2; - } - } - break; - - case GL_LUMINANCE_ALPHA: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 2; - for (j = width >> 1; j; j--) { - pix = - ((R128PACKCOLOR4444(src[0], src[0], src[0], src[1]) ) | - (R128PACKCOLOR4444(src[2], src[2], src[2], src[3])<<16)); - R128CCE(pix); - src += 4; - } - } - break; - - case GL_INTENSITY: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width >> 1; j; j--) { - pix = - ((R128PACKCOLOR4444(src[0], src[0], src[0], src[0]) ) | - (R128PACKCOLOR4444(src[1], src[1], src[1], src[1])<<16)); - R128CCE(pix); - src += 2; - } - } - break; - - default: - fprintf(stderr, "r128ConvertTexture16bpp: unsupported format 0x%x\n", - image->Format); - } + CARD8 *src; + int i, j; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s: %d,%d at %d,%d\n", + __FUNCTION__, width, height, x, y ); + } + + + switch ( image->Format ) { + case GL_RGB: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; + for ( j = width >> 1 ; j ; j-- ) { + *dst++ = ((R128PACKCOLOR565( src[0], src[1], src[2] )) | + (R128PACKCOLOR565( src[3], src[4], src[5] ) << 16)); + src += 6; + } + } + break; + + case GL_RGBA: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; + for ( j = width >> 1 ; j ; j-- ) { + *dst++ = ((R128PACKCOLOR4444( src[0], src[1], src[2], src[3] )) | + (R128PACKCOLOR4444( src[4], src[5], src[6], src[7] ) << 16)); + src += 8; + } + } + break; + + case GL_ALPHA: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width >> 1 ; j ; j-- ) { + *dst++ = ((R128PACKCOLOR4444( 0xff, 0xff, 0xff, src[0] )) | + (R128PACKCOLOR4444( 0xff, 0xff, 0xff, src[1] ) << 16)); + src += 2; + } + } + break; + + case GL_LUMINANCE: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width >> 1 ; j ; j-- ) { + *dst++ = ((R128PACKCOLOR1555( src[0], src[0], src[0], 0xff )) | + (R128PACKCOLOR1555( src[1], src[1], src[1], 0xff ) << 16)); + src += 2; + } + } + break; + + case GL_LUMINANCE_ALPHA: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 2; + for ( j = width >> 1 ; j ; j-- ) { + *dst++ = ((R128PACKCOLOR4444( src[0], src[0], src[0], src[1] )) | + (R128PACKCOLOR4444( src[2], src[2], src[2], src[3] ) << 16)); + src += 4; + } + } + break; + + case GL_INTENSITY: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width >> 1 ; j ; j-- ) { + *dst++ = ((R128PACKCOLOR4444( src[0], src[0], src[0], src[0] )) | + (R128PACKCOLOR4444( src[1], src[1], src[1], src[1] ) << 16)); + src += 2; + } + } + break; + + default: + fprintf( stderr, "%s: unsupported format 0x%x\n", + __FUNCTION__, image->Format ); + break; + } } /* Convert a block of Mesa-formatted texture to a 32bpp hardware format */ -static void r128ConvertTexture32bpp(r128ContextPtr r128ctx, - struct gl_texture_image *image, - int x, int y, int width, int height, - int pitch) +static void r128ConvertTexture32bpp( CARD32 *dst, + struct gl_texture_image *image, + int x, int y, int width, int height, + int pitch ) { - CARD8 *src; - CARD32 pix; - int i, j; - - switch (image->Format) { - case GL_RGB: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; - for (j = width; j; j--) { - pix = R128PACKCOLOR8888(src[0], src[1], src[2], 0xff); - R128CCE(pix); - src += 3; - } - } - break; - - case GL_RGBA: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; - for (j = width; j; j--) { - pix = R128PACKCOLOR8888(src[0], src[1], src[2], src[3]); - R128CCE(pix); - src += 4; - } - } - break; - - case GL_ALPHA: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width; j; j--) { - pix = R128PACKCOLOR8888(0xff, 0xff, 0xff, src[0]); - R128CCE(pix); - src += 1; - } - } - break; - - case GL_LUMINANCE: - for (i = 0 ; i < height ; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width; j; j--) { - pix = R128PACKCOLOR8888(src[0], src[0], src[0], 0xff); - R128CCE(pix); - src += 1; - } - } - break; - - case GL_LUMINANCE_ALPHA: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 2; - for (j = width; j; j-- ) { - pix = R128PACKCOLOR8888(src[0], src[0], src[0], src[1]); - R128CCE(pix); - src += 2; - } - } - break; - - case GL_INTENSITY: - for (i = 0; i < height; i++) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for (j = width; j; j--) { - pix = R128PACKCOLOR8888(src[0], src[0], src[0], src[0]); - R128CCE(pix); - src += 1; - } - } - break; - - default: - fprintf(stderr, "r128ConvertTexture32bpp: unsupported format 0x%x\n", - image->Format); - } + CARD8 *src; + int i, j; + + switch ( image->Format ) { + case GL_RGB: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; + for ( j = width ; j ; j-- ) { + *dst++ = R128PACKCOLOR8888( src[0], src[1], src[2], 0xff ); + src += 3; + } + } + break; + + case GL_RGBA: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; + for ( j = width ; j ; j-- ) { + *dst++ = R128PACKCOLOR8888( src[0], src[1], src[2], src[3] ); + src += 4; + } + } + break; + + case GL_ALPHA: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width ; j ; j-- ) { + *dst++ = R128PACKCOLOR8888( 0xff, 0xff, 0xff, src[0] ); + src += 1; + } + } + break; + + case GL_LUMINANCE: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width ; j ; j-- ) { + *dst++ = R128PACKCOLOR8888( src[0], src[0], src[0], 0xff ); + src += 1; + } + } + break; + + case GL_LUMINANCE_ALPHA: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 2; + for ( j = width ; j ; j-- ) { + *dst++ = R128PACKCOLOR8888( src[0], src[0], src[0], src[1] ); + src += 2; + } + } + break; + + case GL_INTENSITY: + for ( i = 0 ; i < height ; i++ ) { + src = (CARD8 *)image->Data + ((y + i) * pitch + x); + for ( j = width ; j ; j-- ) { + *dst++ = R128PACKCOLOR8888( src[0], src[0], src[0], src[0] ); + src += 1; + } + } + break; + + default: + fprintf( stderr, "%s: unsupported format 0x%x\n", + __FUNCTION__, image->Format ); + break; + } } /* Upload the texture image associated with texture `t' at level `level' at the address relative to `start'. */ /* NOTE: This function is only called while holding the hardware lock */ -static void r128UploadSubImage(r128ContextPtr r128ctx, - r128TexObjPtr t, int level, - int x, int y, int width, int height) +static void r128UploadSubImage( r128ContextPtr r128ctx, + r128TexObjPtr t, int level, + int x, int y, int width, int height ) { - struct gl_texture_image *image; - int texelsPerDword = 0; - int imageWidth, imageHeight; - int remaining, rows; - int format, pitch, dwords; - CARD32 offset; - - /* Ensure we have a valid texture to upload */ - if (level < 0 || level > R128_TEX_MAXLEVELS) return; - if (!(image = t->tObj->Image[level])) return; - - /* FIXME: support RGB888 (i.e., 24bpp) textures? */ - switch (t->texelBytes) { - case 1: texelsPerDword = 4; break; - case 2: texelsPerDword = 2; break; - case 4: texelsPerDword = 1; break; - } - - /* FIXME: The sub image offset calcs are broken - they weren't a - * while ago? - */ - x = 0; - y = 0; - width = image->Width; - height = image->Height; - - imageWidth = image->Width; - imageHeight = image->Height; - - format = t->textureFormat >> 16; - - /* The texel upload routines have a minimum width, so force the size - if needed */ - if (imageWidth < texelsPerDword) { - int factor; - - factor = texelsPerDword / imageWidth; - imageWidth = texelsPerDword; - imageHeight /= factor; - if (imageHeight == 0) { - /* In this case, the texel converter will actually walk a - texel or two off the end of the image, but normal malloc - alignment should prevent it from ever causing a fault. */ - imageHeight = 1; - } - } - - /* We can't upload to a pitch less than 8 texels so we will need to - linearly upload all modified rows for textures smaller than this. - This makes the x/y/width/height different for the blitter and the - texture walker. */ - if (imageWidth >= 8) { - /* The texture walker and the blitter look identical */ - pitch = imageWidth >> 3; - } else { - int factor; - int y2; - int start, end; - - start = (y * imageWidth) & ~7; - end = (y + height) * imageWidth; - - if (end - start < 8) { - /* Handle the case where the total number of texels uploaded - is < 8 */ - x = 0; - y = start / 8; - width = end - start; - height = 1; - } else { - /* Upload some number of full 8 texel blit rows */ - factor = 8 / imageWidth; - - y2 = y + height - 1; - y /= factor; - y2 /= factor; - - x = 0; - width = 8; - height = y2 - y + 1; - } - - /* Fixed pitch of 8 */ - pitch = 1; - } - - dwords = width * height / texelsPerDword; - offset = t->bufAddr + t->image[level].offset; - -#if ENABLE_PERF_BOXES - /* Bump the performace counter */ - r128ctx->c_textureBytes += (dwords << 2); + struct gl_texture_image *image; + int texelsPerDword = 0; + int imageWidth, imageHeight; + int remaining, rows; + int format, dwords; + CARD32 pitch, offset; + drmBufPtr buffer; + CARD32 *dst; + int i; + + /* Ensure we have a valid texture to upload */ + if ( ( level < 0 ) || ( level > R128_TEX_MAXLEVELS ) ) + return; + + image = t->tObj->Image[level]; + if ( !image ) + return; + + switch ( t->texelBytes ) { + case 1: texelsPerDword = 4; break; + case 2: texelsPerDword = 2; break; + case 4: texelsPerDword = 1; break; + } + +#if 1 + /* FIXME: The subimage index calcs are wrong - who changed them? */ + x = 0; + y = 0; + width = image->Width; + height = image->Height; #endif - /* Fix offset for AGP textures */ - if (t->heap == R128_AGP_TEX_HEAP) - offset += R128_AGP_TEX_OFFSET + r128ctx->r128Screen->agpTexOffset; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) { - fprintf(stderr, "r128UploadSubImage: %d,%d of %d,%d at %d,%d\n", - width, height, image->Width, image->Height, x, y); - fprintf(stderr, " blit ofs: 0x%08x pitch: 0x%x dwords: %d " - "level: %d format: %x\n", - (int)offset, pitch, dwords, level, format); - } - - /* Subdivide the texture if required */ - if (dwords < R128_CCE_PACKET_MAX_DWORDS) { - rows = height; - } else { - rows = (R128_CCE_PACKET_MAX_DWORDS * texelsPerDword) / (2 * width); - } - - /* Flush the pixel cache, and mark the contents as Read Invalid */ - R128CCE0(R128_CCE_PACKET0, R128_PC_GUI_CTLSTAT, 0); - R128CCE(r128ctx->regs.pc_gui_ctlstat | - R128_PC_RI_GUI | - R128_PC_FLUSH_GUI); - R128CCE_SUBMIT_PACKET(); - - /* Build the CCE host data blit header */ - R128CCE3(R128_CCE_PACKET3_CNTL_HOSTDATA_BLT, 0); - - /* DP_GUI_MASTER_CNTL */ - R128CCE(R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (format << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_HOST_DATA | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS ); - - /* DST_OFFSET_PITCH - fixed at the moment until we get better ring - control */ - R128CCE((pitch << 21) | (offset>>5)); - - /* FRGD_COLOR, BKGD_COLOR */ - R128CCE(0xffffffff); - R128CCE(0xffffffff); - - for (remaining = height; remaining > 0; remaining -= rows, y += rows) { - height = (remaining >= rows) ? rows : remaining; - dwords = width * height / texelsPerDword; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) { - fprintf(stderr, " blitting: %d,%d at %d,%d - %d dwords\n", - width, height, x, y, dwords); - } - - r128ctx->CCEbuf[0] &= ~R128_CCE_PACKET_COUNT_MASK; - r128ctx->CCEbuf[0] |= (dwords + 6) << 16; - - /* Blit coords, size */ - R128CCE((y << 16) | x); - R128CCE((height << 16) | width); - R128CCE(dwords); - - /* Actually do the texture conversion */ - switch (t->texelBytes) { - case 1: - r128ConvertTexture8bpp(r128ctx, image, - x, y, width, height, width); - break; - case 2: - r128ConvertTexture16bpp(r128ctx, image, - x, y, width, height, width); - break; - case 4: - r128ConvertTexture32bpp(r128ctx, - image, x, y, width, height, width); - break; - } + imageWidth = image->Width; + imageHeight = image->Height; + + format = t->textureFormat >> 16; + + /* The texel upload routines have a minimum width, so force the size + * if needed. + */ + if ( imageWidth < texelsPerDword ) { + int factor; + + factor = texelsPerDword / imageWidth; + imageWidth = texelsPerDword; + imageHeight /= factor; + if ( imageHeight == 0 ) { + /* In this case, the texel converter will actually walk a + * texel or two off the end of the image, but normal malloc + * alignment should prevent it from ever causing a fault. + */ + imageHeight = 1; + } + } + + /* We can't upload to a pitch less than 8 texels so we will need to + * linearly upload all modified rows for textures smaller than this. + * This makes the x/y/width/height different for the blitter and the + * texture walker. + */ + if ( imageWidth >= 8 ) { + /* The texture walker and the blitter look identical */ + pitch = imageWidth >> 3; + } else { + int factor; + int y2; + int start, end; + + start = (y * imageWidth) & ~7; + end = (y + height) * imageWidth; + + if ( end - start < 8 ) { + /* Handle the case where the total number of texels + * uploaded is < 8. + */ + x = 0; + y = start / 8; + width = end - start; + height = 1; + } else { + /* Upload some number of full 8 texel blit rows */ + factor = 8 / imageWidth; + + y2 = y + height - 1; + y /= factor; + y2 /= factor; + + x = 0; + width = 8; + height = y2 - y + 1; + } + + /* Fixed pitch of 8 */ + pitch = 1; + } + + dwords = width * height / texelsPerDword; + offset = t->bufAddr + t->image[level].offset; + + /* Fix offset for AGP textures */ + if ( t->heap == R128_AGP_TEX_HEAP ) { + offset += R128_AGP_TEX_OFFSET + r128ctx->r128Screen->agpTexOffset; + } - /* Flush the pixel cache */ - R128CCE0(R128_CCE_PACKET0, R128_PC_GUI_CTLSTAT, 0 ); - R128CCE(r128ctx->regs.pc_gui_ctlstat | R128_PC_FLUSH_GUI); +#if ENABLE_PERF_BOXES + /* Bump the performace counter */ + r128ctx->c_textureBytes += (dwords << 2); +#endif - /* Save the partial blit header */ - R128CCE_SUBMIT_PACKET(); - r128ctx->CCEcount = 5; - } - /* Clean up CCE ring buffer */ - r128ctx->CCEcount = 0; + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "r128UploadSubImage: %d,%d of %d,%d at %d,%d\n", + width, height, image->Width, image->Height, x, y ); + fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d " + "level: %d format: %x\n", + (int)offset, pitch, dwords, level, format ); + } + + /* Subdivide the texture if required */ + if ( dwords <= R128_BUFFER_MAX_DWORDS / 2 ) { + rows = height; + } else { + rows = (R128_BUFFER_MAX_DWORDS * texelsPerDword) / (2 * width); + } + + for ( i = 0, remaining = height ; + remaining > 0 ; + remaining -= rows, y += rows, i++ ) + { + height = (remaining >= rows) ? rows : remaining; + dwords = width * height / texelsPerDword; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, " blitting: %d,%d at %d,%d - %d dwords\n", + width, height, x, y, dwords ); + } + + /* Grab the indirect buffer for the texture blit */ + buffer = r128GetBufferLocked( r128ctx ); + + dst = (CARD32 *)((char *)buffer->address + R128_HOSTDATA_BLIT_OFFSET); + + /* Actually do the texture conversion */ + switch ( t->texelBytes ) { + case 1: + r128ConvertTexture8bpp( dst, image, + x, y, width, height, width ); + break; + case 2: + r128ConvertTexture16bpp( dst, image, + x, y, width, height, width ); + break; + case 4: + r128ConvertTexture32bpp( dst, image, + x, y, width, height, width ); + break; + } + + r128FireBlitLocked( r128ctx, buffer, + offset, pitch, format, + x, y, width, height ); + } + + r128ctx->new_state |= R128_NEW_CONTEXT; + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; } /* Upload the texture images associated with texture `t'. This might - require removing our own and/or other client's texture objects to - make room for these images. */ + * require removing our own and/or other client's texture objects to + * make room for these images. + */ /* NOTE: This function is only called while holding the hardware lock */ -int r128UploadTexImages(r128ContextPtr r128ctx, r128TexObjPtr t) +int r128UploadTexImages( r128ContextPtr r128ctx, r128TexObjPtr t ) { - int i; - int minLevel; - int maxLevel; - int heap; - - if (!t) return 0; - - /* Choose the heap appropriately */ - heap = t->heap = R128_LOCAL_TEX_HEAP; - if (!r128ctx->r128Screen->IsPCI && - t->totalSize > r128ctx->r128Screen->texSize[heap]) - heap = t->heap = R128_AGP_TEX_HEAP; - - /* Do we need to eject LRU texture objects? */ - if (!t->memBlock) { - /* Allocate a memory block on a 4k boundary (1<<12 == 4096) */ - t->memBlock = mmAllocMem(r128ctx->texHeap[heap], t->totalSize, 12, 0); - - /* Try AGP before kicking anything out of local mem */ - if (!t->memBlock && heap == R128_LOCAL_TEX_HEAP) { - t->memBlock = mmAllocMem(r128ctx->texHeap[R128_AGP_TEX_HEAP], - t->totalSize, 12, 0); - - if (t->memBlock) heap = t->heap = R128_AGP_TEX_HEAP; - } - - /* Kick out textures until the requested texture fits */ - while (!t->memBlock) { - if (r128ctx->TexObjList[heap].prev->bound) { - fprintf(stderr, - "r128UploadTexImages: ran into bound texture\n"); - return -1; - } - if (r128ctx->TexObjList[heap].prev == - &(r128ctx->TexObjList[heap])) { - if (r128ctx->r128Screen->IsPCI) { - fprintf(stderr, "r128UploadTexImages: upload texture " - "failure on local texture heaps, sz=%d\n", - t->totalSize); - return -1; - } else if (heap == R128_LOCAL_TEX_HEAP) { - heap = t->heap = R128_AGP_TEX_HEAP; - continue; - } else { - fprintf(stderr, "r128UploadTexImages: upload texture " - "failure on both local and AGP texture heaps, " - "sz=%d\n", - t->totalSize); - return -1; - } - } - - r128DestroyTexObj(r128ctx, r128ctx->TexObjList[heap].prev); - - t->memBlock = mmAllocMem(r128ctx->texHeap[heap], - t->totalSize, 12, 0); - } - - /* Set the base offset of the texture image */ - t->bufAddr = r128ctx->r128Screen->texOffset[heap] + t->memBlock->ofs; - - maxLevel = ((t->regs.size_pitch & R128_TEX_SIZE_MASK) >> - R128_TEX_SIZE_SHIFT); - minLevel = ((t->regs.size_pitch & R128_TEX_MIN_SIZE_MASK) >> - R128_TEX_MIN_SIZE_SHIFT); - - /* Update the hardware's texture image addresses */ - switch (t->bound) { - case 1: - /* Set texture offsets */ - if (t->regs.tex_cntl & R128_MIP_MAP_DISABLE) { - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.prim_tex_offset[i] = t->bufAddr; - } else { - for (i = maxLevel; i >= minLevel; i--) - r128ctx->regs.prim_tex_offset[i] = - t->image[maxLevel-i].offset + t->bufAddr; - } - /* Fix AGP texture offsets */ - if (heap == R128_AGP_TEX_HEAP) - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.prim_tex_offset[i] += - R128_AGP_TEX_OFFSET + - r128ctx->r128Screen->agpTexOffset; - /* Force loading the new state into the hardware */ - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_TEX0STATE; - break; - - case 2: - /* Set texture offsets */ - if (t->regs.tex_cntl & R128_MIP_MAP_DISABLE) { - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.sec_tex_offset[i] = t->bufAddr; - } else { - for (i = maxLevel; i >= minLevel; i--) - r128ctx->regs.sec_tex_offset[i] = - t->image[maxLevel-i].offset + t->bufAddr; - } - /* Fix AGP texture offsets */ - if (heap == R128_AGP_TEX_HEAP) - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.sec_tex_offset[i] += - R128_AGP_TEX_OFFSET + - r128ctx->r128Screen->agpTexOffset; - /* Force loading the new state into the hardware */ - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_TEX1STATE; - break; - - default: + int i; + int minLevel; + int maxLevel; + int heap; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %p )\n", + __FUNCTION__, r128ctx->glCtx, t ); + } + + if ( !t ) return 0; + + /* Choose the heap appropriately */ + heap = t->heap = R128_LOCAL_TEX_HEAP; + if ( !r128ctx->r128Screen->IsPCI && + t->totalSize > r128ctx->r128Screen->texSize[heap] ) { + heap = t->heap = R128_AGP_TEX_HEAP; + } + + /* Do we need to eject LRU texture objects? */ + if ( !t->memBlock ) { + /* Allocate a memory block on a 4k boundary (1<<12 == 4096) */ + t->memBlock = mmAllocMem( r128ctx->texHeap[heap], t->totalSize, 12, 0 ); + + /* Try AGP before kicking anything out of local mem */ + if ( !t->memBlock && heap == R128_LOCAL_TEX_HEAP ) { + t->memBlock = mmAllocMem( r128ctx->texHeap[R128_AGP_TEX_HEAP], + t->totalSize, 12, 0 ); + + if ( t->memBlock ) + heap = t->heap = R128_AGP_TEX_HEAP; + } + + /* Kick out textures until the requested texture fits */ + while ( !t->memBlock ) { + if ( r128ctx->TexObjList[heap].prev->bound ) { + fprintf( stderr, + "r128UploadTexImages: ran into bound texture\n" ); return -1; - } - } - - /* Let the world know we've used this memory recently */ - r128UpdateTexLRU(r128ctx, t); - - /* Upload any images that are new */ - if (t->dirty_images) { - int num_levels = (((t->regs.size_pitch & R128_TEX_SIZE_MASK) >> - R128_TEX_SIZE_SHIFT) - - ((t->regs.size_pitch & R128_TEX_MIN_SIZE_MASK) >> - R128_TEX_MIN_SIZE_SHIFT)); - - for (i = 0; i <= num_levels; i++) { - if (t->dirty_images & (1<<i)) { - r128UploadSubImage(r128ctx, t, i, 0, 0, - t->image[i].width, t->image[i].height); + } + if ( r128ctx->TexObjList[heap].prev == &r128ctx->TexObjList[heap] ) { + if ( r128ctx->r128Screen->IsPCI ) { + fprintf( stderr, "r128UploadTexImages: upload texture " + "failure on local texture heaps, sz=%d\n", + t->totalSize ); + return -1; + } else if ( heap == R128_LOCAL_TEX_HEAP ) { + heap = t->heap = R128_AGP_TEX_HEAP; + continue; + } else { + fprintf( stderr, "r128UploadTexImages: upload texture " + "failure on both local and AGP texture heaps, " + "sz=%d\n", + t->totalSize ); + return -1; } - } - - r128ctx->regs.tex_cntl_c |= R128_TEX_CACHE_FLUSH; + } + + r128DestroyTexObj( r128ctx, r128ctx->TexObjList[heap].prev ); + + t->memBlock = mmAllocMem( r128ctx->texHeap[heap], + t->totalSize, 12, 0 ); + } + + /* Set the base offset of the texture image */ + t->bufAddr = r128ctx->r128Screen->texOffset[heap] + t->memBlock->ofs; + + maxLevel = ((t->setup.tex_size_pitch & R128_TEX_SIZE_MASK) >> + R128_TEX_SIZE_SHIFT); + minLevel = ((t->setup.tex_size_pitch & R128_TEX_MIN_SIZE_MASK) >> + R128_TEX_MIN_SIZE_SHIFT); + + /* Set texture offsets */ + if ( t->setup.tex_cntl & R128_MIP_MAP_DISABLE ) { + for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + t->setup.tex_offset[i] = t->bufAddr; + } + } else { + for ( i = maxLevel ; i >= minLevel ; i-- ) { + t->setup.tex_offset[i] = + (t->image[maxLevel-i].offset + t->bufAddr); + } + } + /* Fix AGP texture offsets */ + if ( heap == R128_AGP_TEX_HEAP ) { + for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + t->setup.tex_offset[i] += R128_AGP_TEX_OFFSET + + r128ctx->r128Screen->agpTexOffset; + } + } + + /* Force loading the new state into the hardware */ + switch ( t->bound ) { + case 1: + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_TEX0; + break; + + case 2: + r128ctx->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_TEX1; + break; + + default: + return -1; + } + } + + /* Let the world know we've used this memory recently */ + r128UpdateTexLRU( r128ctx, t ); + + /* Upload any images that are new */ + if ( t->dirty_images ) { + int num_levels = (((t->setup.tex_size_pitch & R128_TEX_SIZE_MASK) >> + R128_TEX_SIZE_SHIFT) - + ((t->setup.tex_size_pitch & R128_TEX_MIN_SIZE_MASK) >> + R128_TEX_MIN_SIZE_SHIFT)); + + for ( i = 0 ; i <= num_levels ; i++ ) { + if ( t->dirty_images & (1 << i) ) { + r128UploadSubImage( r128ctx, t, i, 0, 0, + t->image[i].width, t->image[i].height ); + } + } + + r128ctx->setup.tex_cntl_c |= R128_TEX_CACHE_FLUSH; + + r128ctx->dirty |= R128_UPLOAD_CONTEXT; + } + + t->dirty_images = 0; + return 0; +} - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_ENGINESTATE; - } - t->dirty_images = 0; - return 0; -} +/* + * Texture combiners: + */ -/* Update the hardware state for texture unit 0 */ -/* NOTE: This function is only called while holding the hardware lock */ -static void r128UpdateTex0State(r128ContextPtr r128ctx) +#define COLOR_COMB_DISABLE (R128_COMB_DIS | \ + R128_COLOR_FACTOR_TEX) +#define COLOR_COMB_COPY_INPUT (R128_COMB_COPY_INP | \ + R128_COLOR_FACTOR_TEX) +#define COLOR_COMB_MODULATE (R128_COMB_MODULATE | \ + R128_COLOR_FACTOR_TEX) +#define COLOR_COMB_MODULATE_NTEX (R128_COMB_MODULATE | \ + R128_COLOR_FACTOR_NTEX) +#define COLOR_COMB_ADD (R128_COMB_ADD | \ + R128_COLOR_FACTOR_TEX) +#define COLOR_COMB_BLEND_TEX (R128_COMB_BLEND_TEXTURE | \ + R128_COLOR_FACTOR_TEX) + +#define ALPHA_COMB_DISABLE (R128_COMB_ALPHA_DIS | \ + R128_ALPHA_FACTOR_TEX_ALPHA) +#define ALPHA_COMB_COPY_INPUT (R128_COMB_ALPHA_COPY_INP | \ + R128_ALPHA_FACTOR_TEX_ALPHA) +#define ALPHA_COMB_MODULATE (R128_COMB_ALPHA_MODULATE | \ + R128_ALPHA_FACTOR_TEX_ALPHA) +#define ALPHA_COMB_MODULATE_NTEX (R128_COMB_ALPHA_MODULATE | \ + R128_ALPHA_FACTOR_NTEX_ALPHA) +#define ALPHA_COMB_ADD (R128_COMB_ADD | \ + R128_ALPHA_FACTOR_TEX_ALPHA) + +#define INPUT_INTERP (R128_INPUT_FACTOR_INT_COLOR | \ + R128_INP_FACTOR_A_INT_ALPHA) +#define INPUT_PREVIOUS (R128_INPUT_FACTOR_PREV_COLOR | \ + R128_INP_FACTOR_A_PREV_ALPHA) + +static void r128UpdateTextureStage( GLcontext *ctx, int unit ) { - GLcontext *ctx = r128ctx->glCtx; - r128TexObjPtr t; - struct gl_texture_object *tObj; - int i; - CARD32 tex_size_pitch, tex_combine_cntl; - - /* Only update the hardware texture state if the texture is current, - complete and enabled. */ - if (!(tObj = ctx->Texture.Unit[0].Current)) return; - if ((tObj != ctx->Texture.Unit[0].CurrentD[2]) && - (tObj != ctx->Texture.Unit[0].CurrentD[1])) return; - if (!tObj->Complete) return; - - /* If neither tex0 nor tex1 is enabled, then disable tex0. However, - if tex1 is enabled but tex0 is disabled, then we need to enable - tex0 and have it to copy the input (see how tex_combine_cntl is - setup below). */ - if (!(ctx->Texture.ReallyEnabled & (ENABLE_TEX0 | ENABLE_TEX1))) { - r128ctx->regs.tex_cntl_c &= ~R128_TEXMAP_ENABLE; - return; - } - - r128ctx->regs.scale_3d_cntl &= ~R128_TEX_CACHE_SPLIT; - - /* If this is the first time the texture has been used, then create - a new texture object for it. */ - t = tObj->DriverData; - if (!t) t = r128CreateTexObj(r128ctx, tObj); - if (!t) return; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) - fprintf(stderr, "r128UpdateTex0State(%p, 0x%08x)\n", - tObj, (int)t->dirty_images); - - /* Force any texture images to be loaded into the hardware */ - if (t->dirty_images) r128ctx->dirty |= R128_UPDATE_TEX0IMAGES; - - /* Bind texture to texture 0 unit */ - r128ctx->CurrentTexObj[0] = t; - t->bound = 1; - - if (t->memBlock) r128UpdateTexLRU(r128ctx, t); - - /* Set the texture environment state */ - switch (ctx->Texture.Unit[0].EnvMode) { - case GL_REPLACE: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - tex_combine_cntl = (R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_DIS | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case GL_RGB: - case GL_LUMINANCE: - tex_combine_cntl = (R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int source = r128ctx->tmu_source[unit]; + struct gl_texture_object *tObj; + r128TexObjPtr t; + GLuint enabled; + CARD32 combine; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %d )\n", + __FUNCTION__, ctx, unit ); + } + + enabled = (ctx->Texture.ReallyEnabled >> (source * 4)) & TEXTURE0_ANY; + if ( enabled != TEXTURE0_2D && enabled != TEXTURE0_1D ) + return; + + /* Only update the hardware texture state if the texture is current, + * complete and enabled. + */ + tObj = ctx->Texture.Unit[source].Current; + if ( !tObj || !tObj->Complete ) + return; + + if ( ( tObj != ctx->Texture.Unit[source].CurrentD[2] ) && + ( tObj != ctx->Texture.Unit[source].CurrentD[1] ) ) + return; + + /* We definately have a valid texture now */ + t = tObj->DriverData; + + if ( unit == 0 ) { + combine = INPUT_INTERP; + } else { + combine = INPUT_PREVIOUS; + } + + /* Set the texture environment state */ + switch ( ctx->Texture.Unit[source].EnvMode ) { + case GL_REPLACE: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + combine |= (COLOR_COMB_DISABLE | /* C = Ct */ + ALPHA_COMB_DISABLE); /* A = At */ + break; + case GL_RGB: + case GL_LUMINANCE: + combine |= (COLOR_COMB_DISABLE | /* C = Ct */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + break; + case GL_ALPHA: + combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */ + ALPHA_COMB_DISABLE); /* A = At */ + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_MODULATE: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + combine |= (COLOR_COMB_MODULATE | /* C = CfCt */ + ALPHA_COMB_MODULATE); /* A = AfAt */ + break; + case GL_RGB: + case GL_LUMINANCE: + combine |= (COLOR_COMB_MODULATE | /* C = CfCt */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + break; + case GL_ALPHA: + combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */ + ALPHA_COMB_MODULATE); /* A = AfAt */ + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_DECAL: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + combine |= (COLOR_COMB_BLEND_TEX | /* C = Cf(1-At)+CtAt */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + break; + case GL_RGB: + combine |= (COLOR_COMB_DISABLE | /* C = Ct */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + break; + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + /* Undefined behaviour - just copy the incoming fragment */ + combine |= (COLOR_COMB_COPY_INPUT | /* C = undefined */ + ALPHA_COMB_COPY_INPUT); /* A = undefined */ + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_BLEND: + /* Catch the cases of GL_BLEND we can't handle (yet, in some cases). + */ + if ( r128ctx->blend_flags ) { + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; + } + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_LUMINANCE_ALPHA: + switch ( r128ctx->env_color ) { + case 0x00000000: + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_MODULATE); /* A = AfAt */ break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_DIS | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_BLEND: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - switch (r128ctx->regs.constant_color_c & - R128_CONSTANT_COLOR_MASK) { - case R128_CONSTANT_COLOR_ZERO: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_NTEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case R128_CONSTANT_COLOR_ONE: - default: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; - break; + case 0xffffffff: + if ( unit == 0 ) { + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_MODULATE); /* A = AfAt */ + } else { + combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ } break; - case GL_RGB: - case GL_LUMINANCE: - switch (r128ctx->regs.constant_color_c & - R128_CONSTANT_COLOR_MASK) { - case R128_CONSTANT_COLOR_ZERO: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_NTEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case R128_CONSTANT_COLOR_ONE: - default: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; - break; - } + default: + combine |= (COLOR_COMB_MODULATE | /* C = fallback */ + ALPHA_COMB_MODULATE); /* A = fallback */ + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + } + break; + case GL_RGB: + case GL_LUMINANCE: + switch ( r128ctx->env_color ) { + case 0x00000000: + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ break; - case GL_INTENSITY: - switch (r128ctx->regs.constant_color_c & - R128_CONSTANT_COLOR_MASK) { - case R128_CONSTANT_COLOR_ZERO: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_NTEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_NTEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case R128_CONSTANT_COLOR_ONE: - default: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; - break; + case 0xffffffff: + if ( unit == 0 ) { + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + } else { + combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ } break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_MODULATE: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case GL_RGB: - case GL_LUMINANCE: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + default: + combine |= (COLOR_COMB_MODULATE | /* C = fallback */ + ALPHA_COMB_COPY_INPUT); /* A = fallback */ + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + } + break; + case GL_ALPHA: + combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */ + ALPHA_COMB_MODULATE); /* A = AfAt */ + break; + case GL_INTENSITY: + switch ( r128ctx->env_color ) { + case 0x00000000: + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_MODULATE_NTEX); /* A = Af(1-Ct) */ break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_DECAL: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - tex_combine_cntl = (R128_COMB_BLEND_TEXTURE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case GL_RGB: - tex_combine_cntl = (R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case GL_ALPHA: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - /* Undefined behaviour - just copy the input */ - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_ADD: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - tex_combine_cntl = (R128_COMB_ADD | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + case 0x00ffffff: + if ( unit == 0 ) { + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_MODULATE_NTEX); /* A = Af(1-Ct) */ + } else { + combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + } break; - case GL_RGB: - case GL_LUMINANCE: - tex_combine_cntl = (R128_COMB_ADD | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + case 0xffffffff: + if ( unit == 0 ) { + combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */ + ALPHA_COMB_MODULATE_NTEX); /* A = Af(1-Ct) */ + } else { + combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */ + ALPHA_COMB_ADD); /* A = Af+At */ + } break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); + default: + combine |= (COLOR_COMB_MODULATE | /* C = fallback */ + ALPHA_COMB_MODULATE); /* A = fallback */ + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - default: - return; - } - - /* If tex0 is disabled, then make sure it just copies the input */ - if (!(ctx->Texture.ReallyEnabled & ENABLE_TEX0)) - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_INT_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_INT_ALPHA); - - /* Enable tex0 */ - r128ctx->regs.tex_cntl_c |= R128_TEXMAP_ENABLE; - - tex_size_pitch = r128ctx->regs.tex_size_pitch_c; - tex_size_pitch &= ~R128_TEX_SIZE_PITCH_MASK; - tex_size_pitch |= t->regs.size_pitch << R128_TEX_SIZE_PITCH_SHIFT; - - /* Set the primary texture state in r128ctx->regs */ - r128ctx->regs.prim_tex_cntl_c = t->regs.tex_cntl; - r128ctx->regs.prim_texture_combine_cntl_c = tex_combine_cntl; - r128ctx->regs.tex_size_pitch_c = tex_size_pitch; - r128ctx->regs.prim_texture_border_color_c = t->regs.border_color; - - /* Set texture offsets */ - if (t->regs.tex_cntl & R128_MIP_MAP_DISABLE) { - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.prim_tex_offset[i] = t->bufAddr; - } else { - int maxLevel = ((t->regs.size_pitch & R128_TEX_SIZE_MASK) >> - R128_TEX_SIZE_SHIFT); - int minLevel = ((t->regs.size_pitch & R128_TEX_MIN_SIZE_MASK) >> - R128_TEX_MIN_SIZE_SHIFT); - for (i = maxLevel; i >= minLevel; i--) - r128ctx->regs.prim_tex_offset[i] = - t->image[maxLevel-i].offset + t->bufAddr; - } - /* Fix AGP texture offsets */ - if (t->heap == R128_AGP_TEX_HEAP) - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.prim_tex_offset[i] += - R128_AGP_TEX_OFFSET + r128ctx->r128Screen->agpTexOffset; - - /* Force loading the new state into the hardware */ - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_TEX0STATE | R128_CTX_ENGINESTATE; + } + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_ADD: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */ + ALPHA_COMB_MODULATE); /* A = AfAt */ + break; + case GL_RGB: + case GL_LUMINANCE: + combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */ + ALPHA_COMB_COPY_INPUT); /* A = Af */ + break; + case GL_ALPHA: + combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */ + ALPHA_COMB_MODULATE); /* A = AfAt */ + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + default: + return; + } + + t->setup.tex_combine_cntl = combine; } -/* Update the hardware state for texture unit 1 */ -/* NOTE: This function is only called while holding the hardware lock */ -static void r128UpdateTex1State(r128ContextPtr r128ctx) +static void r128UpdateTextureObject( GLcontext *ctx, int unit ) { - GLcontext *ctx = r128ctx->glCtx; - r128TexObjPtr t; - struct gl_texture_object *tObj; - int i; - CARD32 tex_size_pitch, tex_combine_cntl, tex_cntl; - - /* Only update the hardware texture state if the texture is current, - complete and enabled. */ - if (!(tObj = ctx->Texture.Unit[1].Current)) return; - if ((tObj != ctx->Texture.Unit[1].CurrentD[2]) && - (tObj != ctx->Texture.Unit[1].CurrentD[1])) return; - if (!tObj->Complete) return; - - /* If tex1 is not enabled, then disable it */ - if (!(ctx->Texture.ReallyEnabled & ENABLE_TEX1)) { - r128ctx->regs.tex_cntl_c &= ~R128_SEC_TEXMAP_ENABLE; - return; - } - - /* If te1 is enabled, split the texel cache */ - r128ctx->regs.scale_3d_cntl |= R128_TEX_CACHE_SPLIT; - - /* If this is the first time the texture has been used, then create - a new texture object for it. */ - t = tObj->DriverData; - if (!t) t = r128CreateTexObj(r128ctx, tObj); - if (!t) return; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) - fprintf(stderr, "r128UpdateTex1State(%p, 0x%08x)\n", - tObj, (int)t->dirty_images); - - /* Force any texture images to be loaded into the hardware */ - if (t->dirty_images) r128ctx->dirty |= R128_UPDATE_TEX1IMAGES; - - /* Bind texture to texture 1 unit */ - r128ctx->CurrentTexObj[1] = t; - t->bound = 2; - - if (t->memBlock) r128UpdateTexLRU(r128ctx, t); - - /* Set the texture environment state */ - switch (ctx->Texture.Unit[1].EnvMode) { - case GL_REPLACE: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - tex_combine_cntl = (R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_DIS | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_RGB: - case GL_LUMINANCE: - tex_combine_cntl = (R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_DIS | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_BLEND: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - switch ( r128ctx->regs.constant_color_c & R128_CONSTANT_COLOR_MASK ) { - case R128_CONSTANT_COLOR_ZERO: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_NTEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case R128_CONSTANT_COLOR_ONE: - default: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; - break; - } - break; - case GL_RGB: - case GL_LUMINANCE: - switch (r128ctx->regs.constant_color_c & - R128_CONSTANT_COLOR_MASK) { - case R128_CONSTANT_COLOR_ZERO: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_NTEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA ); - break; - case R128_CONSTANT_COLOR_ONE: - default: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA ); - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; - break; - } - break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_INTENSITY: - switch (r128ctx->regs.constant_color_c & - R128_CONSTANT_COLOR_MASK) { - case R128_CONSTANT_COLOR_ZERO: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_NTEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_NTEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case R128_CONSTANT_COLOR_ONE: - default: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; - break; - } - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_MODULATE: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_RGB: - case GL_LUMINANCE: - tex_combine_cntl = (R128_COMB_MODULATE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_DECAL: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - tex_combine_cntl = (R128_COMB_BLEND_TEXTURE | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_RGB: - tex_combine_cntl = (R128_COMB_DIS | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_ALPHA: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - /* Undefined behaviour - just copy the input */ - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_ADD: - switch (tObj->Image[0]->Format) { - case GL_RGBA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - tex_combine_cntl = (R128_COMB_ADD | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_RGB: - case GL_LUMINANCE: - tex_combine_cntl = (R128_COMB_ADD | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_COPY_INP | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_ALPHA: - tex_combine_cntl = (R128_COMB_COPY_INP | - R128_COLOR_FACTOR_TEX | - R128_INPUT_FACTOR_PREV_COLOR | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - default: - return; - } - - /* Enable tex1 */ - r128ctx->regs.tex_cntl_c |= R128_SEC_TEXMAP_ENABLE; - - tex_size_pitch = r128ctx->regs.tex_size_pitch_c; - tex_size_pitch &= ~R128_SEC_TEX_SIZE_PITCH_MASK; - tex_size_pitch |= t->regs.size_pitch << R128_SEC_TEX_SIZE_PITCH_SHIFT; - - tex_cntl = t->regs.tex_cntl | R128_SEC_SELECT_SEC_ST; - - /* Set the secondary texture state in r128ctx->regs */ - r128ctx->regs.sec_tex_cntl_c = tex_cntl; - r128ctx->regs.sec_tex_combine_cntl_c = tex_combine_cntl; - r128ctx->regs.tex_size_pitch_c = tex_size_pitch; - r128ctx->regs.sec_texture_border_color_c = t->regs.border_color; - - /* Set texture offsets */ - if (t->regs.tex_cntl & R128_MIP_MAP_DISABLE) { - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.sec_tex_offset[i] = t->bufAddr; - } else { - int maxLevel = ((t->regs.size_pitch & R128_TEX_SIZE_MASK) >> - R128_TEX_SIZE_SHIFT); - int minLevel = ((t->regs.size_pitch & R128_TEX_MIN_SIZE_MASK) >> - R128_TEX_MIN_SIZE_SHIFT); - for (i = maxLevel; i >= minLevel; i--) - r128ctx->regs.sec_tex_offset[i] = - t->image[maxLevel-i].offset + t->bufAddr; - } - /* Fix AGP texture offsets */ - if (t->heap == R128_AGP_TEX_HEAP) - for (i = 0; i < R128_TEX_MAXLEVELS; i++) - r128ctx->regs.sec_tex_offset[i] += - R128_AGP_TEX_OFFSET + r128ctx->r128Screen->agpTexOffset; - - /* Force loading the new state into the hardware */ - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_TEX1STATE | R128_CTX_ENGINESTATE; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int source = r128ctx->tmu_source[unit]; + struct gl_texture_object *tObj; + r128TexObjPtr t; + GLuint enabled; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %d ) really=0x%x\n", + __FUNCTION__, ctx, unit, ctx->Texture.ReallyEnabled ); + } + + /* Disable all texturing until it is known to be good */ + r128ctx->setup.tex_cntl_c &= ~(R128_TEXMAP_ENABLE | + R128_SEC_TEXMAP_ENABLE); + + enabled = (ctx->Texture.ReallyEnabled >> (source * 4)) & TEXTURE0_ANY; + if ( enabled != TEXTURE0_2D && enabled != TEXTURE0_1D ) { + if ( enabled ) + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; + return; + } + + /* Only update the hardware texture state if the texture is current, + * complete and enabled. + */ + tObj = ctx->Texture.Unit[source].Current; + if ( !tObj || !tObj->Complete ) { + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; + return; + } + + if ( ( tObj != ctx->Texture.Unit[source].CurrentD[2] ) && + ( tObj != ctx->Texture.Unit[source].CurrentD[1] ) ) { + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; + return; + } + + if ( !tObj->DriverData ) { + /* If this is the first time the texture has been used, then create + * a new texture object for it. + */ + r128CreateTexObj( r128ctx, tObj ); + + if ( !tObj->DriverData ) { + /* Can't create a texture object... */ + fprintf( stderr, "%s: texture object creation failed!\n", + __FUNCTION__ ); + r128ctx->Fallback |= R128_FALLBACK_TEXTURE; + return; + } + } + + /* We definately have a valid texture now */ + t = tObj->DriverData; + + /* Force the texture unit state to be loaded into the hardware */ + r128ctx->dirty |= R128_UPLOAD_CONTEXT | (R128_UPLOAD_TEX0 << unit); + + /* Force any texture images to be loaded into the hardware */ + if ( t->dirty_images ) + r128ctx->dirty |= (R128_UPLOAD_TEX0IMAGES << unit); + + /* Bind to the given texture unit */ + r128ctx->CurrentTexObj[unit] = t; + t->bound = unit + 1; + + if ( t->memBlock ) + r128UpdateTexLRU( r128ctx, t ); + + if ( unit == 0 ) { + r128ctx->setup.tex_cntl_c |= R128_TEXMAP_ENABLE; + r128ctx->setup.tex_size_pitch_c |= t->setup.tex_size_pitch << 0; + r128ctx->setup.scale_3d_cntl &= ~R128_TEX_CACHE_SPLIT; + + t->setup.tex_cntl &= ~R128_SEC_SELECT_SEC_ST; + } else { + t->setup.tex_cntl |= R128_SEC_SELECT_SEC_ST; + + r128ctx->setup.tex_cntl_c |= (R128_TEXMAP_ENABLE | + R128_SEC_TEXMAP_ENABLE) ; + r128ctx->setup.tex_size_pitch_c |= t->setup.tex_size_pitch << 16; + r128ctx->setup.scale_3d_cntl |= R128_TEX_CACHE_SPLIT; + } } /* Update the hardware texture state */ -/* NOTE: This function is only called while holding the hardware lock */ -void r128UpdateTextureState(r128ContextPtr r128ctx) +void r128UpdateTextureState( GLcontext *ctx ) { - /* Clear the GL_BLEND texturing fallback */ - r128ctx->Fallback &= ~R128_FALLBACK_TEXTURE; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p ) en=0x%x\n", + __FUNCTION__, ctx, ctx->Texture.ReallyEnabled ); + } + + /* Clear any texturing fallbacks */ + r128ctx->Fallback &= ~R128_FALLBACK_TEXTURE; /* Unbind any currently bound textures */ - if (r128ctx->CurrentTexObj[0]) r128ctx->CurrentTexObj[0]->bound = 0; - if (r128ctx->CurrentTexObj[1]) r128ctx->CurrentTexObj[1]->bound = 0; - r128ctx->CurrentTexObj[0] = NULL; - r128ctx->CurrentTexObj[1] = NULL; + if ( r128ctx->CurrentTexObj[0] ) r128ctx->CurrentTexObj[0]->bound = 0; + if ( r128ctx->CurrentTexObj[1] ) r128ctx->CurrentTexObj[1]->bound = 0; + r128ctx->CurrentTexObj[0] = NULL; + r128ctx->CurrentTexObj[1] = NULL; + + r128ctx->setup.tex_size_pitch_c = 0x00000000; + + r128UpdateTextureObject( ctx, 0 ); + r128UpdateTextureStage( ctx, 0 ); - if (r128ctx->glCtx->Enabled & (TEXTURE0_3D|TEXTURE1_3D)) - r128ctx->Fallback |= R128_FALLBACK_TEXTURE; + if ( r128ctx->multitex ) { + r128UpdateTextureObject( ctx, 1 ); + r128UpdateTextureStage( ctx, 1 ); + } - /* Update the texture unit 0/1 state */ - r128UpdateTex0State(r128ctx); - r128UpdateTex1State(r128ctx); + r128ctx->dirty |= R128_UPLOAD_CONTEXT; } + /* Set the texture wrap mode */ -static void r128SetTexWrap(r128TexObjPtr t, GLenum swrap, GLenum twrap) +static void r128SetTexWrap( r128TexObjPtr t, GLenum swrap, GLenum twrap ) { - t->regs.tex_cntl &= ~(R128_TEX_CLAMP_S_MASK | R128_TEX_CLAMP_T_MASK); - - switch (swrap) { - case GL_CLAMP: t->regs.tex_cntl |= R128_TEX_CLAMP_S_CLAMP; break; - case GL_REPEAT: t->regs.tex_cntl |= R128_TEX_CLAMP_S_WRAP; break; - default: /* ERROR!! */ return; - } - - switch (twrap) { - case GL_CLAMP: t->regs.tex_cntl |= R128_TEX_CLAMP_T_CLAMP; break; - case GL_REPEAT: t->regs.tex_cntl |= R128_TEX_CLAMP_T_WRAP; break; - default: /* ERROR!! */ return; - } + t->setup.tex_cntl &= ~(R128_TEX_CLAMP_S_MASK | R128_TEX_CLAMP_T_MASK); + + switch ( swrap ) { + case GL_CLAMP: + t->setup.tex_cntl |= R128_TEX_CLAMP_S_CLAMP; + break; + case GL_REPEAT: + t->setup.tex_cntl |= R128_TEX_CLAMP_S_WRAP; + break; + } + + switch ( twrap ) { + case GL_CLAMP: + t->setup.tex_cntl |= R128_TEX_CLAMP_T_CLAMP; + break; + case GL_REPEAT: + t->setup.tex_cntl |= R128_TEX_CLAMP_T_WRAP; + break; + } } /* Set the texture filter mode */ -static void r128SetTexFilter(r128TexObjPtr t, GLenum minf, GLenum magf) +static void r128SetTexFilter( r128TexObjPtr t, GLenum minf, GLenum magf ) { - t->regs.tex_cntl &= ~(R128_MIN_BLEND_MASK | R128_MAG_BLEND_MASK); - - switch (minf) { - case GL_NEAREST: - t->regs.tex_cntl |= R128_MIN_BLEND_NEAREST; - break; - case GL_LINEAR: - t->regs.tex_cntl |= R128_MIN_BLEND_LINEAR; - break; - case GL_NEAREST_MIPMAP_NEAREST: - t->regs.tex_cntl |= R128_MIN_BLEND_MIPNEAREST; - break; - case GL_LINEAR_MIPMAP_NEAREST: - t->regs.tex_cntl |= R128_MIN_BLEND_LINEARMIPNEAREST; - break; - case GL_NEAREST_MIPMAP_LINEAR: - t->regs.tex_cntl |= R128_MIN_BLEND_MIPLINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - t->regs.tex_cntl |= R128_MIN_BLEND_LINEARMIPLINEAR; - break; - default: /* ERROR!! */ return; - } - - switch (magf) { - case GL_NEAREST: - t->regs.tex_cntl |= R128_MAG_BLEND_NEAREST; - break; - case GL_LINEAR: - t->regs.tex_cntl |= R128_MAG_BLEND_LINEAR; - break; - } + t->setup.tex_cntl &= ~(R128_MIN_BLEND_MASK | R128_MAG_BLEND_MASK); + + switch ( minf ) { + case GL_NEAREST: + t->setup.tex_cntl |= R128_MIN_BLEND_NEAREST; + break; + case GL_LINEAR: + t->setup.tex_cntl |= R128_MIN_BLEND_LINEAR; + break; + case GL_NEAREST_MIPMAP_NEAREST: + t->setup.tex_cntl |= R128_MIN_BLEND_MIPNEAREST; + break; + case GL_LINEAR_MIPMAP_NEAREST: + t->setup.tex_cntl |= R128_MIN_BLEND_LINEARMIPNEAREST; + break; + case GL_NEAREST_MIPMAP_LINEAR: + t->setup.tex_cntl |= R128_MIN_BLEND_MIPLINEAR; + break; + case GL_LINEAR_MIPMAP_LINEAR: + t->setup.tex_cntl |= R128_MIN_BLEND_LINEARMIPLINEAR; + break; + } + + switch ( magf ) { + case GL_NEAREST: + t->setup.tex_cntl |= R128_MAG_BLEND_NEAREST; + break; + case GL_LINEAR: + t->setup.tex_cntl |= R128_MAG_BLEND_LINEAR; + break; + } } /* Set the texture border color */ -static void r128SetTexBorderColor(r128TexObjPtr t, GLubyte c[4]) +static void r128SetTexBorderColor( r128TexObjPtr t, GLubyte c[4] ) { - t->regs.border_color = r128PackColor(32, c[0], c[1], c[2], c[3]); + t->setup.tex_border_color = r128PackColor( 32, c[0], c[1], c[2], c[3] ); } + +/* +============================================================================ + +Driver functions called directly from mesa + +============================================================================ +*/ + + /* Set the texture environment state */ -static void r128DDTexEnv(GLcontext *ctx, GLenum target, GLenum pname, - const GLfloat *param) +static void r128DDTexEnv( GLcontext *ctx, GLenum target, + GLenum pname, const GLfloat *param ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - struct gl_texture_unit *texUnit; - GLubyte c[4]; - CARD32 col; - - /* FIXME: Add texture LOD bias extension */ - - switch (pname) { - case GL_TEXTURE_ENV_MODE: - /* TexEnv modes are handled in UpdateTextureState */ - FLUSH_BATCH(r128ctx); - r128ctx->dirty |= R128_UPDATE_TEXSTATE; - break; - case GL_TEXTURE_ENV_COLOR: - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - FLOAT_RGBA_TO_UBYTE_RGBA(texUnit->EnvColor, c); - col = r128PackColor(32, c[0], c[1], c[2], c[3]); - if (r128ctx->regs.constant_color_c != col) { - FLUSH_BATCH(r128ctx); - r128ctx->regs.constant_color_c = col; - - r128ctx->dirty |= R128_UPDATE_CONTEXT; - r128ctx->dirty_context |= R128_CTX_TEXENVSTATE; - } - break; - default: - return; - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + struct gl_texture_unit *texUnit; + GLubyte c[4]; + int bias; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %s )\n", + __FUNCTION__, gl_lookup_enum_by_nr( pname ) ); + } + + switch ( pname ) { + case GL_TEXTURE_ENV_MODE: + /* TexEnv modes are handled in UpdateTextureState */ + FLUSH_BATCH( r128ctx ); + r128ctx->new_state |= R128_NEW_TEXTURE | R128_NEW_ALPHA; + break; + + case GL_TEXTURE_ENV_COLOR: + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + FLOAT_RGBA_TO_UBYTE_RGBA( c, texUnit->EnvColor ); + r128ctx->env_color = r128PackColor( 32, c[0], c[1], c[2], c[3] ); + if ( r128ctx->setup.constant_color_c != r128ctx->env_color ) { + FLUSH_BATCH( r128ctx ); + r128ctx->setup.constant_color_c = r128ctx->env_color; + + r128ctx->new_state |= R128_NEW_TEXTURE; + + /* More complex multitexture/multipass fallbacks for GL_BLEND + * can be done later, but this allows a single pass GL_BLEND + * in some cases (ie. Performer town demo). + */ + r128ctx->blend_flags &= ~R128_BLEND_ENV_COLOR; + if ( r128ctx->env_color != 0x00000000 && + r128ctx->env_color != 0xff000000 /*&& + r128ctx->env_color != 0x00ffffff && + r128ctx->env_color != 0xffffffff */ ) { + r128ctx->blend_flags |= R128_BLEND_ENV_COLOR; + } + } + break; + + case GL_TEXTURE_LOD_BIAS_EXT: + /* GTH: This isn't exactly correct, but gives good results up to a + * certain point. It is better than completely ignoring the LOD + * bias. Unfortunately there isn't much range in the bias, the + * spec mentions strides that vary between 0.5 and 2.0 but these + * numbers don't seem to relate the the GL LOD bias value at all. + */ + if ( param[0] >= 1.0 ) { + bias = -128; + } else if ( param[0] >= 0.5 ) { + bias = -64; + } else if ( param[0] >= 0.25 ) { + bias = 0; + } else if ( param[0] >= 0.0 ) { + bias = 63; + } else { + bias = 127; + } + if ( r128ctx->lod_bias != bias ) { + FLUSH_BATCH( r128ctx ); + r128ctx->lod_bias = bias; + + r128ctx->new_state |= R128_NEW_RENDER; + } + break; + + default: + return; + } } /* Upload a new texture image */ -static void r128DDTexImage(GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, GLint level, - GLint internalFormat, - const struct gl_texture_image *image) +static void r128DDTexImage( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj, GLint level, + GLint internalFormat, + const struct gl_texture_image *image ) +{ + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + r128TexObjPtr t; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) + fprintf( stderr, "%s( %p, level %d )\n", __FUNCTION__, tObj, level ); + + if ( ( target != GL_TEXTURE_2D ) && ( target != GL_TEXTURE_1D ) ) return; + if ( level >= R128_TEX_MAXLEVELS ) return; + + t = (r128TexObjPtr)tObj->DriverData; + if ( t ) { + if ( t->bound ) FLUSH_BATCH( r128ctx ); + + /* Destroy the old texture, and upload a new one. The actual + * uploading of the texture image occurs in the UploadSubImage + * function. + */ + r128DestroyTexObj( r128ctx, t ); + r128ctx->new_state |= R128_NEW_TEXTURE; + } +} + +/* Upload a new texture sub-image */ +static void r128DDTexSubImage( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLint internalFormat, + const struct gl_texture_image *image ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128TexObjPtr t; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + r128TexObjPtr t; - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) - fprintf(stderr, "r128DDTexImage(%p, level %d)\n", tObj, level); + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, level %d ) size: %d,%d of %d,%d\n", + __FUNCTION__, tObj, level, width, height, + image->Width, image->Height ); + } - if ((target != GL_TEXTURE_2D) && (target != GL_TEXTURE_1D)) return; - if (level >= R128_TEX_MAXLEVELS) return; + if ( ( target != GL_TEXTURE_2D ) && ( target != GL_TEXTURE_1D ) ) return; + if ( level >= R128_TEX_MAXLEVELS ) return; - t = (r128TexObjPtr)tObj->DriverData; - if (t) { - if (t->bound) FLUSH_BATCH(r128ctx); + t = (r128TexObjPtr)tObj->DriverData; + if ( t ) { + if ( t->bound ) FLUSH_BATCH( r128ctx ); - /* Destroy the old texture, and upload a new one. The actual - uploading of the texture image occurs in the UploadSubImage - function. */ - r128DestroyTexObj(r128ctx, t); - r128ctx->dirty |= R128_UPDATE_TEXSTATE; - } -} + LOCK_HARDWARE( r128ctx ); + r128UploadSubImage( r128ctx, t, level, + xoffset, yoffset, width, height ); + UNLOCK_HARDWARE( r128ctx ); -/* Upload a new texture sub-image */ -static void r128DDTexSubImage(GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLint internalFormat, - const struct gl_texture_image *image) -{ - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128TexObjPtr t; - - if (R128_DEBUG_FLAGS & DEBUG_VERBOSE_API) - fprintf(stderr, "r128DDTexSubImage(%p, level %d) " - "size: %d,%d of %d,%d\n", - tObj, level, width, height, image->Width, image->Height); - - if ((target != GL_TEXTURE_2D) && (target != GL_TEXTURE_1D)) return; - if (level >= R128_TEX_MAXLEVELS) return; - - t = (r128TexObjPtr)tObj->DriverData; - if (t) { - if (t->bound) FLUSH_BATCH(r128ctx); - - LOCK_HARDWARE(r128ctx); - r128UploadSubImage(r128ctx, t, level, - xoffset, yoffset, width, height); - UNLOCK_HARDWARE(r128ctx); - - /* Update the context state */ - r128ctx->regs.tex_cntl_c |= R128_TEX_CACHE_FLUSH; - - r128ctx->dirty |= (R128_UPDATE_CONTEXT | - R128_UPDATE_TEXSTATE); - r128ctx->dirty_context |= (R128_CTX_ENGINESTATE | - R128_CTX_TEX0STATE | - R128_CTX_TEX1STATE); - } + /* Update the context state */ + r128ctx->setup.tex_cntl_c |= R128_TEX_CACHE_FLUSH; + + r128ctx->new_state |= R128_NEW_TEXTURE; + } } /* Set the texture parameter state */ -static void r128DDTexParameter(GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, - GLenum pname, const GLfloat *params) +static void r128DDTexParameter( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj, + GLenum pname, const GLfloat *params ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData; - - if (!t) return; - if ((target != GL_TEXTURE_2D) && (target != GL_TEXTURE_1D)) return; - - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - if (t->bound) FLUSH_BATCH(r128ctx); - r128SetTexFilter(t, tObj->MinFilter, tObj->MagFilter); - break; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - if (t->bound) FLUSH_BATCH(r128ctx); - r128SetTexWrap(t, tObj->WrapS, tObj->WrapT); - break; - - case GL_TEXTURE_BORDER_COLOR: - if (t->bound) FLUSH_BATCH(r128ctx); - r128SetTexBorderColor(t, tObj->BorderColor); - break; - - default: - return; - } - - r128ctx->dirty |= R128_UPDATE_TEXSTATE; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %s )\n", + __FUNCTION__, gl_lookup_enum_by_nr( pname ) ); + } + + if ( !t || !t->bound ) return; + if ( ( target != GL_TEXTURE_2D ) && ( target != GL_TEXTURE_1D ) ) return; + + switch ( pname ) { + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + if ( t->bound ) FLUSH_BATCH( r128ctx ); + r128SetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); + break; + + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + if ( t->bound ) FLUSH_BATCH( r128ctx ); + r128SetTexWrap( t, tObj->WrapS, tObj->WrapT ); + break; + + case GL_TEXTURE_BORDER_COLOR: + if ( t->bound ) FLUSH_BATCH( r128ctx ); + r128SetTexBorderColor( t, tObj->BorderColor ); + break; + + default: + return; + } + + r128ctx->new_state |= R128_NEW_TEXTURE; } /* Bind a texture to the currently active texture unit */ -static void r128DDBindTexture(GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj) +static void r128DDBindTexture( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + GLint unit = ctx->Texture.CurrentUnit; + + if ( R128_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p ) unit=%d\n", + __FUNCTION__, tObj, unit ); + } - FLUSH_BATCH(r128ctx); + FLUSH_BATCH( r128ctx ); - /* Unbind the old texture */ - if (r128ctx->CurrentTexObj[ctx->Texture.CurrentUnit]) { - r128ctx->CurrentTexObj[ctx->Texture.CurrentUnit]->bound = 0; - r128ctx->CurrentTexObj[ctx->Texture.CurrentUnit] = NULL; - } + /* Unbind the old texture */ + if ( r128ctx->CurrentTexObj[unit] ) { + r128ctx->CurrentTexObj[unit]->bound &= ~(unit+1); + r128ctx->CurrentTexObj[unit] = NULL; + } - /* The actualy binding occurs in the Tex[01]UpdateState function */ - r128ctx->dirty |= R128_UPDATE_TEXSTATE; + /* The actualy binding occurs in the Tex[01]UpdateState function */ + r128ctx->new_state |= R128_NEW_TEXTURE; } /* Remove texture from AGP/local texture memory */ -static void r128DDDeleteTexture(GLcontext *ctx, - struct gl_texture_object *tObj) +static void r128DDDeleteTexture( GLcontext *ctx, + struct gl_texture_object *tObj ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData; - if (t) { - if (t->bound) { - FLUSH_BATCH(r128ctx); + if ( t ) { + if ( t->bound ) { + FLUSH_BATCH( r128ctx ); - r128ctx->CurrentTexObj[t->bound-1] = 0; - r128ctx->dirty |= R128_UPDATE_TEXSTATE; - } + r128ctx->CurrentTexObj[t->bound-1] = 0; + r128ctx->new_state |= R128_NEW_TEXTURE; + } - r128DestroyTexObj(r128ctx, t); - tObj->DriverData = NULL; - } + r128DestroyTexObj( r128ctx, t ); + tObj->DriverData = NULL; + } } /* Determine if a texture is currently residing in either AGP/local - texture memory */ -static GLboolean r128DDIsTextureResident(GLcontext *ctx, - struct gl_texture_object *tObj) + * texture memory. + */ +static GLboolean r128DDIsTextureResident( GLcontext *ctx, + struct gl_texture_object *tObj ) { - r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData; + r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData; - return t && t->memBlock; + return t && t->memBlock; } /* Initialize the driver's texture functions */ -void r128DDInitTextureFuncs(GLcontext *ctx) +void r128DDInitTextureFuncs( GLcontext *ctx ) { - ctx->Driver.TexEnv = r128DDTexEnv; - ctx->Driver.TexImage = r128DDTexImage; - ctx->Driver.TexSubImage = r128DDTexSubImage; - ctx->Driver.TexParameter = r128DDTexParameter; - ctx->Driver.BindTexture = r128DDBindTexture; - ctx->Driver.DeleteTexture = r128DDDeleteTexture; - ctx->Driver.UpdateTexturePalette = NULL; - ctx->Driver.ActiveTexture = NULL; - ctx->Driver.IsTextureResident = r128DDIsTextureResident; - ctx->Driver.PrioritizeTexture = NULL; + ctx->Driver.TexEnv = r128DDTexEnv; + ctx->Driver.TexImage = r128DDTexImage; + ctx->Driver.TexSubImage = r128DDTexSubImage; + ctx->Driver.TexParameter = r128DDTexParameter; + ctx->Driver.BindTexture = r128DDBindTexture; + ctx->Driver.DeleteTexture = r128DDDeleteTexture; + ctx->Driver.UpdateTexturePalette = NULL; + ctx->Driver.ActiveTexture = NULL; + ctx->Driver.IsTextureResident = r128DDIsTextureResident; + ctx->Driver.PrioritizeTexture = NULL; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h index ed1d5e2b5..d225765a6 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h @@ -1,8 +1,8 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.1 2000/06/17 00:03:08 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.2 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., - Cedar Park, Texas. + Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,8 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Gareth Hughes <gareth@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -38,12 +38,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING -extern void r128AgeTextures(r128ContextPtr r128ctx, int heap); -extern int r128UploadTexImages(r128ContextPtr r128ctx, r128TexObjPtr t); -extern void r128UpdateTextureState(r128ContextPtr r128ctx); -extern void r128DestroyTexObj(r128ContextPtr r128ctx, r128TexObjPtr t); +extern void r128UpdateTextureState( GLcontext *ctx ); + +extern int r128UploadTexImages( r128ContextPtr r128ctx, r128TexObjPtr t ); + +extern void r128AgeTextures( r128ContextPtr r128ctx, int heap ); +extern void r128DestroyTexObj( r128ContextPtr r128ctx, r128TexObjPtr t ); + +extern void r128PrintLocalLRU( r128ContextPtr r128ctx, int heap ); +extern void r128PrintGlobalLRU( r128ContextPtr r128ctx, int heap ); + +extern void r128DDInitTextureFuncs( GLcontext *ctx ); -extern void r128DDInitTextureFuncs(GLcontext *ctx); #define R128PACKCOLOR332(r, g, b) \ (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6)) @@ -64,16 +70,16 @@ extern void r128DDInitTextureFuncs(GLcontext *ctx); #define R128PACKCOLOR4444(r, g, b, a) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) -static __inline__ CARD32 r128PackColor(GLuint depth, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a) +static __inline__ CARD32 r128PackColor( GLuint depth, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { - switch (depth) { - case 8: return R128PACKCOLOR332(r, g, b); - case 15: return R128PACKCOLOR1555(r, g, b, a); - case 16: return R128PACKCOLOR565(r, g, b); - case 24: return R128PACKCOLOR888(r, g, b); - case 32: return R128PACKCOLOR8888(r, g, b, a); + switch ( depth ) { + case 8: return R128PACKCOLOR332( r, g, b ); + case 15: return R128PACKCOLOR1555( r, g, b, a ); + case 16: return R128PACKCOLOR565( r, g, b ); + case 24: return R128PACKCOLOR888( r, g, b ); + case 32: return R128PACKCOLOR8888( r, g, b, a ); default: return 0; } } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h b/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h index 504d35087..59b568321 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texobj.h,v 1.2 2000/09/27 03:39:03 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texobj.h,v 1.3 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,60 +28,55 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Gareth Hughes <gareth@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ #ifndef _R128_TEXOBJ_H_ #define _R128_TEXOBJ_H_ +#include "r128_sarea.h" #include "mm.h" -#define R128_TEX_MAXLEVELS 11 - -/* Setup registers for each texture */ -typedef struct { - CARD32 tex_cntl; - CARD32 size_pitch; - CARD32 border_color; -} r128TextureRegs; - /* Individual texture image information */ typedef struct { - int offset; /* Offset into locally shared texture space (i.e., + GLuint offset; /* Offset into locally shared texture space (i.e., relative to bufAddr (below) */ - int width; /* Width of texture image */ - int height; /* Height of texture image */ + GLuint width; /* Width of texture image */ + GLuint height; /* Height of texture image */ } r128TexImage; typedef struct r128_tex_obj r128TexObj, *r128TexObjPtr; /* Texture object in locally shared texture space */ struct r128_tex_obj { - r128TexObjPtr next, prev; + r128TexObjPtr next, prev; - struct gl_texture_object *tObj; /* Mesa texture object */ + struct gl_texture_object *tObj; /* Mesa texture object */ - PMemBlock memBlock; /* Memory block containing texture */ - CARD32 bufAddr; /* Offset to start of locally + PMemBlock memBlock; /* Memory block containing texture */ + CARD32 bufAddr; /* Offset to start of locally shared texture block */ - CARD32 dirty_images; /* Flags for whether or not + CARD32 dirty_images; /* Flags for whether or not images need to be uploaded to local or AGP texture space */ - int bound; /* Texture unit currently bound to */ - int heap; /* Texture heap currently stored in */ - r128TexImage image[R128_TEX_MAXLEVELS]; /* Image data for all - mipmap levels */ - int totalSize; /* Total size of the texture + + GLuint age; + GLint bound; /* Texture unit currently bound to */ + GLint heap; /* Texture heap currently stored in */ + r128TexImage image[R128_TEX_MAXLEVELS]; /* Image data for all + mipmap levels */ + + GLint totalSize; /* Total size of the texture including all mipmap levels */ - int internFormat; /* Internal GL format used to store + GLuint internFormat; /* Internal GL format used to store texture on card */ - int textureFormat; /* Actual hardware format */ - int texelBytes; /* Number of bytes per texel */ + CARD32 textureFormat; /* Actual hardware format */ + GLint texelBytes; /* Number of bytes per texel */ - r128TextureRegs regs; /* Setup regs for texture */ + r128_texture_regs_t setup; /* Setup regs for texture */ }; #endif /* _R128_TEXOBJ_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c index 2dc13af19..8d1053e90 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v 1.2 2000/08/25 13:42:31 dawes Exp $ */ /* -*- c-basic-offset: 4 -*- */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v 1.3 2000/12/04 19:21:47 dawes Exp $ */ /* -*- c-basic-offset: 3 -*- */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,35 +28,59 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_lock.h" -#include "r128_reg.h" -#include "r128_cce.h" +#include "r128_ioctl.h" #include "r128_vb.h" #include "r128_tris.h" #include "r128_state.h" +#include "pipeline.h" +#include "vbindirect.h" + static struct { - points_func points; - line_func line; - triangle_func tri; - quad_func quad; -} rast_tab[0x10]; + points_func points; + line_func line; + triangle_func triangle; + quad_func quad; +} rast_tab[R128_MAX_TRIFUNC]; #define R128_COLOR(to, from) \ do { \ - (to)[0] = (from)[2]; \ - (to)[1] = (from)[1]; \ - (to)[2] = (from)[0]; \ - (to)[3] = (from)[3]; \ + (to)[0] = (from)[2]; \ + (to)[1] = (from)[1]; \ + (to)[2] = (from)[0]; \ + (to)[3] = (from)[3]; \ } while (0) + +static void r128_null_quad( GLcontext *ctx, GLuint v0, + GLuint v1, GLuint v2, GLuint v3, GLuint pv ) { +} +static void r128_null_triangle( GLcontext *ctx, GLuint v0, + GLuint v1, GLuint v2, GLuint pv ) { +} +static void r128_null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) { +} + +static void r128_null_points( GLcontext *ctx, GLuint first, GLuint last ) { +} + +static void r128PrintRenderState( const char *msg, GLuint state ) +{ + fprintf( stderr, "%s: (0x%x) %s%s%s%s%s\n", + msg, state, + (state & R128_FLAT_BIT) ? "flat, " : "", + (state & R128_OFFSET_BIT) ? "offset, " : "", + (state & R128_TWOSIDE_BIT) ? "twoside, " : "", + (state & R128_NODRAW_BIT) ? "no-draw, " : "", + (state & R128_FALLBACK_BIT) ? "fallback" : "" ); +} + #define IND (0) #define TAG(x) x #include "r128_tritmp.h" @@ -89,75 +113,95 @@ do { \ #define TAG(x) x##_twoside_offset_flat #include "r128_tritmp.h" + /* Initialize the table of points, line and triangle drawing functions */ -void r128DDTriangleFuncsInit(void) +void r128DDTriangleFuncsInit( void ) { - init(); - init_flat(); - init_offset(); - init_offset_flat(); - init_twoside(); - init_twoside_flat(); - init_twoside_offset(); - init_twoside_offset_flat(); + int i; + + init(); + init_flat(); + init_offset(); + init_offset_flat(); + init_twoside(); + init_twoside_flat(); + init_twoside_offset(); + init_twoside_offset_flat(); + + for ( i = 0 ; i < 0x20 ; i++ ) { + if ( (i & (R128_NODRAW_BIT | R128_FALLBACK_BIT)) == R128_NODRAW_BIT ) { + rast_tab[i].points = r128_null_points; + rast_tab[i].line = r128_null_line; + rast_tab[i].triangle = r128_null_triangle; + rast_tab[i].quad = r128_null_quad; + } + } } - /* FIXME: Only enable software fallback for stencil in 16 bpp mode after - we have hardware stencil support */ -#define ALL_FALLBACK (DD_MULTIDRAW | DD_SELECT | DD_FEEDBACK | DD_STENCIL) -#define POINT_FALLBACK (ALL_FALLBACK | DD_POINT_SMOOTH) -#define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_SMOOTH | DD_LINE_STIPPLE) -#define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_STIPPLE | DD_TRI_UNFILLED) -#define ANY_FALLBACK (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK) + * we have hardware stencil support. + */ +#define ALL_FALLBACK (DD_MULTIDRAW | DD_SELECT | DD_FEEDBACK | DD_STENCIL) +#define POINT_FALLBACK (ALL_FALLBACK | DD_POINT_SMOOTH | DD_POINT_ATTEN) +#define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_SMOOTH | DD_LINE_STIPPLE) +#define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_STIPPLE | DD_TRI_UNFILLED) +#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK) +#define ANY_RASTER_FLAGS (/*DD_FLATSHADE |*/ DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_Z_NEVER) /* Setup the Point, Line, Triangle and Quad functions based on the - current rendering state. Wherever possible, use the hardware to - render the primitive. Otherwise, fallback to software rendering. */ -void r128DDChooseRenderState(GLcontext *ctx) + * current rendering state. Wherever possible, use the hardware to + * render the primitive. Otherwise, fallback to software rendering. + */ +void r128DDChooseRenderState( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - GLuint flags = ctx->TriangleCaps; - CARD32 index = 0; - - if (r128ctx->Fallback) { - r128ctx->RenderIndex = R128_FALLBACK_BIT; - return; - } - - if (flags & (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET)) { - if (flags & DD_FLATSHADE) index |= R128_FLAT_BIT; - if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R128_TWOSIDE_BIT; - if (flags & DD_TRI_OFFSET) index |= R128_OFFSET_BIT; - } - - r128ctx->PointsFunc = rast_tab[index].points; - r128ctx->LineFunc = rast_tab[index].line; - r128ctx->TriangleFunc = rast_tab[index].tri; - r128ctx->QuadFunc = rast_tab[index].quad; - - r128ctx->RenderIndex = index; - r128ctx->IndirectTriangles = 0; - - if (flags & ANY_FALLBACK) { - r128ctx->RenderIndex |= R128_FALLBACK_BIT; - - if (flags & POINT_FALLBACK) { - r128ctx->PointsFunc = 0; - r128ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE; - } - - if (flags & LINE_FALLBACK) { - r128ctx->LineFunc = 0; - r128ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE; - } - - if (flags & TRI_FALLBACK) { - r128ctx->TriangleFunc = 0; - r128ctx->QuadFunc = 0; - r128ctx->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | - DD_QUAD_SW_RASTERIZE); - } - } + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + GLuint flags = ctx->TriangleCaps; + CARD32 index = 0; + + if ( r128ctx->Fallback ) { + r128ctx->RenderIndex = R128_FALLBACK_BIT; + return; + } + + if ( flags & ANY_RASTER_FLAGS ) { + if ( flags & DD_FLATSHADE ) index |= R128_FLAT_BIT; + if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= R128_TWOSIDE_BIT; + if ( flags & DD_TRI_OFFSET ) index |= R128_OFFSET_BIT; + if ( flags & DD_Z_NEVER ) index |= R128_NODRAW_BIT; + } + + r128ctx->PointsFunc = rast_tab[index].points; + r128ctx->LineFunc = rast_tab[index].line; + r128ctx->TriangleFunc = rast_tab[index].triangle; + r128ctx->QuadFunc = rast_tab[index].quad; + + r128ctx->RenderIndex = index; + r128ctx->IndirectTriangles = 0; + + if ( flags & ANY_FALLBACK ) { + r128ctx->RenderIndex |= R128_FALLBACK_BIT; + + if ( flags & POINT_FALLBACK ) { + r128ctx->PointsFunc = 0; + r128ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE; + } + + if ( flags & LINE_FALLBACK ) { + r128ctx->LineFunc = 0; + r128ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + } + + if ( flags & TRI_FALLBACK ) { + r128ctx->TriangleFunc = 0; + r128ctx->QuadFunc = 0; + r128ctx->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + } + } + + if ( 0 ) { + gl_print_tri_caps( "tricaps", ctx->TriangleCaps ); + r128PrintRenderState( "r128 render state", r128ctx->RenderIndex ); + } } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h index c6f4db2ad..364aa02c9 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.2 2000/08/25 13:42:31 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.3 2000/12/04 19:21:47 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -42,154 +43,277 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r128DDChooseRenderState(GLcontext *ctx); extern void r128DDTriangleFuncsInit(void); -#define R128_FLAT_BIT 0x01 -#define R128_OFFSET_BIT 0x02 -#define R128_TWOSIDE_BIT 0x04 -#define R128_FALLBACK_BIT 0x08 +#define R128_ANTIALIAS_BIT 0x00 /* Ignored for now */ +#define R128_FLAT_BIT 0x01 +#define R128_OFFSET_BIT 0x02 +#define R128_TWOSIDE_BIT 0x04 +#define R128_NODRAW_BIT 0x08 +#define R128_FALLBACK_BIT 0x10 +#define R128_MAX_TRIFUNC 0x20 /* Draw a triangle from the vertices in the vertex buffer */ -static __inline void r128DrawTriangleVB( r128ContextPtr r128ctx, +static __inline void r128_draw_triangle( r128ContextPtr r128ctx, r128Vertex *v0, r128Vertex *v1, r128Vertex *v2 ) { - int vertsize = r128ctx->vertsize; - CARD32 *vb = r128AllocVertexDwordsInlined( r128ctx, 3 * vertsize ); - int j; + int vertsize = r128ctx->vertsize; + CARD32 *vb = r128AllocVerticesInline( r128ctx, 3 ); + int j; #if defined (USE_X86_ASM) - /* GTH: We can safely assume the vertex stride is some number of - * dwords, and thus a "rep movsd" is okay. The vb pointer is - * automagically updated with this instruction, so we don't have - * to manually take care of incrementing it. - */ - __asm__ __volatile__( "rep ; movsl" - : "=%c" (j) - : "0" (vertsize), "D" ((long)vb), "S" ((long)v0) - : "memory" ); - __asm__ __volatile__( "rep ; movsl" - : "=%c" (j) - : "0" (vertsize), "S" ((long)v1) - : "memory" ); - __asm__ __volatile__( "rep ; movsl" - : "=%c" (j) - : "0" (vertsize), "S" ((long)v2) - : "memory" ); + /* GTH: We can safely assume the vertex stride is some number of + * dwords, and thus a "rep movsd" is okay. The vb pointer is + * automagically updated with this instruction, so we don't have + * to manually take care of incrementing it. + */ + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "D" ((long)vb), "S" ((long)v0) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v1) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v2) + : "memory" ); #else - for (j = 0 ; j < vertsize ; j++) - vb[j] = v0->ui[j]; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v0->ui[j]; - vb += vertsize; - for (j = 0 ; j < vertsize ; j++) - vb[j] = v1->ui[j]; + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v1->ui[j]; - vb += vertsize; - for (j = 0 ; j < vertsize ; j++) - vb[j] = v2->ui[j]; + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v2->ui[j]; +#endif +} + +/* Draw a quad from the vertices in the vertex buffer */ +static __inline void r128_draw_quad( r128ContextPtr r128ctx, + r128Vertex *v0, + r128Vertex *v1, + r128Vertex *v2, + r128Vertex *v3 ) +{ + int vertsize = r128ctx->vertsize; + CARD32 *vb = r128AllocVerticesInline( r128ctx, 6 ); + int j; + +#if defined (USE_X86_ASM) + /* GTH: We can safely assume the vertex stride is some number of + * dwords, and thus a "rep movsd" is okay. The vb pointer is + * automagically updated with this instruction, so we don't have + * to manually take care of incrementing it. + */ + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "D" ((long)vb), "S" ((long)v0) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v1) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v3) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v1) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v2) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v3) + : "memory" ); +#else + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v0->ui[j]; + + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v1->ui[j]; + + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v3->ui[j]; + + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v1->ui[j]; + + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v2->ui[j]; + + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = v3->ui[j]; #endif } /* Draw a line from the vertices in the vertex buffer */ -static __inline void r128DrawLineVB( r128ContextPtr r128ctx, +static __inline void r128_draw_line( r128ContextPtr r128ctx, r128Vertex *tmp0, r128Vertex *tmp1, float width ) { - int vertsize = r128ctx->vertsize; - CARD32 *vb = r128AllocVertexDwordsInlined( r128ctx, 6 * vertsize ); - float dx, dy, ix, iy; - int j; - - dx = tmp0->vert1.x - tmp1->vert1.x; - dy = tmp0->vert1.y - tmp1->vert1.y; - - ix = width * .5; iy = 0; - - if ((ix<.5) && (ix>0.1)) ix = .5; /* I want to see lines with width - 0.5 also */ - - if (dx * dx > dy * dy) { - iy = ix; ix = 0; - } - - *(float *)&vb[0] = tmp0->vert1.x - ix; - *(float *)&vb[1] = tmp0->vert1.y - iy; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp0->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp1->vert1.x + ix; - *(float *)&vb[1] = tmp1->vert1.y + iy; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp1->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp0->vert1.x + ix; - *(float *)&vb[1] = tmp0->vert1.y + iy; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp0->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp0->vert1.x - ix; - *(float *)&vb[1] = tmp0->vert1.y - iy; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp0->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp1->vert1.x - ix; - *(float *)&vb[1] = tmp1->vert1.y - iy; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp1->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp1->vert1.x + ix; - *(float *)&vb[1] = tmp1->vert1.y + iy; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp1->ui[j]; +#if 1 + int vertsize = r128ctx->vertsize; + CARD32 *vb = r128AllocVerticesInline( r128ctx, 6 ); + float dx, dy, ix, iy; + int j; + + dx = tmp0->v.x - tmp1->v.x; + dy = tmp0->v.y - tmp1->v.y; + + ix = width * .5; iy = 0; + + if ((ix<.5) && (ix>0.1)) ix = .5; /* I want to see lines with width + 0.5 also */ + + if (dx * dx > dy * dy) { + iy = ix; ix = 0; + } + + *(float *)&vb[0] = tmp0->v.x - ix; + *(float *)&vb[1] = tmp0->v.y - iy; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp0->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp1->v.x + ix; + *(float *)&vb[1] = tmp1->v.y + iy; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp1->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp0->v.x + ix; + *(float *)&vb[1] = tmp0->v.y + iy; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp0->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp0->v.x - ix; + *(float *)&vb[1] = tmp0->v.y - iy; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp0->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp1->v.x - ix; + *(float *)&vb[1] = tmp1->v.y - iy; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp1->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp1->v.x + ix; + *(float *)&vb[1] = tmp1->v.y + iy; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp1->ui[j]; + +#else + + int vertsize = r128ctx->vertsize; + CARD32 *vb = r128AllocVerticesInline( r128ctx, 2 ); + int j; + +#if defined (USE_X86_ASM) + /* GTH: We can safely assume the vertex stride is some number of + * dwords, and thus a "rep movsd" is okay. The vb pointer is + * automagically updated with this instruction, so we don't have + * to manually take care of incrementing it. + */ + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "D" ((long)vb), "S" ((long)tmp0) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)tmp1) + : "memory" ); +#else + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = tmp0->ui[j]; + + vb += vertsize; + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = tmp1->ui[j]; +#endif +#endif } /* Draw a point from the vertices in the vertex buffer */ -static __inline void r128DrawPointVB( r128ContextPtr r128ctx, +static __inline void r128_draw_point( r128ContextPtr r128ctx, r128Vertex *tmp, float sz ) { - int vertsize = r128ctx->vertsize; - CARD32 *vb = r128AllocVertexDwordsInlined( r128ctx, 6 * vertsize ); - int j; - - *(float *)&vb[0] = tmp->vert1.x - sz; - *(float *)&vb[1] = tmp->vert1.y - sz; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp->vert1.x + sz; - *(float *)&vb[1] = tmp->vert1.y - sz; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp->vert1.x + sz; - *(float *)&vb[1] = tmp->vert1.y + sz; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp->vert1.x + sz; - *(float *)&vb[1] = tmp->vert1.y + sz; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp->vert1.x - sz; - *(float *)&vb[1] = tmp->vert1.y + sz; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; - vb += vertsize; - - *(float *)&vb[0] = tmp->vert1.x - sz; - *(float *)&vb[1] = tmp->vert1.y - sz; - for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; +#if 1 + int vertsize = r128ctx->vertsize; + CARD32 *vb = r128AllocVerticesInline( r128ctx, 6 ); + int j; + + *(float *)&vb[0] = tmp->v.x - sz; + *(float *)&vb[1] = tmp->v.y - sz; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp->v.x + sz; + *(float *)&vb[1] = tmp->v.y - sz; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp->v.x + sz; + *(float *)&vb[1] = tmp->v.y + sz; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp->v.x + sz; + *(float *)&vb[1] = tmp->v.y + sz; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp->v.x - sz; + *(float *)&vb[1] = tmp->v.y + sz; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp->ui[j]; + vb += vertsize; + + *(float *)&vb[0] = tmp->v.x - sz; + *(float *)&vb[1] = tmp->v.y - sz; + for (j = 2 ; j < vertsize ; j++) + vb[j] = tmp->ui[j]; +#else + + int vertsize = r128ctx->vertsize; + CARD32 *vb = r128AllocVerticesInline( r128ctx, 1 ); + int j; + +#if defined (USE_X86_ASM) + /* GTH: We can safely assume the vertex stride is some number of + * dwords, and thus a "rep movsd" is okay. The vb pointer is + * automagically updated with this instruction, so we don't have + * to manually take care of incrementing it. + */ + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "D" ((long)vb), "S" ((long)tmp) + : "memory" ); +#else + for ( j = 0 ; j < vertsize ; j++ ) + vb[j] = tmp->ui[j]; +#endif +#endif } #endif diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tritmp.h b/xc/lib/GL/mesa/src/drv/r128/r128_tritmp.h index 12a813e66..d448493d0 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tritmp.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tritmp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tritmp.h,v 1.2 2000/08/25 13:42:31 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tritmp.h,v 1.4 2000/12/04 22:46:01 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,107 +28,212 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ #if !defined(TAG) || !defined(IND) - this is an error +this is an error #endif /* Draw a single triangle. Note that the device-dependent vertex data might need to be changed based on the render state. */ -static __inline void TAG(triangle)(GLcontext *ctx, - GLuint e0, GLuint e1, GLuint e2, - GLuint pv) +static __inline void TAG(triangle)( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint pv ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - int vertsize = r128ctx->vertsize; - CARD32 *vb = r128AllocVertexDwords(r128ctx, - 3 * vertsize); - struct vertex_buffer *VB = ctx->VB; - r128VertexPtr r128verts = R128_DRIVER_DATA(VB)->verts; - const r128Vertex *v[3]; - int i, j; + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + struct vertex_buffer *VB = ctx->VB; + r128VertexPtr r128verts = R128_DRIVER_DATA(VB)->verts; + r128Vertex *v[3]; #if (IND & R128_OFFSET_BIT) - GLfloat offset; + GLfloat offset; + GLfloat z[3]; #endif #if (IND & R128_TWOSIDE_BIT) - int c[3]; - - c[0] = c[1] = c[2] = *(int *)&r128verts[pv].vert1.dif_argb; + GLuint c[3]; #endif - v[0] = &r128verts[e0]; - v[1] = &r128verts[e1]; - v[2] = &r128verts[e2]; + v[0] = &r128verts[e0]; + v[1] = &r128verts[e1]; + v[2] = &r128verts[e2]; + +#if (IND & R128_TWOSIDE_BIT) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; +#endif #if (IND & (R128_TWOSIDE_BIT | R128_OFFSET_BIT)) - { - GLfloat ex = v[0]->vert1.x - v[2]->vert1.x; - GLfloat ey = v[0]->vert1.y - v[2]->vert1.y; - GLfloat fx = v[1]->vert1.x - v[2]->vert1.x; - GLfloat fy = v[1]->vert1.y - v[2]->vert1.y; - GLfloat cc = ex*fy - ey*fx; + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; #if (IND & R128_TWOSIDE_BIT) - { - GLuint facing = (cc > 0.0) ^ ctx->Polygon.FrontBit; - GLubyte (*vbcolor)[4] = VB->Color[facing]->data; - if (IND & R128_FLAT_BIT) { - R128_COLOR((char *)&c[0], vbcolor[pv]); - c[2] = c[1] = c[0]; - } else { - R128_COLOR((char *)&c[0], vbcolor[e0]); - R128_COLOR((char *)&c[1], vbcolor[e1]); - R128_COLOR((char *)&c[2], vbcolor[e2]); - } - } + { + GLuint facing = (cc > 0.0) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & R128_FLAT_BIT) { + R128_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + R128_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + R128_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + R128_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + } + } #endif #if (IND & R128_OFFSET_BIT) - { - offset = ctx->Polygon.OffsetUnits * r128ctx->depth_scale; - if (cc * cc > 1e-16) { - GLfloat ez = v[0]->vert1.z - v[2]->vert1.z; - GLfloat fz = v[1]->vert1.z - v[2]->vert1.z; - GLfloat a = ey*fz - ez*fy; - GLfloat b = ez*fx - ex*fz; - GLfloat ic = 1.0 / cc; - GLfloat ac = a * ic; - GLfloat bc = b * ic; - if (ac < 0.0f) ac = -ac; - if (bc < 0.0f) bc = -bc; - offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; - } - } + { + offset = ctx->Polygon.OffsetUnits * r128ctx->depth_scale; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if (ac < 0.0f) ac = -ac; + if (bc < 0.0f) bc = -bc; + offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + } +#endif + } +#endif + + r128_draw_triangle( r128ctx, v[0], v[1], v[2] ); + +#if (IND & R128_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; +#endif + +#if (IND & R128_TWOSIDE_BIT) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; #endif - } +} + + +static void TAG(quad)( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, GLuint e3, + GLuint pv ) +{ +#if 0 + TAG(triangle)( ctx, e0, e1, e3, pv ); + TAG(triangle)( ctx, e1, e2, e3, pv ); +#else + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + struct vertex_buffer *VB = ctx->VB; + r128VertexPtr r128verts = R128_DRIVER_DATA(VB)->verts; + r128Vertex *v[4]; + +#if (IND & R128_OFFSET_BIT) + GLfloat offset; + GLfloat z[4]; #endif - for (j = 0 ; j < 3 ; j++, vb += vertsize) { +#if (IND & R128_TWOSIDE_BIT) + int c[4]; +#endif - for (i = 0 ; i < vertsize ; i++) - vb[i] = v[j]->ui[i]; + v[0] = &r128verts[e0]; + v[1] = &r128verts[e1]; + v[2] = &r128verts[e2]; + v[3] = &r128verts[e3]; #if (IND & R128_TWOSIDE_BIT) - vb[4] = c[j]; /* color is the fifth element... */ + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; + c[3] = v[3]->ui[4]; #endif + +#if (IND & (R128_TWOSIDE_BIT | R128_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & R128_TWOSIDE_BIT) + { + GLuint facing = (cc > 0.0) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & R128_FLAT_BIT) { + R128_COLOR((char *)&v[0]->ui[4], vbcolor[pv]); + v[3]->ui[4] = v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + R128_COLOR((char *)&v[0]->ui[4], vbcolor[e0]); + R128_COLOR((char *)&v[1]->ui[4], vbcolor[e1]); + R128_COLOR((char *)&v[2]->ui[4], vbcolor[e2]); + R128_COLOR((char *)&v[3]->ui[4], vbcolor[e3]); + } + } +#endif + #if (IND & R128_OFFSET_BIT) - *(float *)&vb[2] = v[j]->vert1.z + offset; + { + offset = ctx->Polygon.OffsetUnits * r128ctx->depth_scale; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + z[3] = v[3]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if (ac < 0.0f) ac = -ac; + if (bc < 0.0f) bc = -bc; + offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + v[3]->v.z += offset; + } #endif } -} +#endif + r128_draw_quad( r128ctx, v[0], v[1], v[2], v[3] ); -static void TAG(quad)(GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, GLuint v3, - GLuint pv) -{ - TAG(triangle)(ctx, v0, v1, v3, pv); - TAG(triangle)(ctx, v1, v2, v3, pv); +#if (IND & R128_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; + v[3]->v.z = z[3]; +#endif + +#if (IND & R128_TWOSIDE_BIT) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; + v[3]->ui[4] = c[3]; +#endif +#endif } @@ -141,44 +246,97 @@ static void TAG(quad)(GLcontext *ctx, * Twosided lighting for GL_LINE triangles is dependent on the same * harness. */ -static void TAG(line)(GLcontext *ctx, - GLuint v0, GLuint v1, - GLuint pv) +static void TAG(line)( GLcontext *ctx, + GLuint e0, GLuint e1, + GLuint pv ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - r128VertexPtr r128verts = R128_DRIVER_DATA(ctx->VB)->verts; - float width = ctx->Line.Width; + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + r128VertexPtr r128verts = R128_DRIVER_DATA(ctx->VB)->verts; + GLfloat width = ctx->Line.Width; + r128Vertex *v[2]; + +#if (IND & R128_OFFSET_BIT) + GLfloat offset; + GLfloat z[2]; +#endif +#if (IND & R128_TWOSIDE_BIT) + int c[2]; +#endif + + v[0] = &r128verts[e0]; + v[1] = &r128verts[e1]; + +#if (IND & R128_TWOSIDE_BIT) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; +#endif + +#if (IND & R128_TWOSIDE_BIT) + { + GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; + if (IND & R128_FLAT_BIT) { + R128_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[1]->ui[4] = v[0]->ui[4]; + } else { + R128_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + R128_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + } + } +#endif + +#if (IND & R128_OFFSET_BIT) + offset = ctx->LineZoffset * r128ctx->depth_scale; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + v[0]->v.z += offset; + v[1]->v.z += offset; +#endif + + r128_draw_line( r128ctx, v[0], v[1], width ); + +#if (IND & R128_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; +#endif + +#if (IND & R128_TWOSIDE_BIT) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; +#endif + +#if 0 if (IND & (R128_TWOSIDE_BIT|R128_FLAT_BIT|R128_OFFSET_BIT)) { - r128Vertex tmp0 = r128verts[v0]; - r128Vertex tmp1 = r128verts[v1]; + r128Vertex tmp0 = r128verts[e0]; + r128Vertex tmp1 = r128verts[e1]; if (IND & R128_TWOSIDE_BIT) { GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; if (IND & R128_FLAT_BIT) { - R128_COLOR((char *)&tmp0.vert1.dif_argb, vbcolor[pv]); - *(int *)&tmp1.vert1.dif_argb = *(int *)&tmp0.vert1.dif_argb; + R128_COLOR((char *)&tmp0.v.color, vbcolor[pv]); + *(int *)&tmp1.v.color = *(int *)&tmp0.v.color; } else { - R128_COLOR((char *)&tmp0.vert1.dif_argb, vbcolor[v0]); - R128_COLOR((char *)&tmp1.vert1.dif_argb, vbcolor[v1]); + R128_COLOR((char *)&tmp0.v.color, vbcolor[e0]); + R128_COLOR((char *)&tmp1.v.color, vbcolor[e1]); } } else if (IND & R128_FLAT_BIT) { - *(int *)&tmp0.vert1.dif_argb = *(int *)&r128verts[pv].vert1.dif_argb; - *(int *)&tmp1.vert1.dif_argb = *(int *)&r128verts[pv].vert1.dif_argb; + *(int *)&tmp0.v.color = *(int *)&r128verts[pv].v.color; + *(int *)&tmp1.v.color = *(int *)&r128verts[pv].v.color; } if (IND & R128_OFFSET_BIT) { GLfloat offset = ctx->LineZoffset * r128ctx->depth_scale; - tmp0.vert1.z += offset; - tmp1.vert1.z += offset; + tmp0.v.z += offset; + tmp1.v.z += offset; } - r128DrawLineVB( r128ctx, &tmp0, &tmp1, width ); + r128_draw_line( r128ctx, &tmp0, &tmp1, width ); + } else { + r128_draw_line( r128ctx, &r128verts[e0], &r128verts[e1], width ); } - else - r128DrawLineVB( r128ctx, &r128verts[v0], &r128verts[v1], width ); +#endif } /* Draw a set of points. Note that the device-dependent vertex data @@ -186,40 +344,40 @@ static void TAG(line)(GLcontext *ctx, static void TAG(points)(GLcontext *ctx, GLuint first, GLuint last) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - struct vertex_buffer *VB = ctx->VB; - r128VertexPtr r128verts = R128_DRIVER_DATA(VB)->verts; - GLfloat size = ctx->Point.Size * 0.5; - int i; - - - for(i = first; i <= last; i++) { - if(VB->ClipMask[i] == 0) { - if (IND & (R128_TWOSIDE_BIT|R128_OFFSET_BIT)) { - r128Vertex tmp0 = r128verts[i]; - - if (IND & R128_TWOSIDE_BIT) { - GLubyte (*vbcolor)[4] = VB->ColorPtr->data; - R128_COLOR((char *)&tmp0.vert1.dif_argb, vbcolor[i]); - } - if (IND & R128_OFFSET_BIT) { - GLfloat offset = ctx->PointZoffset * r128ctx->depth_scale; - tmp0.vert1.z += offset; - } - r128DrawPointVB( r128ctx, &tmp0, size ); - } else - r128DrawPointVB( r128ctx, &r128verts[i], size ); - } - } + r128ContextPtr r128ctx = R128_CONTEXT(ctx); + struct vertex_buffer *VB = ctx->VB; + r128VertexPtr r128verts = R128_DRIVER_DATA(VB)->verts; + GLfloat size = ctx->Point.Size * 0.5; + int i; + + + for(i = first; i < last; i++) { + if(VB->ClipMask[i] == 0) { + if (IND & (R128_TWOSIDE_BIT|R128_OFFSET_BIT)) { + r128Vertex tmp0 = r128verts[i]; + + if (IND & R128_TWOSIDE_BIT) { + GLubyte (*vbcolor)[4] = VB->ColorPtr->data; + R128_COLOR((char *)&tmp0.v.color, vbcolor[i]); + } + if (IND & R128_OFFSET_BIT) { + GLfloat offset = ctx->PointZoffset * r128ctx->depth_scale; + tmp0.v.z += offset; + } + r128_draw_point( r128ctx, &tmp0, size ); + } else + r128_draw_point( r128ctx, &r128verts[i], size ); + } + } } /* Initialize the table of primitives to render. */ static void TAG(init)(void) { - rast_tab[IND].tri = TAG(triangle); - rast_tab[IND].quad = TAG(quad); - rast_tab[IND].line = TAG(line); - rast_tab[IND].points = TAG(points); + rast_tab[IND].triangle = TAG(triangle); + rast_tab[IND].quad = TAG(quad); + rast_tab[IND].line = TAG(line); + rast_tab[IND].points = TAG(points); } #undef IND diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c index 3248a1493..64308e76d 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.7 2000/11/08 05:02:51 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.8 2000/12/04 19:21:48 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,453 +28,477 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#include "r128_init.h" -#include "r128_xmesa.h" #include "r128_context.h" -#include "r128_lock.h" -#include "r128_reg.h" -#include "r128_cce.h" +#include "r128_ioctl.h" #include "r128_state.h" #include "r128_vb.h" + #include "mem.h" #include "stages.h" -#define TEX0 \ -do { \ - v->vert1.tu0 = tc0[i][0]; \ - v->vert1.tv0 = tc0[i][1]; \ +#define TEX0 \ +do { \ + v->v.tu0 = tc0[i][0]; \ + v->v.tv0 = tc0[i][1]; \ } while (0) -#define TEX1 \ -do { \ - v->vert2.tu1 = tc1[i][0]; \ - v->vert2.tv1 = tc1[i][1]; \ +#define TEX1 \ +do { \ + v->v.tu1 = tc1[i][0]; \ + v->v.tv1 = tc1[i][1]; \ } while (0) -#define SPC \ -do { \ - GLubyte *spec = &(VB->Spec[0][i][0]); \ - v->vert1.spec_frgb.r = spec[0]; \ - v->vert1.spec_frgb.g = spec[1]; \ - v->vert1.spec_frgb.b = spec[2]; \ +#define SPC \ +do { \ + GLubyte *spec = &(VB->Spec[0][i][0]); \ + v->v.specular.blue = spec[2]; \ + v->v.specular.green = spec[1]; \ + v->v.specular.red = spec[0]; \ } while (0) #define FOG \ do { \ - GLubyte *spec = &(VB->Spec[0][i][0]); \ - v->vert1.spec_frgb.a = spec[3]; \ + GLubyte *spec = &(VB->Spec[0][i][0]); \ + v->v.specular.alpha = spec[3]; \ } while (0) -#define COL \ -do { \ - GLubyte *col = &(VB->Color[0]->data[i][0]); \ - v->vert1.dif_argb.a = col[3]; \ - v->vert1.dif_argb.r = col[0]; \ - v->vert1.dif_argb.g = col[1]; \ - v->vert1.dif_argb.b = col[2]; \ +#define COL \ +do { \ + GLubyte *col = &(VB->Color[0]->data[i][0]); \ + v->v.color.blue = col[2]; \ + v->v.color.green = col[1]; \ + v->v.color.red = col[0]; \ + v->v.color.alpha = col[3]; \ } while (0) -#if 1 -/* FIXME: These are handled by the Rage 128 */ -#define TEX0_4 -#define TEX1_4 -#else -#define TEX0_4 \ -do { \ - if (VB->TexCoordPtr[0]->size == 4) { \ - GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \ - v = &(R128_DRIVER_DATA(VB)->verts[start]); \ - for (i = start; i < end; i++, v++) { \ - float oow = 1.0 / tc[i][3]; \ - v->vert1.rhw *= tc[i][3]; \ - v->vert1.tu0 *= oow; \ - v->vert1.tv0 *= oow; \ - } \ - } \ +#define TEX0_4 \ +do { \ + if (VB->TexCoordPtr[0]->size == 4) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \ + v = &(R128_DRIVER_DATA(VB)->verts[start]); \ + for (i = start; i < end; i++, v++) { \ + float oow = 1.0 / tc[i][3]; \ + v->v.rhw *= tc[i][3]; \ + v->v.tu0 *= oow; \ + v->v.tv0 *= oow; \ + } \ + } \ } while (0) -#ifdef USE_RHW2 -#define TEX1_4 \ -do { \ - if (VB->TexCoordPtr[1]->size == 4) { \ - GLfloat (*tc)[4] = VB->TexCoordPtr[1]->data; \ - v = &(R128_DRIVER_DATA(VB)->verts[start]); \ - for (i = start; i < end; i++, v++) { \ - float oow = 1.0 / tc[i][3]; \ - v->vert3.rhw2 *= tc[i][3]; \ - v->vert3.tu1 *= oow; \ - v->vert3.tv1 *= oow; \ - } \ - } \ -} while (0) -#else -#define TEX1_4 -#endif -#endif - -#ifdef USE_RHW2 -#define COORD \ -do { \ - GLfloat *win = VB->Win.data[i]; \ - v->vert3.x = win[0]; \ - v->vert3.y = r128height - win[1]; \ - v->vert3.z = scale * win[2]; \ - v->vert3.rhw = v->vert3.rhw2 = win[3]; \ +#if USE_RHW2 + +#define TEX1_4 \ +do { \ + if (VB->TexCoordPtr[1]->size == 4) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[1]->data; \ + v = &(R128_DRIVER_DATA(VB)->verts[start]); \ + for (i = start; i < end; i++, v++) { \ + float oow = 1.0 / tc[i][3]; \ + v->v.rhw2 *= tc[i][3]; \ + v->v.tu1 *= oow; \ + v->v.tv1 *= oow; \ + } \ + } \ } while (0) -#else -#define COORD \ -do { \ - GLfloat *win = VB->Win.data[i]; \ - v->vert1.x = win[0]; \ - v->vert1.y = r128height - win[1]; \ - v->vert1.z = scale * win[2]; \ - v->vert1.rhw = win[3]; \ + +#define COORD \ +do { \ + GLfloat *win = VB->Win.data[i]; \ + v->v.x = win[0]; \ + v->v.y = r128height - win[1]; \ + v->v.z = scale * win[2]; \ + v->v.rhw = v->v.rhw2 = win[3]; \ } while (0) -#endif + +#else /* USE_RHW2 */ + +#define TEX1_4 + +#define COORD \ +do { \ + GLfloat *win = VB->Win.data[i]; \ + v->v.x = win[0]; \ + v->v.y = r128height - win[1]; \ + v->v.z = scale * win[2]; \ + v->v.rhw = win[3]; \ +} while (0) \ + +#endif /* USE_RHW2 */ #define NOP /* Setup the r128 vertex buffer entries */ -#define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,tex1_4,spec,fog) \ -static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ -{ \ - r128ContextPtr r128ctx = R128_CONTEXT(VB->ctx); \ - __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ - r128VertexPtr v; \ - GLfloat (*tc0)[4]; \ - GLfloat (*tc1)[4]; \ - GLfloat r128height = dPriv->h; \ - GLfloat scale = r128ctx->depth_scale; \ - int i; \ - \ - (void) r128height; (void) r128ctx; (void) scale; \ - \ - gl_import_client_data(VB, VB->ctx->RenderFlags, \ - (VB->ClipOrMask \ - ? VEC_WRITABLE | VEC_GOOD_STRIDE \ - : VEC_GOOD_STRIDE)); \ - \ - tc0 = VB->TexCoordPtr[0]->data; \ - tc1 = VB->TexCoordPtr[1]->data; \ - \ - v = &(R128_DRIVER_DATA(VB)->verts[start]); \ - \ - if (VB->ClipOrMask == 0) \ - for (i = start; i < end; i++, v++) { \ - win; \ - col; \ - spec; \ - fog; \ - tex0; \ - tex1; \ - } \ - else \ - for (i = start; i < end; i++, v++) { \ - if (VB->ClipMask[i] == 0) { \ - win; \ - spec; \ - fog; \ - tex0; \ - tex1; \ - } \ - col; \ - } \ - tex0_4; \ - tex1_4; \ +#define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,tex1_4,spec,fog) \ +static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ +{ \ + r128ContextPtr r128ctx = R128_CONTEXT(VB->ctx); \ + __DRIdrawablePrivate *dPriv = r128ctx->driDrawable; \ + r128VertexPtr v; \ + GLfloat (*tc0)[4]; \ + GLfloat (*tc1)[4]; \ + GLfloat r128height = dPriv->h; \ + GLfloat scale = r128ctx->depth_scale; \ + int i; \ + \ + (void) r128height; (void) r128ctx; (void) scale; \ + \ + gl_import_client_data(VB, VB->ctx->RenderFlags, \ + (VB->ClipOrMask \ + ? VEC_WRITABLE | VEC_GOOD_STRIDE \ + : VEC_GOOD_STRIDE)); \ + \ + tc0 = VB->TexCoordPtr[r128ctx->tmu_source[0]]->data; \ + tc1 = VB->TexCoordPtr[r128ctx->tmu_source[1]]->data; \ + \ + v = &(R128_DRIVER_DATA(VB)->verts[start]); \ + \ + if (VB->ClipOrMask == 0) { \ + for (i = start; i < end; i++, v++) { \ + win; \ + col; \ + spec; \ + fog; \ + tex0; \ + tex1; \ + } \ + } else { \ + for (i = start; i < end; i++, v++) { \ + if (VB->ClipMask[i] == 0) { \ + win; \ + spec; \ + fog; \ + tex0; \ + tex1; \ + } \ + col; \ + } \ + } \ + tex0_4; \ + tex1_4; \ } -SETUPFUNC(rs_wt0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP, NOP) -SETUPFUNC(rs_wt1, COORD, NOP, NOP, TEX1, NOP, TEX1_4, NOP, NOP) -SETUPFUNC(rs_wt0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) -SETUPFUNC(rs_wft0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP, FOG) -SETUPFUNC(rs_wft1, COORD, NOP, NOP, TEX1, NOP, TEX1_4, NOP, FOG) -SETUPFUNC(rs_wft0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) -SETUPFUNC(rs_wg, COORD, COL, NOP, NOP, NOP, NOP, NOP, NOP) -SETUPFUNC(rs_wgs, COORD, COL, NOP, NOP, NOP, NOP, SPC, NOP) -SETUPFUNC(rs_wgt0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP, NOP) -SETUPFUNC(rs_wgt1, COORD, COL, NOP, TEX1, NOP, TEX1_4, NOP, NOP) -SETUPFUNC(rs_wgt0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) -SETUPFUNC(rs_wgst0, COORD, COL, TEX0, NOP, TEX0_4, NOP, SPC, NOP) -SETUPFUNC(rs_wgst1, COORD, COL, NOP, TEX1, NOP, TEX1_4, SPC, NOP) -SETUPFUNC(rs_wgst0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, NOP) -SETUPFUNC(rs_wgf, COORD, COL, NOP, NOP, NOP, NOP, NOP, FOG) -SETUPFUNC(rs_wgfs, COORD, COL, NOP, NOP, NOP, NOP, SPC, FOG) -SETUPFUNC(rs_wgft0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP, FOG) -SETUPFUNC(rs_wgft1, COORD, COL, NOP, TEX1, NOP, TEX1_4, NOP, FOG) -SETUPFUNC(rs_wgft0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) -SETUPFUNC(rs_wgfst0, COORD, COL, TEX0, NOP, TEX0_4, NOP, SPC, FOG) -SETUPFUNC(rs_wgfst1, COORD, COL, NOP, TEX1, NOP, TEX1_4, SPC, FOG) -SETUPFUNC(rs_wgfst0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, FOG) - -SETUPFUNC(rs_t0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP, NOP) -SETUPFUNC(rs_t1, NOP, NOP, NOP, TEX1, NOP, TEX1_4, NOP, NOP) -SETUPFUNC(rs_t0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) -SETUPFUNC(rs_f, NOP, NOP, NOP, NOP, NOP, NOP, NOP, FOG) -SETUPFUNC(rs_ft0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP, FOG) -SETUPFUNC(rs_ft1, NOP, NOP, NOP, TEX1, NOP, TEX1_4, NOP, FOG) -SETUPFUNC(rs_ft0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) -SETUPFUNC(rs_g, NOP, COL, NOP, NOP, NOP, NOP, NOP, NOP) -SETUPFUNC(rs_gs, NOP, COL, NOP, NOP, NOP, NOP, SPC, NOP) -SETUPFUNC(rs_gt0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP, NOP) -SETUPFUNC(rs_gt1, NOP, COL, NOP, TEX1, NOP, TEX1_4, NOP, NOP) -SETUPFUNC(rs_gt0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) -SETUPFUNC(rs_gst0, NOP, COL, TEX0, NOP, TEX0_4, NOP, SPC, NOP) -SETUPFUNC(rs_gst1, NOP, COL, NOP, TEX1, NOP, TEX1_4, SPC, NOP) -SETUPFUNC(rs_gst0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, NOP) -SETUPFUNC(rs_gf, NOP, COL, NOP, NOP, NOP, NOP, NOP, FOG) -SETUPFUNC(rs_gfs, NOP, COL, NOP, NOP, NOP, NOP, SPC, FOG) -SETUPFUNC(rs_gft0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP, FOG) -SETUPFUNC(rs_gft1, NOP, COL, NOP, TEX1, NOP, TEX1_4, NOP, FOG) -SETUPFUNC(rs_gft0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) -SETUPFUNC(rs_gfst0, NOP, COL, TEX0, NOP, TEX0_4, NOP, SPC, FOG) -SETUPFUNC(rs_gfst1, NOP, COL, NOP, TEX1, NOP, TEX1_4, SPC, FOG) -SETUPFUNC(rs_gfst0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, FOG) - - -static void rs_invalid(struct vertex_buffer *VB, GLuint start, GLuint end) +SETUPFUNC(rs_wt0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP, NOP) +SETUPFUNC(rs_wt0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) +SETUPFUNC(rs_wft0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP, FOG) +SETUPFUNC(rs_wft0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) +SETUPFUNC(rs_wg, COORD, COL, NOP, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_wgs, COORD, COL, NOP, NOP, NOP, NOP, SPC, NOP) +SETUPFUNC(rs_wgt0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP, NOP) +SETUPFUNC(rs_wgt0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) +SETUPFUNC(rs_wgst0, COORD, COL, TEX0, NOP, TEX0_4, NOP, SPC, NOP) +SETUPFUNC(rs_wgst0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, NOP) +SETUPFUNC(rs_wgf, COORD, COL, NOP, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_wgfs, COORD, COL, NOP, NOP, NOP, NOP, SPC, FOG) +SETUPFUNC(rs_wgft0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP, FOG) +SETUPFUNC(rs_wgft0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) +SETUPFUNC(rs_wgfst0, COORD, COL, TEX0, NOP, TEX0_4, NOP, SPC, FOG) +SETUPFUNC(rs_wgfst0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, FOG) + +SETUPFUNC(rs_t0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP, NOP) +SETUPFUNC(rs_t0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) +SETUPFUNC(rs_f, NOP, NOP, NOP, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_ft0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP, FOG) +SETUPFUNC(rs_ft0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) +SETUPFUNC(rs_g, NOP, COL, NOP, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_gs, NOP, COL, NOP, NOP, NOP, NOP, SPC, NOP) +SETUPFUNC(rs_gt0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP, NOP) +SETUPFUNC(rs_gt0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, NOP) +SETUPFUNC(rs_gst0, NOP, COL, TEX0, NOP, TEX0_4, NOP, SPC, NOP) +SETUPFUNC(rs_gst0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, NOP) +SETUPFUNC(rs_gf, NOP, COL, NOP, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_gfs, NOP, COL, NOP, NOP, NOP, NOP, SPC, FOG) +SETUPFUNC(rs_gft0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP, FOG) +SETUPFUNC(rs_gft0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP, FOG) +SETUPFUNC(rs_gfst0, NOP, COL, TEX0, NOP, TEX0_4, NOP, SPC, FOG) +SETUPFUNC(rs_gfst0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, SPC, FOG) + + +static void rs_invalid( struct vertex_buffer *VB, GLuint start, GLuint end ) { - fprintf(stderr, "r128RasterSetup(): invalid setup function\n"); + fprintf(stderr, "r128RasterSetup(): invalid setup function\n"); } typedef void (*setupFunc)(struct vertex_buffer *, GLuint, GLuint); -static setupFunc setup_func[0x20]; +static setupFunc setup_func[0x40]; /* Initialize the table of vertex buffer setup functions */ -void r128DDSetupInit(void) +void r128DDSetupInit( void ) +{ + int i; + + for (i = 0; i < 0x20; i++) setup_func[i] = rs_invalid; + + /* Functions to build vertices from scratch */ + setup_func[R128_WIN_BIT|R128_TEX0_BIT] = rs_wt0; + setup_func[R128_WIN_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wt0t1; + setup_func[R128_WIN_BIT|R128_FOG_BIT|R128_TEX0_BIT] = rs_wft0; + setup_func[R128_WIN_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wft0t1; + setup_func[R128_WIN_BIT|R128_RGBA_BIT] = rs_wg; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT] = rs_wgs; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_TEX0_BIT] = rs_wgt0; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgt0t1; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_wgst0; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgst0t1; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT] = rs_wgf; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT] = rs_wgfs; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT] = rs_wgft0; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgft0t1; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_wgfst0; + setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgfst0t1; + + /* Repair functions */ + setup_func[R128_TEX0_BIT] = rs_t0; + setup_func[R128_TEX0_BIT|R128_TEX1_BIT] = rs_t0t1; + setup_func[R128_FOG_BIT] = rs_f; + setup_func[R128_FOG_BIT|R128_TEX0_BIT] = rs_ft0; + setup_func[R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_ft0t1; + setup_func[R128_RGBA_BIT] = rs_g; + setup_func[R128_RGBA_BIT|R128_SPEC_BIT] = rs_gs; + setup_func[R128_RGBA_BIT|R128_TEX0_BIT] = rs_gt0; + setup_func[R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gt0t1; + setup_func[R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_gst0; + setup_func[R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gst0t1; + setup_func[R128_RGBA_BIT|R128_FOG_BIT] = rs_gf; + setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT] = rs_gfs; + setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT] = rs_gft0; + setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gft0t1; + setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_gfst0; + setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gfst0t1; +} + +void r128PrintSetupFlags( char *msg, GLuint flags ) { - int i; - - for (i = 0; i < 0x20; i++) setup_func[i] = rs_invalid; - - /* Funcs to build vertices from scratch */ - setup_func[R128_WIN_BIT|R128_TEX0_BIT] = rs_wt0; - setup_func[R128_WIN_BIT|R128_TEX1_BIT] = rs_wt1; - setup_func[R128_WIN_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wt0t1; - setup_func[R128_WIN_BIT|R128_FOG_BIT|R128_TEX0_BIT] = rs_wft0; - setup_func[R128_WIN_BIT|R128_FOG_BIT|R128_TEX1_BIT] = rs_wft1; - setup_func[R128_WIN_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wft0t1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT] = rs_wg; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT] = rs_wgs; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_TEX0_BIT] = rs_wgt0; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_TEX1_BIT] = rs_wgt1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgt0t1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_wgst0; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX1_BIT] = rs_wgst1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgst0t1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT] = rs_wgf; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT] = rs_wgfs; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT] = rs_wgft0; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX1_BIT] = rs_wgft1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgft0t1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_wgfst0; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX1_BIT] = rs_wgfst1; - setup_func[R128_WIN_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_wgfst0t1; - - - /* Funcs to repair vertices */ - setup_func[R128_TEX0_BIT] = rs_t0; - setup_func[R128_TEX1_BIT] = rs_t1; - setup_func[R128_TEX0_BIT|R128_TEX1_BIT] = rs_t0t1; - setup_func[R128_FOG_BIT] = rs_f; - setup_func[R128_FOG_BIT|R128_TEX0_BIT] = rs_ft0; - setup_func[R128_FOG_BIT|R128_TEX1_BIT] = rs_ft1; - setup_func[R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_ft0t1; - setup_func[R128_RGBA_BIT] = rs_g; - setup_func[R128_RGBA_BIT|R128_SPEC_BIT] = rs_gs; - setup_func[R128_RGBA_BIT|R128_TEX0_BIT] = rs_gt0; - setup_func[R128_RGBA_BIT|R128_TEX1_BIT] = rs_gt1; - setup_func[R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gt0t1; - setup_func[R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_gst0; - setup_func[R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX1_BIT] = rs_gst1; - setup_func[R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gst0t1; - setup_func[R128_RGBA_BIT|R128_FOG_BIT] = rs_gf; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT] = rs_gfs; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT] = rs_gft0; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_TEX1_BIT] = rs_gft1; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gft0t1; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT] = rs_gfst0; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX1_BIT] = rs_gfst1; - setup_func[R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT] = rs_gfst0t1; + fprintf( stderr, "%s: %d %s%s%s%s%s%s\n", + msg, + (int)flags, + (flags & R128_WIN_BIT) ? " xyzw," : "", + (flags & R128_RGBA_BIT) ? " rgba," : "", + (flags & R128_SPEC_BIT) ? " spec," : "", + (flags & R128_FOG_BIT) ? " fog," : "", + (flags & R128_TEX0_BIT) ? " tex-0," : "", + (flags & R128_TEX1_BIT) ? " tex-1," : "" ); } /* Initialize the vertex buffer setup functions based on the current rendering state */ -void r128DDChooseRasterSetupFunc(GLcontext *ctx) +void r128DDChooseRasterSetupFunc( GLcontext *ctx ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - int funcIndex = R128_WIN_BIT | R128_RGBA_BIT; - - r128ctx->vertsize = 8; - r128ctx->vc_format = R128_TEX0_VERTEX_FORMAT; - r128ctx->multitex = 0; - - if (ctx->Texture.ReallyEnabled & ENABLE_TEX0) { - /* This doesn't work for non-RGBA textures - if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) - funcIndex &= ~R128_RGBA_BIT; - */ - funcIndex |= R128_TEX0_BIT; - } - - if (ctx->Texture.ReallyEnabled & ENABLE_TEX1) { - /* GTH: we should really only enable the second texture unit - * when we're doing true multitexturing. I guess there aren't - * that many cases where apps will only bind a texture to the - * second texture unit, but it would definitely be a performance - * win in those cases. - */ - r128ctx->vertsize = 10; - r128ctx->vc_format = R128_TEX1_VERTEX_FORMAT; - r128ctx->multitex = 1; - funcIndex |= R128_TEX1_BIT; - } - - /* FIXME: Verify this works properly */ - if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) - funcIndex |= R128_SPEC_BIT; - - if (ctx->Fog.Enabled) - funcIndex |= R128_FOG_BIT; - - r128ctx->SetupIndex = funcIndex; - ctx->Driver.RasterSetup = setup_func[funcIndex]; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int index = R128_WIN_BIT | R128_RGBA_BIT; + + r128ctx->multitex = 0; + r128ctx->vertsize = 8; + r128ctx->vc_format = R128_TEX0_VERTEX_FORMAT; + r128ctx->tmu_source[0] = 0; + r128ctx->tmu_source[1] = 1; + r128ctx->tex_dest[0] = R128_TEX0_BIT; + r128ctx->tex_dest[1] = R128_TEX1_BIT; + r128ctx->blend_flags &= ~R128_BLEND_MULTITEX; + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + if ( ctx->Texture.Unit[0].EnvMode == GL_BLEND && + (r128ctx->env_color & 0x00ffffff) ) { + r128ctx->multitex = 1; + r128ctx->vertsize = 10; + r128ctx->vc_format = R128_TEX1_VERTEX_FORMAT; + r128ctx->tmu_source[1] = 0; + index |= R128_TEX1_BIT; + } + + index |= R128_TEX0_BIT; + } + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX1 ) { + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + r128ctx->multitex = 1; + r128ctx->vertsize = 10; + r128ctx->vc_format = R128_TEX1_VERTEX_FORMAT; + r128ctx->blend_flags |= R128_BLEND_MULTITEX; + index |= R128_TEX1_BIT; + } else { + /* Just a funny way of doing single texturing. + */ + r128ctx->tmu_source[0] = 1; + r128ctx->tex_dest[1] = R128_TEX0_BIT; + + if ( ctx->Texture.Unit[1].EnvMode == GL_BLEND && + (r128ctx->env_color & 0x00ffffff) ) { + r128ctx->multitex = 1; + r128ctx->vertsize = 10; + r128ctx->vc_format = R128_TEX1_VERTEX_FORMAT; + r128ctx->tmu_source[1] = 1; + index |= R128_TEX1_BIT; + } + + index |= R128_TEX0_BIT; + } + } + + if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) + index |= R128_SPEC_BIT; + + if ( ctx->Fog.Enabled ) + index |= R128_FOG_BIT; + + if ( R128_DEBUG & DEBUG_VERBOSE_MSG ) { + fprintf( stderr, "\n" ); + r128PrintSetupFlags( "full setup function", index ); + } + + r128ctx->new_state |= R128_NEW_TEXTURE; + r128ctx->SetupIndex = index; + + ctx->Driver.RasterSetup = setup_func[index]; } /* Check to see if any updates of the vertex buffer entries are needed */ -void r128DDCheckPartialRasterSetup(GLcontext *ctx, - struct gl_pipeline_stage *s) +void r128DDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *s ) { - r128ContextPtr r128ctx = R128_CONTEXT(ctx); - int tmp = r128ctx->SetupDone; + r128ContextPtr r128ctx = R128_CONTEXT( ctx ); + int tmp = r128ctx->SetupDone; - s->type = 0; - r128ctx->SetupDone = GL_FALSE; + s->type = 0; + r128ctx->SetupDone = GL_FALSE; - if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) return; - if (ctx->IndirectTriangles) return; + if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) return; + if (ctx->IndirectTriangles) return; - r128ctx->SetupDone = tmp; + r128ctx->SetupDone = tmp; } /* Update the vertex buffer entries, if necessary */ -void r128DDPartialRasterSetup(struct vertex_buffer *VB) +void r128DDPartialRasterSetup( struct vertex_buffer *VB ) { - r128ContextPtr r128ctx = R128_CONTEXT(VB->ctx); - int new = VB->pipeline->new_outputs; - int available = VB->pipeline->outputs; - int index = 0; - - if (new & VERT_WIN) { - new = available; - index |= R128_WIN_BIT | R128_FOG_BIT; - } - - if (new & VERT_RGBA) index |= R128_RGBA_BIT | R128_SPEC_BIT; - if (new & VERT_TEX0_ANY) index |= R128_TEX0_BIT; - if (new & VERT_TEX1_ANY) index |= R128_TEX1_BIT; - if (new & VERT_FOG_COORD) index |= R128_FOG_BIT; - - r128ctx->SetupDone &= ~index; - index &= r128ctx->SetupIndex; - r128ctx->SetupDone |= index; - - if (index) setup_func[index](VB, VB->Start, VB->Count); + r128ContextPtr r128ctx = R128_CONTEXT( VB->ctx ); + int new = VB->pipeline->new_outputs; + int available = VB->pipeline->outputs; + int index = 0; + + if (new & VERT_WIN) { + new = available; + index |= R128_WIN_BIT | R128_FOG_BIT; + } + + if (new & VERT_RGBA) + index |= R128_RGBA_BIT | R128_SPEC_BIT; + + if (new & VERT_TEX0_ANY) + index |= R128_TEX0_BIT; + + if (new & VERT_TEX1_ANY) + index |= r128ctx->tex_dest[1]; + + if (new & VERT_FOG_COORD) + index |= R128_FOG_BIT; + + r128ctx->SetupDone &= ~index; + index &= r128ctx->SetupIndex; + r128ctx->SetupDone |= index; + + if ( R128_DEBUG & DEBUG_VERBOSE_MSG ) + r128PrintSetupFlags( "partial setup function", index ); + + if ( index ) + setup_func[index]( VB, VB->Start, VB->Count ); } /* Perform the raster setup for the fast path, if using CVA */ -void r128DDDoRasterSetup(struct vertex_buffer *VB) +void r128DDDoRasterSetup( struct vertex_buffer *VB ) { - GLcontext *ctx = VB->ctx; - - if (VB->Type == VB_CVA_PRECALC) r128DDPartialRasterSetup(VB); - else if (ctx->Driver.RasterSetup) ctx->Driver.RasterSetup(VB, - VB->CopyStart, - VB->Count); + GLcontext *ctx = VB->ctx; + + if ( VB->Type == VB_CVA_PRECALC ) { + r128DDPartialRasterSetup( VB ); + } else if ( ctx->Driver.RasterSetup ) { + ctx->Driver.RasterSetup( VB, + VB->CopyStart, + VB->Count ); + } } /* Resize an existing vertex buffer */ -void r128DDResizeVB(struct vertex_buffer *VB, GLuint size) +void r128DDResizeVB( struct vertex_buffer *VB, GLuint size ) { - r128VertexBufferPtr r128vb = R128_DRIVER_DATA(VB); - - while (r128vb->size < size) - r128vb->size *= 2; - - free(r128vb->vert_store); - r128vb->vert_store = malloc(sizeof(r128Vertex) * r128vb->size + 31); - if (!r128vb->vert_store) { - fprintf(stderr, "Cannot allocate vertex store! Exiting...\n"); - exit(1); - } - - r128vb->verts = - (r128VertexPtr)(((unsigned long)r128vb->vert_store + 31) & ~31); - - gl_vector1ui_free(&r128vb->clipped_elements); - gl_vector1ui_alloc(&r128vb->clipped_elements, - VEC_WRITABLE, r128vb->size, 32); - if (!r128vb->clipped_elements.start) { - fprintf(stderr, "Cannot allocate clipped elements! Exiting...\n"); - exit(1); - } - - ALIGN_FREE(VB->ClipMask); - VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * r128vb->size, 4); - if (!VB->ClipMask) { - fprintf(stderr, "Cannot allocate clipmask! Exiting...\n"); - exit(1); - } + r128VertexBufferPtr r128vb = R128_DRIVER_DATA(VB); + + while ( r128vb->size < size ) + r128vb->size *= 2; + + ALIGN_FREE( r128vb->vert_store ); + r128vb->vert_store = ALIGN_MALLOC( sizeof(r128Vertex) * r128vb->size, 32 ); + if ( !r128vb->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + r128vb->verts = (r128VertexPtr)r128vb->vert_store; + + gl_vector1ui_free( &r128vb->clipped_elements ); + gl_vector1ui_alloc( &r128vb->clipped_elements, + VEC_WRITABLE, r128vb->size, 32 ); + if ( !r128vb->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * r128vb->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } } /* Create a new device-dependent vertex buffer */ -void r128DDRegisterVB(struct vertex_buffer *VB) +void r128DDRegisterVB( struct vertex_buffer *VB ) { - r128VertexBufferPtr r128vb; - - r128vb = (r128VertexBufferPtr)calloc(1, sizeof(*r128vb)); - - r128vb->size = VB->Size * 2; - r128vb->vert_store = malloc(sizeof(r128Vertex) * r128vb->size + 31); - if (!r128vb->vert_store) { - fprintf(stderr, "Cannot allocate vertex store! Exiting...\n"); - exit(1); - } - - r128vb->verts = - (r128VertexPtr)(((unsigned long)r128vb->vert_store + 31) & ~31); - - gl_vector1ui_alloc(&r128vb->clipped_elements, - VEC_WRITABLE, r128vb->size, 32); - if (!r128vb->clipped_elements.start) { - fprintf(stderr, "Cannot allocate clipped elements! Exiting...\n"); - exit(1); - } - - ALIGN_FREE(VB->ClipMask); - VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * r128vb->size, 4); - if (!VB->ClipMask) { - fprintf(stderr, "Cannot allocate clipmask! Exiting...\n"); - exit(1); - } - - VB->driver_data = r128vb; + r128VertexBufferPtr r128vb; + + r128vb = (r128VertexBufferPtr)CALLOC( sizeof(*r128vb) ); + + r128vb->size = VB->Size * 2; + r128vb->vert_store = ALIGN_MALLOC( sizeof(r128Vertex) * r128vb->size, 32 ); + if ( !r128vb->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + r128vb->verts = (r128VertexPtr)r128vb->vert_store; + + gl_vector1ui_alloc( &r128vb->clipped_elements, + VEC_WRITABLE, r128vb->size, 32 ); + if ( !r128vb->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * r128vb->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } + + VB->driver_data = r128vb; } /* Destroy a device-dependent vertex buffer */ -void r128DDUnregisterVB(struct vertex_buffer *VB) +void r128DDUnregisterVB( struct vertex_buffer *VB ) { - r128VertexBufferPtr r128vb = R128_DRIVER_DATA(VB); - - if (r128vb) { - if (r128vb->vert_store) free(r128vb->vert_store); - gl_vector1ui_free(&r128vb->clipped_elements); - free(r128vb); - VB->driver_data = 0; - } + r128VertexBufferPtr r128vb = R128_DRIVER_DATA(VB); + + if ( r128vb ) { + if ( r128vb->vert_store ) ALIGN_FREE( r128vb->vert_store ); + gl_vector1ui_free( &r128vb->clipped_elements ); + FREE( r128vb ); + VB->driver_data = 0; + } } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h index 761b3de85..f1afdff2c 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.h,v 1.2 2000/08/25 13:42:31 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.h,v 1.3 2000/12/04 19:21:48 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,7 +28,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -39,66 +40,24 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* FIXME: This is endian-specific */ typedef struct { - GLubyte b; - GLubyte g; - GLubyte r; - GLubyte a; -} r128Color; - -/* Single texture vertex, single x86 cache line. - * - * GTH: This is in use now. - */ -typedef struct { - GLfloat x, y, z; /* Coordinates in screen space */ - GLfloat rhw; /* Reciprocal homogeneous w */ - r128Color dif_argb; /* Diffuse color */ - r128Color spec_frgb; /* Specular color (alpha is fog) */ - GLfloat tu0, tv0; /* Texture 0 coordinates */ -} r128_vertex1; - -/* The only vertex format in current use, but unsatisfactory for two - * reasons: - * - Not possible to implement fully conformant rendering - * with this format (projective multitexturing), - * - Performance is lower with this vertex for single-texture - * geometry, as the vertex is unnecessarily larger than - * a cacheline. - * - * Switching to single-texture vertices can be accomplished in state - * management, and is relatively trivial. Switching to the rhw2 - * format is data-dependent (are there any glTexCoord4f's in the - * current buffer). One option is to switch between single-texture - * and rhw2 vertex formats only on the standard path. - * - * The fastpath never requires the rhw2 format, as it already makes - * the data-dependent checks. - * - * GTH: This is fixed. - */ -typedef struct { - GLfloat x, y, z; /* Coordinates in screen space */ - GLfloat rhw; /* Reciprocal homogeneous w */ - r128Color dif_argb; /* Diffuse color */ - r128Color spec_frgb; /* Specular color (alpha is fog) */ - GLfloat tu0, tv0; /* Texture 0 coordinates */ - GLfloat tu1, tv1; /* Texture 1 coordinates */ -} r128_vertex2; - -/* Need to be slightly clever about flushing vertex buffers in order - * to use rhw2 only on demand. - * - * GTH: This can be used now. + GLubyte blue; + GLubyte green; + GLubyte red; + GLubyte alpha; +} r128_color_t; + +/* The vertex structure. The final tu1/tv1 values are only used in + * multitexture modes, and the rhw2 value is currently never used. */ typedef struct { - GLfloat x, y, z; /* Coordinates in screen space */ - GLfloat rhw; /* Reciprocal homogeneous w */ - r128Color dif_argb; /* Diffuse color */ - r128Color spec_frgb; /* Specular color (alpha is fog) */ - GLfloat tu0, tv0; /* Texture 0 coordinates */ - GLfloat tu1, tv1; /* Texture 1 coordinates */ - GLfloat rhw2; /* Reciprocal homogeneous w2 */ -} r128_vertex2_rhw2; + GLfloat x, y, z; /* Coordinates in screen space */ + GLfloat rhw; /* Reciprocal homogeneous w */ + r128_color_t color; /* Diffuse color */ + r128_color_t specular; /* Specular color (alpha is fog) */ + GLfloat tu0, tv0; /* Texture 0 coordinates */ + GLfloat tu1, tv1; /* Texture 1 coordinates */ + GLfloat rhw2; /* Reciprocal homogeneous w2 */ +} r128_vertex; /* Format of vertices in r128_vertex struct */ #define R128_TEX0_VERTEX_FORMAT \ @@ -125,11 +84,9 @@ typedef struct { /* FIXME: We currently only have assembly for 16-stride vertices */ union r128_vertex_t { - r128_vertex1 vert1; - r128_vertex2 vert2; - r128_vertex2_rhw2 vert3; - float f[16]; - CARD32 ui[16]; + r128_vertex v; + GLfloat f[16]; + CARD32 ui[16]; }; typedef union r128_vertex_t r128Vertex; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c index 461ab30c3..c33eca347 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.1 2000/06/17 00:03:09 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.2 2000/12/04 19:21:48 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -28,45 +28,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ #ifdef GLX_DIRECT_RENDERING /* r128 Mesa driver includes */ -#include "r128_init.h" #include "r128_context.h" -#include "r128_xmesa.h" +#include "r128_ioctl.h" #include "r128_state.h" #include "r128_tex.h" -#include "r128_swap.h" /* Mesa src includes */ #include "context.h" #include "simple_list.h" #include "mmath.h" -#ifndef R128_DEBUG_FLAGS -int R128_DEBUG_FLAGS = (0 -/* | DEBUG_ALWAYS_SYNC */ -/* | DEBUG_VERBOSE_CCE */ -/* | DEBUG_VERBOSE_OUTREG */ -/* | DEBUG_VERBOSE_MSG */ -/* | DEBUG_NO_OUTRING */ -/* | DEBUG_NO_OUTREG */ -/* | DEBUG_VERBOSE_API */ -/* | DEBUG_VERBOSE_2D */ -/* | DEBUG_VERBOSE_DRI */ -/* | DEBUG_VALIDATE_RING */ -/* | DEBUG_VERBOSE_IOCTL */ - ); -#endif - -#if DEBUG_LOCKING -char *prevLockFile = NULL; -int prevLockLine = 0; -#endif +extern void __driRegisterExtensions( void ); static r128ContextPtr r128Context = NULL; @@ -190,16 +170,28 @@ GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv, if (driContextPriv) { r128ContextPtr r128ctx = (r128ContextPtr)driContextPriv->driverPrivate; +#if 0 + /* GH: This causes the driver to fail the glean makeCurrent + * tests. Leave it disabled for now... + */ if (r128Context && r128ctx == (void *)r128Context && driDrawPriv == R128_DRIDRAWABLE(r128Context)) return GL_TRUE; +#endif + /* GH: Do we still need this then? + */ r128Context = r128MakeCurrent(r128Context, r128ctx, driDrawPriv); gl_make_current2(R128_MESACTX(r128Context), driDrawPriv->mesaBuffer, driReadPriv->mesaBuffer); + if (r128Context->driDrawable != driDrawPriv) { + r128Context->driDrawable = driDrawPriv; + r128Context->dirty = R128_UPLOAD_ALL; + } + if (!R128_MESACTX(r128Context)->Viewport.Width) { gl_Viewport(R128_MESACTX(r128Context), 0, 0, driDrawPriv->w, driDrawPriv->h); @@ -218,37 +210,10 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv) return GL_TRUE; } -/* Update the hardware state. This is called if another context has - grabbed the hardware lock, which includes the X server. This - function also updates the driver's window state after the X server - moves, resizes or restacks a window -- the change will be reflected - in the drawable position and clip rects. Since the X server grabs - the hardware lock when it changes the window state, this routine will - automatically be called after such a change. */ -/* NOTE: This routine is only called while holding the hardware lock. */ -void XMesaUpdateState(__DRIcontextPrivate *driContextPriv) -{ - r128ContextPtr r128ctx = driContextPriv->driverPrivate; - __DRIscreenPrivate *sPriv = R128_DRISCREEN(r128ctx); - __DRIdrawablePrivate *dPriv = R128_DRIDRAWABLE(r128ctx); - int stamp = dPriv->lastStamp; - - /* The window might have moved, so we might need to get new clip - rects. - - NOTE: This releases and regrabs the hw lock to allow the X server - to respond to the DRI protocol request for new drawable info. - Since the hardware state depends on having the latest drawable - clip rects, all state checking must be done _after_ this call. */ - XMESA_VALIDATE_DRAWABLE_INFO(r128ctx->display, sPriv, dPriv); - - r128UpdateState(r128ctx, (stamp != dPriv->lastStamp)); -} - /* This function is called by libGL.so as soon as libGL.so is loaded. * This is where we'd register new extension functions with the dispatcher. */ -void __driRegisterExtensions(void) +void __driRegisterExtensions( void ) { } diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c b/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c index 1170a3a68..2f2d0cfb8 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c,v 1.1 2000/09/24 13:51:14 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c,v 1.5 2000/12/02 20:29:06 alanh Exp $ */ /* * Mesa 3-D graphics library * Version: 3.3 @@ -321,14 +321,13 @@ read_R5G6B5_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, ? (fxMesa->screen_width) : (info.strideInBytes / 2); const GLushort *data16 = (const GLushort *) info.lfbPtr + (winY - y) * srcStride + (winX + x); - const GLuint *data32 = (const GLuint *) data16; GLuint i, j; GLuint extraPixel = (n & 1); n -= extraPixel; for (i = j = 0; i < n; i += 2, j++) { - GLuint pixel = data32[j]; - GLuint pixel0 = pixel & 0xffff; - GLuint pixel1 = pixel >> 16; + /* use data16[] to keep correct alignment */ + GLuint pixel0 = data16[i]; + GLuint pixel1 = data16[i+1]; rgba[i][RCOMP] = FX_PixelToR(fxMesa, pixel0); rgba[i][GCOMP] = FX_PixelToG(fxMesa, pixel0); rgba[i][BCOMP] = FX_PixelToB(fxMesa, pixel0); @@ -1251,7 +1250,7 @@ GetFbParams(fxMesaContext fxMesa, { FxU32 physicalStrideInBytes, bufferOffset; FxU32 strideInBytes = info->strideInBytes; - FxU32 lfbPtr = (FxU32) (info->lfbPtr); + char *lfbPtr = (char *) (info->lfbPtr); /* * These two come directly from the info structure. @@ -1278,7 +1277,7 @@ GetFbParams(fxMesaContext fxMesa, * < bufferOffset&(info->strideInBytes-1) * the buffer begins in the forbidden zone. We assert for this. */ - bufferOffset = lfbPtr - (FxU32) backBufferInfo->lfbPtr; + bufferOffset = lfbPtr - (char *) backBufferInfo->lfbPtr; physicalStrideInBytes = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1) & ~(TILE_WIDTH_IN_BYTES - 1); @@ -1290,7 +1289,7 @@ GetFbParams(fxMesaContext fxMesa, * This is the address of the next physical line. */ ReadParamsp->lfbWrapPtr - = (void *) ((FxU32) backBufferInfo->lfbPtr + = (void *) ((char *) backBufferInfo->lfbPtr + (bufferOffset & ~(strideInBytes - 1)) + (TILE_HEIGHT_IN_LINES) * strideInBytes); } diff --git a/xc/lib/X11/KeysymStr.c b/xc/lib/X11/KeysymStr.c index 80d63a3ba..69e692182 100644 --- a/xc/lib/X11/KeysymStr.c +++ b/xc/lib/X11/KeysymStr.c @@ -21,7 +21,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/X11/KeysymStr.c,v 3.3 1999/05/09 10:49:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/KeysymStr.c,v 3.4 2000/12/02 01:16:02 dawes Exp $ */ #include "Xlibint.h" #include <X11/Xresource.h> @@ -130,7 +130,32 @@ char *XKeysymToString(ks) data.value = &resval; (void)XrmEnumerateDatabase(keysymdb, &empty, &empty, XrmEnumAllLevels, SameValue, (XPointer)&data); - return data.name; + if (data.name) + return data.name; + } + if ((ks & 0xff000000) == 0x01000000){ + KeySym val = ks; + char *s; + int i; + if (val & 0xff0000) + i = 8; + else + i = 6; + s = Xmalloc(i); + if (s == NULL) + return s; + i--; + s[i--] = '\0'; + for (; i; i--){ + val1 = val & 0xf; + val >>= 4; + if (val1 < 10) + s[i] = '0'+ val1; + else + s[i] = 'A'+ val1 - 10; + } + s[i] = 'U'; + return s; } return ((char *) NULL); } diff --git a/xc/lib/X11/StrKeysym.c b/xc/lib/X11/StrKeysym.c index 06250ca4b..94c6314db 100644 --- a/xc/lib/X11/StrKeysym.c +++ b/xc/lib/X11/StrKeysym.c @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/X11/StrKeysym.c,v 3.2 1999/05/09 10:50:15 dawes Exp $ */ +/* $XFree86: xc/lib/X11/StrKeysym.c,v 3.3 2000/12/02 01:16:03 dawes Exp $ */ #include "Xlibint.h" #include <X11/Xresource.h> @@ -121,7 +121,6 @@ KeySym XStringToKeysym(s) XrmValue result; XrmRepresentation from_type; char c; - KeySym val; XrmQuark names[2]; names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False); @@ -134,12 +133,27 @@ KeySym XStringToKeysym(s) { c = ((char *)result.addr)[i]; if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; - else if ('a' <= c && c <= 'z') val = (val<<4)+c-'a'+10; - else if ('A' <= c && c <= 'Z') val = (val<<4)+c-'A'+10; + else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; + else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; else return NoSymbol; } return val; } } + + if (*s == 'U') { + val = 0; + for (p = &s[1]; *p; p++) { + c = *p; + if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; + else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; + else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; + else return NoSymbol; + + } + if (val >= 0x01000000) + return NoSymbol; + return val | 0x01000000; + } return (NoSymbol); } diff --git a/xc/lib/X11/Ximint.h b/xc/lib/X11/Ximint.h index 7eb96e5e7..dae046ff7 100644 --- a/xc/lib/X11/Ximint.h +++ b/xc/lib/X11/Ximint.h @@ -30,7 +30,7 @@ PERFORMANCE OF THIS SOFTWARE. makoto@sm.sony.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/Ximint.h,v 3.7 2000/11/28 18:49:25 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Ximint.h,v 3.8 2000/12/04 18:49:19 dawes Exp $ */ #ifndef _XIMINT_H #define _XIMINT_H @@ -68,7 +68,8 @@ typedef struct _XimCommonPrivateRec { XlcConv cstomb_conv; XlcConv cstowc_conv; XlcConv cstoutf8_conv; - XlcConv ucs_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; } XimCommonPrivateRec; typedef union _XIMPrivateRec { diff --git a/xc/lib/X11/XimintL.h b/xc/lib/X11/XimintL.h index 539d800d6..be61ca417 100644 --- a/xc/lib/X11/XimintL.h +++ b/xc/lib/X11/XimintL.h @@ -32,7 +32,7 @@ THIS SOFTWARE. frankyling@hgrd01.enet.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/XimintL.h,v 1.5 2000/11/28 18:49:25 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XimintL.h,v 1.6 2000/12/04 18:49:19 dawes Exp $ */ #ifndef _XIMINTL_H #define _XIMINTL_H @@ -63,7 +63,8 @@ typedef struct _XimLocalPrivateRec { XlcConv cstomb_conv; XlcConv cstowc_conv; XlcConv cstoutf8_conv; - XlcConv ucs_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; XIC current_ic; DefTree *top; diff --git a/xc/lib/X11/XimintP.h b/xc/lib/X11/XimintP.h index 0831826d2..05d8e24c4 100644 --- a/xc/lib/X11/XimintP.h +++ b/xc/lib/X11/XimintP.h @@ -35,7 +35,7 @@ PERFORMANCE OF THIS SOFTWARE. miyamoto@jrd.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/XimintP.h,v 1.5 2000/11/28 18:49:26 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XimintP.h,v 1.6 2000/12/04 18:49:19 dawes Exp $ */ #ifndef _XIMINTP_H #define _XIMINTP_H @@ -109,7 +109,8 @@ typedef struct _XimProtoPrivateRec { XlcConv cstomb_conv; XlcConv cstowc_conv; XlcConv cstoutf8_conv; - XlcConv ucs_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; Window im_window; XIMID imid; diff --git a/xc/lib/X11/XlcPubI.h b/xc/lib/X11/XlcPubI.h index 4d1c577e4..4c1462127 100644 --- a/xc/lib/X11/XlcPubI.h +++ b/xc/lib/X11/XlcPubI.h @@ -23,7 +23,7 @@ * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ -/* $XFree86: xc/lib/X11/XlcPubI.h,v 3.6 2000/11/28 18:49:26 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XlcPubI.h,v 3.7 2000/12/04 18:49:20 dawes Exp $ */ #ifndef _XLCPUBLICI_H_ #define _XLCPUBLICI_H_ @@ -115,18 +115,22 @@ extern void _XlcDestroyLC( XLCd lcd ); +/* Fills into a freshly created XlcCharSet the fields that can be inferred + from the ESC sequence. These are side, char_size, set_size. */ extern Bool _XlcParseCharSet( XlcCharSet charset ); +/* Creates a new XlcCharSet, given its name (including side suffix) and + Compound Text ESC sequence (normally at most 4 bytes). */ extern XlcCharSet _XlcCreateDefaultCharSet( const char* name, - const char* control_sequence + const char* ct_sequence ); extern XlcCharSet _XlcAddCT( const char* name, - const char* control_sequence + const char* ct_sequence ); extern Bool _XlcInitCTInfo (void); diff --git a/xc/lib/X11/XlcPublic.h b/xc/lib/X11/XlcPublic.h index d57d9f83c..3f7b30152 100644 --- a/xc/lib/X11/XlcPublic.h +++ b/xc/lib/X11/XlcPublic.h @@ -31,7 +31,7 @@ * Modifier: Takanori Tateno FUJITSU LIMITED * */ -/* $XFree86: xc/lib/X11/XlcPublic.h,v 1.7 2000/11/28 18:49:26 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XlcPublic.h,v 1.8 2000/12/04 18:49:20 dawes Exp $ */ /* * Most of this API is documented in i18n/Framework.PS */ @@ -41,63 +41,127 @@ #include "Xlcint.h" -#define XlcNCharSize "charSize" -#define XlcNCodeset "codeset" -#define XlcNControlSequence "controlSequence" -#define XlcNDefaultString "defaultString" -#define XlcNEncodingName "encodingName" -#define XlcNLanguage "language" -#define XlcNMbCurMax "mbCurMax" -#define XlcNName "name" -#define XlcNSetSize "setSize" -#define XlcNSide "side" -#define XlcNStateDependentEncoding "stateDependentEncoding" -#define XlcNTerritory "territory" +/* + * Character sets. + */ + +/* Every character set has a "side". It denotes the range of byte values for + which the character set is responsible. This means that the character + set's encoded characters will only assumes bytes within the range, and + that the character set can be used simultaneously with another character + set responsible for a disjoint range. */ typedef enum { - XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther, XlcNONE + XlcUnknown, + XlcC0, /* responsible for values 0x00..0x1F */ + XlcGL, /* responsible for values 0x00..0x7F or 0x20..0x7F */ + XlcC1, /* responsible for values 0x80..0x9F */ + XlcGR, /* responsible for values 0x80..0xFF or 0xA0..0xFF */ + XlcGLGR, /* responsible for values 0x00..0xFF */ + XlcOther, /* unused */ + XlcNONE } XlcSide; -typedef struct _FontScope { - unsigned long start; - unsigned long end; - unsigned long shift; - unsigned long shift_direction; -} FontScopeRec, *FontScope; - +/* Data read from XLC_LOCALE files. + XXX Apparently superseded by _XUDCGlyphRegion. */ typedef struct _UDCArea { - unsigned long start,end; + unsigned long start; + unsigned long end; } UDCAreaRec, *UDCArea; -typedef struct _XlcCharSetRec *XlcCharSet; - -typedef char* (*XlcGetCSValuesProc)( -#if NeedFunctionPrototypes - XlcCharSet /* charset */, - XlcArgList /* args */, - int /* num_args */ -#endif -); +/* Where the character set comes from. */ +typedef enum { + CSsrcUndef, /* unused */ + CSsrcStd, /* defined in libX11 */ + CSsrcXLC /* defined in an XLC_LOCALE file */ +} CSSrc; -typedef enum {CSsrcUndef = 0, CSsrcStd, CSsrcXLC} CSSrc; +/* These are the supported properties of XlcCharSet. */ +#define XlcNCharSize "charSize" +#define XlcNControlSequence "controlSequence" +#define XlcNEncodingName "encodingName" +#define XlcNName "name" +#define XlcNSetSize "setSize" +#define XlcNSide "side" +/* This is the structure of an XlcCharSet. + Once allocated, they are never freed. */ typedef struct _XlcCharSetRec { - char *name; /* character set name */ + /* Character set name, including side suffix */ + const char *name; XrmQuark xrm_name; - char *encoding_name; /* XLFD encoding name */ + + /* XLFD encoding name, no side suffix */ + const char *encoding_name; XrmQuark xrm_encoding_name; - XlcSide side; /* GL, GR or others */ - int char_size; /* number of bytes per character */ - int set_size; /* graphic character sets */ - char *ct_sequence; /* control sequence of CT */ - XlcGetCSValuesProc get_values; - /* UDC */ + + /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */ + XlcSide side; + + /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */ + int char_size; + /* Classification of the character set according to ISO-2022 */ + int set_size; /* e.g. 94 or 96 */ + const char *ct_sequence; /* control sequence of CT */ + /* (normally at most 4 bytes) */ + + /* for UDC */ Bool string_encoding; UDCArea udc_area; int udc_area_num; - /* CS description source */ + + /* Description source */ CSSrc source; -} XlcCharSetRec; +} XlcCharSetRec, *XlcCharSet; + +_XFUNCPROTOBEGIN + +/* Returns the charset with the given name (including side suffix). + Returns NULL if not found. */ +extern XlcCharSet _XlcGetCharSet( + const char* name +); + +/* Returns the charset with the given encoding (no side suffix) and + responsible for at least the given side (XlcGL or XlcGR). + Returns NULL if not found. */ +extern XlcCharSet _XlcGetCharSetWithSide( + const char* encoding_name, + XlcSide side +); + +/* Registers an XlcCharSet in the list of character sets. + Returns True if successful. */ +extern Bool _XlcAddCharSet( + XlcCharSet charset +); + +/* Retrieves a number of attributes of an XlcCharSet. + Return NULL if successful, otherwise the name of the first argument + specifiying a nonexistent attribute. */ +extern char *_XlcGetCSValues( +#if NeedVarargsPrototypes + XlcCharSet charset, + ... +#endif +); + +_XFUNCPROTOEND + + +#define XlcNCodeset "codeset" +#define XlcNDefaultString "defaultString" +#define XlcNLanguage "language" +#define XlcNMbCurMax "mbCurMax" +#define XlcNStateDependentEncoding "stateDependentEncoding" +#define XlcNTerritory "territory" + +typedef struct _FontScope { + unsigned long start; + unsigned long end; + unsigned long shift; + unsigned long shift_direction; +} FontScopeRec, *FontScope; /* * conversion methods @@ -184,26 +248,6 @@ extern char *_XGetLCValues( #endif ); -extern XlcCharSet _XlcGetCharSet( - const char* name -); - -extern XlcCharSet _XlcGetCharSetWithSide( - const char* encoding_name, - XlcSide side -); - -extern Bool _XlcAddCharSet( - XlcCharSet charset -); - -extern char *_XlcGetCSValues( -#if NeedVarargsPrototypes - XlcCharSet /* charset */, - ... -#endif -); - extern XlcConv _XlcOpenConverter( XLCd from_lcd, const char* from_type, diff --git a/xc/lib/X11/Xlcint.h b/xc/lib/X11/Xlcint.h index 5ac26880b..cb9d69aed 100644 --- a/xc/lib/X11/Xlcint.h +++ b/xc/lib/X11/Xlcint.h @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/X11/Xlcint.h,v 3.6 2000/11/28 18:49:27 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Xlcint.h,v 3.7 2000/12/02 15:30:22 tsi Exp $ */ /* * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, @@ -221,8 +221,8 @@ typedef void (*XCloseLCProc)( typedef char* (*XlcMapModifiersProc)( #if NeedFunctionPrototypes XLCd /* lcd */, - char* /* user_mods */, - char* /* prog_mods */ + _Xconst char* /* user_mods */, + _Xconst char* /* prog_mods */ #endif ); @@ -863,8 +863,8 @@ extern Bool _XlcValidModSyntax( extern char *_XlcDefaultMapModifiers( XLCd lcd, - const char* user_mods, - const char* prog_mods + _Xconst char* user_mods, + _Xconst char* prog_mods ); extern void _XIMCompileResourceList( diff --git a/xc/lib/X11/Xlib.h b/xc/lib/X11/Xlib.h index 1c5d44f8d..91c7850f2 100644 --- a/xc/lib/X11/Xlib.h +++ b/xc/lib/X11/Xlib.h @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/X11/Xlib.h,v 3.17 2000/11/28 18:49:27 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Xlib.h,v 3.18 2000/12/04 18:49:20 dawes Exp $ */ /* @@ -4246,7 +4246,7 @@ extern int XWriteBitmapFile( extern Bool XSupportsLocale (void); extern char *XSetLocaleModifiers( - const char* modifier_list + const char* /* modifier_list */ ); extern XOM XOpenOM( diff --git a/xc/lib/X11/XlibInt.c b/xc/lib/X11/XlibInt.c index af2b76437..04977d997 100644 --- a/xc/lib/X11/XlibInt.c +++ b/xc/lib/X11/XlibInt.c @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/X11/XlibInt.c,v 3.22 2000/06/17 00:27:30 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XlibInt.c,v 3.23 2000/11/30 23:29:59 dawes Exp $ */ /* * XlibInt.c - Internal support routines for the C subroutine @@ -588,7 +588,10 @@ static void _XFlushInt (dpy, cv) register char *bufindex; _XExtension *ext; - if (dpy->flags & XlibDisplayIOError) return; + if (dpy->flags & XlibDisplayIOError) { + dpy->bufptr = dpy->buffer; /* reset to avoid buffer overflows */ + return; + } #ifdef XTHREADS while (dpy->flags & XlibDisplayWriting) { if (dpy->lock) { diff --git a/xc/lib/X11/imConv.c b/xc/lib/X11/imConv.c index f1d4e981d..5863e7294 100644 --- a/xc/lib/X11/imConv.c +++ b/xc/lib/X11/imConv.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* 2000 Modifier: Ivan Pascal The XFree86 Project. */ -/* $XFree86: xc/lib/X11/imConv.c,v 1.28 2000/11/28 18:49:32 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imConv.c,v 1.30 2000/12/04 18:49:21 dawes Exp $ */ #define NEED_EVENTS #include <stdio.h> @@ -91,12 +91,12 @@ XPointer _XimGetLocaleCode ( _Xconst char* encoding_name) #else -_XimGetLocaleCode (encoding_name, charset_ret) +_XimGetLocaleCode (encoding_name) _Xconst char* encoding_name; #endif { XPointer cvt = _Utf8GetConvByName(encoding_name); - if (!cvt) { + if (!cvt && encoding_name) { int i; for (i = 0; i < num_substitute; i++) if (!strcmp(encoding_name, SubstTable[i].encoding_name)) @@ -217,9 +217,9 @@ _XimLookupMBText(ic, event, buffer, nbytes, keysym, status) if (!ucs4) return 0; - if ((count = _XlcConvert(private->ucs_conv, - &from, &from_len, &to, &to_len, - args, 1 )) != 0) { + if (_XlcConvert(private->ucstoc_conv, + &from, &from_len, &to, &to_len, + args, 1 ) != 0) { count = 0; } else { from = (XPointer) look; @@ -286,9 +286,9 @@ _XimLookupWCText(ic, event, buffer, nbytes, keysym, status) if (!ucs4) return 0; - if ((count = _XlcConvert(private->ucs_conv, - &from, &from_len, &to, &to_len, - args, 1 )) != 0) { + if (_XlcConvert(private->ucstoc_conv, + &from, &from_len, &to, &to_len, + args, 1 ) != 0) { count = 0; } else { from = (XPointer) look; @@ -350,33 +350,20 @@ _XimLookupUTF8Text(ic, event, buffer, nbytes, keysym, status) (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { XPointer from = (XPointer) &ucs4; - XPointer to = (XPointer) look; int from_len = 1; - int to_len = BUF_SIZE; - XPointer args[1]; - XlcCharSet charset; - args[0] = (XPointer) &charset; + XPointer to = (XPointer) buffer; + int to_len = nbytes; + ucs4 = (ucs4_t) KeySymToUcs4(symbol); if (!ucs4) return 0; - if ((count = _XlcConvert(private->ucs_conv, - &from, &from_len, &to, &to_len, - args, 1 )) != 0) { + if (_XlcConvert(private->ucstoutf8_conv, + &from, &from_len, &to, &to_len, + NULL, 0) != 0) { count = 0; } else { - from = (XPointer) look; - to = (XPointer) buffer; - from_len = BUF_SIZE - to_len; - to_len = nbytes; - args[0] = (XPointer) charset; - if (_XlcConvert(private->cstoutf8_conv, - &from, &from_len, &to, &to_len, - args, 1 ) != 0) { - count = 0; - } else { - count = nbytes - to_len; - } + count = nbytes - to_len; } } /* FIXME: diff --git a/xc/lib/X11/imDefIm.c b/xc/lib/X11/imDefIm.c index 6b036f333..6c8441aca 100644 --- a/xc/lib/X11/imDefIm.c +++ b/xc/lib/X11/imDefIm.c @@ -31,7 +31,7 @@ OF THIS SOFTWARE. makoto@sm.sony.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imDefIm.c,v 1.6 2000/11/28 18:49:35 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imDefIm.c,v 1.7 2000/12/04 18:49:22 dawes Exp $ */ #include <X11/Xatom.h> #define NEED_EVENTS @@ -1053,6 +1053,14 @@ _XimProtoIMFree(im) _XlcCloseConverter(im->private.proto.cstoutf8_conv); im->private.proto.cstoutf8_conv = NULL; } + if (im->private.proto.ucstoc_conv) { + _XlcCloseConverter(im->private.proto.ucstoc_conv); + im->private.proto.ucstoc_conv = NULL; + } + if (im->private.proto.ucstoutf8_conv) { + _XlcCloseConverter(im->private.proto.ucstoutf8_conv); + im->private.proto.ucstoutf8_conv = NULL; + } #ifdef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { @@ -1685,7 +1693,11 @@ _XimGetEncoding(im, buf, name, name_len, detail, detail_len) if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) return False; - private->ucs_conv = conv; + private->ucstoc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) + return False; + private->ucstoutf8_conv = conv; return True; } diff --git a/xc/lib/X11/imLcIm.c b/xc/lib/X11/imLcIm.c index 89149c0ae..a007680a2 100644 --- a/xc/lib/X11/imLcIm.c +++ b/xc/lib/X11/imLcIm.c @@ -32,7 +32,7 @@ THIS SOFTWARE. frankyling@hgrd01.enet.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/imLcIm.c,v 1.7 2000/11/28 18:49:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imLcIm.c,v 1.8 2000/12/04 18:49:23 dawes Exp $ */ #include <stdio.h> /* @@ -147,6 +147,14 @@ _XimLocalIMFree(im) _XlcCloseConverter(im->private.local.cstoutf8_conv); im->private.local.cstoutf8_conv = NULL; } + if (im->private.local.ucstoc_conv) { + _XlcCloseConverter(im->private.local.ucstoc_conv); + im->private.local.ucstoc_conv = NULL; + } + if (im->private.local.ucstoutf8_conv) { + _XlcCloseConverter(im->private.local.ucstoutf8_conv); + im->private.local.ucstoutf8_conv = NULL; + } return; } @@ -283,7 +291,11 @@ _XimLocalOpenIM(im) if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) goto Open_Error; - private->ucs_conv = conv; + private->ucstoc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) + goto Open_Error; + private->ucstoutf8_conv = conv; im->methods = &Xim_im_local_methods; private->current_ic = (XIC)NULL; diff --git a/xc/lib/X11/imLcLkup.c b/xc/lib/X11/imLcLkup.c index e96d5bc12..bf287344b 100644 --- a/xc/lib/X11/imLcLkup.c +++ b/xc/lib/X11/imLcLkup.c @@ -29,7 +29,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imLcLkup.c,v 3.3 2000/11/28 18:49:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imLcLkup.c,v 3.4 2000/12/04 18:49:24 dawes Exp $ */ #include <stdio.h> #include <X11/Xatom.h> @@ -57,7 +57,7 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) if(status) *status = XLookupNone; return(0); } - if(ev->keycode == 0) { /* Composed Event */ + if(ev->keycode == 0 && ic->private.local.composed != NULL) { /* Composed Event */ ret = strlen(ic->private.local.composed->mb); if(ret > bytes) { if(status) *status = XBufferOverflow; diff --git a/xc/lib/X11/imThaiFlt.c b/xc/lib/X11/imThaiFlt.c index a5dad60f7..3ef81d132 100644 --- a/xc/lib/X11/imThaiFlt.c +++ b/xc/lib/X11/imThaiFlt.c @@ -41,7 +41,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/lib/X11/imThaiFlt.c,v 3.5 2000/11/28 18:49:38 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imThaiFlt.c,v 3.6 2000/12/02 15:30:22 tsi Exp $ */ /* **++ @@ -1174,7 +1174,7 @@ XPointer client_data; if (!IC_IscMode(ic)) InitIscMode(ic); - count = XmbLookupString(ic, &ev->xkey, buf, sizeof(buf), &symbol, NULL); + count = XmbLookupString((XIC)ic, &ev->xkey, buf, sizeof(buf), &symbol, NULL); if (((symbol >> 8 == 0xFF) && ((XK_BackSpace <= symbol && symbol <= XK_Clear) || diff --git a/xc/lib/X11/imThaiIm.c b/xc/lib/X11/imThaiIm.c index 3bdd5b8b9..e21bfa7b2 100644 --- a/xc/lib/X11/imThaiIm.c +++ b/xc/lib/X11/imThaiIm.c @@ -32,7 +32,7 @@ THIS SOFTWARE. frankyling@hgrd01.enet.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/imThaiIm.c,v 1.5 2000/11/28 18:49:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imThaiIm.c,v 1.6 2000/12/04 18:49:24 dawes Exp $ */ #include <stdio.h> #include <X11/Xlib.h> @@ -124,7 +124,11 @@ _XimThaiOpenIM(im) if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) goto Open_Error; - private->ucs_conv = conv; + private->ucstoc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) + goto Open_Error; + private->ucstoutf8_conv = conv; im->methods = &Xim_im_thai_methods; private->current_ic = (XIC)NULL; @@ -196,6 +200,14 @@ _XimThaiIMFree(im) _XlcCloseConverter(im->private.local.cstoutf8_conv); im->private.local.cstoutf8_conv = NULL; } + if (im->private.local.ucstoc_conv) { + _XlcCloseConverter(im->private.local.ucstoc_conv); + im->private.local.ucstoc_conv = NULL; + } + if (im->private.local.ucstoutf8_conv) { + _XlcCloseConverter(im->private.local.ucstoutf8_conv); + im->private.local.ucstoutf8_conv = NULL; + } return; } diff --git a/xc/lib/X11/lcCT.c b/xc/lib/X11/lcCT.c index 206e142df..60d0c561d 100644 --- a/xc/lib/X11/lcCT.c +++ b/xc/lib/X11/lcCT.c @@ -36,7 +36,7 @@ * Modifier: Ivan Pascal The XFree86 Project * Modifier: Bruno Haible The XFree86 Project */ -/* $XFree86: xc/lib/X11/lcCT.c,v 3.19 2000/11/28 18:49:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcCT.c,v 3.21 2000/12/04 18:49:25 dawes Exp $ */ #include "Xlibint.h" #include "XlcPubI.h" @@ -51,7 +51,7 @@ */ typedef struct _CTDataRec { const char *name; - const char *encoding; /* Compound Text encoding, ESC sequence */ + const char *ct_sequence; /* Compound Text encoding, ESC sequence */ } CTDataRec, *CTData; static CTDataRec default_ct_data[] = @@ -109,32 +109,22 @@ static CTDataRec default_ct_data[] = /* Registered encodings with a varying number of bytes per character */ { "ISO10646-1", /* UTF-8 196 */ "\033%G" }, - /* Encodings without ISO-IR assigned escape sequence */ - { "KOI8-R:GR", "\033%/1\200\210koi8-r\002"}, - { "KOI8-U:GR", "\033%/1\200\211koi8-u\002"}, - { "KOI8-C:GR", "\033%/1\200\210koi8-c\002"}, - { "TATAR-CYR:GR", "\033%/1\200\210tatar-cyr\002"}, - { "ARMSCII-8:GR", "\033%/1\200\210armscii-8\002"}, - { "IBM-CP1133:GR", "\033%/1\200\210ibm-cp1133\002"}, - { "MULELAO-1:GR", "\033%/1\200\210mulelao-1\002"}, - { "VISCII1.1-1:GR", "\033%/1\200\210viscii1.1-1\002"}, - { "TCVN-5712:GR", "\033%/1\200\210tcvn-5712\002"}, - { "GEORGIAN-ACADEMY:GR", "\033%/1\200\210georgian-academy\002"}, - { "GEORGIAN-PS:GR", "\033%/1\200\210georgian-ps\002"}, - { "ISO8859-9E:GR", "\033%/1\200\210iso8859-9e\002"}, - { "MICROSOFT-CP1251:GR", "\033%/1\200\210microsoft-cp1251\002"}, - { "MICROSOFT-CP1255:GR", "\033%/1\200\210microsoft-cp1255\002"}, - { "MICROSOFT-CP1256:GR", "\033%/1\200\210microsoft-cp1256\002"}, + /* Encodings without ISO-IR assigned escape sequence must be + defined in XLC_LOCALE files, using "\033%/1" or "\033%/2". */ + /* Backward compatibility with XFree86 3.x */ - { "ISO8859-14:GR", "\033%/1\200\213iso8859-14\002"}, - { "ISO8859-15:GR", "\033%/1\200\213iso8859-15\002"}, + { "ISO8859-14:GR", "\033%/1" }, + { "ISO8859-15:GR", "\033%/1" }, /* used by Emacs, but not backed by ISO-IR */ { "BIG5-0:GL", "\033$(0" }, { "BIG5-0:GR", "\033$)0" }, { "BIG5-1:GL", "\033$(1" }, { "BIG5-1:GR", "\033$)1" }, -}; +}; + +/* We represent UTF-8 as an XlcGLGR charset, not in extended segments. */ +#define UTF8_IN_EXTSEQ 0 /* ======================= Parsing ESC Sequences ======================= */ @@ -172,42 +162,61 @@ static CTDataRec default_ct_data[] = /* * Parses the header of a Compound Text segment, i.e. the charset designator. + * The string starts at *text and has *length bytes. + * Return value is one of: + * 0 (no valid charset designator), + * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, + * XctLeftToRight, XctRightToLeft, XctDirectionEnd, + * XctExtSeg, XctOtherCoding, XctIgnoreExt, XctNotIgnoreExt. + * If the return value is not 0, *text is incremented and *length decremented, + * to point past the charset designator. If the return value is one of + * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, + * XctExtSeg, XctOtherCoding, XctIgnoreExt, XctNotIgnoreExt, + * *final_byte is set to the "final byte" of the charset designator. */ static unsigned int _XlcParseCT( const char **text, int *length, - unsigned int *extra_data) + unsigned char *final_byte) { - unsigned int ret = 0, dummy, *data = extra_data; + unsigned int ret = 0; unsigned char ch; const unsigned char *str = (const unsigned char *) *text; - if (data == NULL) - data = &dummy; - *data = 0; + *final_byte = 0; + if (*length < 1) + return 0; switch (ch = *str++) { case XctESC: + if (*length < 2) + return 0; switch (ch = *str++) { case XctOtherCoding: /* % */ + if (*length < 3) + return 0; ch = *str++; - if (ch == XctNonStandard) { + if (ch == XctNonStandard) { /* / */ + if (*length < 4) + return 0; ret = XctExtSeg; ch = *str++; } else { ret = XctOtherCoding; } - *data = (unsigned int) ch; + *final_byte = ch; break; case XctCntrlFunc: /* # */ - *data = (unsigned int) *str++; - switch (*str++){ - case XctIgnoreExt: + if (*length < 4) + return 0; + *final_byte = *str++; + switch (*str++) { + case XctIgnoreExt: /* 0 */ ret = XctIgnoreExt; break; - case XctNotIgnoreExt: + case XctNotIgnoreExt: /* 1 */ ret = XctNotIgnoreExt; break; default: @@ -217,62 +226,78 @@ _XlcParseCT( break; case XctMB: /* $ */ + if (*length < 4) + return 0; ch = *str++; switch (ch) { - case XctGL94: + case XctGL94: /* ( */ ret = XctGL94MB; break; - case XctGR94: + case XctGR94: /* ) */ ret = XctGR94MB; break; default: ret = 0; break; } - *data = (unsigned int) *str++; + *final_byte = *str++; break; - case XctGL94: + case XctGL94: /* ( */ + if (*length < 3) + return 0; ret = XctGL94; - *data = (unsigned int) *str++; + *final_byte = *str++; break; - case XctGR94: + case XctGR94: /* ) */ + if (*length < 3) + return 0; ret = XctGR94; - *data = (unsigned int) *str++; + *final_byte = *str++; break; - case XctGR96: + case XctGR96: /* - */ + if (*length < 3) + return 0; ret = XctGR96; - *data = (unsigned int) *str++; + *final_byte = *str++; break; } break; case XctCSI: /* direction */ - if (*str == XctLeftToRight && *(str + 1) == XctDirection) { - ret = XctLeftToRight; - str += 2; - } else if (*str == XctRightToLeft && *(str + 1) == XctDirection) { - ret = XctRightToLeft; - str += 2; - } else if (*str == XctDirectionEnd) { - ret = XctDirectionEnd; - str++; - } else { - ret = 0; + if (*length < 2) + return 0; + switch (*str++) { + case XctLeftToRight: + if (*length < 3) + return 0; + if (*str++ == XctDirection) + ret = XctLeftToRight; + break; + case XctRightToLeft: + if (*length < 3) + return 0; + if (*str++ == XctDirection) + ret = XctRightToLeft; + break; + case XctDirectionEnd: + ret = XctDirectionEnd; + break; } break; } if (ret) { - *length -= (char *) str - *text; - *text = (char *) str; + *length -= (const char *) str - *text; + *text = (const char *) str; } return ret; } /* * Fills into a freshly created XlcCharSet the fields that can be inferred - * from the ESC sequence. + * from the ESC sequence. These are side, char_size, set_size. + * Returns True if the charset can be used with Compound Text. * * Used by _XlcCreateDefaultCharSet. */ @@ -280,57 +305,66 @@ Bool _XlcParseCharSet( XlcCharSet charset) { - unsigned int type, final_byte; + unsigned int type; + unsigned char final_byte; const char *ptr = charset->ct_sequence; int length; - int char_size = 1; + int char_size; - if (ptr == NULL || *ptr == '\0') + if (*ptr == '\0') return False; length = strlen(ptr); type = _XlcParseCT(&ptr, &length, &final_byte); - if (type == XctGR94MB || type == XctGL94MB) { - if (final_byte < 0x60) { - char_size = 2; - } else if (final_byte < 0x70) { - char_size = 3; - } else { - char_size = 4; - } + /* Check for validity and determine char_size. + char_size = 0 means varying number of bytes per character. */ + switch (type) { + case XctGL94: + case XctGR94: + case XctGR96: + char_size = 1; + break; + case XctGL94MB: + case XctGR94MB: + char_size = (final_byte < 0x60 ? 2 : final_byte < 0x70 ? 3 : 4); + break; + case XctExtSeg: + char_size = final_byte - '0'; + if (!(char_size >= 0 && char_size <= 4)) + return False; + break; + case XctOtherCoding: + char_size = 0; + break; + default: + return False; } - if (type == XctExtSeg) { - char_size = final_byte - '0'; - if ((char_size < 1) || (char_size > 4)) - char_size = 1; - } + charset->char_size = char_size; + /* Fill in other values. */ switch (type) { - case XctGR94MB : - case XctGR94 : - charset->side = XlcGR; - charset->set_size = 94; - charset->char_size = char_size; - break; - case XctGL94MB : - case XctGL94 : - charset->side = XlcGL; - charset->set_size = 94; - charset->char_size = char_size; - break; - case XctGR96: - charset->side = XlcGR; - charset->set_size = 96; - charset->char_size = char_size; - break; - case XctOtherCoding: - case XctExtSeg: - charset->side = XlcGLGR; - charset->char_size = char_size; - break; + case XctGL94: + case XctGL94MB: + charset->side = XlcGL; + charset->set_size = 94; + break; + case XctGR94: + case XctGR94MB: + charset->side = XlcGR; + charset->set_size = 94; + break; + case XctGR96: + charset->side = XlcGR; + charset->set_size = 96; + break; + case XctExtSeg: + case XctOtherCoding: + charset->side = XlcGLGR; + charset->set_size = 0; + break; } return True; } @@ -341,13 +375,18 @@ _XlcParseCharSet( /* * Representation of a character set that can be used for Compound Text, * at run time. + * Note: This information is not contained in the XlcCharSet, because + * multiple ESC sequences may be used for the same XlcCharSet. */ typedef struct _CTInfoRec { XlcCharSet charset; + const char *ct_sequence; /* Compound Text ESC sequence */ unsigned int type; unsigned char final_byte; - int ext_segment_len; - char *ext_segment; /* extended segment */ + /* If type == XctExtSeg: */ + const char *ext_segment; /* extended segment name, then '\002' */ + int ext_segment_len; /* length of above, including final '\002' */ + struct _CTInfoRec *next; } CTInfoRec, *CTInfo; @@ -357,106 +396,160 @@ typedef struct _CTInfoRec { * at runtime through _XlcAddCT. */ static CTInfo ct_list = NULL; +static CTInfo *ct_list_end = &ct_list; +/* + * Returns a Compound Text info record for an ESC sequence. + * The first part of the ESC sequence has already been parsed into 'type' + * and 'final_byte'. The remainder starts at 'text', at least 'text_len' + * bytes (only used if type == XctExtSeg). + */ static CTInfo _XlcGetCTInfo( - const char *text, - unsigned int type, - unsigned char final_byte) + unsigned int type, + unsigned char final_byte, + const char *text, + int text_len) { - CTInfo ct_info; - - for (ct_info = ct_list; ct_info; ct_info = ct_info->next) { - if (ct_info->type == type && ct_info->final_byte == final_byte) { - if (ct_info->ext_segment) { - if (text && - !strncmp(text, ct_info->ext_segment, ct_info->ext_segment_len)) - return ct_info; - } else { + CTInfo ct_info; + + for (ct_info = ct_list; ct_info; ct_info = ct_info->next) + if (ct_info->type == type + && ct_info->final_byte == final_byte + && (type != XctExtSeg + || (text_len >= ct_info->ext_segment_len + && memcmp(text, ct_info->ext_segment, + ct_info->ext_segment_len) == 0))) return ct_info; - } - } - } - return (CTInfo) NULL; + + return (CTInfo) NULL; } +/* Returns the Compound Text info for a given XlcCharSet. + Returns NULL if none is found. */ +static CTInfo +_XlcGetCTInfoFromCharSet( + XlcCharSet charset) +{ + CTInfo ct_info; + + for (ct_info = ct_list; ct_info; ct_info = ct_info->next) + if (ct_info->charset == charset) + return ct_info; + + return (CTInfo) NULL; +} + +/* Creates a new XlcCharSet, given its name (including side suffix) and + Compound Text ESC sequence (normally at most 4 bytes), and makes it + eligible for Compound Text processing. */ XlcCharSet _XlcAddCT( const char *name, const char *ct_sequence) { - CTInfo ct_info; + CTInfo ct_info, existing_info; XlcCharSet charset; - const char *ct_ptr = ct_sequence; + const char *ct_ptr; int length; - unsigned int type, final_byte; - - length = strlen(ct_sequence); + unsigned int type; + unsigned char final_byte; charset = _XlcGetCharSet(name); - if (charset == NULL) { + if (charset != NULL) { + /* Even if the charset already exists, it is OK to register a second + Compound Text sequence for it. */ + } else { + /* Attempt to create the charset. */ charset = _XlcCreateDefaultCharSet(name, ct_sequence); if (charset == NULL) return (XlcCharSet) NULL; _XlcAddCharSet(charset); } - ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec)); + /* Allocate a CTinfo record. */ + length = strlen(ct_sequence); + ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec) + length+1); if (ct_info == NULL) - return (XlcCharSet) NULL; + return charset; + + ct_info->charset = charset; + ct_info->ct_sequence = strcpy((char *) (ct_info + 1), ct_sequence); - ct_info->ext_segment = NULL; - ct_info->ext_segment_len = 0; - + /* Parse the Compound Text sequence. */ + ct_ptr = ct_sequence; type = _XlcParseCT(&ct_ptr, &length, &final_byte); + ct_info->type = type; + ct_info->final_byte = final_byte; + switch (type) { - case XctExtSeg: - if (strlen(charset->ct_sequence) > 6) { - ct_info->ext_segment = charset->ct_sequence + 6; - ct_info->ext_segment_len = strlen(ct_info->ext_segment) - 1; - } else { - ct_info->ext_segment = charset->encoding_name; - ct_info->ext_segment_len = strlen(ct_info->ext_segment); - } case XctGL94: - case XctGL94MB: case XctGR94: - case XctGR94MB: case XctGR96: + case XctGL94MB: + case XctGR94MB: case XctOtherCoding: - ct_info->type = type; - ct_info->final_byte = (unsigned char) final_byte; - ct_info->charset = charset; + ct_info->ext_segment = NULL; + ct_info->ext_segment_len = 0; break; + case XctExtSeg: { + /* By convention, the extended segment name is the encoding_name + in lowercase. */ + const char *q = charset->encoding_name; + int n = strlen(q); + char *p; + + /* Ensure ct_info->ext_segment_len <= 0x3fff - 6. */ + if (n > 0x3fff - 6 - 1) { + Xfree(ct_info); + return charset; + } + p = (char *) Xmalloc(n+1); + if (p == NULL) { + Xfree(ct_info); + return charset; + } + ct_info->ext_segment = p; + ct_info->ext_segment_len = n+1; + for ( ; n > 0; p++, q++, n--) + *p = (*q >= 'A' && *q <= 'Z' ? *q - 'A' + 'a' : *q); + *p = XctSTX; + break; + } default: Xfree(ct_info); return (XlcCharSet) NULL; } - if (!_XlcGetCTInfo( ct_info->ext_segment, type, ct_info->final_byte)) { - ct_info->next = ct_list; - ct_list = ct_info; + /* Insert it into the list, if not already present. */ + existing_info = + _XlcGetCTInfo(type, ct_info->final_byte, + ct_info->ext_segment, ct_info->ext_segment_len); + if (existing_info == NULL) { + /* Insert it at the end. If there are duplicates CTinfo entries + for the same XlcCharSet, we want the first (standard) one to + override the second (user defined) one. */ + ct_info->next = *ct_list_end; + *ct_list_end = ct_info; } else { + if (existing_info->charset != charset + /* We have a conflict, with one exception: JISX0208.1983-0 and + JISX0208.1990-0 are the same for all practical purposes. */ + && !(strncmp(existing_info->charset->name, "JISX0208", 8) == 0 + && strncmp(charset->name, "JISX0208", 8) == 0)) { + fprintf(stderr, + "Xlib: charsets %s and %s have the same CT sequence\n", + charset->name, existing_info->charset->name); + if (strcmp(charset->ct_sequence, ct_sequence) == 0) + charset->ct_sequence = ""; + } Xfree(ct_info); } return charset; } -static CTInfo -_XlcGetCTInfoFromCharSet( - XlcCharSet charset) -{ - CTInfo ct_info; - - for (ct_info = ct_list; ct_info; ct_info = ct_info->next) - if (ct_info->charset == charset) - return ct_info; - - return (CTInfo) NULL; -} - /* ========== Converters String <--> CharSet <--> Compound Text ========== */ @@ -464,20 +557,20 @@ _XlcGetCTInfoFromCharSet( * Structure representing the parse state of a Compound Text string. */ typedef struct _StateRec { - XlcCharSet charset; - XlcCharSet GL_charset; - XlcCharSet GR_charset; - XlcCharSet ext_seg_charset; - int ext_seg_left; + XlcCharSet charset; /* The charset of the current segment */ + XlcCharSet GL_charset; /* The charset responsible for 0x00..0x7F */ + XlcCharSet GR_charset; /* The charset responsible for 0x80..0xFF */ + int ext_seg_left; /* > 0 if currently in an extended segment */ } StateRec, *State; -typedef enum { resOK, resNotCTSeq, resNotInList } CheckResult; -/* resNotCTSeq - EscSeq not recognized, pointers not changed -* resNotInList - EscSeq recognized but charset not found, -* sequence skiped -* resOK - OK. Charset saved in 'state', sequence skiped -*/ +/* Subroutine for parsing an ESC sequence. */ + +typedef enum { + resOK, /* Charset saved in 'state', sequence skipped */ + resNotInList, /* Charset not found, sequence skipped */ + resNotCTSeq /* EscSeq not recognized, pointers not changed */ +} CheckResult; static CheckResult _XlcCheckCTSequence( @@ -487,45 +580,73 @@ _XlcCheckCTSequence( { XlcCharSet charset; CTInfo ct_info; - unsigned int type, final_byte; - unsigned int ext_seg_left; - - type = _XlcParseCT(ctext, ctext_len, &final_byte); + const char *tmp_ctext = *ctext; + int tmp_ctext_len = *ctext_len; + unsigned int type; + unsigned char final_byte; + int ext_seg_left = 0; - if (!type) - return resNotCTSeq; + /* Check for validity. */ + type = _XlcParseCT(&tmp_ctext, &tmp_ctext_len, &final_byte); - if ((type == XctExtSeg) && (*ctext_len > 2)) { - int msb = *(*ctext)++ & 0x7f; - int lsb = *(*ctext)++ & 0x7f; - ext_seg_left = (msb << 7) + lsb - 2; - *ctext_len -= 2; + switch (type) { + case XctGL94: + case XctGR94: + case XctGR96: + case XctGL94MB: + case XctGR94MB: + case XctOtherCoding: + *ctext = tmp_ctext; + *ctext_len = tmp_ctext_len; + break; + case XctExtSeg: + if (tmp_ctext_len > 2 + && (tmp_ctext[0] & 0x80) && (tmp_ctext[0] & 0x80)) { + unsigned int msb = tmp_ctext[0] & 0x7f; + unsigned int lsb = tmp_ctext[1] & 0x7f; + ext_seg_left = (msb << 7) + lsb; + if (ext_seg_left <= tmp_ctext_len - 2) { + *ctext = tmp_ctext + 2; + *ctext_len = tmp_ctext_len - 2; + break; + } + } + return resNotCTSeq; + default: + return resNotCTSeq; } - ct_info = _XlcGetCTInfo(*ctext, type, (unsigned char) final_byte); + ct_info = _XlcGetCTInfo(type, final_byte, *ctext, ext_seg_left); if (ct_info) { charset = ct_info->charset; - if (ct_info->ext_segment_len) { - *ctext += ct_info->ext_segment_len + 1; - *ctext_len -= ct_info->ext_segment_len + 1; - } - if (charset->side == XlcGL) { - state->GL_charset = charset; - } else if (charset->side == XlcGR) { - state->GR_charset = charset; + state->ext_seg_left = ext_seg_left; + if (type == XctExtSeg) { + state->charset = charset; + /* Skip past the extended segment name and the separator. */ + *ctext += ct_info->ext_segment_len; + *ctext_len -= ct_info->ext_segment_len; + state->ext_seg_left -= ct_info->ext_segment_len; } else { - state->GL_charset = charset; - state->GR_charset = charset; + if (charset->side == XlcGL) { + state->GL_charset = charset; + } else if (charset->side == XlcGR) { + state->GR_charset = charset; + } else { + state->GL_charset = charset; + state->GR_charset = charset; + } } + return resOK; } else { + state->ext_seg_left = 0; if (type == XctExtSeg) { + /* Skip the entire extended segment. */ *ctext += ext_seg_left; *ctext_len -= ext_seg_left; } return resNotInList; } - return resOK; } static void @@ -533,17 +654,18 @@ init_state( XlcConv conv) { State state = (State) conv->state; - static XlcCharSet GL_charset = NULL; - static XlcCharSet GR_charset = NULL; + static XlcCharSet default_GL_charset = NULL; + static XlcCharSet default_GR_charset = NULL; - if (GL_charset == NULL) { - GL_charset = _XlcGetCharSet("ISO8859-1:GL"); - GR_charset = _XlcGetCharSet("ISO8859-1:GR"); + if (default_GL_charset == NULL) { + default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); + default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); } - state->GL_charset = state->charset = GL_charset; - state->GR_charset = GR_charset; - state->ext_seg_charset = NULL; + /* The initial state is ISO-8859-1 on both sides. */ + state->GL_charset = state->charset = default_GL_charset; + state->GR_charset = default_GR_charset; + state->ext_seg_left = 0; } @@ -560,12 +682,11 @@ cttocs( int num_args) { State state = (State) conv->state; - unsigned char ch; - CheckResult ret; XlcCharSet charset = NULL; const char *ctptr; char *bufptr; int ctext_len, buf_len; + int unconv_num = 0; ctptr = (const char *) *from; bufptr = (char *) *to; @@ -573,43 +694,145 @@ cttocs( buf_len = *to_left; while (ctext_len > 0 && buf_len > 0) { - ch = *ctptr; -#ifdef notdef - if (ch == XctCSI) { - /* do nothing except skip sequence if not recognized */ - if (_XlcParseCT(&ctptr, &ctext_len, NULL)) - continue; - } -#endif - if (ch == XctESC) { - ret = _XlcCheckCTSequence(state, &ctptr, &ctext_len); - if (ret == resOK || ret == resNotInList) - continue; - } - if (charset) { - if (charset != (ch & 0x80 ? state->GR_charset : state->GL_charset)) - break; + if (state->ext_seg_left == 0) { + /* Not in the middle of an extended segment; look at next byte. */ + unsigned char ch = *ctptr; + XlcCharSet ch_charset; + + if (ch == XctESC) { + CheckResult ret = + _XlcCheckCTSequence(state, &ctptr, &ctext_len); + if (ret == resOK) + /* state has been modified. */ + continue; + if (ret == resNotInList) { + /* XXX Just continue with previous charset. */ + unconv_num++; + continue; + } + } else if (ch == XctCSI) { + /* XXX Simply ignore the XctLeftToRight, XctRightToLeft, + XctDirectionEnd sequences for the moment. */ + unsigned char dummy; + if (_XlcParseCT(&ctptr, &ctext_len, &dummy)) { + unconv_num++; + continue; + } + } + + /* Find the charset which is responsible for this byte. */ + ch_charset = (ch & 0x80 ? state->GR_charset : state->GL_charset); + + /* Set the charset of this run, or continue the current run, + or stop the current run. */ + if (charset) { + if (charset != ch_charset) + break; + } else { + state->charset = charset = ch_charset; + } + + /* We don't want to split a character into multiple pieces. */ + if (buf_len < 6) { + if (charset->char_size > 0) { + if (buf_len < charset->char_size) + break; + } else { + /* char_size == 0 is tricky. The code here is good only + for valid UTF-8 input. */ + if (charset->ct_sequence[0] == XctESC + && charset->ct_sequence[1] == XctOtherCoding + && charset->ct_sequence[2] == 'G') { + int char_size = (ch < 0xc0 ? 1 : + ch < 0xe0 ? 2 : + ch < 0xf0 ? 3 : + ch < 0xf8 ? 4 : + ch < 0xfc ? 5 : + 6); + if (buf_len < char_size) + break; + } + } + } + + *bufptr++ = *ctptr++; + ctext_len--; + buf_len--; } else { - charset = (ch & 0x80 ? state->GR_charset : state->GL_charset); - } + /* Copy as much as possible from the current extended segment + to the buffer. */ + int char_size; + + /* Set the charset of this run, or continue the current run, + or stop the current run. */ + if (charset) { + if (charset != state->charset) + break; + } else { + charset = state->charset; + } + + char_size = charset->char_size; - *bufptr++ = *ctptr++; - ctext_len--; - buf_len--; + if (state->ext_seg_left <= buf_len || char_size > 0) { + int n = (state->ext_seg_left <= buf_len + ? state->ext_seg_left + : (buf_len / char_size) * char_size); + memcpy(bufptr, ctptr, n); + ctptr += n; ctext_len -= n; + bufptr += n; buf_len -= n; + state->ext_seg_left -= n; + } else { +#if UTF8_IN_EXTSEQ + /* char_size == 0 is tricky. The code here is good only + for valid UTF-8 input. */ + if (strcmp(charset->name, "ISO10646-1") == 0) { + unsigned char ch = *ctptr; + int char_size = (ch < 0xc0 ? 1 : + ch < 0xe0 ? 2 : + ch < 0xf0 ? 3 : + ch < 0xf8 ? 4 : + ch < 0xfc ? 5 : + 6); + int i; + if (buf_len < char_size) + break; + /* A small loop is faster than calling memcpy. */ + for (i = char_size; i > 0; i--) + *bufptr++ = *ctptr++; + ctext_len -= char_size; + buf_len -= char_size; + state->ext_seg_left -= char_size; + } else +#endif + { + /* Here ctext_len >= state->ext_seg_left > buf_len. + We may be splitting a character into multiple pieces. + Oh well. */ + int n = buf_len; + memcpy(bufptr, ctptr, n); + ctptr += n; ctext_len -= n; + bufptr += n; buf_len -= n; + state->ext_seg_left -= n; + } + } + } } - if (charset) - state->charset = charset; + /* 'charset' is the charset for the current run. In some cases, + 'state->charset' contains the charset for the next run. Therefore, + return 'charset'. + 'charset' may still be NULL only if no output was produced. */ if (num_args > 0) - *((XlcCharSet *) args[0]) = state->charset; + *((XlcCharSet *) args[0]) = charset; - *from_left -= ctptr - *((char **) from); + *from_left -= ctptr - *((const char **) from); *from = (XPointer) ctptr; *to_left -= bufptr - *((char **) to); *to = (XPointer) bufptr; - return 0; + return unconv_num; } /* from XlcNCharSet to XlcNCompoundText */ @@ -634,6 +857,8 @@ cstoct( const char *csptr; char *ctptr; int csstr_len, ct_len; + char *ext_segment_start; + int char_size; /* One argument is required, of type XlcCharSet. */ if (num_args < 1) @@ -651,78 +876,154 @@ cstoct( return -1; side = charset->side; - length = strlen(charset->ct_sequence); + length = strlen(ct_info->ct_sequence); - if (((side == XlcGR || side == XlcGLGR) && - charset != state->GR_charset) || - ((side == XlcGL || side == XlcGLGR) && - charset != state->GL_charset) ) { + ext_segment_start = NULL; - /* output esc-sequence */ - if ((ct_info->type == XctExtSeg) && (length < 7)) { - int comp_len = length + strlen(ct_info->ext_segment) + 3; + /* Test whether the charset is already active. */ + if (((side == XlcGR || side == XlcGLGR) + && charset != state->GR_charset) + || ((side == XlcGL || side == XlcGLGR) + && charset != state->GL_charset)) { - if (ct_len < comp_len) + /* Output the Escape sequence for switching to the charset. */ + if (ct_info->type == XctExtSeg) { + if (ct_len < length + 2 + ct_info->ext_segment_len) return -1; - strcpy(ctptr, ct_info->charset->ct_sequence); + memcpy(ctptr, ct_info->ct_sequence, length); ctptr += length; + ct_len -= length; - length = ct_info->ext_segment_len; - *ctptr++ = ((length + 3) / 128) | 0x80; - *ctptr++ = ((length + 3) % 128) | 0x80; - strncpy(ctptr, ct_info->ext_segment, length); - ctptr += length; - *ctptr++ = XctSTX; - ct_len -= comp_len; + ctptr += 2; + ct_len -= 2; + ext_segment_start = ctptr; + /* The size of an extended segment must fit in 14 bits. */ + if (ct_len > 0x3fff) + ct_len = 0x3fff; + + memcpy(ctptr, ct_info->ext_segment, ct_info->ext_segment_len); + ctptr += ct_info->ext_segment_len; + ct_len -= ct_info->ext_segment_len; } else { if (ct_len < length) return -1; - strcpy(ctptr, ct_info->charset->ct_sequence); + memcpy(ctptr, ct_info->ct_sequence, length); ctptr += length; ct_len -= length; } } + + /* If the charset has side GL or GR, prepare remapping the characters + to the correct side. */ if (charset->set_size) { min_ch = 0x20; max_ch = 0x7f; - if (charset->set_size == 94) { max_ch--; - if (charset->char_size > 1 || side == XlcGR) - min_ch++; + if (charset->char_size > 1 || side == XlcGR) + min_ch++; } } - while (csstr_len > 0 && ct_len > 0) { - if (charset->set_size) { - ch = *((unsigned char *) csptr) & 0x7f; - if (ch < min_ch || ch > max_ch) - if (ch != 0x00 && ch != 0x09 && ch != 0x0a && ch != 0x1b) { + /* Actually copy the contents. */ + unconv_num = 0; + char_size = charset->char_size; + if (char_size == 1) { + while (csstr_len > 0 && ct_len > 0) { + if (charset->set_size) { + /* The CompoundText specification says that the only + control characters allowed are 0x09, 0x0a, 0x1b, 0x9b. + Therefore here we eliminate other control characters. */ + unsigned char ch = *((unsigned char *) csptr) & 0x7f; + if (!((ch >= min_ch && ch <= max_ch) + || (side == XlcGL + && (ch == 0x00 || ch == 0x09 || ch == 0x0a)) + || ((side == XlcGL || side == XlcGR) + && (ch == 0x1b)))) { csptr++; csstr_len--; - continue; /* XXX */ - } + unconv_num++; + continue; + } + } + + if (side == XlcGL) + *ctptr++ = *csptr++ & 0x7f; + else if (side == XlcGR) + *ctptr++ = *csptr++ | 0x80; + else + *ctptr++ = *csptr++; + csstr_len--; + ct_len--; + } + } else if (char_size > 1) { + while (csstr_len >= char_size && ct_len >= char_size) { + if (side == XlcGL) { + int i; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++ & 0x7f; + } else if (side == XlcGR) { + int i; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++ | 0x80; + } else { + int i; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++; + } + csstr_len -= char_size; + ct_len -= char_size; + } + } else { + /* char_size = 0. The code here is good only for valid UTF-8 input. */ + if ((charset->ct_sequence[0] == XctESC + && charset->ct_sequence[1] == XctOtherCoding + && charset->ct_sequence[2] == 'G') +#if UTF8_IN_EXTSEQ + || strcmp(charset->name, "ISO10646-1") == 0 +#endif + ) { + while (csstr_len > 0 && ct_len > 0) { + unsigned char ch = * (unsigned char *) csptr; + int char_size = (ch < 0xc0 ? 1 : + ch < 0xe0 ? 2 : + ch < 0xf0 ? 3 : + ch < 0xf8 ? 4 : + ch < 0xfc ? 5 : + 6); + int i; + if (!(csstr_len >= char_size && ct_len >= char_size)) + break; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++; + csstr_len -= char_size; + ct_len -= char_size; + } + } else { + while (csstr_len > 0 && ct_len > 0) { + *ctptr++ = *csptr++; + csstr_len--; + ct_len--; + } } - - if (side == XlcGL) - *ctptr++ = *csptr++ & 0x7f; - else if (side == XlcGR) - *ctptr++ = *csptr++ | 0x80; - else - *ctptr++ = *csptr++; - csstr_len--; - ct_len--; } - if (side == XlcGR || side == XlcGLGR) - state->GR_charset = charset; - if (side == XlcGL || side == XlcGLGR) - state->GL_charset = charset; + if (ext_segment_start != NULL) { + /* Backpatch the extended segment's length. */ + int ext_segment_length = ctptr - ext_segment_start; + *(ext_segment_start - 2) = (ext_segment_length >> 7) | 0x80; + *(ext_segment_start - 1) = (ext_segment_length & 0x7f) | 0x80; + } else { + if (side == XlcGR || side == XlcGLGR) + state->GR_charset = charset; + if (side == XlcGL || side == XlcGLGR) + state->GL_charset = charset; + } - *from_left -= csptr - *((char **) from); + *from_left -= csptr - *((const char **) from); *from = (XPointer) csptr; *to_left -= ctptr - *((char **) to); @@ -758,7 +1059,7 @@ strtocs( while (side == (*((unsigned char *) src) & 0x80) && length-- > 0) *dst++ = *src++; - *from_left -= src - (char *) *from; + *from_left -= src - (const char *) *from; *from = (XPointer) src; *to_left -= dst - (char *) *to; *to = (XPointer) dst; @@ -788,8 +1089,10 @@ cstostr( unsigned char ch; int unconv_num = 0; - if (num_args < 1 || (state->GL_charset != (XlcCharSet) args[0] && - state->GR_charset != (XlcCharSet) args[0])) + /* This converter can only convert from ISO8859-1:GL and ISO8859-1:GR. */ + if (num_args < 1 + || !((XlcCharSet) args[0] == state->GL_charset + || (XlcCharSet) args[0] == state->GR_charset)) return -1; csptr = *((const char **) from); @@ -797,10 +1100,13 @@ cstostr( csstr_len = *from_left; str_len = *to_left; - while (csstr_len-- > 0 && str_len > 0) { + while (csstr_len > 0 && str_len > 0) { ch = *((unsigned char *) csptr++); - if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) || - ch == 0x7f || ((ch & 0x80) && ch < 0xa0)) { + csstr_len--; + /* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character + set plus the control characters TAB and NEWLINE." */ + if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) + || (ch >= 0x7f && ch < 0xa0)) { unconv_num++; continue; } @@ -808,7 +1114,7 @@ cstostr( str_len--; } - *from_left -= csptr - *((char **) from); + *from_left -= csptr - *((const char **) from); *from = (XPointer) csptr; *to_left -= string_ptr - *((char **) to); @@ -928,11 +1234,12 @@ _XlcInitCTInfo() num = sizeof(default_ct_data) / sizeof(CTDataRec); for (ct_data = default_ct_data; num > 0; ct_data++, num--) { - charset = _XlcAddCT(ct_data->name, ct_data->encoding); + charset = _XlcAddCT(ct_data->name, ct_data->ct_sequence); if (charset == NULL) continue; charset->source = CSsrcStd; } + /* Register CompoundText and CharSet converters. */ _XlcSetConverter((XLCd) NULL, XlcNCompoundText, diff --git a/xc/lib/X11/lcCharSet.c b/xc/lib/X11/lcCharSet.c index c9954616f..d014a6f9e 100644 --- a/xc/lib/X11/lcCharSet.c +++ b/xc/lib/X11/lcCharSet.c @@ -23,48 +23,14 @@ * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ -/* $XFree86: xc/lib/X11/lcCharSet.c,v 3.6 2000/11/28 18:49:40 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcCharSet.c,v 3.7 2000/12/04 18:49:26 dawes Exp $ */ #include <stdio.h> #include "Xlibint.h" #include "XlcPublic.h" #include "XlcPubI.h" -#if NeedVarargsPrototypes -char * -_XlcGetCSValues(XlcCharSet charset, ...) -#else -char * -_XlcGetCSValues(charset, va_alist) - XlcCharSet charset; - va_dcl -#endif -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - - Va_start(var, charset); - _XlcCountVaList(var, &num_args); - va_end(var); - - Va_start(var, charset); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - if (charset->get_values) - ret = (*charset->get_values)(charset, args, num_args); - else - ret = args->name; - - Xfree(args); - - return ret; -} +/* The list of all known XlcCharSets. They are identified by their name. */ typedef struct _XlcCharSetListRec { XlcCharSet charset; @@ -73,6 +39,8 @@ typedef struct _XlcCharSetListRec { static XlcCharSetList charset_list = NULL; +/* Returns the charset with the given name (including side suffix). + Returns NULL if not found. */ XlcCharSet _XlcGetCharSet( const char *name) @@ -90,6 +58,9 @@ _XlcGetCharSet( return (XlcCharSet) NULL; } +/* Returns the charset with the given encoding (no side suffix) and + responsible for at least the given side (XlcGL or XlcGR). + Returns NULL if not found. */ XlcCharSet _XlcGetCharSetWithSide( const char *encoding_name, @@ -109,6 +80,8 @@ _XlcGetCharSetWithSide( return (XlcCharSet) NULL; } +/* Registers an XlcCharSet in the list of character sets. + Returns True if successful. */ Bool _XlcAddCharSet( XlcCharSet charset) @@ -129,6 +102,7 @@ _XlcAddCharSet( return True; } +/* List of resources for XlcCharSet. */ static XlcResource resources[] = { { XlcNName, NULLQUARK, sizeof(char *), XOffsetOf(XlcCharSetRec, name), XlcGetMask }, @@ -144,6 +118,9 @@ static XlcResource resources[] = { XOffsetOf(XlcCharSetRec, ct_sequence), XlcGetMask } }; +/* Retrieves a number of attributes of an XlcCharSet. + Return NULL if successful, otherwise the name of the first argument + specifiying a nonexistent attribute. */ static char * get_values( XlcCharSet charset, @@ -157,39 +134,84 @@ get_values( args, num_args, XlcGetMask); } +/* Retrieves a number of attributes of an XlcCharSet. + Return NULL if successful, otherwise the name of the first argument + specifiying a nonexistent attribute. */ +#if NeedVarargsPrototypes +char * +_XlcGetCSValues(XlcCharSet charset, ...) +#else +char * +_XlcGetCSValues(charset, va_alist) + XlcCharSet charset; + va_dcl +#endif +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + + Va_start(var, charset); + _XlcCountVaList(var, &num_args); + va_end(var); + + Va_start(var, charset); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = get_values(charset, args, num_args); + + Xfree(args); + + return ret; +} + +/* Creates a new XlcCharSet, given its name (including side suffix) and + Compound Text ESC sequence (normally at most 4 bytes). */ XlcCharSet _XlcCreateDefaultCharSet( const char *name, const char *ct_sequence) { XlcCharSet charset; + int name_len, ct_sequence_len; const char *colon; + char *tmp; charset = (XlcCharSet) Xmalloc(sizeof(XlcCharSetRec)); if (charset == NULL) return (XlcCharSet) NULL; bzero((char *) charset, sizeof(XlcCharSetRec)); + name_len = strlen(name); + ct_sequence_len = strlen(ct_sequence); + /* Fill in name and xrm_name. */ - charset->name = (char *) Xmalloc(strlen(name) + strlen(ct_sequence) + 2); - if (charset->name == NULL) { + tmp = (char *) Xmalloc(name_len + 1 + ct_sequence_len + 1); + if (tmp == NULL) { Xfree((char *) charset); return (XlcCharSet) NULL; } - strcpy(charset->name, name); + memcpy(tmp, name, name_len+1); + charset->name = tmp; charset->xrm_name = XrmStringToQuark(charset->name); /* Fill in encoding_name and xrm_encoding_name. */ if ((colon = strchr(charset->name, ':')) != NULL) { unsigned int length = colon - charset->name; - charset->encoding_name = (char *) Xmalloc(length + 1); - if (charset->encoding_name == NULL) { + char *encoding_tmp = (char *) Xmalloc(length + 1); + if (encoding_tmp == NULL) { Xfree((char *) charset->name); Xfree((char *) charset); return (XlcCharSet) NULL; } - strncpy(charset->encoding_name, charset->name, length); - charset->encoding_name[length] = '\0'; + memcpy(encoding_tmp, charset->name, length); + encoding_tmp[length] = '\0'; + charset->encoding_name = encoding_tmp; charset->xrm_encoding_name = XrmStringToQuark(charset->encoding_name); } else { charset->encoding_name = charset->name; @@ -197,12 +219,14 @@ _XlcCreateDefaultCharSet( } /* Fill in ct_sequence. */ - charset->ct_sequence = charset->name + strlen(name) + 1; - strcpy(charset->ct_sequence, ct_sequence); - - charset->get_values = get_values; - - _XlcParseCharSet(charset); + tmp += name_len + 1; + memcpy(tmp, ct_sequence, ct_sequence_len+1); + charset->ct_sequence = tmp; + + /* Fill in side, char_size, set_size. */ + if (!_XlcParseCharSet(charset)) + /* If ct_sequence is not usable in Compound Text, remove it. */ + charset->ct_sequence = ""; return (XlcCharSet) charset; } diff --git a/xc/lib/X11/lcConv.c b/xc/lib/X11/lcConv.c index 1d7ca8bcb..e3b0abbf2 100644 --- a/xc/lib/X11/lcConv.c +++ b/xc/lib/X11/lcConv.c @@ -23,7 +23,7 @@ * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ -/* $XFree86: xc/lib/X11/lcConv.c,v 1.4 2000/11/28 18:49:41 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcConv.c,v 1.5 2000/12/04 18:49:26 dawes Exp $ */ #include "Xlibint.h" #include "XlcPubI.h" @@ -162,22 +162,25 @@ indirect_convert( unconv_num += ret; - length = cs_left = cs - buf; - cs = buf; + length = cs - buf; + if (length > 0) { + cs_left = length; + cs = buf; - tmp_args[0] = (XPointer) charset; + tmp_args[0] = (XPointer) charset; - ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left, - tmp_args, 1); - if (ret < 0) { - unconv_num += length / charset->char_size; - continue; - } + ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left, + tmp_args, 1); + if (ret < 0) { + unconv_num += length / (charset->char_size > 0 ? charset->char_size : 1); + continue; + } - unconv_num += ret; + unconv_num += ret; - if (*to_left < 1) - break; + if (*to_left < 1) + break; + } } return unconv_num; diff --git a/xc/lib/X11/lcGenConv.c b/xc/lib/X11/lcGenConv.c index 9105e722a..a3c575549 100644 --- a/xc/lib/X11/lcGenConv.c +++ b/xc/lib/X11/lcGenConv.c @@ -35,7 +35,7 @@ * 2000 * Modifier: Ivan Pascal The XFree86 Project */ -/* $XFree86: xc/lib/X11/lcGenConv.c,v 3.16 2000/11/28 18:49:44 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcGenConv.c,v 3.17 2000/12/04 18:49:27 dawes Exp $ */ /* * A generic locale loader for all kinds of ISO-2022 based codesets. @@ -446,8 +446,8 @@ cmp_esc_sequence( { int seq_len, name_len, total_len; unsigned char byte_m, byte_l; - char *ct_sequence = charset->ct_sequence; - char *encoding_name = charset->encoding_name; + const char *ct_sequence = charset->ct_sequence; + const char *encoding_name = charset->encoding_name; /* check esc sequence */ if ( !(seq_len = strlen(ct_sequence) ) ) @@ -462,13 +462,13 @@ cmp_esc_sequence( /* * Non-Standard Character Set Encoding * - * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ - * | esc sequence | M | L | encoding name | STX | - * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ - * 4bytes 1byte 1byte variable length 1byte - * | | - * +-----------------------------------------+ - * name length = ((M - 128) * 128) + (L - 128) + * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ + * | ctseq | M | L | encoding name | STX | contents | + * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ + * 4bytes 1byte 1byte variable length 1byte variable length + * | | + * +----------------------------------------------+ + * rest length = ((M - 128) * 128) + (L - 128) */ /* get length of encoding name */ @@ -1074,7 +1074,7 @@ wcstocts( CodeSet codeset; XlcCharSet charset, old_charset = NULL; - char *ct_sequence; + const char *ct_sequence; const wchar_t *inbufptr = (const wchar_t *) *from; char *outbufptr = *to; diff --git a/xc/lib/X11/lcUTF8.c b/xc/lib/X11/lcUTF8.c index 94faed3ba..7c6e692f0 100644 --- a/xc/lib/X11/lcUTF8.c +++ b/xc/lib/X11/lcUTF8.c @@ -24,7 +24,7 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/lib/X11/lcUTF8.c,v 1.9 2000/11/28 18:49:50 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcUTF8.c,v 1.10 2000/12/04 18:49:28 dawes Exp $ */ /* * This file contains: @@ -198,9 +198,9 @@ typedef struct _Utf8ConvRec { #include "lcUniConv/tcvn.h" #include "lcUniConv/georgian_academy.h" #include "lcUniConv/georgian_ps.h" -#include "lcUniConv/microsoft_cp1251.h" -#include "lcUniConv/microsoft_cp1255.h" -#include "lcUniConv/microsoft_cp1256.h" +#include "lcUniConv/cp1251.h" +#include "lcUniConv/cp1255.h" +#include "lcUniConv/cp1256.h" #include "lcUniConv/tatar_cyr.h" typedef struct { @@ -276,6 +276,9 @@ static Utf8ConvRec all_charsets[] = { { "JISX0208.1983-0", NULLQUARK, jisx0208_mbtowc, jisx0208_wctomb }, + { "JISX0208.1990-0", NULLQUARK, + jisx0208_mbtowc, jisx0208_wctomb + }, { "JISX0212.1990-0", NULLQUARK, jisx0212_mbtowc, jisx0212_wctomb }, @@ -319,13 +322,13 @@ static Utf8ConvRec all_charsets[] = { iso8859_9e_mbtowc, iso8859_9e_wctomb }, { "MICROSOFT-CP1251", NULLQUARK, - microsoft_cp1251_mbtowc, microsoft_cp1251_wctomb + cp1251_mbtowc, cp1251_wctomb }, { "MICROSOFT-CP1255", NULLQUARK, - microsoft_cp1255_mbtowc, microsoft_cp1255_wctomb + cp1255_mbtowc, cp1255_wctomb }, { "MICROSOFT-CP1256", NULLQUARK, - microsoft_cp1256_mbtowc, microsoft_cp1256_wctomb + cp1256_mbtowc, cp1256_wctomb }, { "BIG5-0", NULLQUARK, big5_0_mbtowc, big5_0_wctomb @@ -380,7 +383,7 @@ cstoutf8( int num_args) { XlcCharSet charset; - char *name; + const char *name; Utf8Conv convptr; int i; unsigned char const *src; @@ -500,7 +503,7 @@ create_tocs_conv( XlcCharSet *charsets = codeset_list[i]->charset_list; int num_charsets = codeset_list[i]->num_charsets; for (j = 0; j < num_charsets; j++) { - char *name = charsets[j]->encoding_name; + const char *name = charsets[j]->encoding_name; /* If it wasn't already encountered... */ for (k = charset_num-1; k >= 0; k--) if (!strcmp(preferred[k]->name, name)) @@ -914,6 +917,7 @@ open_strtoutf8( } /* Support for the input methods. */ + XPointer _Utf8GetConvByName( const char *name) @@ -934,7 +938,7 @@ _Utf8GetConvByName( return (XPointer) NULL; } -/* from XlcNUcsChar to XlcNChar needed for input methods */ +/* from XlcNUcsChar to XlcNChar, needed for input methods */ static XlcConv create_ucstocs_conv( @@ -1055,6 +1059,67 @@ open_ucstocs1( return create_ucstocs_conv(from_lcd, &methods_ucstocs1); } +/* from XlcNUcsChar to XlcNUtf8String, needed for input methods */ + +static int +ucstoutf8( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const ucs4_t *src; + const ucs4_t *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + src = (const ucs4_t *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend) { + int count = utf8_wctomb(NULL, dst, *src, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) + unconv_num++; + src++; + dst += count; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec methods_ucstoutf8 = { + close_converter, + ucstoutf8, + NULL +}; + +static XlcConv +open_ucstoutf8( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_ucstoutf8); +} + /* Registers UTF-8 converters for a non-UTF-8 locale. */ void _XlcAddUtf8Converters( @@ -1066,6 +1131,7 @@ _XlcAddUtf8Converters( _XlcSetConverter(lcd, XlcNString, lcd, XlcNUtf8String, open_strtoutf8); _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNString, open_utf8tostr); _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNChar, open_ucstocs1); + _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String, open_ucstoutf8); } /***************************************************************************/ @@ -1333,7 +1399,7 @@ cstowcs( int num_args) { XlcCharSet charset; - char *name; + const char *name; Utf8Conv convptr; int i; unsigned char const *src; @@ -1693,7 +1759,7 @@ create_tofontcs_conv( } while (count-- > 0){ XlcCharSet charset = _XlcGetCharSet(*value++); - char *name = charset->encoding_name; + const char *name = charset->encoding_name; /* If it wasn't already encountered... */ for (k = num - 1; k >= 0; k--) if (!strcmp(preferred[k]->name, name)) diff --git a/xc/lib/X11/lcUniConv/8bit_tab_to_h.c b/xc/lib/X11/lcUniConv/8bit_tab_to_h.c index 549770d92..f6776b919 100644 --- a/xc/lib/X11/lcUniConv/8bit_tab_to_h.c +++ b/xc/lib/X11/lcUniConv/8bit_tab_to_h.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/X11/lcUniConv/8bit_tab_to_h.c,v 1.2 2000/12/04 18:49:30 dawes Exp $ */ + /* * Generates an 8-bit character set table from a .TXT table as found on * ftp.unicode.org or from a table containing the 256 Unicode values as @@ -197,7 +199,7 @@ int main (int argc, char *argv[]) fprintf(f, "\n"); } final_ret_reached = false; - fprintf(f, "static int\n%s_mbtowc (conv_t conv, wchar_t *pwc, const unsigned char *s, int n)\n", c_charsetname); + fprintf(f, "static int\n%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", c_charsetname); fprintf(f, "{\n"); fprintf(f, " unsigned char c = *s;\n"); if (some_invalid) { @@ -221,7 +223,7 @@ int main (int argc, char *argv[]) if (t == -2) { final_ret_reached = true; } else if (t == -1) { - fprintf(f, "%s*pwc = (wchar_t) c;\n", indent); + fprintf(f, "%s*pwc = (ucs4_t) c;\n", indent); fprintf(f, "%sreturn 1;\n", indent); } else { fprintf(f, "%s", indent); @@ -232,7 +234,7 @@ int main (int argc, char *argv[]) if (some_invalid) fprintf(f, "unsigned short wc = "); else - fprintf(f, "*pwc = (wchar_t) "); + fprintf(f, "*pwc = (ucs4_t) "); fprintf(f, "%s_2uni", c_charsetname); if (tableno > 1) fprintf(f, "_%d", t+1); @@ -242,7 +244,7 @@ int main (int argc, char *argv[]) fprintf(f, "];\n"); if (some_invalid) { fprintf(f, "%sif (wc != 0xfffd) {\n", indent); - fprintf(f, "%s *pwc = (wchar_t) wc;\n", indent); + fprintf(f, "%s *pwc = (ucs4_t) wc;\n", indent); fprintf(f, "%s return 1;\n", indent); fprintf(f, "%s}\n", indent); final_ret_reached = true; @@ -274,9 +276,9 @@ int main (int argc, char *argv[]) } } if (t == -1) - fprintf(f, "*pwc = (wchar_t) c;\n"); + fprintf(f, "*pwc = (ucs4_t) c;\n"); else { - fprintf(f, "*pwc = (wchar_t) %s_2uni", c_charsetname); + fprintf(f, "*pwc = (ucs4_t) %s_2uni", c_charsetname); if (tableno > 1) fprintf(f, "_%d", t+1); fprintf(f, "[c"); @@ -403,7 +405,7 @@ int main (int argc, char *argv[]) j1 = j2; } fix_0000 = false; - fprintf(f, "static int\n%s_wctomb (conv_t conv, unsigned char *r, wchar_t wc, int n)\n", c_charsetname); + fprintf(f, "static int\n%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", c_charsetname); fprintf(f, "{\n"); if (need_c) fprintf(f, " unsigned char c = 0;\n"); diff --git a/xc/lib/X11/lcUniConv/cjk_tab_to_h.c b/xc/lib/X11/lcUniConv/cjk_tab_to_h.c index 2955a63c5..1335fae73 100644 --- a/xc/lib/X11/lcUniConv/cjk_tab_to_h.c +++ b/xc/lib/X11/lcUniConv/cjk_tab_to_h.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/X11/lcUniConv/cjk_tab_to_h.c,v 1.2 2000/12/04 18:49:31 dawes Exp $ */ + /* * Generates a CJK character set table from a .TXT table as found on * ftp.unicode.org or in the X nls directory. @@ -202,7 +204,7 @@ static void output_charset2uni (const char* name, Encoding* enc) printf("\n"); printf("static int\n"); - printf("%s_mbtowc (conv_t conv, wchar_t *pwc, const unsigned char *s, int n)\n", name); + printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", name); printf("{\n"); printf(" unsigned char c1 = s[0];\n"); printf(" if ("); @@ -243,7 +245,7 @@ static void output_charset2uni (const char* name, Encoding* enc) } printf(" }\n"); printf(" if (wc != 0xfffd) {\n"); - printf(" *pwc = (wchar_t) wc;\n"); + printf(" *pwc = (ucs4_t) wc;\n"); printf(" return 2;\n"); printf(" }\n"); printf(" }\n"); @@ -355,7 +357,7 @@ static void output_uni2charset_dense (const char* name, Encoding* enc) if (p >= 0) printf("\n"); } - printf("static int\n%s_wctomb (conv_t conv, unsigned char *r, wchar_t wc, int n)\n", name); + printf("static int\n%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name); printf("{\n"); printf(" if (n >= 2) {\n"); printf(" unsigned short c = 0;\n"); @@ -494,7 +496,7 @@ static void output_uni2charset_sparse (const char* name, Encoding* enc) printf("\n"); printf("static int\n"); - printf("%s_wctomb (conv_t conv, unsigned char *r, wchar_t wc, int n)\n", name); + printf("%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name); printf("{\n"); printf(" if (n >= 2) {\n"); printf(" const Summary16 *summary = NULL;\n"); diff --git a/xc/lib/X11/lcUniConv/cp1251.h b/xc/lib/X11/lcUniConv/cp1251.h new file mode 100644 index 000000000..f3f7577f1 --- /dev/null +++ b/xc/lib/X11/lcUniConv/cp1251.h @@ -0,0 +1,113 @@ +/* $XFree86: xc/lib/X11/lcUniConv/cp1251.h,v 1.1 2000/12/04 18:49:32 dawes Exp $ */ + +/* + * CP1251 + */ + +static const unsigned short cp1251_2uni[128] = { + /* 0x80 */ + 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, + 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, + /* 0x90 */ + 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, + /* 0xa0 */ + 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, + 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, + 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, + /* 0xc0 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + /* 0xd0 */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + /* 0xe0 */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + /* 0xf0 */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, +}; + +static int +cp1251_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = cp1251_2uni[c-0x80]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char cp1251_page00[32] = { + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ +}; +static const unsigned char cp1251_page04[152] = { + 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ + 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ + 0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ + 0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char cp1251_page20[48] = { + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +cp1251_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00c0) + c = cp1251_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x0498) + c = cp1251_page04[wc-0x0400]; + else if (wc >= 0x2010 && wc < 0x2040) + c = cp1251_page20[wc-0x2010]; + else if (wc == 0x20ac) + c = 0x88; + else if (wc == 0x2116) + c = 0xb9; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/xc/lib/X11/lcUniConv/cp1255.h b/xc/lib/X11/lcUniConv/cp1255.h new file mode 100644 index 000000000..17b843ee3 --- /dev/null +++ b/xc/lib/X11/lcUniConv/cp1255.h @@ -0,0 +1,121 @@ +/* $XFree86: xc/lib/X11/lcUniConv/cp1255.h,v 1.1 2000/12/04 18:49:33 dawes Exp $ */ + +/* + * CP1255 + */ + +static const unsigned short cp1255_2uni[128] = { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa0 */ + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + /* 0xc0 */ + 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, + 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, + /* 0xd0 */ + 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, + 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xe0 */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, + /* 0xf0 */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, + 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, +}; + +static int +cp1255_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = cp1255_2uni[c-0x80]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char cp1255_page00[88] = { + 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ +}; +static const unsigned char cp1255_page02[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ +}; +static const unsigned char cp1255_page05[72] = { + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xb0-0xb7 */ + 0xc8, 0xc9, 0x00, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xb8-0xbf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ + 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ +}; +static const unsigned char cp1255_page20[56] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +cp1255_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00f8) + c = cp1255_page00[wc-0x00a0]; + else if (wc == 0x0192) + c = 0x83; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = cp1255_page02[wc-0x02c0]; + else if (wc >= 0x05b0 && wc < 0x05f8) + c = cp1255_page05[wc-0x05b0]; + else if (wc >= 0x2008 && wc < 0x2040) + c = cp1255_page20[wc-0x2008]; + else if (wc == 0x20aa) + c = 0xa4; + else if (wc == 0x20ac) + c = 0x80; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/xc/lib/X11/lcUniConv/cp1256.h b/xc/lib/X11/lcUniConv/cp1256.h new file mode 100644 index 000000000..5d4051bfe --- /dev/null +++ b/xc/lib/X11/lcUniConv/cp1256.h @@ -0,0 +1,135 @@ +/* $XFree86: xc/lib/X11/lcUniConv/cp1256.h,v 1.1 2000/12/04 18:49:34 dawes Exp $ */ + +/* + * CP1256 + */ + +static const unsigned short cp1256_2uni[128] = { + /* 0x80 */ + 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, + /* 0x90 */ + 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, + /* 0xa0 */ + 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, + /* 0xc0 */ + 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, + /* 0xd0 */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, + 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, + /* 0xe0 */ + 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, + 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, +}; + +static int +cp1256_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) cp1256_2uni[c-0x80]; + return 1; +} + +static const unsigned char cp1256_page00[96] = { + 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0xe0, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ + 0x00, 0xf9, 0x00, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; +static const unsigned char cp1256_page01[72] = { + 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char cp1256_page06[208] = { + 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, /* 0x30-0x37 */ + 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0xdc, 0xdd, 0xde, 0xdf, 0xe1, 0xe3, 0xe4, 0xe5, /* 0x40-0x47 */ + 0xe6, 0xec, 0xed, 0xf0, 0xf1, 0xf2, 0xf3, 0xf5, /* 0x48-0x4f */ + 0xf6, 0xf8, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, /* 0x80-0x87 */ + 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xb8-0xbf */ + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ +}; +static const unsigned char cp1256_page20[56] = { + 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0xfd, 0xfe, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +cp1256_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0100) + c = cp1256_page00[wc-0x00a0]; + else if (wc >= 0x0150 && wc < 0x0198) + c = cp1256_page01[wc-0x0150]; + else if (wc == 0x02c6) + c = 0x88; + else if (wc >= 0x0608 && wc < 0x06d8) + c = cp1256_page06[wc-0x0608]; + else if (wc >= 0x2008 && wc < 0x2040) + c = cp1256_page20[wc-0x2008]; + else if (wc == 0x20ac) + c = 0x80; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/xc/lib/X11/lcUniConv/tatar_cyr.h b/xc/lib/X11/lcUniConv/tatar_cyr.h index 478e30bf2..536070056 100644 --- a/xc/lib/X11/lcUniConv/tatar_cyr.h +++ b/xc/lib/X11/lcUniConv/tatar_cyr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/X11/lcUniConv/tatar_cyr.h,v 1.2 2000/11/28 16:10:31 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcUniConv/tatar_cyr.h,v 1.3 2000/12/04 18:49:42 dawes Exp $ */ /* * TATAR-CYR @@ -35,10 +35,10 @@ static int tatar_cyr_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; - if (c < 0xa0) + if (c < 0x80) *pwc = (ucs4_t) c; else - *pwc = (ucs4_t) tatar_cyr_2uni[c-0xa0]; + *pwc = (ucs4_t) tatar_cyr_2uni[c-0x80]; return 1; } diff --git a/xc/lib/X11/udcInf.c b/xc/lib/X11/udcInf.c index 2f3c23c1b..acbd618f6 100644 --- a/xc/lib/X11/udcInf.c +++ b/xc/lib/X11/udcInf.c @@ -29,7 +29,7 @@ from The Open Group. * */ -/* $XFree86: xc/lib/X11/udcInf.c,v 1.4 1998/10/03 08:41:45 dawes Exp $ */ +/* $XFree86: xc/lib/X11/udcInf.c,v 1.5 2000/12/04 18:49:28 dawes Exp $ */ #include <stdio.h> #include <locale.h> @@ -385,14 +385,15 @@ XlcCharSet charset; char *src; int size; { - int name_len,seq_len,i; + int name_len,seq_len,rest_len,i; name_len = 2 + strlen(charset->encoding_name) + 1; seq_len = strlen(charset->ct_sequence); - if (name_len + seq_len + strlen(src) >= size) + rest_len = strlen(charset->encoding_name) + 1 + strlen(src); + if (name_len + seq_len + strlen(src) >= size || rest_len >= 0x4000) return False; strcpy(from,charset->ct_sequence); - from[seq_len] = name_len / 128 + 128; - from[seq_len+1] = name_len % 128 + 128; + from[seq_len] = (rest_len >> 7) + 128; + from[seq_len+1] = (rest_len & 0x7f) + 128; strcpy(&from[seq_len + 2],charset->encoding_name); from[seq_len+name_len-1] = 0x02; /* STX */ strcpy(&from[seq_len + name_len],src); diff --git a/xc/lib/Xft/Imakefile b/xc/lib/Xft/Imakefile index 778a4b6fd..5082af006 100644 --- a/xc/lib/Xft/Imakefile +++ b/xc/lib/Xft/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.4 2000/11/29 08:39:20 keithp Exp $ +XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.7 2000/12/01 03:27:57 keithp Exp $ #define DoNormalLib NormalLibXft #define DoSharedLib SharedLibXft @@ -13,8 +13,7 @@ XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.4 2000/11/29 08:39:20 keithp Exp $ #include <Threads.tmpl> -YFLAGS = -d -p XftConfig -LFLAGS = -PXftConfig -s +YFLAGS = -d #ifndef XftLibDir #define XftLibDir $(LIBDIR) @@ -29,25 +28,25 @@ XFTCONFIG=$(XFTLIBDIR)/XftConfig TYPE1DIR=XftType1Dir CONFIG_DEFS=-DXFT_TYPE1_DIR=\"$(TYPE1DIR)\" INCLUDES=$(FREETYPE2INCLUDES) -DEFINES=-DXFT_DEFAULT_PATH=\"$(XFTCONFIG)\" $(FREETYPE2DEFINES) -REQUIREDLIBS=$(LDPRELIBS) $(XRENDER) $(XLIB) $(FREETYPE2LIB) +DEFINES=-DXFT_DEFAULT_PATH=\"$(XFTCONFIG)\" $(FREETYPE2DEFINES) $(RENDERDEFINES) +REQUIREDLIBS=$(LDPRELIBS) $(XRENDERLIB) $(XLIB) $(FREETYPE2LIB) HEADERS = Xft.h XftFreetype.h - SRCS = xftcfg.c xftcore.c xftdbg.c xftdir.c xftdpy.c xftdraw.c \ - xftextent.c xftfont.c xftfreetype.c xftfs.c xftglyphs.c \ - xftgram.c xftinit.c xftlex.c xftmatch.c xftname.c xftpat.c \ - xftrender.c xftstr.c xftxlfd.c - - OBJS = xftcfg.o xftcore.o xftdbg.o xftdir.o xftdpy.o xftdraw.o \ - xftextent.o xftfont.o xftfreetype.o xftfs.o xftglyphs.o \ - xftgram.o xftinit.o xftlex.o xftmatch.o xftname.o xftpat.o \ - xftrender.o xftstr.o xftxlfd.o + SRCS = xftcfg.c xftcolor.c xftcore.c xftdbg.c xftdir.c xftdpy.c \ + xftdraw.c xftextent.c xftfont.c xftfreetype.c xftfs.c \ + xftglyphs.c xftgram.c xftinit.c xftlex.c xftlist.c xftmatch.c \ + xftname.c xftpat.c xftrender.c xftstr.c xftxlfd.c + + OBJS = xftcfg.o xftcolor.o xftcore.o xftdbg.o xftdir.o xftdpy.o \ + xftdraw.o xftextent.o xftfont.o xftfreetype.o xftfs.o \ + xftglyphs.o xftgram.o xftinit.o xftlex.o xftlist.o xftmatch.o \ + xftname.o xftpat.o xftrender.o xftstr.o xftxlfd.o #include <Library.tmpl> -LexFile(xftlex) -YaccFile(xftgram,$(YFLAGS)) +LexFilePrefix(xftlex,XftConfig) +YaccFilePrefix(xftgram,$(YFLAGS),XftConfig) #if DoSharedLib && SharedDataSeparation SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) diff --git a/xc/lib/Xft/Xft.h b/xc/lib/Xft/Xft.h index 38e48733e..618372f7a 100644 --- a/xc/lib/Xft/Xft.h +++ b/xc/lib/Xft/Xft.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/Xft.h,v 1.4 2000/11/29 08:39:20 keithp Exp $ + * $XFree86: xc/lib/Xft/Xft.h,v 1.10 2000/12/03 19:03:22 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -51,6 +51,10 @@ #define XFT_SCALE "scale" /* double */ #define XFT_RENDER "render" /* Bool */ +/* specific to FreeType rasterizer */ +#define XFT_CHAR_WIDTH "charwidth" /* Int */ +#define XFT_CHAR_HEIGHT "charheight"/* Int */ + #define XFT_WEIGHT_LIGHT 0 #define XFT_WEIGHT_MEDIUM 100 #define XFT_WEIGHT_DEMIBOLD 180 @@ -113,21 +117,6 @@ typedef struct _XftFontSet { XftPattern **fonts; } XftFontSet; -XftFontSet * -XftFontSetCreate (void); - -void -XftFontSetDestroy (XftFontSet *s); - -Bool -XftFontSetAdd (XftFontSet *s, XftPattern *font); - -void -XftPatternPrint (XftPattern *p); - -XftPattern * -XftMatchFont (Display *dpy, int screen, XftPattern *pattern, XftResult *result); - typedef struct _XftFontStruct XftFontStruct; typedef struct _XftFont { @@ -149,21 +138,44 @@ typedef struct _XftFont { typedef struct _XftDraw XftDraw; -XftFont * -XftOpenFont (Display *dpy, XftPattern *pattern); +typedef struct _XftColor { + unsigned long pixel; + XRenderColor color; +} XftColor; -XftFont * -XftPatternOpenFont (Display *dpy, int screen, ...); - +typedef struct _XftObjectSet { + int nobject; + int sobject; + const char **objects; +} XftObjectSet; + +/* xftcfg.c */ Bool -XftDefaultSet (Display *dpy, XftPattern *defaults); +XftConfigSubstitute (XftPattern *p); -XftPattern * -XftNameParse (const char *name); +/* xftcolor.c */ +Bool +XftColorAllocName (Display *dpy, + Visual *visual, + Colormap cmap, + char *name, + XftColor *result); -XftFont * -XftNameOpenFont (Display *dpy, int screen, const char *name); +Bool +XftColorAllocValue (Display *dpy, + Visual *visual, + Colormap cmap, + XRenderColor *color, + XftColor *result); + +void +XftColorFree (Display *dpy, + Visual *visual, + Colormap cmap, + XftColor *color); + +/* xftcore.c */ /* xftdbg.c */ void XftValuePrint (XftValue v); @@ -179,6 +191,15 @@ XftFontSetPrint (XftFontSet *s); /* xftdir.c */ /* xftdpy.c */ +Bool +XftDefaultHasRender (Display *dpy); + +Bool +XftDefaultSet (Display *dpy, XftPattern *defaults); + +void +XftDefaultSubstitute (Display *dpy, int screen, XftPattern *pattern); + /* xftdraw.c */ XftDraw * @@ -188,11 +209,15 @@ XftDrawCreate (Display *dpy, Colormap colormap); void -XftDrawDestroy (XftDraw *d); +XftDrawChange (XftDraw *draw, + Drawable drawable); + +void +XftDrawDestroy (XftDraw *draw); void XftDrawString8 (XftDraw *d, - XRenderColor *color, + XftColor *color, XftFont *font, int x, int y, @@ -201,7 +226,7 @@ XftDrawString8 (XftDraw *d, void XftDrawString16 (XftDraw *draw, - XRenderColor *color, + XftColor *color, XftFont *font, int x, int y, @@ -210,15 +235,15 @@ XftDrawString16 (XftDraw *draw, void XftDrawString32 (XftDraw *draw, - XRenderColor *color, + XftColor *color, XftFont *font, int x, int y, - unsigned long *string, + unsigned int *string, int len); void XftDrawRect (XftDraw *d, - XRenderColor *color, + XftColor *color, int x, int y, unsigned int width, @@ -244,7 +269,7 @@ XftTextExtents16 (Display *dpy, void XftTextExtents32 (Display *dpy, XftFont *font, - unsigned long *string, + unsigned int *string, int len, XGlyphInfo *extents); @@ -261,12 +286,82 @@ XftFontOpen (Display *dpy, int screen, ...); XftFont * XftFontOpenName (Display *dpy, int screen, const char *name); +XftFont * +XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd); + void XftFontClose (Display *dpy, XftFont *font); +Bool +XftGlyphExists (Display *dpy, XftFont *font, unsigned int glyph); + /* xftfreetype.c */ /* xftfs.c */ +XftFontSet * +XftFontSetCreate (void); + +void +XftFontSetDestroy (XftFontSet *s); + +Bool +XftFontSetAdd (XftFontSet *s, XftPattern *font); + +/* xftglyphs.c */ +/* see XftFreetype.h */ + +/* xftgram.y */ + +/* xftinit.c */ +Bool +XftInit (char *config); + +/* xftlex.l */ + +/* xftlist.c */ +XftObjectSet * +XftObjectSetCreate (void); + +Bool +XftObjectSetAdd (XftObjectSet *os, const char *object); + +void +XftObjectSetDestroy (XftObjectSet *os); + +XftObjectSet * +XftObjectSetVaBuild (const char *first, va_list va); + +XftObjectSet * +XftObjectSetBuild (const char *first, ...); + +XftFontSet * +XftListFontSets (XftFontSet **sets, + int nsets, + XftPattern *p, + XftObjectSet *os); + +XftFontSet * +XftListFontsPatternObjects (Display *dpy, + int screen, + XftPattern *pattern, + XftObjectSet *os); + +XftFontSet * +XftListFonts (Display *dpy, + int screen, + ...); + +/* xftmatch.c */ +XftPattern * +XftFontSetMatch (XftFontSet **sets, + int nsets, + XftPattern *p, + XftResult *result); + +/* xftname.c */ +XftPattern * +XftNameParse (const char *name); + /* xftpat.c */ XftPattern * XftPatternCreate (void); @@ -275,8 +370,17 @@ XftPattern * XftPatternDuplicate (XftPattern *p); void +XftValueDestroy (XftValue v); + +void +XftValueListDestroy (XftValueList *l); + +void XftPatternDestroy (XftPattern *p); +XftPatternElt * +XftPatternFind (XftPattern *p, const char *object, Bool insert); + Bool XftPatternAdd (XftPattern *p, const char *object, XftValue value, Bool append); @@ -316,4 +420,16 @@ XftPatternVaBuild (XftPattern *orig, va_list va); XftPattern * XftPatternBuild (XftPattern *orig, ...); +/* xftrender.c */ +/* see XftFreetype.h */ + +/* xftstr.c */ + +/* xftxlfd.c */ +XftPattern * +XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable, Bool complete); + +XFontStruct * +XftCoreOpen (Display *dpy, XftPattern *pattern); + #endif /* _XFT_H_ */ diff --git a/xc/lib/Xft/Xft.man b/xc/lib/Xft/Xft.man index 449f87d54..0a71bc931 100644 --- a/xc/lib/Xft/Xft.man +++ b/xc/lib/Xft/Xft.man @@ -1,5 +1,5 @@ .\" -.\" $XFree86: xc/lib/Xft/Xft.man,v 1.1 2000/10/05 18:05:26 keithp Exp $ +.\" $XFree86: xc/lib/Xft/Xft.man,v 1.2 2000/11/30 06:59:45 keithp Exp $ .\" .\" Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. .\" @@ -39,107 +39,138 @@ library. .SH DATATYPES +.B XftPattern +holds a set of names with associated value lists; each name refers to a +property of a font. XftPatterns are used as inputs to the matching code as +well as holding information about specific fonts. + .B XftFont -is an opaque pointer to a font object containing references to both the X -server GlyphSet and the FreeType outline data. +contains general font metrics and a pointer to either the core XFontStruct +data or a structure holding FreeType and X Render Extension data. -.B XftFontName -contains matching information for accessing fonts. Each field is matched -with a bit in the mask indicating whether that field has valid data. +.B XftFontStruct +contains information about FreeType fonts used with the X Render Extension. -.Ds 0 -.TA .5i 3i -.ta .5i 3i -typedef struct _XftFontName { - unsigned long mask; - char *face; - char *encoding; - char *file; - int size; - int rotation; - int spacing; -} XftFontName; +.B XftFontSet +contains a list of XftPatterns. Internally Xft uses this data structure to +hold sets of fonts. Externally, Xft returns the results of listing fonts in +this format. -#define XftFontNameFace 0x1 -#define XftFontNameEncoding 0x2 -#define XftFontNameFile 0x4 -#define XftFontNameSize 0x8 -#define XftFontNameRotation 0x10 -#define XftFontNameSpacing 0x20 +.B XftObjectSet +holds a set of names and is used to specify which fields from fonts are +placed in the the list of returned patterns when listing fonts. -#define XftFontSpacingAny 0 -#define XftFontSpacingMono 1 -#define XftFontSpacingCell 2 +.B XftDraw +is an opaque object which holds information used to render to an X drawable +using either core protocol or the X Rendering extension. .SH FUNCTIONS -XftFont * -XftLoadFont (Display *dpy, XftFontName *name); - +.nf +XftFont * +XftFontOpen (Display *dpy, int screen, ...); +.fi +.B XftFontOpen +takes a list of pattern elements of the form (field, type, value) terminated +with a 0, matches that pattern against the available fonts and opens the +matching font. +.PP +Example: +.br + font = XftFontOpen (dpy, scr, + XFT_FAMILY, XftTypeString, "charter", + XFT_SIZE, XftTypeDouble, 12.0); +.PP +This opens the charter font at 12 points. The point size is automatically +converted to the correct pixel size based on the resolution of the monitor. +.PP +.nf void -XftFreeFont (Display *dpy, XftFont *font); - -int -XftFontAscent(Display *dpy, XftFont *font); - -int -XftFontDescent(Display *dpy, XftFont *font); - -int -XftFontHeight(Display *dpy, XftFont *font); - -int -XftFontMaxAdvanceWidth (Display *dpy, XftFont *font); - +XftTextExtents8 (Display *dpy, + XftFont *font, + unsigned char *string, + int len, + XGlyphInfo *extents); +.fi +.B XftTextExtents8 +computes the pixel extents of "string" when drawn with "font". +.PP +.nf +XftDraw * +XftDrawCreate (Display *dpy, + Drawable drawable, + Visual *visual, + Colormap colormap); +.fi +.B XtDrawCreate +creates a structure that can be used to render text and rectangles +to the screen. +.PP +.nf void -XftExtentsString (Display *dpy, - XftFont *font, - unsigned char *string, - int len, - XGlyphInfo *extents); - +XftDrawString8 (XftDraw *d, + XRenderColor *color, + XftFont *font, + int x, + int y, + unsigned char *string, + int len); +.fi +.B XftDrawString8 +draws "string" using "font" in "color" at "x, y". +.PP +.nf void -XftDrawString (Display *dpy, - Picture src, - XftFont *font, - Picture dst, - int srcx, - int srcy, - int x, - int y, - char *string, - int len); - +XftDrawRect (XftDraw *d, + XRenderColor *color, + int x, + int y, + unsigned int width, + unsigned int height); +.fi +.B XftDrawRect +fills a solid rectangle in the specified color. .SH XftConfig The .B XftConfig -file contains instructions for converting an XftFontName structure into -a usable set of glyphs. XftFontNames are refined through a series of -matching and editing steps. - -ents : ents ent - | - ; -ent : edit - | path - | dir +file contains configuration information for the Xft library consisting of +directories to look at for font information as well as instructions on +editing program specified font patterns before attempting to match the +available fonts. +.PP +.nf +config : "dir" STRING + | "include" STRING + | "includeif" STRING + | "match" tests "edit" edits ; -edit : MATCH patterns EDIT patterns +test : qual FIELD-NAME COMPARE CONSTANT ; -patterns: pattern patterns - | +qual : "any" + | "all" ; -pattern : FACE EQUAL STRING - | ENCODING EQUAL STRING - | FILE EQUAL STRING - | SIZE EQUAL NUMBER - | ROTATION EQUAL NUMBER - | SPACING EQUAL NUMBER +edit : FIELD-NAME ASSIGN expr SEMI ; -path : PATH STRING - ; -dir : DIR STRING - ; - +.fi +.PP +STRINGs are double-quote delimited. FIELD-NAMEs are identifiers, +ASSIGN is one of "=", "+=" or "=+". expr can contain the usual +arithmetic operators and can include FIELD-NAMEs. +.PP +"dir" adds a directory to the list of places Xft will look for fonts. +There is no particular order implied by the list; Xft treats all fonts about +the same. +.PP +"include" and "includeif" cause Xft to load more configuration parameters +from the indicated file. "includeif" doesn't elicit a complaint if the file +doesn't exist. If the file name begins with a '~' character, it refers to a +path relative to the home directory of the user. +.PP +If the tests in a "match" statement all match a user-specified pattern, the +pattern will be edited with the specified instructions. +.PP +Where ASSIGN is "=", the matching value in the pattern will be replaced by +the given expression. "+="/"=+" will prepend/append a new value to the list +of values for the indicated field. .SH RESTRICTIONS .B Xft diff --git a/xc/lib/Xft/XftFreetype.h b/xc/lib/Xft/XftFreetype.h index ca69287e3..8cd1e7dfd 100644 --- a/xc/lib/Xft/XftFreetype.h +++ b/xc/lib/Xft/XftFreetype.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.1 2000/11/29 08:39:20 keithp Exp $ + * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.4 2000/12/02 10:02:04 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -45,11 +45,31 @@ struct _XftFontStruct { Bool monospace; int rgba; Bool antialias; + Bool encoded; /* use charmap */ XRenderPictFormat *format; XGlyphInfo **realized; int nrealized; }; +/* xftglyphs.c */ +void +XftGlyphLoad (Display *dpy, + XftFontStruct *font, + unsigned long *glyphs, + int nglyph); + +void +XftGlyphCheck (Display *dpy, + XftFontStruct *font, + unsigned long glyph, + unsigned long *missing, + int *nmissing); + +Bool +XftFreeTypeGlyphExists (Display *dpy, + XftFontStruct *font, + unsigned int glyph); + /* xftrender.c */ void @@ -71,7 +91,7 @@ XftRenderString32 (Display *dpy, Picture src, XftFontStruct *font, Picture dst, int srcx, int srcy, int x, int y, - unsigned long *string, int len); + unsigned int *string, int len); void XftRenderExtents8 (Display *dpy, @@ -90,7 +110,7 @@ XftRenderExtents16 (Display *dpy, void XftRenderExtents32 (Display *dpy, XftFontStruct *font, - unsigned long *string, + unsigned int *string, int len, XGlyphInfo *extents); diff --git a/xc/lib/Xft/xftcfg.c b/xc/lib/Xft/xftcfg.c index f362582da..9d15207eb 100644 --- a/xc/lib/Xft/xftcfg.c +++ b/xc/lib/Xft/xftcfg.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftcfg.c,v 1.1 2000/11/29 08:39:21 keithp Exp $ + * $XFree86: xc/lib/Xft/xftcfg.c,v 1.4 2000/12/03 19:05:27 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -125,7 +125,7 @@ _XftConfigPromote (XftValue v) return v; } -static Bool +Bool _XftConfigCompareValue (XftValue m, XftOp op, XftValue v) @@ -414,6 +414,86 @@ _XftConfigEvaluate (XftPattern *p, XftExpr *e) return v; } +static Bool +_XftConfigAdd (XftValueList **head, + XftValueList *position, + Bool append, + XftValue value) +{ + XftValueList *new, **prev; + + new = (XftValueList *) malloc (sizeof (XftValueList)); + if (!new) + goto bail0; + + if (value.type == XftTypeString) + { + value.u.s = _XftSaveString (value.u.s); + if (!value.u.s) + goto bail1; + + } + new->value = value; + new->next = 0; + + if (append) + { + prev = &position->next; + } + else + { + for (prev = head; *prev; prev = &(*prev)->next) + { + if (*prev == position) + break; + } +#ifdef XFT_DEBUG + if (!*prev) + printf ("position not on list\n"); +#endif + } + +#ifdef XFT_DEBUG_EDIT + printf ("%s list before ", append ? "Append" : "Prepend"); + XftValueListPrint (*head); + printf ("\n"); +#endif + + new->next = *prev; + *prev = new; + +#ifdef XFT_DEBUG_EDIT + printf ("%s list after ", append ? "Append" : "Prepend"); + XftValueListPrint (*head); + printf ("\n"); +#endif + + return True; + +bail1: + free (new); +bail0: + return False; +} + +static void +_XftConfigDel (XftValueList **head, + XftValueList *position) +{ + XftValueList **prev; + + for (prev = head; *prev; prev = &(*prev)->next) + { + if (*prev == position) + { + *prev = position->next; + position->next = 0; + XftValueListDestroy (position); + break; + } + } +} + Bool XftConfigSubstitute (XftPattern *p) { @@ -453,7 +533,12 @@ XftConfigSubstitute (XftPattern *p) break; } if (t) + { +#ifdef XFT_DEBUG_EDIT + printf ("No match\n"); +#endif continue; + } #ifdef XFT_DEBUG_EDIT printf ("Substitute "); XftSubstPrint (s); @@ -470,8 +555,8 @@ XftConfigSubstitute (XftPattern *p) case XftOpAssign: if (t) { - XftValueDestroy (st[i].value->value); - st[i].value->value = v; + _XftConfigAdd (&st[i].elt->values, st[i].value, True, v); + _XftConfigDel (&st[i].elt->values, st[i].value); } else { @@ -480,10 +565,16 @@ XftConfigSubstitute (XftPattern *p) } break; case XftOpPrepend: - XftPatternAdd (p, e->field, v, False); + if (t) + _XftConfigAdd (&st[i].elt->values, st[i].value, False, v); + else + XftPatternAdd (p, e->field, v, False); break; case XftOpAppend: - XftPatternAdd (p, e->field, v, True); + if (t) + _XftConfigAdd (&st[i].elt->values, st[i].value, True, v); + else + XftPatternAdd (p, e->field, v, True); break; default: break; diff --git a/xc/lib/Xft/xftcolor.c b/xc/lib/Xft/xftcolor.c new file mode 100644 index 000000000..6443e00ec --- /dev/null +++ b/xc/lib/Xft/xftcolor.c @@ -0,0 +1,125 @@ +/* + * $XFree86: xc/lib/Xft/xftcolor.c,v 1.1 2000/12/01 03:27:57 keithp Exp $ + * + * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "xftint.h" + +Bool +XftColorAllocName (Display *dpy, + Visual *visual, + Colormap cmap, + char *name, + XftColor *result) +{ + XColor screen, exact; + + if (!XAllocNamedColor (dpy, cmap, name, &screen, &exact)) + { + /* XXX stick standard colormap stuff here */ + return False; + } + + result->pixel = screen.pixel; + result->color.red = exact.red; + result->color.green = exact.green; + result->color.blue = exact.blue; + result->color.alpha = 0xffff; + return True; +} + +static short +maskbase (unsigned long m) +{ + short i; + + if (!m) + return 0; + i = 0; + while (!(m&1)) + { + m>>=1; + i++; + } + return i; +} + +static short +masklen (unsigned long m) +{ + unsigned long y; + + y = (m >> 1) &033333333333; + y = m - y - ((y >>1) & 033333333333); + return (short) (((y + (y >> 3)) & 030707070707) % 077); +} + +Bool +XftColorAllocValue (Display *dpy, + Visual *visual, + Colormap cmap, + XRenderColor *color, + XftColor *result) +{ + if (visual->class == TrueColor) + { + int red_shift, red_len; + int green_shift, green_len; + int blue_shift, blue_len; + + red_shift = maskbase (visual->red_mask); + red_len = masklen (visual->red_mask); + green_shift = maskbase (visual->green_mask); + green_len = masklen (visual->green_mask); + blue_shift = maskbase (visual->blue_mask); + blue_len = masklen (visual->blue_mask); + result->pixel = (((color->red >> (16 - red_len)) << red_shift) | + ((color->green >> (16 - green_len)) << green_shift) | + ((color->blue >> (16 - blue_len)) << blue_shift)); + } + else + { + XColor xcolor; + + xcolor.red = color->red; + xcolor.green = color->green; + xcolor.blue = color->blue; + if (!XAllocColor (dpy, cmap, &xcolor)) + return False; + result->pixel = xcolor.pixel; + } + result->color.red = color->red; + result->color.green = color->green; + result->color.blue = color->blue; + result->color.alpha = 0xffff; + return True; +} + +void +XftColorFree (Display *dpy, + Visual *visual, + Colormap cmap, + XftColor *color) +{ + if (visual->class != TrueColor) + XFreeColors (dpy, cmap, &color->pixel, 1, 0); +} diff --git a/xc/lib/Xft/xftcore.c b/xc/lib/Xft/xftcore.c index 8360831af..692e17ad6 100644 --- a/xc/lib/Xft/xftcore.c +++ b/xc/lib/Xft/xftcore.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftcore.c,v 1.1 2000/11/29 08:39:21 keithp Exp $ + * $XFree86: xc/lib/Xft/xftcore.c,v 1.3 2000/12/02 10:02:04 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -46,7 +46,7 @@ XftCoreConvert16 (unsigned short *string, } XChar2b * -XftCoreConvert32 (unsigned long *string, +XftCoreConvert32 (unsigned int *string, int len, XChar2b xcloc[XFT_CORE_N16LOCAL]) { @@ -128,7 +128,7 @@ XftCoreExtents16 (Display *dpy, void XftCoreExtents32 (Display *dpy, XFontStruct *fs, - unsigned long *string, + unsigned int *string, int len, XGlyphInfo *extents) { @@ -156,3 +156,23 @@ XftCoreExtents32 (Display *dpy, extents->yOff = 0; } +Bool +XftCoreGlyphExists (Display *dpy, + XFontStruct *fs, + unsigned int glyph) +{ + int direction; + int ascent, descent; + XCharStruct overall; + XChar2b xc; + + XftCoreConvert32 (&glyph, 1, &xc); + XTextExtents16 (fs, &xc, 1, &direction, + &ascent, &descent, &overall); + return (overall.lbearing != 0 || + overall.rbearing != 0 || + overall.width != 0 || + overall.ascent != 0 || + overall.descent != 0); +} + diff --git a/xc/lib/Xft/xftdraw.c b/xc/lib/Xft/xftdraw.c index f90c489c7..daeb09488 100644 --- a/xc/lib/Xft/xftdraw.c +++ b/xc/lib/Xft/xftdraw.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftdraw.c,v 1.1 2000/11/29 08:39:22 keithp Exp $ + * $XFree86: xc/lib/Xft/xftdraw.c,v 1.4 2000/12/01 21:32:01 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -47,6 +47,22 @@ XftDrawCreate (Display *dpy, } void +XftDrawChange (XftDraw *draw, + Drawable drawable) +{ + draw->drawable = drawable; + if (draw->render_able) + { + XRenderPictFormat *format; + + XRenderFreePicture (draw->dpy, draw->render.pict); + format = XRenderFindVisualFormat (draw->dpy, draw->visual); + draw->render.pict = XRenderCreatePicture (draw->dpy, draw->drawable, + format, 0, 0); + } +} + +void XftDrawDestroy (XftDraw *draw) { if (draw->render_able) @@ -56,22 +72,14 @@ XftDrawDestroy (XftDraw *draw) XRenderFreePicture (draw->dpy, draw->render.fg_pict); } if (draw->core_set) - { - int i; - XFreeGC (draw->dpy, draw->core.draw_gc); - for (i = 0; i < CACHE_SIZE; i++) - if (draw->core.u.cache[i].use >= 0) - XFreeColors (draw->dpy, draw->colormap, - &draw->core.u.cache[i].pixel, 1, 0); - } free (draw); } Bool -XftDrawRenderPrepare (XftDraw *draw, - XRenderColor *color, - XftFont *font) +XftDrawRenderPrepare (XftDraw *draw, + XftColor *color, + XftFont *font) { if (!draw->render_set) { @@ -101,129 +109,39 @@ XftDrawRenderPrepare (XftDraw *draw, draw->render.fg_pix, pix_format, CPRepeat, &pa); - draw->render.fg_color.red = ~color->red; + draw->render.fg_color.red = ~color->color.red; } } if (!draw->render_able) return False; - if (memcmp (color, &draw->render.fg_color, sizeof (XRenderColor))) + if (memcmp (&color->color, &draw->render.fg_color, sizeof (XRenderColor))) { XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.fg_pict, - color, 0, 0, 1, 1); - draw->render.fg_color = *color; + &color->color, 0, 0, 1, 1); + draw->render.fg_color = color->color; } return True; } -static short -maskbase (unsigned long m) -{ - short i; - - if (!m) - return 0; - i = 0; - while (!(m&1)) - { - m>>=1; - i++; - } - return i; -} - -static short -masklen (unsigned long m) -{ - unsigned long y; - - y = (m >> 1) &033333333333; - y = m - y - ((y >>1) & 033333333333); - return (short) (((y + (y >> 3)) & 030707070707) % 077); -} - Bool -XftDrawCorePrepare (XftDraw *draw, - XRenderColor *color, - XftFont *font) +XftDrawCorePrepare (XftDraw *draw, + XftColor *color, + XftFont *font) { - int i; - unsigned long pixel; XGCValues gcv; if (!draw->core_set) { draw->core_set = True; - if (draw->visual->class == TrueColor) - { - draw->core.u.truecolor.red_shift = maskbase (draw->visual->red_mask); - draw->core.u.truecolor.red_len = masklen (draw->visual->red_mask); - draw->core.u.truecolor.green_shift = maskbase (draw->visual->green_mask); - draw->core.u.truecolor.green_len = masklen (draw->visual->green_mask); - draw->core.u.truecolor.blue_shift = maskbase (draw->visual->blue_mask); - draw->core.u.truecolor.blue_len = masklen (draw->visual->blue_mask); - } - else - { - for (i = 0; i < CACHE_SIZE; i++) - draw->core.u.cache[i].use = -1; - } - draw->core.draw_gc = XCreateGC (draw->dpy, draw->drawable, 0, 0); - } - if (draw->visual->class == TrueColor) - { - pixel = (((color->red >> (16 - draw->core.u.truecolor.red_len)) << - draw->core.u.truecolor.red_shift) | - ((color->green >> (16 - draw->core.u.truecolor.green_len)) << - draw->core.u.truecolor.green_shift) | - ((color->blue >> (16 - draw->core.u.truecolor.blue_len)) << - draw->core.u.truecolor.blue_shift)); - } - else - { - int oldest, newest; - int match; - XColor xcolor; - - oldest = newest = 0; - match = -1; - for (i = 1; i < CACHE_SIZE; i++) - { - if (draw->core.u.cache[i].use < draw->core.u.cache[oldest].use) - oldest = i; - if (draw->core.u.cache[i].use > draw->core.u.cache[newest].use) - newest = i; - if (draw->core.u.cache[i].use >= 0 && - !memcmp (&draw->core.u.cache[i].color, color, - sizeof (XRenderColor))) - match = i; - } - if (match < 0) - { - match = oldest; - if (draw->core.u.cache[match].use >= 0) - { - XFreeColors (draw->dpy, draw->colormap, - &draw->core.u.cache[match].pixel, 1, 0); - draw->core.u.cache[match].use = -1; - } - xcolor.red = color->red; - xcolor.green = color->green; - xcolor.blue = color->blue; - xcolor.flags = DoRed|DoGreen|DoBlue; - if (!XAllocColor (draw->dpy, draw->colormap, &xcolor)) - return False; - draw->core.u.cache[match].pixel = xcolor.pixel; - draw->core.u.cache[match].color = *color; - draw->core.u.cache[match].use = draw->core.u.cache[newest].use + 1; - } - else if (match != newest) - draw->core.u.cache[match].use = draw->core.u.cache[newest].use + 1; - pixel = draw->core.u.cache[match].pixel; + draw->core.fg = color->pixel; + gcv.foreground = draw->core.fg; + draw->core.draw_gc = XCreateGC (draw->dpy, draw->drawable, + GCForeground, &gcv); + } - XGetGCValues (draw->dpy, draw->core.draw_gc, GCForeground|GCFont, &gcv); - if (gcv.foreground != pixel) - XSetForeground (draw->dpy, draw->core.draw_gc, pixel); + if (draw->core.fg != color->pixel) + XSetForeground (draw->dpy, draw->core.draw_gc, color->pixel); if (font && gcv.font != font->u.core.font->fid) XSetFont (draw->dpy, draw->core.draw_gc, font->u.core.font->fid); return True; @@ -231,7 +149,7 @@ XftDrawCorePrepare (XftDraw *draw, void XftDrawString8 (XftDraw *draw, - XRenderColor *color, + XftColor *color, XftFont *font, int x, int y, @@ -255,7 +173,7 @@ XftDrawString8 (XftDraw *draw, void XftDrawString16 (XftDraw *draw, - XRenderColor *color, + XftColor *color, XftFont *font, int x, int y, @@ -283,11 +201,11 @@ XftDrawString16 (XftDraw *draw, void XftDrawString32 (XftDraw *draw, - XRenderColor *color, + XftColor *color, XftFont *font, int x, int y, - unsigned long *string, + unsigned int *string, int len) { if (font->core) @@ -311,7 +229,7 @@ XftDrawString32 (XftDraw *draw, void XftDrawRect (XftDraw *draw, - XRenderColor *color, + XftColor *color, int x, int y, unsigned int width, @@ -320,7 +238,7 @@ XftDrawRect (XftDraw *draw, if (XftDrawRenderPrepare (draw, color, 0)) { XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.pict, - color, x, y, width, height); + &color->color, x, y, width, height); } else { diff --git a/xc/lib/Xft/xftextent.c b/xc/lib/Xft/xftextent.c index 3a775bf21..ce1963cbc 100644 --- a/xc/lib/Xft/xftextent.c +++ b/xc/lib/Xft/xftextent.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftextent.c,v 1.1 2000/11/29 08:39:22 keithp Exp $ + * $XFree86: xc/lib/Xft/xftextent.c,v 1.2 2000/12/01 21:32:02 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -61,7 +61,7 @@ XftTextExtents16 (Display *dpy, void XftTextExtents32 (Display *dpy, XftFont *font, - unsigned long *string, + unsigned int *string, int len, XGlyphInfo *extents) { diff --git a/xc/lib/Xft/xftfont.c b/xc/lib/Xft/xftfont.c index 5182d36ba..682c3cde2 100644 --- a/xc/lib/Xft/xftfont.c +++ b/xc/lib/Xft/xftfont.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftfont.c,v 1.1 2000/11/29 08:39:22 keithp Exp $ + * $XFree86: xc/lib/Xft/xftfont.c,v 1.3 2000/12/02 10:02:04 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -165,6 +165,29 @@ XftFontOpenName (Display *dpy, int screen, const char *name) return font; } +XftFont * +XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd) +{ + XftPattern *pat; + XftPattern *match; + XftResult result; + XftFont *font; + + pat = XftXlfdParse (xlfd, False, False); + if (!pat) + return 0; + match = XftFontMatch (dpy, screen, pat, &result); + XftPatternDestroy (pat); + if (!match) + return 0; + + font = XftFontOpenPattern (dpy, match); + if (!font) + XftPatternDestroy (match); + + return font; +} + void XftFontClose (Display *dpy, XftFont *font) { @@ -176,3 +199,12 @@ XftFontClose (Display *dpy, XftFont *font) XftPatternDestroy (font->pattern); free (font); } + +Bool +XftGlyphExists (Display *dpy, XftFont *font, unsigned int glyph) +{ + if (font->core) + return XftCoreGlyphExists (dpy, font->u.core.font, glyph); + else + return XftFreeTypeGlyphExists (dpy, font->u.ft.font, glyph); +} diff --git a/xc/lib/Xft/xftfreetype.c b/xc/lib/Xft/xftfreetype.c index 1519ab1a9..bf80f6414 100644 --- a/xc/lib/Xft/xftfreetype.c +++ b/xc/lib/Xft/xftfreetype.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.1 2000/11/29 08:39:22 keithp Exp $ + * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.3 2000/12/03 19:03:22 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -35,6 +35,7 @@ XftFtEncoding xftFtEncoding[] = { { "iso10646-1", ft_encoding_unicode, }, { "iso8859-1", ft_encoding_unicode, }, { "adobe-fontspecific", ft_encoding_symbol, }, + { "glyphs-fontspecific",ft_encoding_none, }, }; #define NUM_FT_ENCODINGS (sizeof xftFtEncoding / sizeof xftFtEncoding[0]) @@ -127,6 +128,11 @@ XftFreeTypeQuery (const char *file, int id, int *count) } } + if (!XftPatternAddString (pat, XFT_ENCODING, + "glyphs-fontspecific")) + goto bail1; + + FT_Done_Face (face); return pat; @@ -147,7 +153,9 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) double size; int rgba; int spacing; + int char_width; Bool antialias; + Bool encoded; char *encoding_name; FT_Face face; XftFontStruct *font; @@ -194,6 +202,12 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) goto bail0; } + if (XftPatternGetInteger (pattern, XFT_CHAR_WIDTH, + 0, &char_width) != XftResultMatch) + { + char_width = 0; + } + if (antialias) { if (rgba) @@ -273,18 +287,24 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) break; } - for (charmap = 0; charmap < face->num_charmaps; charmap++) - if (face->charmaps[charmap]->encoding == encoding) - break; - - if (charmap == face->num_charmaps) - goto bail2; + if (encoding == ft_encoding_none) + encoded = False; + else + { + encoded = True; + for (charmap = 0; charmap < face->num_charmaps; charmap++) + if (face->charmaps[charmap]->encoding == encoding) + break; - error = FT_Set_Charmap(face, - face->charmaps[charmap]); + if (charmap == face->num_charmaps) + goto bail2; - if (error) - goto bail2; + error = FT_Set_Charmap(face, + face->charmaps[charmap]); + + if (error) + goto bail2; + } height = face->height; ascent = face->ascender; @@ -312,6 +332,11 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) font->max_advance_width = face->max_advance_width * font->size / (64 * div); font->monospace = (face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0; + if (char_width) + { + font->max_advance_width = char_width; + font->monospace = True; + } switch (XftPatternGetInteger (pattern, XFT_SPACING, 0, &spacing)) { case XftResultNoMatch: break; @@ -330,6 +355,7 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) font->nrealized = 0; font->rgba = rgba; font->antialias = antialias; + font->encoded = encoded; font->face = face; return font; diff --git a/xc/lib/Xft/xftglyphs.c b/xc/lib/Xft/xftglyphs.c index 1e99d4727..c400f821d 100644 --- a/xc/lib/Xft/xftglyphs.c +++ b/xc/lib/Xft/xftglyphs.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.1 2000/11/29 08:39:23 keithp Exp $ + * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.3 2000/12/03 19:03:22 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -53,6 +53,7 @@ XftGlyphLoad (Display *dpy, #ifdef FREETYPE2 FT_Error error; FT_ULong charcode; + FT_UInt glyphindex; FT_GlyphSlot glyph; XGlyphInfo *gi; Glyph g; @@ -83,19 +84,45 @@ XftGlyphLoad (Display *dpy, while (nglyph--) { charcode = (FT_ULong) *glyphs++; - error = FT_Load_Char (font->face, charcode, 0/*|FT_LOAD_NO_HINTING */); + if (font->encoded) + { + glyphindex = FT_Get_Char_Index (font->face, charcode); + if (!glyphindex) + continue; + } + else + glyphindex = (FT_UInt) charcode; + error = FT_Load_Glyph (font->face, glyphindex, 0/*|FT_LOAD_NO_HINTING */); if (error) continue; -#define FLOOR(x) ((x) & -64) -#define CEIL(x) (((x)+63) & -64) -#define TRUNC(x) ((x) >> 6) +#define FLOOR(x) ((x) & -64) +#define CEIL(x) (((x)+63) & -64) +#define TRUNC(x) ((x) >> 6) +#define ROUND(x) (((x)+32) & -64) glyph = font->face->glyph; left = FLOOR( glyph->metrics.horiBearingX ); right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width ); width = TRUNC(right - left); + /* + * Try to keep monospace fonts ink-inside + */ + if (font->monospace) + { + if (TRUNC(right) > font->max_advance_width) + { + int adjust; + + adjust = right - (font->max_advance_width << 6); + if (adjust > left) + adjust = left; + left -= adjust; + right -= adjust; + width = font->max_advance_width; + } + } top = CEIL( glyph->metrics.horiBearingY ); bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height ); @@ -204,9 +231,9 @@ XftGlyphLoad (Display *dpy, gi->x = -TRUNC(left); gi->y = TRUNC(top); if (font->monospace) - gi->xOff = font->face->max_advance_width * font->size / (64 * font->face->units_per_EM); + gi->xOff = font->max_advance_width; else - gi->xOff = ((glyph->metrics.horiAdvance + 0x20) >> 6); + gi->xOff = TRUNC(ROUND(glyph->metrics.horiAdvance)); gi->yOff = 0; g = charcode; @@ -330,3 +357,18 @@ XftGlyphCheck (Display *dpy, } #endif } + +Bool +XftFreeTypeGlyphExists (Display *dpy, + XftFontStruct *font, + unsigned int glyph) +{ +#ifdef FREETYPE2 + if (font->encoded) + return FT_Get_Char_Index (font->face, (FT_ULong) glyph) != 0; + else + return glyph && glyph <= font->face->num_glyphs; +#else + return False; +#endif +} diff --git a/xc/lib/Xft/xftgram.y b/xc/lib/Xft/xftgram.y index bcf7df2cd..bcf399a2a 100644 --- a/xc/lib/Xft/xftgram.y +++ b/xc/lib/Xft/xftgram.y @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftgram.y,v 1.1 2000/11/29 08:39:23 keithp Exp $ + * $XFree86: xc/lib/Xft/xftgram.y,v 1.2 2000/11/30 23:30:00 dawes Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -25,6 +25,7 @@ %{ #include <stdlib.h> +#include <stdio.h> #include "xftint.h" %} diff --git a/xc/lib/Xft/xftint.h b/xc/lib/Xft/xftint.h index b4c305e60..cae06ebae 100644 --- a/xc/lib/Xft/xftint.h +++ b/xc/lib/Xft/xftint.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftint.h,v 1.3 2000/11/29 08:39:23 keithp Exp $ + * $XFree86: xc/lib/Xft/xftint.h,v 1.8 2000/12/02 10:02:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -38,8 +38,6 @@ typedef struct _XftSymbolic { int value; } XftSymbolic; -#define CACHE_SIZE 3 - struct _XftDraw { Display *dpy; Drawable drawable; @@ -49,25 +47,14 @@ struct _XftDraw { Bool render_set; Bool render_able; struct { - Picture pict; - Pixmap fg_pix; - Picture fg_pict; + Picture pict; + Pixmap fg_pix; + Picture fg_pict; XRenderColor fg_color; } render; struct { - GC draw_gc; - union { - struct { - unsigned long pixel; - XRenderColor color; - int use; - } cache[CACHE_SIZE]; - struct { - short red_shift, red_len; - short green_shift, green_len; - short blue_shift, blue_len; - } truecolor; - } u; + GC draw_gc; + unsigned long fg; } core; }; @@ -152,7 +139,9 @@ Bool XftConfigAddEdit (XftTest *test, XftEdit *edit); Bool -XftConfigSubstitute (XftPattern *p); +_XftConfigCompareValue (XftValue m, + XftOp op, + XftValue v); /* xftcore.c */ @@ -164,7 +153,7 @@ XftCoreConvert16 (unsigned short *string, XChar2b xcloc[XFT_CORE_N16LOCAL]); XChar2b * -XftCoreConvert32 (unsigned long *string, +XftCoreConvert32 (unsigned int *string, int len, XChar2b xcloc[XFT_CORE_N16LOCAL]); @@ -185,10 +174,15 @@ XftCoreExtents16 (Display *dpy, void XftCoreExtents32 (Display *dpy, XFontStruct *fs, - unsigned long *string, + unsigned int *string, int len, XGlyphInfo *extents); +Bool +XftCoreGlyphExists (Display *dpy, + XFontStruct *fs, + unsigned int glyph); + /* xftdbg.c */ void XftOpPrint (XftOp op); @@ -210,12 +204,6 @@ Bool XftDirScan (XftFontSet *set, const char *dir); /* xftdpy.c */ -Bool -XftDefaultHasRender (Display *dpy); - -Bool -XftDefaultSet (Display *dpy, XftPattern *defaults); - int XftDefaultParseBool (char *v); @@ -231,19 +219,16 @@ XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def); XftFontSet * XftDisplayGetFontSet (Display *dpy); -void -XftDefaultSubstitute (Display *dpy, int screen, XftPattern *pattern); - /* xftdraw.c */ Bool -XftDrawRenderPrepare (XftDraw *draw, - XRenderColor *color, - XftFont *font); +XftDrawRenderPrepare (XftDraw *draw, + XftColor *color, + XftFont *font); Bool -XftDrawCorePrepare (XftDraw *draw, - XRenderColor *color, - XftFont *font); +XftDrawCorePrepare (XftDraw *draw, + XftColor *color, + XftFont *font); /* xftextent.c */ /* xftfont.c */ @@ -258,28 +243,7 @@ void XftFreeTypeClose (Display *dpy, XftFontStruct *font); /* xftfs.c */ -XftFontSet * -XftFontSetCreate (void); - -void -XftFontSetDestroy (XftFontSet *s); - -Bool -XftFontSetAdd (XftFontSet *s, XftPattern *font); - /* xftglyphs.c */ -void -XftGlyphLoad (Display *dpy, - XftFontStruct *font, - unsigned long *glyphs, - int nglyph); - -void -XftGlyphCheck (Display *dpy, - XftFontStruct *font, - unsigned long glyph, - unsigned long *missing, - int *nmissing); /* xftgram.y */ int XftConfigparse (void); @@ -330,9 +294,6 @@ XftEditDestroy (XftEdit *e); Bool XftInitFtLibrary (void); -Bool -XftInit (char *config); - /* xftlex.l */ extern int XftConfigLineno; extern char *XftConfigFile; @@ -346,30 +307,39 @@ XftConfigLexFile(char *s); Bool XftConfigPushInput (char *s, Bool complain); -/* xftmatch.c */ -XftPattern * -XftFontSetMatch (XftFontSet **sets, - int nsets, - XftPattern *p, - XftResult *result); +/* xftlist.c */ +XftObjectSet * +_XftObjectSetVapBuild (const char *first, va_list *vap); -/* xftname.c */ Bool -XftNameConstant (char *string, int *result); +XftListValueCompare (XftValue v1, + XftValue v2); -XftPattern * -XftNameParse (const char *name); +Bool +XftListValueListCompare (XftValueList *v1orig, + XftValueList *v2orig, + XftQual qual); -/* xftpat.c */ +Bool +XftListMatch (XftPattern *p, + XftPattern *font, + XftQual qual); -void -XftValueDestroy (XftValue v); +Bool +XftListAppend (XftFontSet *s, + XftPattern *font, + XftObjectSet *os); -void -XftValueListDestroy (XftValueList *l); -XftPatternElt * -XftPatternFind (XftPattern *p, const char *object, Bool insert); +/* xftmatch.c */ + +/* xftname.c */ +Bool +XftNameConstant (char *string, int *result); + +/* xftpat.c */ +XftPattern * +_XftPatternVapBuild (XftPattern *orig, va_list *vap); /* xftrender.c */ @@ -396,13 +366,7 @@ int _XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def); /* xftxlfd.c */ -XftPattern * -XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable); - Bool XftCoreAddFonts (XftFontSet *set, Display *dpy, Bool ignore_scalable); -XFontStruct * -XftCoreOpen (Display *dpy, XftPattern *pattern); - #endif /* _XFT_INT_H_ */ diff --git a/xc/lib/Xft/xftlex.l b/xc/lib/Xft/xftlex.l index 6c4641653..839ea04c0 100644 --- a/xc/lib/Xft/xftlex.l +++ b/xc/lib/Xft/xftlex.l @@ -1,6 +1,6 @@ %{ /* - * $XFree86: xc/lib/Xft/xftlex.l,v 1.1 2000/11/29 08:39:23 keithp Exp $ + * $XFree86: xc/lib/Xft/xftlex.l,v 1.2 2000/11/30 23:30:00 dawes Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -25,10 +25,29 @@ #include <string.h> #include "xftint.h" + #include "xftgram.h" int XftConfigLineno; + +static void _XftConfigSkipComment (void); + +static void _XftConfigSkipLine (void); + +static int _XftConfigPopInput (void); + +#define XFT_CONFIG_IN_DEEP 20 +FILE *XftConfigInStack[XFT_CONFIG_IN_DEEP]; +FILE **XftConfigInpt = XftConfigInStack + XFT_CONFIG_IN_DEEP; +FILE *XftConfigInput; +int XftConfigLinenos[XFT_CONFIG_IN_DEEP]; +int *XftConfigLinenopt = XftConfigLinenos + XFT_CONFIG_IN_DEEP; +char *XftConfigFile = ""; +char *XftConfigFileNames[XFT_CONFIG_IN_DEEP]; +char **XftConfigFileNamePt = XftConfigFileNames + XFT_CONFIG_IN_DEEP; +int XftConfigFiledeep = 0; + #undef YY_INPUT #define YY_INPUT(buf,result,max_size) \ @@ -69,30 +88,10 @@ static void unput (char c) { if (c == '\n') XftConfigLineno--; - ungetc (XftConfigInput, c); + ungetc (c, XftConfigInput); } #endif -#define XFT_CONFIG_IN_DEEP 20 -FILE *XftConfigInStack[XFT_CONFIG_IN_DEEP]; -FILE **XftConfigInpt = XftConfigInStack + XFT_CONFIG_IN_DEEP; -FILE *XftConfigInput; -int XftConfigLinenos[XFT_CONFIG_IN_DEEP]; -int *XftConfigLinenopt = XftConfigLinenos + XFT_CONFIG_IN_DEEP; -char *XftConfigFile = ""; -char *XftConfigFileNames[XFT_CONFIG_IN_DEEP]; -char **XftConfigFileNamePt = XftConfigFileNames + XFT_CONFIG_IN_DEEP; -int XftConfigFiledeep = 0; - -static void -_XftConfigSkipComment (void); - -static void -_XftConfigSkipLine (void); - -static int -_XftConfigPopInput (void); - %} %% "/\052" _XftConfigSkipComment(); @@ -126,21 +125,21 @@ all return ALL; "?" return QUEST; \"([^\n\"]|\\\")*\" { yytext[yyleng - 1] = '\0'; - XftConfiglval.sval = yytext+1; + yylval.sval = yytext+1; return STRING; } [0-9]+ { - XftConfiglval.ival = strtol (yytext, 0, 10); + yylval.ival = strtol (yytext, 0, 10); return INTEGER; } (([0-9]+((\.[0-9]*(\{[0-9]+\})?)?))|(\.[0-9]+)|(\.[0-9]*\{[0-9]+\}))(([Ee][-+]?[0-9]+)?) { - XftConfiglval.dval = strtod (yytext, 0); + yylval.dval = strtod (yytext, 0); return DOUBLE; } [a-zA-Z][0-9a-zA-Z_]* { - if (XftNameConstant (yytext, &XftConfiglval.ival)) + if (XftNameConstant (yytext, &yylval.ival)) return INTEGER; - XftConfiglval.sval = yytext; + yylval.sval = yytext; return NAME; } . ; diff --git a/xc/lib/Xft/xftlist.c b/xc/lib/Xft/xftlist.c new file mode 100644 index 000000000..1ee72bc05 --- /dev/null +++ b/xc/lib/Xft/xftlist.c @@ -0,0 +1,321 @@ +/* + * $XFree86: xc/lib/Xft/xftlist.c,v 1.1 2000/11/30 06:59:45 keithp Exp $ + * + * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <stdlib.h> +#include "xftint.h" + +XftObjectSet * +XftObjectSetCreate (void) +{ + XftObjectSet *os; + + os = (XftObjectSet *) malloc (sizeof (XftObjectSet)); + if (!os) + return 0; + os->nobject = 0; + os->sobject = 0; + os->objects = 0; + return os; +} + +Bool +XftObjectSetAdd (XftObjectSet *os, const char *object) +{ + int s; + const char **objects; + + if (os->nobject == os->sobject) + { + s = os->sobject + 4; + if (os->objects) + objects = (const char **) realloc ((void *) os->objects, + s * sizeof (const char **)); + else + objects = (const char **) malloc (s * sizeof (const char **)); + if (!objects) + return False; + os->objects = objects; + os->sobject = s; + } + os->objects[os->nobject++] = object; + return True; +} + +void +XftObjectSetDestroy (XftObjectSet *os) +{ + if (os->objects) + free ((void *) os->objects); + free (os); +} + +XftObjectSet * +_XftObjectSetVapBuild (const char *first, va_list *vap) +{ + XftObjectSet *os; + const char *object; + va_list va = *vap; + + os = XftObjectSetCreate (); + if (!os) + goto bail0; + object = first; + while (object) + { + if (!XftObjectSetAdd (os, object)) + goto bail1; + object = va_arg (va, const char *); + } + *vap = va; + return os; +bail1: + XftObjectSetDestroy (os); +bail0: + return 0; +} + +XftObjectSet * +XftObjectSetVaBuild (const char *first, va_list va) +{ + return _XftObjectSetVapBuild (first, &va); +} + +XftObjectSet * +XftObjectSetBuild (const char *first, ...) +{ + va_list va; + XftObjectSet *os; + + va_start (va, first); + os = _XftObjectSetVapBuild (first, &va); + va_end (va); + return os; +} + +Bool +XftListValueCompare (XftValue v1, + XftValue v2) +{ + return _XftConfigCompareValue (v1, XftOpEqual, v2); +} + +Bool +XftListValueListCompare (XftValueList *v1orig, + XftValueList *v2orig, + XftQual qual) +{ + XftValueList *v1, *v2; + + for (v1 = v1orig; v1; v1 = v1->next) + { + for (v2 = v2orig; v2; v2 = v2->next) + { + if (_XftConfigCompareValue (v1->value, XftOpEqual, v2->value)) + { + if (qual == XftQualAny) + return True; + else + break; + } + } + if (qual == XftQualAll) + { + if (!v2) + return False; + } + } + if (qual == XftQualAll) + return True; + else + return False; +} + +/* + * True iff all objects in "p" match "font" + */ +Bool +XftListMatch (XftPattern *p, + XftPattern *font, + XftQual qual) +{ + int i; + XftPatternElt *e; + + for (i = 0; i < p->num; i++) + { + e = XftPatternFind (font, p->elts[i].object, False); + if (!e) + { + if (qual == XftQualAll) + continue; + else + return False; + } + if (!XftListValueListCompare (p->elts[i].values, e->values, qual)) + return False; + } + return True; +} + +Bool +XftListAppend (XftFontSet *s, + XftPattern *font, + XftObjectSet *os) +{ + int f; + int o; + XftPattern *l; + XftPatternElt *e; + XftValueList *v; + + for (f = 0; f < s->nfont; f++) + { + l = s->fonts[f]; + if (XftListMatch (l, font, XftQualAll)) + return True; + } + l = XftPatternCreate (); + if (!l) + goto bail0; + for (o = 0; o < os->nobject; o++) + { + e = XftPatternFind (font, os->objects[o], False); + if (e) + { + for (v = e->values; v; v = v->next) + { + if (!XftPatternAdd (l, os->objects[o], v->value, True)) + goto bail1; + } + } + } + if (!XftFontSetAdd (s, l)) + goto bail1; + return True; +bail1: + XftPatternDestroy (l); +bail0: + return False; +} + +XftFontSet * +XftListFontSets (XftFontSet **sets, + int nsets, + XftPattern *p, + XftObjectSet *os) +{ + XftFontSet *ret; + XftFontSet *s; + int f; + int set; + + ret = XftFontSetCreate (); + if (!ret) + goto bail0; + for (set = 0; set < nsets; set++) + { + s = sets[set]; + for (f = 0; f < s->nfont; f++) + { + if (XftListMatch (p, s->fonts[f], XftQualAny)) + { + if (!XftListAppend (ret, s->fonts[f], os)) + goto bail1; + } + } + } + return ret; +bail1: + XftFontSetDestroy (ret); +bail0: + return 0; +} + +XftFontSet * +XftListFontsPatternObjects (Display *dpy, + int screen, + XftPattern *pattern, + XftObjectSet *os) +{ + XftFontSet *sets[2]; + int nsets = 0; +#ifdef FREETYPE2 + Bool core, render; + XftResult result; +#endif + + if (!XftInit (0)) + return 0; + +#ifdef FREETYPE2 + render = core = False; + result = XftPatternGetBool (pattern, XFT_CORE, 0, &core); + if (result != XftResultMatch) + core = XftDefaultGetBool (dpy, XFT_CORE, screen, + !XftDefaultHasRender (dpy)); + + result = XftPatternGetBool (pattern, XFT_RENDER, 0, &render); + if (result != XftResultMatch) + render = XftDefaultGetBool (dpy, XFT_RENDER, screen, + XftDefaultHasRender (dpy)); + if (render) + { + if (XftInitFtLibrary ()) + { + sets[nsets] = _XftFontSet; + if (sets[nsets]) + nsets++; + } + } + if (core) +#endif + { + sets[nsets] = XftDisplayGetFontSet (dpy); + if (sets[nsets]) + nsets++; + } + return XftListFontSets (sets, nsets, pattern, os); +} + +XftFontSet * +XftListFonts (Display *dpy, + int screen, + ...) +{ + va_list va; + XftFontSet *fs; + XftObjectSet *os; + XftPattern *pattern; + const char *first; + + va_start (va, screen); + pattern = _XftPatternVapBuild (0, &va); + first = va_arg (va, const char *); + os = _XftObjectSetVapBuild (first, &va); + va_end (va); + fs = XftListFontsPatternObjects (dpy, screen, pattern, os); + XftPatternDestroy (pattern); + XftObjectSetDestroy (os); + return fs; +} diff --git a/xc/lib/Xft/xftname.c b/xc/lib/Xft/xftname.c index bf9ca0367..bd99f98fe 100644 --- a/xc/lib/Xft/xftname.c +++ b/xc/lib/Xft/xftname.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftname.c,v 1.1 2000/11/29 08:39:23 keithp Exp $ + * $XFree86: xc/lib/Xft/xftname.c,v 1.4 2000/12/03 00:45:44 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -72,41 +72,52 @@ XftNameGetType (const char *object) typedef struct _XftConstant { const char *name; + const char *object; int value; } XftConstant; static XftConstant XftConstants[] = { - { "light", XFT_WEIGHT_LIGHT, }, - { "medium", XFT_WEIGHT_MEDIUM, }, - { "demibold", XFT_WEIGHT_DEMIBOLD, }, - { "bold", XFT_WEIGHT_BOLD, }, - { "black", XFT_WEIGHT_BLACK, }, - - { "roman", XFT_SLANT_ROMAN, }, - { "italic", XFT_SLANT_ITALIC, }, - { "oblique", XFT_SLANT_OBLIQUE, }, - - { "proportional", XFT_PROPORTIONAL, }, - { "mono", XFT_MONO, }, - { "charcell", XFT_CHARCELL, }, - - { "rgb", XFT_RGBA_RGB, }, - { "bgr", XFT_RGBA_BGR, }, + { "light", "weight", XFT_WEIGHT_LIGHT, }, + { "medium", "weight", XFT_WEIGHT_MEDIUM, }, + { "demibold", "weight", XFT_WEIGHT_DEMIBOLD, }, + { "bold", "weight", XFT_WEIGHT_BOLD, }, + { "black", "weight", XFT_WEIGHT_BLACK, }, + + { "roman", "slant", XFT_SLANT_ROMAN, }, + { "italic", "slant", XFT_SLANT_ITALIC, }, + { "oblique", "slant", XFT_SLANT_OBLIQUE, }, + + { "proportional", "spacing", XFT_PROPORTIONAL, }, + { "mono", "spacing", XFT_MONO, }, + { "charcell", "spacing", XFT_CHARCELL, }, + + { "rgb", "rgba", XFT_RGBA_RGB, }, + { "bgr", "rgba", XFT_RGBA_BGR, }, }; #define NUM_XFT_CONSTANTS (sizeof XftConstants/sizeof XftConstants[0]) +static XftConstant * +_XftNameConstantLookup (char *string) +{ + int i; + + for (i = 0; i < NUM_XFT_CONSTANTS; i++) + if (!strcmp (string, XftConstants[i].name)) + return &XftConstants[i]; + return 0; +} + Bool XftNameConstant (char *string, int *result) { - int i; + XftConstant *c; - for (i = 0; i < NUM_XFT_CONSTANTS; i++) - if (!strcmp (string, XftConstants[i].name)) - { - *result = XftConstants[i].value; - return True; - } + if ((c = _XftNameConstantLookup(string))) + { + *result = c->value; + return True; + } return False; } @@ -136,6 +147,25 @@ _XftNameConvert (XftType type, char *string) return v; } +static const char * +_XftNameFindNext (const char *cur, const char *delim, char *save, char *last) +{ + char c; + + while (*cur && !strchr (delim, *cur)) + { + c = *cur++; + if (isupper (c)) + c = tolower (c); + *save++ = c; + } + *save = 0; + *last = *cur; + if (*cur) + cur++; + return cur; +} + XftPattern * XftNameParse (const char *name) { @@ -143,8 +173,10 @@ XftNameParse (const char *name) XftPattern *pat; double d; char *e; + char delim; XftValue v; const XftObjectType *t; + XftConstant *c; save = malloc (strlen (name) + 1); if (!save) @@ -155,41 +187,58 @@ XftNameParse (const char *name) for (;;) { - name = _XftSplitValue (name, save); - if (!XftPatternAddString (pat, XFT_FAMILY, save)) - goto bail2; - if (*name != ',') + name = _XftNameFindNext (name, "-,:", save, &delim); + if (save[0]) + { + if (!XftPatternAddString (pat, XFT_FAMILY, save)) + goto bail2; + } + if (delim != ',') break; } - if (*name) + if (delim == '-') { - _XftSplitStr (name, save); - d = strtod (save, &e); - if (e != save) + for (;;) { - if (!XftPatternAddDouble (pat, XFT_SIZE, d)) - goto bail2; + name = _XftNameFindNext (name, "-,:", save, &delim); + d = strtod (save, &e); + if (e != save) + { + if (!XftPatternAddDouble (pat, XFT_SIZE, d)) + goto bail2; + } + if (delim != ',') + break; } - name = strchr (name, '-'); - if (name) - ++name; - while (name && *name) + } + while (delim == ':') + { + name = _XftNameFindNext (name, "=-:", save, &delim); + if (save[0]) { - name = _XftSplitField (name, save); - t = XftNameGetType (save); - if (*name == '=') + if (delim == '=' || delim == '-') { - do + t = XftNameGetType (save); + for (;;) { - name++; - name = _XftSplitValue (name, save); - if (t) + name = _XftNameFindNext (name, ":,", save, &delim); + if (save[0] && t) { v = _XftNameConvert (t->type, save); - XftPatternAdd (pat, t->object, v, True); + if (!XftPatternAdd (pat, t->object, v, True)) + goto bail2; } + if (delim != ',') + break; + } + } + else + { + if ((c = _XftNameConstantLookup (save))) + { + if (!XftPatternAddInteger (pat, c->object, c->value)) + goto bail2; } - while (*name == ','); } } } diff --git a/xc/lib/Xft/xftpat.c b/xc/lib/Xft/xftpat.c index 7d9caa151..2c8045bb0 100644 --- a/xc/lib/Xft/xftpat.c +++ b/xc/lib/Xft/xftpat.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftpat.c,v 1.1 2000/11/29 08:39:23 keithp Exp $ + * $XFree86: xc/lib/Xft/xftpat.c,v 1.2 2000/11/30 06:59:45 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -339,8 +339,9 @@ bail0: } XftPattern * -XftPatternVaBuild (XftPattern *orig, va_list va) +_XftPatternVapBuild (XftPattern *orig, va_list *vap) { + va_list va = *vap; const char *object; XftValue v; XftPattern *p; @@ -377,6 +378,7 @@ XftPatternVaBuild (XftPattern *orig, va_list va) if (!XftPatternAdd (p, object, v, True)) goto bail; } + *vap = va; return p; bail: if (!orig) @@ -385,12 +387,18 @@ bail: } XftPattern * +XftPatternVaBuild (XftPattern *orig, va_list va) +{ + return _XftPatternVapBuild (orig, &va); +} + +XftPattern * XftPatternBuild (XftPattern *orig, ...) { va_list va; va_start (va, orig); - orig = XftPatternVaBuild (orig, va); + orig = _XftPatternVapBuild (orig, &va); va_end (va); return orig; } diff --git a/xc/lib/Xft/xftrender.c b/xc/lib/Xft/xftrender.c index e95d5bd8e..baa120a81 100644 --- a/xc/lib/Xft/xftrender.c +++ b/xc/lib/Xft/xftrender.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftrender.c,v 1.2 2000/11/29 17:40:37 dawes Exp $ + * $XFree86: xc/lib/Xft/xftrender.c,v 1.3 2000/12/01 21:32:02 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -69,7 +69,7 @@ XftRenderString16 (Display *dpy, Picture src, XftGlyphLoad (dpy, font, missing, nmissing); XRenderCompositeString16 (dpy, PictOpOver, src, dst, font->format, font->glyphset, - srcx, srcy, x, y, (unsigned short *) string, len); + srcx, srcy, x, y, string, len); } void @@ -77,11 +77,11 @@ XftRenderString32 (Display *dpy, Picture src, XftFontStruct *font, Picture dst, int srcx, int srcy, int x, int y, - unsigned long *string, int len) + unsigned int *string, int len) { unsigned long missing[XFT_NMISSING]; int nmissing; - unsigned long *s; + unsigned int *s; int l; s = string; @@ -93,7 +93,7 @@ XftRenderString32 (Display *dpy, Picture src, XftGlyphLoad (dpy, font, missing, nmissing); XRenderCompositeString32 (dpy, PictOpOver, src, dst, font->format, font->glyphset, - srcx, srcy, x, y, (unsigned long *) string, len); + srcx, srcy, x, y, string, len); } void @@ -209,13 +209,13 @@ XftRenderExtents16 (Display *dpy, void XftRenderExtents32 (Display *dpy, XftFontStruct *font, - unsigned long *string, + unsigned int *string, int len, XGlyphInfo *extents) { unsigned long missing[XFT_NMISSING]; int nmissing; - unsigned long *s; + unsigned int *s; int l; XGlyphInfo *gi; int x, y; diff --git a/xc/lib/Xft/xftxlfd.c b/xc/lib/Xft/xftxlfd.c index 3e6c6e26a..8885dd2f1 100644 --- a/xc/lib/Xft/xftxlfd.c +++ b/xc/lib/Xft/xftxlfd.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftxlfd.c,v 1.1 2000/11/29 08:39:24 keithp Exp $ + * $XFree86: xc/lib/Xft/xftxlfd.c,v 1.3 2000/12/02 10:02:06 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -47,7 +47,7 @@ static XftSymbolic XftXlfdSlants[] = { #define NUM_XLFD_SLANTS (sizeof XftXlfdSlants/sizeof XftXlfdSlants[0]) XftPattern * -XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable) +XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable, Bool complete) { XftPattern *pat; const char *xlfd = xlfd_orig; @@ -64,6 +64,7 @@ XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable) int resx; int resy; int slant_value, weight_value; + double dpixel; if (*xlfd != '-') return 0; @@ -96,9 +97,14 @@ XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable) return 0; if (!XftPatternAddString (pat, XFT_XLFD, xlfd_orig)) goto bail; - if (!XftPatternAddBool (pat, XFT_CORE, True)) goto bail; - if (!XftPatternAddString (pat, XFT_FOUNDRY, _XftSplitStr (foundry, save))) goto bail; - if (!XftPatternAddString (pat, XFT_FAMILY, _XftSplitStr (family, save))) goto bail; + + _XftSplitStr (foundry, save); + if (save[0] && strcmp (save, "*") != 0) + if (!XftPatternAddString (pat, XFT_FOUNDRY, save)) goto bail; + + _XftSplitStr (family, save); + if (save[0] && strcmp (save, "*") != 0) + if (!XftPatternAddString (pat, XFT_FAMILY, save)) goto bail; weight_value = _XftMatchSymbolic (XftXlfdWeights, NUM_XLFD_WEIGHTS, _XftSplitStr (weight_name, save), @@ -112,36 +118,54 @@ XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable) if (!XftPatternAddInteger (pat, XFT_SLANT, slant_value)) goto bail; - /* - * Build a style name - */ - style[0] = '\0'; - switch (weight_value) { - case XFT_WEIGHT_LIGHT: strcat (style, "light"); break; - case XFT_WEIGHT_DEMIBOLD: strcat (style, "demibold"); break; - case XFT_WEIGHT_BOLD: strcat (style, "bold"); break; - case XFT_WEIGHT_BLACK: strcat (style, "black"); break; + dpixel = (double) pixel; + + if (complete) + { + /* + * Build a style name + */ + style[0] = '\0'; + switch (weight_value) { + case XFT_WEIGHT_LIGHT: strcat (style, "light"); break; + case XFT_WEIGHT_DEMIBOLD: strcat (style, "demibold"); break; + case XFT_WEIGHT_BOLD: strcat (style, "bold"); break; + case XFT_WEIGHT_BLACK: strcat (style, "black"); break; + } + if (slant_value != XFT_SLANT_ROMAN) { + if (style[0]) + strcat (style, " "); + switch (slant_value) { + case XFT_SLANT_ITALIC: strcat (style, "italic"); break; + case XFT_SLANT_OBLIQUE: strcat (style, "oblique"); break; + } + } + if (!style[0]) + strcat (style, "regular"); + + if (!XftPatternAddString (pat, XFT_STYLE, style)) + goto bail; + if (!XftPatternAddBool (pat, XFT_SCALABLE, pixel == 0)) goto bail; + if (!XftPatternAddBool (pat, XFT_CORE, True)) goto bail; } - if (slant_value != XFT_SLANT_ROMAN) { - if (style[0]) - strcat (style, " "); - switch (slant_value) { - case XFT_SLANT_ITALIC: strcat (style, "italic"); break; - case XFT_SLANT_OBLIQUE: strcat (style, "oblique"); break; + else + { + if (point > 0) + { + if (!XftPatternAddDouble (pat, XFT_SIZE, ((double) point) / 10.0)) goto bail; + if (pixel <= 0 && resy > 0) + { + dpixel = (double) point * (double) resy / 720.0; + } } } - if (!style[0]) - strcat (style, "regular"); - if (!XftPatternAddString (pat, XFT_STYLE, style)) - goto bail; + if (dpixel > 0) + if (!XftPatternAddDouble (pat, XFT_PIXEL_SIZE, dpixel)) goto bail; - if (pixel) - if (!XftPatternAddDouble (pat, XFT_PIXEL_SIZE, (double) pixel)) goto bail; - - if (!XftPatternAddBool (pat, XFT_SCALABLE, pixel == 0)) goto bail; - - if (!XftPatternAddString (pat, XFT_ENCODING, _XftDownStr (registry, save))) goto bail; + _XftDownStr (registry, save); + if (registry[0] && !strchr (registry, '*')) + if (!XftPatternAddString (pat, XFT_ENCODING, save)) goto bail; free (save); return pat; @@ -169,15 +193,14 @@ XftCoreAddFonts (XftFontSet *set, Display *dpy, Bool ignore_scalable) ret = True; for (i = 0; ret && i < num; i++) { - font = XftXlfdParse (xlfds[i], ignore_scalable); + font = XftXlfdParse (xlfds[i], ignore_scalable, True); if (font) { -#if 0 - printf ("xlfd %s ", xlfds[i]); - XftPatternPrint (font); -#endif if (!XftFontSetAdd (set, font)) + { + XftPatternDestroy (font); ret = False; + } } } diff --git a/xc/lib/Xrender/Glyph.c b/xc/lib/Xrender/Glyph.c index a8cdf7c1c..ad223450f 100644 --- a/xc/lib/Xrender/Glyph.c +++ b/xc/lib/Xrender/Glyph.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xrender/Glyph.c,v 1.3 2000/11/29 08:25:45 keithp Exp $ + * $XFree86: xc/lib/Xrender/Glyph.c,v 1.5 2000/12/02 09:38:02 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -37,7 +37,7 @@ XRenderCreateGlyphSet (Display *dpy, XRenderPictFormat *format) GetReq(RenderCreateGlyphSet, req); req->reqType = info->codes->major_opcode; req->renderReqType = X_RenderCreateGlyphSet; - req->gsid = gsid = _XAllocID(dpy); + req->gsid = gsid = XAllocID(dpy); req->format = format->id; UnlockDisplay(dpy); SyncHandle(); @@ -56,7 +56,7 @@ XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing) GetReq(RenderReferenceGlyphSet, req); req->reqType = info->codes->major_opcode; req->renderReqType = X_RenderReferenceGlyphSet; - req->gsid = gsid = _XAllocID(dpy); + req->gsid = gsid = XAllocID(dpy); req->existing = existing; UnlockDisplay(dpy); SyncHandle(); @@ -151,10 +151,15 @@ XRenderCompositeString8 (Display *dpy, xRenderCompositeGlyphs8Req *req; long len; xGlyphElt *elt; + int nbytes; + if (!nchar) + return; + RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); - GetReqExtra(RenderCompositeGlyphs8, SIZEOF (xGlyphElt), req); + + GetReq(RenderCompositeGlyphs8, req); req->reqType = info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs8; req->op = op; @@ -164,13 +169,51 @@ XRenderCompositeString8 (Display *dpy, req->glyphset = glyphset; req->xSrc = xSrc; req->ySrc = ySrc; - elt = (xGlyphElt *) (req + 1); - elt->len = nchar; - elt->deltax = xDst; - elt->deltay = yDst; - len = (nchar + 3) >> 2; - SetReqLen(req, len, len); - Data(dpy, string, nchar); + + /* + * xGlyphElt must be aligned on a 32-bit boundary; this is + * easily done by filling no more than 252 glyphs in each + * bucket + */ + +#define MAX_8 252 + + len = SIZEOF(xGlyphElt) * ((nchar + MAX_8-1) / MAX_8) + nchar; + + req->length += (len + 3)>>2; /* convert to number of 32-bit words */ + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. + */ + + if (dpy->bufptr + len > dpy->bufmax) + _XFlush (dpy); + + while(nchar > MAX_8) + { + nbytes = MAX_8 + SIZEOF(xGlyphElt); + BufAlloc (xGlyphElt *, elt, nbytes); + elt->len = MAX_8; + elt->deltax = xDst; + elt->deltay = yDst; + xDst = 0; + yDst = 0; + memcpy ((char *) (elt + 1), string, MAX_8); + nchar = nchar - MAX_8; + string += MAX_8; + } + + if (nchar) + { + nbytes = (nchar + SIZEOF(xGlyphElt) + 3) & ~3; + BufAlloc (xGlyphElt *, elt, nbytes); + elt->len = nchar; + elt->deltax = xDst; + elt->deltay = yDst; + memcpy ((char *) (elt + 1), string, nchar); + } + UnlockDisplay(dpy); SyncHandle(); } @@ -192,12 +235,17 @@ XRenderCompositeString16 (Display *dpy, xRenderCompositeGlyphs8Req *req; long len; xGlyphElt *elt; + int nbytes; + if (!nchar) + return; + RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); - GetReqExtra(RenderCompositeGlyphs8, SIZEOF (xGlyphElt), req); + + GetReq(RenderCompositeGlyphs16, req); req->reqType = info->codes->major_opcode; - req->renderReqType = X_RenderCompositeGlyphs8; + req->renderReqType = X_RenderCompositeGlyphs16; req->op = op; req->src = src; req->dst = dst; @@ -205,14 +253,45 @@ XRenderCompositeString16 (Display *dpy, req->glyphset = glyphset; req->xSrc = xSrc; req->ySrc = ySrc; - elt = (xGlyphElt *) (req + 1); - elt->len = nchar; - elt->deltax = xDst; - elt->deltay = yDst; - len = (nchar + 1) >> 1; - SetReqLen(req, len, len); - nchar <<= 1; - Data16(dpy, string, nchar); + +#define MAX_16 254 + + len = SIZEOF(xGlyphElt) * ((nchar + MAX_8-1) / MAX_8) + nchar * 2; + + req->length += (len + 3)>>2; /* convert to number of 32-bit words */ + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. + */ + + if (dpy->bufptr + len > dpy->bufmax) + _XFlush (dpy); + + while(nchar > MAX_16) + { + nbytes = MAX_16 * 2 + SIZEOF(xGlyphElt); + BufAlloc (xGlyphElt *, elt, nbytes); + elt->len = MAX_16; + elt->deltax = xDst; + elt->deltay = yDst; + xDst = 0; + yDst = 0; + memcpy ((char *) (elt + 1), (char *) string, MAX_16 * 2); + nchar = nchar - MAX_16; + string += MAX_16; + } + + if (nchar) + { + nbytes = (nchar * 2 + SIZEOF(xGlyphElt) + 3) & ~3; + BufAlloc (xGlyphElt *, elt, nbytes); + elt->len = nchar; + elt->deltax = xDst; + elt->deltay = yDst; + memcpy ((char *) (elt + 1), (char *) string, nchar * 2); + } + UnlockDisplay(dpy); SyncHandle(); } @@ -228,19 +307,24 @@ XRenderCompositeString32 (Display *dpy, int ySrc, int xDst, int yDst, - unsigned long *string, + unsigned int *string, int nchar) { XExtDisplayInfo *info = XRenderFindDisplay (dpy); xRenderCompositeGlyphs8Req *req; long len; xGlyphElt *elt; + int nbytes; + if (!nchar) + return; + RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); - GetReqExtra(RenderCompositeGlyphs32, SIZEOF (xGlyphElt), req); + + GetReq(RenderCompositeGlyphs32, req); req->reqType = info->codes->major_opcode; - req->renderReqType = X_RenderCompositeGlyphs8; + req->renderReqType = X_RenderCompositeGlyphs32; req->op = op; req->src = src; req->dst = dst; @@ -248,14 +332,45 @@ XRenderCompositeString32 (Display *dpy, req->glyphset = glyphset; req->xSrc = xSrc; req->ySrc = ySrc; - elt = (xGlyphElt *) (req + 1); - elt->len = nchar; - elt->deltax = xDst; - elt->deltay = yDst; - len = nchar; - SetReqLen(req, len, len); - nchar <<= 2; - Data32(dpy, string, nchar); + +#define MAX_32 254 + + len = SIZEOF(xGlyphElt) * ((nchar + MAX_8-1) / MAX_8) + nchar * 4; + + req->length += (len + 3)>>2; /* convert to number of 32-bit words */ + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. + */ + + if (dpy->bufptr + len > dpy->bufmax) + _XFlush (dpy); + + while(nchar > MAX_32) + { + nbytes = MAX_32 * 4 + SIZEOF(xGlyphElt); + BufAlloc (xGlyphElt *, elt, nbytes); + elt->len = MAX_32; + elt->deltax = xDst; + elt->deltay = yDst; + xDst = 0; + yDst = 0; + memcpy ((char *) (elt + 1), (char *) string, MAX_32 * 4); + nchar = nchar - MAX_32; + string += MAX_32; + } + + if (nchar) + { + nbytes = nchar * 4 + SIZEOF(xGlyphElt); + BufAlloc (xGlyphElt *, elt, nbytes); + elt->len = nchar; + elt->deltax = xDst; + elt->deltay = yDst; + memcpy ((char *) (elt + 1), (char *) string, nchar * 4); + } + UnlockDisplay(dpy); SyncHandle(); } diff --git a/xc/lib/Xrender/Picture.c b/xc/lib/Xrender/Picture.c index 40befdeaf..55992063d 100644 --- a/xc/lib/Xrender/Picture.c +++ b/xc/lib/Xrender/Picture.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xrender/Picture.c,v 1.3 2000/11/20 07:13:11 keithp Exp $ + * $XFree86: xc/lib/Xrender/Picture.c,v 1.4 2000/12/01 21:32:00 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -25,7 +25,7 @@ #include "Xrenderint.h" -void +static void _XRenderProcessPictureAttributes (Display *dpy, xRenderChangePictureReq *req, unsigned long valuemask, @@ -84,7 +84,7 @@ XRenderCreatePicture (Display *dpy, GetReq(RenderCreatePicture, req); req->reqType = info->codes->major_opcode; req->renderReqType = X_RenderCreatePicture; - req->pid = pid = _XAllocID(dpy); + req->pid = pid = XAllocID(dpy); req->drawable = drawable; req->format = format->id; if ((req->mask = valuemask)) diff --git a/xc/lib/Xrender/Xrender-def.cpp b/xc/lib/Xrender/Xrender-def.cpp new file mode 100644 index 000000000..34740970d --- /dev/null +++ b/xc/lib/Xrender/Xrender-def.cpp @@ -0,0 +1,28 @@ +LIBRARY Xrender +VERSION LIBRARY_VERSION +EXPORTS + XRenderComposite + XRenderFillRectangle + XRenderFillRectangles + XRenderAddGlyphs + XRenderCompositeString16 + XRenderCompositeString32 + XRenderCompositeString8 + XRenderCreateGlyphSet + XRenderFreeGlyphSet + XRenderFreeGlyphs + XRenderReferenceGlyphSet + XRenderChangePicture + XRenderCreatePicture + XRenderFreePicture + _XRenderProcessPictureAttributes + XRenderFindDisplay + XRenderFindFormat + XRenderFindVisualFormat + XRenderQueryExtension + XRenderQueryFormats + XRenderQueryVersion + _XRenderFindFormat + _XRenderFindVisual + +/* $XFree86: xc/lib/Xrender/Xrender-def.cpp,v 1.2 2000/12/04 21:01:00 dawes Exp $ */ diff --git a/xc/lib/Xrender/Xrender.c b/xc/lib/Xrender/Xrender.c index a93d10491..94e63f01d 100644 --- a/xc/lib/Xrender/Xrender.c +++ b/xc/lib/Xrender/Xrender.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xrender/Xrender.c,v 1.2 2000/08/28 02:43:13 tsi Exp $ + * $XFree86: xc/lib/Xrender/Xrender.c,v 1.3 2000/12/01 21:32:00 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -28,7 +28,7 @@ XExtensionInfo XRenderExtensionInfo; char XRenderExtensionName[] = RENDER_NAME; -static int XRenderCloseDisplay(); +static int XRenderCloseDisplay(Display *dpy, XExtCodes *codes); static /* const */ XExtensionHooks render_extension_hooks = { NULL, /* create_gc */ @@ -115,7 +115,7 @@ Status XRenderQueryVersion (Display *dpy, return 1; } -XRenderPictFormat * +static XRenderPictFormat * _XRenderFindFormat (XRenderInfo *xri, PictFormat format) { int nf; @@ -126,7 +126,7 @@ _XRenderFindFormat (XRenderInfo *xri, PictFormat format) return 0; } -Visual * +static Visual * _XRenderFindVisual (Display *dpy, VisualID vid) { XVisualInfo temp, *vi; diff --git a/xc/lib/Xrender/Xrender.h b/xc/lib/Xrender/Xrender.h index 5979af4fd..3f635b545 100644 --- a/xc/lib/Xrender/Xrender.h +++ b/xc/lib/Xrender/Xrender.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xrender/Xrender.h,v 1.4 2000/11/29 08:25:45 keithp Exp $ + * $XFree86: xc/lib/Xrender/Xrender.h,v 1.6 2000/12/03 23:41:44 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -134,7 +134,7 @@ XRenderFindVisualFormat (Display *dpy, Visual *visual); XRenderPictFormat * XRenderFindFormat (Display *dpy, unsigned long mask, - XRenderPictFormat *template, + XRenderPictFormat *templ, int count); Picture @@ -232,7 +232,7 @@ XRenderCompositeString32 (Display *dpy, int ySrc, int xDst, int yDst, - unsigned long *string, + unsigned int *string, int nchar); void diff --git a/xc/lib/font/util/Imakefile b/xc/lib/font/util/Imakefile index 64d9378be..757822589 100644 --- a/xc/lib/font/util/Imakefile +++ b/xc/lib/font/util/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile,v 1.11 94/02/07 16:07:31 gildea Exp $ -XCOMM $XFree86: xc/lib/font/util/Imakefile,v 1.4 1999/04/27 07:08:59 dawes Exp $ +XCOMM $XFree86: xc/lib/font/util/Imakefile,v 1.5 2000/11/30 23:30:00 dawes Exp $ #include <Server.tmpl> INCLUDES = -I$(FONTINCSRC) -I../include @@ -7,7 +7,14 @@ XCOMM $XFree86: xc/lib/font/util/Imakefile,v 1.4 1999/04/27 07:08:59 dawes Exp $ #ifdef FontFormatDefines FORMAT_DEFS = FontFormatDefines #endif - DEFINES = StrcasecmpDefines + +#ifdef SunArchitecture && (OSMajorVersion == 5) && (OSMinorVersion <= 6) + /* Work around a problem with __ctype being a "relocation against + allocatable but non-writable section" on Solaris 2.6. Hopefully + it doesn't break anything. */ + SYS_DEFINES = -D__XPG4_CHAR_CLASS__ +#endif + DEFINES = StrcasecmpDefines $(SYS_DEFINES) SRCS = utilbitmap.c fontnames.c fontutil.c fontxlfd.c format.c \ fontaccel.c atom.c miscutil.c private.c patcache.c diff --git a/xc/nls/Imakefile b/xc/nls/Imakefile index 341e6c96a..2b39765b6 100644 --- a/xc/nls/Imakefile +++ b/xc/nls/Imakefile @@ -3,12 +3,15 @@ XCOMM $XConsortium: Imakefile /main/5 1996/11/13 14:45:33 lehors $ -XCOMM $XFree86: xc/nls/Imakefile,v 1.4 1999/08/22 13:04:24 dawes Exp $ +XCOMM $XFree86: xc/nls/Imakefile,v 1.5 2000/12/02 01:16:04 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags SUBDIRS = XLC_LOCALE Compose - DEFINES = -DR63_COMPAT +#if defined(FreeBSDArchitecture) + RU_SU_DEFINES = -DINCLUDE_ru_SU +#endif + DEFINES = -DR63_COMPAT $(RU_SU_DEFINES) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/xc/nls/XLC_LOCALE/armscii-8 b/xc/nls/XLC_LOCALE/armscii-8 index 0ec1a284d..7fb19f741 100644 --- a/xc/nls/XLC_LOCALE/armscii-8 +++ b/xc/nls/XLC_LOCALE/armscii-8 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/armscii-8,v 1.1 1999/06/06 14:05:58 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/armscii-8,v 1.2 2000/12/01 17:43:02 dawes Exp $ XCOMM XLocale Database Sample for armscii-8. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font ARMSCII-8:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary ARMSCII-8:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name ARMSCII-8 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding ARMSCII-8:GR; ISO8859-1:GR + ct_encoding ARMSCII-8:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/en_US.UTF-8 b/xc/nls/XLC_LOCALE/en_US.UTF-8 index 6779498a4..9919a8d25 100644 --- a/xc/nls/XLC_LOCALE/en_US.UTF-8 +++ b/xc/nls/XLC_LOCALE/en_US.UTF-8 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/en_US.UTF-8,v 1.2 2000/02/29 03:09:07 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/en_US.UTF-8,v 1.3 2000/12/01 17:43:02 dawes Exp $ XCOMM XLocale Database Sample for en_US.UTF-8 XCOMM @@ -14,7 +14,7 @@ object_name generic XCOMM fs0 class fs0 { charset { - name ISO10646-1:none + name ISO10646-1 } font { primary ISO10646-1 @@ -85,58 +85,58 @@ XCOMM XLC_XLOCALE category XCOMM XLC_XLOCALE -encoding_name "UTF-8" +encoding_name UTF-8 mb_cur_max 6 state_depend_encoding False XCOMM cs0 class cs0 { - side none -} - -XCOMM cs1 class -cs1 { side GL:Default length 1 ct_encoding ISO8859-1:GL } -XCOMM cs2 class -cs2 { +XCOMM cs1 class +cs1 { side GR:Default length 1 ct_encoding ISO8859-1:GR } -XCOMM cs3 class -cs3 { +XCOMM cs2 class +cs2 { side GR length 2 ct_encoding JISX0208.1983-0:GL; JISX0208.1983-0:GR;\ JISX0208.1983-1:GL; JISX0208.1983-1:GR } -XCOMM cs4 class -cs4 { +XCOMM cs3 class +cs3 { side GL length 2 ct_encoding KSC5601.1987-0:GL; KSC5601.1987-0:GR;\ KSC5601.1987-1:GL; KSC5601.1987-1:GR } -XCOMM cs5 class -cs5 { +XCOMM cs4 class +cs4 { side GR length 2 ct_encoding GB2312.1980-0:GL; GB2312.1980-0:GR } -XCOMM cs6 class -cs6 { +XCOMM cs5 class +cs5 { side GR length 1 ct_encoding JISX0201.1976-0:GR } +XCOMM cs6 class +cs6 { + side none + ct_encoding ISO10646-1 +} END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/georgian-academy b/xc/nls/XLC_LOCALE/georgian-academy index 418c0700a..37adcb781 100644 --- a/xc/nls/XLC_LOCALE/georgian-academy +++ b/xc/nls/XLC_LOCALE/georgian-academy @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-academy,v 1.1 1999/06/06 14:05:58 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-academy,v 1.2 2000/12/01 17:43:02 dawes Exp $ XCOMM XLocale Database Sample for georgian-academy XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font GEORGIAN-ACADEMY:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary GEORGIAN-ACADEMY:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name GEORGIAN-ACADEMY + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding GEORGIAN-ACADEMY:GR; ISO8859-1:GR + ct_encoding GEORGIAN-ACADEMY:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/georgian-ps b/xc/nls/XLC_LOCALE/georgian-ps index 835b1638c..49f449bf6 100644 --- a/xc/nls/XLC_LOCALE/georgian-ps +++ b/xc/nls/XLC_LOCALE/georgian-ps @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-ps,v 1.1 1999/06/06 14:05:58 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-ps,v 1.2 2000/12/01 17:43:02 dawes Exp $ XCOMM XLocale Database Sample for georgian-ps XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font GEORGIAN-PS:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary GEORGIAN-PS:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name GEORGIAN-PS + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding GEORGIAN-PS:GR; ISO8859-1:GR + ct_encoding GEORGIAN-PS:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/ibm-cp1133 b/xc/nls/XLC_LOCALE/ibm-cp1133 index ecde71205..e08fbb1b8 100644 --- a/xc/nls/XLC_LOCALE/ibm-cp1133 +++ b/xc/nls/XLC_LOCALE/ibm-cp1133 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/ibm-cp1133,v 1.1 1999/06/06 14:05:59 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/ibm-cp1133,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for ibm-cp1133. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font IBM-CP1133:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary IBM-CP1133:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name IBM-CP1133 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding IBM-CP1133:GR; ISO8859-1:GR + ct_encoding IBM-CP1133:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/iscii-dev b/xc/nls/XLC_LOCALE/iscii-dev index 06a69572e..9910e7133 100644 --- a/xc/nls/XLC_LOCALE/iscii-dev +++ b/xc/nls/XLC_LOCALE/iscii-dev @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/iscii-dev,v 1.1 2000/10/27 18:30:53 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iscii-dev,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font ISCII-DEV:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary ISCII-DEV:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name ISCII-DEV + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding ISCII-DEV:GR; ISO8859-1:GR + ct_encoding ISCII-DEV:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/isiri-3342 b/xc/nls/XLC_LOCALE/isiri-3342 index 5d6817afa..d76a03596 100644 --- a/xc/nls/XLC_LOCALE/isiri-3342 +++ b/xc/nls/XLC_LOCALE/isiri-3342 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/isiri-3342,v 1.1 2000/10/27 18:30:55 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/isiri-3342,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font ISIRI-3342:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary ISIRI-3342:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name ISIRI-3342 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding ISIRI-3342:GR; ISO8859-1:GR + ct_encoding ISIRI-3342:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/iso8859-9e b/xc/nls/XLC_LOCALE/iso8859-9e index 3b0e5a8d1..8157a2f32 100644 --- a/xc/nls/XLC_LOCALE/iso8859-9e +++ b/xc/nls/XLC_LOCALE/iso8859-9e @@ -1,7 +1,7 @@ XCOMM $XConsortium: iso8859-9e /main/7 1996/09/28 16:51:50 rws $ XCOMM XLocale Database Sample for iso8859-9e. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-9e,v 1.2 2000/10/28 00:34:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-9e,v 1.3 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -28,6 +28,18 @@ fs1 { } } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name ISO8859-9E + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE XCOMM XCOMM XLC_XLOCALE category diff --git a/xc/nls/XLC_LOCALE/koi8-c b/xc/nls/XLC_LOCALE/koi8-c index ffe2b2ec1..4941705d7 100644 --- a/xc/nls/XLC_LOCALE/koi8-c +++ b/xc/nls/XLC_LOCALE/koi8-c @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-c,v 1.1 2000/10/27 18:30:56 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-c,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for koi8-c. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font KOI8-C:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary KOI8-C:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name KOI8-C + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding KOI8-C:GR; ISO8859-1:GR + ct_encoding KOI8-C:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/koi8-r b/xc/nls/XLC_LOCALE/koi8-r index 0e09f6497..9b78347f3 100644 --- a/xc/nls/XLC_LOCALE/koi8-r +++ b/xc/nls/XLC_LOCALE/koi8-r @@ -2,7 +2,7 @@ XCOMM $TOG: koi8-r /main/2 1997/09/29 13:14:37 kaleb $ XCOMM XLocale Database Sample for koi8-r. XCOMM XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-r,v 3.2 1997/11/16 06:17:47 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-r,v 3.3 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -10,8 +10,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font KOI8-R:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary KOI8-R:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -20,6 +25,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name KOI8-R + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -36,6 +54,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -54,7 +76,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding KOI8-R:GR; ISO8859-1:GR + ct_encoding KOI8-R:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/koi8-u b/xc/nls/XLC_LOCALE/koi8-u index a3cd7e9d3..4fb8d3217 100644 --- a/xc/nls/XLC_LOCALE/koi8-u +++ b/xc/nls/XLC_LOCALE/koi8-u @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-u,v 1.1 1999/05/30 02:28:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-u,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for koi8-u. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font KOI8-U:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary KOI8-U:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name KOI8-U + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding KOI8-U:GR; ISO8859-1:GR + ct_encoding KOI8-U:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/microsoft-cp1251 b/xc/nls/XLC_LOCALE/microsoft-cp1251 index 98a3ffad2..3725553c0 100644 --- a/xc/nls/XLC_LOCALE/microsoft-cp1251 +++ b/xc/nls/XLC_LOCALE/microsoft-cp1251 @@ -1,7 +1,7 @@ XCOMM $TOG: microsoft-cp1251 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for microsoft-cp1251. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1251,v 1.1 2000/10/27 18:30:56 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1251,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -29,6 +29,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name MICROSOFT-CP1251 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM diff --git a/xc/nls/XLC_LOCALE/microsoft-cp1255 b/xc/nls/XLC_LOCALE/microsoft-cp1255 index ad84b5edd..da9103069 100644 --- a/xc/nls/XLC_LOCALE/microsoft-cp1255 +++ b/xc/nls/XLC_LOCALE/microsoft-cp1255 @@ -1,7 +1,7 @@ XCOMM $TOG: microsoft-cp1255 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for microsoft-cp1255. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1255,v 1.1 2000/10/27 18:30:56 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1255,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -29,6 +29,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name MICROSOFT-CP1255 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM diff --git a/xc/nls/XLC_LOCALE/microsoft-cp1256 b/xc/nls/XLC_LOCALE/microsoft-cp1256 index 661af1066..3fb6dc961 100644 --- a/xc/nls/XLC_LOCALE/microsoft-cp1256 +++ b/xc/nls/XLC_LOCALE/microsoft-cp1256 @@ -1,7 +1,7 @@ XCOMM $TOG: microsoft-cp1256 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for microsoft-cp1256. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1256,v 1.1 2000/10/27 18:30:57 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1256,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -29,6 +29,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name MICROSOFT-CP1256 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM diff --git a/xc/nls/XLC_LOCALE/mulelao-1 b/xc/nls/XLC_LOCALE/mulelao-1 index 78c96900a..7b96302c9 100644 --- a/xc/nls/XLC_LOCALE/mulelao-1 +++ b/xc/nls/XLC_LOCALE/mulelao-1 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/mulelao-1,v 1.1 1999/06/06 14:05:59 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/mulelao-1,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font MULELAO-1:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary MULELAO-1:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name MULELAO-1 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding MULELAO-1:GR; ISO8859-1:GR + ct_encoding MULELAO-1:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/nokhchi-1 b/xc/nls/XLC_LOCALE/nokhchi-1 index 8ff4933ed..8750b3bab 100644 --- a/xc/nls/XLC_LOCALE/nokhchi-1 +++ b/xc/nls/XLC_LOCALE/nokhchi-1 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/nokhchi-1,v 1.1 2000/10/27 18:30:57 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/nokhchi-1,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font NOKHCHI-1:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary NOKHCHI-1:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name NOKHCHI-1 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding NOKHCHI-1:GR; ISO8859-1:GR + ct_encoding NOKHCHI-1:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/tatar-cyr b/xc/nls/XLC_LOCALE/tatar-cyr index b1960dee0..17f9893f2 100644 --- a/xc/nls/XLC_LOCALE/tatar-cyr +++ b/xc/nls/XLC_LOCALE/tatar-cyr @@ -1,7 +1,7 @@ XCOMM $TOG: tatar-cyr /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for tatar-cyr. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/tatar-cyr,v 1.1 2000/10/27 18:30:57 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/tatar-cyr,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -29,6 +29,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name TATAR-CYR + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM diff --git a/xc/nls/XLC_LOCALE/tscii-0 b/xc/nls/XLC_LOCALE/tscii-0 index 05197e899..19b610c3b 100644 --- a/xc/nls/XLC_LOCALE/tscii-0 +++ b/xc/nls/XLC_LOCALE/tscii-0 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/tscii-0,v 1.1 2000/10/27 18:30:57 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/tscii-0,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font TSCII-0:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary TSCII-0:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name TSCII-0 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding TSCII-0:GR; ISO8859-1:GR + ct_encoding TSCII-0:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/vi_VN.tcvn b/xc/nls/XLC_LOCALE/vi_VN.tcvn index af3d0ea8a..76b10547d 100644 --- a/xc/nls/XLC_LOCALE/vi_VN.tcvn +++ b/xc/nls/XLC_LOCALE/vi_VN.tcvn @@ -1,6 +1,6 @@ XCOMM XLocale Database Sample for vi_VN.TCVN XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.tcvn,v 1.1 1999/06/06 14:06:02 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.tcvn,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font TCVN-5712:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary TCVN-5712:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name TCVN-5712 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding TCVN-5712:GR; ISO8859-1:GR + ct_encoding TCVN-5712:GR } END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/vi_VN.viscii b/xc/nls/XLC_LOCALE/vi_VN.viscii index 061b16bcd..9018602b0 100644 --- a/xc/nls/XLC_LOCALE/vi_VN.viscii +++ b/xc/nls/XLC_LOCALE/vi_VN.viscii @@ -1,6 +1,6 @@ XCOMM XLocale Database Sample for vi_VN.VISCII XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.viscii,v 1.1 1999/06/06 14:06:02 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.viscii,v 1.2 2000/12/01 17:43:03 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -8,8 +8,13 @@ XCOMM XLC_FONTSET XCOMM fs0 class (7 bit ASCII) fs0 { - charset ISO8859-1:GL - font VISCII1.1-1:GL; ISO8859-1:GL + charset { + name ISO8859-1:GL + } + font { + primary VISCII1.1-1:GL + substitute ISO8859-1:GL + } } XCOMM fs1 class fs1 { @@ -18,6 +23,19 @@ fs1 { } END XLC_FONTSET +XCOMM +XCOMM XLC_CHARSET_DEFINE category +XCOMM +XLC_CHARSET_DEFINE +csd0 { + charset_name VISCII1.1-1 + side GR + length 1 + string_encoding False + sequence \x1b%/1 +} +END XLC_CHARSET_DEFINE + XCOMM XCOMM XLC_XLOCALE category XCOMM @@ -34,6 +52,10 @@ wc_encoding_mask \x00008080 wc_shift_bits 8 #endif +#ifndef X_LOCALE +use_stdc_env True +#endif + XCOMM cs0 class cs0 { side GL:Default @@ -52,7 +74,7 @@ cs1 { #else wc_encoding \x00008080 #endif - ct_encoding VISCII1.1-1:GR; ISO8859-1:GR + ct_encoding VISCII1.1-1:GR } END XLC_XLOCALE diff --git a/xc/nls/locale.alias b/xc/nls/locale.alias index 9e43d8050..ee70a4a14 100644 --- a/xc/nls/locale.alias +++ b/xc/nls/locale.alias @@ -5,7 +5,7 @@ XCOMM Each alias name is described within one line. XCOMM The first word is the alias name (simplified locale name) XCOMM the second word is full locale name. XCOMM -XCOMM $XFree86: xc/nls/locale.alias,v 1.32 2000/11/28 23:43:41 dawes Exp $ +XCOMM $XFree86: xc/nls/locale.alias,v 1.33 2000/12/02 01:16:04 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -442,6 +442,7 @@ wa_BE.iso885915 wa_BE.ISO8859-15 zh zh_CN.eucCN zh_CN zh_CN.eucCN zh_CN.big5 zh_TW.big5 +zh_CN.Big5 zh_TW.big5 zh_CN.EUC zh_CN.eucCN zh_CN.euc zh_CN.eucCN zh_CN.gb2312 zh_CN.eucCN @@ -1031,6 +1032,7 @@ yi_US.MICROSOFT-CP1255: yi_US.CP1255 zh: zh_CN.eucCN zh_CN: zh_CN.eucCN zh_CN.big5: zh_TW.big5 +zh_CN.Big5: zh_TW.big5 zh_CN.EUC: zh_CN.eucCN zh_CN.euc: zh_CN.eucCN zh_CN.gb2312: zh_CN.eucCN diff --git a/xc/nls/locale.dir b/xc/nls/locale.dir index 87be9bbd3..5624c9bb7 100644 --- a/xc/nls/locale.dir +++ b/xc/nls/locale.dir @@ -4,7 +4,7 @@ XCOMM This file contains locale database file name XCOMM The first word is the locale database file name and XCOMM the second word is full locale name. XCOMM -XCOMM $XFree86: xc/nls/locale.dir,v 1.17 2000/11/27 17:45:54 dawes Exp $ +XCOMM $XFree86: xc/nls/locale.dir,v 1.18 2000/12/01 17:43:02 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -122,7 +122,6 @@ iso8859-1/XLC_LOCALE is_IS.ISO8859-1 iso8859-15/XLC_LOCALE is_IS.ISO8859-15 iso8859-1/XLC_LOCALE it_CH.ISO8859-1 iso8859-1/XLC_LOCALE it_IT.ISO8859-1 -nunacom-8/XLC_LOCALE iu_CA.NUNACOM-8 ja/XLC_LOCALE ja_JP.eucJP ja.SJIS/XLC_LOCALE ja_JP.SJIS ja.JIS/XLC_LOCALE ja_JP.JIS7 @@ -200,7 +199,7 @@ zh/XLC_LOCALE zh_CN.eucCN zh/XLC_LOCALE zh_CN.GB2312 zh_TW.big5/XLC_LOCALE zh_TW.big5 zh_TW.big5/XLC_LOCALE zh_TW.Big5 -zh_TW.cns11643/XLC_LOCALE zh_TW.eucTW +zh_TW/XLC_LOCALE zh_TW.eucTW XCOMM Note: The UTF-8 locales don't work correctly yet. Work in progress. en_US.UTF-8/XLC_LOCALE af_ZA.UTF-8 en_US.UTF-8/XLC_LOCALE ar_AA.UTF-8 @@ -457,7 +456,6 @@ iso8859-1/XLC_LOCALE: is_IS.ISO8859-1 iso8859-15/XLC_LOCALE: is_IS.ISO8859-15 iso8859-1/XLC_LOCALE: it_CH.ISO8859-1 iso8859-1/XLC_LOCALE: it_IT.ISO8859-1 -nunacom-8/XLC_LOCALE: iu_CA.NUNACOM-8 ja/XLC_LOCALE: ja_JP.eucJP ja.SJIS/XLC_LOCALE: ja_JP.SJIS ja.JIS/XLC_LOCALE: ja_JP.JIS7 @@ -534,7 +532,7 @@ zh/XLC_LOCALE: zh_CN.eucCN zh/XLC_LOCALE: zh_CN.GB2312 zh_TW.big5/XLC_LOCALE: zh_TW.big5 zh_TW.big5/XLC_LOCALE: zh_TW.Big5 -zh_TW.cns11643/XLC_LOCALE: zh_TW.eucTW +zh_TW/XLC_LOCALE: zh_TW.eucTW XCOMM Note: The UTF-8 locales don't work correctly yet. Work in progress. en_US.UTF-8/XLC_LOCALE: af_ZA.UTF-8 en_US.UTF-8/XLC_LOCALE: ar_AA.UTF-8 diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 4f5e56dbb..d115da4b2 100644 --- a/xc/programs/Xserver/Imakefile +++ b/xc/programs/Xserver/Imakefile @@ -2,7 +2,7 @@ XCOMM $TOG: Imakefile /main/249 1997/12/11 11:18:14 kaleb $ /* * Server Master Makefile */ -XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.203 2000/11/18 19:37:05 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.204 2000/11/30 23:30:01 dawes Exp $ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -263,12 +263,14 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) #ifdef ServerExtraSysLibs EXTRASYSLIBS = ServerExtraSysLibs #endif -#if SystemV4 || defined(SGIArchitecture) || UseRgbTxt - SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(USB) $(EXTRASYSLIBS) -#else - SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries DBMLibrary $(USB) \ - $(EXTRASYSLIBS) +#if HasPam && HasPamMisc + PAMLIBS = PamLibraries PamMiscLibraries +#endif +#if !(SystemV4 || defined(SGIArchitecture) || UseRgbTxt) + DBMLIBS = DBMLibrary #endif + SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(DBMLIBS) $(USB) \ + $(PAMLIBS) $(EXTRASYSLIBS) CBRT = mi/LibraryTargetName(cbrt) STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS) diff --git a/xc/programs/Xserver/cfb/Imakefile b/xc/programs/Xserver/cfb/Imakefile index 2a3582efe..b068e9e5e 100644 --- a/xc/programs/Xserver/cfb/Imakefile +++ b/xc/programs/Xserver/cfb/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/71 1997/11/17 10:00:11 msr $ -XCOMM $XFree86: xc/programs/Xserver/cfb/Imakefile,v 3.24 1999/09/27 06:29:16 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/cfb/Imakefile,v 3.25 2000/12/01 00:24:31 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -234,10 +234,10 @@ clean:: $(RM) stipsparcte.s stipsparc.o: stipsparc.s - $(CPP) stipsparc.s | $(AS) -o $@ - + $(CPP) stipsparc.s AsmDefines | $(AS) -o $@ - stipsparcte.o: stipsparcte.s - $(CPP) -DTETEXT stipsparcte.s | $(AS) -o $@ - + $(CPP) -DTETEXT stipsparcte.s AsmDefines | $(AS) -o $@ - #endif #endif @@ -250,10 +250,10 @@ clean:: $(RM) stipsprcte32.s stipsprc32.o: stipsprc32.s - $(CPP) stipsprc32.s | $(AS) -o $@ - + $(CPP) stipsprc32.s AsmDefines | $(AS) -o $@ - stipsprcte32.o: stipsprcte32.s - $(CPP) -DTETEXT stipsprcte32.s | $(AS) -o $@ - + $(CPP) -DTETEXT stipsprcte32.s AsmDefines | $(AS) -o $@ - #endif #endif diff --git a/xc/programs/Xserver/dix/main.c b/xc/programs/Xserver/dix/main.c index 304162c98..daebf6bdd 100644 --- a/xc/programs/Xserver/dix/main.c +++ b/xc/programs/Xserver/dix/main.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.30 2000/11/27 00:10:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.31 2000/11/30 23:30:02 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -268,6 +268,8 @@ main(argc, argv, envp) CheckUserParameters(argc, argv, envp); + CheckUserAuthorization(); + #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS ExpandCommandLine(&argc, &argv); #endif diff --git a/xc/programs/Xserver/hw/darwin/Imakefile b/xc/programs/Xserver/hw/darwin/Imakefile index 2a1f2430a..9039d531b 100644 --- a/xc/programs/Xserver/hw/darwin/Imakefile +++ b/xc/programs/Xserver/hw/darwin/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/Imakefile,v 1.2 2000/11/16 03:22:18 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/Imakefile,v 1.3 2000/12/01 19:47:37 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -17,6 +17,13 @@ INCLUDES = -I. -I$(SERVERSRC)/mi -I$(SERVERSRC)/mfb -I$(SERVERSRC)/cfb \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(SERVERSRC)/os \ -I$(INCLUDESRC) -I$(FONTINCSRC) +#if defined(XFree86CustomVersion) +CUSTOMVERSION = XFree86CustomVersion +CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)' +#endif + +DEFINES = $(CUSTOMVERDEF) + NormalLibraryObjectRule() NormalLibraryTarget(darwin,$(OBJS)) diff --git a/xc/programs/Xserver/hw/darwin/Xdarwin.man b/xc/programs/Xserver/hw/darwin/Xdarwin.man index aee06c433..b1062791c 100644 --- a/xc/programs/Xserver/hw/darwin/Xdarwin.man +++ b/xc/programs/Xserver/hw/darwin/Xdarwin.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/darwin/Xdarwin.man,v 1.1 2000/11/15 01:36:13 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/darwin/Xdarwin.man,v 1.2 2000/12/01 19:47:38 dawes Exp $ .\" .TH XDARWIN 1 "Release 6.4" "X Version 11" .SH NAME @@ -36,6 +36,12 @@ per pixel are supported. .TP 8 .B "\-refresh \fIrate\fP" Gives the refresh rate to use in Hz. For LCD displays this should be 0. +.TP 8 +.B \-showconfig +Print out the server version and patchlevel. +.TP 8 +.B \-version +Same as \fB\-showconfig\fP. .SH "SEE ALSO" .PP X(1), Xserver(1), xdm(1), xinit(1) diff --git a/xc/programs/Xserver/hw/darwin/darwin.c b/xc/programs/Xserver/hw/darwin/darwin.c index a28d07d70..a62405f72 100644 --- a/xc/programs/Xserver/hw/darwin/darwin.c +++ b/xc/programs/Xserver/hw/darwin/darwin.c @@ -8,7 +8,7 @@ * Significantly rewritten for XFree86 4.0.1 by Torrey Lyons * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.1 2000/11/15 01:36:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.2 2000/12/01 19:47:38 dawes Exp $ */ #define NDEBUG 1 @@ -22,6 +22,8 @@ #include "mibstore.h" #include "mipointer.h" #include "micmap.h" +#include "site.h" +#include "xf86Version.h" #include <sys/types.h> #include <sys/time.h> @@ -70,6 +72,44 @@ static PixmapFormatRec formats[] = { }; const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]); +#ifndef OSNAME +#define OSNAME " Darwin" +#endif +#ifndef OSVENDOR +#define OSVENDOR "" +#endif +#ifndef PRE_RELEASE +#define PRE_RELEASE (XF86_VERSION_BETA || XF86_VERSION_ALPHA) +#endif + +static void +DarwinPrintBanner() +{ +#if PRE_RELEASE + ErrorF("\n" + "This is a pre-release version of XFree86, and is not supported in any\n" + "way. Bugs may be reported to XFree86@XFree86.Org and patches submitted\n" + "to fixes@XFree86.Org. Before reporting bugs in pre-release versions,\n" + "please check the latest version in the XFree86 CVS repository\n" + "(http://www.XFree86.Org/cvs)\n"); +#endif + ErrorF("\nXFree86 Version%s", XF86_VERSION); +#ifdef XF86_CUSTOM_VERSION + ErrorF("(%s) ", XF86_CUSTOM_VERSION); +#endif + ErrorF("/ X Window System\n"); + ErrorF("(protocol Version %d, revision %d, vendor release %d)\n", + X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE ); + ErrorF("Release Date: %s\n", XF86_DATE); + ErrorF("\tIf the server is older than 6-12 months, or if your hardware is\n" + "\tnewer than the above date, look for a newer version before\n" + "\treporting problems. (See http://www.XFree86.Org/FAQ)\n"); + ErrorF("Operating System:%s%s\n", OSNAME, OSVENDOR); +#if defined(BUILDERSTRING) + ErrorF("%s \n",BUILDERSTRING); +#endif +} + static Bool DarwinSaveScreen(ScreenPtr pScreen, int on) { // FIXME if (on == SCREEN_SAVER_FORCER) { @@ -623,8 +663,8 @@ static void *DarwinHIDThread(void *arg); * Register the keyboard and mouse devices */ void InitInput( int argc, char **argv ) -{ static int initialized = 0; - if (!initialized) { +{ + if (serverGeneration == 1) { int fd[2]; assert( pipe(fd) == 0 ); @@ -645,14 +685,6 @@ mach_port_t masterPort; mach_port_t notificationPort; IONotificationPortRef NotificationPortRef; -static void InitIOKit(void) -{ - kern_return_t kr; - - kr = IOMasterPort(bootstrap_port, &masterPort); - kern_assert( kr ); -} - static void ClearEvent(NXEvent * ep) { static NXEvent nullEvent = {NX_NULLEVENT, {0, 0 }, 0, -1, 0 }; @@ -891,44 +923,44 @@ void SetupFBandHID(void) /* - * InitOutput -- + * InitOutput * Initialize screenInfo for all actually accessible framebuffers. - * - * FIXME: why does this get called multiple times when a session is starting? */ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv ) -{ int i; - static int initialized = 0; -// static PixmapFormatRec darwinFormat; - - // perform one-time-only initialization - if ( !initialized ) { - initialized = 1; - // do our appkit or darwin device driver work to open and map a screen - InitIOKit(); - SetupFBandHID(); - } - - pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; +{ + int i; - // list how we want common pixmap formats to be padded - pScreenInfo->numPixmapFormats = NUMFORMATS; - for (i = 0; i < NUMFORMATS; i++) - pScreenInfo->formats[i] = formats[i]; + pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + // list how we want common pixmap formats to be padded + pScreenInfo->numPixmapFormats = NUMFORMATS; + for (i = 0; i < NUMFORMATS; i++) + pScreenInfo->formats[i] = formats[i]; - AddScreen( DarwinAddScreen, argc, argv ); + AddScreen( DarwinAddScreen, argc, argv ); } void OsVendorFatalError( void ) -{ ErrorF( " OsVendorFatalError\n" ); +{ ErrorF( " OsVendorFatalError\n" ); } +/* + * OSVendorInit + * One-time initialization of Darwin support. + * Connect to framebuffer and HID system. + */ void OsVendorInit(void) { + kern_return_t kr; + + kr = IOMasterPort(bootstrap_port, &masterPort); + kern_assert( kr ); + + DarwinPrintBanner(); + SetupFBandHID(); } /* @@ -999,7 +1031,7 @@ int ddxProcessArgument( int argc, char *argv[], int i ) return 2; } - if ( !strcmp( argv[i], "-refresh" ) ) { + if ( !strcmp( argv[i], "-refresh" ) ) { if ( i == argc-1 ) { FatalError( "-refresh must be followed by a number" ); } @@ -1012,7 +1044,12 @@ int ddxProcessArgument( int argc, char *argv[], int i ) return 2; } - return 0; + if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) { + DarwinPrintBanner(); + exit(0); + } + + return 0; } /* @@ -1034,6 +1071,7 @@ void ddxUseMsg( void ) ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n"); ErrorF("-depth <8,15,24> : use this bit depth.\n"); ErrorF("-refresh <rate> : use a monitor refresh rate of <rate> Hz.\n"); + ErrorF("-version : show the server version\n"); ErrorF("\n"); } diff --git a/xc/programs/Xserver/hw/darwin/utils/Imakefile b/xc/programs/Xserver/hw/darwin/utils/Imakefile index 7947a14ce..72acc9e80 100644 --- a/xc/programs/Xserver/hw/darwin/utils/Imakefile +++ b/xc/programs/Xserver/hw/darwin/utils/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/utils/Imakefile,v 1.2 2000/11/16 03:22:18 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/utils/Imakefile,v 1.3 2000/12/01 19:47:38 dawes Exp $ SRCS = dumpkeymap.c OBJS = dumpkeymap.o @@ -6,6 +6,5 @@ EXTRA_LOAD_FLAGS = -framework IOKit AllTarget(ProgramTargetName(dumpkeymap)) -SingleProgramTarget(dumpkeymap,$(OBJS),NullParameter,NullParameter) -InstallProgram(dumpkeymap,$(BINDIR)) +SimpleProgramTarget(dumpkeymap) diff --git a/xc/programs/Xserver/hw/darwin/utils/README.txt b/xc/programs/Xserver/hw/darwin/utils/README.txt new file mode 100644 index 000000000..6baff652d --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/utils/README.txt @@ -0,0 +1,108 @@ +dumpkeymap - Diagnostic dump and detailed description of .keymapping files +Version 3 + +Copyright (C)1999,2000 by Eric Sunshine <sunshine@sunshineco.com> +Eric Sunshine, November 28, 2000 + +OVERVIEW + +This package contains the diagnostic utility dumpkeymap, as well as highly +detailed documentation describing the internal layout of the Apple/NeXT +.keymapping file. + +The dumpkeymap utility displays detailed information about each .keymapping +file mentioned on the command-line. On Apple and NeXT platforms, if no +.keymapping files are mentioned on the command-line, then it will instead +dissect the key mapping currently in use by the WindowServer and AppKit. + +Documentation includes a thorough and detailed description of the internal +layout of the .keymapping file, as well as an explanation of how to interpret +the output of dumpkeymap. + +The complete set of documentation is available for perusal via dumpkeymap's +manual page (dumpkeymap.1), as well as via the command-line options described +below. + + --help + Usage summary. + --help-keymapping + Detailed discussion of the internal format of a .keymapping file. + --help-output + Explanation of dumpkeymap's output. + --help-files + List of key mapping-related files and directories. + --help-diagnostics + Explanation of diagnostic messages. + +Once the manual page is been installed, documentation can also be accessed +with the Unix `man' command: + + % man dumpkeymap + +COMPILATION + +MacOS/X, Darwin + + cc -Wall -o dumpkeymap dumpkeymap.c -framework IOKit + +MacOS/X DP4 (Developer Preview 4) + + cc -Wall -o dumpkeymap dumpkeymap.c -FKernel -framework IOKit + +MacOS/X Server, OpenStep, NextStep + + cc -Wall -o dumpkeymap dumpkeymap.c + +By default, dumpkeymap is configured to interface with the HID driver (Apple) +or event-status driver (NeXT), thus allowing it to dump the key mapping which +is currently in use by the WindowServer and AppKit. However, these facilities +are specific to Apple/NeXT. In order to build dumpkeymap for non-Apple/NeXT +platforms, you must define the DUMPKEYMAP_FILE_ONLY flag when compiling the +program. This flag inhibits use of the HID and event-status drivers and +configures dumpkeymap to work strictly with raw key mapping files. + +For example, to compile for Linux: + + gcc -Wall -DDUMPKEYMAP_FILE_ONLY -o dumpkeymap dumpkeymap.c + +INSTALLATION + +Install the dumpkeymap executable image in a location mentioned in the PATH +environment variable. Typicall locations for executable files are: + + /usr/local/bin + $(HOME)/bin + +Install the manual page, dumpkeymap.1, in the `man1' subdirectory one of the +standard manual page locations or in any other location mentioned by the +MANPATH environment variable. + +Typical locations for manual pages on most Unix platforms are: + + /usr/local/man/man1 + +Typical locations for manual pages on MacOS/X, Darwin, and MacOS/X Server are: + + /usr/local/man/man1 + /Local/Documentation/ManPages/man1 + /Network/Documentation/ManPages/man1 + +Typical locations for manual pages on OpenStep and NextStep are: + + /usr/local/man/man1 + /LocalLibrary/Documentation/ManPages/man1 + /LocalDeveloper/Documentation/ManPages/man1 + +CONCLUSION + +This program and its accompanying documentation were written by Eric Sunshine +and are copyright (C)1999,2000 by Eric Sunshine <sunshine@sunshineco.com>. + +The implementation of dumpkeymap is based upon information gathered on +September 3, 1997 by Eric Sunshine <sunshine@sunshineco.com> and Paul S. +McCarthy <zarnuk@zarnuk.com> during an effort to reverse engineer the format +of the NeXT .keymapping file. + + + +$XFree86: xc/programs/Xserver/hw/darwin/utils/README.txt,v 1.1 2000/12/01 19:47:39 dawes Exp $ diff --git a/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.c b/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.c index a3b96ea45..22fcf6179 100644 --- a/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.c +++ b/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.c @@ -1,5 +1,4 @@ -// $XFree86: xc/programs/Xserver/hw/darwin/utils/dumpkeymap.c,v 1.1 2000/11/15 01:36:14 dawes Exp $ -// +// $XFree86: xc/programs/Xserver/hw/darwin/utils/dumpkeymap.c,v 1.2 2000/12/04 20:21:18 dawes Exp $ //============================================================================= // // Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com> @@ -31,271 +30,88 @@ //----------------------------------------------------------------------------- // dumpkeymap.c // -// Prints a textual representation of an Apple/NeXT .keymapping file, or -// the currently active key map in use by the WindowServer and the AppKit -// on the local machine. -// -// KEY MAPPING DESCRIPTION -// -// Types and Data -// -------------- -// The following type definitions are employed throughout this -// discussion: -// -// typedef unsigned char byte; -// typedef unsigned short word; -// typedef unsigned long dword; -// -// Additionally, the type definition `number' is used generically to -// indicate a numeric value. The actual size of the `number' type may be -// one or two bytes depending upon how the data is stored in the key map. -// Although most key maps use byte-sized numeric values, word-sized -// values are also allowed. -// -// Multi-byte values in a key mapping file are stored in big-endian byte -// order. -// -// Key Mapping File and Device Mapping -// ----------------------------------- -// A key mapping file begins with a magic-number and continues with a -// variable number of device-specific key mappings. -// -// struct KeyMappingFile { -// char magic_number[4]; // "KYM1" -// DeviceMapping maps[...] // Variable number of maps -// }; -// -// struct DeviceMapping { -// dword interface; // NX_EVS_DEVICE_INTERFACE_ACE, etc. -// dword handler_id; // Interface subtype (0=101, 1=102 key, etc.) -// dword map_size; // Byte count following this address -// KeyMapping map; -// }; -// -// Together, `interface' and `handler_id' identify the exact keyboard -// hardware to which this mapping applies. The `interface' value -// represents a family of keyboard device types (such as Intel, ADB, -// NeXT, Sun Type5, etc.) and `handler_id' represents a specific keyboard -// layout within that family. On MacOS/X and Darwin, `interface' -// constants can be found in IOHIDTypes.h, whereas on MacOS/X Server, -// OpenStep, and NextStep, they can be found in ev_types.h. Programs -// which display a visual representation of a keyboard layout, match -// `interface' and `handler_id' from the .keymapping file against the -// `interface' and `handler_id' values found in each .keyboard file. -// -// Key Mapping -// ----------- -// A key mapping completely defines the relationship of all scan codes -// with their associated functionality. A KeyMapping structure is -// embedded within the DeviceMapping structure in a KeyMappingFile. The -// currently active key mapping in use by the WindowServer and AppKit is -// also represented by a KeyMapping structure, and can be referred to -// directly by calling NXGetKeyMapping() and accessing the `mapping' data -// member of the returned NXKeyMapping structure. -// -// struct KeyMapping { -// word number_size; // 0=1 byte, non-zero=2 bytes -// number num_modifier_groups; // Modifier groups -// ModifierGroup modifier_groups[...]; -// number num_scan_codes; // Scan groups -// ScanGroup scan_table[...]; -// number num_sequence_lists; // Sequence lists -// Sequence sequence_lists[...]; -// number num_special_keys; // Special keys -// SpecialKey special_key[...]; -// }; -// -// The `number_size' flag determines the size, in bytes, of all remaining -// numeric values (denoted by the type definition `number') within the -// key mapping. If its value is zero, then numbers are represented by a -// single byte. If it is non-zero, then numbers are represented by a -// word (two bytes). -// -// Modifier Group -// -------------- -// A modifier group defines all scan codes which map to a particular type -// of modifier, such as "shift", "control", etc. -// -// enum Modifier { -// ALPHALOCK = 0, -// SHIFT, -// CONTROL, -// ALTERNATE, -// COMMAND, -// KEYPAD, -// HELP -// }; -// -// struct ModifierGroup { -// number modifier; // A Modifier constant -// number num_scan_codes; -// number scan_codes[...]; // Variable number of scan codes -// }; -// -// The scan_codes[] array contains a list of all scan codes which map to -// the specified modifier. The "shift", "command", and "alternate" -// modifiers are frequently mapped to two different scan codes, apiece, -// since these modifiers often appear on both the left and right sides of -// the keyboard. -// -// Scan Group -// ---------- -// There is one ScanGroup for each scan code generated by the given -// keyboard. This number is given by KeyMapping::num_scan_codes. The -// first scan group represents hardware scan code 0, the second -// represents scan code 1, etc. -// -// enum ModifierMask { -// ALPHALOCK_MASK = 1 << 0, -// SHIFT_MASK = 1 << 1, -// CONTROL_MASK = 1 << 2, -// ALTERNATE_MASK = 1 << 3, -// CARRIAGE_RETURN_MASK = 1 << 4 -// }; -// #define NOT_BOUND 0xff -// -// struct ScanGroup { -// number mask; -// Character characters[...]; -// }; -// -// For each scan code, `mask' defines which modifier combinations -// generate characters. If `mask' is NOT_BOUND (0xff) then then this -// scan code does not generate any characters ever, and its characters[] -// array is zero length. Otherwise, the characters[] array contains one -// Character record for each modifier combination. -// -// The number of records in characters[] is determined by computing -// (1 << bits_set_in_mask). In other words, if mask is zero, then zero -// bits are set, so characters[] contains only one record. If `mask' is -// (SHIFT_MASK | CONTROL_MASK), then two bits are set, so characters[] -// contains four records. -// -// The first record always represents the character which is generated by -// that key when no modifiers are active. The remaining records -// represent characters generated by the various modifier combinations. -// Using the example with the "shift" and "control" masks set, record two -// would represent the character with the shift modifier active; record -// three, the control modifier active; and record four, both the shift -// and control modifiers active. -// -// As a special case, ALPHALOCK_MASK implies SHIFT_MASK, though only -// ALPHALOCK_MASK appears in `mask'. In this case the same character is -// generated for both the shift and alpha-lock modifiers, but only needs -// to appear once in the characters[] array. -// -// Character -// --------- -// Each Character record indicates the character generated when this key -// is pressed, as well as the character set which contains the character. -// Well known character Sets are "ASCII" and "Symbol". The character set -// can also be one of the meta values FUNCTION_KEY or KEY_SEQUENCE. If -// it is FUNCTION_KEY then `char_code' represents a generally well-known -// function key such as those enumerated by FunctionKey. If the -// character set is KEY_SEQUENCE then `char_code' represents is a -// zero-base index into KeyMapping::sequence_lists[]. +// Prints a textual representation of each Apple/NeXT .keymapping file +// mentioned on the command-line. If no files are mentioned and if the +// local machine is an Apple or NeXT installation, then the key mapping +// currently in use by the WindowServer and the AppKit is printed +// instead. // -// enum CharacterSet { -// ASCII = 0x00, -// SYMBOL = 0x01, -// ... -// FUNCTION_KEY = 0xfe, -// KEY_SEQUENCE = 0xff -// }; +// Invoke dumpkeymap with one of the options listed below in order to +// view detailed documentation about .keymapping files and the use of +// this program. // -// struct Character { -// number set; // CharacterSet of generated character -// number char_code; // Actual character generated -// }; -// -// enum FunctionKey { -// F1 = 0x20, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, -// INSERT, DELETE, HOME, END, PAGE_UP, PAGE_DOWN, PRINT_SCREEN, -// SCROLL_LOCK, PAUSE, SYS_REQUEST, BREAK, RESET, STOP, MENU, USER, -// SYSTEM, PRINT, CLEAR_LINE, CLEAR_DISPLAY, INSERT_LINE, -// DELETE_LINE, INSERT_CHAR, DELETE_CHAR, PREV, NEXT, SELECT -// }; -// -// Sequence -// -------- -// When Character::set contains the meta value KEY_SEQUENCE, the scan -// code is bound to a sequence of keys rather than a single character. A -// sequence is a series of modifiers and characters which are -// automatically generated when the associated key is depressed. Each -// generated Character is represented as previously described, with the -// exception that MODIFIER_KEY may appear in place of KEY_SEQUENCE. When -// the value of Character::set is MODIFIER_KEY then Character::char_code -// represents a modifier key rather than an actual character. If the -// modifier represented by `char_code' is non-zero, then it indicates -// that the associated modifier key has been depressed. In this case, -// the value is one of the constants enumerated by Modifier (SHIFT, -// CONTROL, ALTERNATE, etc.). If the value is zero then it means that -// the modifier keys have been released. -// -// #define MODIFIER_KEY 0xff -// -// struct Sequence { -// number num_chars; -// Character characters[...]; -// }; -// -// Special Key -// ----------- -// A special key is one which is scanned directly by the Mach kernel -// rather than by the WindowServer. In general, events are not generated -// for special keys. -// -// enum SpecialKeyType { -// VOLUME_UP = 0, -// VOLUME_DOWN, -// BRIGHTNESS_UP, -// BRIGHTNESS_DOWN, -// ALPHA_LOCK, -// HELP, -// POWER, -// SECONDARY_ARROW_UP, -// SECONDARY_ARROW_DOWN -// }; -// -// struct SpecialKey { -// number type; // A SpecialKeyType constant -// number scan_code; // Actual scan code -// }; +// --help: Usage summary. +// --help-keymapping: Detailed discussion of the internal format of a +// .keymapping file. +// --help-output: Explanation of dumpkeymap's output. +// --help-files: List of key mapping-related files and directories. +// --help-diagnostics: Explanation of diagnostic messages. // // COMPILATION INSTRUCTIONS // // MacOS/X, Darwin // cc -Wall -o dumpkeymap dumpkeymap.c -framework IOKit // +// MacOS/X DP4 (Developer Preview 4) +// cc -Wall -o dumpkeymap dumpkeymap.c -FKernel -framework IOKit +// // MacOS/X Server, OpenStep, NextStep // cc -Wall -o dumpkeymap dumpkeymap.c // -// USAGE INSTRUCTIONS -// -// Usage: dumpkeymap [path-to-keymap ...] +// By default, dumpkeymap is configured to interface with the HID driver +// (Apple) or event-status driver (NeXT), thus allowing it to dump the +// key mapping which is currently in use by the WindowServer and AppKit. +// However, these facilities are specific to Apple/NeXT. In order to +// build dumpkeymap for non-Apple/NeXT platforms, you must define the +// DUMPKEYMAP_FILE_ONLY flag when compiling the program. This flag +// inhibits use of the HID and event-status drivers and configures +// dumpkeymap to work strictly with raw key mapping files. // -// When provided with no arguments, this program dumps the currently -// active key map. Otherwise, it prints out the contents of each -// .keymapping files mentioned as an argument on the command line. +// For example, to compile for Linux: +// gcc -Wall -DDUMPKEYMAP_FILE_ONLY -o dumpkeymap dumpkeymap.c // // CONCLUSION // // This program and its accompanying documentation were written by Eric // Sunshine and are copyright (C)1999,2000 by Eric Sunshine -// <sunshine@sunshineco.com>. It is based on information gathered on -// September 3, 1997 by Eric Sunshine and Paul S. McCarthy -// <zarnuk@zarnuk.com> while reverse engineering the NeXT .keymapping -// file format. +// <sunshine@sunshineco.com>. +// +// The implementation of dumpkeymap is based upon information gathered +// on September 3, 1997 by Eric Sunshine <sunshine@sunshineco.com> and +// Paul S. McCarthy <zarnuk@zarnuk.com> during an effort to reverse +// engineer the format of the NeXT .keymapping file. // // HISTORY // +// 2000/11/28 Eric Sunshine <sunshine@sunshineco.com> +// Considerably expanded the documentation. +// Augmented the existing description of .keymapping internals. +// Added these new documentation topics: +// - Output: Very important section describing how to interpret +// the output of dumpkeymap. +// - Files: Lists files and directories related to key mappings. +// - Diagnostics: Explains diagnostic messages issued by +// dumpkeymap. +// Created a manual page (dumpkeymap.1) which contains the complete +// set of documentation for key mapping files and dumpkeymap. +// Added command-line options (--help, --help-keymapping, +// --help-output, --help-files, --help-diagnostics) which allow +// access to all key mapping documentation. Previously the +// description of the internal layout of a .keymapping file was +// only available as source code comments. +// Added --version option. +// Ported to non-Apple/NeXT platforms. Defining the pre-processor +// flag DUMPKEYMAP_FILE_ONLY at compilation time inhibits use of +// Apple/NeXT-specific API. +// Added a README file. +// // 2000/11/13 Eric Sunshine <sunshine@sunshineco.com> // Converted from C++ to plain-C. // Now parses and takes into account the "number-size" flag stored // with each key map. This flag indicates the size, in bytes, of // all remaining numeric values in the mapping. Updated all code -// to respect the this flag. (Previously, the purpose of this -// field was unknown, and it was thus denoted as +// to respect this flag. (Previously, the purpose of this field +// was unknown, and it was thus denoted as // `KeyMapping::fill[2]'.) // Updated all documentation; especially the "KEY MAPPING // DESCRIPTION" section. Added discussion of the "number-size" @@ -316,11 +132,13 @@ #include <ctype.h> #include <stdio.h> #include <stdlib.h> -#include <drivers/event_status_driver.h> #include <sys/stat.h> +#if !defined(DUMPKEYMAP_FILE_ONLY) +#include <drivers/event_status_driver.h> +#endif #define PROG_NAME "dumpkeymap" -#define PROG_VERSION 2 +#define PROG_VERSION "3" #define AUTHOR_NAME "Eric Sunshine" #define AUTHOR_EMAIL "sunshine@sunshineco.com" #define AUTHOR_INFO AUTHOR_NAME " <" AUTHOR_EMAIL ">" @@ -336,6 +154,12 @@ typedef dword number; #define BIND_FUNCTION 0xfe #define BIND_SPECIAL 0xff +#define OPT_SWITCH(X) { char const* switched_str__=(X); if (0) { +#define OPT_CASE(X,Y) } else if (strcmp(switched_str__,(#X)) == 0 || \ + strcmp(switched_str__,(#Y)) == 0) { +#define OPT_DEFAULT } else { +#define OPT_SWITCH_END }} + //----------------------------------------------------------------------------- // Translation Tables //----------------------------------------------------------------------------- @@ -482,7 +306,7 @@ static void expect_nbytes( DataStream* s, int nbytes ) { if (s->data + nbytes > s->data_end) { - fprintf( stderr, "Insufficient data in keymapping data stream.\n" ); + fputs( "Insufficient data in keymapping data stream.\n", stderr ); exit(-1); } } @@ -575,7 +399,7 @@ static number bits_set( number mask ) static void unparse_modifiers( DataStream* s ) { number nmod = get_number(s); // Modifier count - printf( "\nMODIFIERS [%lu]\n", nmod ); + printf( "MODIFIERS [%lu]\n", nmod ); while (nmod-- > 0) { number nscan; @@ -586,6 +410,7 @@ static void unparse_modifiers( DataStream* s ) printf( " 0x%02x", (natural)get_number(s) ); putchar( '\n' ); } + putchar( '\n' ); } @@ -640,18 +465,18 @@ static void unparse_key_special( number code ) printf( "{seq#%lu}", code ); } -static void unparse_keys( DataStream* s ) +static void unparse_characters( DataStream* s ) { number const NOT_BOUND = 0xff; - number const nkeys = get_number(s); + number const nscans = get_number(s); number scan; - printf( "\nKEYS [%lu]\n", nkeys ); - for (scan = 0; scan < nkeys; scan++) + printf( "CHARACTERS [%lu]\n", nscans ); + for (scan = 0; scan < nscans; scan++) { number const mask = get_number(s); printf( "scan 0x%02x: ", (natural)scan ); if (mask == NOT_BOUND) - printf( "not-bound\n" ); + fputs( "not-bound\n", stdout ); else { number const bits = bits_set( mask ); @@ -661,6 +486,7 @@ static void unparse_keys( DataStream* s ) putchar( '\n' ); } } + putchar( '\n' ); } @@ -676,14 +502,15 @@ static void unparse_sequences( DataStream* s ) { number const nseqs = get_number(s); number seq; - printf( "\nSEQUENCES [%lu]\n", nseqs ); + printf( "SEQUENCES [%lu]\n", nseqs ); for (seq = 0; seq < nseqs; seq++) { number const nchars = get_number(s); - printf( "sequence %lu: ", seq ); + printf( "sequence %lu:", seq ); unparse_char_codes( s, nchars, unparse_sequence_special ); putchar( '\n' ); } + putchar( '\n' ); } @@ -693,13 +520,14 @@ static void unparse_sequences( DataStream* s ) static void unparse_specials( DataStream* s ) { number nspecials = get_number(s); - printf( "\nSPECIALS [%lu]\n", nspecials ); + printf( "SPECIALS [%lu]\n", nspecials ); while (nspecials-- > 0) { number const special = get_number(s); number const scan = get_number(s); printf( "%s: 0x%02x\n", special_code_desc(special), (natural)scan ); } + putchar( '\n' ); } @@ -720,7 +548,7 @@ static void unparse_keymap_data( DataStream* s ) { unparse_numeric_size(s); unparse_modifiers(s); - unparse_keys(s); + unparse_characters(s); unparse_sequences(s); unparse_specials(s); } @@ -729,12 +557,13 @@ static void unparse_keymap_data( DataStream* s ) //----------------------------------------------------------------------------- // Unparse the active key map. //----------------------------------------------------------------------------- +#if !defined(DUMPKEYMAP_FILE_ONLY) static int unparse_active_keymap( void ) { int rc = 1; NXEventHandle const h = NXOpenEventStatus(); if (h == 0) - fprintf( stderr, "Unable to open event status driver.\n" ); + fputs( "Unable to open event status driver.\n", stderr ); else { NXKeyMapping km; @@ -745,11 +574,13 @@ static int unparse_active_keymap( void ) { km.mapping = (char*)malloc( km.size ); if (NXGetKeyMapping( h, &km ) == 0) - fprintf( stderr, "Unable to get current key mapping.\n" ); + fputs( "Unable to get current key mapping.\n", stderr ); else { DataStream* stream = new_data_stream( (byte const*)km.mapping, km.size ); + fputs( "=============\nACTIVE KEYMAP\n=============\n\n", + stdout); unparse_keymap_data( stream ); destroy_data_stream( stream ); rc = 0; @@ -760,6 +591,7 @@ static int unparse_active_keymap( void ) } return rc; } +#endif //----------------------------------------------------------------------------- @@ -770,7 +602,7 @@ static void unparse_keymap( DataStream* s ) dword const interface = get_dword(s); dword const handler_id = get_dword(s); dword const map_size = get_dword(s); - printf( "interface=0x%02lx handler_id=0x%02lx map_size=%lu bytes\n", + printf( "interface: 0x%02lx\nhandler_id: 0x%02lx\nmap_size: %lu bytes\n\n", interface, handler_id, map_size ); unparse_keymap_data(s); } @@ -796,16 +628,16 @@ static int unparse_keymaps( DataStream* s ) int rc = 0; if (check_magic_number(s)) { - int n = 0; + int n = 1; while (!end_of_stream(s)) { - printf( "\nKEYMAP #%d: ", n++ ); + printf( "---------\nKEYMAP #%d\n---------\n", n++ ); unparse_keymap(s); } } else { - fprintf( stderr, "Bad magic number.\n" ); + fputs( "Bad magic number.\n", stderr ); rc = 1; } return rc; @@ -819,20 +651,20 @@ static int unparse_keymap_file( char const* const path ) { int rc = 1; FILE* file; - printf( "\nKEYMAP FILE: %s\n", path ); + printf( "===========\nKEYMAP FILE\n===========\n%s\n\n", path ); file = fopen( path, "rb" ); if (file == 0) - perror( "Unable to open keymap" ); + perror( "Unable to open key mapping file" ); else { struct stat st; if (fstat( fileno(file), &st ) != 0) - perror( "Unable to determine file size" ); + perror( "Unable to determine key mapping file size" ); else { byte* buffer = (byte*)malloc( st.st_size ); if (fread( buffer, st.st_size, 1, file ) != 1) - perror( "Unable to read keymap" ); + perror( "Unable to read key mapping file" ); else { DataStream* stream = new_data_stream(buffer, (int)st.st_size); @@ -850,30 +682,763 @@ static int unparse_keymap_file( char const* const path ) //----------------------------------------------------------------------------- +// Handle the case when no documents are mentioned on the command-line. For +// Apple/NeXT platforms, dump the currently active key mapping; else display +// an error message. +//----------------------------------------------------------------------------- +static int handle_empty_document_list( void ) + { +#if !defined(DUMPKEYMAP_FILE_ONLY) + return unparse_active_keymap(); +#else + fputs( "ERROR: Must specify at least one .keymapping file.\n\n", stderr ); + return 1; +#endif + } + + +//----------------------------------------------------------------------------- +// Print a detailed description of the internal layout of a key mapping. +//----------------------------------------------------------------------------- +static void print_internal_layout_info( FILE* f ) + { + fputs( +"What follows is a detailed descriptions of the internal layout of an\n" +"Apple/NeXT .keymapping file.\n" +"\n" +"Types and Data\n" +"--------------\n" +"The following type definitions are employed throughout this discussion:\n" +"\n" +" typedef unsigned char byte;\n" +" typedef unsigned short word;\n" +" typedef unsigned long dword;\n" +"\n" +"Additionally, the type definition `number' is used generically to indicate\n" +"a numeric value. The actual size of the `number' type may be one or two\n" +"bytes depending upon how the data is stored in the key map. Although most\n" +"key maps use byte-sized numeric values, word-sized values are also allowed.\n" +"\n" +"Multi-byte values in a key mapping file are stored in big-endian byte\n" +"order.\n" +"\n" +"Key Mapping File and Device Mapping\n" +"-----------------------------------\n" +"A key mapping file begins with a magic-number and continues with a variable\n" +"number of device-specific key mappings.\n" +"\n" +" struct KeyMappingFile {\n" +" char magic_number[4]; // `KYM1'\n" +" DeviceMapping maps[...]; // Variable number of maps\n" +" };\n" +"\n" +" struct DeviceMapping {\n" +" dword interface; // Interface type\n" +" dword handler_id; // Interface subtype\n" +" dword map_size; // Byte count of `map' (below)\n" +" KeyMapping map;\n" +" };\n" +"\n" +"The value of `interface' represents a family of keyboard device types\n" +"(such as Intel PC, ADB, NeXT, Sun Type5, etc.), and is generally\n" +"specified as one of the constant values NX_EVS_DEVICE_INTERFACE_ADB,\n" +"NX_EVS_DEVICE_INTERFACE_ACE, etc., which are are defined in IOHIDTypes.h on\n" +"MacOS/X and Darwin, and in ev_types.h on MacOS/X Server, OpenStep, and\n" +"NextStep.\n" +"\n" +"The value of `handler_id' represents a specific keyboard layout within the\n" +"much broader `interface' family. For instance, for a 101-key Intel PC\n" +"keyboard (of type NX_EVS_DEVICE_INTERFACE_ACE) the `handler_id' is '0',\n" +"whereas for a 102-key keyboard it is `1'.\n" +"\n" +"Together, `interface' and `handler_id' identify the exact keyboard hardware\n" +"to which this mapping applies. Programs which display a visual\n" +"representation of a keyboard layout, match `interface' and `handler_id'\n" +"from the .keymapping file against the `interface' and `handler_id' values\n" +"found in each .keyboard file.\n" +"\n" +"Key Mapping\n" +"-----------\n" +"A key mapping completely defines the relationship of all scan codes with\n" +"their associated functionality. A KeyMapping structure is embedded within\n" +"the DeviceMapping structure in a KeyMappingFile. The key mapping currently\n" +"in use by the WindowServer and AppKit is also represented by a KeyMapping\n" +"structure, and can be referred to directly by calling NXGetKeyMapping() and\n" +"accessing the `mapping' data member of the returned NXKeyMapping structure.\n" +"\n" +" struct KeyMapping {\n" +" word number_size; // 0=1 byte, non-zero=2 bytes\n" +" number num_modifier_groups; // Modifier groups\n" +" ModifierGroup modifier_groups[...];\n" +" number num_scan_codes; // Scan groups\n" +" ScanGroup scan_table[...];\n" +" number num_sequence_lists; // Sequence lists\n" +" Sequence sequence_lists[...];\n" +" number num_special_keys; // Special keys\n" +" SpecialKey special_key[...];\n" +" };\n" +"\n" +"The `number_size' flag determines the size, in bytes, of all remaining\n" +"numeric values (denoted by the type definition `number') within the key\n" +"mapping. If its value is zero, then numbers are represented by a single\n" +"byte. If it is non-zero, then numbers are represented by a word (two\n" +"bytes).\n" +"\n" +"Modifier Group\n" +"--------------\n" +"A modifier group defines all scan codes which map to a particular type of\n" +"modifier, such as `shift', `control', etc.\n" +"\n" +" enum Modifier {\n" +" ALPHALOCK = 0,\n" +" SHIFT,\n" +" CONTROL,\n" +" ALTERNATE,\n" +" COMMAND,\n" +" KEYPAD,\n" +" HELP\n" +" };\n" +"\n" +" struct ModifierGroup {\n" +" number modifier; // A Modifier constant\n" +" number num_scan_codes;\n" +" number scan_codes[...]; // Variable number of scan codes\n" +" };\n" +"\n" +"The scan_codes[] array contains a list of all scan codes which map to the\n" +"specified modifier. The `shift', `command', and `alternate' modifiers are\n" +"frequently mapped to two different scan codes, apiece, since these\n" +"modifiers often appear on both the left and right sides of the keyboard.\n" +"\n" +"Scan Group\n" +"----------\n" +"There is one ScanGroup for each scan code generated by the given keyboard.\n" +"This number is given by KeyMapping::num_scan_codes. The first scan group\n" +"represents hardware scan code 0, the second represents scan code 1, etc.\n" +"\n" +" enum ModifierMask {\n" +" ALPHALOCK_MASK = 1 << 0,\n" +" SHIFT_MASK = 1 << 1,\n" +" CONTROL_MASK = 1 << 2,\n" +" ALTERNATE_MASK = 1 << 3,\n" +" CARRIAGE_RETURN_MASK = 1 << 4\n" +" };\n" +" #define NOT_BOUND 0xff\n" +"\n" +" struct ScanGroup {\n" +" number mask;\n" +" Character characters[...];\n" +" };\n" +"\n" +"For each scan code, `mask' defines which modifier combinations generate\n" +"characters. If `mask' is NOT_BOUND (0xff) then then this scan code does\n" +"not generate any characters ever, and its characters[] array is zero\n" +"length. Otherwise, the characters[] array contains one Character record\n" +"for each modifier combination.\n" +"\n" +"The number of records in characters[] is determined by computing (1 <<\n" +"bits_set_in_mask). In other words, if mask is zero, then zero bits are\n" +"set, so characters[] contains only one record. If `mask' is (SHIFT_MASK |\n" +"CONTROL_MASK), then two bits are set, so characters[] contains four\n" +"records.\n" +"\n" +"The first record always represents the character which is generated by that\n" +"key when no modifiers are active. The remaining records represent\n" +"characters generated by the various modifier combinations. Using the\n" +"example with the `shift' and `control' masks set, record two would\n" +"represent the character with the `shift' modifier active; record three, the\n" +"`control' modifier active; and record four, both the `shift' and `control'\n" +"modifiers active.\n" +"\n" +"As a special case, ALPHALOCK_MASK implies SHIFT_MASK, though only\n" +"ALPHALOCK_MASK appears in `mask'. In this case the same character is\n" +"generated for both the `shift' and `alpha-lock' modifiers, but only needs\n" +"to appear once in the characters[] array.\n" +"\n" +"CARRIAGE_RETURN_MASK does not actually refer to a modifier key. Instead,\n" +"it is used to distinguish the scan code which is given the special\n" +"pseudo-designation of `carriage return' key. Typically, this mask appears\n" +"solo in a ScanGroup record and only the two Character records for control-M\n" +"and control-C follow. This flag may be a throwback to an earlier time or\n" +"may be specially interpreted by the low-level keyboard driver, but its\n" +"purpose is otherwise enigmatic.\n" +"Character\n" +"---------\n" +"Each Character record indicates the character generated when this key is\n" +"pressed, as well as the character set which contains the character. Well\n" +"known character sets are `ASCII' and `Symbol'. The character set can also\n" +"be one of the meta values FUNCTION_KEY or KEY_SEQUENCE. If it is\n" +"FUNCTION_KEY then `char_code' represents a generally well-known function\n" +"key such as those enumerated by FunctionKey. If the character set is\n" +"KEY_SEQUENCE then `char_code' represents a zero-base index into\n" +"KeyMapping::sequence_lists[].\n" +"\n" +" enum CharacterSet {\n" +" ASCII = 0x00,\n" +" SYMBOL = 0x01,\n" +" ...\n" +" FUNCTION_KEY = 0xfe,\n" +" KEY_SEQUENCE = 0xff\n" +" };\n" +"\n" +" struct Character {\n" +" number set; // CharacterSet of generated character\n" +" number char_code; // Actual character generated\n" +" };\n" +"\n" +" enum FunctionKey {\n" +" F1 = 0x20, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,\n" +" INSERT, DELETE, HOME, END, PAGE_UP, PAGE_DOWN, PRINT_SCREEN,\n" +" SCROLL_LOCK, PAUSE, SYS_REQUEST, BREAK, RESET, STOP, MENU, USER,\n" +" SYSTEM, PRINT, CLEAR_LINE, CLEAR_DISPLAY, INSERT_LINE,\n" +" DELETE_LINE, INSERT_CHAR, DELETE_CHAR, PREV, NEXT, SELECT\n" +" };\n" +"\n" +"Sequence\n" +"--------\n" +"When Character::set contains the meta value KEY_SEQUENCE, the scan code is\n" +"bound to a sequence of keys rather than a single character. A sequence is\n" +"a series of modifiers and characters which are automatically generated when\n" +"the associated key is depressed.\n" +"\n" +" #define MODIFIER_KEY 0xff\n" +"\n" +" struct Sequence {\n" +" number num_chars;\n" +" Character characters[...];\n" +" };\n" +"\n" +"Each generated Character is represented as previously described, with the\n" +"exception that MODIFIER_KEY may appear in place of KEY_SEQUENCE. When the\n" +"value of Character::set is MODIFIER_KEY then Character::char_code\n" +"represents a modifier key rather than an actual character. If the modifier\n" +"represented by `char_code' is non-zero, then it indicates that the\n" +"associated modifier key has been depressed. In this case, the value is one\n" +"of the constants enumerated by Modifier (SHIFT, CONTROL, ALTERNATE, etc.).\n" +"If the value is zero then it means that the modifier keys have been\n" +"released.\n" +"\n" +"Special Key\n" +"-----------\n" +"A special key is one which is scanned directly by the Mach kernel rather\n" +"than by the WindowServer. In general, events are not generated for special\n" +"keys.\n" +"\n" +" enum SpecialKeyType {\n" +" VOLUME_UP = 0,\n" +" VOLUME_DOWN,\n" +" BRIGHTNESS_UP,\n" +" BRIGHTNESS_DOWN,\n" +" ALPHA_LOCK,\n" +" HELP,\n" +" POWER,\n" +" SECONDARY_ARROW_UP,\n" +" SECONDARY_ARROW_DOWN\n" +" };\n" +"\n" +" struct SpecialKey {\n" +" number type; // A SpecialKeyType constant\n" +" number scan_code; // Actual scan code\n" +" };\n" +"\n", f ); + } + + +//----------------------------------------------------------------------------- +// Print an explanation of the output generated by this program. +//----------------------------------------------------------------------------- +static void print_output_info( FILE* f ) + { + fputs( +"What follows is an explanation and description of the various pieces of\n" +"information emitted by dumpkeymap.\n" +"\n" +"For a more thorough discussion of any particular piece of information\n" +"described here, refer to the detailed description of the internal layout of\n" +"a key mapping given by the --help-layout option.\n" +"\n" +"Conventions\n" +"-----------\n" +"Depending upon context, some numeric values are displayed in decimal\n" +"notation, whereas others are displayed in hexadecimal notation.\n" +"Hexadecimal numbers are denoted by a `0x' prefix (for instance, `0x7b'),\n" +"except when explicitly noted otherwise.\n" +"\n" +"Key Mapping Source\n" +"------------------\n" +"The first piece of information presented about a particular key mapping is\n" +"the source from which the data was gleaned. For a .keymapping file, the\n" +"title `KEYMAP FILE' is emitted along with the path and name of the file in\n" +"question. For the key mapping currently in use by the WindowServer and\n" +"AppKit, the title `ACTIVE KEYMAP' is emitted instead.\n" +"\n" +"Device Information\n" +"------------------\n" +"Each .keymapping file may contain one or more raw key mappings. For\n" +"example, a file which maps keys to a Dvorak-style layout might contain raw\n" +"mappings for Intel PC, ADB, NeXT, and Sun Type5 keyboards.\n" +"\n" +"For each raw mapping, the following information is emitted:\n" +"\n" +" o The title `KEYMAP' along with the mapping's relative position in the\n" +" .keymapping file.\n" +" o The `interface' identifier.\n" +" o The `handler_id' sub-identifier.\n" +" o The size of the raw mapping resource counted in bytes.\n" +"\n" +"The `interface' and `handler_id' values, taken together, define a specific\n" +"keyboard device. A .keyboard file, which describes the visual layout of a\n" +"keyboard, also contains `interface' and `handler_id' identifiers. The\n" +".keyboard file corresponding to a particular key mapping can be found by\n" +"matching the `interface' and `handler_id' values from each resource.\n" +"\n" +"Modifiers\n" +"---------\n" +"Each mapping may contain zero or more modifier records which associate\n" +"hardware scan codes with modifier descriptions such as `shift', `control',\n" +"`alternate', etc. The title `MODIFIERS' is printed along with the count of\n" +"modifier records which follow. For each modifier record, the modifier's\n" +"name is printed along with a list of scan codes, in hexadecimal format,\n" +"which generate that modifier value. For example:\n" +"\n" +" MODIFIERS [4]\n" +" alternate: 0x1d 0x60\n" +" control: 0x3a\n" +" keypad: 0x52 0x53 ... 0x63 0x62\n" +" shift: 0x2a 0x36\n" +"\n" +"Characters\n" +"----------\n" +"Each mapping may contain zero or more character records which associate\n" +"hardware scan codes with the actual characters generated by those scan\n" +"codes in the presence or absence of various modifier combinations. The\n" +"title `CHARACTERS' is printed along with the count of character records\n" +"which follow. Here is a highly abbreviated example:\n" +"\n" +" CHARACTERS [9]\n" +" scan 0x00: -AC-L \"a\" \"A\" \"^A\" \"^A\" ca c7 \"^A\" \"^A\"\n" +" scan 0x07: -AC-L \"x\" \"X\" \"^X\" \"^X\" 01/b4 01/ce \"^X\" \"^X\"\n" +" scan 0x0a: ---S- \"<\" \">\"\n" +" scan 0x13: -ACS- \"2\" \"@\" \"^@\" \"^@\" b2 b3 \"^@\" \"^@\"\n" +" scan 0x24: R---- \"^M\" \"^C\"\n" +" scan 0x3e: ----- [F4]\n" +" scan 0x4a: ----- [page up]\n" +" scan 0x60: ----- {seq#3}\n" +" scan 0x68: not-bound\n" +"\n" +"For each record, the hexadecimal value of the hardware scan code is\n" +"printed, followed by a list of modifier flag combinations and the actual\n" +"characters generated by this scan code with and without modifiers applied.\n" +"\n" +"The modifier flags field is composed of a combination of single letter\n" +"representations of the various modifier types. The letters stand for:\n" +"\n" +" L - alpha-lock\n" +" S - shift\n" +" C - control\n" +" A - alternate\n" +" R - carriage-return\n" +"\n" +"As a special case, the `alpha-lock' flag also implies the `shift' flag, so\n" +"these two flags never appear together in the same record.\n" +"\n" +"The combination of modifier flags determines the meaning and number of\n" +"fields which follow. The first field after the modifier flags always\n" +"represents the character that will be generated if no modifier keys are\n" +"depressed. The remaining fields represent characters generated by the\n" +"various modifier combinations. The order of the fields follows this\n" +"general pattern:\n" +"\n" +" o The character generated by this scan code when no modifiers are in\n" +" effect is listed first.\n" +"\n" +" o If the `L' or `S' flag is active, then the shifted character\n" +" generated by this scan code is listed next.\n" +"\n" +" o If the `C' flag is active, then the control-character generated by\n" +" this scan code is listed next. Furthermore, if the `L' or `S' flag\n" +" is also active, then the shifted control-character is listed after\n" +" that.\n" +"\n" +" o If the `A' flag is active, then the alternate-character generated by\n" +" this scan code is listed next. Furthermore, if the `L' or `S' flag\n" +" is active, then the shifted alternate-character is listed after that.\n" +" If the `C' flag is also active, then the alternate-control-character\n" +" is listed next. Finally, if the `C' and `L' or `C' and `S' flags are\n" +" also active, then the shifted alternate-control-character is listed.\n" +"\n" +"The `R' flag does not actually refer to a modifier key. Instead, it is\n" +"used to distinguish the scan code which is given the special\n" +"pseudo-designation of `carriage return' key. Typically, this mask appears\n" +"solo and only the two fields for control-M and control-C follow. This flag\n" +"may be a throwback to an earlier time or may be specially interpreted by\n" +"the low-level keyboard driver, but its purpose is otherwise enigmatic.\n" +"\n" +"Recalling the example from above, the following fields can be identified:\n" +"\n" +" scan 0x00: -AC-L \"a\" \"A\" \"^A\" \"^A\" ca c7 \"^A\" \"^A\"\n" +"\n" +" o Lower-case `a' is generated when no modifiers are active.\n" +" o Upper-case `A' is generated when `shift' or `alpha-lock' are active.\n" +" o Control-A is generated when `control' is active.\n" +" o Control-A is generated when `control' and `shift' are active.\n" +" o The character represented by the hexadecimal code 0xca is generated\n" +" when `alternate' is active.\n" +" o The character represented by 0xc7 is generated when `alternate' and\n" +" `shift' (or `alpha-lock') are active.\n" +" o Control-A is generated when `alternate' and `control' are active.\n" +" o Control-A is generated when `alternate', `control' and `shift' (or\n" +" `alpha-lock') are active.\n" +"\n" +"The notation used to represent a particular generated character varies.\n" +"\n" +" o Printable ASCII characters are quoted, as in \"x\" or \"X\".\n" +"\n" +" o Control-characters are quoted and prefixed with `^', as in \"^X\".\n" +"\n" +" o Characters with values greater than 127 (0x7f) are displayed as\n" +" hexadecimal values without the `0x' prefix.\n" +"\n" +" o Characters in a non-ASCII character set (such as `Symbol') are\n" +" displayed as two hexadecimal numbers separated by a slash, as in\n" +" `01/4a'. The first number is the character set's identification code\n" +" (such as `01' for the `Symbol' set), and the second number is the\n" +" value of the generated character.\n" +"\n" +" o Non-printing special function characters are displayed with the\n" +" function's common name enclosed in brackets, as in `[page up]' or\n" +" `[F4]'.\n" +"\n" +" o If the binding represents a key sequence rather than a single\n" +" character, then the sequence's identification number is enclosed in\n" +" braces, as in `{seq#3}'.\n" +"\n" +"Recalling a few examples from above, the following interpretations can be\n" +"made:\n" +"\n" +" scan 0x07: -AC-L \"x\" \"X\" \"^X\" \"^X\" 01/b4 01/ce \"^X\" \"^X\"\n" +" scan 0x3e: ----- [F4]\n" +" scan 0x4a: ----- [page up]\n" +" scan 0x60: ----- {seq#3}\n" +"\n" +" o \"x\" and \"X\" are printable ASCII characters.\n" +" o \"^X\" is a control-character.\n" +" o `01/b4' and `01/ce' represent the character codes 0xb4 and 0xce in\n" +" the `Symbol' character set.\n" +" o Scan code 0x3e generates function-key `F4', and scan code 0x4a\n" +" generates function-key `page up'.\n" +" o Scan code 0x60 is bound to key sequence #3.\n" +"\n" +"Finally, if a scan code is not bound to any characters, then it is\n" +"annotated with the label `not-bound', as with example scan code 0x68 from\n" +"above.\n" +"\n" +"Sequences\n" +"---------\n" +"A scan code (modified and unmodified) can be bound to a key sequence rather\n" +"than generating a single character or acting as a modifier. When it is\n" +"bound to a key sequence, a series of character invocations and modifier\n" +"actions are automatically generated rather than a single keystroke.\n" +"\n" +"Each mapping may contain zero or more key sequence records. The title\n" +"`SEQUENCES' is printed along with the count of sequence records which\n" +"follow. For example:\n" +"\n" +" SEQUENCES [3]\n" +" sequence 0: \"f\" \"o\" \"o\"\n" +" sequence 1: {alternate} \"b\" \"a\" \"r\" {unmodify}\n" +" sequence 2: [home] \"b\" \"a\" \"z\"\n" +"\n" +"The notation used to represent the sequence of generated characters is\n" +"identical to the notation already described in the `Characters' section\n" +"above, with the exception that modifier actions may be interposed between\n" +"generated characters. Such modifier actions are represented by the\n" +"modifier's name enclosed in braces. The special name `{unmodify}'\n" +"indicates the release of the modifier keys.\n" +"\n" +"Thus, the sequences in the above example can be interpreted as follows:\n" +"\n" +" o Sequence #0 generates `foo'.\n" +" o Sequence #1 invokes the `alternate' modifier, generates `bar', and\n" +" then releases `alternate'.\n" +" o Sequence #2 invokes the `home' key and then generates `baz'. In a\n" +" text editor, this would probably result in `baz' being prepended to\n" +" the line of text on which the cursor resides.\n" +"\n" +"Special Keys\n" +"------------\n" +"Certain keyboards feature keys which perform some type of special purpose\n" +"function rather than generating a character or acting as a modifier. For\n" +"instance, Apple keyboards often contain a `power' key, and NeXT keyboards\n" +"have historically featured screen brightness and volume control keys.\n" +"\n" +"Each mapping may contain zero or more special-key records which associate\n" +"hardware scan codes with such special purpose functions. The title\n" +"`SPECIALS' is printed along with the count of records which follow. For\n" +"each record, the special function's name is printed along with a list of\n" +"scan codes, in hexadecimal format, which are bound to that function. For\n" +"example:\n" +"\n" +" SPECIALS [6]\n" +" alpha-lock: 0x39\n" +" brightness-down: 0x79\n" +" brightness-up: 0x74\n" +" power: 0x7f\n" +" sound-down: 0x77\n" +" sound-up: 0x73\n" +"\n", f ); + } + + +//----------------------------------------------------------------------------- +// Print a summary of the various files and directories which are related to +// key mappings. +//----------------------------------------------------------------------------- +static void print_files_info( FILE* f ) + { + fputs( +"This is a summary of the various files and directories which are related to\n" +"key mappings.\n" +"\n" +"*.keymapping\n" +" A key mapping file which precisely defines the relationship of all\n" +" hardware-specific keyboard scan-codes with their associated\n" +" functionality.\n" +"\n" +"*.keyboard\n" +" A file describing the physical layout of keys on a particular type of\n" +" keyboard. Each `key' token in this file defines the position and shape\n" +" of the key on the keyboard, as well as the associated scan code which\n" +" that key generates. A .keymapping file, on the other hand, defines the\n" +" characters which are generated by a particular scan code depending upon\n" +" the state of the various modifier keys (such as shift, control, etc.).\n" +" The `interface' and `handler_id' values from a .keymapping file are\n" +" matched against those in each .keyboard file in order to associate a\n" +" particular .keyboard file with a key mapping. Various GUI programs use\n" +" the .keyboard file to display a visual representation of a keyboard for\n" +" the user. Since these files are just plain text, they can be easily\n" +" viewed and interpreted without the aid of a specialized program, thus\n" +" dumpkeymap leaves these files alone.\n" +"\n" +"/System/Library/Keyboards\n" +"/Network/Library/Keyboards\n" +"/Local/Library/Keyboards\n" +"/Library/Keyboards\n" +" Repositories for .keymapping and .keyboard files for MacOS/X, Darwin,\n" +" and MacOS/X Server.\n" +"\n" +"/NextLibrary/Keyboards\n" +"/LocalLibrary/Keyboards\n" +" Repositories for .keymapping and .keyboard files for OpenStep and\n" +" NextStep.\n" +"\n" +"$(HOME)/Library/Keyboards\n" +" Repository for personal .keymapping and .keyboard files.\n" +"\n", f ); + } + + +//----------------------------------------------------------------------------- +// Print a list of the various diagnostic messages which may be emitted. +//----------------------------------------------------------------------------- +static void print_diagnostics_info( FILE* f ) + { + fputs( +"The following diagnostic messages may be issued to the standard error\n" +"stream.\n" +"\n" +"Unrecognized option.\n" +" An unrecognized option was specified on the command-line. Invoke\n" +" dumpkeymap with the --help option to view a list of valid options.\n" +"\n" +"Insufficient data in keymapping data stream.\n" +" The key mapping file or data stream is corrupt. Either the file has\n" +" been incorrectly truncated or a field, such as those which indicates\n" +" the number of variable records which follow, contains a corrupt value.\n" +"\n" +"The following diagnostic messages have significance only when trying to\n" +"print .keymapping files mentioned on the command-line.\n" +"\n" +"Bad magic number.\n" +" The mentioned file is not a .keymapping file. The file's content does\n" +" not start with the string `KYM1'.\n" +"\n" +"Unable to open key mapping file.\n" +" The call to fopen() failed; probably because the specified path is\n" +" invalid or dumpkeymap does not have permission to read the file.\n" +"\n" +"Unable to determine key mapping file size.\n" +" The call to fstat() failed, thus memory can not be allocated for\n" +" loading the file.\n" +"\n" +"Unable to read key mapping file.\n" +" The call to fread() failed.\n" +"\n" +"The following diagnostic messages have significance only when trying to\n" +"print the currently active key mapping when no .keymapping files have been\n" +"mentioned on the command-line.\n" +"\n" +"Unable to open event status driver.\n" +" The call to NXOpenEventStatus() failed.\n" +"\n" +"Bad key mapping length.\n" +" The call to NXKeyMappingLength() returned a bogus value.\n" +"\n" +"Unable to get current key mapping.\n" +" The call to NXGetKeyMapping() failed.\n" +"\n" +"The following diagnostic messages have significance only when using\n" +"dumpkeymap on a non-Apple/NeXT platform.\n" +"\n" +"Must specify at least one .keymapping file.\n" +" No .keymapping files were mentioned on the command-line. On\n" +" non-Apple/NeXT platforms, there is no concept of a currently active\n" +" .keymapping file, so at least one file must be mentioned on the\n" +" command-line.\n" +"\n", f ); + } + + +//----------------------------------------------------------------------------- +// Print warranty. +//----------------------------------------------------------------------------- +static void print_warranty( FILE* f ) + { + fputs( +"This software is provided by the author `AS IS' and any express or implied\n" +"WARRANTIES, including, but not limited to, the implied warranties of\n" +"MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE are DISCLAIMED. In NO\n" +"EVENT shall the author be LIABLE for any DIRECT, INDIRECT, INCIDENTAL,\n" +"SPECIAL, EXEMPLARY, or CONSEQUENTIAL damages (including, but not limited\n" +"to, procurement of substitute goods or services; loss of use, data, or\n" +"profits; or business interruption) however caused and on any theory of\n" +"liability, whether in contract, strict liability, or tort (including\n" +"negligence or otherwise) arising in any way out of the use of this\n" +"software, even if advised of the possibility of such damage.\n" +"\n", f ); + } + + +//----------------------------------------------------------------------------- +// Print this program's version number. +//----------------------------------------------------------------------------- +static void print_version( FILE* f ) + { + fputs( "Version " PROG_VERSION " (built " __DATE__ ")\n\n", f ); + } + + +//----------------------------------------------------------------------------- +// Print a usage summary. +//----------------------------------------------------------------------------- +static void print_usage( FILE* f ) + { + fputs( +"Usage: dumpkeymap [options] [-] [file ...]\n" +"\n" +"Prints a textual representation of each Apple/NeXT .keymapping file\n" +"mentioned on the command-line. If no files are mentioned and if the local\n" +"machine is an Apple or NeXT installation, then the key mapping currently in\n" +"use by the WindowServer and the AppKit is printed instead.\n" +"\n" +"Options:\n" +" -h --help\n" +" Display general program instructions and option summary.\n" +"\n" +" -k --help-keymapping\n" +" Display a detailed description of the internal layout of a\n" +" .keymapping file.\n" +"\n" +" -o --help-output\n" +" Display an explanation of the output generated by dumpkeymap when\n" +" dissecting a .keymapping file.\n" +"\n" +" -f --help-files\n" +" Display a summary of the various files and directories which are\n" +" related to key mappings.\n" +"\n" +" -d --help-diagnostics\n" +" Display a list of the various diagnostic messages which may be\n" +" emitted by dumpkeymap.\n" +"\n" +" -v --version\n" +" Display the dumpkeymap version number and warranty information.\n" +"\n" +" - --\n" +" Inhibit processing of options at this point in the argument list.\n" +" An occurrence of `-' or `--' in the argument list causes all\n" +" following arguments to be treated as file names even if an argument\n" +" begins with a `-' character.\n" +"\n", f ); + } + + +//----------------------------------------------------------------------------- // Print an informational banner. //----------------------------------------------------------------------------- -static void print_banner( void ) +static void print_banner( FILE* f ) { - printf( "\n" PROG_NAME " v%d by " AUTHOR_INFO "\n" COPYRIGHT "\n", - PROG_VERSION ); + fputs( "\n" PROG_NAME " v" PROG_VERSION " by " AUTHOR_INFO "\n" + COPYRIGHT "\n\n", f ); } //----------------------------------------------------------------------------- -// Master dispatcher. +// Process command-line arguments. Examine options first; collecting files +// along the way. If all is well, process collected file list. //----------------------------------------------------------------------------- int main( int const argc, char const* const argv[] ) { - int rc = 0; - print_banner(); - if (argc == 1) // No arguments, unparse keymap currently in use. - rc = unparse_active_keymap(); - else // Unparse keymaps specified on command line. + int rc = 0, i, nfiles = 0, more_options = 1, process_files = 1; + int* files = (int*)calloc( argc - 1, sizeof(int) ); + print_banner( stdout ); + + for (i = 1; i < argc; i++) + { + char const* const s = argv[i]; + if (!more_options || *s != '-') + files[ nfiles++ ] = i; + else + { + OPT_SWITCH(s) + OPT_CASE(-,--) + more_options = 0; + OPT_CASE(-h,--help) + print_usage( stdout ); + process_files = 0; + OPT_CASE(-k,--help-keymapping) + print_internal_layout_info( stdout ); + process_files = 0; + OPT_CASE(-o,--help-output) + print_output_info( stdout ); + process_files = 0; + OPT_CASE(-f,--help-files) + print_files_info( stdout ); + process_files = 0; + OPT_CASE(-d,--help-diagnostics) + print_diagnostics_info( stdout ); + process_files = 0; + OPT_CASE(-v,--version) + print_version( stdout ); + print_warranty( stdout ); + process_files = 0; + OPT_DEFAULT + fprintf( stderr, "ERROR: Unrecognized option: %s\n\n", s ); + process_files = 0; + rc = 1; + OPT_SWITCH_END + } + } + + if (process_files) { - int i; - for (i = 1; i < argc; i++) - rc |= unparse_keymap_file( argv[i] ); + if (nfiles == 0) + rc = handle_empty_document_list(); + else + for (i = 0; i < nfiles; i++) + rc |= unparse_keymap_file( argv[files[i]] ); } + + free( files ); return rc; } - diff --git a/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.man b/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.man new file mode 100644 index 000000000..3f0d9d6eb --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/utils/dumpkeymap.man @@ -0,0 +1,951 @@ +.\"============================================================================ +.\" +.\" Manual page for `dumpkeymap'. +.\" +.\" Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +.\" NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +.\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\"============================================================================ +.\" +.\" $XFree86: xc/programs/Xserver/hw/darwin/utils/dumpkeymap.man,v 1.1 2000/12/01 19:47:39 dawes Exp $ +.\" +.\"---------------------------------------------------------------------------- +.\" Annotation Macros -- Facilitate creation of annotated, non-filled blocks +.\" of text. An annotated block is initiated with the `AS' macro. Each +.\" annotated, non-filled line within the block must be introduced with +.\" the `AN' macro which takes two arguments. The first argument is the +.\" detail text to be annotated, and the second is the annotation itself. +.\" The block should be terminated with the `AE' macro which actually +.\" emits the fully annotated block. All anotations within the block are +.\" aligned at the same horizontal position. This position is guaranteed +.\" to be just to the right of the widest detail line. Finally, the `AZ' +.\" macro, which takes a single argument, can be used to to insert a +.\" non-annotated line into the block which does not play a part in the +.\" calculation of the horizontal annotation alignment. +.\" Implementation Note +.\" These macros utilize a diversion (named `AD'). Since the prevailing +.\" indentation is stored along with the diverted text, we must muck with +.\" the indentation level in order to prevent the indentation from being +.\" applied to the text a second time when `AD' is finally emitted. +.\"---------------------------------------------------------------------------- +.de AS +.nr AW 0 +.nr AI \\n(.i +.in -\\n(AI +.nf +.. +.de AN +.if \w'\\$1'>\\n(AW .nr AW \w'\\$1' +.da AD +\\$1\\t\\$2 +.da +.. +.de AZ +.da AD +\\$1 +.da +\\ +.. +.de AE +.in +\\n(AIu +.if \\n(AW .ta \\n(AWu+\w'\\(em'u +.AD +.DT +.rm AD +.rm AW +.fi +.. +.\"---------------------------------------------------------------------------- +.\" Bulleted list macros -- `BG' begins a bulleted list; `BU' delimits +.\" bulleted entries; `BE' ends a bulleted list. +.\"---------------------------------------------------------------------------- +.de BG +.PP +.RS +.. +.de BU +.HP +.ie t \\(bu\\ \\c +.el *\\ \\c +.. +.de BE +.RE +.PP +.. +.\"---------------------------------------------------------------------------- +.\" Indented paragraph with stylized hanging tag macro. `TG' takes a single +.\" argument and treats it as the hanging tag of the indented paragraph. +.\" The tag is italicized in troff but not in nroff. +.\"---------------------------------------------------------------------------- +.de TG +.TP +.ie t .I "\\$1" +.el \\$1 +.. +.\"---------------------------------------------------------------------------- +.\" Manual page for `dumpkeymap'. +.\"---------------------------------------------------------------------------- +.TH DUMPKEYMAP 1 "November 2000" "Version 3" +.SH NAME +dumpkeymap \- Dianostic dump of a .keymapping file +.SH SYNOPSIS +.B dumpkeymap +.RI [ options "] [-] [" file "...]" +.SH DESCRIPTION +.I dumpkeymap +prints a textual representation of each Apple/\c +.SM NeXT +.I .keymapping +file mentioned on the command-line. If no files are mentioned and if the +local machine is an Apple or +.SM NeXT +installation, then the key mapping currently in use by the WindowServer and the +AppKit is printed instead. +.SH OPTIONS +.TP +.B "\-h \-\^\-help" +Display general program instructions and option summary. +.TP +.B "\-k \-\^\-help\-keymapping" +Display a detailed description of the internal layout of a +.I .keymapping +file. This is the same information as that presented in the +.I "Key Mapping Description" +section of this document. +.TP +.B "\-o \-\^\-help\-output" +Display an explanation of the output generated by +.I dumpkeymap +when dissecting a +.I .keymapping +file. This is the same information as that presented in the +.I "Output Description" +section of this document. +.TP +.B "\-f \-\^\-help\-files" +Display a summary of the various files and directories which are related to +key mappings. This is the same information as that presented in the +.I "Files" +section of this document. +.TP +.B "\-d \-\^\-help\-diagnostics" +Display a list of the various diagnostic messages which may be emitted by +.I dumpkeymap. +This is the same information as that presented in the +.I "Diagnostics" +section of this document. +.TP +.B "\-v \-\^\-version" +Display the +.I dumpkeymap +version number and warranty information. +.TP +.B "\- \-\^\-" +Inhibit processing of options at this point in the argument list. An +occurrence of `\-' or `\-\^\-' in the argument list causes all following +arguments to be treated as file names even if an argument begins with a `\-' +character. +.SH "KEY MAPPING DESCRIPTION" +The following sections describe, in complete detail, the format of a raw key +mapping resource, as well as the format of the +.I .keymapping +file which encapsulates one or more raw mappings. +.SH "Types and Data" +The following type definitions are employed throughout this discussion: +.PP +.RS +.AS +.AZ "typedef unsigned char byte;" +.AZ "typedef unsigned short word;" +.AZ "typedef unsigned long dword;" +.AE +.RE +.PP +Additionally, the type definition +.RI ` number ' +is used generically to +indicate a numeric value. The actual size of the +.RI ` number ' +type may be one or two bytes depending upon how the data is stored in the key +map. Although most key maps use byte-sized numeric values, word-sized values +are also allowed. +.PP +Multi-byte values in a key mapping file are stored in big-endian byte order. +.SH "Key Mapping File and Device Mapping" +A key mapping file begins with a magic-number and continues with a +variable number of device-specific key mappings. +.PP +.RS +.AS +.AZ "struct KeyMappingFile {" +.AN " char magic_number[4];" "// `KYM1'" +.AN " DeviceMapping maps[...];" "// Variable number of maps" +.AZ }; +.AE +.PP +.AS +.AZ "struct DeviceMapping {" +.AN " dword interface;" "// Interface type" +.AN " dword handler_id;" "// Interface subtype" +.AN " dword map_size;" "// Byte count of `map' (below)" +.AN " KeyMapping map;" +.AZ }; +.AE +.RE +.PP +The value of `interface' represents a family of keyboard device types +(such as Intel +.SM "PC, ADB, NeXT," +Sun Type5, etc.), and is generally specified as one of the constant values +.SM "NX_EVS_DEVICE_INTERFACE_ADB, NX_EVS_DEVICE_INTERFACE_ACE," +etc., which are are defined in IOHIDTypes.h on MacOS/X and Darwin, and in +ev_types.h on MacOS/X Server, OpenStep, and NextStep. +.PP +The value of `handler_id' represents a specific keyboard layout within the +much broader `interface' family. For instance, for a 101-key Intel +.SM PC +keyboard (of type +.SM NX_EVS_DEVICE_INTERFACE_ACE\c +) the `handler_id' is '0', whereas for a 102-key keyboard it is `1'. +.PP +Together, `interface' and `handler_id' identify the exact keyboard hardware to +which this mapping applies. Programs which display a visual representation of +a keyboard layout, match `interface' and `handler_id' from the +.I .keymapping +file against the `interface' and `handler_id' values found in each +.I .keyboard +file. +.SH "Key Mapping" +A key mapping completely defines the relationship of all scan codes with their +associated functionality. A +.I KeyMapping +structure is embedded within the +.I DeviceMapping +structure in a +.IR KeyMappingFile . +The key mapping currently in use by the WindowServer and AppKit is also +represented by a +.I KeyMapping +structure, and can be referred to directly by calling NXGetKeyMapping() and +accessing the `mapping' data member of the returned +.I NXKeyMapping +structure. +.PP +.RS +.AS +.AZ "struct KeyMapping {" +.AN " word number_size;" "// 0=1 byte, non-zero=2 bytes" +.AN " number num_modifier_groups;" "// Modifier groups" +.AZ " ModifierGroup modifier_groups[...];" +.AN " number num_scan_codes;" "// Scan groups" +.AN " ScanGroup scan_table[...];" +.AN " number num_sequence_lists;" "// Sequence lists" +.AN " Sequence sequence_lists[...];" +.AN " number num_special_keys;" "// Special keys" +.AN " SpecialKey special_key[...];" +.AZ }; +.AE +.RE +.PP +The `number_size' flag determines the size, in bytes, of all remaining numeric +values (denoted by the type definition +.RI ` number ') +within the +key mapping. If its value is zero, then numbers are represented by a single +byte. If it is non-zero, then numbers are represented by a word (two bytes). +.SH "Modifier Group" +A modifier group defines all scan codes which map to a particular type of +modifier, such as +.IR shift , +.IR control , +etc. +.PP +.RS +.AS +.AZ "enum Modifier {" +.AN " ALPHALOCK = 0," +.AN " SHIFT," +.AN " CONTROL," +.AN " ALTERNATE," +.AN " COMMAND," +.AN " KEYPAD," +.AN " HELP" +.AZ }; +.AE +.PP +.AS +.AZ "struct ModifierGroup {" +.AN " number modifier;" "// A Modifier constant" +.AN " number num_scan_codes;" +.AN " number scan_codes[...];" "// Variable number of scan codes" +.AZ }; +.AE +.RE +.PP +The scan_codes[] array contains a list of all scan codes which map to the +specified modifier. The +.IR shift ", " command ", and " alternate +modifiers are frequently mapped to two different scan codes, apiece, +since these modifiers often appear on both the left and right sides of +the keyboard. +.SH "Scan Group" +There is one +.I ScanGroup +for each scan code generated by the given keyboard. This number is given by +KeyMapping::num_scan_codes. The first scan group represents hardware scan +code 0, the second represents scan code 1, etc. +.PP +.RS +.AS +.AZ "enum ModifierMask {" +.AN " ALPHALOCK_MASK" "= 1 << 0," +.AN " SHIFT_MASK" "= 1 << 1," +.AN " CONTROL_MASK" "= 1 << 2," +.AN " ALTERNATE_MASK" "= 1 << 3," +.AN " CARRIAGE_RETURN_MASK" "= 1 << 4" +.AZ }; +.AZ "#define NOT_BOUND 0xff" +.AE +.PP +.AS +.AZ "struct ScanGroup {" +.AN " number mask;" +.AN " Character characters[...];" +.AZ }; +.AE +.RE +.PP +For each scan code, `mask' defines which modifier combinations generate +characters. If `mask' is +.SM NOT_BOUND +(0xff) then then this scan code does not generate any characters ever, and its +characters[] array is zero length. Otherwise, the characters[] array contains +one +.I Character +record for each modifier combination. +.PP +The number of records in characters[] is determined by computing (1 << +bits_set_in_mask). In other words, if mask is zero, then zero bits are set, +so characters[] contains only one record. If `mask' is +.SM "(SHIFT_MASK | CONTROL_MASK)," +then two bits are set, so characters[] contains four records. +.PP +The first record always represents the character which is generated by that +key when no modifiers are active. The remaining records represent characters +generated by the various modifier combinations. Using the example with the +.I shift +and +.I control +masks set, record two would represent the character with the +.I shift +modifier active; record three, the +.I control +modifier active; and record four, both the +.I shift +and +.I control +modifiers active. +.PP +As a special case, +.SM ALPHALOCK_MASK +implies +.SM SHIFT_MASK, +though only +.SM ALPHALOCK_MASK +appears in `mask'. In this case the same character is generated for both the +.I shift +and +.I alpha-lock +modifiers, but only needs to appear once in the characters[] array. +.PP +.SM CARRIAGE_RETURN_MASK +does not actually refer to a modifier key. Instead, it is used to +distinguish the scan code which is given the special pseudo-designation of +.I "carriage return" +key. Typically, this mask appears solo in a +.I ScanGroup +record and only the two +.I Character +records for control-M and control-C follow. This flag may be a throwback to +an earlier time or may be specially interpreted by the low-level keyboard +driver, but its purpose is otherwise enigmatic. +.SH Character +Each +.I Character +record indicates the character generated when this key is pressed, as well as +the character set which contains the character. Well known character sets are +.SM `ASCII' +and `Symbol'. The character set can also be one of the meta values +.SM FUNCTION_KEY +or +.SM KEY_SEQUENCE. +If it is +.SM FUNCTION_KEY +then `char_code' represents a generally well-known function key such as those +enumerated by +.I FunctionKey. +If the character set is +.SM KEY_SEQUENCE +then `char_code' represents is a zero-base index into +KeyMapping::sequence_lists[]. +.PP +.RS +.AS +.AZ "enum CharacterSet {" +.AN " ASCII" "= 0x00," +.AN " SYMBOL" "= 0x01," +.AN " ..." +.AN " FUNCTION_KEY" "= 0xfe," +.AN " KEY_SEQUENCE" "= 0xff" +.AZ }; +.AE +.PP +.AS +.AZ "struct Character {" +.AN " number set;" "// CharacterSet of generated character" +.AN " number char_code;" "// Actual character generated" +.AZ }; +.AE +.PP +.AS +.AZ "enum FunctionKey {" +.AN " F1 = 0x20, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12," +.AN " INSERT, DELETE, HOME, END, PAGE_UP, PAGE_DOWN, PRINT_SCREEN," +.AN " SCROLL_LOCK, PAUSE, SYS_REQUEST, BREAK, RESET, STOP, MENU," +.AN " USER, SYSTEM, PRINT, CLEAR_LINE, CLEAR_DISPLAY, INSERT_LINE," +.AN " DELETE_LINE, INSERT_CHAR, DELETE_CHAR, PREV, NEXT, SELECT" +.AZ }; +.AE +.RE +.SH Sequence +When Character::set contains the meta value +.SM KEY_SEQUENCE, +the scan code is bound to a sequence of keys rather than a single character. +A sequence is a series of modifiers and characters which are automatically +generated when the associated key is depressed. +.PP +.RS +.AS +.AZ "#define MODIFIER_KEY 0xff" +.AE +.PP +.AS +.AZ "struct Sequence {" +.AN " number num_chars;" +.AN " Character characters[...];" +.AZ }; +.AE +.RE +.PP +Each generated +.I Character +is represented as previously described, with the exception that +.SM MODIFIER_KEY +may appear in place of +.SM KEY_SEQUENCE. +When the value of Character::set is +.SM MODIFIER_KEY +then Character::char_code represents a modifier key rather than an actual +character. If the modifier represented by `char_code' is non-zero, then it +indicates that the associated modifier key has been depressed. In this case, +the value is one of the constants enumerated by +.I Modifier +(\c +.SM "SHIFT, CONTROL, ALTERNATE," +etc.). If the value is zero then it means that the modifier keys have been +released. +.SH "Special Key" +A special key is one which is scanned directly by the Mach kernel rather than +by the WindowServer. In general, events are not generated for special keys. +.PP +.RS +.AS +.AZ "enum SpecialKeyType {" +.AN " VOLUME_UP = 0," +.AN " VOLUME_DOWN," +.AN " BRIGHTNESS_UP," +.AN " BRIGHTNESS_DOWN," +.AN " ALPHA_LOCK," +.AN " HELP," +.AN " POWER," +.AN " SECONDARY_ARROW_UP," +.AN " SECONDARY_ARROW_DOWN" +.AZ }; +.AE +.PP +.AS +.AZ "struct SpecialKey {" +.AN " number type;" "// A SpecialKeyType constant" +.AN " number scan_code;" "// Actual scan code" +.AZ }; +.AE +.RE +.SH OUTPUT +What follows is an explanation and description of the various pieces of +information emitted by +.I dumpkeymap. +.PP +For a more thorough discussion of any particular piece of information described +here, refer to the detailed description of the internal layout of a key mapping +provided by the +.I "Key Mapping Description" +section above. +.SH Conventions +Depending upon context, some numeric values are displayed in decimal +notation, whereas others are displayed in hexadecimal notation. +Hexadecimal numbers are denoted by a `0x' prefix (for instance, `0x7b'), +except when explicitly noted otherwise. +.SH "Key Mapping Source" +The first piece of information presented about a particular key mapping is the +source from which the data was gleaned. For a +.I .keymapping +file, the title +.SM "`KEYMAP FILE'" +is emitted along with the path and name of the file in question. For the key +mapping currently in use by the WindowServer and AppKit, the title +.SM "`ACTIVE KEYMAP'" +is emitted instead. +.SH "Device Information" +Each +.I .keymapping +file may contain one or more raw key mappings. For example, a file which maps +keys to a Dvorak-style layout might contain raw mappings for Intel +.SM "PC, ADB, NeXT," +and Sun Type5 keyboards. +.PP +For each raw mapping, the following information is emitted: +.BG +.BU +The title +.SM `KEYMAP' +along with the mapping's relative position in the +.I .keymapping +file. +.BU +The `interface' identifier. +.BU +The `handler_id' sub-identifier. +.BU +The size of the raw mapping resource counted in bytes. +.BE +The `interface' and `handler_id' values, taken together, define a specific +keyboard device. A +.I .keyboard +file, which describes the visual layout of a keyboard, also contains +`interface' and `handler_id' identifiers. The +.I .keyboard +file corresponding to a particular key mapping can be found by matching the +`interface' and `handler_id' values from each resource. +.SH Modifiers +Each mapping may contain zero or more modifier records which associate hardware +scan codes with modifier descriptions such as +.I "shift, control, alternate," +etc. The title +.SM `MODIFIERS' +is printed along with the count of modifier records which follow. For each +modifier record, the modifier's name is printed along with a list of scan +codes, in hexadecimal format, which generate that modifier value. For example: +.PP +.RS +.nf +MODIFIERS [4] +alternate: 0x1d 0x60 +control: 0x3a +keypad: 0x52 0x53 ... 0x63 0x62 +shift: 0x2a 0x36 +.fi +.RE +.SH Characters +Each mapping may contain zero or more character records which associate +hardware scan codes with the actual characters generated by those scan +codes in the presence or absence of various modifier combinations. The +title +.SM `CHARACTERS' +is printed along with the count of character records which follow. Here is a +highly abbreviated example: +.PP +.RS +.nf +CHARACTERS [9] +scan 0x00: -AC-L "a" "A" "^A" "^A" ca c7 "^A" "^A" +scan 0x07: -AC-L "x" "X" "^X" "^X" 01/b4 01/ce "^X" "^X" +scan 0x0a: ---S- "<" ">" +scan 0x13: -ACS- "2" "@" "^@" "^@" b2 b3 "^@" "^@" +scan 0x24: R---- "^M" "^C" +scan 0x3e: ----- [F4] +scan 0x4a: ----- [page up] +scan 0x60: ----- {seq#3} +scan 0x68: not-bound +.fi +.RE +.PP +For each record, the hexadecimal value of the hardware scan code is printed, +followed by a list of modifier flag combinations and the actual characters +generated by this scan code with and without modifiers applied. +.PP +The modifier flags field is composed of a combination of single letter +representations of the various modifier types. The letters stand for: +.PP +.RS +.nf +L \- alpha-lock +S \- shift +C \- control +A \- alternate +R \- carriage-return +.fi +.RE +.PP +As a special case, the +.I alpha-lock +flag also implies the +.I shift +flag, so these two flags never appear together in the same record. +.PP +The combination of modifier flags determines the meaning and number of fields +which follow. The first field after the modifier flags always represents the +character that will be generated if no modifier keys are depressed. The +remaining fields represent characters generated by the various modifier +combinations. The order of the fields follows this general pattern: +.BG +.BU +The character generated by this scan code when no modifiers are in effect is +listed first. +.BU +If the `L' or `S' flag is active, then the shifted character generated by this +scan code is listed next. +.BU +If the `C' flag is active, then the control-character generated by this scan +code is listed next. Furthermore, if the `L' or `S' flag is also active, then +the shifted control-character is listed after that. +.BU +If the `A' flag is active, then the alternate-character generated by this scan +code is listed next. Furthermore, if the `L' or `S' flag is active, then the +shifted alternate-character is listed after that. If the `C' flag is also +active, then the alternate-control-character is listed next. Finally, if the +`C' and `L' or `C' and `S' flags are also active, then the shifted +alternate-control-character is listed. +.BE +The `R' flag does not actually refer to a modifier key. Instead, it is used to +distinguish the scan code which is given the special pseudo-designation of +.I "carriage return" +key. Typically, this mask appears solo and only the two fields for control-M +and control-C follow. This flag may be a throwback to an earlier time or may +be specially interpreted by the low-level keyboard driver, but its purpose is +otherwise enigmatic. +.PP +Recalling the example from above, the following fields can be identified: +.PP +.RS +.nf +scan 0x00: -AC-L "a" "A" "^A" "^A" ca c7 "^A" "^A" +.fi +.RE +.BG +.BU +Lower-case `a' is generated when no modifiers are active. +.BU +Upper-case `A' is generated when +.IR shift " or " alpha-lock +are active. +.BU +Control-A is generated when +.I control +is active. +.BU +Control-A is generated when +.IR control " and " shift +are active. +.BU +The character represented by the hexadecimal code 0xca is generated when +.I alternate +is active. +.BU +The character represented by 0xc7 is generated when +.IR alternate " and " shift " (or " alpha-lock ") are active." +.BU +Control-A is generated when +.IR alternate " and " control +are active. +.BU +Control-A is generated when +.IR "alternate, control" " and " shift " (or " alpha-lock ") are active." +.BE +The notation used to represent a particular generated character varies. +.BG +.BU +Printable +.SM ASCII +characters are quoted, as in "x" or "X". +.BU +Control-characters are quoted and prefixed with `^', as in "^X". +.BU +Characters with values greater than 127 (0x7f) are displayed as hexadecimal +values without the `0x' prefix. +.BU +Characters in a non-\c +.SM ASCII +character set (such as `Symbol') are displayed as two hexadecimal numbers +separated by a slash, as in `01/4a'. The first number is the character set's +identification code (such as `01' for the `Symbol' set), and the second number +is the value of the generated character. +.BU +Non-printing special function characters are displayed with the function's +common name enclosed in brackets, as in `[page up]' or `[F4]'. +.BU +If the binding represents a key sequence rather than a single character, then +the sequence's identification number is enclosed in braces, as in `{seq#3}'. +.BE +Recalling a few examples from above, the following interpretations can be made: +.PP +.RS +.nf +scan 0x07: -AC-L "x" "X" "^X" "^X" 01/b4 01/ce "^X" "^X" +scan 0x3e: ----- [F4] +scan 0x4a: ----- [page up] +scan 0x60: ----- {seq#3} +.fi +.RE +.BG +.BU +"x" and "X" are printable +.SM ASCII +characters. +.BU +"^X" is a control-character. +.BU +`01/b4' and `01/ce' represent the character codes 0xb4 and 0xce in the `Symbol' +character set. +.BU +Scan code 0x3e generates function-key `F4', and scan code 0x4a generates +function-key `page up'. +.BU +Scan code 0x60 is bound to key sequence #3. +.BE +Finally, if a scan code is not bound to any characters, then it is annotated +with the label `not-bound', as with example scan code 0x68 from above. +.SH Sequences +A scan code (modified and unmodified) can be bound to a key sequence rather +than generating a single character or acting as a modifier. When it is bound +to a key sequence, a series of character invocations and modifier actions are +automatically generated rather than a single keystroke. +.PP +Each mapping may contain zero or more key sequence records. The title +.SM `SEQUENCES' +is printed along with the count of sequence records which follow. For example: +.PP +.RS +.nf +SEQUENCES [3] +sequence 0: "f" "o" "o" +sequence 1: {alternate} "b" "a" "r" {unmodify} +sequence 2: [home] "b" "a" "z" +.fi +.RE +.PP +The notation used to represent the sequence of generated characters is +identical to the notation already described in the +.I Characters +section above, with the exception that modifier actions may be interposed +between generated characters. Such modifier actions are represented by the +modifier's name enclosed in braces. The special name `{unmodify}' indicates +the release of the modifier keys. +.PP +Thus, the sequences in the above example can be interpreted as follows: +.BG +.BU +Sequence\ #0 generates `foo'. +.BU +Sequence\ #1 invokes the +.I alternate +modifier, generates `bar', and then releases +.I alternate. +.BU +Sequence\ #2 invokes the +.I home +key and then generates `baz'. In a text editor, this would probably result in +`baz' being prepended to the line of text on which the cursor resides. +.BE +.SH Special Keys +Certain keyboards feature keys which perform some type of special purpose +function rather than generating a character or acting as a modifier. For +instance, Apple keyboards often contain a +.I power +key, and +.SM NeXT +keyboards have historically featured screen brightness and volume control keys. +.PP +Each mapping may contain zero or more special-key records which associate +hardware scan codes with such special purpose functions. The title +.SM `SPECIALS' +is printed along with the count of records which follow. For each record, the +special function's name is printed along with a list of scan codes, in +hexadecimal format, which are bound to that function. For example: +.PP +.RS +.nf +SPECIALS [6] +alpha-lock: 0x39 +brightness-down: 0x79 +brightness-up: 0x74 +power: 0x7f +sound-down: 0x77 +sound-up: 0x73 +.fi +.RE +.SH FILES +.IP *.keymapping +A key mapping file which precisely defines the relationship of all +hardware-specific keyboard scan-codes with their associated functionality. +.IP *.keyboard +A file describing the physical layout of keys on a particular type of +keyboard. Each `key' token in this file defines the position and shape of the +key on the keyboard, as well as the associated scan code which that key +generates. A +.I .keymapping +file, on the other hand, defines the characters which are generated by a +particular scan code depending upon the state of the various modifier keys +(such as +.I shift, +.I control, +etc.). The `interface' and `handler_id' values from a +.I .keymapping +file are matched against those in each +.I .keyboard +file in order to associate a particular +.I .keyboard +file with a key mapping. Various +.SM GUI +programs use the +.I .keyboard +file to display a visual representation of a keyboard for the user. Since +these files are just plain text, they can be easily viewed and interpreted +without the aid of a specialized program, thus +.I dumpkeymap +leaves these files alone. +.PP +/System/Library/Keyboards +.br +/Network/Library/Keyboards +.br +/Local/Library/Keyboards +.br +/Library/Keyboards +.RS +Repositories for +.I .keymapping +and +.I .keyboard +files for MacOS/X, Darwin, and MacOS/X Server. +.RE +.PP +/NextLibrary/Keyboards +.br +/LocalLibrary/Keyboards +.RS +Repositories for +.I .keymapping +and +.I .keyboard +files for OpenStep and NextStep. +.RE +.IP $(HOME)/Library/Keyboards +Repository for personal +.I .keymapping +and +.I .keyboard +files. +.SH DIGANOSTICS +The following diagnostic messages may be issued to the standard error stream. +.TG "Unrecognized option." +An unrecognized option was specified on the command-line. Invoke +.I dumpkeymap +with the +.B "\-\^\-help" +option to view a list of valid options. +.TG "Insufficient data in keymapping data stream." +The key mapping file or data stream is corrupt. Either the file has been +incorrectly truncated or a field, such as those which indicates the number of +variable records which follow, contains a corrupt value. +.PP +The following diagnostic messages have significance only when trying to print +.I .keymapping +files mentioned on the command-line. +.TG "Bad magic number." +The mentioned file is not a +.I .keymapping +file. The file's content does not start with the string `KYM1'. +.TG "Unable to open key mapping file." +The call to fopen() failed; probably because the specified path is invalid or +.I dumpkeymap +does not have permission to read the file. +.TG "Unable to determine key mapping file size." +The call to fstat() failed, thus memory can not be allocated for loading the +file. +.TG "Unable to read key mapping file." +The call to fread() failed. +.PP +The following diagnostic messages have significance only when trying to print +the currently active key mapping when no +.I .keymapping +files have been mentioned on the command-line. +.TG "Unable to open event status driver." +The call to NXOpenEventStatus() failed. +.TG "Bad key mapping length." +The call to NXKeyMappingLength() returned a bogus value. +.TG "Unable to get current key mapping." +The call to NXGetKeyMapping() failed. +.PP +The following diagnostic messages have significance only when using +.I dumpkeymap +on a non-Apple/\c +.SM NeXT +platform. +.TG "Must specify at least one .keymapping file." +No +.I .keymapping +files were mentioned on the command-line. On non-Apple/\c +.SM NeXT +platforms, there is no concept of a currently active +.I .keymapping +file, so at least one file must be mentioned on the command-line. +.SH AUTHOR +Eric Sunshine <sunshine@sunshineco.com> wrote +.I dumpkeymap +and this document, the +.I "dumpkeymap user's manual." +Both +.I dumpkeymap +and this document are copyright \(co1999,2000 by Eric Sunshine +<sunshine@sunshineco.com>. All rights reserved. +.PP +The implementation of +.I dumpkeymap +is based upon information gathered on September 3, 1997 by Eric Sunshine +<sunshine@sunshineco.com> and Paul S. McCarthy <zarnuk@zarnuk.com> during an +effort to reverse engineer the format of the +.SM NeXT +.I .keymapping +file. diff --git a/xc/programs/Xserver/hw/kdrive/Imakefile b/xc/programs/Xserver/hw/kdrive/Imakefile index 3556c1946..96f45c2e8 100644 --- a/xc/programs/Xserver/hw/kdrive/Imakefile +++ b/xc/programs/Xserver/hw/kdrive/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.4 2000/09/15 15:19:00 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.5 2000/12/01 00:01:30 keithp Exp $ KDRIVE=. #include "Kdrive.tmpl" @@ -21,4 +21,5 @@ NormalLibraryTarget(kdrive,$(OBJS)) SpecialCObjectRule(kdrive,,$(EXT_DEFINES)) +InstallManPage(Xkdrive,$(MANDIR)) DependTarget() diff --git a/xc/programs/Xserver/hw/kdrive/Xkdrive.man b/xc/programs/Xserver/hw/kdrive/Xkdrive.man new file mode 100644 index 000000000..163f99269 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/Xkdrive.man @@ -0,0 +1,77 @@ +.\" $XFree86: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.2 2000/12/04 21:01:00 dawes Exp $ +.\" +.TH Xkdrive 1 +.SH NAME +Xkdrive \- tiny X server +.SH SYNOPSIS +.B Xvesa +.RI [ :display ] +.RI [ option ...] + +.B Xfbdev +.RI [ :display ] +.RI [ option ...] + +.B Xigs +.RI [ :display ] +.RI [ option ...] + +.B Xtrident +.RI [ :display ] +.RI [ option ...] + +.B Xsis530 +.RI [ :display ] +.RI [ option ...] + +.B Xtrio +.RI [ :display ] +.RI [ option ...] + +.B Xitsy +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xkdrive +is a family of X servers designed to be particularly small. This +manual page describes the common functionality of the +.B Xkdrive +servers; for information on a specific X server, please refer to the +relevant manual page. +.SH OPTIONS +In addition to the standard options accepted by all X servers (see +Xserver(1)), all the +.B Xkdrive +servers accept the following options: +.TP 8 +.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR]\fB +use a screen of the specified size. +.TP 8 +.B -zaphod +disable switching screens by moving the pointer accross a screen boundary. +.TP 8 +.B -3button +disable emulation of a middle mouse button by chording. +.TP 8 +.B -2button +enable emulation of a middle mouse button by chording. +.TP 8 +.B -dumb +disable hardware acceleration. +.TP 8 +.B -softCursor +disable the hardware cursor. +.TP 8 +.B -card \fIcard\fB +not documented. +.TP 8 +.B -videoTest +not documented. +.TP 8 +.B -standalone +not documented. +.SH SEE ALSO +X(1), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1). +.SH AUTHORS +The Xkdrive common core was written by Keith Packard, based on XFree86 +which, in turn, is based on the Sample Implementation of X. diff --git a/xc/programs/Xserver/hw/kdrive/fbdev/Imakefile b/xc/programs/Xserver/hw/kdrive/fbdev/Imakefile index 9542e2051..4f371869d 100644 --- a/xc/programs/Xserver/hw/kdrive/fbdev/Imakefile +++ b/xc/programs/Xserver/hw/kdrive/fbdev/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/Imakefile,v 1.2 2000/09/03 05:11:17 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/Imakefile,v 1.3 2000/12/01 00:01:31 keithp Exp $ KDRIVE=.. #include "../Kdrive.tmpl" @@ -11,4 +11,5 @@ INCLUDES = $(KDINCS) -I. NormalLibraryObjectRule() NormalLibraryTarget(fbdev,$(OBJS)) +InstallManPage(Xfbdev,$(MANDIR)) DependTarget() diff --git a/xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man b/xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man new file mode 100644 index 000000000..abfb75590 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man @@ -0,0 +1,28 @@ +.\" $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man,v 1.2 2000/12/04 21:01:00 dawes Exp $ +.\" +.TH Xfbdev 1 +.SH NAME +Xvesa \- Linux framebuffer device tiny X server +.SH SYNOPSIS +.B Xfbdev +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xfbdev +is a generic X server for Linux. +.B Xfbdev +doesn't know about any particular hardware, and uses the framebuffer +provided by the Linux framebuffer device. +.SH OPTIONS +.B Xfbdev +accepts the common options of the Xkdrive family of servers. Please +see Xkdrive(1). +.SH KEYBOARD +To be written. +.SH SEE ALSO +X(1), Xserver(1), Xkdrive(1), xdm(1), xinit(1). +.SH AUTHORS +The +.B Xfbdev +server was written by Keith Packard. + diff --git a/xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man b/xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man index 04ae7f154..7c046733e 100644 --- a/xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man +++ b/xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man @@ -1,7 +1,7 @@ -.\" $XFree86: xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man,v 1.3 2000/10/20 00:19:50 keithp Exp $ +.\" $XFree86: xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man,v 1.4 2000/12/01 00:01:32 keithp Exp $ .TH Xvesa 1 .SH NAME -Xvesa \- VESA VBE tiny X server +Xvesa \- VESA Bios Extensions tiny X server .SH SYNOPSIS .B Xvesa .RI [ :display ] @@ -13,15 +13,14 @@ is a generic X server for Linux on the x86 platform. doesn't know about any particular hardware, and sets the video mode by running the video BIOS in VM86 mode. .B Xvesa -therefore runs untrusted code with full priviledges, and is one of the -most insecure X servers available. +can use both standard VGA BIOS modes and any modes advertised by a +VESA BIOS if available. .B Xvesa -uses both standard VGA BIOS modes and any modes advertised by a VESA 2.0 -BIOS if available. +runs untrusted code with full privileges, and is therefore a fairly +insecure X server. .B Run at your own risk. .SH OPTIONS -In addition to the normal tiny-X server's options (to be described in -a separate man page), +In addition to the normal KDrive server's options (see Xkdrive(1)), .B Xvesa accepts the following command line switches: .TP 8 @@ -30,13 +29,13 @@ specifies the VESA video mode to use. If mode .I n is not supported by your BIOS and hardware, .B Xvesa -will fail, hang your system, or make your monitor explode; you are on -your own. This option overrides any +will fail, hang your system, or cause your monitor to explode; you are +on your own. This option overrides any .B -screen options. .TP 8 .B -listmodes -tells the server to list all supported video modes. If +list all supported video modes. If .B -force was specified before .BR -listmodes , @@ -46,12 +45,12 @@ the server won't be able to use. .TP 8 .B -force -disables some sanity checks and use the specified mode even if the +disable some sanity checks and use the specified mode even if the BIOS claims not to support it. .TP 8 .B -shadow use a shadow framebuffer even if it is not strictly necessary. This -may dramatically improve performance on some machines. +may dramatically improve performance on some hardware. .TP 8 .B -nolinear don't use a linear framebuffer even if one is available. You don't @@ -59,22 +58,19 @@ want to use this option. .TP 8 .B -swaprgb pass RGB values in the order that works on broken BIOSes. Use this if -the colours are wrong in PseudoColor modes. +the colours are wrong in PseudoColor and 16 colour modes. .TP 8 .B -verbose emit diagnostic messages during BIOS initialization and teardown. .SH KEYBOARD -Xvesa handles the keyboard in the same manner as the -.B Xfbdev -Linux X server. See Xfbdev(1) (not yet written) for more information. +To be written. .SH BUGS .B Xvesa -opens all IO ports and runs your VESA BIOS, which may safely be -assumed to be buggy. Allowing your users to run +opens all IO ports and runs your VESA BIOS, which may be assumed to be +buggy. Allowing your users to run .B Xvesa -is a major security hole. Allowing yourself to run -.B Xvesa -is probably a mistake. +is probably a security hole. + .B Xvesa records the current BIOS mode when it starts and restores that mode on termination; if the video card has been reprogrammed by another application, @@ -82,10 +78,9 @@ the display will almost certainly be trashed. The alternative of saving and restoring the complete video card state has proven unreliable on most video cards. .SH SEE ALSO -X(1), Xserver(1), xdm(1), xinit(1), Xfbdev(1). +X(1), Xserver(1), Xkdrive(1), xdm(1), xinit(1). .SH AUTHORS -The tiny-X server was written by Keith Packard, and the VESA driver -was added by Juliusz Chroboczek who didn't realise what he was doing -until it was too late. Tiny-X uses code from XFree86, which in turn -is based on the Sample Implementation. Keith Packard then added support for -standard VGA BIOS modes and is especially proud of 320x200 16 color mode. +The VESA driver was written by Juliusz Chroboczek who didn't realise +what he was doing until it was too late. Keith Packard then added +support for standard VGA BIOS modes and is especially proud of 320x200 +16 colour mode. diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG index 9a99365a8..35f3f623d 100644 --- a/xc/programs/Xserver/hw/xfree86/CHANGELOG +++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG @@ -1,3 +1,187 @@ +XFree86 4.0.1h (4 December 2000) +1088. Fix key mapping for the '\' key on GB keyboards in Solaris 8. +1087. Status doc updates for Neomagic an NVIDIA (#4334, Andrew C. Aitchison, + Mark Vojkovich). +1086. Updated Rage 128 DRI support from the DRI CVS (Gareth Hughes, VA Linux). +1085. Updates for Hurd support (#A.209, Marcus Brinkmann). +1084. Bump the minor revisions of libXmu (UTF8_STRING) and libX11 + (Xutf8LookupString). +1083. Fixes for all known bugs in the CompoundText parser and generator, + including: + * While adding a charset: + - Adding a charset with two different escape sequences (e.g. + ISO-8859-14) led to broken behaviour of the converter. Moreover + the second added would have priority over the first added. + - If an invalid escape sequence was detected by _XlcParseCharSet, it + was still used when generating compound text. + - Extended segment charsets with varying number of bytes per character + were treated like those with 1 byte per character. + - _XlcAddCT failed to copy its ct_sequence argument, thus leading to + bugs when this argument was a dynamically allocated string. + - Missing detection of different charsets having the same escape + sequence. + * Parsing Compound Text: + - The functions _XlcParseCT and _XlcGetCTInfo did not perform range + checks on the strings being parsed. Danger of core dump through + out-of-bounds string access if a malicious client provides malformed + text. + - Builtin extended segment charsets were not recognized because the + strncmp in _XlcGetCTInfo was returning false most of the time, due + to the embedded length bytes. + - Extended segment charsets in general would not be deactivated after + the specified number of bytes. + - In _XlcCheckCTSequence, extended segments with invalid embedded + length bytes would lead to out-of-bounds string accesses as well. + - Unrecognized escape sequences did not lead to a return value > 0. + - Left-to-right and right-to-left indicators (starting with 0x9b) were + just ignored, without leading to a return value > 0. + - If the source string was larger than the intermediate buffer, + multibyte characters could be split into pieces, leading to + conversion errors. + * Generating Compound Text: + - The length embedded in an extended segment prefix was always wrong. + - Long strings could give rise to extended segments with a length that + doesn't fit in the allowed 14 bits. + - After an extended segment, GL or GR designators would unnecessarily + be repeated. + - Bytes in the range 0x81..0x88, 0x8b..0x9a, 0x9c..0x9f in multibyte + encodings could not be output, would be thrown away. + - Byte 0x9b could not be output in the UTF-8 charset. + * udcInf.c was generating invalid Compound Text (invalid length in + extended segment). + * lcConv.c: If in the indirect converter, the first step led to no + output, the second step would still be called, possibly leading to + out-of-bounds accesses. + * lcUTF8.c: had knowledge about JISX0208.1983-0 but not about + JISX0208.1990-0. + (#4333, Bruno Haible). +1082. Fix documentation for XSetOMValues() (#4332, Bruno Haible). +1081. Fix namespace polution in <X11/Xlib.h> introduced with patch #4293 + (#4331, Bruno Haible). +1080. Fix a bug in the newly introduced Xutf8LookupString() function that + loses input not representable in the locale encoding (#4330, + Bruno Haible). +1079. Avoid four new gcc warnings about const in lcUTF8.c introduced by + patch #4293 (#4329, Bruno Haible). +1078. Fix some additional cases of confusing local typedef for wchar_t + (#4328, Bruno Haible). +1077. Fix some round-trip conversion errors in COMPOUND_TEXT -> UTF8_STRING -> + COMPOUND_TEXT due to wrong tables introduced by patches #4214, 4215 + (#4327, Pablo Saratxaga). +1076. Cygwin update for building Xrender DLL (#4326, Suhaib M. Siddiqi). +1075. Fix an undefined SUBDIRS in xc/lib/GL/mesa/src/drv/Imakefile when + compiling on something other than x86, alpha or sparc (#4325, + Brian Paul). +1074. Don't have the neomagic driver disable stretching when a mode that + fills the panel is selected (#4324, Andrew C. Aitchison). +1073. Fix a bug in Xlib's _XimLocalMbLookupString() that causes a crash when + a zero keycode keypress event is received (#4322, HIBINO Kei). +1072. NetBSD doesn't have perl in its default install (Matthieu Herrb). +1071. Add Xft support to xditview with #ifdefs (Keith Packard) +1070. Add a MIT-MAGIC-COOKIE-1 generator to startx for NetBSD 1.5 and OpenBSD + and FreeBSD and make mkcookie support more generic (Matthieu Herrb). +1069. Update OpenBSD and NetBSD docs (Matthieu Herrb). +1068. Clean up r128_video.c again (Marc La France). +1067. Fix ATI clock generator recognition when an adapter BIOS cannot be + retrieved (Linus Torvalds). +1066. Fix int10 and ATI driver for video BIOSes larger than 64kB + (Marc La France). +1065. Change xf86MatchDevice() to initialise its return pointer and clean up + drivers accordingly (Marc La France). +1064. Fix for bug in new imConv.c (#4318, Ivan Pascal). +1063. Fix for FreeBSD sysmouse support (#4317, from FreeBSD ports collection). +1062. Enable the ru_SU local entries for FreeBSD (based on patch from FreeBSD + ports collection). +1061. Driver for the S3 Savage family of chips (#4315, 4316, 4319-4321, + Tim Roberts). +1060. Add xkb definitions for the Logitech cordless keyboard (#4314, + Michel Goraczko). +1059. Add support for "unicode keysym" to XKeysymToString() and + XStringToKeysym() (#4313, Ivan Pascal). +1058. SiS driver updates, including: + - Performance tuning for sis630 + - Support XV extension for sis630 + - Support Chrontel TV for sis630 + (#4312, Can-Ru Yeou). +1057. Fix Xrender library to handle strings > 254 chars long. + Change Xrender and Xft interfaces to use 'unsigned int' + instead of 'unsigned long' for 32-bit glyph values. + (Keith Packard) +1056. Fix neomagic driver mangled acceleration test (#4309, 4310, + Chip Salzenberg). +1055. Add a rudimentary driver for the SGI Indy's newport cards (only + 8-bit and non-accelerated so far) (#4308, Guido Guenther). +1054. Fix a bug in rman that is provoked by the new dumpkeymap man page + (David Dawes). +1053. Updates to the dumpkeymap utility, and add documentation (including + a man page) (#4307, Eric Sunshine). +1052. Add -version and -showconfig options to the Darwin Xserver, and print + the usual "XFree86" banner message (#4306, Torrey T. Lyons). +1051. Fix i810 crash when running XFree86 -configure (#4305, Ryan Drake). +1050. Linux APM fix, which fixes a problem that shows up with the neomagic + driver after an APM suspend (#4304, 4311, Chip Salzenberg). +1049. Correct maximum ranges for Wacom IV devices (#4303, Frederic Lepied). +1048. Add preliminary support for USB input devices under Linux (wacom + driver (#4303, MATSUMURA Namihiko). +1047. Locale fixes/cleanups, including: + - Cleanup garbage in XLC_LOCALES. + - Add "use_stdc_env' to locales where it was absent. + - Move non-standard charset descriptions from the lcCT.c table to + the XLC_LOCALE files. + (#4302, Ivan Pascal). +1046. Make sure the correct "driverName" string is used in xf86Configure.c. +1045. Fix some i810 driver problems when too little videoRam is specified + (David Dawes). +1044. Fix an i810 driver bug that prevents the DRI from being enabled + after a server reset (Jeff Hartmann). +1043. Add a "dri" config file option to the i810 driver that can be used + to enable/disable the DRI (no other method works for statically + linked servers) (David Dawes, from VA's 7.0.1). +1042. Update the i810 driver to check the max available GART memory + (Jeff Hartmann, David Dawes, from VA's 7.0.1). +1041. Resync DRI code/drivers with the DRI CVS (VA Linux). Includes + 3dfx driver updates (Daryll Strauss). +1040. Fix a couple of clipping problems on the Trident CyberBlade/Blade3d + chipsets (Alan Hourihane). +1039. Fix a couple of Alpha related issues (Jay Estabrook). +1038. Change Xft interface (again) to use new XftColor datatype for + colors instead of XRenderColor. xterm and x11perf updated to + match. (Keith Packard) +1037. Fix an i810 init problem that resulted in the fallback to 2D failing + for one case where there's insufficient memory to enable the DRI + (David Dawes, from VA's 7.0.1). +1036. Add support for printing a vendor-specific version string in the + X server startup messages (David Dawes, from VA's 7.0.1). +1035. Xwd workaround for a gcc bug (Red Hat's XFree86-4.0.1-xwd-gcc-workaround + patch). +1034. Fixes for sparc drivers, mostly to prevent accessing the hardware + when the server doesn't have control of the VT (Red Hat's + XFree86-4.0.1-ffb patch). +1033. Use OS-provided interface for accessing PCI config space on Linux/ia64 + (based on Red Hat's XFree86-4.0.1-ia64-pci patch). +1032. Use AsmDefines when processing the Sparc assembler code for cfb + (based on Red Hat's XFree86-4.0-sparc-asmflags patch). +1031. Add PAM authentication to the X server (based on Red Hat's + XFree86-4.0-Xwrapper patch). +1030. Add Slovenian and Romanian entries to XKB's keymap/xfree86 file + (Red Hat's XFree86-4.0-si_xkb patch and XFree86-4.0-ro_xkb.patch). +1029. Fix for PAM support in xdm SessionExit() (Red Hat's + XFree86-4.0-pamsession patch). +1028. XlibInt.c patch to avoid buffer overflow (Red Hat's + XFree86-3.3.6-fixemacs patch). +1027. Updates to xfs from Red Hat and Debian, including: + - command line options to make xfs drop it's root privs (-droppriv + and -user) - command line options to make xfs start as a daemon, + and a build option to make this the default. + - don't let a port option in the config file override the -port + command line option + - cleanup/fix syslogging + (based on #4253, Debian, and Red Hat's XFree86-4.0-xfsredhat patch). +1026. Support for startx to set up the Xauth when starting an X server + (based on Red Hat's XFree86-4.0-startx_xauth patch). +1025. Fix an unaligned access on Alpha with the tdfx driver (Jay Estabrook). +1024. Add detection for CyberBlade/Ai1 Socket A chipsets (Alan Hourihane). + XFree86 4.0.1g (29 November 2000) 1023. Fix small bug in lcGeneric.c (#4301, Ivan Pascal). 1022. Rewrite Xft library for Render extension/core text and font management @@ -11698,4 +11882,4 @@ XFree86 3.0a (28 April 1994) XFree86 3.0 (26 April 1994) -$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1420 2000/11/29 18:12:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1443 2000/12/05 00:31:58 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile index 9ac94f282..35ec8419a 100644 --- a/xc/programs/Xserver/hw/xfree86/common/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.123 2000/11/03 18:46:05 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.124 2000/12/01 00:24:33 dawes Exp $ @@ -168,11 +168,13 @@ OFILES = \ OSNAME = OSName OSVENDOR = OSVendor OSNAMEDEF = -DOSNAME='" $(OSNAME)"' -DOSVENDOR='" $(OSVENDOR)"' +#if defined(XFree86CustomVersion) +CUSTOMVERSION = XFree86CustomVersion + CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)' +#endif #if defined(BuilderString) BUILDERSTRING = BuilderString BUILDERMSG = -DBUILDERSTRING='$(BUILDERSTRING)' -#else - BUILDERMSG = #endif CONSDEFINES = XFree86ConsoleDefines EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES) @@ -190,7 +192,7 @@ XCONFIGUREDEFINES = -DXF86CONFIGFILE='"$(XF86CONFIGFILE)"' AllTarget($(OFILES)) SpecialCObjectRule(xf86Bus,NullParameter,$(BUGMSG) $(VGAINCLUDES)) -SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG) $(BUGMSG) $(EXT_DEFINES) $(BETADEFS)) +SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG) $(BUGMSG) $(CUSTOMVERDEF) $(EXT_DEFINES) $(BETADEFS)) SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(xf86Globals,$(ICONFIGFILES),$(EXT_DEFINES) $(MODPATHDEFINES) $(LOGDEFINES)) SpecialCObjectRule(xf86Config,$(ICONFIGFILES),$(XCONFIGDEFINES)) diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c index ae6e3dd66..2885b824b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.44 2000/11/18 19:37:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.45 2000/12/01 21:03:32 paulo Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. * @@ -348,6 +348,7 @@ configureScreenSection (int screennum) display = xf86confmalloc(sizeof(XF86ConfDisplayRec)); memset((XF86ConfDisplayPtr)display,0,sizeof(XF86ConfDisplayRec)); display->disp_depth = depths[i]; + display->disp_black.red = display->disp_white.red = -1; ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem( (glp)ptr->scrn_display_lst, (glp)display); } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c index d6c1e4549..d3675e4fc 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.103 2000/11/18 19:37:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.105 2000/12/02 15:30:28 tsi Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -1455,6 +1455,9 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist) confScreenPtr screensecptr; int i,j; + if (sectlist) + *sectlist = NULL; + if (xf86DoProbe) return 1; if (xf86DoConfigure && xf86DoConfigurePass1) return 1; @@ -1645,7 +1648,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID, for (i = 0; i < allocatedInstances; i++) { if (instances[i].foundHW) { actualcards++; - pGDev = xf86AddDeviceToConfigure(driverName, + pGDev = xf86AddDeviceToConfigure(drvp->driverName, instances[i].pci, -1); if (pGDev) { /* @@ -1902,7 +1905,7 @@ xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) { if (FindIsaDevice && ((foundChip = (*FindIsaDevice)(NULL)) != -1)) { - xf86AddDeviceToConfigure(driverName, NULL, foundChip); + xf86AddDeviceToConfigure(drvp->driverName, NULL, foundChip); return 1; } return 0; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c index 68af62445..049ebe66c 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.172 2000/11/27 05:06:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.173 2000/12/01 00:24:33 dawes Exp $ */ /* * Copyright 1991-1999 by The XFree86 Project, Inc. @@ -1568,7 +1568,11 @@ xf86PrintBanner() "please check the latest version in the XFree86 CVS repository\n" "(http://www.XFree86.Org/cvs)\n"); #endif - ErrorF("\nXFree86 Version%s/ X Window System\n", XF86_VERSION); + ErrorF("\nXFree86 Version%s", XF86_VERSION); +#ifdef XF86_CUSTOM_VERSION + ErrorF("(%s) ", XF86_CUSTOM_VERSION); +#endif + ErrorF("/ X Window System\n"); ErrorF("(protocol Version %d, revision %d, vendor release %d)\n", X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE ); ErrorF("Release Date: %s\n", XF86_DATE); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h index e933a3017..6cd7d1278 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.79 2000/11/29 09:16:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.82 2000/12/04 18:49:52 dawes Exp $ */ /* * PCI Probe * @@ -324,6 +324,8 @@ #define PCI_CHIP_8420 0x8420 #define PCI_CHIP_8500 0x8500 #define PCI_CHIP_8520 0x8520 +#define PCI_CHIP_8600 0x8600 +#define PCI_CHIP_8620 0x8620 #define PCI_CHIP_9320 0x9320 #define PCI_CHIP_9388 0x9388 #define PCI_CHIP_9397 0x9397 @@ -534,13 +536,19 @@ #define PCI_CHIP_Trio3D_2X 0x8A13 #define PCI_CHIP_VIRGE_DXGX 0x8A01 #define PCI_CHIP_VIRGE_GX2 0x8A10 -#define PCI_CHIP_Savage3D 0x8A20 -#define PCI_CHIP_Savage3D_MV 0x8A21 -#define PCI_CHIP_Savage4 0x8A22 -#define PCI_CHIP_Savage2000 0x9102 +#define PCI_CHIP_SAVAGE3D 0x8A20 +#define PCI_CHIP_SAVAGE3D_MV 0x8A21 +#define PCI_CHIP_SAVAGE4 0x8A22 +#define PCI_CHIP_SAVAGE2000 0x9102 #define PCI_CHIP_VIRGE_MX 0x8C01 #define PCI_CHIP_VIRGE_MXPLUS 0x8C01 #define PCI_CHIP_VIRGE_MXP 0x8C03 +#define PCI_CHIP_PROSAVAGE_PM 0x8A25 +#define PCI_CHIP_PROSAVAGE_KM 0x8A26 +#define PCI_CHIP_SAVAGE_MX_MV 0x8c10 +#define PCI_CHIP_SAVAGE_MX 0x8c11 +#define PCI_CHIP_SAVAGE_IX_MV 0x8c12 +#define PCI_CHIP_SAVAGE_IX 0x8c13 /* ARK Logic */ #define PCI_CHIP_1000PV 0xA091 @@ -905,6 +913,8 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_8420, "CyberBlade/DSTN/i7",0}, {PCI_CHIP_8500, "CyberBlade/i1",0}, {PCI_CHIP_8520, "CyberBlade/DSTN/i1",0}, + {PCI_CHIP_8600, "CyberBlade/Ai1",0}, + {PCI_CHIP_8620, "CyberBlade/DSTN/Ai1",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ALI, { @@ -1383,10 +1393,16 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_VIRGE_VX, "ViRGE/VX",0}, {PCI_CHIP_VIRGE_DXGX, "ViRGE/DX or /GX",0}, {PCI_CHIP_VIRGE_GX2, "ViRGE/GX2",0}, - {PCI_CHIP_Savage3D, "Savage3D (86E391)",0}, - {PCI_CHIP_Savage3D_MV, "Savage3D+MacroVision (86E390)",0}, - {PCI_CHIP_Savage4, "Savage4",0}, - {PCI_CHIP_Savage2000, "Savage2000",0}, + {PCI_CHIP_SAVAGE3D, "Savage3D (86E391)",0}, + {PCI_CHIP_SAVAGE3D_MV, "Savage3D+MacroVision (86E390)",0}, + {PCI_CHIP_SAVAGE4, "Savage4",0}, + {PCI_CHIP_SAVAGE2000, "Savage2000",0}, + {PCI_CHIP_SAVAGE_MX, "Savage/MX",0}, + {PCI_CHIP_SAVAGE_MX_MV, "Savage/MX-MV",0}, + {PCI_CHIP_SAVAGE_IX, "Savage/IX",0}, + {PCI_CHIP_SAVAGE_IX_MV, "Savage/IX-MV",0}, + {PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133",0}, + {PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133",0}, {PCI_CHIP_VIRGE_MX, "ViRGE/MX",0}, {PCI_CHIP_VIRGE_MXPLUS, "ViRGE/MX+",0}, {PCI_CHIP_VIRGE_MXP, "ViRGE/MX+MV",0}, diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c index 9b221349d..5f711f87b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.3 2000/06/20 16:01:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.4 2000/12/01 15:28:10 dawes Exp $ */ #include <ctype.h> #include <stdio.h> @@ -436,7 +436,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId, int actualcards = 0; for (i = 0; i < allocatedInstances; i++) { actualcards++; - pGDev = xf86AddBusDeviceToConfigure(driverName, BUS_SBUS, + pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS, instances[i].sbus, -1); if (pGDev) { /* diff --git a/xc/programs/Xserver/hw/xfree86/doc/DESIGN b/xc/programs/Xserver/hw/xfree86/doc/DESIGN index c359e4db0..9e7a4dd4b 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/DESIGN +++ b/xc/programs/Xserver/hw/xfree86/doc/DESIGN @@ -2,7 +2,7 @@ The XFree86 Project, Inc - Last modified 1 May 2000 + Last modified 2 December 2000 NOTE: This is a DRAFT document, and the interfaces described here are subject to change without notice. @@ -415,7 +415,6 @@ was loaded) and a reference count which keeps track of how many screens are using the driver. The entry driver entry points are those required prior to the driver allocating and filling in its ScrnInfoRec. - For a static server, the xf86DriverList[] array is initialised at build time, and the loading of modules is not done. @@ -466,16 +465,17 @@ Probe() function of each registered video driver is called. The purpose of this is to identify all instances of hard- ware supported by the driver. The flags value is cur- - rently either PROBE_DEFAULT or PROBE_DETECT. PROBE_DETECT - is used if "-configure" or "-probe" command line argurments - are given and indicates to the Probe() function that it - should not configure the PCI entities. + rently either 0, PROBE_DEFAULT or PROBE_DETECT. + PROBE_DETECT is used if "-configure" or "-probe" command + line arguments are given and indicates to the Probe() + function that it should not configure the bus entities + and that no XF86Config information is available. The probe must find the active device sections that match the driver by calling xf86MatchDevice(). The number of matches found limits the maximum number of instances for - this driver. If no matches are found, the function should - return FALSE immediately. + this driver. If no matches are found, the function + should return FALSE immediately. Devices that cannot be identified by using device-inde- pendent methods should be probed at this stage (keeping @@ -3208,9 +3208,7 @@ The XF86VideoAdaptorRec: video stream be scaled to rectangle of drw_w by drw_h on the screen. Since it is not expected that all hardware will be able to get the target dimensions exactly, it is - important that the driver provide this function. The - returned dimensions must be less than or equal to the - requested dimension. + important that the driver provide this function. typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, @@ -5630,8 +5628,7 @@ NOTE: The xf86DrvMsg() functions cannot be used from the Probe. /* add screen to entity */ } } - if (numUsed > 0) - xfree(usedChips); + xfree(usedChips); } #ifdef HAS_ISA_DEVS @@ -5662,8 +5659,7 @@ NOTE: The xf86DrvMsg() functions cannot be used from the Probe. foundScreen = TRUE; } } - if (numUsed > 0) - xfree(usedChips); + xfree(usedChips); #endif /* HAS_ISA_DEVS */ xfree(devSections); @@ -6306,7 +6302,7 @@ eScreen() function. ZZZFreeRec(xf86Screens[scrnIndex]); } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.32 2000/08/28 18:24:14 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.39 2000/12/04 18:49:54 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.29 2000/09/05 01:47:44 robin Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.33 2000/12/04 19:47:21 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/Imakefile index 272ebc4ce..ed8c19149 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/doc/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/33 1996/10/28 05:12:24 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.69 2000/11/06 22:07:05 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.70 2000/12/01 19:47:44 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> @@ -60,6 +60,7 @@ HWREADME = \ /*ReadmeFile(Mach32)*/ \ /*ReadmeFile(Mach64)*/ \ /*ReadmeFile(MGA)*/ \ + ReadmeFile(newport) \ /*ReadmeFile(NVIDIA)*/ \ /*ReadmeFile(Oak)*/ \ /*ReadmeFile(P9000)*/ \ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Install b/xc/programs/Xserver/hw/xfree86/doc/Install index 1522642a6..ced646815 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Install +++ b/xc/programs/Xserver/hw/xfree86/doc/Install @@ -1,4 +1,4 @@ - Installation Details for XFree86[tm] 4.0.1 + Installation Details for XFree86[tm] 4.0.2 The XFree86 Project, Inc @@ -19,11 +19,11 @@ balls" identified by the .tgz suffix). Along with the binaries we provide a customized version of the GNU tar utility called "extract" and an installa- tion script. We recommend that these be used to install the binaries. -2. Downloading the XFree86 4.0.1 binaries +2. Downloading the XFree86 4.0.2 binaries -We, The XFree86 Project, provide XFree86 4.0.1 binaries for a range of oper- +We, The XFree86 Project, provide XFree86 4.0.2 binaries for a range of oper- ating systems at our ftp site -<URL:ftp://ftp.xfree86.org/pub/XFree86/4.0.1/binaries/>. Often during +<URL:ftp://ftp.xfree86.org/pub/XFree86/4.0.2/binaries/>. Often during releases, our ftp site is heavily loaded. Instead of downloading directly from us we recommend that instead you use one of our mirror sites. Another advantage of using our mirror sites is that some of them support http access @@ -108,9 +108,9 @@ NOTES: If you miss some and want to install them later, go to the Manual Installa- tion (section 4., page 1) section. -3. Installing XFree86 4.0.1 using the Xinstall.sh script +3. Installing XFree86 4.0.2 using the Xinstall.sh script -We strongly recommend that our XFree86 4.0.1 binaries be installed using the +We strongly recommend that our XFree86 4.0.2 binaries be installed using the Xinstall.sh script that we provide. There are a lot of steps in the manual installation process, and those steps can vary according to the platform and hardware setup. There is a description of the manual installation process @@ -227,7 +227,7 @@ later that you need it, you can create it easily by running: The next step is to configure the X server. That is covered in detail in an as-yet unwritten document :-(. In the meantime, there are two ways to create -a basic X server configuration file for XFree86 4.0.1. One is to run the +a basic X server configuration file for XFree86 4.0.2. One is to run the xf86config utility. Another is to use the new -configure X server option: XFree86 -configure @@ -241,9 +241,9 @@ old XF86_* and/or XF98_* X server binaries from /usr/X11R6/bin. After the X server configuration is done, it may be advisable to reboot, especially if you run xdm (or equivalent) or the font server (xfs). -4. Installing XFree86 4.0.1 manually +4. Installing XFree86 4.0.2 manually -This section describes how to manually install the XFree86 4.0.1 binary dis- +This section describes how to manually install the XFree86 4.0.2 binary dis- tributions. You should only use this method if you know what you're doing. The information here covers some common cases, but not every possible case. @@ -347,4 +347,4 @@ Once that's done, the main part of the installation can be done: Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.7 2000/07/03 16:51:11 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.6 2000/07/03 16:51:32 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.7 2000/12/01 19:47:44 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/LICENSE b/xc/programs/Xserver/hw/xfree86/doc/LICENSE index 19f1b6903..a16673c84 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/LICENSE +++ b/xc/programs/Xserver/hw/xfree86/doc/LICENSE @@ -595,4 +595,4 @@ For further information, contact: Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7 2000/03/06 22:59:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.10 2000/06/17 17:44:20 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.11 2000/12/01 19:47:45 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes b/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes index 86f8a2e00..b39511bee 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes +++ b/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes @@ -226,4 +226,4 @@ Well, you see, this was quite easy :-) $XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.16 2000/06/17 17:44:20 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.17 2000/12/01 19:47:45 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README b/xc/programs/Xserver/hw/xfree86/doc/README index 1b004e4e0..ff349ebd4 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README +++ b/xc/programs/Xserver/hw/xfree86/doc/README @@ -1,4 +1,4 @@ - README for XFree86[tm] 4.0.1 + README for XFree86[tm] 4.0.2 The XFree86 Project, Inc @@ -10,9 +10,9 @@ supports several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operating systems on Intel and other platforms. -1. What is XFree86 4.0.1? +1. What is XFree86 4.0.2? -XFree86 4.0.1 is a the upgrade to the first full release in the new XFree86 4 +XFree86 4.0.2 is a the upgrade to the first full release in the new XFree86 4 series. Release 4 is a major re-design of the basic architectural underpin- nings of XFree86's implementation of the original X Consortium's X Server. This re-design allows for a modular interaction between the hardware drivers @@ -24,7 +24,7 @@ installing the new driver module and updating the configuration file. The road to XFree86 Release 4 began as an architectural concept in mid 1997, with the serious framework being implemented in code the beginning of 1998. There were several snapshots on the road to 4.0 which are now part of the 4.0 -base release. The 4.0.1 version is an upgrade to 4.0, which include more +base release. The 4.0.2 version is an upgrade to 4.0.1, which include more hardware ports, code enhancements and bug fixes. Release 4 also included the long-awaited integration of the DRI (Direct Ren- @@ -118,29 +118,29 @@ Once your work is finished (coded, debugged and documented) please send your fix to <fixes@XFree86.org>. This will ensure that they are included in future releases. And thanks! You make this truly an Open group. -4. How to get XFree86 4.0.1 +4. How to get XFree86 4.0.2 -XFree86 4.0.1 can be found at the XFree86 ftp server -<URL:ftp://ftp.xfree86.org/pub/XFree86/4.0.1/>, and at mirrors of this +XFree86 4.0.2 can be found at the XFree86 ftp server +<URL:ftp://ftp.xfree86.org/pub/XFree86/4.0.2/>, and at mirrors of this server. Information about obtaining and installing binary distributions of this release can be found in the Installation Document. Information about obtaining the release in source form is given below. -The source for version 4.0.1 is split into three tarballs: X401src-1.tgz, -X401src-2.tgz, X401src-3.tgz. The first contains everything except the fonts +The source for version 4.0.2 is split into three tarballs: X402src-1.tgz, +X402src-2.tgz, X402src-3.tgz. The first contains everything except the fonts and general X11 documentation. It is sufficient for building XFree86 is you already have a set of fonts. The second contains the fonts and the source for the general X11 documentation. The third contains the general X11 docu- mentation in hardcopy format. -A source patch relative to version 4.0 is also available. Because of its -size, it is split into two parts. The patch files are 4.0-4.0.1.diff1.gz and -4.0-4.0.1.diff2.gz. These patches should be applied to a clean 4.0 source -tree, working from the directory containing the xc/ directory. The patches -should be applied by running: +A source patch relative to version 4.0.1 is also available. Because of its +size, it is split into two parts. The patch files are 4.0.1-4.0.2.diff1.gz +and 4.0.1-4.0.2.diff2.gz. These patches should be applied to a clean 4.0.1 +source tree, working from the directory containing the xc/ directory. The +patches should be applied by running: - gunzip < 4.0-4.0.1.diff1.gz | patch -p0 -E - gunzip < 4.0-4.0.1.diff2.gz | patch -p0 -E + gunzip < 4.0.1-4.0.2.diff1.gz | patch -p0 -E + gunzip < 4.0.1-4.0.2.diff2.gz | patch -p0 -E The contrib part of the distribution has been folded into the main source tree, so a separate contrib tarball is no longer required. @@ -160,4 +160,4 @@ reproduce and debug your problem. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.107 2000/07/02 16:35:56 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.106 2000/07/03 16:30:34 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.107 2000/12/01 19:47:45 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DECtga b/xc/programs/Xserver/hw/xfree86/doc/README.DECtga index 6377a9a04..b48be24d2 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DECtga +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DECtga @@ -6,7 +6,7 @@ 1. DEC 21030 - o The DEC 21030 is supported by XFree86 4.0.1. The driver is now par- + o The DEC 21030 is supported by XFree86 4.0.2. The driver is now par- tially accelerated. The built-in graphics on the Multia is supported in 8-plane mode, and PCI cards with 8 or 16 MB framebuffers are supported in 24-plane mode. TGA2 (aka PowerStorm 3D30/4D20) cards are not cur- @@ -65,4 +65,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DECtga.sgml,v 3.9 2000/03/06 22:59:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.16 2000/06/17 17:44:20 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.17 2000/12/01 19:47:46 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI index 78b231d90..ce89d4218 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRI +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI @@ -2,7 +2,7 @@ VA Linux Systems, Inc. Professional Services - Graphics. - 24 October 2000 + 20 November 2000 1. Preamble @@ -183,9 +183,9 @@ See the DRI Compilation Guide for information on compiling the DRI kernel modules. XFree86 4.0.1 added automatic kernel module loading to the X server. On -Linux, the X server uses modprobe to load kernel modules. The DRM kernel -modules should be in /lib/modules/KERNEL-VERSION/misc/ for automatic loading -to work. +Linux, the X server uses modprobe to load kernel modules. In Linux 2.4.x the +DRM kernel modules should be kept in /lib/modules/2.4.x/ker- +nel/driver/char/drm/ for automatic loading to work. Optionally, DRM kernel modules can be loaded manually with insmod prior to starting the X server. @@ -261,7 +261,11 @@ may require four times the memory used for a simple 2D display. If your graphics card doesn't have a lot of memory (less than 16MB, for exam- ple), you may have to reduce your screen size and/or color depth in order to -use 3D features. +use 3D features. Reducing the screen resolution will also leave more space +for texture images, possibly improving 3D performance. If, for example, you +play Quake3 at 1024x768 but start your display at 1600x1200 you might con- +sider restarting X at 1024x768 in order to maximize your texture memory +space. The documentation included with your card should have information about maxi- mum screen size when using 3D. @@ -295,11 +299,12 @@ A simple GLUT/OpenGL program may be compiled and linked as follows: The -I option is used to specify where the GL/glut.h (and possibly the GL/gl.h and GL/glu.h) header file may be found. -The -L options specify where the libglut.so, libGLU.so and X libraries are -located. +The -L options specify where the libglut.so and the X libraries are located. +libGL.so and libGLU.so should be in /usr/lib, as specified by the +Linux/OpenGL ABI standard. The -lglut -lGLU -lGL arguments specify that the application should link with -the GLUT, GLU and GL libraries. +the GLUT, GLU and GL libraries, in that order. 8.3 Running your OpenGL program @@ -316,13 +321,15 @@ trouble shooting section. 8.4 libOSMesa.so OSMesa (Off-Screen Mesa) is an interface and driver for rendering 3D images -into a user-allocated block of memory rather than an on-screen window. +into a user-allocated block of memory rather than an on-screen window. It +was originally developed for Mesa before Mesa became part of the XFree86/DRI +project. It can now be used with the XFree86/DRI libGL.so as well. -libOSMesa.so implements the OSMesa interface and must be linked with your +libOSMesa.so implements the OSMesa interface and it must be linked with your application if you want to use the OSMesa functions. You must also link with libGL.so. For example: - gcc osdemo.c -L/usr/X11R6/lib -lOSMesa -lGLU -lGL -o osdemo + gcc osdemo.c -lOSMesa -lGLU -lGL -o osdemo In stand-alone Mesa this interface was compiled into the monolithic libGL.so (formerly libMesaGL.so) library. In XFree86 4.0.1 and later this interface @@ -352,9 +359,9 @@ unaccelerated rendering is being used. If you see that indirect rendering is being used when direct rendering was expected, proceed to the troubleshooting section. -glxinfo also lists all of the GLX-enhanced visuals available. Here you can -determine which visuals may have depth buffers, stencil buffers, accumulation -buffers, etc. +glxinfo also lists all of the GLX-enhanced visuals available so you can +determine which visuals are double-bufferd, have depth (Z) buffers, stencil +buffers, accumulation buffers, etc. 8.6 Environment Variables @@ -546,8 +553,8 @@ The Screen section should then reference the Voodoo3 device: EndSection The kernel module for the Voodoo3 is named tdfx.o and should be installed in -/lib/modules/KERNEL-VERSION/misc/. It will be automatically loaded by the -Xserver if needed. +/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +by the Xserver if needed. The DRI 3D driver for the Voodoo3 hould be in /usr/X11R6/lib/mod- ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. @@ -557,7 +564,7 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. o If you try to run an OpenGL application and see an error message similar to - gd error (glide): gd error (glide): grSstSelect: non-existent SSTgd error (glide): grSstSelect: non-existent SSTS + gd error (glide): gd error (glide): grSstSelect: non-existent SSTgd error (glide): grSstSelect: non-existent SSTS it means that you have the wrong version of the Glide library for your hardware. @@ -664,8 +671,8 @@ The Screen section should then reference the Voodoo3 device: EndSection The kernel module for the Voodoo5 is named tdfx.o and should be installed in -/lib/modules/KERNEL-VERSION/misc/. It will be automatically loaded by the -Xserver if needed. +/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +by the Xserver if needed. The DRI 3D driver for the Voodoo5 hould be in /usr/X11R6/lib/mod- ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. @@ -759,8 +766,8 @@ The Screen section should then reference the i810 device: EndSection The kernel module for the i810 is named i810.o and should be installed in -/lib/modules/KERNEL-VERSION/misc/. It will be automatically loaded by the -Xserver if needed. +/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +by the Xserver if needed. The DRI 3D driver for the i810 should be in /usr/X11R6/lib/mod- ules/dri/i810_dri.so. This will be automatically loaded by libGL.so. @@ -834,22 +841,68 @@ To use a 32bpp screen mode, use this Screen section instead: EndSection The kernel module for the G200/G400 is named mga.o and should be installed in -/lib/modules/KERNEL-VERSION/misc/. It will be automatically loaded by the -Xserver if needed. +/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +by the Xserver if needed. The DRI 3D driver for the G200/G400 should be in /usr/X11R6/lib/mod- ules/dri/mga_dri.so. This will be automatically loaded by libGL.so. 10.4.3 Performance -No data at this time. +Software rendering will be used under any of the following conditions: -10.4.4 Known Problems + o Using glDrawBuffer(GL_FRONT_AND_BACK). - o Multitexture is currently disabled on the G400 to work around a hardware - lockup bug. This should be restored in a subsequent release. + o Using point, line, or triangle smoothing. - o 32bpp mode has not been tested on the G400 at this time. + o Using glLogicOp. + + o Using glPolygonStipple or glLineStipple. + + o Using 1D or 3D textures. + + o Using the accumulation buffer. + +10.4.4 IRQ Assignment + +There have been problems in the past with the MGA driver being very sluggish +when the DRI is enabled (to the point of being unusable.) This is caused by +the graphics card not having an interrupt assigned to it. The current DRI +trunk will attempt to detect this condition and bail outgracefully. + +The solution to the above problem is to assign an interrupt to your graphics +card. This is something you must turn on in your system BIOS configuration. +Please consult your system BIOS manual for instructions on how to enable an +interrupt for your graphics card. + +10.4.5 MGA HAL lib + +MGAHALlib.a is a binary library Matrox has provided for use under Linux to +expose functionality for which they can not provide documentation. (For +example TV-Out requires MacroVision be enabled on the output.) This binary +library also sets the pixel/memory clocks to the optimial settings for your +Matrox card. + +Currently the MGAHAL library is required for the G450 to work. You can down- +load this from the driver section on Matrox's website: www.matrox.com/mga + +Here modifications to the DRI build instructions which make the mga ddx +driver use the MGAHAL library: + + 1.Put the following define in your host.def file + #define UseMatroxHal YES + 2. Place mgaHALlib.a in the following directory + xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib/ + +You can use DualHead on the G400/G450 DH cards by creating two device sec- +tions which both point to the same BusID. For most AGP devices the BusID +will be "PCI:1:0:0". Configure your screen section as you would normally +configure XFree86 4.x Multihead. It should be noted that currently the sec- +ond head does not support direct rendering. + +10.4.6 Known Problems + +None. 10.5 ATI Rage 128 @@ -894,8 +947,8 @@ The Screen section should then reference the Rage 128 device: EndSection The kernel module for the Rage 128 is named r128.o and should be installed in -/lib/modules/KERNEL-VERSION/misc/. It will be automatically loaded by the -Xserver if needed. +/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +by the Xserver if needed. The DRI 3D driver for the Rage 128 should be in /usr/X11R6/lib/mod- ules/dri/r128_dri.so. This will be automatically loaded by libGL.so. @@ -940,14 +993,12 @@ GLXPixmap rendering is only supported for indirect rendering contexts. This is a common OpenGL limitation. Attempting to use a direct rendering context with a GLXPixmap will result in an X protocol error. -11.3 Signal Handling +11.3 Debugging -There are several understood, but unresolved problems relating to hardware -locking and signal handling. Hitting CTRL-z to suspend a 3D application can -sometimes cause the X server to lock-up if executing device driver code at -that moment. Also, using a debugger to step through OpenGL/Mesa device -driver functions code could cause a lock-up. These problems will be fixed in -the future. +Debugging DRI drivers with gdb can be difficult because of the locking +involved. When debugging OpenGL applications, you should avoid stepping +inside the GL functions. If you're trying to debug a DRI driver it's recom- +mended that you do so remotely, from a second system. 11.4 Scheduling @@ -1027,7 +1078,7 @@ forge.net/resources/resources.html o In the future there may be IHV and Linux vendor support resources for the DRI. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.12 2000/11/16 18:36:25 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.13 2000/12/01 14:28:55 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.10 2000/11/16 18:37:34 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.11 2000/12/01 19:47:46 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp index 8a0a8ea33..d2d81ddea 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp @@ -51,97 +51,112 @@ You'll need the following: o ssh (secure shell) for registered developer downloading of the DRI source tree + o A recent Linux Kernel. See below for details. + + o FreeBSD support is not currently being maintained and may not work. + For 3dfx Voodoo3 hardware, you'll also need: o Glide3x headers and runtime library if you want to use the 3dfx driver. These can be obtained from linux.3dfx.com. - o Linux kernel 2.2.x. The DRI developers have been using stock RedHat 6.1 - systems (kernel 2.2.12-20). Later kernel versions will be supported in - the future. + o A recent Linux 2.4.x kernel. AGP support is not required. For Matrox G200/G400 hardware, you'll also need: - o Linux kernel 2.3.51. Older kernel versions will not work. + o A recent Linux 2.4.x kernel with AGP support. For Intel i810 hardware, you'll also need: - o Linux kernel 2.3.99-pre6. Older kernel versions will not work. + o A recent Linux 2.4.x kernel with AGP support. For ATI Rage hardware, you'll also need: - o Linux kernel 2.3.51. Other kernel versions may work but this one is - known to work. + o A recent Linux 2.4.x kernel with AGP support. + +4. Linux Kernel Preparation -4. Kernel preparation +The DRI project closely tracks Linux kernel development. Since the internal +Linux data structures change frequently in the 2.4 development branch it's +important to have use the most recent Linux kernel. As of this writing (Nov +2000), 2.4.0-test11-pre5 is the most recent version of Linux which the DRI is +synchronized to. -You may have to upgrade your Linux kernel in order to use the DRI. This is -because you need a kernel version which supports AGP. Building a new Linux -kernel can be difficult for beginners but there are resources on the Internet -to help. This document assumes experience with configuring, building and -installing Linux kernels. +Most of the DRI drivers require AGP support and using Intel Pentium III SSE +optimizations also requires an up-to-date Linux kernel. + +Building a new Linux kernel can be difficult for beginners but there are +resources on the Internet to help. This document assumes experience with +configuring, building and installing Linux kernels. Linux kernels can be downloaded from www.kernel.org -Download the needed kernel and put it in /usr/src. Create a directory for -the source and unpack it. For example: +Here are the basic steps for kernel setup. + + o Download the needed kernel and put it in /usr/src. Create a directory + for the source and unpack it. For example: - cd /usr/src - rm -f linux - mkdir linux-2.3.51 - ln -s linux-2.3.51 linux - bzcat linux-2.3.51.tar.bz2 | tar xf - + cd /usr/src + rm -f linux + mkdir linux-2.4.x + ln -s linux-2.4.x linux + bzcat linux-2.4.x.tar.bz2 | tar xf - -Now configure your kernel. You might, for example, use make menuconfig and -do the following: + o Configure your kernel. You might, for example, use make menuconfig and + do the following: - o Go to Code maturity level options + o Go to Code maturity level options - o Enable Prompt for development and/or incomplete code/drivers + o Enable Prompt for development and/or incomplete code/drivers - o hit ESC + o hit ESC to return to the top-level menu - o Go to Character devices + o Go to Character devices - o Disable Direct Rendering Manager (XFree86 DRI support) since we'll use - the DRI module from the XFree86/DRI tree. + o Disable Direct Rendering Manager (XFree86 DRI support) since we'll + use the DRI module from the XFree86/DRI tree. - o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW) + o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW) - o Hit SPACE twice + o Hit SPACE twice to build AGP support into the kernel - o Enable all chipsets' support for AGP + o Enable all chipsets' support for AGP -It's recommended that you turn on MTRRs under Processor type and Features, -but not required. + o It's recommended that you turn on MTRRs under Processor type and + Features, but not required. -Configure the rest of the kernel as required for your system (i.e. Ethernet, -SCSI, etc) + o Configure the rest of the kernel as required for your system (i.e. Eth- + ernet, SCSI, etc) -Exit, saving your kernel configuration. + o Exit, saving your kernel configuration. -Edit your /etc/lilo.conf file. Make sure you have an image entry as follows -(or similar): + o Edit your /etc/lilo.conf file. Make sure you have an image entry as + follows (or similar): - image=/boot/vmlinuz - label=linux.2.3.51 - read-only - root=/dev/hda1 + image=/boot/vmlinuz + label=linux.2.4.x + read-only + root=/dev/hda1 -The important part is that you have /boot/vmlinuz without a trailing version -number. If this is the first entry in your /etc/lilo.conf AND you haven't -set a default, then this will be your default kernel. + The important part is that you have /boot/vmlinuz without a trailing + version number. If this is the first entry in your /etc/lilo.conf AND + you haven't set a default, then this will be your default kernel. -Now compile the new kernel: + o Compile the new kernel. - cd /usr/src/linux-2.3.51 - make dep ; make bzImage - make modules ; make modules_install - make install + cd /usr/src/linux-2.4.x + make dep + make bzImage + make modules + make modules_install + make install -Note that the final part, make install, will automatically run lilo for you. + Note that last make command will automatically run lilo for you. -Now reboot to use this new kernel. + o Upgrade your modutils package for Linux 2.4.x if you're upgrading from + Linux 2.2.x. + + o Now reboot to use the new kernel. 5. Downloading the XFree86/DRI CVS Sources @@ -323,12 +338,12 @@ using the right version of the Linux kernel. The most recent kernels are not always supported. If your build machine is running a different version of the kernel than your -target machine (i.e. 2.2.12-20 vs. 2.3.99-pre6), make will select the wrong -kernel headers. This can be fixed by explicitly setting the value of TREE. -If the path to your kernel source is /bigdisk/linux-2.3.99-pre6, +target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel +headers. This can be fixed by explicitly setting the value of TREE. If the +path to your kernel source is /usr/src/linux-2.4.x, cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel - make TREE=/bigdisk/linux-2.3.99-pre6 + make TREE=/usr/src/linux-2.4 or alternatively, edit Makefile to include this change. @@ -336,6 +351,18 @@ After fixing the errors, run make World again. Later, you might just compile parts of the source tree but it's important that the whole tree will build first. +7.5 DRI kernel module installation + +The DRI kernel modules are in ~/DRI-CVS/build/xc/pro- +grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/. + +To load the appropriate DRI module in your running kernel you can either use +ismod and restart your X server or copy the kernel module to /lib/mod- +ules/2.4.x/kernel/driver/char/drm/ then run depmod and restart your X server. + +Make sure you first unload any older DRI kernel modules that might be already +loaded. + 8. Normal Installation and Configuration Most users will want to install the new X server and use it instead of the @@ -486,7 +513,7 @@ At this point your X server should be up and running with hardware-acceler- ated direct rendering. Please read the DRI User Guide for information about trouble shooting and how to use the DRI-enabled X server for 3D applications. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.7 2000/11/08 05:03:03 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.8 2000/12/01 14:28:55 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.4 2000/11/16 15:50:04 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.5 2000/12/01 19:47:46 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.I128 b/xc/programs/Xserver/hw/xfree86/doc/README.I128 index dd4d65e4a..dfcc279e6 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.I128 +++ b/xc/programs/Xserver/hw/xfree86/doc/README.I128 @@ -100,4 +100,4 @@ and special help from: Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/I128.sgml,v 1.5 2000/11/06 22:03:28 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.I128,v 1.7 2000/11/06 22:07:05 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.I128,v 1.8 2000/12/01 19:47:46 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS b/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS index 7ff3816d1..05e190d43 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS +++ b/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS @@ -1,4 +1,4 @@ - README for XFree86 4.0.1 on LynxOS + README for XFree86 4.0.2 on LynxOS Thomas Mueller @@ -13,19 +13,19 @@ ments as well as many bug fixes. See the Copyright Notice. -The sources for XFree86 4.0.1 are available by anonymous ftp from: +The sources for XFree86 4.0.2 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.1 +ftp://ftp.XFree86.org/pub/XFree86/4.0.2 Binaries of XFree86 for LynxOS x86 are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.1/binaries/LynxOS +ftp://ftp.XFree86.org/pub/XFree86/4.0.2/binaries/LynxOS A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR- RORS The binaries on the FTP site were built on the latest released LynxOS version -at the time XFree86 4.0.1 was released. In this case it is `LynxOS x86 +at the time XFree86 4.0.2 was released. In this case it is `LynxOS x86 3.0.1'. Because of changes made to the object format they don't run on LynxOS versions earlier than 3.0.0. @@ -37,7 +37,7 @@ this OS release was not available long enough for serious testing `LynxOS 3.1.0' support has to be considered to be in `alpha state'. Initial tests were performed on LynxOS x86 only! -XFree86 4.0.1 supports LynxOS on the x86 and on the PowerPC platform. X +XFree86 4.0.2 supports LynxOS on the x86 and on the PowerPC platform. X servers are currently available only on the x86 platform. The X server may work with some PowerPC platforms supported by LynxOS though this has not (yet) been thoroughly tested. @@ -163,7 +163,7 @@ to 3.5 X Server debug diagnostics output and other VT peculiarities Output made by the XFree86 X on its stdout or stderr will be lost after the -server switches to graphics mode. The XFree86 4.0.1 server stores its output +server switches to graphics mode. The XFree86 4.0.2 server stores its output in /usr/adm/XFree86.n.log (where n is the screen number). When the X server is running output made to other consoles will be lost. @@ -266,4 +266,4 @@ duplicate entries: Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LynxOS.sgml,v 3.20 2000/06/17 00:27:32 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.27 2000/06/17 17:44:20 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.28 2000/12/01 19:47:46 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD index 3dedb18df..b9c7542f5 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD +++ b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD @@ -1,8 +1,8 @@ - README for XFree86 4.0.1 on NetBSD + README for XFree86 4.0.2 on NetBSD Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb - Last modified on: 1 July 2000 + Last modified on: 2 December 2000 1. What and Where is XFree86? @@ -15,13 +15,12 @@ See the Copyright Notice. The sources for XFree86 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.1 +ftp://ftp.XFree86.org/pub/XFree86/4.0.2 Binaries for NetBSD 1.3 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.1/binaries/NetBSD +ftp://ftp.XFree86.org/pub/XFree86/4.0.2/binaries/NetBSD -A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR- -RORS +A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml XFree86 also builds on other NetBSD architectures. See section Building on other architectures (section 8.3, page 1) for details. @@ -35,24 +34,37 @@ if you have comments or suggestions about this file and we'll revise it. 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.0.1. +See the Release Notes for non-OS dependent new features in XFree86 4.0.2. -3.1 New OS dependent features in 4.0.1 +3.1 New OS dependent features in 4.0.2 + + o A fix for libXmu OS detection which was broken since unix isn't defined + anymore by the C preprocessor. + + o (limited) native wscons support. This is not activated by default. + + o Updates to the aperture driver + + o Support for multithread libraries with GNU pth + + o Add /usr/pkg/bin to the default user path. + +3.2 New OS dependent features in 4.0.1 o Support for NetBSD 1.5_ALPHA o The Xsun server can be built on NetBSD/sparc -3.2 New OS dependent features in 4.0 +3.3 New OS dependent features in 4.0 o Preliminary APM support. -3.3 New OS dependent features in 3.9.18 +3.4 New OS dependent features in 3.9.18 o Soft-booting secondary cards through the int10 BIOS interface is now possible using the x86emu real mode emulator. -3.4 New OS dependent features in 3.9.17 +3.5 New OS dependent features in 3.9.17 o Support for silken mouse with the wsmouse protocol has been added. @@ -93,7 +105,7 @@ Only standard PS/2 mice are supported by this driver. Newest PS/2 mice that send more than three bytes at a time (especially Intellimouse, or MouseMan+ with a ``3D'' roller) are not supported yet. -XFree86 4.0.1 also has support for the mouse driver included in the new +XFree86 4.0.2 also has support for the mouse driver included in the new wscons console driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the protocol and ``/dev/wsmouse0'' as the device in /etc/XF86Config if you're using NetBSD 1.4 with wscons. @@ -200,14 +212,14 @@ By default NetBSD include the BSD 4.4 kernel security feature that disable access to the /dev/mem device when in multi-users mode. But XFree86 servers can take advantage (or require) linear access to the display memory. -Most XFree86 4.0.1 card drivers require linear memory access. There are two +Most XFree86 4.0.2 card drivers require linear memory access. There are two ways to allow XFree86 to access linear memory: The first way is to disable the kernel security feature by adding ``option INSECURE'' in the kernel configuration file and build a new kernel. The second way is to install the aperture driver, included in source form in -xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.0.1 source +xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.0.2 source distribution. Unpack it in a new directory of your choice by running: sh apNetBSD.shar @@ -274,7 +286,7 @@ And finally run make World in the xc directory. 8.2 Console drivers XFree86 has a configuration option to select the console drivers to use in -xf86site.def: +host.def: o if you're using pccons put: @@ -284,9 +296,17 @@ xf86site.def: #define XFree86ConsoleDefines -DPCVT_SUPPORT -If you don't define XFree86ConsoleDefines in xf86site.def the pccons and pcvt +If you don't define XFree86ConsoleDefines in host.def the pccons and pcvt drivers will be supported by default. +Experimental native support for the wscons console driver can be built by +adding: + + #define XFree86ConsoleDefines -DWSCONS_SUPPORT + +to xc/config/host.def before rebuilding the server. This has not been tor- +oughly tested, except on the macppc. + 8.3 Building on other architectures Note that the NetBSD project has now its own source tree, based on the @@ -294,6 +314,9 @@ XFree86 source tree, with some local modifications. You may want to start with this tree to rebuild from sources. The NetBSD xsrc source tree is available at: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/xsrc/ +There's an experimental patch by Tsubai Masanari to make XFree86 4.0.1 work +on NetBSD/macppc at: ftp://nandra.iri.co.jp/pub/NetBSD/macppc/XFree86/README. + 9. Building New X Clients The easiest way to build a new client (X application) is to use xmkmf if an @@ -324,7 +347,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.56 2000/07/02 02:35:27 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.57 2000/12/02 15:27:09 herrb Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.70 2000/07/02 02:46:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.73 2000/12/04 21:01:00 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD index 1e89a7e40..84696018a 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD +++ b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD @@ -1,8 +1,8 @@ - README for XFree86 4.0.1 on OpenBSD + README for XFree86 4.0.2 on OpenBSD Matthieu Herrb - Last modified on: 1 July 2000 + Last modified on: 2 December 2000 1. What and Where is XFree86? @@ -13,16 +13,15 @@ ments as well as many bug fixes. See the Copyright Notice. -The sources for XFree86 4.0.1 are available by anonymous ftp from: +The sources for XFree86 4.0.2 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.1 +ftp://ftp.XFree86.org/pub/XFree86/4.0.2 -Binaries for OpenBSD/i386 2.6 and later are available from: +Binaries for OpenBSD/i386 2.8 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.1/binaries/OpenBSD +ftp://ftp.XFree86.org/pub/XFree86/4.0.2/binaries/OpenBSD -A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR- -RORS +A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml XFree86 also builds on other OpenBSD architectures. See section Building on other architectures (section 8.2, page 1) for details. @@ -34,9 +33,18 @@ if you have comments or suggestions about this file and we'll revise it. 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.0.1. +See the Release Notes for non-OS dependent new features in XFree86 4.0.2. -3.1 New OS dependent features in 4.0.1 +3.1 New OS dependent features in 4.0.2 + + o Support for the OpenBSD ports tree + + o Preliminary support for the powerpc architecture (clients build and + work, the server doesn't work yet) + + o Xdm now writes an utmp entry + +3.2 New OS dependent features in 4.0.1 o Several features from the OpenBSD X11 tree were merged into xdm: @@ -55,21 +63,21 @@ See the Release Notes for non-OS dependent new features in XFree86 4.0.1. o The Xsun server can be built again on OpenBSD/sparc. -3.2 New OS dependent features in 4.0 +3.3 New OS dependent features in 4.0 o Multi-thread safe libraries are built by default on OpenBSD 2.6 and later, o Preliminary APM support. -3.3 New OS dependent features in 3.9.18 +3.4 New OS dependent features in 3.9.18 o Support for USB mices has been added on OpenBSD. o Soft-booting secondary cards through the int10 BIOS interface is now possible using the x86emu real mode emulator. -3.4 New OS dependent features in 3.9.17 +3.5 New OS dependent features in 3.9.17 o Silken mouse is supported for serial mices, and, under post 2.6 OpenBSD- current for PS/2 mices. @@ -216,7 +224,7 @@ directory. 8.1 Console drivers XFree86 has a configuration option to select the console drivers to use in -xf86site.def: +host.def: o if you're using pccons only put: @@ -226,8 +234,16 @@ xf86site.def: #define XFree86ConsoleDefines -DPCVT_SUPPORT -If you don't define XFree86ConsoleDefines in xf86site.def the pccons and pcvt -drivers will be supported. +If you don't define XFree86ConsoleDefines in host.def the pccons and pcvt +drivers will be supported by default. + +Experimental native support for the wscons console driver found on +OpenBSD/powerpc and on OpenBSD/i386 -current can be built by adding: + + #define XFree86ConsoleDefines -DWSCONS_SUPPORT + +to xc/config/host.def before rebuilding the server. This has not been tor- +oughly tested, except on the macppc. 8.2 Building on other architectures @@ -248,7 +264,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.11 2000/07/02 02:35:27 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.12 2000/12/02 15:27:09 herrb Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.13 2000/07/02 02:46:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.16 2000/12/04 21:01:00 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.SiS b/xc/programs/Xserver/hw/xfree86/doc/README.SiS index 17cd1ad79..339ee77c9 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.SiS +++ b/xc/programs/Xserver/hw/xfree86/doc/README.SiS @@ -113,4 +113,4 @@ Document based on 3.3 version written by Xavier Ducoin. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SiS.sgml,v 3.7 2000/03/06 22:59:24 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SiS,v 3.15 2000/06/17 17:44:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SiS,v 3.16 2000/12/01 19:47:48 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.apm b/xc/programs/Xserver/hw/xfree86/doc/README.apm index 99d9b03c3..7c821ad7d 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.apm +++ b/xc/programs/Xserver/hw/xfree86/doc/README.apm @@ -111,4 +111,4 @@ be possible to add support for the 3210 chipset if someone needs it. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/apm.sgml,v 1.3 2000/03/08 05:38:43 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.apm,v 1.7 2000/06/17 17:44:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.apm,v 1.8 2000/12/01 19:47:48 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ati b/xc/programs/Xserver/hw/xfree86/doc/README.ati index 66bba12c8..7cd6232d1 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.ati +++ b/xc/programs/Xserver/hw/xfree86/doc/README.ati @@ -674,4 +674,4 @@ Intel architectures. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.33 2000/08/09 02:19:23 tsi Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.51 2000/08/12 01:23:59 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.52 2000/12/01 19:47:48 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.chips b/xc/programs/Xserver/hw/xfree86/doc/README.chips index 6a47eb359..23d8180c4 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.chips +++ b/xc/programs/Xserver/hw/xfree86/doc/README.chips @@ -7,7 +7,7 @@ 1. Introduction -With the release of XFree86 version 4.0.1, the Chips and Technologies driver +With the release of XFree86 version 4.0.2, the Chips and Technologies driver has been extensively rewritten and contains many new features. This driver must be considered work in progress, and those users wanting stability are encouraged to use the older XFree86 3.3.x versions. However this version of @@ -277,19 +277,19 @@ Screen, Monitor, Device. allows the user to select a different clock for the server to use when returning to the text console. - Option "FPClock8" "65.0" - Option "FPClock16" "65.0" Option "FPClock24" "65.0" Option - "FPClock32" "65.0"" In general the LCD panel clock should be set - independently of the modelines supplied. Normally the chips BIOS - set the flat panel clock correctly and so the default behaviour - with HiQV chipset is to leave the flat panel clock alone, or - force it to be 90% of the maximum allowable clock if the current - panel clock exceeds the dotclock limitation due to a depth - change. This option allows the user to force the server the - reprogram the flat panel clock independently of the modeline with - HiQV chipset. The four options are for 8bpp or less, 16, 24 or - 32bpp LCD panel clocks, where the options above set the clocks to - 65MHz. + Option "FPClock8" "65.0MHz" + Option "FPClock16" "65.0MHz" Option "FPClock24" "65.0MHz" + Option "FPClock32" "65.0MHz"" In general the LCD panel clock + should be set independently of the modelines supplied. Normally + the chips BIOS set the flat panel clock correctly and so the + default behaviour with HiQV chipset is to leave the flat panel + clock alone, or force it to be 90% of the maximum allowable clock + if the current panel clock exceeds the dotclock limitation due to + a depth change. This option allows the user to force the server + the reprogram the flat panel clock independently of the modeline + with HiQV chipset. The four options are for 8bpp or less, 16, 24 + or 32bpp LCD panel clocks, where the options above set the clocks + to 65MHz. Option "MMIO" This has a different effect depending on the hardware on which it @@ -377,11 +377,6 @@ Screen, Monitor, Device. evant for chipsets more recent than the ct65555 and only when used with a DSTN LCD. - Option "UseFB" - Force the new framebuffer (fb) code to be used in place of its - older counterpart (cfb). The sense of this option will probably - be reversed when fb becomes the default. - Option "Overlay" The HiQV chipsets contain a multimedia engine that allow a 16bpp window to be overlayed on the screen. This driver uses this capa- @@ -808,6 +803,16 @@ cause damage. colour depths. However, 8 and 24 bit colour depths seem to work fine. + My ct69030 machine locks up when starting XFree + The ct69030 chipset introduced a new dual channel architecture. + In its current form, XFree can not take advantage of this second + display channel. In fact if the video BIOS on the machine sets + the ct69030 to a dual channel mode by default, XFree will lockup + hard at this point. The solution is to use the BIOS setup to + change to a single display channel mode, ensuring that both the + IOSS and MSS registers are set to a single channel mode. Work is + underway to fix this. + I can't start X-windows with 16, 24 or 32bpp Firstly, is your machine capable of 16/24/32bpp with the mode specified. Many LCD displays are incapable of using a 24bpp mode. @@ -824,7 +829,7 @@ cause damage. startx -- -depth 24 -fbbpp 32 8-8-8 RGB truecolor - however as XFree86 version 4.0.1 allows 32bpp pixmaps to be used + however as XFree86 version 4.0.2 allows 32bpp pixmaps to be used with framebuffers operating in 24bpp, this mode of operating will cost performance for no gain in functionality. @@ -894,7 +899,7 @@ Contributors (In no particular order) We also thank the many people on the net who have contributed by reporting bugs and extensively testing this server. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.32 2000/10/27 18:31:02 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.33 2000/12/02 21:52:22 dbateman Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.33 2000/11/06 22:07:05 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.35 2000/12/04 19:47:24 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.cyrix b/xc/programs/Xserver/hw/xfree86/doc/README.cyrix index 92bd56365..457e3d3f8 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.cyrix +++ b/xc/programs/Xserver/hw/xfree86/doc/README.cyrix @@ -50,4 +50,4 @@ lowing Cyrix CPUs with integrated graphics: Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/cyrix.sgml,v 1.3 2000/03/08 05:38:43 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cyrix,v 1.7 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cyrix,v 1.8 2000/12/01 19:47:49 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.fonts b/xc/programs/Xserver/hw/xfree86/doc/README.fonts index af43461d4..c52eb458e 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.fonts +++ b/xc/programs/Xserver/hw/xfree86/doc/README.fonts @@ -788,4 +788,4 @@ only provides support for horizontal writing. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.8 2000/11/14 16:54:49 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.11 2000/11/16 15:50:04 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.12 2000/12/01 19:47:49 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.i740 b/xc/programs/Xserver/hw/xfree86/doc/README.i740 index c422029e3..bf790fdd8 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.i740 +++ b/xc/programs/Xserver/hw/xfree86/doc/README.i740 @@ -178,4 +178,4 @@ http://www.precisioninsight.com Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i740.sgml,v 1.3 2000/03/04 00:26:30 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i740,v 1.7 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i740,v 1.8 2000/12/01 19:47:49 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.i810 b/xc/programs/Xserver/hw/xfree86/doc/README.i810 index b02c18bf9..7807628d9 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.i810 +++ b/xc/programs/Xserver/hw/xfree86/doc/README.i810 @@ -107,4 +107,4 @@ http://www.precisioninsight.com Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:00:30 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.4 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.5 2000/12/01 19:47:49 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.isc b/xc/programs/Xserver/hw/xfree86/doc/README.isc index 857379cda..83627198d 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.isc +++ b/xc/programs/Xserver/hw/xfree86/doc/README.isc @@ -489,4 +489,4 @@ tribute to this excellent piece of free software. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/isc.sgml,v 3.24 2000/03/06 22:59:25 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.38 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.39 2000/12/01 19:47:50 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.mouse b/xc/programs/Xserver/hw/xfree86/doc/README.mouse index e491d69ec..89dadc30f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.mouse +++ b/xc/programs/Xserver/hw/xfree86/doc/README.mouse @@ -6,7 +6,7 @@ 1. Introduction -This document describes mouse support in XFree86 4.0.1. +This document describes mouse support in XFree86 4.0.2. Mouse configuration has often been mysterious task for novice users. How- ever, once you learn several basics, it is straightforward to write the mouse @@ -928,4 +928,4 @@ wheel's movement will be reported as the buttons 6 and 7. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.11 2000/03/01 00:25:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.10 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.11 2000/12/01 19:47:50 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.newport b/xc/programs/Xserver/hw/xfree86/doc/README.newport new file mode 100644 index 000000000..f67024303 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/doc/README.newport @@ -0,0 +1,44 @@ + Information for newport Users + + Guido Guenther + + 1 August 2000 + +1. Supported Hardware + +This is an unaccelerated driver for the SGI Indy's newport cards. Both the +8bit and 24bit versions are tested and working with some limitations(see +below). The 24bit newport additionally works in 8bit mode only. + +2. Notes + + o X -configure does not generate a XF86Config file + +3. Configuration + +The following Section "Device" options are supported by the newport driver: + + o Option "bitplanes" "x" Gives the maximum number of bitplanes your card + supports (8 or 24). + +4. Authors + + o Guido Guenther <guido.guenther@gmx.net> + +5. Acknowledgements + + o Gleb O. Raiko <raiko@niisi.msk.ru> for getting the beast to build + + o Ralf Baechle <ralf@oss.sgi.com> for his patience... + + o Ulf Carlsson <ulfc@calypso.engr.sgi.com> for comments and the dynamic + loader code + + o Nina A. Podolskaya <nap@niisi.msk.ru> for dynamic loader code + + o all the guys who wrote the newport_con linux kernel code + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.1 2000/12/01 19:37:57 dawes Exp $ + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.1 2000/12/01 19:47:50 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.r128 b/xc/programs/Xserver/hw/xfree86/doc/README.r128 index b8534be6b..a666b3035 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.r128 +++ b/xc/programs/Xserver/hw/xfree86/doc/README.r128 @@ -119,4 +119,4 @@ http://www.suse.com Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml,v 1.8 2000/06/14 00:16:09 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.r128,v 1.12 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.r128,v 1.13 2000/12/01 19:47:51 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.rendition b/xc/programs/Xserver/hw/xfree86/doc/README.rendition index 62f0aff0f..bc9db34bd 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.rendition +++ b/xc/programs/Xserver/hw/xfree86/doc/README.rendition @@ -145,4 +145,4 @@ on the list of features to be included. Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/rendition.sgml,v 1.12 2000/06/17 02:30:33 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rendition,v 1.11 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rendition,v 1.12 2000/12/01 19:47:51 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.s3virge b/xc/programs/Xserver/hw/xfree86/doc/README.s3virge index 07a1a4c50..8b878827e 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.s3virge +++ b/xc/programs/Xserver/hw/xfree86/doc/README.s3virge @@ -6,11 +6,12 @@ 1. Supported hardware -The s3virge driver in XFree86 4.0.1 supports the S3 ViRGE, ViRGE DX, GX, MX, +The s3virge driver in XFree86 4.0.2 supports the S3 ViRGE, ViRGE DX, GX, MX, MX+, and VX chipsets. A majority of testing is done on ViRGE DX chips, mak- -ing them the most stable to date. This release has improved support for 24 -bit color depths and resolves all the known issues with Netscape and other -applications supporting 24 bit color. +ing them the most stable to date. This release has improved support for +ViRGE GX2 stability, XVideo support for ViRGE DX (tested) and ViRGE +(untested) in depth 16 and 24, conversion to fb framebuffer rendering, and +support for the new Render extension (untested). This driver is moderately stable, however please use caution with any new install. Please report any problems to <XFree86@Xfree86.org> using the @@ -59,7 +60,7 @@ tact our support email address <XFree86@Xfree86.org> o Kevin Brosius <Cobra@compuserve.com> - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.2 1999/07/10 12:17:25 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.3 2000/11/28 20:59:17 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.5 2000/06/17 17:44:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.6 2000/12/01 19:47:51 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES index 4e8eec711..77b6cb4ea 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES +++ b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES @@ -1,4 +1,4 @@ - Release Notes for XFree86[tm] 4.0.1 + Release Notes for XFree86[tm] 4.0.2 The XFree86 Project, Inc @@ -7,7 +7,7 @@ Abstract This document contains some information about the features present - in XFree86 4.0.1 and their status. + in XFree86 4.0.2 and their status. 1. Introduction to the 4.x Release Series @@ -16,17 +16,17 @@ represents a significant redesign of the XFree86 X server. Not all of the hardware drivers from 3.3.x have been ported to 4.x yet, but conversely, 4.x has some hardware support not present in 3.3.x. We've attempted to provide some information about the second point in our Driver Status document. -Please check there first before downloading 4.0.1. +Please check there first before downloading 4.0.2. The 4.0.1 has a new configuration tool, "xf86cfg". It is work in progress, but definitely worth trying out. We have also updated the basic text-based -tool "xf86config" to generate config files in the format required by 4.0.1 -(3.3.x config files won't really work with 4.0.1). We're also on a configu- +tool "xf86config" to generate config files in the format required by 4.0.2 +(3.3.x config files won't really work with 4.0.2). We're also on a configu- ration tool that is built-in to the X server. An early version of this is included in the release, and it works well for some hardware. To try it out, just run (as root) "XFree86 -configure". Each of these configuration options will give you a reasonable starting point for a suitable configuration file. -We've put some effort into documenting the 4.0.1 config file format, and you +We've put some effort into documenting the 4.0.2 config file format, and you can find that information in the XF86Config manual page. Check that, the driver manual pages and the related documentation for further information. @@ -40,12 +40,12 @@ Finally, before you download and install the binary distributions for this release, please have a quick read through the Installation Document. It may save you some time. -The next section describes what is new in the latest version (4.0.1). The +The next section describes what is new in the latest version (4.0.2). The other sections below describe some of the new features and changes between 3.3.x and 4.0. There is a lot of new features, and we definitely don't have enough space to cover it all here. -2. Summary of new features in 4.0.1. +2. Summary of new features in 4.0.2. 2.1 X server @@ -209,12 +209,12 @@ enough space to cover it all here. 3. The new X server Unlike XFree86 3.3.x where there are multiple X server binaries, each of -which drive different hardware, XFree86 4.0.1 has a single X server binary +which drive different hardware, XFree86 4.0.2 has a single X server binary called XFree86. This binary can either have one or more video drivers linked in statically, or, more usually, dynamically load the video drivers and other modules that are needed. -XFree86 4.0.1 has X server support for most UNIX(R) and UNIX-like operating +XFree86 4.0.2 has X server support for most UNIX(R) and UNIX-like operating systems on Intel/x86 platforms, plus support for Linux on Alpha, PowerPC and Sparc platforms. Work on support for additional architectures and operating systems is in progress, and is planned for future releases. @@ -235,7 +235,7 @@ they do not need to be recompiled for every different operating system. In the future we plan to take advantage of this to provide more frequent driver module updates in between major releases. -The loader in version 4.0.1 has support for Intel (x86), Alpha and PowerPC +The loader in version 4.0.2 has support for Intel (x86), Alpha and PowerPC platforms. It also has preliminary support for Sparc platforms. The X server makes use of modules for video drivers, X server extensions, @@ -574,7 +574,7 @@ Known problems: 3.7 DGA version 2 -DGA 2.0 is included in 4.0.1, but is not implemented by all drivers. Prelim- +DGA 2.0 is included in 4.0.2, but is not implemented by all drivers. Prelim- inary documentation for the client libraries can be found in the README.DGA document. A good degree of backwards compatibility with version 1.0 is pro- vided. @@ -645,7 +645,7 @@ sion and some new features should be completed in a future release. 3.12 Drivers -XFree86 4.0.1 includes the following drivers: +XFree86 4.0.2 includes the following drivers: +------------+-------------------------------------+ |Driver Name | Description | @@ -791,6 +791,12 @@ ation at 8, 15, 16, and 24 bit depths (limited by some chips at some depths). Further information about this driver can be found in the 'glint' driver man page. +3.12.10 Trident + +The "trident" driver supports all PCI based Trident cards, including one ISA +based - the 8900D. 3.3.x is still needed for older SVGA ISA/VLB based cards, +yet 4.0.2 is much faster for the newer boards. + 4. X libraries and clients 4.1 Xaw @@ -1183,7 +1189,7 @@ location pointing to the new location. Some run-time generated files are now located under the appropriate subdirectories of /var, again with the relevant symbolic links in the old location. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.42 2000/07/03 16:27:10 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.43 2000/12/04 16:24:57 alanh Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.85 2000/07/03 16:30:35 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.87 2000/12/04 19:47:29 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Status b/xc/programs/Xserver/hw/xfree86/doc/Status index 6f99cdff6..905bf3b1f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Status +++ b/xc/programs/Xserver/hw/xfree86/doc/Status @@ -1,23 +1,23 @@ - Driver Status for XFree86[tm] 4.0.1 + Driver Status for XFree86[tm] 4.0.2 The XFree86 Project, Inc - 11 August 2000 + 4 December 2000 Abstract This document provides information about the status of the driver - and hardware support in XFree86 4.0.1 compared with that in XFree86 + and hardware support in XFree86 4.0.2 compared with that in XFree86 3.3.6. Please send updates for this document to <fixes@xfree86.org> 1. Introduction This document contains one section per vendor (organised alphabetically) for -each chipset family that is supported in XFree86 3.3.6 or XFree86 4.0.1. It +each chipset family that is supported in XFree86 3.3.6 or XFree86 4.0.2. It includes information about the status of the drivers and the hardware they support, including a comparison of the level of support between versions -3.3.6 and 4.0.1. +3.3.6 and 4.0.2. NOTE: Status information needs to be checked carefully and expanded where possible. E.g., include information about acceleration, multi-head, known @@ -31,7 +31,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support is provided by the XF86_SVGA server with the tdfx driver). - 4.0.1: + 4.0.2: Support for Voodoo 1 and Voodoo 2 via glide on platforms where glide is available (Linux and FreeBSD(?)). Support is provided by the "glide" driver (requires Glide 2x). @@ -40,7 +40,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support is provided by the "tdfx" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.1. + All hardware supported in 3.3.6 is also supported in 4.0.2. 3. 3Dlabs @@ -50,13 +50,13 @@ architectures known to work on (e.g., Alpha, PPC), etc. ramdacs), Permedia with IBM RGB526 ramdac, Permedia 2, 2a, 2v. Support is provided by the XF86_3DLabs server. - 4.0.1: + 4.0.2: Support (including acceleration) for Permedia, Permedia 2, 2v (and 2a??) GLINT 500TX, GLINT MX, GLINT Gamma, and Glint Delta coproc. Support is provided by the "glint" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.1. + All hardware supported in 3.3.6 is also supported in 4.0.2. 4. Alliance @@ -64,14 +64,14 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support (including acceleration) for the AT24, AP6422, AT3D. Support is provided by the XF86_SVGA server with the apm driver. - 4.0.1: + 4.0.2: Support (including acceleration?) for the AT24, AT25 and AT3D. This support is provided by the "apm" driver. This driver cur- rently has only incomplete support for the AP6422. Summary: - The AP6422 is supported in 3.3.6 but not fully in 4.0.1. The - AT25 is supported in 4.0.1 but not in 3.3.6. + The AP6422 is supported in 3.3.6 but not fully in 4.0.2. The + AT25 is supported in 4.0.2 but not in 3.3.6. 5. ARK Logic @@ -80,12 +80,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. and ARK2000MT. Support is provided by the XF86_SVGA server with the ark driver. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No ARK Logic chips are supported in 4.0.1. + No ARK Logic chips are supported in 4.0.2. 6. ATI @@ -103,7 +103,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. driver. Accelerated support is provided for the Rage 128 chips by the XF86_SVGA server with the r128 driver. - 4.0.1: + 4.0.2: Accelerated support is provided for the Rage 128 chips by the "r128" driver. Accelerated support is provided for the Mach64 Rage variants by the "ati" driver. Unaccelerated support is pro- @@ -111,8 +111,8 @@ architectures known to work on (e.g., Alpha, PPC), etc. Mach32 chips by the "ati" driver. Summary: - All chips supported in 3.3.6 are supported in 4.0.1 except for - Mach8 and some old Mach32 chips. The support in 4.0.1 is, how- + All chips supported in 3.3.6 are supported in 4.0.2 except for + Mach8 and some old Mach32 chips. The support in 4.0.2 is, how- ever, unaccelerated for all chips except the Mach64, Rage and Rage 128 variants. @@ -125,12 +125,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. the others. These drivers reportedly work, but they have no maintainer. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old drivers have not been ported. Summary: - No Avance Logic chips are supported in 4.0.1. + No Avance Logic chips are supported in 4.0.2. 8. Chips and Technologies @@ -140,13 +140,13 @@ architectures known to work on (e.g., Alpha, PPC), etc. 64300. This support is provided by the XF86_SVGA server with the chips driver. - 4.0.1: + 4.0.2: Support (accelerated) for the 65520, 65525, 65530, 65535, 65540, 65545, 65546, 65548, 65550, 65554, 65555, 68554, 69000, 64200 and 64300. This support is provided by the "chips" driver. Summary: - All chips supported in 3.3.6 are also supported in 4.0.1. + All chips supported in 3.3.6 are also supported in 4.0.2. 9. Cirrus Logic @@ -158,13 +158,13 @@ architectures known to work on (e.g., Alpha, PPC), etc. 7541, 7542, 7543, 7548, 7555 and 7556 is provided by the XF86_SVGA server with the cirrus driver. - 4.0.1: + 4.0.2: Support (accelerated) for the Alpine (5430, 5434, 5436, 5446, 5480), and Laguna (5462, 5464, 5465) chips is provided by the "cirrus" driver. Summary: - The following chips are supported in 3.3.6 but not in 4.0.1: + The following chips are supported in 3.3.6 but not in 4.0.2: 6410, 6412, 6420, 6440, 5420, 5422, 5424, 5426, 5428, 5429, 6205, 6215, 6225, 6235, 7541, 7542, 7543, 7548, 7555 and 7556. @@ -180,7 +180,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. 24 plane 3D chips (on Alpha platforms) is provided by the XF86_TGA server. - 4.0.1: + 4.0.2: No support for the Compaq AVGA (driver hasn't been ported). Support (accelerated) for the DEC 21030 TGA 8 plane, 24 plane and @@ -188,7 +188,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. the "tga" driver. Summary: - No Compaq AVGA support in 4.0.1. DEC TGA support is equivalent + No Compaq AVGA support in 4.0.2. DEC TGA support is equivalent in both versions. 11. Cyrix @@ -197,12 +197,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support (accelerated) for the Cyrix MediaGX is provided by the XF86_SVGA server with the cyrix driver. - 4.0.1: + 4.0.2: A preliminary port of the driver is available, but it isn't ready for widespread use. Summary: - No Cyrix chips are well-supported in 4.0.1. + No Cyrix chips are well-supported in 4.0.2. 12. Epson @@ -210,12 +210,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support (accelerated) for the Epson SPC8110 is provided by the XF86_SVGA server with the spc8100 driver. - 4.0.1: + 4.0.2: No native support for this chipset, because the old driver has not been ported. Summary: - No Epson chips are supported in 4.0.1. + No Epson chips are supported in 4.0.2. 13. Genoa @@ -225,12 +225,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. because we don't have any recent test reports, and this driver has no maintainer. - 4.0.1: + 4.0.2: No native support for this chipset, because the old driver has not been ported. Summary: - No Genoa chips are supported in 4.0.1. + No Genoa chips are supported in 4.0.2. 14. IBM @@ -245,7 +245,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support for the IBM XGA-2 chip is provided by the XF86_AGX server. - 4.0.1: + 4.0.2: Support for the standard IBM VGA chip (and compatibles) is pro- vided by the "vga" driver. @@ -254,7 +254,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Summary: The standard VGA core is supported in both versions, but there is - no support for the 8514/A or XGA-2 in 4.0.1. + no support for the 8514/A or XGA-2 in 4.0.2. 15. IIT @@ -262,12 +262,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support (accelerated) for the AGX-016, AGX-015 and AGX-014 is provided by the XF86_AGX server.. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No IIT chips are supported in 4.0.1. + No IIT chips are supported in 4.0.2. 16. Intel @@ -278,7 +278,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Linux, and requires the agpgart.o kernel module in order to use modes that require more than 1MB of video memory. - 4.0.1: + 4.0.2: Support (accelerated) for the Intel i740 is provided by the "i740" driver, and support for the Intel i810 is provided by the "i810" driver. The "i810" driver is currently Linux-only, and @@ -295,13 +295,13 @@ architectures known to work on (e.g., Alpha, PPC), etc. (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200 and G400 is provided by the XF86_SVGA server with the mga driver. - 4.0.1: + 4.0.2: Support (accelerated) for the MGA2064W (Millennium I), MGA1064SG (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200 and G400 is provided by the "mga" driver. Summary: - All chips supported in 3.3.6 are also supported in 4.0.1. + All chips supported in 3.3.6 are also supported in 4.0.2. 18. MX (???) @@ -311,12 +311,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. is unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.0.1: + 4.0.2: No native support for this chipset, because the old driver has not been ported. Summary: - No MX (???) chips are supported in 4.0.1. + No MX (???) chips are supported in 4.0.2. 19. NCR @@ -325,12 +325,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. XF86_SVGA server and the ncr77c22 driver. The status of this support is unknown because we don't have any recent test reports. - 4.0.1: + 4.0.2: No native support for this chipset, because the old driver has not been ported. Summary: - No NCR chips are supported in 4.0.1. + No NCR chips are supported in 4.0.2. 20. NeoMagic @@ -339,13 +339,14 @@ architectures known to work on (e.g., Alpha, PPC), etc. NM2097, NM2160 and NM2200 chipsets is provided by the XF86_SVGA server with the neo driver. - 4.0.1: + 4.0.2: Support (accelerated) for the NeoMagic NM2070, NM2090, NM2093, - NM2097, NM2160 and NM2200 chipsets is provided by the "neomagic" - driver. + NM2097, NM2160, NM2200, NM2230, NM2360 and NM2380 chipsets is + provided by the "neomagic" driver. Summary: - All chips supported in 3.3.6 are also supported in 4.0.1. + All chips supported in 3.3.6 are also supported in 4.0.2. The + NM2230 and later chips are only supported in 4.0.2. 21. NVIDIA @@ -354,14 +355,15 @@ architectures known to work on (e.g., Alpha, PPC), etc. (Ultra, Vanta, M64), GeForce (DDR, 256) and Quadro is provided by the XF86_SVGA server and the nv driver. - 4.0.1: + 4.0.2: Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, - Vanta, M64), GeForce (DDR, 256) and Quadro is provided by the nv - driver. + Vanta, M64), GeForce (DDR, 256), GeForce2 (GTS, Ultra, MX), + Quadro, and Quadro2 is provided by the nv driver. Summary: All chipsets supported in 3.3.6 except the NV1 are also supported - in 4.0.1. + in 4.0.2. Support for the newer chips (GeForce2 and later) is + only available in 4.0.2. 22. Number Nine @@ -369,12 +371,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support (accelerated) for the Imagine 128, Ticket 2 Ride, Revolu- tion 3D and Revolution IV is provided by the XF86_I128 server. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No Number Nine chips are supported in 4.0.1. + No Number Nine chips are supported in 4.0.2. 23. Oak Technologies Inc @@ -383,12 +385,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. acceleration) is provided by the XF86_SVGA server and the oak driver. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No Oak chips are supported in 4.0.1. + No Oak chips are supported in 4.0.2. 24. Paradise/Western Digital @@ -399,12 +401,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. port for some of these chipsets is uncertain because we don't have any recent test reports, and this driver has no maintainer. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No Paradise/Western Digital chips are supported in 4.0.1. + No Paradise/Western Digital chips are supported in 4.0.2. 25. RealTek @@ -414,12 +416,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No RealTek chips are supported in 4.0.1. + No RealTek chips are supported in 4.0.2. 26. Rendition/Micron @@ -427,12 +429,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. Support for the Verite 1000, 2100 and 2200 is provided by the XF86_SVGA server with the rendition driver. - 4.0.1: + 4.0.2: Support for the Verite 1000, 2100 and 2200 is provided by the "rendition" driver. Summary: - All chips supported in 3.3.6 are also supported in 4.0.1. + All chips supported in 3.3.6 are also supported in 4.0.2. 27. S3 @@ -446,18 +448,17 @@ architectures known to work on (e.g., Alpha, PPC), etc. ated) for those ViRGE chips, as well as the Trio3D and Trio3D/2X is provided by the XF86_SVGA server with the s3v driver. Support (accelerated) for the Savage3D, Savage3D/MV, Savage4, Savage2000, - Savage/MX-MV, Savage/MX, Savage/IX-MV and Savage/IX is provided - by the XF86_SVGA server with the s3_savage driver (CHECK: is this - support Linux-only?). + is provided by the XF86_SVGA server with the s3_savage driver + (CHECK: is this support Linux-only?). - 4.0.1: + 4.0.2: Support (accelerated) for the ViRGE, ViRGE/VX, ViRGE/DX, ViRGE/GX, ViRGE/GX2, ViRGE/MX, ViRGE/MX+, Trio3D and Trio3D/2X is provided by the "s3virge" driver. Support for the other S3 chipsets has not yet been ported. Summary: - Only the ViRGE and Trio3D chipsets are supported in 4.0.1. All + Only the ViRGE and Trio3D chipsets are supported in 4.0.2. All of the other chipsets are only supported in 3.3.6. 28. Silicon Integrated Systems (SiS) @@ -467,7 +468,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. 86C225, 5597, 5598, 6326, 530, 620, 300, 630 and 540 is provided by the XF86_SVGA server with the sis driver. - 4.0.1: + 4.0.2: Support (accelerated) for the SiS 530, 620, 6326 is provided by the "sis" driver. The 630, 300, and 540 are also supported, but this code is new and there are @@ -484,12 +485,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. LynxEM+ and Lynx3DM chips is provided by the XF86_SVGA server with the smi driver. - 4.0.1: + 4.0.2: No native support for these chipsets, because the driver has not been ported. Summary: - No SMI chips are supported in 4.0.1, but the fbdev driver is + No SMI chips are supported in 4.0.2, but the fbdev driver is reported to work on Linux. 30. Trident Microsystems @@ -505,7 +506,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. CyberBlade/DSTN/i7 and CyberBlade/i1 is provided by the XF86_SVGA server with the tvga8900 driver. - 4.0.1: + 4.0.2: Support (accelerated where the chip supports it) for the TVGA8900D, TGUI9420DGi, TGUI9440AGi, TGUI9660, TGUI9680, ProVidia 9682, ProVidia 9685, Cyber9320, Cyber9382, Cyber9385, Cyber9388, @@ -515,7 +516,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Summary: The following (older) chipsets that are supported in 3.3.6 are - not supported in 4.0.1: TVGA8200LX, TVGA8800CS, TVGA8900B, + not supported in 4.0.2: TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9420, TGUI9430DGi. @@ -529,13 +530,13 @@ architectures known to work on (e.g., Alpha, PPC), etc. driver. Support (accelerated) for the ET4000/W32 series and the ET6000 is also provided by the deprecated XF86_W32 server. - 4.0.1: + 4.0.2: Support for the ET4000AX, and accelerated support for the ET4000/W32, ET4000/W32i, ET4000/W32p, ET6000 and ET6100 is pro- vided by the "tseng" driver. Summary: - All cards supported by 3.3.6 are also supported by 4.0.1 except + All cards supported by 3.3.6 are also supported by 4.0.2 except for the old ET3000. 32. Video 7 @@ -546,12 +547,12 @@ architectures known to work on (e.g., Alpha, PPC), etc. unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old driver has not been ported. Summary: - No Video 7 chips are supported in 4.0.1. + No Video 7 chips are supported in 4.0.2. 33. Weitek @@ -560,14 +561,14 @@ architectures known to work on (e.g., Alpha, PPC), etc. server and accelerated support for the P9100 is provided by the XF86_SVGA server with the p9x00 driver. - 4.0.1: + 4.0.2: No native support for these chipsets, because the old drivers have not been ported. Summary: - No Weitek chips are supported in 4.0.1. + No Weitek chips are supported in 4.0.2. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.18 2000/08/11 21:12:49 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.21 2000/12/04 19:31:05 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.14 2000/08/12 01:24:00 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.16 2000/12/04 19:47:33 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml index 69fbdd28f..a40db0e09 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml @@ -27,7 +27,7 @@ <title>XFree86 X server ``New Design'' (DRAFT) <author>The XFree86 Project, Inc -<date>Last modified 1 May 2000 +<date>Last modified 2 December 2000 @@ -36,7 +36,7 @@ <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.32 2000/08/28 18:24:14 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.39 2000/12/04 18:49:54 dawes Exp $ </ident> @@ -518,8 +518,9 @@ is what &s.code;InitOutput()&e.code; does: it to the global &s.code;xf86DriverList[]&e.code; array. The &s.code;DriverRec&e.code; contains the driver's version, a short - descriptive message, the &s.code;Identify()&e.code; and - &s.code;Probe()&e.code; function entry points as well as a pointer + descriptive message, the &s.code;Identify()&e.code;, + &s.code;Probe()&e.code; and &s.code;AvailableOptions()&e.code; + function entry points as well as a pointer to the driver's module (as returned from the loader when the driver was loaded) and a reference count which keeps track of how many screens are using the driver. The entry driver entry points are @@ -589,13 +590,17 @@ is what &s.code;InitOutput()&e.code; does: &s.code;Bool ChipProbe(DriverPtr drv, int flags)&e.code; <quote><p> The purpose of this is to identify all instances of hardware - supported by the driver. The flags value is currently not used, - and should be ignored by the driver. + supported by the driver. The flags value is currently either 0, + &s.code;PROBE_DEFAULT&e.code; or &s.code;PROBE_DETECT&e.code;. + &s.code;PROBE_DETECT&e.code; is used if "-configure" or "-probe" + command line arguments are given and indicates to the + &s.code;Probe()&e.code; function that it should not configure the + bus entities and that no XF86Config information is available. The probe must find the active device sections that match the driver by calling &s.code;xf86MatchDevice()&e.code;. The number of matches found limits the maximum number of instances for this - driver. If no matches are found, the problem should return + driver. If no matches are found, the function should return &s.code;FALSE&e.code; immediately. Devices that cannot be identified by using device-independent @@ -3845,8 +3850,7 @@ typedef struct { &s.code;drw_w&e.code; by &s.code;drw_h&e.code; on the screen. Since it is not expected that all hardware will be able to get the target dimensions exactly, it is important that the - driver provide this function. The returned dimensions must - be less than or equal to the requested dimension. + driver provide this function. </quote> @@ -6630,8 +6634,7 @@ ZZZProbe(DriverPtr drv, int flags) /* add screen to entity */ } } - if (numUsed > 0) - xfree(usedChips); + xfree(usedChips); } #ifdef HAS_ISA_DEVS @@ -6662,8 +6665,7 @@ ZZZProbe(DriverPtr drv, int flags) foundScreen = TRUE; } } - if (numUsed > 0) - xfree(usedChips); + xfree(usedChips); #endif /* HAS_ISA_DEVS */ xfree(devSections); diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml index 0771e6982..c9ed15581 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml @@ -12,10 +12,10 @@ <author> <htmlurl url="http://www.valinux.com/" name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>24 October 2000 + <date>20 November 2000 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.12 2000/11/16 18:36:25 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.13 2000/12/01 14:28:55 dawes Exp $ </ident> <toc> @@ -198,8 +198,9 @@ <p> XFree86 4.0.1 added automatic kernel module loading to the X server. On Linux, the X server uses modprobe to load kernel modules. - The DRM kernel modules should be in /lib/modules/KERNEL-VERSION/misc/ - for automatic loading to work. + In Linux 2.4.x the DRM kernel modules should be kept in + <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> for automatic + loading to work. <p> Optionally, DRM kernel modules can be loaded manually with insmod prior to starting the X server. @@ -289,6 +290,11 @@ If your graphics card doesn't have a lot of memory (less than 16MB, for example), you may have to reduce your screen size and/or color depth in order to use 3D features. + Reducing the screen resolution will also leave more space for + texture images, possibly improving 3D performance. + If, for example, you play Quake3 at 1024x768 but start your display + at 1600x1200 you might consider restarting X at 1024x768 in order to + maximize your texture memory space. <p> The documentation included with your card should have information about maximum screen size when using 3D. @@ -328,11 +334,13 @@ The <tt/-I/ option is used to specify where the GL/glut.h (and possibly the GL/gl.h and GL/glu.h) header file may be found. <p> - The <tt/-L/ options specify where the libglut.so, libGLU.so and - X libraries are located. + The <tt/-L/ options specify where the libglut.so and the X + libraries are located. + libGL.so and libGLU.so should be in /usr/lib, as specified by + the Linux/OpenGL ABI standard. <p> The <tt/-lglut -lGLU -lGL/ arguments specify that the application - should link with the GLUT, GLU and GL libraries. + should link with the GLUT, GLU and GL libraries, in that order. <sect1>Running your OpenGL program <p> @@ -351,12 +359,15 @@ OSMesa (Off-Screen Mesa) is an interface and driver for rendering 3D images into a user-allocated block of memory rather than an on-screen window. + It was originally developed for Mesa before Mesa became part of + the XFree86/DRI project. + It can now be used with the XFree86/DRI libGL.so as well. <p> - libOSMesa.so implements the OSMesa interface and must be linked + libOSMesa.so implements the OSMesa interface and it must be linked with your application if you want to use the OSMesa functions. You must also link with libGL.so. For example: <verb> - gcc osdemo.c -L/usr/X11R6/lib -lOSMesa -lGLU -lGL -o osdemo + gcc osdemo.c -lOSMesa -lGLU -lGL -o osdemo </verb> <p> In stand-alone Mesa this interface was compiled into the monolithic @@ -395,9 +406,9 @@ If you see that indirect rendering is being used when direct rendering was expected, proceed to the troubleshooting section. <p> - <tt/glxinfo/ also lists all of the GLX-enhanced visuals available. - Here you can determine which visuals may have depth buffers, stencil - buffers, accumulation buffers, etc. + <tt/glxinfo/ also lists all of the GLX-enhanced visuals available + so you can determine which visuals are double-bufferd, have depth (Z) + buffers, stencil buffers, accumulation buffers, etc. <sect1>Environment Variables <p> @@ -639,7 +650,7 @@ </verb> <p> The kernel module for the Voodoo3 is named <tt>tdfx.o</tt> and - should be installed in /lib/modules/KERNEL-VERSION/misc/. + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the Voodoo3 hould be in @@ -654,7 +665,7 @@ If you try to run an OpenGL application and see an error message similar to <verb> - gd error (glide): gd error (glide): grSstSelect: non-existent SSTgd error (glide): grSstSelect: non-existent SSTS + gd error (glide): gd error (glide): grSstSelect: non-existent SSTgd error (glide): grSstSelect: non-existent SSTS </verb> it means that you have the wrong version of the Glide library for your hardware. @@ -782,7 +793,7 @@ </verb> <p> The kernel module for the Voodoo5 is named <tt>tdfx.o</tt> and - should be installed in /lib/modules/KERNEL-VERSION/misc/. + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the Voodoo5 hould be in @@ -894,7 +905,7 @@ </verb> <p> The kernel module for the i810 is named <tt>i810.o</tt> and - should be installed in /lib/modules/KERNEL-VERSION/misc/. + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the i810 should be in @@ -976,7 +987,7 @@ <p> The kernel module for the G200/G400 is named <tt>mga.o</tt> and - should be installed in /lib/modules/KERNEL-VERSION/misc/. + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the G200/G400 should be in @@ -985,18 +996,68 @@ <sect2>Performance <p> - No data at this time. + Software rendering will be used under any of the + following conditions: + <itemize> + <item>Using glDrawBuffer(GL_FRONT_AND_BACK). + <item>Using point, line, or triangle smoothing. + <item>Using glLogicOp. + <item>Using glPolygonStipple or glLineStipple. + <item>Using 1D or 3D textures. + <item>Using the accumulation buffer. + </itemize> + + + <sect2>IRQ Assignment +<p> + There have been problems in the past with the MGA driver being very + sluggish when the DRI is enabled (to the point of being unusable.) + This is caused by the graphics card not having an interrupt assigned + to it. + The current DRI trunk will attempt to detect this condition and + bail outgracefully. + <p> + The solution to the above problem is to assign an interrupt to your + graphics card. + This is something you must turn on in your system BIOS configuration. + Please consult your system BIOS manual for instructions + on how to enable an interrupt for your graphics card. + <p> + + <sect2>MGA HAL lib +<p> + MGAHALlib.a is a binary library Matrox has provided for use under + Linux to expose functionality for which they can not provide + documentation. + (For example TV-Out requires MacroVision be enabled on the output.) + This binary library also sets the pixel/memory clocks to the optimial + settings for your Matrox card. + <p> + Currently the MGAHAL library is required for the G450 to work. + You can download this from the driver section on Matrox's website: + <htmlurl url="http://www.matrox.com/mga/" name="www.matrox.com/mga"> + <p> + Here modifications to the DRI build instructions which make the + mga ddx driver use the MGAHAL library: + <verb> + 1.Put the following define in your host.def file + #define UseMatroxHal YES + 2. Place mgaHALlib.a in the following directory + xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib/ + </verb> + <p> + You can use DualHead on the G400/G450 DH cards by creating two + device sections which both point to the same BusID. + For most AGP devices the BusID will be "PCI:1:0:0". + Configure your screen section as you would normally configure + XFree86 4.x Multihead. It should be noted that currently + the second head does not support direct rendering. + <P> <sect2>Known Problems <p> - <itemize> - <item> - Multitexture is currently disabled on the G400 to work - around a hardware lockup bug. This should be restored in - a subsequent release. - <item> - 32bpp mode has not been tested on the G400 at this time. - </itemize> + None. + <p> <sect1>ATI Rage 128 @@ -1038,7 +1099,7 @@ </verb> <p> The kernel module for the Rage 128 is named <tt>r128.o</tt> and - should be installed in /lib/modules/KERNEL-VERSION/misc/. + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the Rage 128 should be in @@ -1092,16 +1153,13 @@ in an X protocol error. <p> - <sect1>Signal Handling + <sect1>Debugging <p> - There are several understood, but unresolved problems relating - to hardware locking and signal handling. - Hitting CTRL-z to suspend a 3D application can sometimes cause - the X server to lock-up if executing device driver code at that - moment. - Also, using a debugger to step through OpenGL/Mesa device driver - functions code could cause a lock-up. - These problems will be fixed in the future. + Debugging DRI drivers with gdb can be difficult because of the + locking involved. When debugging OpenGL applications, you should + avoid stepping inside the GL functions. If you're trying to debug + a DRI driver it's recommended that you do so remotely, from a + second system. <sect1>Scheduling <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml index 2f4032d0a..ec394effa 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml @@ -15,7 +15,7 @@ <date>29 October 2000 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.7 2000/11/08 05:03:03 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.8 2000/12/01 14:28:55 dawes Exp $ </ident> <toc> @@ -72,6 +72,9 @@ <item>GCC compiler and related tools. <item>ssh (secure shell) for registered developer downloading of the DRI source tree + <item>A recent Linux Kernel. See below for details. + <item>FreeBSD support is not currently being maintained and may not + work. </itemize> <p> @@ -82,36 +85,40 @@ These can be obtained from <htmlurl url="http://linux.3dfx.com/open_source/glide_kit.htm" name="linux.3dfx.com">. - <item>Linux kernel 2.2.x. - The DRI developers have been using stock RedHat 6.1 systems - (kernel 2.2.12-20). - Later kernel versions will be supported in the future. + <item>A recent Linux 2.4.x kernel. AGP support is not required. </itemize> <p> For Matrox G200/G400 hardware, you'll also need: <itemize> - <item>Linux kernel 2.3.51. Older kernel versions will not work. + <item>A recent Linux 2.4.x kernel with AGP support. </itemize> <p> For Intel i810 hardware, you'll also need: <itemize> - <item>Linux kernel 2.3.99-pre6. Older kernel versions will not work. + <item>A recent Linux 2.4.x kernel with AGP support. </itemize> <p> For ATI Rage hardware, you'll also need: <itemize> - <item>Linux kernel 2.3.51. Other kernel versions may work but - this one is known to work. + <item>A recent Linux 2.4.x kernel with AGP support. </itemize> - <sect>Kernel preparation <p> + <sect>Linux Kernel Preparation <p> - You may have to upgrade your Linux kernel in order to use the DRI. - This is because you need a kernel version which supports AGP. + The DRI project closely tracks Linux kernel development. + Since the internal Linux data structures change frequently in + the 2.4 development branch it's important to have use the most + recent Linux kernel. + As of this writing (Nov 2000), 2.4.0-test11-pre5 is the most + recent version of Linux which the DRI is synchronized to. + <p> + Most of the DRI drivers require AGP support and using Intel + Pentium III SSE optimizations also requires an up-to-date Linux kernel. + <p> Building a new Linux kernel can be difficult for beginners but there are resources on the Internet to help. This document assumes experience with configuring, building and @@ -121,70 +128,65 @@ <htmlurl url="http://www.kernel.org/pub/linux/kernel/" name="www.kernel.org"> <p> - Download the needed kernel and put it in /usr/src. - Create a directory for the source and unpack it. - For example: - <verb> - cd /usr/src - rm -f linux - mkdir linux-2.3.51 - ln -s linux-2.3.51 linux - bzcat linux-2.3.51.tar.bz2 | tar xf - - </verb> - <p> - Now configure your kernel. - You might, for example, use <tt>make menuconfig</tt> and do the - following: - + Here are the basic steps for kernel setup. <itemize> - <item>Go to <em>Code maturity level options</em> - <item>Enable <em>Prompt for development and/or incomplete - code/drivers</em> - <item>hit ESC - <item>Go to <em>Character devices</em> - <item>Disable <em>Direct Rendering Manager (XFree86 DRI support)</em> - since we'll use the DRI module from the XFree86/DRI tree. - <item>Go to <em>/dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)</em> - <item>Hit SPACE twice - <item>Enable all chipsets' support for AGP - </itemize> - - <p>It's recommended that you turn on MTRRs under <em>Processor type - and Features</em>, but not required. - - <p> - Configure the rest of the kernel as required for your system - (i.e. Ethernet, SCSI, etc) - <p> - Exit, saving your kernel configuration. - <p> - Edit your /etc/lilo.conf file. - Make sure you have an image entry as follows (or similar): + <item>Download the needed kernel and put it in /usr/src. + Create a directory for the source and unpack it. + For example: + <verb> + cd /usr/src + rm -f linux + mkdir linux-2.4.x + ln -s linux-2.4.x linux + bzcat linux-2.4.x.tar.bz2 | tar xf - + </verb> + <item>Configure your kernel. + You might, for example, use <tt>make menuconfig</tt> and do the + following: + + <itemize> + <item>Go to <em>Code maturity level options</em> + <item>Enable <em>Prompt for development and/or incomplete + code/drivers</em> + <item>hit ESC to return to the top-level menu + <item>Go to <em>Character devices</em> + <item>Disable <em>Direct Rendering Manager (XFree86 DRI support)</em> + since we'll use the DRI module from the XFree86/DRI tree. + <item>Go to <em>/dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)</em> + <item>Hit SPACE twice to build AGP support into the kernel + <item>Enable all chipsets' support for AGP + <item>It's recommended that you turn on MTRRs under + <em>Processor type and Features</em>, but not required. + </itemize> + <item>Configure the rest of the kernel as required for your system + (i.e. Ethernet, SCSI, etc) + <item>Exit, saving your kernel configuration. + <item>Edit your /etc/lilo.conf file. + Make sure you have an image entry as follows (or similar): <verb> image=/boot/vmlinuz - label=linux.2.3.51 + label=linux.2.4.x read-only root=/dev/hda1 </verb> - <p> - The important part is that you have /boot/vmlinuz without a - trailing version number. - If this is the first entry in your /etc/lilo.conf AND you - haven't set a default, then this will be your default kernel. - - <p> - Now compile the new kernel: - - <verb> - cd /usr/src/linux-2.3.51 - make dep ; make bzImage - make modules ; make modules_install - make install - </verb> - Note that the final part, make install, will automatically run - lilo for you. - <p> - Now reboot to use this new kernel. + The important part is that you have /boot/vmlinuz without a + trailing version number. + If this is the first entry in your /etc/lilo.conf AND you + haven't set a default, then this will be your default kernel. + <item>Compile the new kernel. + <verb> + cd /usr/src/linux-2.4.x + make dep + make bzImage + make modules + make modules_install + make install + </verb> + Note that last make command will automatically run lilo for you. + <item>Upgrade your modutils package for Linux 2.4.x if you're + upgrading from Linux 2.2.x. + <item>Now reboot to use the new kernel. + </itemize> <sect>Downloading the XFree86/DRI CVS Sources <p> @@ -398,14 +400,14 @@ The most recent kernels are not always supported. <p> If your build machine is running a different version of the kernel - than your target machine (i.e. 2.2.12-20 vs. 2.3.99-pre6), make will + than your target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel headers. This can be fixed by explicitly setting the value of <tt>TREE</tt>. If the path to your kernel source is - <tt>/bigdisk/linux-2.3.99-pre6</tt>, + <tt>/usr/src/linux-2.4.x</tt>, <verb> cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel - make TREE=/bigdisk/linux-2.3.99-pre6 + make TREE=/usr/src/linux-2.4 </verb> or alternatively, edit Makefile to include this change. <p> @@ -413,6 +415,19 @@ Later, you might just compile parts of the source tree but it's important that the whole tree will build first. + <sect1>DRI kernel module installation <p> + + The DRI kernel modules are in + <tt>~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/</tt>. + <p> + To load the appropriate DRI module in your running kernel you can + either use ismod and restart your X server or copy the kernel module + to <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> then run + depmod and restart your X server. + <p> + Make sure you first unload any older DRI kernel modules that might + be already loaded. + <p> <sect>Normal Installation and Configuration <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile index cfcac3fcf..f78dcaed8 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile @@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/16 1996/10/28 05:13:04 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.65 2000/11/06 22:03:28 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.66 2000/12/01 19:47:55 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> @@ -15,7 +15,7 @@ MANSGMLDEPENDS = mdefs.ent mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml \ isc.sgml LynxOS.sgml NetBSD.sgml OpenBSD.sgml OS2note.sgml \ apm.sgml ati.sgml chips.sgml cyrix.sgml DECtga.sgml \ - I128.sgml i740.sgml i810.sgml \ + I128.sgml i740.sgml i810.sgml newport.sgml \ r128.sgml rendition.sgml s3virge.sgml SiS.sgml #ifdef DEADDOCS @@ -67,6 +67,9 @@ LinuxDocReadmeTarget(i740) LinuxDocReadmeTarget(i810) #ifdef OUTOFDATE LinuxDocReadmeTarget(neomagic) +#endif +LinuxDocReadmeTarget(newport) +#ifdef OUTOFDATE LinuxDocReadmeTarget(Mach32) LinuxDocReadmeTarget(Mach64) LinuxDocReadmeTarget(MGA) diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml index fc45c29eb..17b6e9297 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml @@ -9,10 +9,10 @@ David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb -<Date>Last modified on: 1 July 2000 +<Date>Last modified on: 2 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.56 2000/07/02 02:35:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.57 2000/12/02 15:27:09 herrb Exp $ </ident> <toc> @@ -38,8 +38,8 @@ url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/NetBSD"> A list of mirror sites is provided by -<htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/MIRRORS" -url="ftp://ftp.XFree86.org/pub/XFree86/MIRRORS"> +<htmlurl name="http://www.xfree86.org/MIRRORS.shtml" +url="http://www.xfree86.org/MIRRORS.shtml"> XFree86 also builds on other NetBSD architectures. See section @@ -60,6 +60,18 @@ this file and we'll revise it. See the <htmlurl url="RELNOTES.html" name="Release Notes"> for non-OS dependent new features in XFree86 &relvers;. +<sect1>New OS dependent features in 4.0.2 +<p> +<itemize> +<item>A fix for libXmu OS detection which was broken since <tt/unix/ +isn't defined anymore by the C preprocessor. +<item>(limited) native wscons support. This is not activated by +default. +<item>Updates to the aperture driver +<item>Support for multithread libraries with GNU pth +<item>Add <tt>/usr/pkg/bin</tt> to the default user path. +</itemize> + <sect1>New OS dependent features in 4.0.1 <p> <itemize> @@ -358,7 +370,7 @@ And finally run <tt/make World/ in the <tt/xc/ directory. <p> XFree86 has a configuration option to select the console -drivers to use in <tt/xf86site.def/: +drivers to use in <tt/host.def/: <itemize> <item> if you're using pccons put: <tscreen><verb> @@ -369,9 +381,18 @@ drivers to use in <tt/xf86site.def/: #define XFree86ConsoleDefines -DPCVT_SUPPORT </verb></tscreen> </itemize> -If you don't define <bf/XFree86ConsoleDefines/ in <tt/xf86site.def/ the +If you don't define <bf/XFree86ConsoleDefines/ in <tt/host.def/ the pccons and pcvt drivers will be supported by default. +<p> +Experimental native support for the wscons console driver can be built +by adding: +<tscreen><verb> + #define XFree86ConsoleDefines -DWSCONS_SUPPORT +</verb></tscreen> +to <tt>xc/config/host.def</tt> before rebuilding the server. +This has not been toroughly tested, except on the macppc. + <sect1>Building on other architectures<label id="sparc"> <p> @@ -382,6 +403,13 @@ The NetBSD xsrc source tree is available at: <htmlurl url="ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/xsrc/" name="ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/xsrc/"> +<p> +There's an <em/experimental/ patch by Tsubai Masanari to make XFree86 +4.0.1 work on +NetBSD/macppc at: +<htmlurl url="ftp://nandra.iri.co.jp/pub/NetBSD/macppc/XFree86/README" +name="ftp://nandra.iri.co.jp/pub/NetBSD/macppc/XFree86/README">. + <sect>Building New X Clients <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml index 15f131d8e..2ce82b556 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml @@ -6,10 +6,10 @@ <title>README for XFree86 &relvers; on OpenBSD <author> Matthieu Herrb -<Date>Last modified on: 1 July 2000 +<Date>Last modified on: 2 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.11 2000/07/02 02:35:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.12 2000/12/02 15:27:09 herrb Exp $ </ident> <toc> @@ -30,14 +30,14 @@ The sources for XFree86 &relvers; are available by anonymous ftp from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;"> -Binaries for OpenBSD/i386 2.6 and later are available from: +Binaries for OpenBSD/i386 2.8 and later are available from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/OpenBSD" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/OpenBSD"> A list of mirror sites is provided by -<htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/MIRRORS" -url="ftp://ftp.XFree86.org/pub/XFree86/MIRRORS"> +<htmlurl name="http://www.xfree86.org/MIRRORS.shtml" +url="http://www.xfree86.org/MIRRORS.shtml"> <p> @@ -57,6 +57,15 @@ this file and we'll revise it. See the <htmlurl url="RELNOTES.html" name="Release Notes"> for non-OS dependent new features in XFree86 &relvers;. +<sect1>New OS dependent features in 4.0.2 +<p> +<itemize> +<item>Support for the OpenBSD ports tree +<item>Preliminary support for the powerpc architecture (clients build +and work, the server doesn't work yet) +<item>Xdm now writes an utmp entry +</itemize> + <sect1>New OS dependent features in 4.0.1 <p> <itemize> @@ -280,7 +289,7 @@ sources, invoke ``<tt/make World/'' in the xc directory. <p> XFree86 has a configuration option to select the console -drivers to use in <tt/xf86site.def/: +drivers to use in <tt/host.def/: <itemize> <item> if you're using pccons only put: <tscreen><verb> @@ -291,8 +300,18 @@ drivers to use in <tt/xf86site.def/: #define XFree86ConsoleDefines -DPCVT_SUPPORT </verb></tscreen> </itemize> -If you don't define <bf/XFree86ConsoleDefines/ in <tt/xf86site.def/ the -pccons and pcvt drivers will be supported. +If you don't define <bf/XFree86ConsoleDefines/ in <tt/host.def/ the +pccons and pcvt drivers will be supported by default. + +<p> +Experimental native support for the wscons console driver found on +OpenBSD/powerpc and on OpenBSD/i386 -current can be built +by adding: +<tscreen><verb> + #define XFree86ConsoleDefines -DWSCONS_SUPPORT +</verb></tscreen> +to <tt>xc/config/host.def</tt> before rebuilding the server. +This has not been toroughly tested, except on the macppc. diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml index 454076b3e..9e20f003f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml @@ -9,7 +9,7 @@ <date>3 July 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.42 2000/07/03 16:27:10 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.43 2000/12/04 16:24:57 alanh Exp $ </ident> <abstract> @@ -956,6 +956,13 @@ for some boards. Further information about this driver can be found in the 'glint' driver man page. +<sect2>Trident <label id="trident"> +<p> + +The "trident" driver supports all PCI based Trident cards, including one ISA +based - the 8900D. 3.3.x is still needed for older SVGA ISA/VLB based cards, +yet 4.0.2 is much faster for the newer boards. + <sect>X libraries and clients <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml index 644004d37..dc5529742 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml @@ -6,10 +6,10 @@ <title>Driver Status for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>11 August 2000 +<date>4 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.19 2000/11/28 20:59:17 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.21 2000/12/04 19:31:05 dawes Exp $ </ident> <abstract> @@ -414,11 +414,12 @@ dependencies/limitations, other architectures known to work on <tag>&relvers;:</tag> Support (accelerated) for the NeoMagic NM2070, NM2090, NM2093, - NM2097, NM2160 and NM2200 chipsets is provided by the "neomagic" - driver. + NM2097, NM2160, NM2200, NM2230, NM2360 and NM2380 chipsets is + provided by the "neomagic" driver. <tag>Summary:</tag> All chips supported in &legacyvers; are also supported in + &relvers;. The NM2230 and later chips are only supported in &relvers;. </descrip> @@ -433,12 +434,14 @@ dependencies/limitations, other architectures known to work on <tag>&relvers;:</tag> Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, - Vanta, M64), GeForce (DDR, 256) and Quadro is provided by + Vanta, M64), GeForce (DDR, 256), GeForce2 (GTS, Ultra, MX), Quadro, + and Quadro2 is provided by the nv driver. <tag>Summary:</tag> All chipsets supported in &legacyvers; except the NV1 are also - supported in &relvers;. + supported in &relvers;. Support for the newer chips (GeForce2 and + later) is only available in &relvers;. </descrip> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml index 31955e9e1..2cdc21479 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml @@ -11,7 +11,7 @@ <date> 14th June 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.32 2000/10/27 18:31:02 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.33 2000/12/02 21:52:22 dbateman Exp $ </ident> <!-- Table of contents --> @@ -295,10 +295,10 @@ TextClockFreq 25.175 select a different clock for the server to use when returning to the text console. <tag> -Option "FPClock8" "65.0" -Option "FPClock16" "65.0" -Option "FPClock24" "65.0" -Option "FPClock32" "65.0" +Option "FPClock8" "65.0MHz" +Option "FPClock16" "65.0MHz" +Option "FPClock24" "65.0MHz" +Option "FPClock32" "65.0MHz" </tag> In general the LCD panel clock should be set independently of the modelines supplied. Normally the chips BIOS set the flat panel @@ -409,12 +409,6 @@ Option "NoTMED" LCD, try using this option. This option is only relevant for chipsets more recent than the ct65555 and only when used with a DSTN LCD. <tag> -Option "UseFB" -</tag> - Force the new framebuffer (fb) code to be used in place of its older - counterpart (cfb). The sense of this option will probably be reversed - when fb becomes the default. -<tag> Option "Overlay" </tag> The HiQV chipsets contain a multimedia engine that allow a 16bpp @@ -845,6 +839,14 @@ video processor beyond it capabilities won't cause damage. The XVideo extension has only recently been added to the chips driver. Some YUV to RGB colour have been noted at 15 and 16 bit colour depths. However, 8 and 24 bit colour depths seem to work fine. +<tag> My ct69030 machine locks up when starting XFree</tag> + The ct69030 chipset introduced a new dual channel architecture. In its + current form, XFree can not take advantage of this second display + channel. In fact if the video BIOS on the machine sets the ct69030 + to a dual channel mode by default, XFree will lockup hard at this + point. The solution is to use the BIOS setup to change to a single + display channel mode, ensuring that both the IOSS and MSS registers + are set to a single channel mode. Work is underway to fix this. <tag> I can't start X-windows with 16, 24 or 32bpp</tag> Firstly, is your machine capable of 16/24/32bpp with the mode specified. Many LCD displays are incapable of using a 24bpp diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml new file mode 100644 index 000000000..18ebd7b4e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml @@ -0,0 +1,53 @@ +<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN" [ +<!ENTITY % defs SYSTEM "defs.ent"> %defs; +]> + +<article> +<title>Information for newport Users +<author>Guido Guenther +<date>1 August 2000 +<ident> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.1 2000/12/01 19:37:57 dawes Exp $ +</ident> +<toc> + +<sect>Supported Hardware +<p> +This is an unaccelerated driver for the SGI Indy's newport cards. Both the + 8bit and 24bit versions are tested and working with some limitations(see below). +The 24bit newport additionally works in 8bit mode only. + +<sect>Notes +<p> +<itemize> + <item>X -configure does not generate a XF86Config file +</itemize> + + +<sect>Configuration +<p> +The following Section "Device" options are supported by the newport driver: +<itemize> + <item>Option "bitplanes" "x" + Gives the maximum number of bitplanes your card supports (8 or 24). +</itemize> + + +<sect>Authors +<p> +<itemize> + <item>Guido Guenther <guido.guenther@gmx.net> +</itemize> + + +<sect>Acknowledgements +<p> +<itemize> + <item>Gleb O. Raiko <raiko@niisi.msk.ru> for getting the beast to build + <item>Ralf Baechle <ralf@oss.sgi.com> for his patience... + <item>Ulf Carlsson <ulfc@calypso.engr.sgi.com> for comments and the dynamic loader code + <item>Nina A. Podolskaya <nap@niisi.msk.ru> for dynamic loader code + <item>all the guys who wrote the newport_con linux kernel code +</itemize> + +</article> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c index 7f346ba18..1bdaa4a74 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.45 2000/11/22 04:32:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.46 2000/12/02 15:30:31 tsi Exp $ */ #include "apm.h" @@ -378,7 +378,7 @@ static Bool ApmProbe(DriverPtr drv, int flags) { int numDevSections, numUsed, i; - GDevPtr *DevSections = NULL; + GDevPtr *DevSections; int *usedChips; int foundScreen = FALSE; @@ -445,8 +445,7 @@ ApmProbe(DriverPtr drv, int flags) } } } - if (DevSections) - xfree(DevSections); + xfree(DevSections); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c index b7e765b5c..ed7dbc03c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.8 2000/11/15 23:13:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.9 2000/12/02 15:30:31 tsi Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -209,7 +209,7 @@ static void ARKIdentify(int flags) static Bool ARKProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -225,8 +225,7 @@ static Bool ARKProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); + xfree(devSections); if (numUsed <= 0) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c index d655859d3..059a83cab 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.13 2000/08/04 21:07:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.14 2000/12/02 15:53:52 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -65,6 +65,7 @@ * Jakub Jelinek, jakub@redhat.com * David S. Miller, davem@redhat.com * A E Lawrence, adrian.lawrence@computing-services.oxford.ac.uk + * Linus Torvalds, torvalds@transmeta.com * * ... and, many, many others from around the world. * diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c index 58985bd1b..4002ee139 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.37 2000/10/26 11:47:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.38 2000/12/02 15:30:32 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -584,13 +584,14 @@ ATIPreInit /* Validate, then make a private copy of, the initialised BIOS */ CARD8 *pBIOS = xf86int10Addr(pInt10Info, pInt10Info->BIOSseg << 4); - if ((pBIOS[0] != 0x55U) || (pBIOS[1] != 0xAAU) || - !pBIOS[2] || (pBIOS[2] > 0x80U)) + if ((pBIOS[0] != 0x55U) || (pBIOS[1] != 0xAAU) || !pBIOS[2]) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Unable to correctly retrieve adapter BIOS.\n"); else { BIOSSize = pBIOS[2] << 9; + if (BIOSSize > BIOS_SIZE) + BIOSSize = BIOS_SIZE; (void)memcpy(BIOS, pBIOS, BIOSSize); } } @@ -979,7 +980,7 @@ ATIPreInit * Compensate for BIOS absence. Note that the reference * frequency has already been set by option processing. */ - if ((pATI->DAC & 0x0FU) == ATI_DAC_INTERNAL) + if ((pATI->DAC & ~0x0FU) == ATI_DAC_INTERNAL) pATI->ProgrammableClock = ATI_CLOCK_INTERNAL; else switch (pATI->DAC) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h index 4a31c46d2..110c59516 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.26 2000/11/02 16:55:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.27 2000/12/02 15:53:52 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -27,11 +27,11 @@ #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_NAME "6.2.0" +#define ATI_VERSION_NAME "6.2.2" #define ATI_VERSION_MAJOR 6 #define ATI_VERSION_MINOR 2 -#define ATI_VERSION_PATCH 0 +#define ATI_VERSION_PATCH 2 #define ATI_VERSION_CURRENT \ ((ATI_VERSION_MAJOR << 20) | (ATI_VERSION_MINOR << 10) | ATI_VERSION_PATCH) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h index 72b74d413..aaae5390c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.3 2000/11/18 19:37:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.6 2000/12/04 19:21:52 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -40,6 +40,8 @@ #include "xf86str.h" +#include "xf86_OSproc.h" + /* PCI support */ #include "xf86Pci.h" @@ -218,6 +220,7 @@ typedef struct { R128SaveRec SavedReg; /* Original (text) mode */ R128SaveRec ModeReg; /* Current mode */ Bool (*CloseScreen)(int, ScreenPtr); + void (*BlockHandler)(int, pointer, pointer, pointer); Bool PaletteSavedOnVT; /* Palette saved on last VT switch */ @@ -298,22 +301,14 @@ typedef struct { drmSize ringReadMapSize; /* Size of map */ unsigned char *ringReadPtr; /* Map */ - /* CCE vertex buffer data */ - unsigned long vbStart; /* Offset into AGP space */ - drmHandle vbHandle; /* Handle from drmAddMap */ - drmSize vbMapSize; /* Size of map */ - int vbSize; /* Size of vert bufs (in MB) */ - unsigned char *vb; /* Map */ - int vbBufSize; /* Size of individual vert buf */ - int vbNumBufs; /* Number of vert bufs */ - drmBufMapPtr vbBufs; /* Buffer map */ - - /* CCE indirect buffer data */ - unsigned long indStart; /* Offset into AGP space */ - drmHandle indHandle; /* Handle from drmAddMap */ - drmSize indMapSize; /* Size of map */ - int indSize; /* Size of indirect bufs (in MB) */ - unsigned char *ind; /* Map */ + /* CCE vertex/indirect buffer data */ + unsigned long bufStart; /* Offset into AGP space */ + drmHandle bufHandle; /* Handle from drmAddMap */ + drmSize bufMapSize; /* Size of map */ + int bufSize; /* Size of buffers (in MB) */ + unsigned char *buf; /* Map */ + int bufNumBufs; /* Number of buffers */ + drmBufMapPtr buffers; /* Buffer map */ /* CCE AGP Texture data */ unsigned long agpTexStart; /* Offset into AGP space */ @@ -330,12 +325,30 @@ typedef struct { int backY; int depthX; int depthY; - int textureX; - int textureY; + + int frontOffset; + int frontPitch; + int backOffset; + int backPitch; + int depthOffset; + int depthPitch; + int spanOffset; + int textureOffset; int textureSize; int log2TexGran; + + /* Saved scissor values */ + CARD32 sc_left; + CARD32 sc_right; + CARD32 sc_top; + CARD32 sc_bottom; + CARD32 aux_sc_cntl; #endif + XF86VideoAdaptorPtr adaptor; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + int videoKey; + Bool showCache; } R128InfoRec, *R128InfoPtr; #define R128WaitForFifo(pScrn, entries) \ @@ -365,10 +378,59 @@ extern void R128InitVideo(ScreenPtr pScreen); extern Bool R128DRIScreenInit(ScreenPtr pScreen); extern void R128DRICloseScreen(ScreenPtr pScreen); extern Bool R128DRIFinishScreenInit(ScreenPtr pScreen); -extern void R128CCEStart(ScrnInfoPtr pScrn); -extern void R128CCEStop(ScrnInfoPtr pScrn); -extern void R128CCEResetRing(ScrnInfoPtr pScrn); -extern void R128CCEWaitForIdle(ScrnInfoPtr pScrn); + +#define R128CCE_START(pScrn, info) \ +do { \ + int ret = drmR128StartCCE(info->drmFD); \ + if (ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "%s: CCE start %d\n", __FUNCTION__, ret); \ + } \ + info->CCEInUse = TRUE; \ +} while (0) + +#define R128CCE_STOP(pScrn, info) \ +do { \ + int ret = drmR128StopCCE(info->drmFD); \ + if (ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "%s: CCE stop %d\n", __FUNCTION__, ret); \ + } \ + info->CCEInUse = FALSE; \ +} while (0) + +#define R128CCE_RESET(pScrn, info) \ +do { \ + if (R128CCE_USE_RING_BUFFER(info->CCEMode)) { \ + int ret = drmR128ResetCCE(info->drmFD); \ + if (ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "%s: CCE reset %d\n", __FUNCTION__, ret); \ + } \ + } \ + info->CCEInUse = FALSE; \ +} while (0) + +#define R128CCE_TO_MMIO(pScrn, info) \ +do { \ + if (info->CCEInUse) { \ + R128CCE_STOP(pScrn, info); \ + \ + R128WaitForFifo(pScrn, 5); \ + OUTREG(R128_SC_LEFT, info->sc_left); \ + OUTREG(R128_SC_RIGHT, info->sc_right); \ + OUTREG(R128_SC_TOP, info->sc_top); \ + OUTREG(R128_SC_BOTTOM, info->sc_bottom); \ + OUTREG(R128_AUX_SC_CNTL, info->aux_sc_cntl); \ + } \ +} while (0) + +#define R128MMIO_TO_CCE(pScrn, info) \ +do { \ + if (!info->CCEInUse) { \ + R128CCE_START(pScrn, info); \ + } \ +} while (0) #endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c index 500b3e820..6a2d75aef 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.3 2000/11/18 19:37:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.4 2000/12/04 19:21:52 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -155,10 +155,6 @@ void R128EngineReset(ScrnInfoPtr pScrn) OUTPLL(R128_MCLK_CNTL, mclk_cntl); OUTREG(R128_CLOCK_CNTL_INDEX, clock_cntl_index); OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl); - -#ifdef XF86DRI - if (R128CCE_USE_RING_BUFFER(info->CCEMode)) R128CCEResetRing(pScrn); -#endif } /* The FIFO has 64 slots. This routines waits until at least `entries' of @@ -182,7 +178,10 @@ void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries) "FIFO timed out, resetting engine...\n"); R128EngineReset(pScrn); #ifdef XF86DRI - if (info->CCE2D) R128CCEStart(pScrn); + R128CCE_RESET(pScrn, info); + if (info->CCE2D) { + R128CCE_START(pScrn, info); + } #endif } } @@ -213,11 +212,46 @@ void R128WaitForIdle(ScrnInfoPtr pScrn) "Idle timed out, resetting engine...\n"); R128EngineReset(pScrn); #ifdef XF86DRI - if (info->CCE2D) R128CCEStart(pScrn); + R128CCE_RESET(pScrn, info); + if (info->CCE2D) { + R128CCE_START(pScrn, info); + } #endif } } +#ifdef XF86DRI +/* Wait until the CCE is completely idle: the FIFO has drained and the + * CCE is idle. + */ +static void R128CCEWaitForIdle(ScrnInfoPtr pScrn) +{ + R128InfoPtr info = R128PTR(pScrn); + int ret; + int i = 0; + + for (;;) { + do { + ret = drmR128WaitForIdleCCE(info->drmFD); + if (ret && ret != -EBUSY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: CCE idle %d\n", __FUNCTION__, ret); + } + } while ((ret == -EBUSY) && (i++ < R128_TIMEOUT)); + + if (ret == 0) return; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n"); + R128EngineReset(pScrn); + + /* Always restart the engine when doing CCE 2D acceleration */ + R128CCE_RESET(pScrn, info); + R128CCE_START(pScrn, info); + } +} +#endif + /* Setup for XAA SolidFill. */ static void R128SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) @@ -225,6 +259,10 @@ static void R128SetupForSolidFill(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 4); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_BRUSH_SOLID_COLOR @@ -246,6 +284,10 @@ static void R128SubsequentSolidFillRect(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 2); OUTREG(R128_DST_Y_X, (y << 16) | x); OUTREG(R128_DST_WIDTH_HEIGHT, (w << 16) | h); @@ -258,6 +300,10 @@ static void R128SetupForSolidLine(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 3); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_BRUSH_SOLID_COLOR @@ -290,6 +336,10 @@ static void R128SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, unsigned char *R128MMIO = info->MMIO; int flags = 0; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR; if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT; if (!(octant & YDECREASING)) flags |= R128_DST_Y_DIR_TOP_TO_BOTTOM; @@ -316,6 +366,10 @@ static void R128SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 1); OUTREG(R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT | R128_DST_Y_TOP_TO_BOTTOM)); @@ -350,6 +404,10 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn, unsigned char *R128MMIO = info->MMIO; CARD32 pat = *(CARD32 *)pattern; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + switch (length) { case 2: pat |= pat << 2; /* fall through */ case 4: pat |= pat << 4; /* fall through */ @@ -381,6 +439,10 @@ static void R128SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, unsigned char *R128MMIO = info->MMIO; int flags = 0; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR; if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT; if (!(octant & YDECREASING)) flags |= R128_DST_Y_DIR_TOP_TO_BOTTOM; @@ -418,6 +480,10 @@ static void R128SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, int origdxL = dxL; int origdxR = dxR; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128TRACE(("Trap %d %d; L %d %d %d %d; R %d %d %d %d\n", y, h, left, dxL, dyL, eL, @@ -468,6 +534,10 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + info->xdir = xdir; info->ydir = ydir; R128WaitForFifo(pScrn, 3); @@ -501,6 +571,10 @@ static void R128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + if (info->xdir < 0) xa += w - 1, xb += w - 1; if (info->ydir < 0) ya += h - 1, yb += h - 1; @@ -530,6 +604,10 @@ static void R128SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 6); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | (bg == -1 @@ -553,6 +631,10 @@ static void R128SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 3); OUTREG(R128_BRUSH_Y_X, (patterny << 8) | patternx); OUTREG(R128_DST_Y_X, (y << 16) | x); @@ -572,6 +654,10 @@ static void R128SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128TRACE(("Color8x8 %d %d %d\n", trans_color, patx, paty)); R128WaitForFifo(pScrn, 2); @@ -600,6 +686,10 @@ static void R128SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128TRACE(("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h)); R128WaitForFifo(pScrn, 3); OUTREG(R128_SRC_Y_X, (paty << 16) | patx); @@ -660,6 +750,10 @@ static void R128SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + R128WaitForFifo(pScrn, 4); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_DST_CLIPPING @@ -687,6 +781,10 @@ static void R128SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x1clip = x+skipleft; int x2clip = x+w; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + info->scanline_h = h; info->scanline_words = (w + 31) >> 5; @@ -733,6 +831,10 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) int left = info->scanline_words; volatile CARD32 *d; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + if (info->scanline_direct) return; --info->scanline_h; while (left) { @@ -779,6 +881,10 @@ static void R128SetupForScanlineImageWrite(ScrnInfoPtr pScrn, R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + info->scanline_bpp = bpp; R128WaitForFifo(pScrn, 2); @@ -815,6 +921,10 @@ static void R128SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int shift = 0; /* 32bpp */ +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + if (pScrn->bitsPerPixel == 8) shift = 3; else if (pScrn->bitsPerPixel == 16) shift = 1; @@ -863,6 +973,10 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) int left = info->scanline_words; volatile CARD32 *d; +#ifdef XF86DRI + R128CCE_TO_MMIO(pScrn, info); +#endif + if (info->scanline_direct) return; --info->scanline_h; while (left) { @@ -967,7 +1081,6 @@ static void R128CCEAccelInit(XAAInfoRecPtr a) /* Sync */ a->Sync = R128CCEWaitForIdle; - } #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c index 995472811..55b2a24db 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.5 2000/11/21 23:10:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.6 2000/12/04 19:21:52 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -33,6 +33,7 @@ * Kevin E. Martin <martin@valinux.com> * Rickard E. Faith <faith@valinux.com> * Daryll Strauss <daryll@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -51,144 +52,7 @@ #define _XF86DRI_SERVER_ #include "GL/glxtokens.h" #include "sarea.h" -#include "xf86drmR128.h" -#define R128_WATERMARK_L 16 -#define R128_WATERMARK_M 8 -#define R128_WATERMARK_N 8 -#define R128_WATERMARK_K 128 - -static int CCEFifoSlots = 0; - -#define R128CCEWaitForFifo(pScrn, entries) \ -do { \ - if (CCEFifoSlots < entries) R128WaitForFifoFunction(pScrn, entries); \ - CCEFifoSlots -= entries; \ -} while (0) - -/* Wait for at least `entries' slots are free. The actual number of - slots available is stored in info->CCEFifoSize. */ -static void R128CCEWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - int i; - - for (;;) { - for (i = 0; i < R128_TIMEOUT; i++) { - CCEFifoSlots = INREG(R128_PM4_STAT) & R128_PM4_FIFOCNT_MASK; - if (CCEFifoSlots >= entries) return; - } - R128EngineReset(pScrn); - if (info->CCE2D) R128CCEStart(pScrn); - } -} - -/* Wait until the CCE is completely idle: the FIFO has drained and the - CCE is idle. */ -void R128CCEWaitForIdle(ScrnInfoPtr pScrn) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - int i; - - if (!info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return; - - if (R128CCE_USE_RING_BUFFER(info->CCEMode)) { - volatile CARD32 *r128RingReadPtr = - (volatile CARD32 *)(info->ringReadPtr); - R128SAREAPrivPtr pSAREAPriv; - - OUTREGP(R128_PM4_BUFFER_DL_WPTR, - R128_PM4_BUFFER_DL_DONE, ~R128_PM4_BUFFER_DL_DONE); - - pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScrn->pScreen); - - for (;;) { - for (i = 0; i < R128_TIMEOUT; i++) { - if (*r128RingReadPtr == pSAREAPriv->ringWrite) { - int pm4stat = INREG(R128_PM4_STAT); - if ((pm4stat & R128_PM4_FIFOCNT_MASK) >= info->CCEFifoSize - && !(pm4stat & (R128_PM4_BUSY|R128_PM4_GUI_ACTIVE))) { - R128EngineFlush(pScrn); - return; - } - } - } - R128EngineReset(pScrn); - if (info->CCE2D) R128CCEStart(pScrn); - } - } else { - R128CCEWaitForFifoFunction(pScrn, info->CCEFifoSize); - - for (;;) { - for (i = 0; i < R128_TIMEOUT; i++) { - if (!(INREG(R128_PM4_STAT) - & (R128_PM4_BUSY | R128_PM4_GUI_ACTIVE))) { - R128EngineFlush(pScrn); - return; - } - } - R128EngineReset(pScrn); - if (info->CCE2D) R128CCEStart(pScrn); - } - } -} - -/* Reset the ring buffer status, if the engine was reset */ -void R128CCEResetRing(ScrnInfoPtr pScrn) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - R128SAREAPrivPtr pSAREAPriv; - volatile CARD32 *r128RingReadPtr; - - if (!info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return; - - r128RingReadPtr = (volatile CARD32 *)(info->ringReadPtr); - pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScrn->pScreen); - - OUTREG(R128_PM4_BUFFER_DL_WPTR, 0); - OUTREG(R128_PM4_BUFFER_DL_RPTR, 0); - pSAREAPriv->ringWrite = 0; - *r128RingReadPtr = 0; - - /* Resetting the ring turns off the CCE */ - info->CCEInUse = FALSE; -} - -/* Start the CCE, but only if it is not already in use and the requested - mode is a CCE mode. The mode is stored in info->CCEMode. */ -void R128CCEStart(ScrnInfoPtr pScrn) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - - if (info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return; - - R128WaitForIdle(pScrn); - OUTREG(R128_PM4_BUFFER_CNTL, info->CCEMode | info->ringSizeLog2QW); - (void)INREG(R128_PM4_BUFFER_ADDR); /* as per the sample code */ - OUTREG(R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN); - info->CCEInUse = TRUE; -} - -/* Stop the CCE, but only if it is in use and the requested mode is not - the non-CCE mode. This function also flushes any outstanding - requests before switching modes.*/ -void R128CCEStop(ScrnInfoPtr pScrn) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - - if (!info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return; - - R128CCEWaitForIdle(pScrn); - OUTREG(R128_PM4_MICRO_CNTL, 0); - OUTREG(R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4); - R128EngineReset(pScrn); - info->CCEInUse = FALSE; -} /* Initialize the visual configs that are supported by the hardware. These are combined with the visual configs that the indirect @@ -274,7 +138,11 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen) pConfigs[i].stencilSize = 0; pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - pConfigs[i].visualRating = GLX_NONE_EXT; + if (accum || stencil) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } pConfigs[i].transparentPixel = GLX_NONE; pConfigs[i].transparentRed = 0; pConfigs[i].transparentGreen = 0; @@ -348,7 +216,11 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen) } pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - pConfigs[i].visualRating = GLX_NONE_EXT; + if (accum || stencil) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } pConfigs[i].transparentPixel = GLX_NONE; pConfigs[i].transparentRed = 0; pConfigs[i].transparentGreen = 0; @@ -396,13 +268,6 @@ static void R128EnterServer(ScreenPtr pScreen) R128InfoPtr info = R128PTR(pScrn); if (info->accel) info->accel->NeedToSync = TRUE; - -#if 1 - if (!info->CCE2D) R128CCEStop(pScrn); -#else - if (info->CCE2D) R128CCEWaitForIdle(pScrn); - else R128CCEStop(pScrn); -#endif } /* Called when the X server goes to sleep to allow the X server's @@ -413,15 +278,22 @@ static void R128EnterServer(ScreenPtr pScreen) can start/stop the engine. */ static void R128LeaveServer(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - R128InfoPtr info = R128PTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; -#if 1 - if (!info->CCE2D) R128CCEStart(pScrn); -#else - if (info->CCE2D) R128CCEWaitForIdle(pScrn); - else R128CCEStart(pScrn); -#endif + if (!info->CCE2D) { + if (!info->CCEInUse) { + /* Save all hardware scissors */ + info->sc_left = INREG(R128_SC_LEFT); + info->sc_right = INREG(R128_SC_RIGHT); + info->sc_top = INREG(R128_SC_TOP); + info->sc_bottom = INREG(R128_SC_BOTTOM); + info->aux_sc_cntl = INREG(R128_SC_BOTTOM); + } + + R128MMIO_TO_CCE(pScrn, info); + } } /* Contexts can be swapped by the X server if necessary. This callback @@ -448,9 +320,9 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) /* FIXME: This routine needs to have acceleration turned on */ ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - R128InfoPtr info = R128PTR(pScrn); - BoxPtr pbox; - int nbox; + R128InfoPtr info = R128PTR(pScrn); + BoxPtr pbox, pboxSave; + int nbox, nboxSave; int depth; /* FIXME: Use accel when CCE 2D code is written */ @@ -469,8 +341,8 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) /* FIXME: Only initialize the back and depth buffers for contexts that request them */ - pbox = REGION_RECTS(prgn); - nbox = REGION_NUM_RECTS(prgn); + pboxSave = pbox = REGION_RECTS(prgn); + nboxSave = nbox = REGION_NUM_RECTS(prgn); (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, (CARD32)(-1)); for (; nbox; nbox--, pbox++) { @@ -486,6 +358,9 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) pbox->y2 - pbox->y1); } + pbox = pboxSave; + nbox = nboxSave; + (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, (CARD32)(-1)); for (; nbox; nbox--, pbox++) (*info->accel->SubsequentSolidFillRect)(pScrn, @@ -542,6 +417,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) mode &= ~R128_AGP_MODE_MASK; switch (info->agpMode) { + case 4: mode |= R128_AGP_4X_MODE; case 2: mode |= R128_AGP_2X_MODE; case 1: default: mode |= R128_AGP_1X_MODE; } @@ -585,16 +461,12 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) info->ringReadOffset = info->ringStart + info->ringMapSize; info->ringReadMapSize = 4096; - /* Reserve space for the vertex buffer */ - info->vbStart = info->ringReadOffset + info->ringReadMapSize; - info->vbMapSize = info->vbSize*1024*1024; - - /* Reserve space for the indirect buffer */ - info->indStart = info->vbStart + info->vbMapSize; - info->indMapSize = info->indSize*1024*1024; + /* Reserve space for vertex/indirect buffers */ + info->bufStart = info->ringReadOffset + info->ringReadMapSize; + info->bufMapSize = info->bufSize*1024*1024; /* Reserve the rest for AGP textures */ - info->agpTexStart = info->indStart + info->indMapSize; + info->agpTexStart = info->bufStart + info->bufMapSize; s = (info->agpSize*1024*1024 - info->agpTexStart); l = R128MinBits((s-1) / R128_NR_TEX_REGIONS); if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY; @@ -642,43 +514,25 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) "[agp] Ring read ptr mapped at 0x%08lx\n", (unsigned long)info->ringReadPtr); - if (drmAddMap(info->drmFD, info->vbStart, info->vbMapSize, - DRM_AGP, 0, &info->vbHandle) < 0) { + if (drmAddMap(info->drmFD, info->bufStart, info->bufMapSize, + DRM_AGP, 0, &info->bufHandle) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[agp] Could not add vertex buffers mapping\n"); + "[agp] Could not add vertex/indirect buffers mapping\n"); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] vertex buffers handle = 0x%08lx\n", info->vbHandle); + "[agp] vertex/indirect buffers handle = 0x%08lx\n", + info->bufHandle); - if (drmMap(info->drmFD, info->vbHandle, info->vbMapSize, - (drmAddressPtr)&info->vb) < 0) { + if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, + (drmAddressPtr)&info->buf) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[agp] Could not map vertex buffers\n"); + "[agp] Could not map vertex/indirect buffers\n"); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] Vertex buffers mapped at 0x%08lx\n", - (unsigned long)info->vb); - - if (drmAddMap(info->drmFD, info->indStart, info->indMapSize, - DRM_AGP, flags, &info->indHandle) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[agp] Could not add indirect buffers mapping\n"); - return FALSE; - } - xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] indirect buffers handle = 0x%08lx\n", info->indHandle); - - if (drmMap(info->drmFD, info->indHandle, info->indMapSize, - (drmAddressPtr)&info->ind) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[agp] Could not map indirect buffers\n"); - return FALSE; - } - xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] Indirect buffers mapped at 0x%08lx\n", - (unsigned long)info->ind); + "[agp] Vertex/indirect buffers mapped at 0x%08lx\n", + (unsigned long)info->buf); if (drmAddMap(info->drmFD, info->agpTexStart, info->agpTexMapSize, DRM_AGP, 0, &info->agpTexHandle) < 0) { @@ -723,14 +577,16 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) return TRUE; } +#if 0 /* Fake the vertex buffers for PCI cards. */ static Bool R128DRIPciInit(R128InfoPtr info) { - info->vbStart = 0; - info->vbMapSize = info->vbSize*1024*1024; + info->bufStart = 0; + info->bufMapSize = info->bufSize*1024*1024; return TRUE; } +#endif /* Add a map for the MMIO registers that will be accessed by any DRI-based clients. */ @@ -753,69 +609,37 @@ static Bool R128DRIMapInit(R128InfoPtr info, ScreenPtr pScreen) return TRUE; } -/* Initialize the ring buffer state for use in the X server and any - DRI-based clients. */ -static void R128DRICCEInitRingBuffer(ScrnInfoPtr pScrn) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - unsigned long addr; - - /* FIXME: When we use the CCE for the X server, we should move this - function (and the support functions above) to r128_accel.c */ - - /* The manual (p. 2) says this address is - in "VM space". This means it's an - offset from the start of AGP space. */ - OUTREG(R128_PM4_BUFFER_OFFSET, info->ringStart | 0x02000000); - - OUTREG(R128_PM4_BUFFER_DL_WPTR, 0); - OUTREG(R128_PM4_BUFFER_DL_RPTR, 0); - - /* DL_RPTR_ADDR is a physical address. - This should be in the SAREA. */ - *(volatile long unsigned *)(info->ringReadPtr) = 0; - OUTREG(R128_PM4_BUFFER_DL_RPTR_ADDR, (info->ringReadPtrHandle)); - - /* Set watermark control */ - OUTREG(R128_PM4_BUFFER_WM_CNTL, - ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) - | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) - | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) - | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT)); - - addr = INREG(R128_PM4_BUFFER_ADDR); /* Force read. Why? Because it's - in the examples... */ - -#if 0 - R128CCEWaitForIdle(pScrn); -#endif - - /* Turn on bus mastering */ - info->BusCntl &= ~R128_BUS_MASTER_DIS; - OUTREGP(R128_BUS_CNTL, 0, ~R128_BUS_MASTER_DIS); -} - /* Initialize the kernel data structures. */ -static int R128DRIKernelInit(R128InfoPtr info) +static int R128DRIKernelInit(R128InfoPtr info, ScreenPtr pScreen) { - drmR128Init drmInfo; + drmR128Init drmInfo; drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); drmInfo.is_pci = info->IsPCI; drmInfo.cce_mode = info->CCEMode; - drmInfo.cce_fifo_size = info->CCEFifoSize; drmInfo.cce_secure = info->CCESecure; drmInfo.ring_size = info->ringSize*1024*1024; drmInfo.usec_timeout = info->CCEusecTimeout; + drmInfo.fb_bpp = info->CurrentLayout.pixel_code; + drmInfo.depth_bpp = info->CurrentLayout.pixel_code; + + drmInfo.front_offset = info->frontOffset; + drmInfo.front_pitch = info->frontPitch; + + drmInfo.back_offset = info->backOffset; + drmInfo.back_pitch = info->backPitch; + + drmInfo.depth_offset = info->depthOffset; + drmInfo.depth_pitch = info->depthPitch; + drmInfo.span_offset = info->spanOffset; + drmInfo.fb_offset = info->LinearAddr; - drmInfo.agp_ring_offset = info->ringHandle; - drmInfo.agp_read_ptr_offset = info->ringReadPtrHandle; - drmInfo.agp_vertbufs_offset = info->vbHandle; - drmInfo.agp_indbufs_offset = info->indHandle; - drmInfo.agp_textures_offset = info->agpTexHandle; drmInfo.mmio_offset = info->registerHandle; + drmInfo.ring_offset = info->ringHandle; + drmInfo.ring_rptr_offset = info->ringReadPtrHandle; + drmInfo.buffers_offset = info->bufHandle; + drmInfo.agp_textures_offset = info->agpTexHandle; if (drmR128InitCCE(info->drmFD, &drmInfo) < 0) return FALSE; @@ -827,96 +651,44 @@ static int R128DRIKernelInit(R128InfoPtr info) static Bool R128DRIBufInit(R128InfoPtr info, ScreenPtr pScreen) { /* Initialize vertex buffers */ - if ((info->vbNumBufs = drmAddBufs(info->drmFD, - info->vbMapSize / info->vbBufSize, - info->vbBufSize, - DRM_AGP_BUFFER, - info->vbStart)) <= 0) { + if ((info->bufNumBufs = drmAddBufs(info->drmFD, + info->bufMapSize / R128_BUFFER_SIZE, + R128_BUFFER_SIZE, + DRM_AGP_BUFFER, + info->bufStart)) <= 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Could not create vertex buffers list\n"); + "[drm] Could not create vertex/indirect buffers list\n"); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Added %d %d byte vertex buffers\n", - info->vbNumBufs, info->vbBufSize); + "[drm] Added %d %d byte vertex/indirect buffers\n", + info->bufNumBufs, R128_BUFFER_SIZE); if (drmMarkBufs(info->drmFD, 0.133333, 0.266666)) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to mark vertex buffers list\n"); + "[drm] Failed to mark vertex/indirect buffers list\n"); return FALSE; } - if (!(info->vbBufs = drmMapBufs(info->drmFD))) { + if (!(info->buffers = drmMapBufs(info->drmFD))) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to map vertex buffers list\n"); + "[drm] Failed to map vertex/indirect buffers list\n"); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Mapped %d vertex buffers\n", - info->vbBufs->count); + "[drm] Mapped %d vertex/indirect buffers\n", + info->buffers->count); return TRUE; } -/* Load the microcode for the CCE */ -static void R128DRILoadMicrocode(ScrnInfoPtr pScrn) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - int i; - unsigned long R128Microcode[] = { - /* CCE microcode (from ATI) */ - 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, 1617039951, - 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, 599558925, 0, 589505315, 0, - 596487092, 0, 589505315, 1, 11544576, 1, 206848, 1, 311296, 1, 198656, 2, - 912273422, 11, 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, - 28, 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, 30, 1, - 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, 1, 15630, 1, 51200, - 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, 15717, 1, 15718, 2, 43, 1, - 15936948, 1, 570480831, 1, 14715071, 12, 322123831, 1, 33953125, 12, 55, 1, - 33559908, 1, 15718, 2, 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, - 509952, 1, 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, - 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, 15975928, 1, - 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, 268449859, 2, 10307, 12, - 176, 1, 15734, 1, 15735, 1, 15630, 1, 15631, 1, 5253120, 6, 3145810, 16, - 2150645232U, 1, 15864, 2, 82, 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, - 1, 7817, 1, 15729, 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, - 1, 16008, 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, - 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, 180224, 1, - 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, 114880, 14, 125, 12, - 206975, 1, 33559995, 12, 198784, 0, 33570236, 1, 15803, 0, 15804, 3, - 294912, 1, 294912, 3, 442370, 1, 11544576, 0, 811612160, 1, 12593152, 1, - 11536384, 1, 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, - 14793, 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, - 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, 114880, 14, - 159, 12, 198784, 1, 1109409213, 12, 198783, 1, 1107312059, 12, 198784, 1, - 1109409212, 2, 162, 1, 1075854781, 1, 1073757627, 1, 1075854780, 1, 540672, - 1, 10485760, 6, 3145894, 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, - 0, 0, 256, 14, 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, - 1, 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, 33560360, 1, - 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, 409611, 9, 188, 0, - 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 - }; - - R128WaitForIdle(pScrn); - - OUTREG(R128_PM4_MICROCODE_ADDR, 0); - for (i = 0; i < 256; i += 1) { - OUTREG(R128_PM4_MICROCODE_DATAH, R128Microcode[i*2]); - OUTREG(R128_PM4_MICROCODE_DATAL, R128Microcode[i*2 + 1]); - } -} - /* Initialize the CCE state, and start the CCE (if used by the X server) */ static void R128DRICCEInit(ScrnInfoPtr pScrn) { R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; + + /* Turn on bus mastering */ + info->BusCntl &= ~R128_BUS_MASTER_DIS; /* CCEMode is initialized in r128_driver.c */ switch (info->CCEMode) { @@ -934,11 +706,10 @@ static void R128DRICCEInit(ScrnInfoPtr pScrn) if (info->CCE2D) { /* Make sure the CCE is on for the X server */ - R128CCEStart(pScrn); + R128CCE_START(pScrn, info); } else { /* Make sure the CCE is off for the X server */ - OUTREG(R128_PM4_MICRO_CNTL, 0); - OUTREG(R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4); + R128CCE_STOP(pScrn, info); } } @@ -1051,6 +822,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n"); xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate = NULL; DRIDestroyInfoRec(pDRIInfo); @@ -1061,13 +833,13 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) /* Check the r128 DRM version */ version = drmGetVersion(info->drmFD); if (version) { - if (version->version_major != 1 || - version->version_minor != 0 || + if (version->version_major != 2 || + version->version_minor != 1 || version->version_patchlevel < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "R128DRIScreenInit failed " - "(DRM version = %d.%d.%d, expected 1.0.x). " + "(DRM version = %d.%d.%d, expected 2.1.x). " "Disabling DRI.\n", version->version_major, version->version_minor, @@ -1084,11 +856,19 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) R128DRICloseScreen(pScreen); return FALSE; } +#if 0 /* Initialize PCI */ - if (info->IsPCI && !R128DRIPciInit(info)) { + if (info->IsPCI && !R128DRIPciInit(info, pScreen)) { R128DRICloseScreen(pScreen); return FALSE; } +#else + if (info->IsPCI) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "PCI cards not yet supported\n"); + R128DRICloseScreen(pScreen); + return FALSE; + } +#endif /* DRIScreenInit doesn't add all the common mappings. Add additional @@ -1098,21 +878,6 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) return FALSE; } - /* Initialize the ring buffer */ - if (!info->IsPCI) R128DRICCEInitRingBuffer(pScrn); - - /* Initialize the kernel data structures */ - if (!R128DRIKernelInit(info)) { - R128DRICloseScreen(pScreen); - return FALSE; - } - - /* Initialize vertex buffers list */ - if (!info->IsPCI && !R128DRIBufInit(info, pScreen)) { - R128DRICloseScreen(pScreen); - return FALSE; - } - /* FIXME: When are these mappings unmapped? */ if (!R128InitVisualConfigs(pScreen)) { @@ -1121,12 +886,6 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Visual configs initialized\n"); - /* Load the CCE Microcode */ - R128DRILoadMicrocode(pScrn); - - /* Reset the Graphics Engine */ - R128EngineReset(pScrn); - return TRUE; } @@ -1135,20 +894,41 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) initialization. */ Bool R128DRIFinishScreenInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - R128InfoPtr info = R128PTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + R128InfoPtr info = R128PTR(pScrn); R128SAREAPrivPtr pSAREAPriv; R128DRIPtr pR128DRI; - /* Init and start the CCE */ + info->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + /* info->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ + + /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit + because *DRIKernelInit requires that the hardware lock is held by + the X server, and the first time the hardware lock is grabbed is + in DRIFinishScreenInit. */ + if (!DRIFinishScreenInit(pScreen)) { + R128DRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize the kernel data structures */ + if (!R128DRIKernelInit(info, pScreen)) { + R128DRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize the vertex buffers list */ + if (!info->IsPCI && !R128DRIBufInit(info, pScreen)) { + R128DRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize and start the CCE if required */ R128DRICCEInit(pScrn); pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScreen); memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - info->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; - /* info->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ - pR128DRI = (R128DRIPtr)info->pDRIInfo->devPrivate; pR128DRI->registerHandle = info->registerHandle; pR128DRI->registerSize = info->registerSize; @@ -1160,13 +940,9 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen) pR128DRI->ringReadPtrHandle = info->ringReadPtrHandle; pR128DRI->ringReadMapSize = info->ringReadMapSize; - pR128DRI->vbHandle = info->vbHandle; - pR128DRI->vbMapSize = info->vbMapSize; - pR128DRI->vbOffset = info->vbStart; - pR128DRI->vbBufSize = info->vbBufSize; - - pR128DRI->indHandle = info->indHandle; - pR128DRI->indMapSize = info->indMapSize; + pR128DRI->bufHandle = info->bufHandle; + pR128DRI->bufMapSize = info->bufMapSize; + pR128DRI->bufOffset = info->bufStart; pR128DRI->agpTexHandle = info->agpTexHandle; pR128DRI->agpTexMapSize = info->agpTexMapSize; @@ -1179,25 +955,24 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen) pR128DRI->depth = pScrn->depth; pR128DRI->bpp = pScrn->bitsPerPixel; - pR128DRI->fbX = info->fbX; - pR128DRI->fbY = info->fbY; - pR128DRI->backX = info->backX; - pR128DRI->backY = info->backY; - pR128DRI->depthX = info->depthX; - pR128DRI->depthY = info->depthY; - pR128DRI->textureX = info->textureX; - pR128DRI->textureY = info->textureY; + pR128DRI->frontOffset = info->frontOffset; + pR128DRI->frontPitch = info->frontPitch; + pR128DRI->backOffset = info->backOffset; + pR128DRI->backPitch = info->backPitch; + pR128DRI->depthOffset = info->depthOffset; + pR128DRI->depthPitch = info->depthPitch; + pR128DRI->spanOffset = info->spanOffset; + pR128DRI->textureOffset = info->textureOffset; pR128DRI->textureSize = info->textureSize; pR128DRI->log2TexGran = info->log2TexGran; pR128DRI->IsPCI = info->IsPCI; + pR128DRI->AGPMode = info->agpMode; pR128DRI->CCEMode = info->CCEMode; pR128DRI->CCEFifoSize = info->CCEFifoSize; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "0x%08lx %d\n", - pR128DRI->registerHandle, pR128DRI->registerSize); - return DRIFinishScreenInit(pScreen); + return TRUE; } /* The screen is being closed, so clean up any state and free any @@ -1208,12 +983,14 @@ void R128DRICloseScreen(ScreenPtr pScreen) R128InfoPtr info = R128PTR(pScrn); /* Stop the CCE if it is still in use */ - if (info->CCE2D) R128CCEStop(pScrn); + if (info->CCE2D) { + R128CCE_STOP(pScrn, info); + } /* De-allocate vertex buffers */ - if (info->vbBufs) { - drmUnmapBufs(info->vbBufs); - info->vbBufs = NULL; + if (info->buffers) { + drmUnmapBufs(info->buffers); + info->buffers = NULL; } /* De-allocate all kernel resources */ @@ -1224,13 +1001,9 @@ void R128DRICloseScreen(ScreenPtr pScreen) drmUnmap(info->agpTex, info->agpTexMapSize); info->agpTex = NULL; } - if (info->ind) { - drmUnmap(info->ind, info->indMapSize); - info->ind = NULL; - } - if (info->vb) { - drmUnmap(info->vb, info->vbMapSize); - info->vb = NULL; + if (info->buf) { + drmUnmap(info->buf, info->bufMapSize); + info->buf = NULL; } if (info->ringReadPtr) { drmUnmap(info->ringReadPtr, info->ringReadMapSize); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h index e33ec34a4..c9c9a7543 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.4 2000/12/04 19:21:52 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -32,6 +32,7 @@ * Authors: * Kevin E. Martin <martin@valinux.com> * Rickard E. Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -39,6 +40,7 @@ #define _R128_DRI_ #include "xf86drm.h" +#include "xf86drmR128.h" /* DRI Driver defaults */ #define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM @@ -46,14 +48,16 @@ #define R128_DEFAULT_AGP_MODE 2 #define R128_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */ #define R128_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ -#define R128_DEFAULT_VB_SIZE 1 /* MB (must be page aligned) */ -#define R128_DEFAULT_IND_SIZE 1 /* MB (must be page aligned) */ +#define R128_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ #define R128_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */ -#define R128_DEFAULT_VB_BUF_SIZE 16384 /* bytes */ #define R128_DEFAULT_CCE_TIMEOUT 10000 /* usecs */ -#define R128_AGP_MAX_MODE 2 +#define R128_AGP_MAX_MODE 4 + +#define R128_CARD_TYPE_R128 1 +#define R128_CARD_TYPE_R128_PRO 2 +#define R128_CARD_TYPE_R128_MOBILITY 3 #define R128CCE_USE_RING_BUFFER(m) \ (((m) == R128_PM4_192BM) || \ @@ -75,15 +79,10 @@ typedef struct { drmHandle ringReadPtrHandle; drmSize ringReadMapSize; - /* CCE vertex buffer data */ - drmHandle vbHandle; - drmSize vbMapSize; - int vbOffset; - int vbBufSize; - - /* CCE indirect buffer data */ - drmHandle indHandle; - drmSize indMapSize; + /* CCE vertex/indirect buffer data */ + drmHandle bufHandle; + drmSize bufMapSize; + int bufOffset; /* CCE AGP Texture data */ drmHandle agpTexHandle; @@ -98,18 +97,19 @@ typedef struct { int depth; /* Depth of display (8, 15, 16, 24) */ int bpp; /* Bit depth of display (8, 16, 24, 32) */ - int fbX; /* Start of frame buffer */ - int fbY; - int backX; /* Start of shared back buffer */ - int backY; - int depthX; /* Start of shared depth buffer */ - int depthY; - int textureX; /* Start of texture data in frame buffer */ - int textureY; + int frontOffset; /* Start of front buffer */ + int frontPitch; + int backOffset; /* Start of shared back buffer */ + int backPitch; + int depthOffset; /* Start of shared depth buffer */ + int depthPitch; + int spanOffset; /* Start of scratch spanline */ + int textureOffset;/* Start of texture data in frame buffer */ int textureSize; int log2TexGran; int IsPCI; /* Current card is a PCI card */ + int AGPMode; int CCEMode; /* CCE mode that server/clients use */ int CCEFifoSize; /* Size of the CCE command FIFO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c index 488fa1e65..ada2af0b0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.6 2000/11/28 17:25:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.8 2000/12/04 19:21:52 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -32,6 +32,7 @@ * Authors: * Rickard E. Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * * Credits: * @@ -94,11 +95,13 @@ #include "xf86PciInfo.h" #include "xf86RAC.h" #include "xf86cmap.h" +#include "xf86xv.h" #include "vbe.h" /* fbdevhw & vgahw */ #include "fbdevhw.h" #include "vgaHW.h" +#include "dixstruct.h" #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) @@ -128,8 +131,7 @@ typedef enum { OPTION_AGP_MODE, OPTION_AGP_SIZE, OPTION_RING_SIZE, - OPTION_VERT_SIZE, - OPTION_VBUF_SIZE, + OPTION_BUFFER_SIZE, OPTION_USE_CCE_2D, #endif #if 0 @@ -139,7 +141,9 @@ typedef enum { OPTION_PANEL_WIDTH, OPTION_PANEL_HEIGHT, OPTION_PROG_FP_REGS, - OPTION_FBDEV + OPTION_FBDEV, + OPTION_VIDEO_KEY, + OPTION_SHOW_CACHE } R128Opts; OptionInfoRec R128Options[] = { @@ -155,8 +159,7 @@ OptionInfoRec R128Options[] = { { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_VERT_SIZE, "VBListSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_VBUF_SIZE, "VBSize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_USE_CCE_2D, "UseCCEfor2D", OPTV_BOOLEAN, {0}, FALSE }, #endif #if 0 @@ -167,6 +170,8 @@ OptionInfoRec R128Options[] = { { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE }, { OPTION_PROG_FP_REGS, "ProgramFPRegs", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, + { OPTION_SHOW_CACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -1147,12 +1152,9 @@ static Bool R128PreInitDRI(ScrnInfoPtr pScrn) info->agpMode = R128_DEFAULT_AGP_MODE; info->agpSize = R128_DEFAULT_AGP_SIZE; info->ringSize = R128_DEFAULT_RING_SIZE; - info->vbSize = R128_DEFAULT_VB_SIZE; - info->indSize = R128_DEFAULT_IND_SIZE; + info->bufSize = R128_DEFAULT_BUFFER_SIZE; info->agpTexSize = R128_DEFAULT_AGP_TEX_SIZE; - info->vbBufSize = R128_DEFAULT_VB_BUF_SIZE; - info->CCEusecTimeout = R128_DEFAULT_CCE_TIMEOUT; if (!info->IsPCI) { @@ -1196,36 +1198,31 @@ static Bool R128PreInitDRI(ScrnInfoPtr pScrn) } if (xf86GetOptValInteger(R128Options, - OPTION_VERT_SIZE, &(info->vbSize))) { - if (info->vbSize < 1 || info->vbSize >= (int)info->agpSize) { + OPTION_BUFFER_SIZE, &(info->bufSize))) { + if (info->bufSize < 1 || info->bufSize >= (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Illegal vertex buffers list size: %d MB\n", - info->vbSize); + "Illegal vertex/indirect buffers size: %d MB\n", + info->bufSize); return FALSE; } - } - - if (xf86GetOptValInteger(R128Options, - OPTION_VBUF_SIZE, &(info->vbBufSize))) { - int numBufs = info->vbSize*1024*1024/info->vbBufSize; - if (numBufs < 2 || numBufs > 512) { /* FIXME: 512 is arbitrary */ + if (info->bufSize > 2) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Illegal individual vertex buffer size: %d bytes\n", - info->vbBufSize); - return FALSE; + "Illegal vertex/indirect buffers size: %d MB\n", + info->bufSize); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Clamping vertex/indirect buffers size to 2 MB\n"); + info->bufSize = 2; } } - if (info->ringSize + info->vbSize + info->indSize + info->agpTexSize > + if (info->ringSize + info->bufSize + info->agpTexSize > (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Buffers are too big for requested AGP space\n"); return FALSE; } - info->agpTexSize = info->agpSize - (info->ringSize + - info->vbSize + - info->indSize); + info->agpTexSize = info->agpSize - (info->ringSize + info->bufSize); } if (xf86GetOptValInteger(R128Options, OPTION_USEC_TIMEOUT, @@ -1326,6 +1323,18 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) if (!R128PreInitWeight(pScrn)) goto fail; + if(xf86GetOptValInteger(R128Options, OPTION_VIDEO_KEY, &(info->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + info->videoKey); + } else { + info->videoKey = 0x1E; + } + + if (xf86ReturnOptValBool(R128Options, OPTION_SHOW_CACHE, FALSE)) { + info->showCache = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n"); + } + if (xf86ReturnOptValBool(R128Options, OPTION_FBDEV, FALSE)) { info->FBDev = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, @@ -1439,13 +1448,28 @@ static void R128LoadPalette(ScrnInfoPtr pScrn, int numColors, } } +static void +R128BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + R128InfoPtr info = R128PTR(pScrn); + + pScreen->BlockHandler = info->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = R128BlockHandler; + + if(info->VideoTimerCallback) { + (*info->VideoTimerCallback)(pScrn, currentTime.milliseconds); + } +} + /* Called at the start of each server generation. */ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; R128InfoPtr info = R128PTR(pScrn); BoxRec MemBox; - int y2; R128TRACE(("R128ScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset)); @@ -1459,6 +1483,8 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) #ifdef XF86DRI info->fbX = 0; info->fbY = 0; + info->frontOffset = 0; + info->frontPitch = pScrn->displayWidth; #endif info->PaletteSavedOnVT = FALSE; @@ -1495,21 +1521,26 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) info->CurrentLayout.pixel_bytes); int maxy = info->FbMapSize / width_bytes; - if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE) && - (maxy > pScrn->virtualY * 3) -#if 0 + if (xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Acceleration disabled, not initializing the DRI\n"); + info->directRenderingEnabled = FALSE; +#if 1 + } else if (info->HasPanelRegs) { /* FIXME: Disable 3D support for FPs until it is tested */ - && !info->HasPanelRegs + xf86DrvMsg(scrnIndex, X_WARNING, + "DRI disabled on Mobility 128 by default\n"); + info->directRenderingEnabled = FALSE; #endif - ) { - info->directRenderingEnabled = R128DRIScreenInit(pScreen); - } else { + } else if (maxy <= pScrn->virtualY * 4) { xf86DrvMsg(scrnIndex, X_WARNING, "Static buffer allocation failed -- " "need at least %d kB video memory\n", (pScrn->displayWidth * pScrn->virtualY * - info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024); + info->CurrentLayout.pixel_bytes * 4 + 1023) / 1024); info->directRenderingEnabled = FALSE; + } else { + info->directRenderingEnabled = R128DRIScreenInit(pScreen); } } #endif @@ -1585,169 +1616,205 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) R128DGAInit(pScreen); /* Memory manager setup */ - MemBox.x1 = 0; - MemBox.y1 = 0; - MemBox.x2 = pScrn->displayWidth; - y2 = (info->FbMapSize - / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes)); - if (y2 >= 32768) y2 = 32767; /* because MemBox.y2 is signed short */ - MemBox.y2 = y2; - - /* The acceleration engine uses 14 bit - signed coordinates, so we can't have any - drawable caches beyond this region. */ - if (MemBox.y2 > 8191) MemBox.y2 = 8191; - - if (!xf86InitFBManager(pScreen, &MemBox)) { - xf86DrvMsg(scrnIndex, X_ERROR, - "Memory manager initialization to (%d,%d) (%d,%d) failed\n", - MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - return FALSE; - } else { - int width, height; - FBAreaPtr fbarea; - - xf86DrvMsg(scrnIndex, X_INFO, - "Memory manager initialized to (%d,%d) (%d,%d)\n", - MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - 2, 0, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved area from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); - } - if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { - xf86DrvMsg(scrnIndex, X_INFO, - "Largest offscreen area available: %d x %d\n", - width, height); - } - } - #ifdef XF86DRI - /* Allocate frame buffer space for the - shared back and depth buffers as well - as for local textures. */ if (info->directRenderingEnabled) { - FBAreaPtr fbarea; - int width_bytes = (pScrn->displayWidth * - info->CurrentLayout.pixel_bytes); - int maxy = info->FbMapSize / width_bytes; - int l; - - switch (info->CCEMode) { - case R128_DEFAULT_CCE_PIO_MODE: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in PIO mode\n"); - break; - case R128_DEFAULT_CCE_BM_MODE: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in BM mode\n"); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in UNKNOWN mode\n"); - break; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB AGP aperture\n", info->agpSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for the ring buffer\n", info->ringSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for vertex buffers\n", info->vbSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for indirect buffers\n", info->indSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for AGP textures\n", info->agpTexSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d byte vertex buffers\n", info->vbBufSize); + FBAreaPtr fbarea; + int width_bytes = (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes); + int cpp = info->CurrentLayout.pixel_bytes; + int bufferSize = pScrn->virtualY * width_bytes; + int l, total; + int scanlines; + + switch (info->CCEMode) { + case R128_DEFAULT_CCE_PIO_MODE: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in PIO mode\n"); + break; + case R128_DEFAULT_CCE_BM_MODE: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in BM mode\n"); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in UNKNOWN mode\n"); + break; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB AGP aperture\n", info->agpSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB for the ring buffer\n", info->ringSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB for vertex/indirect buffers\n", info->bufSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB for AGP textures\n", info->agpTexSize); + + /* Try for front, back, depth, and two framebuffers worth of + * pixmap cache. Should be enough for a fullscreen background + * image plus some leftovers. + */ + info->textureSize = info->FbMapSize - 5 * bufferSize; + + /* If that gives us less than half the available memory, let's + * be greedy and grab some more. Sorry, I care more about 3D + * performance than playing nicely, and you'll get around a full + * framebuffer's worth of pixmap cache anyway. + */ + if ( info->textureSize < info->FbMapSize / 2 ) { + info->textureSize = info->FbMapSize - 4 * bufferSize; + } + + l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS); + if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY; + + /* Round the texture size up to the nearest whole number of + * texture regions. Again, be greedy about this, don't round + * down. + */ + info->log2TexGran = l; + info->textureSize = ((info->textureSize >> l) + 1) << l; + + total = info->FbMapSize - info->textureSize; + scanlines = total / width_bytes; + if (scanlines > 8191) scanlines = 8191; + + /* Recalculate the texture offset and size to accomodate any + * rounding to a whole number of scanlines. + * FIXME: Is this actually needed? + */ + info->textureOffset = scanlines * width_bytes; + info->textureSize = info->FbMapSize - info->textureOffset; + + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + MemBox.y2 = scanlines; + + if (!xf86InitFBManager(pScreen, &MemBox)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + return FALSE; + } else { + int width, height; + + xf86DrvMsg(scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + 2, 0, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved area from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + } + if (xf86QueryLargestOffscreenArea(pScreen, &width, + &height, 0, 0, 0)) { + xf86DrvMsg(scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height); + } + } /* Allocate the shared back buffer */ - if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY, - 32, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved back buffer from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - - info->backX = fbarea->box.x1; - info->backY = fbarea->box.y1; - } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve back buffer\n"); - info->backX = -1; - info->backY = -1; - } + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->virtualX, + pScrn->virtualY, + 32, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved back buffer from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + + info->backX = fbarea->box.x1; + info->backY = fbarea->box.y1; + info->backOffset = (fbarea->box.y1 * width_bytes + + fbarea->box.x1 * cpp); + info->backPitch = pScrn->displayWidth; + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve back buffer\n"); + info->backX = -1; + info->backY = -1; + info->backOffset = -1; + info->backPitch = -1; + } /* Allocate the shared depth buffer */ - if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY, - 32, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved depth buffer from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->virtualX, + pScrn->virtualY + 1, + 32, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved depth buffer from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + + info->depthX = fbarea->box.x1; + info->depthY = fbarea->box.y1; + info->depthOffset = (fbarea->box.y1 * width_bytes + + fbarea->box.x1 * cpp); + info->depthPitch = pScrn->displayWidth; + info->spanOffset = ((fbarea->box.y2 - 1) * width_bytes + + fbarea->box.x1 * cpp); + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved depth span from (%d,%d) offset 0x%x\n", + fbarea->box.x1, fbarea->box.y2 - 1, info->spanOffset); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve depth buffer\n"); + info->depthX = -1; + info->depthY = -1; + info->depthOffset = -1; + info->depthPitch = -1; + info->spanOffset = -1; + } + + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved %d kb for textures at offset 0x%x\n", + info->textureSize/1024, total); + } + else +#endif + { + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + MemBox.y2 = (info->FbMapSize + / (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes)); + /* The acceleration engine uses 14 bit + signed coordinates, so we can't have any + drawable caches beyond this region. */ + if (MemBox.y2 > 8191) MemBox.y2 = 8191; - info->depthX = fbarea->box.x1; - info->depthY = fbarea->box.y1; + if (!xf86InitFBManager(pScreen, &MemBox)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + return FALSE; } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve depth buffer\n"); - info->depthX = -1; - info->depthY = -1; - } - - /* Allocate local texture space */ - if (((maxy - MemBox.y2 - 1) * width_bytes) > - (pScrn->virtualX * pScrn->virtualY * 2 * - info->CurrentLayout.pixel_bytes)) { - info->textureX = 0; - info->textureY = MemBox.y2 + 1; - info->textureSize = (maxy - MemBox.y2 - 1) * width_bytes; - - l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS); - if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY; - - info->log2TexGran = l; - info->textureSize = (info->textureSize >> l) << l; - - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved %d kb for textures: (%d,%d)-(%d,%d)\n", - info->textureSize/1024, - info->textureX, info->textureY, - pScrn->displayWidth, maxy); - } else if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY * 2, - 32, - NULL, NULL, NULL))) { - info->textureX = fbarea->box.x1; - info->textureY = fbarea->box.y1; - info->textureSize = ((fbarea->box.y2 - fbarea->box.y1) * - (fbarea->box.x2 - fbarea->box.x1) * - info->CurrentLayout.pixel_bytes); - - l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS); - if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY; - - info->log2TexGran = l; - info->textureSize = (info->textureSize >> l) << l; + int width, height; + FBAreaPtr fbarea; xf86DrvMsg(scrnIndex, X_INFO, - "Reserved %d kb for textures: (%d,%d)-(%d,%d)\n", - info->textureSize/1024, - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - } else { - xf86DrvMsg(scrnIndex, X_ERROR, - "Unable to reserve texture space in frame buffer\n"); - info->textureX = -1; - info->textureY = -1; + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + 2, 0, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved area from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + } + if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, + 0, 0, 0)) { + xf86DrvMsg(scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height); + } } } -#endif - /* Backing store setup */ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -1843,6 +1910,9 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif + info->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = R128BlockHandler; + return TRUE; } @@ -2697,6 +2767,9 @@ void R128AdjustFrame(int scrnIndex, int x, int y, int flags) unsigned char *R128MMIO = info->MMIO; int Base; + if(info->showCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; + Base = y * info->CurrentLayout.displayWidth + x; switch (info->CurrentLayout.pixel_code) { @@ -2724,7 +2797,7 @@ Bool R128EnterVT(int scrnIndex, int flags) R128TRACE(("R128EnterVT\n")); #ifdef XF86DRI if (R128PTR(pScrn)->directRenderingEnabled) { - R128CCEStart(pScrn); + R128CCE_START(pScrn, info); DRIUnlock(pScrn->pScreen); } #endif @@ -2750,7 +2823,7 @@ void R128LeaveVT(int scrnIndex, int flags) #ifdef XF86DRI if (R128PTR(pScrn)->directRenderingEnabled) { DRILock(pScrn->pScreen, 0); - R128CCEStop(pScrn); + R128CCE_STOP(pScrn, info); } #endif R128SavePalette(pScrn, save); @@ -2813,9 +2886,16 @@ static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen) if (info->DGAModes) xfree(info->DGAModes); info->DGAModes = NULL; + + if (info->adaptor) { + xfree(info->adaptor->pPortPrivates[0].ptr); + xf86XVFreeVideoAdaptorRec(info->adaptor); + info->adaptor = NULL; + } pScrn->vtSema = FALSE; + pScreen->BlockHandler = info->BlockHandler; pScreen->CloseScreen = info->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c index 053835976..ab11ae374 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.4 2000/11/28 17:25:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.5 2000/12/02 15:30:33 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -109,7 +109,7 @@ R128Probe(DriverPtr drv, int flags) int numUsed; int numDevSections, nATIGDev, nR128GDev; int *usedChips; - GDevPtr *devSections, *ATIGDevs = NULL, *R128GDevs = NULL; + GDevPtr *devSections, *ATIGDevs, *R128GDevs; EntityInfoPtr pEnt; Bool foundScreen = FALSE; int i; @@ -193,7 +193,7 @@ R128Probe(DriverPtr drv, int flags) xfree(pEnt); } - if (numUsed) xfree(usedChips); + xfree(usedChips); xfree(devSections); return foundScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h index 33b418568..436c3d93b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.4 2000/12/04 19:21:53 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -32,6 +32,7 @@ * Authors: * Rickard E. Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * * References: * @@ -151,6 +152,7 @@ #define R128_ATTRDR 0x03c1 /* VGA */ #define R128_ATTRDW 0x03c0 /* VGA */ #define R128_ATTRX 0x03c0 /* VGA */ +#define R128_AUX_SC_CNTL 0x1660 # define R128_AUX1_SC_EN (1 << 0) # define R128_AUX1_SC_MODE_OR (0 << 1) # define R128_AUX1_SC_MODE_NAND (1 << 1) @@ -160,7 +162,6 @@ # define R128_AUX3_SC_EN (1 << 4) # define R128_AUX3_SC_MODE_OR (0 << 5) # define R128_AUX3_SC_MODE_NAND (1 << 5) -#define R128_AUX_SC_CNTL 0x1660 #define R128_AUX1_SC_BOTTOM 0x1670 #define R128_AUX1_SC_LEFT 0x1664 #define R128_AUX1_SC_RIGHT 0x1668 @@ -421,6 +422,8 @@ # define R128_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4) # define R128_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4) # define R128_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4) +# define R128_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4) +# define R128_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4) # define R128_GMC_BRUSH_8x8_COLOR (10 << 4) # define R128_GMC_BRUSH_1X8_COLOR (12 << 4) # define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) @@ -509,6 +512,7 @@ #define R128_DST_PITCH_OFFSET 0x142c #define R128_DST_PITCH_OFFSET_C 0x1c80 # define R128_PITCH_SHIFT 21 +# define R128_DST_TILE (1 << 31) #define R128_DST_WIDTH 0x140c #define R128_DST_WIDTH_HEIGHT 0x1598 #define R128_DST_WIDTH_X 0x1588 @@ -1088,11 +1092,12 @@ # define R128_SET_UP_CONTINUE (1 << 31) #define R128_WINDOW_XY_OFFSET 0x1bcc -# define R128_WINDOW_Y_SHIFT 4 -# define R128_WINDOW_X_SHIFT 20 +# define R128_WINDOW_Y_SHIFT 2 +# define R128_WINDOW_X_SHIFT 18 #define R128_Z_OFFSET_C 0x1c90 #define R128_Z_PITCH_C 0x1c94 +# define R128_Z_TILE (1 << 16) #define R128_Z_STEN_CNTL_C 0x1c98 # define R128_Z_PIX_WIDTH_16 (0 << 1) # define R128_Z_PIX_WIDTH_24 (1 << 1) @@ -1163,6 +1168,7 @@ # define R128_ANTI_ALIAS (1 << 21) # define R128_TEX_CACHE_FLUSH (1 << 23) # define R128_LOD_BIAS_SHIFT 24 +# define R128_LOD_BIAS_MASK (0xff << 24) #define R128_MISC_3D_STATE_CNTL_REG 0x1ca0 # define R128_REF_ALPHA_MASK 0xff # define R128_MISC_SCALE_3D_NOOP (0 << 8) @@ -1388,14 +1394,14 @@ /* Constants */ #define R128_AGP_TEX_OFFSET 0x02000000 -#define R128_VB_AGE_REG R128_GUI_SCRATCH_REG0 -#define R128_SWAP_AGE_REG R128_GUI_SCRATCH_REG1 +#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 /* CCE packet types */ #define R128_CCE_PACKET0 0x00000000 #define R128_CCE_PACKET0_ONE_REG_WR 0x00008000 #define R128_CCE_PACKET1 0x40000000 #define R128_CCE_PACKET2 0x80000000 +#define R128_CCE_PACKET3 0xC0000000 #define R128_CCE_PACKET3_NOP 0xC0001000 #define R128_CCE_PACKET3_PAINT 0xC0001100 #define R128_CCE_PACKET3_BITBLT 0xC0001200 @@ -1432,7 +1438,7 @@ #define R128_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xC0002E00 # define R128_CCE_PACKET_MASK 0xC0000000 # define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 -# define R128_CCE_PACKET_MAX_DWORDS (1 << 14) +# define R128_CCE_PACKET_MAX_DWORDS (1 << 12) # define R128_CCE_PACKET0_REG_MASK 0x000007ff # define R128_CCE_PACKET1_REG0_MASK 0x000007ff # define R128_CCE_PACKET1_REG1_MASK 0x003ff800 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h index e7cb76862..1dbc5088a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.4 2000/12/04 19:21:53 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -31,6 +31,7 @@ /* * Authors: * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -39,21 +40,142 @@ #include "Xmd.h" +/* WARNING: If you change any of these defines, make sure to change the + * defines in the kernel file (r128_drm.h) + */ +#ifndef __R128_SAREA_DEFINES__ +#define __R128_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define R128_UPLOAD_CONTEXT 0x001 +#define R128_UPLOAD_SETUP 0x002 +#define R128_UPLOAD_TEX0 0x004 +#define R128_UPLOAD_TEX1 0x008 +#define R128_UPLOAD_TEX0IMAGES 0x010 +#define R128_UPLOAD_TEX1IMAGES 0x020 +#define R128_UPLOAD_CORE 0x040 +#define R128_UPLOAD_MASKS 0x080 +#define R128_UPLOAD_WINDOW 0x100 +#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ +#define R128_REQUIRE_QUIESCENCE 0x400 +#define R128_UPLOAD_ALL 0x7ff + +#define R128_FRONT 0x1 +#define R128_BACK 0x2 +#define R128_DEPTH 0x4 + +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#if 1 +#define R128_BUFFER_SIZE 16384 +#else +#define R128_BUFFER_SIZE (128 * 1024) +#endif + +/* Byte offsets for indirect buffer data + */ +#define R128_INDEX_PRIM_OFFSET 20 +#define R128_HOSTDATA_BLIT_OFFSET 32 + +/* Keep these small for testing + */ +#define R128_NR_SAREA_CLIPRECTS 12 + /* There are 2 heaps (local/AGP). Each region within a heap is a - minimum of 64k, and there are at most 64 of them per heap. */ -#define R128_LOCAL_TEX_HEAP 0 -#define R128_AGP_TEX_HEAP 1 -#define R128_NR_TEX_HEAPS 2 -#define R128_NR_TEX_REGIONS 64 -#define R128_LOG_TEX_GRANULARITY 16 + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define R128_LOCAL_TEX_HEAP 0 +#define R128_AGP_TEX_HEAP 1 +#define R128_NR_TEX_HEAPS 2 +#define R128_NR_TEX_REGIONS 64 +#define R128_LOG_TEX_GRANULARITY 16 + +#define R128_NR_CONTEXT_REGS 12 +#define R128_TEX_MAXLEVELS 11 + +#endif /* __R128_SAREA_DEFINES__ */ typedef struct { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ -} R128TexRegion; + /* Context state - can be written in one large chunk */ + unsigned long dst_pitch_offset_c; + unsigned long dp_gui_master_cntl_c; + unsigned long sc_top_left_c; + unsigned long sc_bottom_right_c; + unsigned long z_offset_c; + unsigned long z_pitch_c; + unsigned long z_sten_cntl_c; + unsigned long tex_cntl_c; + unsigned long misc_3d_state_cntl_reg; + unsigned long texture_clr_cmp_clr_c; + unsigned long texture_clr_cmp_msk_c; + unsigned long fog_color_c; + + /* Texture state */ + unsigned long tex_size_pitch_c; + unsigned long constant_color_c; + + /* Setup state */ + unsigned long pm4_vc_fpu_setup; + unsigned long setup_cntl; + + /* Mask state */ + unsigned long dp_write_mask; + unsigned long sten_ref_mask_c; + unsigned long plane_3d_mask_c; + + /* Window state */ + unsigned long window_xy_offset; + + /* Core state */ + unsigned long scale_3d_cntl; +} r128_context_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned long tex_cntl; + unsigned long tex_combine_cntl; + unsigned long tex_size_pitch; + unsigned long tex_offset[R128_TEX_MAXLEVELS]; + unsigned long tex_border_color; +} r128_texture_regs_t; typedef struct { + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ +} r128_tex_region_t; + +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + r128_context_regs_t ContextState; + r128_texture_regs_t TexState[R128_NR_TEX_HEAPS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + /* Maintain an LRU of contiguous regions of texture space. If you * think you own a region of texture memory, and it has an age * different to the one you set, then you are mistaken and it has @@ -69,13 +191,11 @@ typedef struct { * else's - simply eject them all in LRU order. */ /* Last elt is sentinal */ - R128TexRegion texList[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; + r128_tex_region_t texList[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; /* last time texture was uploaded */ - int texAge[R128_NR_TEX_HEAPS]; - - int ctxOwner; /* last context to upload state */ + int texAge[R128_NR_TEX_HEAPS]; - CARD32 ringWrite; /* current ring buffer write index */ + int ctxOwner; /* last context to upload state */ } R128SAREAPriv, *R128SAREAPrivPtr; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c index 84f48ba86..76a3cc758 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c @@ -1,51 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.4 2000/11/21 23:10:34 tsi Exp $ */ -/* - * Copyright 2000 Stuart R. Anderson and Metro Link, Inc. - * - * 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 on - * 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 (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS 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. - */ - -/* - * Authors: - * Stuart R. Anderson <anderson@metrolink.com> - * - * Credits: - * - * This code is derived primarily from the GATOS Project run by Stea Greene. - * The initial version of this code was done by Vladimir Dergacheb. - * - * This code was simplified from the GATOS code primarily because I didn't - * have the right hardware handy to test anything beyond simple overlays, - * and because I wanted to complete it in a short time frame that I had - * available. - * - * My apologies to Vladimir as there is more good work in his code that - * should be brought forward. - */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.11 2000/12/03 23:41:57 mvojkovi Exp $ */ #include "r128.h" #include "r128_reg.h" #include "xf86.h" +#include "dixstruct.h" #include "Xv.h" #include "fourcc.h" @@ -59,62 +18,58 @@ #define TIMER_MASK (OFF_TIMER | FREE_TIMER) + #ifndef XvExtension void R128InitVideo(ScreenPtr pScreen) {} #else -static XF86VideoAdaptorPtr R128SetupImageVideo(ScreenPtr); -static int R128SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); -static int R128GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static XF86VideoAdaptorPtr R128SetupImageVideo(ScreenPtr); +static int R128SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int R128GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); static void R128StopVideo(ScrnInfoPtr, pointer, Bool); -static void R128QueryBestSize(ScrnInfoPtr, Bool, - short, short, short, short, unsigned int *, unsigned int *, pointer); -static int R128PutImage( ScrnInfoPtr, - short, short, short, short, short, short, short, short, - int, unsigned char*, short, short, Bool, RegionPtr, pointer); -static int R128QueryImageAttributes(ScrnInfoPtr, - int, unsigned short *, unsigned short *, int *, int *); +static void R128QueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, + unsigned int *, unsigned int *, pointer); +static int R128PutImage(ScrnInfoPtr, short, short, short, short, short, + short, short, short, int, unsigned char*, short, + short, Bool, RegionPtr, pointer); +static int R128QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); + + +static void R128ResetVideo(ScrnInfoPtr); + +static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time); + #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -#define IMAGE_MAX_WIDTH 2048 -#define IMAGE_MAX_HEIGHT 2048 -#define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT) +static Atom xvBrightness, xvColorKey, xvSaturation, xvDoubleBuffer; -static Atom xvColorKey; typedef struct { - int videoStatus; - unsigned char brightness; - unsigned char contrast; - - RegionRec clip; - CARD32 colorKey; - CARD8 overlay_pixel_size; - CARD8 current_buffer; - int overlay_pad; - CARD32 overlay_id; - CARD32 overlay_width; - - CARD32 scale_cntl; - CARD32 video_format; - FBLinearPtr linear; - } R128PortPrivRec, *R128PortPrivPtr; + int brightness; + int saturation; + Bool doubleBuffer; + unsigned char currentBuffer; + FBLinearPtr linear; + RegionRec clip; + CARD32 colorKey; + CARD32 videoStatus; + Time offTime; + Time freeTime; +} R128PortPrivRec, *R128PortPrivPtr; + void R128InitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + R128InfoPtr info = R128PTR(pScrn); XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int num_adaptors; - R128TRACE(("R128InitVideo called\n")); - - /* Determine if the card supports this */ - if (pScrn->bitsPerPixel != 8) - { + if(info->accel && info->accel->FillSolidRects) newAdaptor = R128SetupImageVideo(pScreen); - } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); @@ -143,39 +98,43 @@ void R128InitVideo(ScreenPtr pScreen) } /* client libraries expect an encoding */ -static XF86VideoEncodingRec DummyEncoding[1] = +static XF86VideoEncodingRec DummyEncoding = { - { 0, "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + 2048, 2048, {1, 1} - } }; -#define NUM_FORMATS 3 +#define NUM_FORMATS 12 static XF86VideoFormatRec Formats[NUM_FORMATS] = { - {15, TrueColor}, - {16, TrueColor}, - {32, TrueColor} + {8, TrueColor}, {8, DirectColor}, {8, PseudoColor}, + {8, GrayScale}, {8, StaticGray}, {8, StaticColor}, + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, + {15, DirectColor}, {16, DirectColor}, {24, DirectColor} }; -#define NUM_ATTRIBUTES 1 + +#define NUM_ATTRIBUTES 4 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, (1<<24)-1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -64, 63, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 31, "XV_SATURATION"}, + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"} }; -#define NUM_IMAGES 3 +#define NUM_IMAGES 4 static XF86ImageRec Images[NUM_IMAGES] = { XVIMAGE_YUY2, + XVIMAGE_UYVY, XVIMAGE_YV12, - XVIMAGE_UYVY + XVIMAGE_I420 }; static void @@ -185,52 +144,53 @@ R128ResetVideo(ScrnInfoPtr pScrn) unsigned char *R128MMIO = info->MMIO; R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; - R128TRACE(("R128ResetVideo called\n")); - /* Initialize some of the HW here */ - OUTREG(R128_OV0_EXCLUSIVE_HORZ,0); /* disable exclusive mode */ - OUTREG(R128_OV0_VIDEO_KEY_MSK,0xffff); + OUTREG(R128_OV0_SCALE_CNTL, 0x80000000); + OUTREG(R128_OV0_EXCLUSIVE_HORZ, 0); + OUTREG(R128_OV0_AUTO_FLIP_CNTL, 0); /* maybe */ + OUTREG(R128_OV0_FILTER_CNTL, 0x0000000f); + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | + (pPriv->saturation << 8) | + (pPriv->saturation << 16)); + OUTREG(R128_OV0_GRAPHICS_KEY_MSK, (1 << pScrn->depth) - 1); + OUTREG(R128_OV0_GRAPHICS_KEY_CLR, pPriv->colorKey); OUTREG(R128_OV0_KEY_CNTL, R128_GRAPHIC_KEY_FN_NE); - OUTREG(R128_OV0_GRAPHICS_KEY_CLR,pPriv->colorKey); - /* Only using one buffer for now - OUTREG(R128_OV0_AUTO_FLIP_CNTL,pAPriv->Port[0].auto_flip_cntl); - */ - switch(pScrn->depth){ - case 8: - OUTREG(R128_OV0_GRAPHICS_KEY_MSK,0xff); - break; - case 15: - OUTREG(R128_OV0_GRAPHICS_KEY_MSK,0x7fff); - break; - case 16: - OUTREG(R128_OV0_GRAPHICS_KEY_MSK,0xffff); - break; - case 24: - OUTREG(R128_OV0_GRAPHICS_KEY_MSK,0xffffff); - break; - case 32: - OUTREG(R128_OV0_GRAPHICS_KEY_MSK,0xffffffff); - break; + OUTREG(R128_OV0_TEST, 0); +} + + +static XF86VideoAdaptorPtr +R128AllocAdaptor(ScrnInfoPtr pScrn) +{ + XF86VideoAdaptorPtr adapt; + R128InfoPtr info = R128PTR(pScrn); + R128PortPrivPtr pPriv; + + if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) + return NULL; + + if(!(pPriv = xcalloc(1, sizeof(R128PortPrivRec) + sizeof(DevUnion)))) + { + xfree(adapt); + return NULL; } - OUTREG(R128_OV0_REG_LOAD_CNTL,0x0); - OUTREG(R128_OV0_DEINTERLACE_PATTERN,0xAAAAA); - OUTREG(R128_OV0_P1_V_ACCUM_INIT,(2<<20)|1); - OUTREG(R128_OV0_P23_V_ACCUM_INIT,(2<<20)|1); - OUTREG(R128_OV0_P1_H_ACCUM_INIT,(3<<28)); - OUTREG(R128_OV0_P23_H_ACCUM_INIT,(2<<28)); - OUTREG(R128_OV0_STEP_BY,1|(1<<8)); - OUTREG(R128_OV0_FILTER_CNTL,0xf); /* use hardcoded coeff's */ - OUTREG(R128_OV0_FILTER_CNTL,0x0); /* use programmable coeff's */ - OUTREG(R128_OV0_FOUR_TAP_COEF_0 , 0x00002000); - OUTREG(R128_OV0_FOUR_TAP_COEF_1 , 0x0D06200D); - OUTREG(R128_OV0_FOUR_TAP_COEF_2 , 0x0D0A1C0D); - OUTREG(R128_OV0_FOUR_TAP_COEF_3 , 0x0C0E1A0C); - OUTREG(R128_OV0_FOUR_TAP_COEF_4 , 0x0C14140C); - OUTREG(R128_OV0_COLOUR_CNTL,(1<<12)|(1<<20)); - OUTREG(R128_OV0_TEST,0); - OUTREG(R128_OV0_SCALE_CNTL,pPriv->scale_cntl|pPriv->video_format); - OUTREG(R128_CAP0_TRIG_CNTL,0); + adapt->pPortPrivates = (DevUnion*)(&pPriv[1]); + adapt->pPortPrivates[0].ptr = (pointer)pPriv; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + + pPriv->colorKey = info->videoKey; + pPriv->doubleBuffer = TRUE; + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->saturation = 16; + pPriv->currentBuffer = 0; + + return adapt; } static XF86VideoAdaptorPtr @@ -238,32 +198,23 @@ R128SetupImageVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; R128InfoPtr info = R128PTR(pScrn); - XF86VideoAdaptorPtr adapt; R128PortPrivPtr pPriv; + XF86VideoAdaptorPtr adapt; - R128TRACE(("R128SetupImageVideo called\n")); - - if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + - sizeof(R128PortPrivRec) + - sizeof(DevUnion)))) + if(!(adapt = R128AllocAdaptor(pScrn))) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "R128 Video Overlay"; + adapt->name = "ATI Rage128 Video Overlay"; adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; + adapt->pEncodings = &DummyEncoding; adapt->nFormats = NUM_FORMATS; adapt->pFormats = Formats; adapt->nPorts = 1; - adapt->pPortPrivates = (DevUnion*)(&adapt[1]); - - pPriv = (R128PortPrivPtr)(&adapt->pPortPrivates[1]); - - adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->nAttributes = NUM_ATTRIBUTES; adapt->pAttributes = Attributes; adapt->nImages = NUM_IMAGES; - adapt->nAttributes = NUM_ATTRIBUTES; adapt->pImages = Images; adapt->PutVideo = NULL; adapt->PutStill = NULL; @@ -276,24 +227,17 @@ R128SetupImageVideo(ScreenPtr pScreen) adapt->PutImage = R128PutImage; adapt->QueryImageAttributes = R128QueryImageAttributes; - /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); - info->adaptor = adapt; - pPriv->colorKey = 0x01; /* a touch of blue */ - pPriv->video_format = R128_SCALER_SOURCE_VYUY422; - pPriv->scale_cntl = R128_SCALER_PRG_LOAD_START|R128_SCALER_DOUBLE_BUFFER; - pPriv->scale_cntl|= R128_SCALER_SMART_SWITCH|R128_SCALER_PIX_EXPAND; - pPriv->scale_cntl|= R128_SCALER_SMART_SWITCH; - - xvColorKey = MAKE_ATOM("XV_COLORKEY"); + pPriv = (R128PortPrivPtr)(adapt->pPortPrivates[0].ptr); + REGION_INIT(pScreen, &(pPriv->clip), NullBox, 0); R128ResetVideo(pScrn); return adapt; } +/* I really should stick this in miregion */ static Bool RegionsEqual(RegionPtr A, RegionPtr B) { @@ -323,28 +267,119 @@ RegionsEqual(RegionPtr A, RegionPtr B) return TRUE; } + +/* R128ClipVideo - + + Takes the dst box in standard X BoxRec form (top and left + edges inclusive, bottom and right exclusive). The new dst + box is returned. The source boundaries are given (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ + +#define DummyScreen screenInfo.screens[0] + +static Bool +R128ClipVideo( + BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + RegionPtr reg, + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*x1 >= *x2) return FALSE; + + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } + if(*y1 >= *y2) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; +} + static void -R128StopVideo(ScrnInfoPtr pScrn, pointer data, Bool Exit) +R128StopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - R128PortPrivPtr pPriv = (R128PortPrivPtr) data; - - R128TRACE(("R128StopVideo called\n")); + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + R128PortPrivPtr pPriv = (R128PortPrivPtr)data; - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if (Exit) { - if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - OUTREG(R128_OV0_SCALE_CNTL,pPriv->scale_cntl|pPriv->video_format); - } - if(pPriv->linear) { - xf86FreeOffscreenLinear(pPriv->linear); - pPriv->linear = NULL; - } + if(cleanup) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + OUTREG(R128_OV0_SCALE_CNTL, 0); + } + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } pPriv->videoStatus = 0; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; } } } @@ -355,22 +390,40 @@ R128SetPortAttribute( Atom attribute, INT32 value, pointer data -) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - R128PortPrivPtr pPriv = (R128PortPrivPtr) data; - - R128TRACE(("R128SetPortAttribute called\n")); - - if (attribute == xvColorKey) { +){ + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + R128PortPrivPtr pPriv = (R128PortPrivPtr)data; + + if(attribute == xvBrightness) { + if((value < -64) || (value > 63)) + return BadValue; + pPriv->brightness = value; + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | + (pPriv->saturation << 8) | + (pPriv->saturation << 16)); + } else + if(attribute == xvSaturation) { + if((value < 0) || (value > 31)) + return BadValue; + pPriv->saturation = value; + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | + (pPriv->saturation << 8) | + (pPriv->saturation << 16)); + } else + if(attribute == xvDoubleBuffer) { + if((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } else + if(attribute == xvColorKey) { pPriv->colorKey = value; - OUTREG(R128_OV0_GRAPHICS_KEY_CLR,pPriv->colorKey); - R128TRACE(("Setting ColorKey to %d\n", pPriv->colorKey)); - return Success; - } + OUTREG(R128_OV0_GRAPHICS_KEY_CLR, pPriv->colorKey); - return Success; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else return BadMatch; + + return Success; } static int @@ -379,21 +432,26 @@ R128GetPortAttribute( Atom attribute, INT32 *value, pointer data -) -{ - R128PortPrivPtr pPriv = (R128PortPrivPtr) data; - - R128TRACE(("R128GetPortAttribute called\n")); - - if (attribute == xvColorKey) { - R128TRACE(("Getting ColorKey %d\n", pPriv->colorKey)); +){ + R128PortPrivPtr pPriv = (R128PortPrivPtr)data; + + if(attribute == xvBrightness) { + *value = pPriv->brightness; + } else + if(attribute == xvSaturation) { + *value = pPriv->saturation; + } else + if(attribute == xvDoubleBuffer) { + *value = pPriv->doubleBuffer ? 1 : 0; + } else + if(attribute == xvColorKey) { *value = pPriv->colorKey; - return Success; - } + } else return BadMatch; - return Success; + return Success; } + static void R128QueryBestSize( ScrnInfoPtr pScrn, @@ -402,80 +460,11 @@ R128QueryBestSize( short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, pointer data -) -{ - R128TRACE(("R128QueryBestSize called\n")); +){ *p_w = drw_w; *p_h = drw_h; } -static void -R128DisplayVideo( - ScrnInfoPtr pScrn, - short width, short height, - int xa, int ya, int xb, int yb, - short src_w, short src_h, - short drw_w, short drw_h, - int fboffset -) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; - int step_by, vert_inc, horz_inc; - - R128TRACE(("R128DisplayVideo called\n")); - - /* calculate step_by factor */ - step_by=src_w/(drw_w*2); - switch(step_by){ - case 0: - OUTREG(R128_OV0_STEP_BY,0x101); - step_by=1; - break; - case 1: - OUTREG(R128_OV0_STEP_BY,0x202); - step_by=2; - break; - case 2: - case 3: - OUTREG(R128_OV0_STEP_BY,0x303); - step_by=4; - break; - default: - OUTREG(R128_OV0_STEP_BY,0x404); - step_by=8; - break; - } - - vert_inc=(src_h<<12)/(drw_h); - horz_inc=(src_w<<12)/(drw_w*step_by); - - OUTREG(R128_OV0_Y_X_START,((xa))|(ya<<16)|(1<<31)); - OUTREG(R128_OV0_Y_X_END,((xb))|((yb)<<16)); - OUTREG(R128_OV0_H_INC,(horz_inc)|((horz_inc<<15))); - OUTREG(R128_OV0_V_INC,(vert_inc<<8)); - OUTREG(R128_OV0_P1_BLANK_LINES_AT_TOP,0xfff|((src_h-1)<<16)); - OUTREG(R128_OV0_P23_BLANK_LINES_AT_TOP,0xfff|((src_h-1)<<16)); - OUTREG(R128_OV0_VID_BUF_PITCH0_VALUE,width<<1); - OUTREG(R128_OV0_VID_BUF_PITCH1_VALUE,width<<1); - OUTREG(R128_OV0_P1_X_START_END,(src_w-1)|((xa&0xf)<<16)); - OUTREG(R128_OV0_P2_X_START_END,(src_w-1)|((xa&0xf)<<16)); - OUTREG(R128_OV0_P3_X_START_END,(src_w-1)|((xa&0xf)<<16)); - - OUTREG(R128_OV0_VID_BUF0_BASE_ADRS,(fboffset)&(~0xf)); - OUTREG(R128_OV0_VID_BUF1_BASE_ADRS,(fboffset)&(~0xf)); - OUTREG(R128_OV0_VID_BUF2_BASE_ADRS,(fboffset)&(~0xf)); - -#if 0 - /* Enable this when double buffering is implemented */ - OUTREG(R128_OV0_VID_BUF3_BASE_ADRS,(fboffset2)&(~0xf)); - OUTREG(R128_OV0_VID_BUF4_BASE_ADRS,(fboffset2)&(~0xf)); - OUTREG(R128_OV0_VID_BUF5_BASE_ADRS,(fboffset2)&(~0xf)); -#endif - - OUTREG(R128_OV0_SCALE_CNTL,pPriv->scale_cntl|R128_SCALER_ENABLE|pPriv->video_format); -} static void R128CopyData( @@ -485,8 +474,7 @@ R128CopyData( int dstPitch, int h, int w - ) -{ +){ w <<= 1; while(h--) { memcpy(dst, src, w); @@ -506,8 +494,7 @@ R128CopyMungedData( int dstPitch, int h, int w - ) -{ +){ CARD32 *dst = (CARD32*)dst1; int i, j; @@ -528,18 +515,16 @@ R128CopyMungedData( } } + static FBLinearPtr R128AllocateMemory( - ScrnInfoPtr pScrn, - FBLinearPtr linear, - int size -) -{ + ScrnInfoPtr pScrn, + FBLinearPtr linear, + int size +){ ScreenPtr pScreen; FBLinearPtr new_linear; - R128TRACE(("R128AllocateMemory(%x,%d) called\n",linear,size)); - if(linear) { if(linear->size >= size) return linear; @@ -552,27 +537,99 @@ R128AllocateMemory( pScreen = screenInfo.screens[pScrn->scrnIndex]; - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, - NULL, NULL, NULL); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8, + NULL, NULL, NULL); if(!new_linear) { int max_size; - xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, - PRIORITY_EXTREME); + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 8, + PRIORITY_EXTREME); - if(max_size < size) return NULL; + if(max_size < size) + return NULL; xf86PurgeUnlockedOffscreenAreas(pScreen); - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, - NULL, NULL, NULL); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8, + NULL, NULL, NULL); } - R128TRACE(("returning %x(%x)\n",new_linear,new_linear->offset)); - return new_linear; } +static void +R128DisplayVideo( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int pitch, + int left, int right, int top, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + int v_inc, h_inc, step_by, tmp; + int p1_h_accum_init, p23_h_accum_init; + int p1_v_accum_init; + + v_inc = (src_h << 20) / drw_h; + h_inc = (src_w << 12) / drw_w; + step_by = 1; + + while(h_inc >= (2 << 12)) { + step_by++; + h_inc >>= 1; + } + + /* keep everything in 16.16 */ + + offset += ((left >> 16) & ~7) << 1; + + tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3); + p1_h_accum_init = ((tmp << 4) & 0x000f8000) | + ((tmp << 12) & 0xf0000000); + + tmp = ((left >> 1) & 0x0001ffff) + 0x00028000 + (h_inc << 2); + p23_h_accum_init = ((tmp << 4) & 0x000f8000) | + ((tmp << 12) & 0x70000000); + + tmp = (top & 0x0000ffff) + 0x00018000; + p1_v_accum_init = ((tmp << 4) & 0x03ff8000) | 0x00000001; + + left = (left >> 16) & 7; + + + OUTREG(R128_OV0_REG_LOAD_CNTL, 1); + while(!(INREG(R128_OV0_REG_LOAD_CNTL) & (1 << 3))); + + OUTREG(R128_OV0_H_INC, h_inc | ((h_inc >> 1) << 16)); + OUTREG(R128_OV0_STEP_BY, step_by | (step_by << 8)); + OUTREG(R128_OV0_Y_X_START, dstBox->x1 | (dstBox->y1 << 16)); + OUTREG(R128_OV0_Y_X_END, dstBox->x2 | (dstBox->y2 << 16)); + OUTREG(R128_OV0_V_INC, v_inc); + OUTREG(R128_OV0_P1_BLANK_LINES_AT_TOP, 0x00000fff | ((src_h - 1) << 16)); + OUTREG(R128_OV0_VID_BUF_PITCH0_VALUE, pitch); + OUTREG(R128_OV0_P1_X_START_END, (src_w + left - 1) | (left << 16)); + left >>= 1; src_w >>= 1; + OUTREG(R128_OV0_P2_X_START_END, (src_w + left - 1) | (left << 16)); + OUTREG(R128_OV0_P3_X_START_END, (src_w + left - 1) | (left << 16)); + OUTREG(R128_OV0_VID_BUF0_BASE_ADRS, offset & 0xfffffff0); + OUTREG(R128_OV0_P1_V_ACCUM_INIT, p1_v_accum_init); + OUTREG(R128_OV0_P1_H_ACCUM_INIT, p1_h_accum_init); + OUTREG(R128_OV0_P23_H_ACCUM_INIT, p23_h_accum_init); + + if(id == FOURCC_UYVY) + OUTREG(R128_OV0_SCALE_CNTL, 0x41008C03); + else + OUTREG(R128_OV0_SCALE_CNTL, 0x41008B03); + + OUTREG(R128_OV0_REG_LOAD_CNTL, 0); +} + + static int R128PutImage( ScrnInfoPtr pScrn, @@ -584,174 +641,147 @@ R128PutImage( short width, short height, Bool Sync, RegionPtr clipBoxes, pointer data -) -{ - R128InfoPtr info = R128PTR(pScrn); - unsigned char *R128MMIO = info->MMIO; - R128PortPrivPtr pPriv = (R128PortPrivPtr)data; - INT32 xa, xb, ya, yb; - INT32 d_x,d_y,d_width,d_height; - int srcPitch = 0, srcPitch2 = 0; - int dstPitch = 0; - int offset,offset2 = 0,offset3 = 0,fboffset; - int top, left, npixels, nlines, size; - CARD32 video_format; - - R128TRACE(("R128PutImage called\n")); - - switch(id) { - case FOURCC_YV12: - case FOURCC_UYVY: - video_format=R128_SCALER_SOURCE_VYUY422; - break; - case FOURCC_YUY2: - video_format=R128_SCALER_SOURCE_YVYU422; - break; - default: - return BadValue; - } +){ + R128InfoPtr info = R128PTR(pScrn); + R128PortPrivPtr pPriv = (R128PortPrivPtr)data; + INT32 x1, x2, y1, y2; + unsigned char *dst_start; + int pitch, new_size, offset, offset2 = 0, offset3 = 0; + int srcPitch, srcPitch2 = 0, dstPitch; + int top, left, npixels, nlines, bpp; + BoxRec dstBox; + CARD32 tmp; + + if(src_w > (drw_w << 4)) + drw_w = src_w >> 4; + if(src_h > (drw_h << 4)) + drw_h = src_h >> 4; /* Clip */ - d_x=drw_x; - d_y=drw_y; - d_width=drw_w; - d_height=drw_h; - if(drw_x<0){ - drw_w+=drw_x; - drw_x=0; - } - if(drw_y<0){ - drw_h+=drw_y; - drw_y=0; - } - if(drw_x+drw_w>pScrn->pScreen->width){ - drw_w=pScrn->pScreen->width-drw_x; - } - if(drw_y+drw_h>pScrn->pScreen->height){ - drw_h=pScrn->pScreen->height-drw_y; - } - if((drw_w<=0)||(drw_h<=0)){ - /* this should not happen, - since we are outside of visible screen, - but just in case */ - return Success; - } + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; - xa = src_x; - xb = src_x + src_w; - ya = src_y; - yb = src_y + src_h; + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; - dstPitch = width*info->CurrentLayout.pixel_bytes; - srcPitch=width; + if(!R128ClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + return Success; - switch(id) { - case FOURCC_YV12: - size = width * height * 2; /* 16bpp */ - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = width * height * 1.5; - break; - } + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; - if(!(pPriv->linear = R128AllocateMemory(pScrn, pPriv->linear,size))) - return BadAlloc; + bpp = pScrn->bitsPerPixel >> 3; + pitch = bpp * pScrn->displayWidth; - /* copy data */ - top = ya >> 16; - left = (xa >> 16) & ~1; - npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; + dstPitch = ((width << 1) + 15) & ~15; + new_size = ((dstPitch * height) + bpp - 1) / bpp; - switch(id) { - case FOURCC_YV12: + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: srcPitch = (width + 3) & ~3; offset2 = srcPitch * height; srcPitch2 = ((width >> 1) + 3) & ~3; offset3 = (srcPitch2 * (height >> 1)) + offset2; - nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - buf += (top * srcPitch) + left; - nlines = ((yb + 0xffff) >> 16) - top; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: srcPitch = (width << 1); break; - } - nlines=src_h; - npixels=src_w; - if(npixels>width) npixels=width; - if(nlines>height) nlines=height; + } + + if(!(pPriv->linear = R128AllocateMemory(pScrn, pPriv->linear, + pPriv->doubleBuffer ? (new_size << 1) : new_size))) + { + return BadAlloc; + } - /* adjust source rectangle */ - src_x+=((drw_x-d_x)*src_w)/d_width; - src_y+=((drw_y-d_y)*src_h)/d_height; + pPriv->currentBuffer ^= 1; - src_w=(src_w * drw_w)/d_width; - src_h=(src_h * drw_h)/d_height; + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + left <<= 1; - offset=(src_x+src_y*width)*info->CurrentLayout.pixel_bytes; - fboffset=pPriv->linear->offset*info->CurrentLayout.pixel_bytes; + offset = pPriv->linear->offset * bpp; + if(pPriv->doubleBuffer) + offset += pPriv->currentBuffer * new_size * bpp; + dst_start = info->FB + offset + left + (top * dstPitch); - if(!(INREG(R128_CRTC_STATUS)&2)){ - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"too fast"); - return Success; + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 2); + offset2 += tmp; + offset3 += tmp; + if(id == FOURCC_I420) { + tmp = offset2; + offset2 = offset3; + offset3 = tmp; } + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + R128CopyMungedData(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dst_start, + srcPitch, srcPitch2, dstPitch, nlines, npixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + buf += (top * srcPitch) + left; + nlines = ((y2 + 0xffff) >> 16) - top; + R128CopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } - R128DisplayVideo(pScrn, width, height, - drw_x, drw_y, drw_x+drw_w, drw_y+drw_h, - src_w, src_h, drw_w, drw_h, fboffset); /* update cliplist */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, - GXcopy, (CARD32)(~0), + (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); } - - switch(id) { - case FOURCC_YV12: - R128CopyMungedData(buf + (top * srcPitch) + (left >> 1), - buf + offset2, buf + offset3, info->FB+fboffset, - srcPitch, srcPitch2, dstPitch, nlines, npixels); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - R128CopyData(buf,info->FB+fboffset,srcPitch,dstPitch, - nlines,npixels); - break; - } + offset += top * dstPitch; + R128DisplayVideo(pScrn, id, offset, width, height, dstPitch, + x1, x2, y1, &dstBox, src_w, src_h, drw_w, drw_h); pPriv->videoStatus = CLIENT_VIDEO_ON; + + info->VideoTimerCallback = R128VideoTimerCallback; + return Success; } + static int R128QueryImageAttributes( - ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets -) -{ + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ int size, tmp; - R128TRACE(("R128QueryImageAtrributes called\n")); - if(*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; - if(*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; + if(*w > 2048) *w = 2048; + if(*h > 2048) *h = 2048; *w = (*w + 1) & ~1; if(offsets) offsets[0] = 0; switch(id) { case FOURCC_YV12: + case FOURCC_I420: *h = (*h + 1) & ~1; size = (*w + 3) & ~3; if(pitches) pitches[0] = size; @@ -775,4 +805,34 @@ R128QueryImageAttributes( return size; } -#endif + +static void +R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time) +{ + R128InfoPtr info = R128PTR(pScrn); + R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; + + if(pPriv->videoStatus & TIMER_MASK) { + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < time) { + unsigned char *R128MMIO = info->MMIO; + OUTREG(R128_OV0_SCALE_CNTL, 0); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = time + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < time) { + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + info->VideoTimerCallback = NULL; + } + } + } else /* shouldn't get here */ + info->VideoTimerCallback = NULL; +} + + +#endif /* !XvExtension */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h index a90f09a6f..10451e9b0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.4 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.5 2000/12/01 08:56:03 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -40,6 +40,8 @@ #include "xf86str.h" +#include "xf86_OSproc.h" + /* PCI support */ #include "xf86Pci.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c index 64d00ade2..4f1b91deb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.3 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.4 2000/12/02 15:30:34 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -96,7 +96,7 @@ RADEONProbe(DriverPtr drv, int flags) int numUsed; int numDevSections, nATIGDev, nRadeonGDev; int *usedChips; - GDevPtr *devSections, *ATIGDevs = NULL, *RadeonGDevs = NULL; + GDevPtr *devSections, *ATIGDevs, *RadeonGDevs; EntityInfoPtr pEnt; Bool foundScreen = FALSE; int i; @@ -180,7 +180,7 @@ RADEONProbe(DriverPtr drv, int flags) xfree(pEnt); } - if (numUsed) xfree(usedChips); + xfree(usedChips); xfree(devSections); return foundScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c index 4239ec65d..775910b94 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.100 2000/11/14 16:54:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.102 2000/12/02 15:30:34 tsi Exp $ */ /* * Copyright 1993 by Jon Block <block@frc.com> @@ -820,7 +820,7 @@ CHIPSProbe(DriverPtr drv, int flags) { Bool foundScreen = FALSE; int numDevSections, numUsed; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int i; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c index 1694daa71..5d7ce6965 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.60 2000/10/26 11:47:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.61 2000/12/02 15:30:36 tsi Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -211,7 +211,7 @@ static Bool CIRProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; pciVideoPtr pPci; int *usedChips; int numDevSections; @@ -262,9 +262,7 @@ CIRProbe(DriverPtr drv, int flags) CIRChipsets, CIRPciChipsets, devSections, numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; if (flags & PROBE_DETECT) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c index 5f56570c2..ab90d7aeb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c @@ -26,7 +26,7 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.12 2000/10/09 23:37:13 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.14 2000/12/02 15:30:37 tsi Exp $ */ #include "fb.h" #include "mibank.h" @@ -358,11 +358,10 @@ CYRIXProbe(DriverPtr drv, int flags) pScrn->EnterVT = CYRIXEnterVT; pScrn->FreeScreen = CYRIXFreeScreen; pScrn->ValidMode = CYRIXValidMode; - return (TRUE); } - xfree(usedChips); } } + xfree(usedChips); return (foundScreen); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c index 6976491cf..17292ffc4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.25 2000/10/20 14:59:00 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.26 2000/12/02 15:30:38 tsi Exp $ */ /* * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> @@ -246,7 +246,7 @@ FBDevProbe(DriverPtr drv, int flags) { int i; ScrnInfoPtr pScrn; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int numDevSections; int bus,device,func; char *dev; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c index 07b025013..309ebf71b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c @@ -45,7 +45,7 @@ * Support static loading. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.18 2000/11/28 17:25:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.19 2000/12/02 15:30:38 tsi Exp $ */ #include "xaa.h" #include "xf86Cursor.h" @@ -374,7 +374,7 @@ GLIDEProbe(DriverPtr drv, int flags) { GrHwConfiguration hw; int i, sst, r; - GDevPtr *devList = NULL; + GDevPtr *devList; GDevPtr dev = NULL; int numdevList; Bool foundScreen = FALSE; @@ -442,7 +442,7 @@ GLIDEProbe(DriverPtr drv, int flags) } cleanup: - if (devList) xfree(devList); + xfree(devList); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c index 827aaad3d..146c87113 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen, * Siemens Nixdorf Informationssysteme and Appian Graphics. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.99 2000/11/14 17:32:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.100 2000/12/02 15:30:39 tsi Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -593,7 +593,7 @@ GLINTProbe(DriverPtr drv, int flags) { int i; pciVideoPtr pPci, *checkusedPci; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int numDevSections; int numUsed,bus,device,func; char *dev; @@ -686,9 +686,7 @@ GLINTProbe(DriverPtr drv, int flags) numUsed = xf86MatchPciInstances(GLINT_NAME, 0, GLINTChipsets, GLINTPciChipsets, devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; foundScreen = TRUE; @@ -743,7 +741,7 @@ GLINTProbe(DriverPtr drv, int flags) } } - if (usedChips) xfree(usedChips); + xfree(usedChips); TRACE_EXIT("GLINTProbe"); return foundScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c index fa65fcdc3..0a583347e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.13 2000/11/06 02:56:03 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.15 2000/12/02 15:30:40 tsi Exp $ */ /* All drivers should typically include these */ @@ -385,14 +385,12 @@ I128Probe(DriverPtr drv, int flags) /* Free it since we don't need that list after this */ xfree(devSections); - devSections = NULL; if (numUsed <= 0) return FALSE; if (flags & PROBE_DETECT) { - if (usedChips) - xfree(usedChips); + xfree(usedChips); return FALSE; } @@ -422,8 +420,7 @@ I128Probe(DriverPtr drv, int flags) foundScreen = TRUE; } - if (usedChips) - xfree(usedChips); + xfree(usedChips); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c index 5f71d50d6..090762940 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.25 2000/10/09 23:37:13 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.26 2000/12/02 15:30:41 tsi Exp $ */ /* * Authors: @@ -359,7 +359,7 @@ I740Identify(int flags) { static Bool I740Probe(DriverPtr drv, int flags) { int i, numUsed, numDevSections, *usedChips; - GDevPtr *devSections = NULL; + GDevPtr *devSections; Bool foundScreen = FALSE; /* @@ -439,8 +439,8 @@ I740Probe(DriverPtr drv, int flags) { } } - if (devSections) - xfree(devSections); + xfree(devSections); + xfree(usedChips); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h index 528344b8f..4a28dafed 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.18 2000/10/24 22:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.19 2000/12/01 14:28:56 dawes Exp $ */ /* * Authors: @@ -270,6 +270,8 @@ extern void I810FreeGARTMemory( ScrnInfoPtr pScrn ); extern Bool I810BindGARTMemory( ScrnInfoPtr pScrn ); extern Bool I810UnbindGARTMemory( ScrnInfoPtr pScrn ); +extern int I810CheckAvailableMemory(ScrnInfoPtr pScrn); + extern Bool I810SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); extern void I810AdjustFrame(int scrnIndex, int x, int y, int flags); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c index ccc01e0d0..89e21850d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.12 2000/09/24 13:51:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.13 2000/12/01 14:28:56 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -601,7 +601,10 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) } /* Allocate FrontBuffer etc. */ - I810AllocateFront(pScrn); + if (!I810AllocateFront(pScrn)) { + DRICloseScreen(pScreen); + return FALSE; + } /* Allocate buffer memory */ I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c index 7f0d32958..5f9416924 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.35 2000/11/13 23:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.39 2000/12/02 15:30:42 tsi Exp $ */ /* * Authors: @@ -122,7 +122,8 @@ typedef enum { OPTION_SW_CURSOR, OPTION_COLOR_KEY, OPTION_CACHE_LINES, - OPTION_DAC_6BIT + OPTION_DAC_6BIT, + OPTION_DRI } I810Opts; static OptionInfoRec I810Options[] = { @@ -131,6 +132,7 @@ static OptionInfoRec I810Options[] = { { OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -405,8 +407,8 @@ I810Probe(DriverPtr drv, int flags) { foundScreen = TRUE; } } - if (numUsed) xfree(usedChips); + xfree(usedChips); xfree(devSections); return foundScreen; @@ -438,6 +440,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) { MessageType from; int flags24; rgb defaultWeight = {0, 0, 0}; + int mem; if (pScrn->numEntities != 1) return FALSE; @@ -627,12 +630,30 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) { * Changed to 8 Meg so we can have acceleration by default (Mark). */ pScrn->videoRam = 8192; - from = X_PROBED; + from = X_DEFAULT; if (pI810->pEnt->device->videoRam) { pScrn->videoRam = pI810->pEnt->device->videoRam; from = X_CONFIG; } + mem = I810CheckAvailableMemory(pScrn); + if (mem > 0 && mem < pScrn->videoRam) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%dk of memory was requested," + " but the\n\t maximum AGP memory available is %dk.\n", + pScrn->videoRam, mem); + from = X_PROBED; + if (mem > (6 * 1024)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Reducing video memory to 4MB\n"); + pScrn->videoRam = 4096; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Less than 6MB of AGP memory" + "is available. Cannot proceed.\n"); + I810FreeRec(pScrn); + return FALSE; + } + } + xf86DrvMsg(pScrn->scrnIndex, from, "Will alloc AGP framebuffer: %d kByte\n", pScrn->videoRam); @@ -1536,15 +1557,23 @@ I810AllocateFront(ScrnInfoPtr pScrn) { xf86GetOptValInteger(I810Options, OPTION_CACHE_LINES, &cache_lines); - if(cache_lines >= 0) - pI810->FbMemBox.y2 += cache_lines; - else { - /* make sure there is enough for two DVD sized YUV buffers */ - pI810->FbMemBox.y2 += (pScrn->depth == 24) ? 256 : 384; - if (pScrn->displayWidth <= 1024) - pI810->FbMemBox.y2 += (pScrn->depth == 24) ? 256 : 384; - cache_lines = pI810->FbMemBox.y2 - pScrn->virtualY; + if (cache_lines < 0) { + /* make sure there is enough for two DVD sized YUV buffers */ + cache_lines = (pScrn->depth == 24) ? 256 : 384; + if (pScrn->displayWidth <= 1024) + cache_lines *= 2; } + /* Make sure there's enough space for cache_lines. */ + { + int maxCacheLines; + + maxCacheLines = ((pScrn->videoRam - 256) * 1024 / + (pScrn->bitsPerPixel / 8) / + pScrn->displayWidth) - pScrn->virtualY; + if (maxCacheLines >= 0 && cache_lines > maxCacheLines) + cache_lines = maxCacheLines; + } + pI810->FbMemBox.y2 += cache_lines; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Adding %i scanlines for pixmap caching\n", cache_lines); @@ -1553,11 +1582,16 @@ I810AllocateFront(ScrnInfoPtr pScrn) { * of memory so we can have nice alignment for the tiled regions at * the start of memory. */ - I810AllocLow( &(pI810->FrontBuffer), + + if (!I810AllocLow( &(pI810->FrontBuffer), &(pI810->SysMem), ((pI810->FbMemBox.x2 * pI810->FbMemBox.y2 * - pI810->cpp) + 4095) & ~4095); + pI810->cpp) + 4095) & ~4095)) { + xf86DrvMsg(pScrn->scrnIndex, + X_WARNING, "Framebuffer allocation failed\n"); + return FALSE; + } memset( &(pI810->LpRing), 0, sizeof( I810RingBuffer ) ); if(I810AllocLow( &(pI810->LpRing.mem), &(pI810->SysMem), 16*4096 )) { @@ -1631,7 +1665,8 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { * InitGLXVisuals call back. */ - if (!xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE) && + xf86ReturnOptValBool(I810Options, OPTION_DRI, TRUE)) { pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); } else { pI810->directRenderingEnabled = FALSE; @@ -1640,8 +1675,9 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { #else pI810->directRenderingEnabled = FALSE; if (!I810AllocateGARTMemory( pScrn )) - return FALSE; - I810AllocateFront(pScrn); + return FALSE; + if (!I810AllocateFront(pScrn)) + return FALSE; #endif if (!I810MapMem(pScrn)) return FALSE; @@ -1684,11 +1720,17 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { xf86SetBlackWhitePixels(pScreen); #ifdef XF86DRI + if (pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { + pI810->directRenderingEnabled = 0; + I810DRICloseScreen(pScreen); + } + if (!pI810->directRenderingEnabled) { pI810->DoneFrontAlloc = FALSE; if (!I810AllocateGARTMemory( pScrn )) return FALSE; - I810AllocateFront(pScrn); + if (!I810AllocateFront(pScrn)) + return FALSE; } #endif @@ -1750,11 +1792,6 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { I810InitVideo(pScreen); #ifdef XF86DRI - if (pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { - pI810->directRenderingEnabled = 0; - I810DRICloseScreen(pScreen); - } - if (pI810->directRenderingEnabled) { /* Now that mi, cfb, drm and others have done their thing, * complete the DRI setup. @@ -1942,6 +1979,7 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen) */ pI810->SysMem = pI810->SavedSysMem; pI810->DcacheMem = pI810->SavedDcacheMem; + pI810->DoneFrontAlloc = FALSE; pScrn->vtSema=FALSE; pScreen->CloseScreen = pI810->CloseScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c index e37ade8b5..ee79e66f1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.16 2000/09/24 13:51:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.18 2000/12/02 15:25:38 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -325,3 +325,29 @@ I810UnbindGARTMemory( ScrnInfoPtr pScrn ) } return TRUE; } + +int +I810CheckAvailableMemory(ScrnInfoPtr pScrn) +{ + AgpInfoPtr agpinf; + int maxPages; + + if (!xf86AgpGARTSupported()) + return -1; + + if (!xf86AcquireGART(pScrn->scrnIndex)) + return -1; + + if ((agpinf = xf86GetAGPInfo(pScrn->scrnIndex)) == NULL) + return -1; + + if (!xf86ReleaseGART(pScrn->scrnIndex)) + return -1; + + maxPages = agpinf->totalPages - agpinf->usedPages; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "I810CheckAvailableMemory: %dk available\n", maxPages * 4); + + return maxPages * 4; +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c index 62ae5e47a..b1db68fe4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.9 2000/08/23 22:10:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.10 2000/12/02 15:30:43 tsi Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -276,7 +276,7 @@ static void IMSTTIdentify(int flags) static Bool IMSTTProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -294,9 +294,7 @@ static Bool IMSTTProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h index 7bbca675a..b1b05e1e5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.67 2000/11/08 05:03:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.69 2000/12/03 01:51:05 mvojkovi Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -80,8 +80,8 @@ typedef struct { } MGARegRec, *MGARegPtr; typedef struct { - unsigned char brightness; - unsigned char contrast; + int brightness; + int contrast; FBLinearPtr linear; RegionRec clip; CARD32 colorKey; @@ -271,6 +271,7 @@ typedef struct { int expandY; #ifdef XF86DRI int agp_mode; + Bool ReallyUseIrqZero; Bool have_quiescense; Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index 1674a177a..5b1d6ddc6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.12 2000/11/13 23:31:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.13 2000/12/01 14:28:57 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -754,6 +754,25 @@ Bool MGADRIScreenInit(ScreenPtr pScreen) ->thisCard)->devnum, ((pciConfigPtr)pMGA->PciInfo ->thisCard)->funcnum); + + if(!pMGADRIServer->irq && !pMGA->ReallyUseIrqZero) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] Your graphics card has Interrupt zero" + " assigned to it.\n" + "This is highly unlikely so I'm disabling the DRI.\n" + "If your graphics card really has Interrupt zero, please" + "add the config option UseIrqZero\n" + "to the device section in your XF86Config file.\n" + "Please be warned that Interrupt zero is normally " + "the timer interrupt on X86 systems.\n" + "Using this option could make your system unusable.\n" + "The more likely solution is that your graphics card has" + " no interrupt assigned to it.\nPlease consult your" + " system BIOS manual for instructions on how to enable " + "an interrupt for your graphics card.\n"); + MGADRICloseScreen(pScreen); + return FALSE; + } drmCtlInstHandler(pMGA->drmSubFD, pMGADRIServer->irq); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c index a6c16be4f..5cfefa728 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -43,7 +43,7 @@ * Fixed 32bpp hires 8MB horizontal line glitch at middle right */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.181 2000/11/16 19:44:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.183 2000/12/02 15:30:43 tsi Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -219,7 +219,8 @@ typedef enum { OPTION_DIGITAL, OPTION_TV, OPTION_TVSTANDARD, - OPTION_CABLETYPE + OPTION_CABLETYPE, + OPTION_USEIRQZERO } MGAOpts; static OptionInfoRec MGAOptions[] = { @@ -248,6 +249,7 @@ static OptionInfoRec MGAOptions[] = { { OPTION_TV, "TV", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE }, { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_USEIRQZERO, "UseIrqZero", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -539,7 +541,7 @@ static Bool MGAProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips = NULL; int numDevSections; int numUsed; @@ -595,9 +597,7 @@ MGAProbe(DriverPtr drv, int flags) MGAChipsets, MGAPciChipsets, devSections, numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -673,8 +673,8 @@ MGAProbe(DriverPtr drv, int flags) pMgaEnt->lastInstance); } } - if (usedChips) - xfree(usedChips); + + xfree(usedChips); return foundScreen; } @@ -1457,6 +1457,17 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP Mode %dx\n", pMga->agp_mode); + + pMga->ReallyUseIrqZero = 0; + + if (xf86GetOptValBool(MGAOptions, OPTION_USEIRQZERO, + &temp)) { + pMga->ReallyUseIrqZero = 1; + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, from, "Enabling use of IRQ " + "Zero (Dangerous)\n"); + } + } #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c index 116236d48..1897874cb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c @@ -22,7 +22,7 @@ RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.40 2000/11/16 19:44:59 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.44 2000/12/04 18:49:57 dawes Exp $ */ /* * The original Precision Insight driver for @@ -486,7 +486,7 @@ NEOProbe(DriverPtr drv, int flags) { Bool foundScreen = FALSE; int numDevSections, numUsed; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int i; @@ -1461,11 +1461,12 @@ NEOScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } else xf86DrvMsg(scrnIndex, X_ERROR, "Too little space for H/W cursor.\n"); + if (!nPtr->noAccel && nPtr->noMMIO) xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Acceleration disabled when not using MMIO\n"); /* Setup the acceleration primitives */ - if (!nPtr->noAccel || nPtr->noMMIO) { + if (!nPtr->noAccel && !nPtr->noMMIO) { nAcl->cacheStart = currentaddr - freespace; nAcl->cacheEnd = currentaddr; freespace = 0; @@ -1494,7 +1495,6 @@ NEOScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Acceleration Initialized\n"); } - if (!nPtr->noAccel && nPtr->noMMIO) miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -2403,11 +2403,17 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) (NeoNew->PanelDispCntlReg1 & 0x02)) { if (mode->HDisplay == nPtr->NeoPanelWidth) { /* + * Don't disable the flag. It will be needed if another mode + * is selected. + */ +#if 0 + /* * No stretching required when the requested display width * equals the panel width. */ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Stretching disabled\n"); nPtr->noLcdStretch = TRUE; +#endif } else { switch (mode->HDisplay) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile new file mode 100644 index 000000000..ae0d85b77 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile @@ -0,0 +1,47 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.1 2000/12/01 19:47:56 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = newport_driver.c newport_regs.c newport_cmap.c newport_shadow.c + +OBJS = newport_driver.o newport_regs.o newport_cmap.o newport_shadow.o + +XF86CONFIG = XF86Config.indy + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. \ + -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mi -I$(SERVERSRC)/cfb \ + -I$(SERVERSRC)/mfb -I$(XF86SRC)/shadowfb \ + -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \ + -I$(XF86SRC)/xf24_32bpp \ + -I$(EXTINCSRC) -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ + -I$(SERVERSRC)/include -I$(FONTINCSRC) -I$(XINCLUDESRC) +#endif + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget(newport,$(OBJS)) + +InstallObjectModule(newport,$(MODULEDIR),drivers) +InstallNamedNonExec($(XF86CONFIG),$(XF86CONFIG),$(LIBDIR)) + +DependTarget() + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/newport) +InstallDriverSDKNonExecFile(newport_driver.c,$(DRIVERSDKDIR)/drivers/newport) +InstallDriverSDKNonExecFile(newport_regs.c,$(DRIVERSDKDIR)/drivers/newport) +InstallDriverSDKNonExecFile(newport_cmap.c,$(DRIVERSDKDIR)/drivers/newport) +InstallDriverSDKNonExecFile(newport_shadow.c,$(DRIVERSDKDIR)/drivers/newport) +InstallDriverSDKNonExecFile(newport_regs.h,$(DRIVERSDKDIR)/drivers/newport) +InstallDriverSDKNonExecFile(newport.h,$(DRIVERSDKDIR)/drivers/newport) + +InstallDriverSDKObjectModule(newport,$(DRIVERSDKMODULEDIR),drivers) + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy b/xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy new file mode 100644 index 000000000..9ebda996e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy @@ -0,0 +1,351 @@ +# Id: XF86Config.indy,v 1.2 2000/08/14 17:07:37 agx Exp $ +# +# Copyright (c) 1994-1998 by The XFree86 Project, Inc. +# +# modified for the SGI Indy by Guido Guenther <guido.guenther@gmx.net> +# +# 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 +# THE XFREE86 PROJECT 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. +# +# Except as contained in this notice, the name of the XFree86 Project shall +# not be used in advertising or otherwise to promote the sale, use or other +# dealings in this Software without prior written authorization from the +# XFree86 Project. +# +# $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy,v 1.1 2000/12/01 19:47:57 dawes Exp $ + +# ********************************************************************** +# This is a configuration file for the Indy's Newport Graphics and the +# SGI GDM17E11 Monitor +# ********************************************************************** + +# The ordering of sections is not important in version 4.0 and later. + +# ********************************************************************** +# Files section. This allows default font and rgb paths to be set +# ********************************************************************** + +Section "Files" + +# The location of the RGB database. Note, this is the name of the +# file minus the extension (like ".txt" or ".db"). There is normally +# no need to change the default. + + RgbPath "/usr/X11R6/lib/X11/rgb" + +# Multiple FontPath entries are allowed (which are concatenated together), +# as well as specifying multiple comma-separated entries in one FontPath +# command (or a combination of both methods) + + FontPath "/usr/X11R6/lib/X11/fonts/local/" + FontPath "/usr/X11R6/lib/X11/fonts/misc/" + FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" + FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled" + FontPath "/usr/X11R6/lib/X11/fonts/Type1/" + FontPath "/usr/X11R6/lib/X11/fonts/CID/" + FontPath "/usr/X11R6/lib/X11/fonts/Speedo/" + FontPath "/usr/X11R6/lib/X11/fonts/75dpi/" + FontPath "/usr/X11R6/lib/X11/fonts/100dpi/" + +# ModulePath can be used to set a search path for the X server modules. +# The default path is shown here. + +# ModulePath "/usr/X11R6/lib/modules" + +EndSection + +# ********************************************************************** +# Module section -- this is an optional section which is used to specify +# which run-time loadable modules to load when the X server starts up. +# ********************************************************************** + +Section "Module" + +# This loads the DBE extension module. + + Load "dbe" + +# This loads the miscellaneous extensions module, and disables +# initialisation of the XFree86-DGA extension within that module. + + SubSection "extmod" + Option "omit xfree86-dga" + EndSubSection + +# This loads the Type1 and FreeType font modules + + Load "type1" + Load "freetype" + +EndSection + + +# ********************************************************************** +# Server flags section. This contains various server-wide Options. +# ********************************************************************** + +Section "ServerFlags" + +# Uncomment this to cause a core dump at the spot where a signal is +# received. This may leave the console in an unusable state, but may +# provide a better stack trace in the core dump to aid in debugging + +# Option "NoTrapSignals" + +# Uncomment this to disable the <Crtl><Alt><BS> server abort sequence +# This allows clients to receive this key event. + +# Option "DontZap" + +# Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching +# sequences. This allows clients to receive these key events. + +# Option "DontZoom" + +# Uncomment this to disable tuning with the xvidtune client. With +# it the client can still run and fetch card and monitor attributes, +# but it will not be allowed to change them. If it tries it will +# receive a protocol error. + +# Option "DisableVidModeExtension" + +# Uncomment this to enable the use of a non-local xvidtune client. + +# Option "AllowNonLocalXvidtune" + +# Uncomment this to disable dynamically modifying the input device +# (mouse and keyboard) settings. + +# Option "DisableModInDev" + +# Uncomment this to enable the use of a non-local client to +# change the keyboard or mouse settings (currently only xset). + +# Option "AllowNonLocalModInDev" + +# Set the basic blanking screen saver timeout. + + Option "blank time" "10" # 10 minutes + +# Set the DPMS timeouts. These are set here because they are global +# rather than screen-specific. These settings alone don't enable DPMS. +# It is enabled per-screen (or per-monitor), and even then only when +# the driver supports it. + + Option "standby time" "20" + Option "suspend time" "30" + Option "off time" "60" + +# On some platform the server needs to estimate the sizes of PCI +# memory and pio ranges. This is done by assuming that PCI ranges +# don't overlap. Some broken BIOSes tend to set ranges of inactive +# devices wrong. Here one can adjust how aggressive the assumptions +# should be. Default is 0. + +# Option "EstimateSizesAggresively" "0" + +EndSection + +# ********************************************************************** +# Input devices +# ********************************************************************** + +# ********************************************************************** +# Core keyboard's InputDevice section +# ********************************************************************** + +Section "InputDevice" + + Identifier "Keyboard1" + Driver "keyboard" + +# For most OSs the protocol can be omitted (it defaults to "Standard"). +# When using XQUEUE (only for SVR3 and SVR4, but not Solaris), comment +# out the above line, and uncomment the following line. + +# Option "Protocol" "Xqueue" + +# Set the keyboard auto repeat parameters. Not all platforms implement +# this. + + Option "AutoRepeat" "500 5" + +# Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)). + +# Option "Xleds" "1 2 3" + +# To disable the XKEYBOARD extension, uncomment XkbDisable. + +# Option "XkbDisable" + +# To customise the XKB settings to suit your keyboard, modify the +# lines below (which are the defaults). For example, for a European +# keyboard, you will probably want to use one of: +# +# Option "XkbModel" "pc102" +# Option "XkbModel" "pc105" +# +# If you have a Microsoft Natural keyboard, you can use: +# +# Option "XkbModel" "microsoft" +# +# If you have a US "windows" keyboard you will want: +# +# Option "XkbModel" "pc104" +# +# Then to change the language, change the Layout setting. +# For example, a german layout can be obtained with: +# +# Option "XkbLayout" "de" +# +# or: +# +# Option "XkbLayout" "de" +# Option "XkbVariant" "nodeadkeys" +# +# If you'd like to switch the positions of your capslock and +# control keys, use: +# +# Option "XkbOptions" "ctrl:swapcaps" + + +# These are the default XKB settings for XFree86 +# +# Option "XkbRules" "xfree86" +# Option "XkbModel" "pc101" +# Option "XkbLayout" "us" +# Option "XkbVariant" "" +# Option "XkbOptions" "" + +EndSection + + +# ********************************************************************** +# Core Pointer's InputDevice section +# ********************************************************************** + +Section "InputDevice" + +# Identifier and driver + + Identifier "Mouse1" + Driver "mouse" + + Option "Protocol" "PS/2" + Option "Device" "/dev/psaux" +# Option "SampleRate" "80" + +EndSection + +# ********************************************************************** +# Monitor section +# ********************************************************************** + +# Any number of monitor sections may be present + +Section "Monitor" + +# The identifier line must be present. + + Identifier "SGI GDM17e11" + +# This Information can be found at http://www.si87.com/ + + HorizSync 30-82 # multiple ranges of sync frequencies + VertRefresh 50-120 # typical for a single frequency fixed-sync monitor + +# A single modeline is sufficient, we don't use it at all: + ModeLine "1280x1024@70Hz" 130 1280 1320 1480 1728 1024 1029 1036 1077 + +EndSection + +# ********************************************************************** +# Graphics device section +# ********************************************************************** + +Section "Device" + Identifier "Newport Graphics 1" + Driver "newport" + +# Option "shadowfb" "yes" +# Option "Silkenmouse" "no" +# VideoRam 1280 +# Option "bitplanes" "24" + BusID "0" +EndSection + +Section "Device" + Identifier "Newport Graphics 2" + Driver "newport" + + Option "shadowfb" "yes" + BusID "1" +EndSection + +# ********************************************************************** +# Screen sections. +# ********************************************************************** + +# Any number of screen sections may be present. Each describes +# the configuration of a single screen. A single specific screen section +# may be specified from the X server command line with the "-screen" +# option. + +Section "Screen" + Identifier "Screen 1" + Device "Newport Graphics 1" + Monitor "SGI GDM17e11" + DefaultDepth 8 + + SubSection "Display" + Depth 8 + Modes "1280x1024" + EndSubSection +EndSection + +Section "Screen" + Identifier "Screen 2" + Device "Newport Graphics 2" + Monitor "SGI GDM17e11" + DefaultDepth 24 + + SubSection "Display" + Depth 24 + Modes "1280x1024" + EndSubSection +EndSection + + +# ********************************************************************** +# ServerLayout sections. +# ********************************************************************** + +Section "ServerLayout" + Identifier "simple layout" + Screen "Screen 1" + InputDevice "Mouse1" "CorePointer" + InputDevice "Keyboard1" "CoreKeyboard" +EndSection + +Section "ServerLayout" + Identifier "multihead layout" + Screen "Screen 1" "" "" "" "Screen 2" + Screen "Screen 2" "" "" "Screen 1" "" + InputDevice "Mouse1" "CorePointer" + InputDevice "Keyboard1" "CoreKeyboard" +EndSection diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h new file mode 100644 index 000000000..afab66e82 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h @@ -0,0 +1,78 @@ +/* + * Id: newport.h,v 1.4 2000/11/29 20:58:10 agx Exp $ + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.1 2000/12/01 19:47:58 dawes Exp $ */ + +#ifndef __NEWPORT_H__ +#define __NEWPORT_H__ + +#ifndef XFree86LOADER +# define NEED_XF86_TYPES /* to make XF86FILE, etc available */ +#endif + +/* + * All drivers should include these: + */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +#include "xf86cmap.h" + +/* xaa & hardware cursor */ +#include "xaa.h" +#include "xf86Cursor.h" + +/* register definitions of the Newport card */ +#include "newport_regs.h" + +#define NEWPORT_BASE_ADDR0 0x1f0f0000 +#define NEWPORT_BASE_OFFSET 0x0040000 +#define NEWPORT_MAX_BOARDS 4 + +typedef struct { + unsigned busID; + int bitplanes; + /* revision numbers of the various pieces of silicon */ + unsigned int board_rev, cmap_rev, rex3_rev, xmap9_rev, bt445_rev; + NewportRegsPtr pNewportRegs; /* Pointer to REX3 registers */ + npireg_t drawmode1; /* REX3 drawmode1 common to all drawing operations */ + + /* ShadowFB stuff: */ + pointer ShadowPtr; + unsigned long int ShadowPitch; + unsigned int Bpp; /* Bytes per pixel */ + + /* wrapped funtions: */ + CloseScreenProcPtr CloseScreen; + + /* newport register backups: */ + npireg_t txt_drawmode1; /* Rex3 drawmode1 register */ + unsigned short txt_vc2ctrl; /* VC2 control register */ + CARD8 txt_xmap9_cfg0; /* 0. Xmap9's control register */ + CARD8 txt_xmap9_cfg1; /* 1. Xmap9's control register */ + CARD8 txt_xmap9_mi; /* Xmap9's mode index register */ + LOCO txt_colormap[256]; +} NewportRec, *NewportPtr; + +#define NEWPORTPTR(p) ((NewportPtr)((p)->driverPrivate)) +#define NEWPORTREGSPTR(p) ((NEWPORTPTR(p))->pNewportRegs) + +/* Newport_regs.c */ +unsigned short NewportVc2Get(NewportRegsPtr, unsigned char vc2Ireg); +void NewportVc2Set(NewportRegsPtr pNewportRegs, unsigned char vc2Ireg, unsigned short val); +void NewportWait(NewportRegsPtr pNewportRegs); +void NewportBfwait(NewportRegsPtr pNewportRegs); +void NewportXmap9SetModeRegister(NewportRegsPtr pNewportRegs, CARD8 address, CARD32 mode); + +/* newort_cmap.c */ +void NewportLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO* colors, VisualPtr pVisual); +void NewportRestorePalette(ScrnInfoPtr pScrn); +void NewportBackupPalette(ScrnInfoPtr pScrn); + +/* newport_shadow.c */ +void NewportRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +#endif /* __NEWPORT_H__ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c new file mode 100644 index 000000000..523e037ac --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c @@ -0,0 +1,80 @@ +/* + * Id: newport_cmap.c,v 1.1 2000/11/29 20:58:10 agx Exp $ + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c,v 1.1 2000/12/01 19:47:59 dawes Exp $ */ + +#include "newport.h" + +static void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color); +static void NewportCmapGetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO *color); + +/* Load a colormap into the hardware */ +void NewportLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, \ + LOCO* colors, VisualPtr pVisual) +{ + int i,index; + NewportRegsPtr pNewportRegs = NEWPORTPTR(pScrn)->pNewportRegs; + + for(i = 0; i < numColors; i++) { + index=indices[i]; + NewportBfwait(pNewportRegs); + NewportCmapSetRGB(pNewportRegs, index, colors[index]); + } +} + +void NewportBackupPalette(ScrnInfoPtr pScrn) +{ + int i; + NewportPtr pNewport = NEWPORTPTR(pScrn); + + NewportWait(pNewport->pNewportRegs); + for(i = 0; i < 256; i++) { + NewportCmapGetRGB(pNewport->pNewportRegs, i, &(pNewport->txt_colormap[i])); + } +} + +/* restore the default colormap */ +void NewportRestorePalette(ScrnInfoPtr pScrn) +{ + int i; + NewportPtr pNewport = NEWPORTPTR(pScrn); + + for(i = 0; i < 256; i++) { + NewportCmapSetRGB(pNewport->pNewportRegs, i, pNewport->txt_colormap[i]); + } +} + +/* set the colormap entry at addr to color */ +static void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color) +{ + NewportWait(pNewportRegs); /* this one should not be necessary */ + NewportBfwait(pNewportRegs); + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC | + NCMAP_REGADDR_AREG | NPORT_DMODE_W2); + pNewportRegs->set.dcbdata0.hwords.s1 = addr; + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + NCMAP_REGADDR_PBUF | NPORT_DMODE_W3); + pNewportRegs->set.dcbdata0.all = (color.red << 24) | + (color.green << 16) | + (color.blue << 8); +} + +/* get the colormap entry at addr */ +static void NewportCmapGetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO* color) +{ + npireg_t tmp; + + NewportBfwait(pNewportRegs); + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC | + NCMAP_REGADDR_AREG | NPORT_DMODE_W2); + pNewportRegs->set.dcbdata0.hwords.s1 = addr; + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + NCMAP_REGADDR_PBUF | NPORT_DMODE_W3); + tmp = pNewportRegs->set.dcbdata0.all; + color->red = (tmp >> 24) & 0xff; + color->green = (tmp >> 16) & 0xff; + color->blue = (tmp >> 8) & 0xff; +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c new file mode 100644 index 000000000..28c97ab71 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c @@ -0,0 +1,762 @@ +/* + * Id: newport_driver.c,v 1.2 2000/11/29 20:58:10 agx Exp $ + * + * Driver for the SGI Indy's Newport graphics card + * + * This driver is based on the newport.c & newport_con.c kernel code + * + * (c) 2000 Guido Guenther <guido.guenther@gmx.net> + * + * 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 fur- + * nished 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, FIT- + * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- + * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall not + * be used in advertising or otherwise to promote the sale, use or other deal- + * ings in this Software without prior written authorization from the XFree86 + * Project. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.2 2000/12/02 15:30:46 tsi Exp $ */ + +/* function prototypes, common data structures & generic includes */ +#include "newport.h" + +/* Drivers using the mi SW cursor need: */ +#include "mipointer.h" +/* Drivers using the mi implementation of backing store need: */ +#include "mibstore.h" +/* Drivers using the mi colourmap code need: */ +#include "micmap.h" + +/* Drivers using cfb need: */ +#define PSZ 8 +#include "cfb.h" +#undef PSZ +#include "cfb24.h" +#include "cfb24_32.h" + +/* Drivers using the shadow frame buffer need: */ +#include "shadowfb.h" + +/* Xv Extension */ +#include "xf86xv.h" +#include "Xv.h" + +#define VERSION 4000 +#define NEWPORT_NAME "Newport" +#define NEWPORT_DRIVER_NAME "newport" +#define NEWPORT_MAJOR_VERSION 0 +#define NEWPORT_MINOR_VERSION 1 +#define NEWPORT_PATCHLEVEL 1 + + +/* Prototypes ------------------------------------------------------- */ +static void NewportIdentify(int flags); +static OptionInfoPtr NewportAvailableOptions(int chipid, int busid); +static Bool NewportProbe(DriverPtr drv, int flags); +static Bool NewportPreInit(ScrnInfoPtr pScrn, int flags); +static Bool NewportScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); +static Bool NewportEnterVT(int scrnIndex, int flags); +static void NewportLeaveVT(int scrnIndex, int flags); +static Bool NewportCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool NewportSaveScreen(ScreenPtr pScreen, int mode); +static unsigned NewportHWProbe(unsigned probedIDs[]); /* return number of found boards */ +static Bool NewportModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void NewportRestore(ScrnInfoPtr pScrn, Bool Closing); +static Bool NewportGetRec(ScrnInfoPtr pScrn); +static Bool NewportFreeRec(ScrnInfoPtr pScrn); +static NewportRegsPtr NewportMapRegs(unsigned cardNum); +static Bool NewportUnmapRegs(unsigned cardNum); +static Bool NewportProbeCardInfo(ScrnInfoPtr pScrn); +/* ------------------------------------------------------------------ */ + +DriverRec NEWPORT = { + VERSION, + NEWPORT_DRIVER_NAME, + NewportIdentify, + NewportProbe, + NewportAvailableOptions, + NULL, + 0 +}; + +/* Supported "chipsets" */ +#define CHIP_XL 0x1 + +static SymTabRec NewportChipsets[] = { + { CHIP_XL, "XL" }, + {-1, NULL } +}; + +/* List of Symbols from other modules that this module references */ + +static const char *cfbSymbols[] = { + "cfbScreenInit", + NULL +}; + +static const char *shadowSymbols[] = { + "ShadowFBInit", + NULL +}; + +#ifdef XFree86LOADER + +static MODULESETUPPROTO(newportSetup); + +static XF86ModuleVersionInfo newportVersRec = +{ + "newport", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + NEWPORT_MAJOR_VERSION, NEWPORT_MINOR_VERSION, NEWPORT_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0,0,0,0} +}; + +XF86ModuleData newportModuleData = { &newportVersRec, newportSetup, NULL }; + +static pointer +newportSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + +/* This module should be loaded only once, but check to be sure. */ + if (!setupDone) { + /* + * Modules that this driver always requires may be loaded + * here by calling LoadSubModule(). + */ + setupDone = TRUE; + xf86AddDriver(&NEWPORT, module, 0); + + /* + * Tell the loader about symbols from other modules that this module + * might refer to. + * + */ + LoaderRefSymLists( cfbSymbols, shadowSymbols, NULL); + + + /* + * The return value must be non-NULL on success even though + * there is no TearDownProc. + */ + return (pointer)1; + } else { + if (errmaj) *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +#endif /* XFree86LOADER */ + +typedef enum { + OPTION_BITPLANES, + OPTION_BUS_ID +} NewportOpts; + +/* Supported options */ +static OptionInfoRec NewportOptions [] = { + { OPTION_BITPLANES, "bitplanes", OPTV_INTEGER, {0}, FALSE }, + { OPTION_BUS_ID, "BusID", OPTV_INTEGER, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +/* ------------------------------------------------------------------ */ + +static Bool +NewportGetRec(ScrnInfoPtr pScrn) +{ + NewportPtr pNewport; + if (pScrn->driverPrivate != NULL) + return TRUE; + pScrn->driverPrivate = xnfcalloc(sizeof(NewportRec), 1); + + pNewport = NEWPORTPTR(pScrn); + pNewport->pNewportRegs = NULL; + + return TRUE; +} + +static Bool +NewportFreeRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate == NULL) + return TRUE; + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; + return TRUE; +} + +static void +NewportIdentify(int flags) +{ + xf86PrintChipsets( NEWPORT_NAME, "driver for Newport Graphics Card", NewportChipsets); +} + +static Bool +NewportProbe(DriverPtr drv, int flags) +{ + int numDevSections, numUsed, i, j, busID; + Bool foundScreen = FALSE; + GDevPtr *devSections; + GDevPtr dev = NULL; + resRange range[] = { {ResExcMemBlock ,0,0}, _END }; + unsigned probedIDs[NEWPORT_MAX_BOARDS]; + memType base; + + if ((numDevSections = xf86MatchDevice(NEWPORT_DRIVER_NAME, &devSections)) <= 0) + return FALSE; + numUsed = NewportHWProbe(probedIDs); + if ( numUsed <= 0 ) + return FALSE; + + if(flags & PROBE_DETECT) + foundScreen = TRUE; + else { + for (i = 0; i < numDevSections; i++) { + dev = devSections[i]; + busID = xf86SetIntOption(dev->options, "BusID", 0); + + for( j = 0; j < numUsed; j++) { + if ( busID == probedIDs[j] ) { + int entity; + ScrnInfoPtr pScrn = NULL; + + /* This is a hack because don't have the RAC info(and don't want it). + * Set it as an ISA entity to get the entity field set up right. + */ + entity = xf86ClaimIsaSlot(drv, 0, dev, TRUE); + base = (NEWPORT_BASE_ADDR0 + busID * NEWPORT_BASE_OFFSET); + RANGE(range[0], base, base + sizeof(NewportRegs),\ + ResExcMemBlock); + pScrn = xf86ConfigIsaEntity(pScrn, 0, entity, NULL, range, \ + NULL, NULL, NULL, NULL); + /* Allocate a ScrnInfoRec */ + pScrn->driverVersion = VERSION; + pScrn->driverName = NEWPORT_DRIVER_NAME; + pScrn->name = NEWPORT_NAME; + pScrn->Probe = NewportProbe; + pScrn->PreInit = NewportPreInit; + pScrn->ScreenInit = NewportScreenInit; + pScrn->EnterVT = NewportEnterVT; + pScrn->LeaveVT = NewportLeaveVT; + pScrn->driverPrivate = (void*)busID; + foundScreen = TRUE; + break; + } + } + } + } + xfree(devSections); + return foundScreen; +} + +/* most of this is from DESIGN.TXT s20.3.6 */ +static Bool +NewportPreInit(ScrnInfoPtr pScrn, int flags) +{ + int i, busID; + NewportPtr pNewport; + MessageType from; + ClockRangePtr clockRanges; + char *mod=0, *reqSym=0; + + if (flags & PROBE_DETECT) return FALSE; + + if (pScrn->numEntities != 1) + return FALSE; + + busID = (int)(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; + + /* Fill in the monitor field */ + pScrn->monitor = pScrn->confScreen->monitor; + + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, + Support24bppFb | SupportConvert32to24 | + PreferConvert32to24 )) + return FALSE; + + switch( pScrn->depth ) { + /* check if the returned depth is one we support */ + case 8: + /* OK */ + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by Newport driver\n", + pScrn->depth); + return FALSE; + } + xf86PrintDepthBpp(pScrn); + + /* Set bits per RGB for 8bpp */ + if( pScrn->depth == 8) + pScrn->rgbBits = 8; + + /* Set Default Weight */ + if( pScrn->depth > 8 ) { + rgb zeros = {0, 0, 0}; + if (!xf86SetWeight(pScrn, zeros, zeros)) + return FALSE; + } + + if (!xf86SetDefaultVisual(pScrn, -1)) { + return FALSE; + } else { + if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" + " (%s) is not supported at depth %d\n", + xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); + return FALSE; + } + } + + { /* Set default Gamma */ + Gamma zeros = {0.0, 0.0, 0.0}; + + if (!xf86SetGamma(pScrn, zeros)) { + return FALSE; + } + } + + /* Allocate the NewportRec driverPrivate */ + if (!NewportGetRec(pScrn)) { + return FALSE; + } + pNewport = NEWPORTPTR(pScrn); + pNewport->busID = busID; + + /* We use a programamble clock */ + pScrn->progClock = TRUE; + + /* Fill in pScrn->options) */ + xf86CollectOptions(pScrn, NULL); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, NewportOptions); + + /* Set fields in ScreenInfoRec && NewportRec */ + pScrn->videoRam = 1280 * (pScrn->bitsPerPixel >> 3); + + /* get revisions of REX3, etc. */ + if( !(pNewport->pNewportRegs = NewportMapRegs(busID))) + return FALSE; + NewportProbeCardInfo(pScrn); + NewportUnmapRegs(busID); + + from=X_PROBED; + xf86DrvMsg(pScrn->scrnIndex, from, + "Newport Graphics Revisions: Board: %d, Rex3: %d, Cmap: %c, Xmap9: %d\n", + pNewport->board_rev, pNewport->rex3_rev, + pNewport->cmap_rev, pNewport->xmap9_rev); + + if ( (xf86GetOptValInteger(NewportOptions, OPTION_BITPLANES, &pNewport->bitplanes))) + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, from, "Newport has %d bitplanes\n", pNewport->bitplanes); + + if ( pScrn->depth > pNewport->bitplanes ) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "Display depth(%d) > number of bitplanes on Newport board(%d)\n", \ + pScrn->depth, pNewport->bitplanes); + return FALSE; + } + + /* Set up clock ranges that are alway ok */ + /* XXX: Should use the correct data from the specs(which specs?) here */ + clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges->next = NULL; + clockRanges->minClock = 10000; + clockRanges->maxClock = 300000; + clockRanges->clockIndex = -1; /* programmable */ + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = TRUE; + + /* see above note */ + /* There is currently only an 1280x1024 mode */ + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, + NULL, 256, 2048, + pScrn->bitsPerPixel, 128, 2048, + pScrn->display->virtualX, + pScrn->display->virtualY, + pScrn->videoRam * 1024, + LOOKUP_BEST_REFRESH); + + if (i == -1) { + NewportFreeRec(pScrn); + return FALSE; + } + + xf86PruneDriverModes(pScrn); + if( i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + NewportFreeRec(pScrn); + return FALSE; + } + + /* unnecessary, but do it to get a valid ScrnInfoRec */ + xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + + /* Set the current mode to the first in the list */ + pScrn->currentMode = pScrn->modes; + + /* Print the list of modes being used */ + xf86PrintModes(pScrn); + xf86SetDpi (pScrn, 0, 0); + + switch(pScrn->bitsPerPixel) { + case 8: + mod = "cfb"; + reqSym = "cfbScreenInit"; + break; + } + if ( mod && (!xf86LoadSubModule(pScrn, mod))) { + NewportFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymbols( reqSym, NULL); + + /* Load ShadowFB module */ + if (!xf86LoadSubModule(pScrn, "shadowfb")) { + NewportFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(shadowSymbols, NULL); + + return TRUE; +} + +static Bool +NewportScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScrn; + NewportPtr pNewport; + VisualPtr visual; + BOOL ret; + int i; + + /* First get a pointer to our private info */ + pScrn = xf86Screens[pScreen->myNum]; + pNewport = NEWPORTPTR(pScrn); + + /* map the Newportregs until the server dies */ + if( !(pNewport->pNewportRegs = NewportMapRegs(pNewport->busID))) + return FALSE; + + /* Reset visual list. */ + miClearVisualTypes(); + + if (!miSetVisualTypes(pScrn->depth, pScrn->depth != 8 ? TrueColorMask : + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + + pNewport->Bpp = pScrn->bitsPerPixel >> 3; + /* Setup the stuff for the shadow framebuffer */ + pNewport->ShadowPitch = (( pScrn->virtualX * pNewport->Bpp ) + 3) & ~3L; + pNewport->ShadowPtr = xnfalloc(pNewport->ShadowPitch * pScrn->virtualY); + + if (!NewportModeInit(pScrn, pScrn->currentMode)) + return FALSE; + + switch( pScrn->bitsPerPixel) { + case 8: + ret=cfbScreenInit(pScreen, pNewport->ShadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + default: + xf86Msg(X_ERROR, + "Internal Error: Display depth not supported in NewportScreenInit.\n"); + ret=FALSE; + break; + } + + if(!ret) + return FALSE; + + /* we need rgb ordering if bitsPerPixel > 8 */ + if (pScrn->bitsPerPixel > 8) { + for (i = 0, visual = pScreen->visuals; + i < pScreen->numVisuals; i++, visual++) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + + xf86SetBlackWhitePixels(pScreen); + + /* Initialize software cursor */ + if(!miDCInitialize(pScreen, xf86GetPointerScreenFuncs())) + return FALSE; + + /* Initialise default colourmap */ + if (!miCreateDefColormap(pScreen)) + return FALSE; + + /* Install our LoadPalette funciton */ + if(!xf86HandleColormaps(pScreen, 256, 8, NewportLoadPalette, 0, + CMAP_RELOAD_ON_MODE_SWITCH )) + return FALSE; + + /* Initialise shadow frame buffer */ + ShadowFBInit(pScreen, &NewportRefreshArea8); + +#ifdef XvExtension + { + XF86VideoAdaptorPtr *ptr; + int n; + + n = xf86XVListGenericAdaptors(pScrn,&ptr); + if (n) { + xf86XVScreenInit(pScreen, ptr, n); + } + } +#endif + + + pScreen->SaveScreen = NewportSaveScreen; + /* Wrap the current CloseScreen function */ + pNewport->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = NewportCloseScreen; + + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + } + + return TRUE; +} + +/* called when switching away from a VT */ +static Bool +NewportEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + return NewportModeInit(pScrn, pScrn->currentMode); +} + +/* called when switching to a VT */ +static void +NewportLeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + NewportRestore(pScrn, FALSE); +} + +/* called at the end of each server generation */ +static Bool +NewportCloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + NewportPtr pNewport = NEWPORTPTR(pScrn); + + NewportRestore(pScrn, TRUE); + if (pNewport->ShadowPtr) + xfree(pNewport->ShadowPtr); + + /* unmap the Newport's registers from memory */ + if(!NewportUnmapRegs(pNewport->busID)) + return FALSE; + pScrn->vtSema = FALSE; + + pScreen->CloseScreen = pNewport->CloseScreen; + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + +/* Blank or unblank the screen */ +static Bool +NewportSaveScreen(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn; + NewportRegsPtr pNewportRegs; + Bool unblank; + unsigned short treg; + + unblank = xf86IsUnblank(mode); + pScrn = xf86Screens[pScreen->myNum]; + pNewportRegs = NEWPORTPTR(pScrn)->pNewportRegs; + + if (unblank) { + treg = NewportVc2Get(pNewportRegs, VC2_IREG_CONTROL); + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, (treg | VC2_CTRL_EDISP)); + } else { + treg = NewportVc2Get(pNewportRegs, VC2_IREG_CONTROL); + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, (treg & ~(VC2_CTRL_EDISP))); + } + return TRUE; +} + + +static OptionInfoPtr +NewportAvailableOptions(int chipid, int busid) +{ + return NewportOptions; +} + + +/* This sets up the actual mode on the Newport */ +static Bool +NewportModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + int width, height; + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + width = mode->HDisplay; + height = mode->VDisplay; + if (width != 1280 || height != 1024) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "Width = %d and height = %d is not supported by by this driver\n", width, height); + } + + pScrn->vtSema=TRUE; + /* first backup the necessary registers... */ + pNewport->txt_drawmode1 = pNewportRegs->set.drawmode1; + pNewport->txt_vc2ctrl = NewportVc2Get( pNewportRegs, VC2_IREG_CONTROL); + NewportBackupPalette(pScrn); + + /* ...then setup the hardware */ + /* + * XXX: set the frambuffer layout to either 24 or 8 bpp here - more specs needed + * XXX: Lazy mode on: simply rely on the prom since it does such a good job + */ + if( pNewport->Bpp == 1) { + pNewport->drawmode1 = pNewport->txt_drawmode1; + } + + return TRUE; +} + + +/* + * This will acutally restore the saved state + * (either when switching back to a VT or when the server is going down) + * Closing is true if the X server is really going down + */ +static void +NewportRestore(ScrnInfoPtr pScrn, Bool Closing) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; + + /* Restore backed up registers */ + pNewportRegs->set.drawmode1 = pNewport->txt_drawmode1; + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->txt_vc2ctrl); + NewportRestorePalette(pScrn); +} + + +/* Probe for the Newport card ;) */ +/* XXX: we need a better probe here in order to support multihead! */ +static unsigned +NewportHWProbe(unsigned probedIDs[]) +{ + FILE* cpuinfo; + char line[80]; + unsigned hasNewport = 0; + cpuinfo = xf86fopen("/proc/cpuinfo","r"); + while(xf86fgets(line,80,cpuinfo) != NULL) { + if(xf86strstr(line, "SGI Indy") != NULL) { + hasNewport = 1; + break; + } + } + xf86fclose(cpuinfo); + + probedIDs[0] = 0; + return hasNewport; +} + +/* Probe for Chipset revisions */ +static Bool NewportProbeCardInfo(ScrnInfoPtr pScrn) +{ + unsigned int tmp,cmap_rev; + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; + + NewportWait(pNewportRegs); + pNewportRegs->set.dcbmode = (DCB_CMAP0 | NCMAP_PROTOCOL | + NCMAP_REGADDR_RREG | NPORT_DMODE_W1); + tmp = pNewportRegs->set.dcbdata0.bytes.b3; + pNewport->board_rev = (tmp >> 4) & 7; + pNewport->bitplanes = ((pNewport->board_rev > 1) && (tmp & 0x80)) ? 8 : 24; + cmap_rev = tmp & 7; + pNewport->cmap_rev = (char)('A'+(cmap_rev ? (cmap_rev+1):0)); + pNewport->rex3_rev = (pNewportRegs->cset.ustat) & 7; + + pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_REVISION | NPORT_DMODE_W1); + pNewport->xmap9_rev = (pNewportRegs->set.dcbdata0.bytes.b3) & 7; + + return TRUE; +} + + +/* map NewportRegs */ +static NewportRegsPtr +NewportMapRegs(unsigned cardNum) +{ + int fd; + pointer base; + + if ((fd = xf86open("/dev/mem", XF86_O_RDWR)) < 0) { + FatalError("NewportMapRegs: failed to open /dev/mem (%s)\n", \ + xf86strerror(xf86errno)); + return (NewportRegsPtr)NULL; + } + + base = xf86mmap((pointer)0, sizeof(NewportRegs), \ + XF86_PROT_READ | XF86_PROT_WRITE, XF86_MAP_SHARED, fd, \ + NEWPORT_BASE_ADDR0 + cardNum * NEWPORT_BASE_OFFSET); + xf86close(fd); + if (base == XF86_MAP_FAILED) { + FatalError("NewportMapRegs: Could not mmap NewportRegs (0x%08x,0x%x) (%s)\n", \ + NEWPORT_BASE_ADDR0 + cardNum * NEWPORT_BASE_OFFSET, \ + sizeof(NewportRegs), xf86strerror(xf86errno)); + return (NewportRegsPtr)NULL; + } + return (NewportRegsPtr)base; +} + +/* unmap NewportRegs */ +static Bool +NewportUnmapRegs(unsigned cardNum) +{ + if(xf86munmap( (pointer)(NEWPORT_BASE_ADDR0 + cardNum * NEWPORT_BASE_OFFSET), \ + sizeof(NewportRegs)) == -1) { + FatalError("NewportUnmapRegs: Could not munmap NewportRegs\n"); + return FALSE; + } + return TRUE; +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c new file mode 100644 index 000000000..8a7c08859 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c @@ -0,0 +1,69 @@ +/* + * Id: newport_regs.c,v 1.3 2000/11/29 20:58:10 agx Exp $ + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c,v 1.1 2000/12/01 19:48:01 dawes Exp $ */ + +#include "newport.h" + +static void NewportXmap9FifoWait(NewportRegsPtr pNewportRegs, unsigned long xmapChip); + +void +NewportVc2Set(NewportRegsPtr pNewportRegs, unsigned char vc2Ireg, unsigned short val) +{ + pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | + NPORT_DMODE_ECINC | VC2_PROTOCOL); + pNewportRegs->set.dcbdata0.all = (vc2Ireg << 24) | (val << 8); +} + +unsigned short +NewportVc2Get(NewportRegsPtr pNewportRegs, unsigned char vc2Ireg) +{ + pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | + NPORT_DMODE_ECINC | VC2_PROTOCOL); + pNewportRegs->set.dcbdata0.bytes.b3 = vc2Ireg; + pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 | + NPORT_DMODE_ECINC | VC2_PROTOCOL); + return pNewportRegs->set.dcbdata0.hwords.s1; +} + + +/* Sometimes we just have to wait until we can do anything */ +void +NewportWait(NewportRegsPtr pNewportRegs) +{ + while(1) + if(!(pNewportRegs->cset.stat & NPORT_STAT_GBUSY)) + break; +} + +void +NewportBfwait(NewportRegsPtr pNewportRegs) +{ + while(1) + if(!(pNewportRegs->cset.stat & NPORT_STAT_BBUSY)) + break; +} + +/* wait til an entry in the Xmap9's Mode Fifo is free (xmapChip = DCB_XMAP0 | DCB_XMAP1) */ +static void +NewportXmap9FifoWait(NewportRegsPtr pNewportRegs, unsigned long xmapChip) +{ + while(1) { + NewportBfwait( pNewportRegs); + pNewportRegs->set.dcbmode = (xmapChip | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_FIFO_AVAIL | NPORT_DMODE_W1); + if( (pNewportRegs->set.dcbdata0.bytes.b3) & 7 ) + break; + } +} + +void +NewportXmap9SetModeRegister(NewportRegsPtr pNewportRegs, CARD8 address, CARD32 mode) +{ + NewportXmap9FifoWait( pNewportRegs, DCB_XMAP0); + NewportXmap9FifoWait( pNewportRegs, DCB_XMAP1); + + pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_MODE_REG_DATA | NPORT_DMODE_W4 ); + pNewportRegs->set.dcbdata0.all = (address << 24) | ( mode & 0xffffff ); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h new file mode 100644 index 000000000..f976d065c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h @@ -0,0 +1,453 @@ +/* + * Id: newport_regs.h,v 1.5 2000/11/18 23:23:14 agx Exp $ + * + * Register Layouts of the various newport chips + * mostly as found in linux/include/asm/newport.h + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h,v 1.1 2000/12/01 19:48:01 dawes Exp $ */ + +typedef volatile unsigned long npireg_t; + +union npfloat { + volatile float f; + npireg_t i; +}; + +typedef union npfloat npfreg_t; + +union np_dcb { + npireg_t all; + struct { volatile unsigned short s0, s1; } hwords; + struct { volatile unsigned char b0, b1, b2, b3; } bytes; +}; + +struct Newport_rexregs { + npireg_t drawmode1; /* GL extra mode bits */ + +#define DM1_PLANES 0x00000007 +#define DM1_NOPLANES 0x00000000 +#define DM1_RGBPLANES 0x00000001 +#define DM1_RGBAPLANES 0x00000002 +#define DM1_OLAYPLANES 0x00000004 +#define DM1_PUPPLANES 0x00000005 +#define DM1_CIDPLANES 0x00000006 + +#define NPORT_DMODE1_DDMASK 0x00000018 +#define NPORT_DMODE1_DD4 0x00000000 +#define NPORT_DMODE1_DD8 0x00000008 +#define NPORT_DMODE1_DD12 0x00000010 +#define NPORT_DMODE1_DD24 0x00000018 +#define NPORT_DMODE1_DSRC 0x00000020 +#define NPORT_DMODE1_YFLIP 0x00000040 +#define NPORT_DMODE1_RWPCKD 0x00000080 +#define NPORT_DMODE1_HDMASK 0x00000300 +#define NPORT_DMODE1_HD4 0x00000000 +#define NPORT_DMODE1_HD8 0x00000100 +#define NPORT_DMODE1_HD12 0x00000200 +#define NPORT_DMODE1_HD32 0x00000300 +#define NPORT_DMODE1_RWDBL 0x00000400 +#define NPORT_DMODE1_ESWAP 0x00000800 /* Endian swap */ +#define NPORT_DMODE1_CCMASK 0x00007000 +#define NPORT_DMODE1_CCLT 0x00001000 +#define NPORT_DMODE1_CCEQ 0x00002000 +#define NPORT_DMODE1_CCGT 0x00004000 +#define NPORT_DMODE1_RGBMD 0x00008000 +#define NPORT_DMODE1_DENAB 0x00010000 /* Dither enable */ +#define NPORT_DMODE1_FCLR 0x00020000 /* Fast clear */ +#define NPORT_DMODE1_BENAB 0x00040000 /* Blend enable */ +#define NPORT_DMODE1_SFMASK 0x00380000 +#define NPORT_DMODE1_SF0 0x00000000 +#define NPORT_DMODE1_SF1 0x00080000 +#define NPORT_DMODE1_SFDC 0x00100000 +#define NPORT_DMODE1_SFMDC 0x00180000 +#define NPORT_DMODE1_SFSA 0x00200000 +#define NPORT_DMODE1_SFMSA 0x00280000 +#define NPORT_DMODE1_DFMASK 0x01c00000 +#define NPORT_DMODE1_DF0 0x00000000 +#define NPORT_DMODE1_DF1 0x00400000 +#define NPORT_DMODE1_DFSC 0x00800000 +#define NPORT_DMODE1_DFMSC 0x00c00000 +#define NPORT_DMODE1_DFSA 0x01000000 +#define NPORT_DMODE1_DFMSA 0x01400000 +#define NPORT_DMODE1_BBENAB 0x02000000 /* Back blend enable */ +#define NPORT_DMODE1_PFENAB 0x04000000 /* Pre-fetch enable */ +#define NPORT_DMODE1_ABLEND 0x08000000 /* Alpha blend */ +#define NPORT_DMODE1_LOMASK 0xf0000000 +#define NPORT_DMODE1_LOZERO 0x00000000 +#define NPORT_DMODE1_LOAND 0x10000000 +#define NPORT_DMODE1_LOANDR 0x20000000 +#define NPORT_DMODE1_LOSRC 0x30000000 +#define NPORT_DMODE1_LOANDI 0x40000000 +#define NPORT_DMODE1_LODST 0x50000000 +#define NPORT_DMODE1_LOXOR 0x60000000 +#define NPORT_DMODE1_LOOR 0x70000000 +#define NPORT_DMODE1_LONOR 0x80000000 +#define NPORT_DMODE1_LOXNOR 0x90000000 +#define NPORT_DMODE1_LONDST 0xa0000000 +#define NPORT_DMODE1_LOORR 0xb0000000 +#define NPORT_DMODE1_LONSRC 0xc0000000 +#define NPORT_DMODE1_LOORI 0xd0000000 +#define NPORT_DMODE1_LONAND 0xe0000000 +#define NPORT_DMODE1_LOONE 0xf0000000 + + npireg_t drawmode0; /* REX command register */ + + /* These bits define the graphics opcode being performed. */ +#define NPORT_DMODE0_OPMASK 0x00000003 /* Opcode mask */ +#define NPORT_DMODE0_NOP 0x00000000 /* No operation */ +#define NPORT_DMODE0_RD 0x00000001 /* Read operation */ +#define NPORT_DMODE0_DRAW 0x00000002 /* Draw operation */ +#define NPORT_DMODE0_S2S 0x00000003 /* Screen to screen operation */ + + /* The following decide what addressing mode(s) are to be used */ +#define NPORT_DMODE0_AMMASK 0x0000001c /* Address mode mask */ +#define NPORT_DMODE0_SPAN 0x00000000 /* Spanning address mode */ +#define NPORT_DMODE0_BLOCK 0x00000004 /* Block address mode */ +#define NPORT_DMODE0_ILINE 0x00000008 /* Iline address mode */ +#define NPORT_DMODE0_FLINE 0x0000000c /* Fline address mode */ +#define NPORT_DMODE0_ALINE 0x00000010 /* Aline address mode */ +#define NPORT_DMODE0_TLINE 0x00000014 /* Tline address mode */ +#define NPORT_DMODE0_BLINE 0x00000018 /* Bline address mode */ + + /* And now some misc. operation control bits. */ +#define NPORT_DMODE0_DOSETUP 0x00000020 +#define NPORT_DMODE0_CHOST 0x00000040 +#define NPORT_DMODE0_AHOST 0x00000080 +#define NPORT_DMODE0_STOPX 0x00000100 +#define NPORT_DMODE0_STOPY 0x00000200 +#define NPORT_DMODE0_SK1ST 0x00000400 +#define NPORT_DMODE0_SKLST 0x00000800 +#define NPORT_DMODE0_ZPENAB 0x00001000 +#define NPORT_DMODE0_LISPENAB 0x00002000 +#define NPORT_DMODE0_LISLST 0x00004000 +#define NPORT_DMODE0_L32 0x00008000 +#define NPORT_DMODE0_ZOPQ 0x00010000 +#define NPORT_DMODE0_LISOPQ 0x00020000 +#define NPORT_DMODE0_SHADE 0x00040000 +#define NPORT_DMODE0_LRONLY 0x00080000 +#define NPORT_DMODE0_XYOFF 0x00100000 +#define NPORT_DMODE0_CLAMP 0x00200000 +#define NPORT_DMODE0_ENDPF 0x00400000 +#define NPORT_DMODE0_YSTR 0x00800000 + + npireg_t lsmode; /* Mode for line stipple ops */ + npireg_t lspattern; /* Pattern for line stipple ops */ + npireg_t lspatsave; /* Backup save pattern */ + npireg_t zpattern; /* Pixel zpattern */ + npireg_t colorback; /* Background color */ + npireg_t colorvram; /* Clear color for fast vram */ + npireg_t alpharef; /* Reference value for afunctions */ + unsigned long pad0; + npireg_t smask0x; /* Window GL relative screen mask 0 */ + npireg_t smask0y; /* Window GL relative screen mask 0 */ + npireg_t _setup; + npireg_t _stepz; + npireg_t _lsrestore; + npireg_t _lssave; + + unsigned long _pad1[0x30]; + + /* Iterators, full state for context switch */ + npfreg_t _xstart; /* X-start point (current) */ + npfreg_t _ystart; /* Y-start point (current) */ + npfreg_t _xend; /* x-end point */ + npfreg_t _yend; /* y-end point */ + npireg_t xsave; /* copy of xstart integer value for BLOCk addressing MODE */ + npireg_t xymove; /* x.y offset from xstart, ystart for relative operations */ + npfreg_t bresd; + npfreg_t bress1; + npireg_t bresoctinc1; + volatile int bresrndinc2; + npireg_t brese1; + npireg_t bress2; + npireg_t aweight0; + npireg_t aweight1; + npfreg_t xstartf; + npfreg_t ystartf; + npfreg_t xendf; + npfreg_t yendf; + npireg_t xstarti; + npfreg_t xendf1; + npireg_t xystarti; + npireg_t xyendi; + npireg_t xstartendi; + + unsigned long _unused2[0x29]; + + npfreg_t colorred; + npfreg_t coloralpha; + npfreg_t colorgrn; + npfreg_t colorblue; + npfreg_t slopered; + npfreg_t slopealpha; + npfreg_t slopegrn; + npfreg_t slopeblue; + npireg_t wrmask; + npireg_t colori; + npfreg_t colorx; + npfreg_t slopered1; + npireg_t hostrw0; + npireg_t hostrw1; + npireg_t dcbmode; +#define NPORT_DMODE_WMASK 0x00000003 +#define NPORT_DMODE_W4 0x00000000 +#define NPORT_DMODE_W1 0x00000001 +#define NPORT_DMODE_W2 0x00000002 +#define NPORT_DMODE_W3 0x00000003 +#define NPORT_DMODE_EDPACK 0x00000004 +#define NPORT_DMODE_ECINC 0x00000008 +#define NPORT_DMODE_CMASK 0x00000070 +#define NPORT_DMODE_AMASK 0x00000780 +#define NPORT_DMODE_AVC2 0x00000000 +#define NPORT_DMODE_ACMALL 0x00000080 +#define NPORT_DMODE_ACM0 0x00000100 +#define NPORT_DMODE_ACM1 0x00000180 +#define NPORT_DMODE_AXMALL 0x00000200 +#define NPORT_DMODE_AXM0 0x00000280 +#define NPORT_DMODE_AXM1 0x00000300 +#define NPORT_DMODE_ABT 0x00000380 +#define NPORT_DMODE_AVCC1 0x00000400 +#define NPORT_DMODE_AVAB1 0x00000480 +#define NPORT_DMODE_ALG3V0 0x00000500 +#define NPORT_DMODE_A1562 0x00000580 +#define NPORT_DMODE_ESACK 0x00000800 +#define NPORT_DMODE_EASACK 0x00001000 +#define NPORT_DMODE_CWMASK 0x0003e000 +#define NPORT_DMODE_CHMASK 0x007c0000 +#define NPORT_DMODE_CSMASK 0x0f800000 +#define NPORT_DMODE_SENDIAN 0x10000000 + + unsigned long _unused3; + + union np_dcb dcbdata0; + npireg_t dcbdata1; +}; + +struct Newport_cregs { + npireg_t smask1x; + npireg_t smask1y; + npireg_t smask2x; + npireg_t smask2y; + npireg_t smask3x; + npireg_t smask3y; + npireg_t smask4x; + npireg_t smask4y; + npireg_t topscan; + npireg_t xywin; + npireg_t clipmode; +#define NPORT_CMODE_SM0 0x00000001 +#define NPORT_CMODE_SM1 0x00000002 +#define NPORT_CMODE_SM2 0x00000004 +#define NPORT_CMODE_SM3 0x00000008 +#define NPORT_CMODE_SM4 0x00000010 +#define NPORT_CMODE_CMSK 0x00001e00 + + unsigned long _unused0; + unsigned long config; +#define NPORT_CFG_G32MD 0x00000001 +#define NPORT_CFG_BWIDTH 0x00000002 +#define NPORT_CFG_ERCVR 0x00000004 +#define NPORT_CFG_BDMSK 0x00000078 +#define NPORT_CFG_GDMSK 0x00000f80 +#define NPORT_CFG_GD0 0x00000080 +#define NPORT_CFG_GD1 0x00000100 +#define NPORT_CFG_GD2 0x00000200 +#define NPORT_CFG_GD3 0x00000400 +#define NPORT_CFG_GD4 0x00000800 +#define NPORT_CFG_GFAINT 0x00001000 +#define NPORT_CFG_TOMSK 0x0000e000 +#define NPORT_CFG_VRMSK 0x00070000 +#define NPORT_CFG_FBTYP 0x00080000 + + npireg_t _unused1; + npireg_t stat; +#define NPORT_STAT_VERS 0x00000007 +#define NPORT_STAT_GBUSY 0x00000008 +#define NPORT_STAT_BBUSY 0x00000010 +#define NPORT_STAT_VRINT 0x00000020 +#define NPORT_STAT_VIDINT 0x00000040 +#define NPORT_STAT_GLMSK 0x00001f80 +#define NPORT_STAT_BLMSK 0x0007e000 +#define NPORT_STAT_BFIRQ 0x00080000 +#define NPORT_STAT_GFIRQ 0x00100000 + + npireg_t ustat; + npireg_t dreset; +}; + +typedef +struct Newport_regs { + struct Newport_rexregs set; + unsigned long _unused0[0x16e]; + struct Newport_rexregs go; + unsigned long _unused1[0x22e]; + struct Newport_cregs cset; + unsigned long _unused2[0x1ef]; + struct Newport_cregs cgo; +} NewportRegs, *NewportRegsPtr; + +/* Reading/writing VC2 registers. */ +#define VC2_REGADDR_INDEX 0x00000000 +#define VC2_REGADDR_IREG 0x00000010 +#define VC2_REGADDR_RAM 0x00000030 +#define VC2_PROTOCOL (NPORT_DMODE_EASACK | 0x00800000 | 0x00040000) + +#define VC2_VLINET_ADDR 0x000 +#define VC2_VFRAMET_ADDR 0x400 +#define VC2_CGLYPH_ADDR 0x500 + +/* Now the Indexed registers of the VC2. */ +#define VC2_IREG_VENTRY 0x00 +#define VC2_IREG_CENTRY 0x01 +#define VC2_IREG_CURSX 0x02 +#define VC2_IREG_CURSY 0x03 +#define VC2_IREG_CCURSX 0x04 +#define VC2_IREG_DENTRY 0x05 +#define VC2_IREG_SLEN 0x06 +#define VC2_IREG_RADDR 0x07 +#define VC2_IREG_VFPTR 0x08 +#define VC2_IREG_VLSPTR 0x09 +#define VC2_IREG_VLIR 0x0a +#define VC2_IREG_VLCTR 0x0b +#define VC2_IREG_CTPTR 0x0c +#define VC2_IREG_WCURSY 0x0d +#define VC2_IREG_DFPTR 0x0e +#define VC2_IREG_DLTPTR 0x0f +#define VC2_IREG_CONTROL 0x10 +#define VC2_IREG_CONFIG 0x20 + +/* VC2 Control register bits */ +#define VC2_CTRL_EVIRQ 0x0001 +#define VC2_CTRL_EDISP 0x0002 +#define VC2_CTRL_EVIDEO 0x0004 +#define VC2_CTRL_EDIDS 0x0008 +#define VC2_CTRL_ECURS 0x0010 +#define VC2_CTRL_EGSYNC 0x0020 +#define VC2_CTRL_EILACE 0x0040 +#define VC2_CTRL_ECDISP 0x0080 +#define VC2_CTRL_ECCURS 0x0100 +#define VC2_CTRL_ECG64 0x0200 +#define VC2_CTRL_GLSEL 0x0400 + +/* Controlling the color map on Newport. */ +#define NCMAP_REGADDR_AREG 0x00000000 +#define NCMAP_REGADDR_ALO 0x00000000 +#define NCMAP_REGADDR_AHI 0x00000010 +#define NCMAP_REGADDR_PBUF 0x00000020 +#define NCMAP_REGADDR_CREG 0x00000030 +#define NCMAP_REGADDR_SREG 0x00000040 +#define NCMAP_REGADDR_RREG 0x00000060 +#define NCMAP_PROTOCOL (0x00008000 | 0x00040000 | 0x00800000) + +/* + * DCBMODE register defines: + */ + +/* Widht of the data being transfered for each DCBDATA[01] word */ +#define DCB_DATAWIDTH_4 0x0 +#define DCB_DATAWIDTH_1 0x1 +#define DCB_DATAWIDTH_2 0x2 +#define DCB_DATAWIDTH_3 0x3 + +/* If set, all of DCBDATA will be moved, otherwise only DATAWIDTH bytes */ +#define DCB_ENDATAPACK (1 << 2) + +/* Enables DCBCRS auto increment after each DCB transfer */ +#define DCB_ENCRSINC (1 << 3) + +/* shift for accessing the control register select address (DBCCRS, 3 bits) */ +#define DCB_CRS_SHIFT 4 + +/* DCBADDR (4 bits): display bus slave address */ +#define DCB_ADDR_SHIFT 7 +#define DCB_VC2 (0 << DCB_ADDR_SHIFT) +#define DCB_CMAP_ALL (1 << DCB_ADDR_SHIFT) +#define DCB_CMAP0 (2 << DCB_ADDR_SHIFT) +#define DCB_CMAP1 (3 << DCB_ADDR_SHIFT) +#define DCB_XMAP_ALL (4 << DCB_ADDR_SHIFT) +#define DCB_XMAP0 (5 << DCB_ADDR_SHIFT) +#define DCB_XMAP1 (6 << DCB_ADDR_SHIFT) +#define DCB_BT445 (7 << DCB_ADDR_SHIFT) +#define DCB_VCC1 (8 << DCB_ADDR_SHIFT) +#define DCB_VAB1 (9 << DCB_ADDR_SHIFT) +#define DCB_LG3_BDVERS0 (10 << DCB_ADDR_SHIFT) +#define DCB_LG3_ICS1562 (11 << DCB_ADDR_SHIFT) +#define DCB_RESERVED (15 << DCB_ADDR_SHIFT) + +/* DCB protocol ack types */ +#define DCB_ENSYNCACK (1 << 11) +#define DCB_ENASYNCACK (1 << 12) + +#define DCB_CSWIDTH_SHIFT 13 +#define DCB_CSHOLD_SHIFT 18 +#define DCB_CSSETUP_SHIFT 23 + +/* XMAP9 specific defines */ +/* XMAP9 -- registers as seen on the DCBMODE register*/ +# define XM9_CRS_CONFIG (0 << DCB_CRS_SHIFT) +# define XM9_PUPMODE (1 << 0) +# define XM9_ODD_PIXEL (1 << 1) +# define XM9_8_BITPLANES (1 << 2) +# define XM9_SLOW_DCB (1 << 3) +# define XM9_VIDEO_RGBMAP_MASK (3 << 4) +# define XM9_VIDEO_RGBMAP_M0 (1 << 4) +# define XM9_VIDEO_RGMPAP_M1 (1 << 5) +# define XM9_VIDEO_RGBMAP_M2 (3 << 4) +# define XM9_EXPRESS_VIDEO (1 << 6) +# define XM9_VIDEO_OPTION (1 << 7) +# define XM9_CRS_REVISION (1 << DCB_CRS_SHIFT) +# define XM9_CRS_FIFO_AVAIL (2 << DCB_CRS_SHIFT) +# define XM9_FIFO_0_AVAIL 0 +# define XM9_FIFO_1_AVAIL 1 +# define XM9_FIFO_2_AVAIL 3 +# define XM9_FIFO_3_AVAIL 2 +# define XM9_FIFO_FULL XM9_FIFO_0_AVAIL +# define XM9_FIFO_EMPTY XM9_FIFO_3_AVAIL +# define XM9_CRS_CURS_CMAP_MSB (3 << DCB_CRS_SHIFT) +# define XM9_CRS_PUP_CMAP_MSB (4 << DCB_CRS_SHIFT) +# define XM9_CRS_MODE_REG_DATA (5 << DCB_CRS_SHIFT) +# define XM9_CRS_MODE_REG_INDEX (7 << DCB_CRS_SHIFT) + + +#define DCB_CYCLES(setup,hold,width) \ + ((hold << DCB_CSHOLD_SHIFT) | \ + (setup << DCB_CSSETUP_SHIFT)| \ + (width << DCB_CSWIDTH_SHIFT)) + +#define W_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 0) +#define WSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (5, 5, 0) +#define WAYSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (12, 12, 0) +#define R_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 3) + +/* xmap9 mode register layout */ +#define XM9_MREG_BUF_SEL (1 << 0) +#define XM9_MREG_OVL_BUF_SEL (1 << 1) +#define XM9_MREG_GAMMA_BYPASS (1 << 2) +#define XM9_MREG_MSB_CMAP (31 << 3 +#define XM9_MREG_PIX_MODE_MASK (3 << 8) +#define XM9_MREG_PIX_MODE_RGB0 (1 << 8) +#define XM9_MREG_PIX_MODE_RGB1 (1 << 9) +#define XM9_MREG_PIX_MODE_RGB2 (3 << 8) +#define XM9_MREG_PIX_SIZE_MASK (3 << 10) +#define XM9_MREG_PIX_SIZE_8BPP (1 << 10) +#define XM9_MREG_PIX_SIZE_12BPP (1 << 11) +#define XM9_MREG_PIX_SIZE_24BPP (3 << 10) +#define XM9_MREG_VID_MODE_MASK (3 << 12) +#define XM9_MREG_VID_MODE_OVL (1 << 12) +#define XM9_MREG_VID_MODE_UDL (1 << 13) +#define XM9_MREG_VID_MODE_RPL (3 << 12) +#define XM9_MREG_BUF_VID_ALPHA (1 << 15) +#define XM9_MREG_APIX_MODE_MASK (7 << 16) +#define XM9_MREG_APIX_MODE_FUDL (1 << 16) +#define XM9_MREG_APIX_MODE_FOVL (1 << 17) +#define XM9_MREG_APIX_MODE_ODB (3 << 17) +#define XM9_MREG_APIX_MODE_BOTH (7 << 16) +#define XM9_MREG_AMSB_CMAP_MASK (31 << 19) + + +#define BT445_PROTOCOL DCB_CYCLES(1,1,3) + +#define BT445_CSR_ADDR_REG (0 << DCB_CRS_SHIFT) +#define BT445_CSR_REVISION (2 << DCB_CRS_SHIFT) + +#define BT445_REVISION_REG 0x01 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c new file mode 100644 index 000000000..0e06e77ef --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c @@ -0,0 +1,47 @@ +/* + * Id: newport_shadow.c,v 1.3 2000/11/29 20:58:10 agx Exp $ + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c,v 1.1 2000/12/01 19:48:02 dawes Exp $ */ + +#include "newport.h" + +void +NewportRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + unsigned long *base, *src; + int dx, dy, x; + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; + +#define RA8_PIXELS 4 /* burst 4 pixels each time */ +#define RA8_PIXEL_SHIFT 2 /* 4 Pixels on each burst */ +#define RA8_MASK 0xffc /* move to 4Byte boundary */ + + NewportWait(pNewportRegs); + pNewportRegs->set.drawmode1 = pNewport->drawmode1 | (NPORT_DMODE1_RWPCKD | \ + (NPORT_DMODE1_HDMASK & NPORT_DMODE1_HD8)); + pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | \ + NPORT_DMODE0_CHOST); + while(num--) { + NewportWait(pNewportRegs); + x = pbox->x1 & RA8_MASK; /* move x to 4 byte boundary */ + base = (unsigned long*)pNewport->ShadowPtr + + (pbox->y1 * (pNewport->ShadowPitch >> RA8_PIXEL_SHIFT) ) + + ( x >> RA8_PIXEL_SHIFT); + + pNewportRegs->set.xystarti = (x << 16) | pbox->y1; + pNewportRegs->set.xyendi = (pbox->x2 << 16) | pbox->y2; + + for ( dy = pbox->y1; dy <= pbox->y2; dy++) { + + src = base; + for ( dx = x; dx <= pbox->x2; dx += RA8_PIXELS) { + pNewportRegs->go.hostrw0 = *src; + src++; + } + base += ( pNewport->ShadowPitch >> RA8_PIXEL_SHIFT ); + } + pbox++; + } +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c index 19b4a8126..079028165 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c @@ -24,7 +24,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.50 2000/11/16 19:44:59 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.51 2000/12/02 15:30:46 tsi Exp $ */ #include "nv_include.h" @@ -417,7 +417,7 @@ static Bool NVProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -476,9 +476,7 @@ NVProbe(DriverPtr drv, int flags) &usedChips); /* Free it since we don't need that list after this */ - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c b/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c index e843dfe1a..7f755f6a8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.36 2000/09/19 16:52:45 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.37 2000/12/02 15:30:47 tsi Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -314,9 +314,7 @@ renditionProbe(DriverPtr drv, int flags) renditionChipsets, renditionPCIchipsets, devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c index abeae8197..004f483c3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.68 2000/11/28 20:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.69 2000/12/02 15:30:47 tsi Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -496,7 +496,7 @@ static Bool S3VProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -521,9 +521,7 @@ S3VProbe(DriverPtr drv, int flags) numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile new file mode 100644 index 000000000..cc2612798 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile @@ -0,0 +1,73 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.2 2000/12/02 15:30:48 tsi Exp $ +/* + * + * Copyright 1995-1998 The XFree86 Project, Inc. + * + */ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = savage_driver.c \ + savage_accel.c \ + savage_cursor.c \ + savage_image.c \ + savage_shadow.c \ + savage_vbe.c + +OBJS = savage_driver.o \ + savage_accel.o \ + savage_cursor.o \ + savage_image.o \ + savage_shadow.o \ + savage_vbe.o + +DEFINES = -DPSZ=8 + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ + -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \ + -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ + -I$(EXTINCSRC) -I$(XF86OSSRC)/vbe -I$(XF86SRC)/shadowfb +#endif + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +NormalAsmObjectRule() + +ModuleObjectRule() +ObjectModuleTarget(savage, $(OBJS)) + +InstallObjectModule(savage,$(MODULEDIR),drivers) + +#if !defined(XF86DriverSDK) +CppManTarget(savage,) +InstallModuleManPage(savage) +#endif + +DependTarget() + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_accel.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_bci.h,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_cursor.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_driver.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_driver.h,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_image.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_regs.h,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_shadow.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_vbe.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_vbe.h,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage.cpp,$(DRIVERSDKDIR)/drivers/savage) + +InstallDriverSDKObjectModule(savage,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp new file mode 100644 index 000000000..9c4631d37 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp @@ -0,0 +1,96 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp,v 1.1 2000/12/02 01:16:11 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SAVAGE __drivermansuffix__ "Version 4.0.1" "XFree86" +.SH NAME +savage \- S3 Savage video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsavage\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B savage +is an XFree86 driver for the S3 Savage family video accelerator chips. The +.B savage +driver supports PCI and AGP boards with the following chips: +.TP 16 +.BI Savage3D +(8a20 and 8a21) +.TP 16 +.B Savage4 +(8a22) +.TP 16 +.B Savage2000 +(9102) +.TP 16 +.B Savage/MX +(8c10 and 8c11) +.TP 16 +.B Savage/IX +(8c12 and 8c13) +.TP 16 +.B ProSavage PM133 +(8a25) +.TP 16 +.B ProSavage KM133 +(8a26) +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +These two options interact to specify hardware or software cursor. If the +SWCursor option is specified, any HWCursor setting is ignored. Thus, either +\*qHWCursor off\*q or \*qSWCursor on\*q will force the use of the software +cursor. On Savage/MX and Savage/IX chips which are connected to LCDs, a +software cursor will be forced, because the Savage hardware cursor does not +correctly track the automatic panel expansion feature. +Default: hardware cursor. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the desktop 90 degrees clockwise or counterclockwise. This option +forces the ShadowFB option on, and disables acceleration. +Default: no rotation. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. This option +disables acceleration. Default: off. +.TP +.BI "Option \*qUseBIOS\*q \*q" boolean \*q +Enable or disable use of the video BIOS to change modes. Ordinarily, the +.B savage +driver tries to use the video BIOS to do mode switches. This generally +produces the best results with the mobile chips (/MX and /IX), since the BIOS +knows how to handle the critical but unusual timing requirements of the +various LCD panels supported by the chip. To do this, the driver searches +through the BIOS mode list, looking for the mode which most closely matches +the XF86Config mode line. Some purists find this scheme objectionable. If +you would rather have the +.B savage +driver use your mode line timing exactly, turn off the UseBios option. +Default: on (use the BIOS). +.SH FILES +savage_drv.o +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include Tim Roberts (timr@probo.com) and Ani Joshi (ajoshi@unixbox.com) +for the 4.0 version, and Tim Roberts and S. Marineau for the 3.3 driver from +which this was derived. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c new file mode 100644 index 000000000..cb5e07763 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c @@ -0,0 +1,1260 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.2 2000/12/02 15:30:49 tsi Exp $ */ + +/* + * + * Copyright 1995-1997 The XFree86 Project, Inc. + * + */ + +/* + * The accel file for the Savage driver. + * + * Created 20/03/97 by Sebastien Marineau for 3.3.6 + * Modified 17-Nov-2000 by Tim Roberts for 4.0.1 + * Revision: + * + */ + +#include "Xarch.h" +#include "xf86.h" +#include "xf86_ansic.h" +#include "xf86_OSproc.h" +#include "compiler.h" +#include "xaalocal.h" +#include "xaarop.h" +#include "xf86PciInfo.h" +#include "miline.h" + +#include "savage_driver.h" +#include "savage_regs.h" +#include "savage_bci.h" + + +/* Globals used in driver */ +extern pointer s3savMmioMem; +#ifdef __alpha__ +extern pointer s3savMmioMemSparse; +#endif + +/* Forward declaration of functions used in the driver */ + +static void SavageAccelSync( ScrnInfoPtr ); + +static void SavageSetupForScreenToScreenCopy( + ScrnInfoPtr pScrn, + int xdir, + int ydir, + int rop, + unsigned planemask, + int transparency_color); + +static void SavageSubsequentScreenToScreenCopy( + ScrnInfoPtr pScrn, + int x1, + int y1, + int x2, + int y2, + int w, + int h); + +static void SavageSetupForSolidFill( + ScrnInfoPtr pScrn, + int color, + int rop, + unsigned planemask); + +static void SavageSubsequentSolidFillRect( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h); + +static void SavageSubsequentSolidBresenhamLine( + ScrnInfoPtr pScrn, + int x1, + int y1, + int e1, + int e2, + int err, + int length, + int octant); + +static void SavageSubsequentSolidTwoPointLine( + ScrnInfoPtr pScrn, + int x1, + int y1, + int x2, + int y2, + int bias); + +#if 0 +static void SavageSetupForScreenToScreenColorExpand( + ScrnInfoPtr pScrn, + int bg, + int fg, + int rop, + unsigned planemask); + +static void SavageSubsequentScreenToScreenColorExpand( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft); +#endif + +static void SavageSetupForCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, + int bg, + int rop, + unsigned planemask); + +static void SavageSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft); + +static void SavageSubsequentColorExpandScanline( + ScrnInfoPtr pScrn, + int buffer_no); + +static void SavageSetupForMono8x8PatternFill( + ScrnInfoPtr pScrn, + int patternx, + int patterny, + int fg, + int bg, + int rop, + unsigned planemask); + +static void SavageSubsequentMono8x8PatternFillRect( + ScrnInfoPtr pScrn, + int pattern0, + int pattern1, + int x, + int y, + int w, + int h); + +static void SavageSetupForColor8x8PatternFill( + ScrnInfoPtr pScrn, + int patternx, + int patterny, + int rop, + unsigned planemask, + int trans_col); + +static void SavageSubsequentColor8x8PatternFillRect( + ScrnInfoPtr pScrn, + int pattern0, + int pattern1, + int x, + int y, + int w, + int h); + +static void SavageSetClippingRectangle( + ScrnInfoPtr pScrn, + int x1, + int y1, + int x2, + int y2); + +static void SavageDisableClipping( ScrnInfoPtr ); + +#if 0 +static void SavageSubsequentSolidFillTrap( + ScrnInfoPtr pScrn, + int y, + int h, + int left, + int dxl, + int dyl, + int el, + int right, + int dxr, + int dyr, + int er); +#endif + +/* from savage_image.c: */ + +void SavageSetupForImageWrite( + ScrnInfoPtr pScrn, + int rop, + unsigned int planemask, + int transparency_color, + int bpp, + int depth); + +void SavageSubsequentImageWriteRect( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft); + +void SavageWriteBitmapCPUToScreenColorExpand ( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned char * src, + int srcwidth, + int skipleft, + int fg, int bg, + int rop, + unsigned int planemask +); + + +void SavageSetGBD( ScrnInfoPtr ); + +/* + * This is used to cache the last known value for routines we want to + * call from the debugger. + */ + +static ScrnInfoPtr gpScrn = 0; + + + + +void +SavageInitialize2DEngine(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + unsigned int vgaCRIndex = hwp->IOBase + 4; + unsigned int vgaCRReg = hwp->IOBase + 5; + + gpScrn = pScrn; + + VGAOUT16(vgaCRIndex, 0x0140); + VGAOUT8(vgaCRIndex, 0x31); + VGAOUT8(vgaCRReg, 0x0c); + + /* Setup plane masks */ + OUTREG(0x8128, ~0); /* enable all write planes */ + OUTREG(0x812C, ~0); /* enable all read planes */ + OUTREG16(0x8134, 0x27); + OUTREG16(0x8136, 0x07); + + switch( psav->Chipset ) { + + case S3_SAVAGE3D: + case S3_SAVAGE_MX: + /* Disable BCI */ + OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0); + /* Disable shadow status update */ + OUTREG(0x48C0C, 0); + /* Setup BCI command overflow buffer */ + OUTREG(0x48C14, (psav->cobOffset >> 11) | (psav->cobIndex << 29)); + /* Enable BCI and command overflow buffer */ + OUTREG(0x48C18, INREG(0x48C18) | 0x0C); + break; + + case S3_SAVAGE4: + case S3_PROSAVAGE: + /* Disable BCI */ + OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0); + /* Disable shadow status update */ + OUTREG(0x48C0C, 0); + /* Enabel BCI without the COB */ + OUTREG(0x48C18, INREG(0x48C18) | 0x08); + break; + + case S3_SAVAGE2000: + /* Disable BCI */ + OUTREG(0x48C18, 0); + /* Disable shadow status update */ + OUTREG(0x48A30, 0); + /* Setup BCI command overflow buffer */ + OUTREG(0x48C18, (psav->cobOffset >> 7) | (psav->cobIndex)); + /* Enable BCI and command overflow buffer */ + OUTREG(0x48C18, INREG(0x48C18) | 0x00280000 ); + break; + } + + /* Use and set global bitmap descriptor. */ + + /* For reasons I do not fully understand yet, on the Savage4, the */ + /* write to the GBD register, MM816C, does not "take" at this time. */ + /* Only the low-order byte is acknowledged, resulting in an incorrect */ + /* stride. Writing the register later, after the mode switch, works */ + /* correctly. This needs to get resolved. */ + + psav->SavedGbd = 1 | 8 | BCI_BD_BW_DISABLE; + BCI_BD_SET_BPP(psav->SavedGbd, pScrn->bitsPerPixel); + BCI_BD_SET_STRIDE(psav->SavedGbd, pScrn->displayWidth); + + SavageSetGBD(pScrn); +} + + +void +SavageSetGBD( ScrnInfoPtr pScrn ) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + unsigned int vgaCRIndex = hwp->IOBase + 4; + unsigned int vgaCRReg = hwp->IOBase + 5; + + if( !psav->SavedGbd ) + { + psav->SavedGbd = 1 | 8 | BCI_BD_BW_DISABLE; + BCI_BD_SET_BPP(psav->SavedGbd, pScrn->bitsPerPixel); + BCI_BD_SET_STRIDE(psav->SavedGbd, pScrn->displayWidth); + } + + /* Turn on 16-bit register access. */ + + VGAOUT8(vgaCRIndex, 0x31); + VGAOUT8(vgaCRReg, 0x0c); + + /* Set stride to use GBD. */ + + VGAOUT8(vgaCRIndex, 0x50); + VGAOUT8(vgaCRReg, inb(vgaCRReg) | 0xC1); + + /* Enable 2D engine. */ + + VGAOUT16(vgaCRIndex, 0x0140); + + /* Now set the GBD and SBDs. */ + + OUTREG(0x8168,0); + OUTREG(0x816C,psav->SavedGbd); + OUTREG(0x8170,0); + OUTREG(0x8174,psav->SavedGbd); + OUTREG(0x8178,0); + OUTREG(0x817C,psav->SavedGbd); + + OUTREG(0x81C8, pScrn->displayWidth << 4); + OUTREG(0x81D8, pScrn->displayWidth << 4); +} + + +/* Acceleration init function, sets up pointers to our accelerated functions */ + +Bool +SavageInitAccel(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SavagePtr psav = SAVPTR(pScrn); + XAAInfoRecPtr xaaptr; + BoxRec AvailFBArea; + + /* Set-up our GE command primitive */ + + if (pScrn->bitsPerPixel == 8) { + psav->PlaneMask = 0xFF; + } + else if (pScrn->bitsPerPixel == 16) { + psav->PlaneMask = 0xFFFF; + } + else if (pScrn->bitsPerPixel == 24) { + psav->PlaneMask = 0xFFFFFF; + } + else if (pScrn->bitsPerPixel == 32) { + psav->PlaneMask = 0xFFFFFFFF; + } + + /* General acceleration flags */ + + if (!(xaaptr = psav->AccelInfoRec = XAACreateInfoRec())) + return FALSE; + + xaaptr->Flags = 0 + | PIXMAP_CACHE + | OFFSCREEN_PIXMAPS + | LINEAR_FRAMEBUFFER + ; + + /* Clipping */ + + xaaptr->SetClippingRectangle = SavageSetClippingRectangle; + xaaptr->DisableClipping = SavageDisableClipping; + xaaptr->ClippingFlags = 0 + | HARDWARE_CLIP_SOLID_FILL + | HARDWARE_CLIP_SOLID_LINE + | HARDWARE_CLIP_DASHED_LINE + | HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY + | HARDWARE_CLIP_MONO_8x8_FILL + | HARDWARE_CLIP_COLOR_8x8_FILL + ; + + xaaptr->Sync = SavageAccelSync; + + + /* ScreenToScreen copies */ + +#if 1 + xaaptr->SetupForScreenToScreenCopy = SavageSetupForScreenToScreenCopy; + xaaptr->SubsequentScreenToScreenCopy = SavageSubsequentScreenToScreenCopy; + xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; +#endif + + + /* Solid filled rectangles */ + +#if 1 + xaaptr->SetupForSolidFill = SavageSetupForSolidFill; + xaaptr->SubsequentSolidFillRect = SavageSubsequentSolidFillRect; + xaaptr->SolidFillFlags = NO_PLANEMASK; +#endif + + /* Mono 8x8 pattern fills */ + +#if 1 + xaaptr->SetupForMono8x8PatternFill = SavageSetupForMono8x8PatternFill; + xaaptr->SubsequentMono8x8PatternFillRect + = SavageSubsequentMono8x8PatternFillRect; + xaaptr->Mono8x8PatternFillFlags = 0 + | HARDWARE_PATTERN_PROGRAMMED_BITS + | HARDWARE_PATTERN_SCREEN_ORIGIN + | BIT_ORDER_IN_BYTE_LSBFIRST + ; +#endif + + /* Color 8x8 pattern fills */ + +#if 1 + xaaptr->SetupForColor8x8PatternFill = + SavageSetupForColor8x8PatternFill; + xaaptr->SubsequentColor8x8PatternFillRect = + SavageSubsequentColor8x8PatternFillRect; + xaaptr->Color8x8PatternFillFlags = 0 + | NO_TRANSPARENCY + | HARDWARE_PATTERN_PROGRAMMED_BITS + | HARDWARE_PATTERN_PROGRAMMED_ORIGIN + ; +#endif + + /* Solid lines */ + +#if 1 + xaaptr->SolidLineFlags = NO_PLANEMASK; + xaaptr->SetupForSolidLine = SavageSetupForSolidFill; + xaaptr->SubsequentSolidBresenhamLine = SavageSubsequentSolidBresenhamLine; + xaaptr->SubsequentSolidTwoPointLine = SavageSubsequentSolidTwoPointLine; +#if 0 + xaaptr->SubsequentSolidFillTrap = SavageSubsequentSolidFillTrap; +#endif + + xaaptr->SolidBresenhamLineErrorTermBits = 16; +#endif + + /* ImageWrite */ + + xaaptr->ImageWriteFlags = 0 + | NO_PLANEMASK + | CPU_TRANSFER_PAD_DWORD + | SCANLINE_PAD_DWORD + | BIT_ORDER_IN_BYTE_MSBFIRST + | LEFT_EDGE_CLIPPING + ; + xaaptr->SetupForImageWrite = SavageSetupForImageWrite; + xaaptr->SubsequentImageWriteRect = SavageSubsequentImageWriteRect; + xaaptr->NumScanlineImageWriteBuffers = 1; + xaaptr->ImageWriteBase = psav->BciMem; + xaaptr->ImageWriteRange = 120 * 1024; + + /* WriteBitmap color expand */ + +#if 0 + xaaptr->WriteBitmapFlags = NO_PLANEMASK; + xaaptr->WriteBitmap = SavageWriteBitmapCPUToScreenColorExpand; +#endif + + /* Screen to Screen color expansion. Not implemented. */ + +#if 0 + xaaptr->SetupForScreenToScreenColorExpand = + SavageSetupForScreenToScreenColorExpand; + xaaptr->SubsequentScreenToScreenColorExpand = + SavageSubsequentCPUToScreenColorExpand; +#endif + + /* CPU to Screen color expansion */ + + xaaptr->ScanlineCPUToScreenColorExpandFillFlags = 0 + | NO_PLANEMASK + | CPU_TRANSFER_PAD_DWORD + | SCANLINE_PAD_DWORD + | BIT_ORDER_IN_BYTE_MSBFIRST + | LEFT_EDGE_CLIPPING + ; + xaaptr->SetupForScanlineCPUToScreenColorExpandFill = + SavageSetupForCPUToScreenColorExpandFill; + xaaptr->SubsequentScanlineCPUToScreenColorExpandFill = + SavageSubsequentScanlineCPUToScreenColorExpandFill; + xaaptr->SubsequentColorExpandScanline = + SavageSubsequentColorExpandScanline; + xaaptr->ColorExpandBase = psav->BciMem; + xaaptr->ScanlineColorExpandBuffers = &xaaptr->ColorExpandBase; + xaaptr->NumScanlineColorExpandBuffers = 1; + + /* Set up screen parameters. */ + + psav->Bpp = pScrn->bitsPerPixel / 8; + psav->Bpl = pScrn->displayWidth * psav->Bpp; + psav->ScissB = psav->CursorKByte / psav->Bpl; + if (psav->ScissB > 2047) + psav->ScissB = 2047; + + /* + * Finally, we set up the video memory space available to the pixmap + * cache. In this case, all memory from the end of the virtual screen + * to the end of the command overflow buffer can be used. If you haven't + * enabled the PIXMAP_CACHE flag, then these lines can be omitted. + */ + + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = psav->ScissB; + xf86InitFBManager(pScreen, &AvailFBArea); + + return XAAInit(pScreen, xaaptr); +} + + + + +/* The sync function for the GE */ +void +SavageAccelSync(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + WaitIdleEmpty(); +} + + +/* + * The XAA ROP helper routines all assume that a solid color is a + * "pattern". The Savage chips, however, apply a non-stippled solid + * color as "source". Thus, we use a slightly customized version. + */ + +static int +SavageHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop) +{ + XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); + int ret = 0; + + pm &= infoRec->FullPlanemask; + + if(pm == infoRec->FullPlanemask) { + if(!NO_SRC_ROP(*rop)) + ret |= ROP_PAT; + *rop = XAACopyROP[*rop]; + } else { + switch(*rop) { + case GXnoop: + break; + case GXset: + case GXclear: + case GXinvert: + ret |= ROP_PAT; + *fg = pm; + if(*bg != -1) + *bg = pm; + break; + default: + ret |= ROP_PAT | ROP_SRC; + break; + } + *rop = XAACopyROP_PM[*rop]; + } + + return ret; +} + + +static int +SavageHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop) +{ + XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); + int ret = 0; + + pm &= infoRec->FullPlanemask; + + if(pm == infoRec->FullPlanemask) { + if(!NO_SRC_ROP(*rop)) + ret |= ROP_PAT; + *rop = XAACopyROP[*rop]; + } else { + switch(*rop) { + case GXnoop: + break; + case GXset: + case GXclear: + case GXinvert: + ret |= ROP_PAT; + *fg = pm; + break; + default: + ret |= ROP_PAT | ROP_SRC; + break; + } + *rop = XAACopyROP_PM[*rop]; + } + + return ret; +} + + + +/* These are the ScreenToScreen bitblt functions. We support all ROPs, all + * directions, and a planemask by adjusting the ROP and using the mono pattern + * registers. + * + * (That's a lie; we don't really support planemask.) + */ + +static void +SavageSetupForScreenToScreenCopy( + ScrnInfoPtr pScrn, + int xdir, + int ydir, + int rop, + unsigned planemask, + int transparency_color) +{ + SavagePtr psav = SAVPTR(pScrn); + int cmd; + + cmd = BCI_CMD_RECT | BCI_CMD_DEST_GBD | BCI_CMD_SRC_GBD; + BCI_CMD_SET_ROP( cmd, XAACopyROP[rop] ); + if (transparency_color != -1) + cmd |= BCI_CMD_SEND_COLOR | BCI_CMD_SRC_TRANSPARENT; + + if (xdir == 1 ) cmd |= BCI_CMD_RECT_XP; + if (ydir == 1 ) cmd |= BCI_CMD_RECT_YP; + + psav->SavedBciCmd = cmd; + psav->SavedBgColor = transparency_color; +} + +static void +SavageSubsequentScreenToScreenCopy( + ScrnInfoPtr pScrn, + int x1, + int y1, + int x2, + int y2, + int w, + int h) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + + if (!w || !h) return; + if (!(psav->SavedBciCmd & BCI_CMD_RECT_XP)) { + w --; + x1 += w; + x2 += w; + w ++; + } + if (!(psav->SavedBciCmd & BCI_CMD_RECT_YP)) { + h --; + y1 += h; + y2 += h; + h ++; + } + + WaitQueue(6); + BCI_SEND(psav->SavedBciCmd); + if (psav->SavedBgColor != -1) + BCI_SEND(psav->SavedBgColor); + BCI_SEND(BCI_X_Y(x1, y1)); + BCI_SEND(BCI_X_Y(x2, y2)); + BCI_SEND(BCI_W_H(w, h)); +} + + +/* + * SetupForSolidFill is also called to set up for lines. + */ + +static void +SavageSetupForSolidFill( + ScrnInfoPtr pScrn, + int color, + int rop, + unsigned planemask) +{ + SavagePtr psav = SAVPTR(pScrn); + XAAInfoRecPtr xaaptr = GET_XAAINFORECPTR_FROM_SCRNINFOPTR( pScrn ); + int cmd; + int mix; + + cmd = BCI_CMD_RECT + | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID; + + /* Don't send a color if we don't have to. */ + + if( rop == GXcopy ) + { + if( color == 0 ) + rop = GXclear; + else if( color == xaaptr->FullPlanemask ) + rop = GXset; + } + + mix = SavageHelpSolidROP( pScrn, &color, planemask, &rop ); + + if( mix & ROP_PAT ) + cmd |= BCI_CMD_SEND_COLOR; + + BCI_CMD_SET_ROP( cmd, rop ); + + psav->SavedBciCmd = cmd; + psav->SavedFgColor = color; +} + + +static void +SavageSubsequentSolidFillRect( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + + WaitQueue(5); + + BCI_SEND(psav->SavedBciCmd); + if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) + BCI_SEND(psav->SavedFgColor); + BCI_SEND(BCI_X_Y(x, y)); + BCI_SEND(BCI_W_H(w, h)); +} + +#if 0 +static void +SavageSetupForScreenToScreenColorExpand( + ScrnInfoPtr pScrn, + int bg, + int fg, + int rop, + unsigned planemask) +{ +/* SavagePtr psav = SAVPTR(pScrn); */ +} + +static void +SavageSubsequentScreenToScreenColorExpand( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft) +{ +/* SavagePtr psav = SAVPTR(pScrn); */ +} +#endif + + +static void +SavageSetupForCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, + int bg, + int rop, + unsigned planemask) +{ + SavagePtr psav = SAVPTR(pScrn); + int cmd; + int mix; + + cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_CLIP_LR + | BCI_CMD_DEST_GBD | BCI_CMD_SRC_MONO; + + mix = SavageHelpPatternROP( pScrn, &fg, &bg, planemask, &rop ); + + if( mix & ROP_PAT ) + cmd |= BCI_CMD_SEND_COLOR; + + BCI_CMD_SET_ROP( cmd, rop ); + + if (bg != -1) + cmd |= BCI_CMD_SEND_COLOR; + else + cmd |= BCI_CMD_SRC_TRANSPARENT; + + psav->SavedBciCmd = cmd; + psav->SavedFgColor = fg; + psav->SavedBgColor = bg; +} + + +static void +SavageSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + + /* XAA will be sending bitmap data next. */ + /* We should probably wait for empty/idle here. */ + + WaitQueue(20); + + BCI_SEND(psav->SavedBciCmd); + BCI_SEND(BCI_CLIP_LR(x+skipleft, x+w-1)); + w = (w + 31) & ~31; + if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) + BCI_SEND(psav->SavedFgColor); + if( psav->SavedBgColor != -1 ) + BCI_SEND(psav->SavedBgColor); + BCI_SEND(BCI_X_Y(x, y)); + BCI_SEND(BCI_W_H(w, 1)); + + psav->Rect.x = x; + psav->Rect.y = y + 1; + psav->Rect.width = w; + psav->Rect.height = h - 1; +} + +static void +SavageSubsequentColorExpandScanline( + ScrnInfoPtr pScrn, + int buffer_no) +{ + /* This gets call after each scanline's image data has been sent. */ + SavagePtr psav = SAVPTR(pScrn); + xRectangle xr = psav->Rect; + BCI_GET_PTR; + + if( xr.height ) + { + WaitQueue(20); + BCI_SEND(BCI_X_Y( xr.x, xr.y)); + BCI_SEND(BCI_W_H( xr.width, 1 )); + psav->Rect.height--; + psav->Rect.y++; + } +} + + +/* + * The meaning of the two pattern paremeters to Setup & Subsequent for + * Mono8x8Patterns varies depending on the flag bits. We specify + * HW_PROGRAMMED_BITS, which means our hardware can handle 8x8 patterns + * without caching in the frame buffer. Thus, Setup gets the pattern bits. + * There is no way with BCI to rotate an 8x8 pattern, so we do NOT specify + * HW_PROGRAMMED_ORIGIN. XAA wil rotate it for us and pass the rotated + * pattern to both Setup and Subsequent. If we DID specify PROGRAMMED_ORIGIN, + * then Setup would get the unrotated pattern, and Subsequent gets the + * origin values. + */ + +static void +SavageSetupForMono8x8PatternFill( + ScrnInfoPtr pScrn, + int patternx, + int patterny, + int fg, + int bg, + int rop, + unsigned planemask) +{ + SavagePtr psav = SAVPTR(pScrn); + int cmd; + int mix; + + mix = XAAHelpPatternROP( pScrn, &fg, &bg, planemask, &rop ); + + cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_DEST_GBD | BCI_CMD_PAT_MONO; + + if( mix & ROP_PAT ) + cmd |= BCI_CMD_SEND_COLOR; + + if (bg == -1) + cmd |= BCI_CMD_PAT_TRANSPARENT; + + BCI_CMD_SET_ROP(cmd, rop); + + psav->SavedBciCmd = cmd; + psav->SavedFgColor = fg; + psav->SavedBgColor = bg; +} + + +static void +SavageSubsequentMono8x8PatternFillRect( + ScrnInfoPtr pScrn, + int pattern0, + int pattern1, + int x, + int y, + int w, + int h) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + + WaitQueue(7); + BCI_SEND(psav->SavedBciCmd); + if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) + BCI_SEND(psav->SavedFgColor); + if( psav->SavedBgColor != -1 ) + BCI_SEND(psav->SavedBgColor); + BCI_SEND(BCI_X_Y(x, y)); + BCI_SEND(BCI_W_H(w, h)); + BCI_SEND(pattern0); + BCI_SEND(pattern1); +} + + +static void +SavageSetupForColor8x8PatternFill( + ScrnInfoPtr pScrn, + int patternx, + int patterny, + int rop, + unsigned planemask, + int trans_col) +{ + SavagePtr psav = SAVPTR(pScrn); + + int cmd; + int mix; + unsigned int bd; + int pat_offset; + + /* ViRGEs and Savages do not support transparent color patterns. */ + /* We set the NO_TRANSPARENCY bit, so we should never receive one. */ + + pat_offset = (int) (patternx * psav->Bpp + patterny * psav->Bpl); + + cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_DEST_GBD | BCI_CMD_PAT_SBD_COLOR_NEW; + + mix = SavageHelpSolidROP( pScrn, &trans_col, planemask, &rop ); + + BCI_CMD_SET_ROP(cmd, rop); + bd = BCI_BD_BW_DISABLE; + BCI_BD_SET_BPP(bd, pScrn->bitsPerPixel); + BCI_BD_SET_STRIDE(bd, 8); + + psav->SavedBciCmd = cmd; + psav->SavedSbdOffset = pat_offset; + psav->SavedSbd = bd; + psav->SavedBgColor = trans_col; +} + + +static void +SavageSubsequentColor8x8PatternFillRect( + ScrnInfoPtr pScrn, + int patternx, + int patterny, + int x, + int y, + int w, + int h) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + + WaitQueue(5); + BCI_SEND(psav->SavedBciCmd); + BCI_SEND(psav->SavedSbdOffset); + BCI_SEND(psav->SavedSbd); + BCI_SEND(BCI_X_Y(x, y)); + BCI_SEND(BCI_W_H(w, h)); +} + + +static void +SavageSubsequentSolidBresenhamLine( + ScrnInfoPtr pScrn, + int x1, + int y1, + int e1, + int e2, + int err, + int length, + int octant) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + int cmd; + + cmd = (psav->SavedBciCmd & 0x00ffffff); + cmd |= BCI_CMD_LINE_LAST_PIXEL; + +#ifdef DEBUG_EXTRA + ErrorF("BresenhamLine, (%4d,%4d), len %4d, oct %d, err %4d,%4d, clr %08x\n", + x1, y1, length, octant, e2, e1, psav->SavedFgColor ); +#endif + + WaitQueue( 5 ); + BCI_SEND(cmd); + if( cmd & BCI_CMD_SEND_COLOR ) + BCI_SEND( psav->SavedFgColor ); + BCI_SEND(BCI_LINE_X_Y(x1, y1)); + BCI_SEND(BCI_LINE_STEPS(e2-e1, e2)); + BCI_SEND(BCI_LINE_MISC(length, + !!(octant & YMAJOR), + !(octant & XDECREASING), + !(octant & YDECREASING), + e2+err)); +} + + +static void +SavageSubsequentSolidTwoPointLine( + ScrnInfoPtr pScrn, + int x1, + int y1, + int x2, + int y2, + int bias) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + + int cmd; + int dx, dy; + int min, max, xp, yp, ym; + + dx = x2 - x1; + dy = y2 - y1; + +#ifdef DEBUG_EXTRA + ErrorF("TwoPointLine, (%4d,%4d)-(%4d,%4d), clr %08x, last pt %s\n", + x1, y1, x2, y2, psav->SavedFgColor, (bias & 0x100)?"NO ":"YES"); +#endif + + xp = (dx >= 0); + if( !xp ) { + dx = -dx; + } + + yp = (dy >= 0); + if( !yp ) { + dy = -dy; + } + + ym = (dy > dx); + if( ym ) { + max = dy; + min = dx; + } + else { + max = dx; + min = dy; + } + + if( !(bias & 0x100) ) { + max++; + } + + cmd = (psav->SavedBciCmd & 0x00ffffff); + cmd |= BCI_CMD_LINE_LAST_PIXEL; + + WaitQueue(5); + BCI_SEND( cmd ); + if( cmd & BCI_CMD_SEND_COLOR ) + BCI_SEND( psav->SavedFgColor ); + BCI_SEND( BCI_LINE_X_Y( x1, y1 ) ); + BCI_SEND( BCI_LINE_STEPS( 2 * (min - max), 2 * min ) ); + BCI_SEND( BCI_LINE_MISC( max, ym, xp, yp, 2 * min - max ) ); +} + + + +static void +SavageSetClippingRectangle( + ScrnInfoPtr pScrn, + int x1, + int y1, + int x2, + int y2) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + int cmd; + +#ifdef DEBUG_EXTRA + ErrorF("ClipRect, (%4d,%4d)-(%4d,%4d) \n", x1, y1, x2, y2 ); +#endif + + cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; + WaitQueue(3); + BCI_SEND(cmd); + BCI_SEND(BCI_CLIP_TL(y1, x1)); + BCI_SEND(BCI_CLIP_BR(y2, x2)); + psav->SavedBciCmd |= BCI_CMD_CLIP_CURRENT; +} + + +static void SavageDisableClipping( ScrnInfoPtr pScrn ) +{ + SavagePtr psav = SAVPTR(pScrn); +#ifdef DEBUG_EXTRA + ErrorF("Kill ClipRect\n"); +#endif + psav->SavedBciCmd &= ~BCI_CMD_CLIP_NEW; +} + + +/* Trapezoid solid fills. XAA passes the coordinates of the top start + * and end points, and the slopes of the left and right vertexes. We + * use this info to generate the bottom points. We use a mixture of + * floating-point and fixed point logic; the biases are done in fixed + * point. Essentially, these were determined experimentally. The function + * passes xtest, but I suspect that it will not match cfb for large polygons. + * + * This code is from the ViRGE. We need to modify it for Savage if we ever + * decide to turn it on. + */ + +#if 0 +void +SavageSubsequentSolidFillTrap( + ScrnInfoPtr pScrn, + int y, + int h, + int left, + int dxl, + int dyl, + int el, + int right, + int dxr, + int dyr, + int er) +{ + int l_xdelta, r_xdelta; + double lendx, rendx, dl_delta, dr_delta; + int lbias, rbias; + unsigned int cmd; + double l_sgn = -1.0, r_sgn = -1.0; + + cmd |= (CMD_POLYFILL | CMD_AUTOEXEC | MIX_MONO_PATT) ; + cmd |= (psav->SavedRectCmdForLine & (0xff << 17)); + + l_xdelta = -(dxl << 20)/ dyl; + r_xdelta = -(dxr << 20)/ dyr; + + dl_delta = -(double) dxl / (double) dyl; + dr_delta = -(double) dxr / (double) dyr; + if (dl_delta < 0.0) l_sgn = 1.0; + if (dr_delta < 0.0) r_sgn = 1.0; + + lendx = l_sgn * ((double) el / (double) dyl) + left + ((h - 1) * dxl) / (double) dyl; + rendx = r_sgn * ((double) er / (double) dyr) + right + ((h - 1) * dxr) / (double) dyr; + + /* We now have four cases */ + + if (fabs(dl_delta) > 1.0) { /* XMAJOR line */ + if (dxl > 0) { lbias = ((1 << 20) - h); } + else { lbias = 0; } + } + else { + if (dxl > 0) { lbias = ((1 << 20) - 1) + l_xdelta / 2; } + else { lbias = 0; } + } + + if (fabs(dr_delta) > 1.0) { /* XMAJOR line */ + if (dxr > 0) { rbias = (1 << 20); } + else { rbias = ((1 << 20) - 1); } + } + else { + if (dxr > 0) { rbias = (1 << 20); } + else { rbias = ((1 << 20) - 1); } + } + + WaitQueue(8); + CACHE_SETP_CMD_SET(cmd); + SETP_PRDX(r_xdelta); + SETP_PLDX(l_xdelta); + SETP_PRXSTART(((int) (rendx * (double) (1 << 20))) + rbias); + SETP_PLXSTART(((int) (lendx * (double) (1 << 20))) + lbias); + + SETP_PYSTART(y + h - 1); + SETP_PYCNT((h) | 0x30000000); + + CACHE_SETB_CMD_SET(psav->SavedRectCmdForLine); + +} +#endif + +/* Routines for debugging. */ + +unsigned long +writedw( unsigned long addr, unsigned long value ) +{ + SavagePtr psav = SAVPTR(gpScrn); + OUTREG( addr, value ); + return INREG( addr ); +} + +unsigned long +readdw( unsigned long addr ) +{ + SavagePtr psav = SAVPTR(gpScrn); + return INREG( addr ); +} + +unsigned long +readfb( unsigned long addr ) +{ + SavagePtr psav = SAVPTR(gpScrn); + char * videobuffer = (char *) psav->FBBase; + return *(volatile unsigned long*)(videobuffer + (addr & ~3) ); +} + +unsigned long +writefb( unsigned long addr, unsigned long value ) +{ + SavagePtr psav = SAVPTR(gpScrn); + char * videobuffer = (char *) psav->FBBase; + *(unsigned long*)(videobuffer + (addr & ~3)) = value; + return *(volatile unsigned long*)(videobuffer + (addr & ~3) ); +} + +void +writescan( unsigned long scan, unsigned long color ) +{ + SavagePtr psav = SAVPTR(gpScrn); + int i; + char * videobuffer = (char *)psav->FBBase; + videobuffer += scan * gpScrn->displayWidth * gpScrn->bitsPerPixel >> 3; + for( i = gpScrn->displayWidth; --i; ) { + switch( gpScrn->bitsPerPixel ) { + case 8: + *videobuffer++ = color; + break; + case 16: + *(unsigned short*)videobuffer = color; + videobuffer += 2; + break; + case 32: + *(unsigned long*)videobuffer = color; + videobuffer += 4; + break; + } + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h new file mode 100644 index 000000000..e5093677e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h @@ -0,0 +1,95 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.1 2000/12/02 01:16:11 dawes Exp $ */ + +#ifndef _S3BCI_H_ +#define _S3BCI_H_ + +#define REVERSE_BYTE_ORDER32(dword) {\ + unsigned int temp; \ + dword = (temp & 0xFF) << 24; \ + dword |= (temp & 0xFF00) << 8; \ + dword |= (temp & 0xFF0000) >> 8; \ + dword |= (temp & 0xFF000000) >> 24; } + +#define BCI_GET_PTR volatile unsigned int * bci_ptr = (unsigned int *) psav->BciMem +#define BCI_RESET bci_ptr = (unsigned int *) psav->BciMem + +#define BCI_SEND(dw) (*bci_ptr++ = (unsigned int)(dw)) + +#define BCI_CMD_NOP 0x40000000 +#define BCI_CMD_RECT 0x48000000 +#define BCI_CMD_RECT_XP 0x01000000 +#define BCI_CMD_RECT_YP 0x02000000 +#define BCI_CMD_SCANLINE 0x50000000 +#define BCI_CMD_LINE 0x5C000000 +#define BCI_CMD_LINE_LAST_PIXEL 0x58000000 +#define BCI_CMD_BYTE_TEXT 0x63000000 +#define BCI_CMD_NT_BYTE_TEXT 0x67000000 +#define BCI_CMD_BIT_TEXT 0x6C000000 +#define BCI_CMD_GET_ROP(cmd) (((cmd) >> 16) & 0xFF) +#define BCI_CMD_SET_ROP(cmd, rop) ((cmd) |= ((rop & 0xFF) << 16)) +#define BCI_CMD_SEND_COLOR 0x00008000 + +#define BCI_CMD_CLIP_NONE 0x00000000 +#define BCI_CMD_CLIP_CURRENT 0x00002000 +#define BCI_CMD_CLIP_LR 0x00004000 +#define BCI_CMD_CLIP_NEW 0x00006000 + +#define BCI_CMD_DEST_GBD 0x00000000 +#define BCI_CMD_DEST_PBD 0x00000800 +#define BCI_CMD_DEST_PBD_NEW 0x00000C00 +#define BCI_CMD_DEST_SBD 0x00001000 +#define BCI_CMD_DEST_SBD_NEW 0x00001400 + +#define BCI_CMD_SRC_TRANSPARENT 0x00000200 +#define BCI_CMD_SRC_SOLID 0x00000000 +#define BCI_CMD_SRC_GBD 0x00000020 +#define BCI_CMD_SRC_COLOR 0x00000040 +#define BCI_CMD_SRC_MONO 0x00000060 +#define BCI_CMD_SRC_PBD_COLOR 0x00000080 +#define BCI_CMD_SRC_PBD_MONO 0x000000A0 +#define BCI_CMD_SRC_PBD_COLOR_NEW 0x000000C0 +#define BCI_CMD_SRC_PBD_MONO_NEW 0x000000E0 +#define BCI_CMD_SRC_SBD_COLOR 0x00000100 +#define BCI_CMD_SRC_SBD_MONO 0x00000120 +#define BCI_CMD_SRC_SBD_COLOR_NEW 0x00000140 +#define BCI_CMD_SRC_SBD_MONO_NEW 0x00000160 + +#define BCI_CMD_PAT_TRANSPARENT 0x00000010 +#define BCI_CMD_PAT_NONE 0x00000000 +#define BCI_CMD_PAT_COLOR 0x00000002 +#define BCI_CMD_PAT_MONO 0x00000003 +#define BCI_CMD_PAT_PBD_COLOR 0x00000004 +#define BCI_CMD_PAT_PBD_MONO 0x00000005 +#define BCI_CMD_PAT_PBD_COLOR_NEW 0x00000006 +#define BCI_CMD_PAT_PBD_MONO_NEW 0x00000007 +#define BCI_CMD_PAT_SBD_COLOR 0x00000008 +#define BCI_CMD_PAT_SBD_MONO 0x00000009 +#define BCI_CMD_PAT_SBD_COLOR_NEW 0x0000000A +#define BCI_CMD_PAT_SBD_MONO_NEW 0x0000000B + +#define BCI_BD_BW_DISABLE 0x10000000 +#define BCI_BD_TILE_MASK 0x03000000 +#define BCI_BD_TILE_NONE 0x00000000 +#define BCI_BD_TILE_16 0x02000000 +#define BCI_BD_TILE_32 0x04000000 +#define BCI_BD_GET_BPP(bd) (((bd) >> 16) & 0xFF) +#define BCI_BD_SET_BPP(bd, bpp) ((bd) |= (((bpp) & 0xFF) << 16)) +#define BCI_BD_GET_STRIDE(bd) ((bd) & 0xFFFF) +#define BCI_BD_SET_STRIDE(bd, st) ((bd) |= ((st) & 0xFFFF)) + +#define BCI_W_H(w, h) (((h) << 16) | ((w) & 0xFFF)) +#define BCI_X_Y(x, y) (((y) << 16) | ((x) & 0xFFF)) +#define BCI_X_W(x, y) (((w) << 16) | ((x) & 0xFFF)) +#define BCI_CLIP_LR(l, r) (((r) << 16) | ((l) & 0xFFF)) +#define BCI_CLIP_TL(t, l) (((t) << 16) | ((l) & 0xFFF)) +#define BCI_CLIP_BR(b, r) (((b) << 16) | ((r) & 0xFFF)) + +#define BCI_LINE_X_Y(x, y) (((y) << 16) | ((x) & 0xFFFF)) +#define BCI_LINE_STEPS(diag, axi) (((axi) << 16) | ((diag) & 0xFFFF)) +#define BCI_LINE_MISC(maj, ym, xp, yp, err) \ +(((maj) & 0xFFF) | (((ym) & 1) << 13) | \ +(((xp) & 1) << 14) | (((yp) & 1) << 15) | \ +((err) << 16)) + + +#endif /* _S3BCI_H_ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c new file mode 100644 index 000000000..b6fb39856 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c @@ -0,0 +1,255 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.1 2000/12/02 01:16:11 dawes Exp $ */ + +/* + * Hardware cursor support for S3 Savage 4.0 driver. Taken with + * very few changes from the s3virge cursor file. + * + * S. Marineau, 19/04/97. + * Modified by Amancio Hasty and Jon Tombs + * Ported to 4.0 by Tim Roberts. + */ + +#include "savage_driver.h" + +static void SavageLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); +static void SavageShowCursor(ScrnInfoPtr pScrn); +static void SavageHideCursor(ScrnInfoPtr pScrn); +static void SavageSetCursorPosition(ScrnInfoPtr pScrn, int x, int y); +static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); + + +/* + * Read/write to the DAC via MMIO + */ + +#define inCRReg(reg) (VGAHWPTR(pScrn))->readCrtc( VGAHWPTR(pScrn), reg ) +#define outCRReg(reg, val) (VGAHWPTR(pScrn))->writeCrtc( VGAHWPTR(pScrn), reg, val ) + + +#define MAX_CURS 64 + + +Bool +SavageHWCursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SavagePtr psav = SAVPTR(pScrn); + xf86CursorInfoPtr infoPtr; + + infoPtr = xf86CreateCursorInfoRec(); + if(!infoPtr) + return FALSE; + + psav->CursorInfoRec = infoPtr; + + infoPtr->MaxWidth = MAX_CURS; + infoPtr->MaxHeight = MAX_CURS; + infoPtr->Flags = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 | + HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_INVERT_MASK; + + /* + * The /MX family is apparently unique among the Savages, in that + * the cursor color is always straight RGB. The rest of the Savages + * use palettized values at 8-bit when not clock doubled. + */ + + if( + ( (inCRReg(0x18) & 0x80) && (inCRReg(0x15) & 0x50) ) + || + (psav->Chipset == S3_SAVAGE_MX) + ) + infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; + + infoPtr->SetCursorColors = SavageSetCursorColors; + infoPtr->SetCursorPosition = SavageSetCursorPosition; + infoPtr->LoadCursorImage = SavageLoadCursorImage; + infoPtr->HideCursor = SavageHideCursor; + infoPtr->ShowCursor = SavageShowCursor; + infoPtr->UseHWCursor = NULL; + + if( !psav->CursorKByte ) + psav->CursorKByte = pScrn->videoRam - 4; + + return xf86InitCursor(pScreen, infoPtr); +} + + + +void +SavageShowCursor(ScrnInfoPtr pScrn) +{ + /* Turn cursor on. */ + outCRReg( 0x45, inCRReg(0x45) | 0x01 ); +} + + +void +SavageHideCursor(ScrnInfoPtr pScrn) +{ + /* Turn cursor off. */ + outCRReg( 0x45, inCRReg(0x45) & 0xfe ); +} + + +static void +SavageLoadCursorImage( + ScrnInfoPtr pScrn, + unsigned char* src) +{ + SavagePtr psav = SAVPTR(pScrn); + + /* Set cursor location in frame buffer. */ + outCRReg( 0x4d, (0xff & psav->CursorKByte)); + outCRReg( 0x4c, (0xff00 & psav->CursorKByte) >> 8); + + /* Upload the cursor image to the frame buffer. */ + memcpy(psav->FBBase + psav->CursorKByte * 1024, src, 1024); + + if( S3_SAVAGE4_SERIES( psav->Chipset ) ) { + /* + * Bug in Savage4 Rev B requires us to do an MMIO read after + * loading the cursor. + */ + volatile unsigned int i = ALT_STATUS_WORD0; + } +} + + +static void +SavageSetCursorPosition( + ScrnInfoPtr pScrn, + int x, + int y) +{ + unsigned char xoff, yoff; + + /* adjust for frame buffer base address granularity */ + if (pScrn->bitsPerPixel == 8) + x += ((pScrn->frameX0) & 3); + else if (pScrn->bitsPerPixel == 16) + x += ((pScrn->frameX0) & 1); + else if (pScrn->bitsPerPixel == 32) + x += ((pScrn->frameX0+2) & 3) - 2; + + /* + * Make these even when used. There is a bug/feature on at least + * some chipsets that causes a "shadow" of the cursor in interlaced + * mode. Making this even seems to have no visible effect, so just + * do it for the generic case. + */ + + if (x < 0) { + xoff = ((-x) & 0xFE); + x = 0; + } else { + xoff = 0; + } + + if (y < 0) { + yoff = ((-y) & 0xFE); + y = 0; + } else { + yoff = 0; + } + + /* This is the recomended order to move the cursor */ + outCRReg( 0x46, (x & 0xff00)>>8 ); + outCRReg( 0x47, (x & 0xff) ); + outCRReg( 0x49, (y & 0xff) ); + outCRReg( 0x4e, xoff ); + outCRReg( 0x4f, yoff ); + outCRReg( 0x48, (y & 0xff00)>>8 ); +} + + +static void +SavageSetCursorColors( + ScrnInfoPtr pScrn, + int bg, + int fg) +{ + SavagePtr psav = SAVPTR(pScrn); + Bool bNeedExtra = FALSE; + + /* Clock doubled modes need an extra cursor stack write. */ + bNeedExtra = + (psav->CursorInfoRec->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP); + + if( psav->Chipset == S3_SAVAGE_MX ) + bNeedExtra = TRUE; + + switch (pScrn->bitsPerPixel) { + case 16: + if (pScrn->weight.green == 5) { + fg = ((fg & 0xf80000) >> 9) | + ((fg & 0xf800) >> 6) | + ((fg & 0xf8) >> 3); + bg = ((bg & 0xf80000) >> 9) | + ((bg & 0xf800) >> 6) | + ((bg & 0xf8) >> 3); + } else { + fg = ((fg & 0xf80000) >> 8) | + ((fg & 0xfc00) >> 5) | + ((fg & 0xf8) >> 3); + bg = ((bg & 0xf80000) >> 8) | + ((bg & 0xfc00) >> 5) | + ((bg & 0xf8) >> 3); + } + /* Reset the cursor color stack pointer */ + inCRReg( 0x45 ); + outCRReg( 0x4a, fg ); + outCRReg( 0x4a, fg>>8 ); + if( bNeedExtra ) + { + outCRReg( 0x4a, fg ); + outCRReg( 0x4a, fg>>8 ); + } + /* Reset the cursor color stack pointer */ + inCRReg( 0x45 ); + outCRReg( 0x4b, bg ); + outCRReg( 0x4b, bg>>8 ); + if( bNeedExtra ) + { + outCRReg( 0x4b, bg ); + outCRReg( 0x4b, bg>>8 ); + } + break; + case 8: + if( !bNeedExtra ) + { + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write foreground */ + outCRReg(0x4a, fg); + outCRReg(0x4a, fg); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write background */ + outCRReg(0x4b, bg); + outCRReg(0x4b, bg); + break; + } + /* else */ + /* FALLTHROUGH */ + case 24: + case 32: + /* Do it straight, full 24 bit color. */ + + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write low, mid, high bytes - foreground */ + outCRReg(0x4a, fg); + outCRReg(0x4a, fg >> 8); + outCRReg(0x4a, fg >> 16); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write low, mid, high bytes - background */ + outCRReg(0x4b, bg); + outCRReg(0x4b, bg >> 8); + outCRReg(0x4b, bg >> 16); + break; + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c new file mode 100644 index 000000000..25e9ee027 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c @@ -0,0 +1,2683 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.3 2000/12/04 18:49:59 dawes Exp $ */ +/* + * vim: sw=4 ts=8 ai ic: + * + * XFree86 4.0 S3 Savage driver + * + * Tim Roberts <timr@probo.com> + * Ani Joshi <ajoshi@unixbox.com> + * + * TODO: add credits for the 3.3.x authors... + * + */ + + +#include "xf86RAC.h" +#include "shadowfb.h" + +#include "savage_driver.h" +#include "savage_bci.h" + + + + +/* + * prototypes + */ +static void SavageEnableMMIO(ScrnInfoPtr pScrn); +static void SavageDisableMMIO(ScrnInfoPtr pScrn); + +static OptionInfoPtr SavageAvailableOptions(int chipid, int busid); +static void SavageIdentify(int flags); +static Bool SavageProbe(DriverPtr drv, int flags); +static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags); + +static Bool SavageEnterVT(int scrnIndex, int flags); +static void SavageLeaveVT(int scrnIndex, int flags); +static void SavageSave(ScrnInfoPtr pScrn); +static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr, SavageRegPtr); + +static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, + char **argv); +static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen); +static ModeStatus SavageValidMode(int index, DisplayModePtr mode, + Bool verbose, int flags); + +static Bool SavageMapMem(ScrnInfoPtr pScrn); +static void SavageUnmapMem(ScrnInfoPtr pScrn); +static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool SavageSaveScreen(ScreenPtr pScreen, int mode); +static void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, + VisualPtr pVisual); +static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, + int min_n2, int max_n2, long freq_min, + long freq_max, unsigned int *mdiv, + unsigned int *ndiv, unsigned int *r); +void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file); +void SavagePrintRegs(ScrnInfoPtr pScrn); + +static int pix24bpp = 0; + +#define iabs(a) ((int)(a)>0?(a):(-(a))) + +#define DRIVER_NAME "savage" +#define DRIVER_VERSION "1.1.0" +#define VERSION_MAJOR 1 +#define VERSION_MINOR 1 +#define PATCHLEVEL 0 +#define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ + (VERSION_MINOR << 16) | \ + PATCHLEVEL) + + +DriverRec SAVAGE = +{ + SAVAGE_VERSION, + DRIVER_NAME, + SavageIdentify, + SavageProbe, + SavageAvailableOptions, + NULL, + 0 +}; + + +/* Supported chipsets */ + +static SymTabRec SavageChips[] = { + { PCI_CHIP_SAVAGE4, "Savage4" }, + { PCI_CHIP_SAVAGE3D, "Savage3D" }, + { PCI_CHIP_SAVAGE3D_MV, "Savage3D-MV" }, + { PCI_CHIP_SAVAGE2000, "Savage2000" }, + { PCI_CHIP_SAVAGE_MX_MV, "Savage/MX-MV" }, + { PCI_CHIP_SAVAGE_MX, "Savage/MX" }, + { PCI_CHIP_SAVAGE_IX_MV, "Savage/IX-MV" }, + { PCI_CHIP_SAVAGE_IX, "Savage/IX" }, + { PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133" }, + { PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133" }, + { -1, NULL } +}; + +static SymTabRec SavageChipsets[] = { + { S3_SAVAGE3D, "Savage3D" }, + { S3_SAVAGE4, "Savage4" }, + { S3_SAVAGE2000, "Savage2000" }, + { S3_SAVAGE_MX, "Savage/MX or /IX" }, + { S3_PROSAVAGE, "ProSavage PM133" }, + { -1, NULL } +}; + +/* This table maps a PCI device ID to a chipset family identifier. */ + +static PciChipsets SavagePciChipsets[] = { + { S3_SAVAGE3D, PCI_CHIP_SAVAGE3D, RES_SHARED_VGA }, + { S3_SAVAGE3D, PCI_CHIP_SAVAGE3D_MV, RES_SHARED_VGA }, + { S3_SAVAGE4, PCI_CHIP_SAVAGE4, RES_SHARED_VGA }, + { S3_SAVAGE2000, PCI_CHIP_SAVAGE2000, RES_SHARED_VGA }, + { S3_SAVAGE_MX, PCI_CHIP_SAVAGE_MX_MV, RES_SHARED_VGA }, + { S3_SAVAGE_MX, PCI_CHIP_SAVAGE_MX, RES_SHARED_VGA }, + { S3_SAVAGE_MX, PCI_CHIP_SAVAGE_IX_MV, RES_SHARED_VGA }, + { S3_SAVAGE_MX, PCI_CHIP_SAVAGE_IX, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_PM, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_KM, RES_SHARED_VGA }, + { -1, -1, RES_UNDEFINED } +}; + +typedef enum { + OPTION_SLOW_EDODRAM, + OPTION_SLOW_DRAM, + OPTION_FAST_DRAM, + OPTION_FPM_VRAM, + OPTION_PCI_BURST, + OPTION_FIFO_CONSERV, + OPTION_FIFO_MODERATE, + OPTION_FIFO_AGGRESSIVE, + OPTION_PCI_RETRY, + OPTION_NOACCEL, + OPTION_EARLY_RAS_PRECHARGE, + OPTION_LATE_RAS_PRECHARGE, + OPTION_LCD_CENTER, + OPTION_LCDCLOCK, + OPTION_MCLK, + OPTION_REFCLK, + OPTION_SHOWCACHE, + OPTION_SWCURSOR, + OPTION_HWCURSOR, + OPTION_SHADOW_FB, + OPTION_ROTATE, + OPTION_USEBIOS +} SavageOpts; + + +static OptionInfoRec SavageOptions[] = +{ + { OPTION_SLOW_EDODRAM, "slow_edodram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SLOW_DRAM, "slow_dram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FAST_DRAM, "fast_dram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FPM_VRAM, "fpm_vram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, + /* finish later... */ + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + + +static const char *vgaHWSymbols[] = { + "vgaHWGetHWRec", + "vgaHWSetMmioFuncs", + "vgaHWGetIOBase", + "vgaHWSave", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWMapMem", + "vgaHWUnmapMem", + "vgaHWInit", + "vgaHWSaveScreen", + "vgaHWLock", +#if 0 + "vgaHWUnlock", + "vgaHWFreeHWRec", +#endif + NULL +}; + +static const char *ramdacSymbols[] = { + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL +}; + +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + +static const char *ddcSymbols[] = { + "xf86InterpretEDID", + NULL +}; + +static const char *xaaSymbols[] = { + "XAACopyROP", + "XAACopyROP_PM", + "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAHelpPatternROP", + "XAAHelpSolidROP", + "XAAInit", + "XAAScreenIndex", + NULL +}; + +static const char *shadowSymbols[] = { + "ShadowFBInit", + NULL +}; + +static const char *int10Symbols[] = { + "xf86ExecX86int10", + "xf86FreeInt10", + "xf86InitInt10", + "xf86Int10AllocPages", + "xf86Int10FreePages", + NULL +}; + +static const char *cfbSymbols[] = { + "cfbScreenInit", + "cfb16ScreenInit", + "cfb24ScreenInit", + "cfb24_32ScreenInit", + "cfb32ScreenInit", + "cfb16BresS", + "cfb24BresS", + NULL +}; + +#ifdef XFree86LOADER + +static MODULESETUPPROTO(SavageSetup); + +static XF86ModuleVersionInfo SavageVersRec = { + "savage", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +XF86ModuleData savageModuleData = { &SavageVersRec, SavageSetup, NULL }; + +static pointer SavageSetup(pointer module, pointer opts, int *errmaj, + int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&SAVAGE, module, 0); + LoaderRefSymLists(vgaHWSymbols, cfbSymbols, ramdacSymbols, + xaaSymbols, shadowSymbols, vbeSymbols, + ddcSymbols, NULL); + return (pointer) 1; + } else { + if (errmaj) + *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +#endif /* XFree86LOADER */ + + +/* + * I'd rather have these wait macros be inline, but S3 has made it + * darned near impossible. The bit fields are in a different place in + * all three families, the status register has a different address in the + * three families, and even the idle vs busy sense flipped in the Sav2K. + */ + +static void +ResetBCI2K( SavagePtr psav ) +{ + CARD32 cob = INREG( 0x48c18 ); + /* if BCI is enabled and BCI is busy... */ + + if( + (cob & 0x00000008) && + ! (ALT_STATUS_WORD0 & 0x00200000) + ) + { + ErrorF( "Resetting BCI, stat = %08x...\n", ALT_STATUS_WORD0); + /* Turn off BCI */ + OUTREG( 0x48c18, cob & ~8 ); + usleep(10000); + /* Turn it back on */ + OUTREG( 0x48c18, cob ); + usleep(10000); + } +} + +/* Wait until "v" queue entries are free */ + +static int +WaitQueue3D( SavagePtr psav, int v ) +{ + int loop = 0; + int slots = MAXFIFO - v; + + mem_barrier(); + loop &= STATUS_WORD0; + while( ((STATUS_WORD0 & 0x0000ffff) > slots) && (loop++ < MAXLOOP)) + ; + return loop >= MAXLOOP; +} + +static int +WaitQueue4( SavagePtr psav, int v ) +{ + int loop = 0; + int slots = MAXFIFO - v; + + if( !psav->NoPCIRetry ) + return 0; + mem_barrier(); + while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)) + ; + return loop >= MAXLOOP; +} + +static int +WaitQueue2K( SavagePtr psav, int v ) +{ + int loop = 0; + int slots = MAXFIFO - v; + + if( !psav->NoPCIRetry ) + return 0; + mem_barrier(); + while( ((ALT_STATUS_WORD0 & 0x000fffff) > slots) && (loop++ < MAXLOOP)) + ; + if( loop >= MAXLOOP ) + ResetBCI2K(psav); + return loop >= MAXLOOP; +} + +/* Wait until GP is idle and queue is empty */ + +static int +WaitIdleEmpty3D(SavagePtr psav) +{ + int loop = 0; + mem_barrier(); + loop &= STATUS_WORD0; + while( ((STATUS_WORD0 & 0x0008ffff) != 0x80000) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +static int +WaitIdleEmpty4(SavagePtr psav) +{ + int loop = 0; + mem_barrier(); + while( ((ALT_STATUS_WORD0 & 0x00a1ffff) != 0x00a00000) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +static int +WaitIdleEmpty2K(SavagePtr psav) +{ + int loop = 0; + mem_barrier(); + /* CAUTION! How do we insure this read isn't optimized away? */ + /* Is the "volatile" enough to do that? */ + loop &= ALT_STATUS_WORD0; + while( ((ALT_STATUS_WORD0 & 0x009fffff) != 0) && (loop++ < MAXLOOP) ) + ; + if( loop >= MAXLOOP ) + ResetBCI2K(psav); + return loop >= MAXLOOP; +} + +/* Wait until GP is idle */ + +static int +WaitIdle3D(SavagePtr psav) +{ + int loop = 0; + mem_barrier(); + while( (!(STATUS_WORD0 & 0x00080000)) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +static int +WaitIdle4(SavagePtr psav) +{ + int loop = 0; + mem_barrier(); + while( (!(ALT_STATUS_WORD0 & 0x00800000)) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +static int +WaitIdle2K(SavagePtr psav) +{ + int loop = 0; + mem_barrier(); + loop &= ALT_STATUS_WORD0; + while( (ALT_STATUS_WORD0 & 0x00900000) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +/* Wait until Command FIFO is empty */ + + +static int +WaitCommandEmpty3D(SavagePtr psav) { + int loop = 0; + mem_barrier(); + while( (STATUS_WORD0 & 0x0000ffff) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +static int +WaitCommandEmpty4(SavagePtr psav) { + int loop = 0; + mem_barrier(); + while( (ALT_STATUS_WORD0 & 0x0001ffff) && (loop++ < MAXLOOP) ) + ; + return loop >= MAXLOOP; +} + +static int +WaitCommandEmpty2K(SavagePtr psav) { + int loop = 0; + mem_barrier(); + while( (ALT_STATUS_WORD0 & 0x001fffff) && (loop++ < MAXLOOP) ) + ; + if( loop >= MAXLOOP ) + ResetBCI2K(psav); + return loop >= MAXLOOP; +} + +static Bool SavageGetRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate) + return TRUE; + + pScrn->driverPrivate = xnfcalloc(sizeof(SavageRec), 1); + return TRUE; +} + + +static void SavageFreeRec(ScrnInfoPtr pScrn) +{ + if (!pScrn->driverPrivate) + return; + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; + SavageUnmapMem(pScrn); +} + + +static OptionInfoPtr SavageAvailableOptions(int chipid, int busid) +{ + return SavageOptions; +} + + +static void SavageIdentify(int flags) +{ + xf86PrintChipsets("SAVAGE", + "driver (version " DRIVER_VERSION " for S3 Savage chipsets", + SavageChips); +} + + +static Bool SavageProbe(DriverPtr drv, int flags) +{ + int i; + GDevPtr *devSections; + int *usedChips; + int numDevSections; + int numUsed; + Bool foundScreen = FALSE; + + /* sanity checks */ + if ((numDevSections = xf86MatchDevice("savage", &devSections)) <= 0) + return FALSE; + if (xf86GetPciVideoInfo() == NULL) + return FALSE; + + numUsed = xf86MatchPciInstances("SAVAGE", PCI_VENDOR_S3, + SavageChipsets, SavagePciChipsets, + devSections, numDevSections, drv, + &usedChips); + xfree(devSections); + if (numUsed <= 0) + return FALSE; + + if (flags & PROBE_DETECT) + foundScreen = TRUE; + else + for (i=0; i<numUsed; i++) { + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + + pScrn->driverVersion = (int)DRIVER_VERSION; + pScrn->driverName = DRIVER_NAME; + pScrn->name = "SAVAGE"; + pScrn->Probe = SavageProbe; + pScrn->PreInit = SavagePreInit; + pScrn->ScreenInit = SavageScreenInit; + pScrn->SwitchMode = SavageSwitchMode; + pScrn->AdjustFrame = SavageAdjustFrame; + pScrn->EnterVT = SavageEnterVT; + pScrn->LeaveVT = SavageLeaveVT; + pScrn->FreeScreen = NULL; + pScrn->ValidMode = SavageValidMode; + foundScreen = TRUE; + xf86ConfigActivePciEntity(pScrn, usedChips[i], SavagePciChipsets, + NULL, NULL, NULL, NULL, NULL); + } + + xfree(usedChips); + return foundScreen; +} + +static int LookupChipID( PciChipsets* pset, int ChipID ) +{ + /* Is there a function to do this for me? */ + while( pset->numChipset >= 0 ) + { + if( pset->PCIid == ChipID ) + return pset->numChipset; + pset++; + } + + return -1; +} + +static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) +{ + EntityInfoPtr pEnt; + SavagePtr psav; + MessageType from = X_DEFAULT; + int i; + ClockRangePtr clockRanges; + char *mod = NULL; + char *s = NULL; + const char *reqSym = NULL; + unsigned char config1, m, n, n1, n2, sr8, cr66 = 0, tmp; + int mclk; + vgaHWPtr hwp; + int vgaCRIndex, vgaCRReg, vgaIOBase; + + if (flags & PROBE_DETECT) + return FALSE; + + if (!xf86LoadSubModule(pScrn, "vgahw")) + return FALSE; + + xf86LoaderReqSymLists(vgaHWSymbols, NULL); + if (!vgaHWGetHWRec(pScrn)) + return FALSE; + +#if 0 + /* Here we can alter the number of registers saved and restored by the + * standard vgaHWSave and Restore routines. + */ + vgaHWSetRegCounts( pScrn, VGA_NUM_CRTC, VGA_NUM_SEQ, VGA_NUM_GFX, VGA_NUM_ATTR ); +#endif + + pScrn->monitor = pScrn->confScreen->monitor; + + /* + * We support depths of 8, 15, 16 and 24. + * We support bpp of 8, 16, and 32. + */ + + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) + return FALSE; + else { + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + /* OK */ + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScrn->depth); + return FALSE; + } + } + xf86PrintDepthBpp(pScrn); + + if (pScrn->depth == 24 && pix24bpp == 0) + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + + if (pScrn->depth > 8) { + rgb zeros = {0, 0, 0}; + + if (!xf86SetWeight(pScrn, zeros, zeros)) + return FALSE; + else { + /* TODO check weight returned is supported */ + ; + } + } + + if (!xf86SetDefaultVisual(pScrn, -1)) { + return FALSE; + } else { + /* We don't currently support DirectColor at > 8bpp */ + if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" + " (%s) is not supported at depth %d\n", + xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); + return FALSE; + } + } + + pScrn->progClock = TRUE; + + if (!SavageGetRec(pScrn)) + return FALSE; + psav = SAVPTR(pScrn); + + xf86CollectOptions(pScrn, NULL); + + if (pScrn->depth == 8) + pScrn->rgbBits = 6; + + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SavageOptions); + + if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_BURST, FALSE)) { + psav->pci_burst = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_burst - PCI burst read enabled\n"); + } else + psav->pci_burst = FALSE; + psav->NoPCIRetry = 1; /* default */ + if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_BURST, FALSE)) { + psav->NoPCIRetry = 0; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_retry\n"); + } else + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"pci_retry\" option requires \"pci_burst\"\n"); + } + if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_CONSERV)) { + psav->fifo_conservative = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo conservative set\n"); + } else + psav->fifo_conservative = FALSE; + if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_MODERATE)) { + psav->fifo_moderate = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_moderate set\n"); + } else + psav->fifo_moderate = FALSE; + if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_AGGRESSIVE)) { + psav->fifo_aggressive = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_aggressive set\n"); + } else + psav->fifo_aggressive = FALSE; + if (xf86IsOptionSet(SavageOptions, OPTION_SLOW_EDODRAM)) { + psav->slow_edodram = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_edodram_set\n"); + } else + psav->slow_edodram = FALSE; + if (xf86IsOptionSet(SavageOptions, OPTION_SLOW_DRAM)) { + psav->slow_dram = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_dram set\n"); + } else + psav->slow_dram = FALSE; + if (xf86IsOptionSet(SavageOptions, OPTION_FAST_DRAM)) { + psav->fast_dram = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fast_dram set\n"); + } else + psav->fast_dram = FALSE; + if (xf86IsOptionSet(SavageOptions, OPTION_FPM_VRAM)) { + psav->fpm_vram = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fpm_vram set\n"); + } else + psav->fpm_vram = FALSE; + + if (xf86IsOptionSet(SavageOptions, OPTION_SHADOW_FB)) { + psav->shadowFB = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ShadowFB %s.\n", + psav->shadowFB ? "enabled" : "disabled"); + } else + psav->shadowFB = FALSE; + + if ((s = xf86GetOptValString(SavageOptions, OPTION_ROTATE))) { + if(!xf86NameCmp(s, "CW")) { + /* accel is disabled below for shadowFB */ + psav->shadowFB = TRUE; + psav->rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n"); + } else if(!xf86NameCmp(s, "CCW")) { + psav->shadowFB = TRUE; + psav->rotate = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen" + "counter clockwise - acceleration disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid" + "value for Option \"Rotate\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n"); + } + } + + if (xf86ReturnOptValBool(SavageOptions, OPTION_NOACCEL, FALSE)) { + psav->NoAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - Acceleration Disabled\n"); + } else + psav->NoAccel = FALSE; + + if (psav->shadowFB && !psav->NoAccel) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "HW acceleration not supported with \"shadowFB\".\n"); + psav->NoAccel = TRUE; + } + + if (xf86ReturnOptValBool(SavageOptions, OPTION_EARLY_RAS_PRECHARGE, FALSE)) { + psav->early_ras_precharge = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: early_ras_precharge set\n"); + } else + psav->early_ras_precharge = FALSE; + + /* + * The SWCursor setting takes priority over HWCursor. The default + * if neither is specified is HW. + */ + + from = X_DEFAULT; + psav->hwcursor = TRUE; + if (xf86GetOptValBool(SavageOptions, OPTION_HWCURSOR, &psav->hwcursor)) + from = X_CONFIG; + if (xf86ReturnOptValBool(SavageOptions, OPTION_SWCURSOR, FALSE)) { + psav->hwcursor = FALSE; + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + psav->hwcursor ? "HW" : "SW"); + + from = X_DEFAULT; + psav->UseBIOS = TRUE; + if (xf86IsOptionSet(SavageOptions, OPTION_USEBIOS) ) + { + from = X_CONFIG; + xf86GetOptValBool(SavageOptions, OPTION_USEBIOS, &psav->UseBIOS); + } + xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n", + psav->UseBIOS ? "U" : "Not u" ); + + + /* DO OTHERS HERE LATER!!!!!!!!!!!!!! */ + + from = X_DEFAULT; + + + + if (pScrn->numEntities > 1) { + SavageFreeRec(pScrn); + return FALSE; + } + + pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (pEnt->resources) { + xfree(pEnt); + SavageFreeRec(pScrn); + return FALSE; + } + psav->EntityIndex = pEnt->index; + + if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); + psav->pInt10 = xf86InitInt10(pEnt->index); + } + + if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + psav->pVbe = VBEInit(psav->pInt10, pEnt->index); + } + + + psav->PciInfo = xf86GetPciInfoForEntity(pEnt->index); + xf86RegisterResources(pEnt->index, NULL, ResNone); + xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + + if (pEnt->device->chipset && *pEnt->device->chipset) { + pScrn->chipset = pEnt->device->chipset; + psav->ChipId = pEnt->device->chipID; + psav->Chipset = xf86StringToToken(SavageChipsets, pScrn->chipset); + from = X_CONFIG; + } else if (pEnt->device->chipID >= 0) { + psav->ChipId = pEnt->device->chipID; + psav->Chipset = LookupChipID(SavagePciChipsets, psav->ChipId); + pScrn->chipset = (char *)xf86TokenToString(SavageChipsets, + psav->Chipset); + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", + pEnt->device->chipID); + } else { + from = X_PROBED; + psav->ChipId = psav->PciInfo->chipType; + psav->Chipset = LookupChipID(SavagePciChipsets, psav->ChipId); + pScrn->chipset = (char *)xf86TokenToString(SavageChipsets, + psav->Chipset); + } + + if (pEnt->device->chipRev >= 0) { + psav->ChipRev = pEnt->device->chipRev; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", + psav->ChipRev); + } else + psav->ChipRev = psav->PciInfo->chipRev; + + xfree(pEnt); + + /* maybe throw in some more sanity checks here */ + + xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); + + psav->PciTag = pciTag(psav->PciInfo->bus, psav->PciInfo->device, + psav->PciInfo->func); + + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + xf86EnableIO(); + /* unprotect CRTC[0-7] */ + VGAOUT8(vgaCRIndex, 0x11); + tmp = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, tmp & 0x7f); + + /* unlock extended regs */ + VGAOUT16(vgaCRIndex, 0x4838); + VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(0x3c4, 0x0608); + + VGAOUT8(vgaCRIndex, 0x40); + tmp = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, tmp & ~0x01); + + /* unlock sys regs */ + VGAOUT8(vgaCRIndex, 0x38); + VGAOUT8(vgaCRReg, 0x48); + + { + Gamma zeros = {0.0, 0.0, 0.0}; + + if (!xf86SetGamma(pScrn, zeros)) + return FALSE; + } + + /* Unlock system registers. */ + VGAOUT16(vgaCRIndex, 0x4838); + + /* Next go on to detect amount of installed ram */ + + VGAOUT8(vgaCRIndex, 0x36); /* for register CR36 (CONFG_REG1), */ + config1 = VGAIN8(vgaCRReg); /* get amount of vram installed */ + + /* Compute the amount of video memory and offscreen memory. */ + + psav->MemOffScreen = 0; + if (!pScrn->videoRam) { + static unsigned char RamSavage3D[] = { 8, 4, 4, 2 }; + static unsigned char RamSavage4[] = { 2, 4, 8, 12, 16, 32, 64, 2 }; + static unsigned char RamSavageMX[] = { 2, 8, 4, 16, 8, 16, 4, 16 }; + static unsigned char RamSavageNB[] = { 0, 2, 4, 8, 16, 32, 2, 2 }; + + switch( psav->Chipset ) { + case S3_SAVAGE3D: + pScrn->videoRam = RamSavage3D[ (config1 & 0xC0) >> 6 ] * 1024; + break; + + case S3_SAVAGE4: + case S3_SAVAGE2000: + pScrn->videoRam = RamSavage4[ (config1 & 0xE0) >> 5 ] * 1024; + break; + + case S3_SAVAGE_MX: + pScrn->videoRam = RamSavageMX[ (config1 & 0x0E) >> 1 ] * 1024; + break; + + case S3_PROSAVAGE: + pScrn->videoRam = RamSavageNB[ (config1 & 0xE0) >> 5 ] * 1024; + break; + + default: + /* How did we get here? */ + pScrn->videoRam = 0; + break; + } + + psav->videoRambytes = pScrn->videoRam * 1024; + + if (psav->MemOffScreen) + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "probed videoram: %dk plus %dk offscreen\n", + pScrn->videoRam, + psav->MemOffScreen); + else + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "probed videoram: %dk\n", + pScrn->videoRam); + } else { + psav->videoRambytes = pScrn->videoRam * 1024; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "videoram = %dk\n", + pScrn->videoRam); + } + + /* + * If we're running with acceleration, compute the command overflow + * buffer location. The command overflow buffer must END at a + * 4MB boundary; for all practical purposes, that means the very + * end of the frame buffer. + */ + + if( psav->NoAccel ) { + psav->CursorKByte = pScrn->videoRam - 4; + psav->cobIndex = 0; + psav->cobSize = 0; + psav->cobOffset = psav->videoRambytes; + } + else if( S3_SAVAGE4_SERIES(psav->Chipset) ) { + /* + * The Savage4 and ProSavage have COB coherency bugs which render + * the buffer useless. We disable it. + */ + psav->CursorKByte = pScrn->videoRam - 4; + psav->cobIndex = 2; + psav->cobSize = 0x8000 << psav->cobIndex; + psav->cobOffset = psav->videoRambytes; + } + else + { + /* We use 128kB for the COB on all chips. */ + + psav->cobIndex = 7; + psav->cobSize = 0x400 << psav->cobIndex; + psav->cobOffset = psav->videoRambytes - psav->cobSize; + } + + /* + * We place the cursor in high memory, just before the command overflow + * buffer. The cursor must be aligned on a 4k boundary. + */ + + psav->CursorKByte = (psav->cobOffset >> 10) - 4; + + /* reset graphics engine to avoid memory corruption */ + VGAOUT8(vgaCRIndex, 0x66); + cr66 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr66 | 0x02); + usleep(10000); + + VGAOUT8(vgaCRIndex, 0x66); + VGAOUT8(vgaCRReg, cr66 & ~0x02); /* clear reset flag */ + usleep(10000); + + /* Set status word positions based on chip type. */ + + switch( psav->Chipset ) { + case S3_SAVAGE3D: + case S3_SAVAGE_MX: + psav->myWaitQueue = WaitQueue3D; + psav->myWaitIdle = WaitIdle3D; + psav->myWaitIdleEmpty = WaitIdleEmpty3D; + psav->myWaitCommandEmpty = WaitCommandEmpty3D; + break; + + case S3_SAVAGE4: + case S3_PROSAVAGE: + psav->myWaitQueue = WaitQueue4; + psav->myWaitIdle = WaitIdle4; + psav->myWaitIdleEmpty = WaitIdleEmpty4; + psav->myWaitCommandEmpty = WaitCommandEmpty4; + break; + + case S3_SAVAGE2000: + psav->myWaitQueue = WaitQueue2K; + psav->myWaitIdle = WaitIdle2K; + psav->myWaitIdleEmpty = WaitIdleEmpty2K; + psav->myWaitCommandEmpty = WaitCommandEmpty2K; + break; + } + + /* savage ramdac speeds */ + pScrn->numClocks = 4; + pScrn->clock[0] = 250000; + pScrn->clock[1] = 250000; + pScrn->clock[2] = 220000; + pScrn->clock[3] = 220000; + + if (psav->dacSpeedBpp <= 0) { + if (pScrn->bitsPerPixel > 24) + psav->dacSpeedBpp = pScrn->clock[3]; + else if (pScrn->bitsPerPixel >= 24) + psav->dacSpeedBpp = pScrn->clock[2]; + else if ((pScrn->bitsPerPixel > 8) && (pScrn->bitsPerPixel < 24)) + psav->dacSpeedBpp = pScrn->clock[1]; + else if (pScrn->bitsPerPixel <= 8) + psav->dacSpeedBpp = pScrn->clock[0]; + } + + /* set ramdac limits */ + psav->maxClock = psav->dacSpeedBpp; + + /* detect current mclk */ + VGAOUT8(0x3c4, 0x08); + sr8 = VGAIN8(0x3c5); + VGAOUT8(0x3c5, 0x06); + VGAOUT8(0x3c4, 0x10); + n = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x11); + m = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x08); + VGAOUT8(0x3c5, sr8); + m &= 0x7f; + n1 = n & 0x1f; + n2 = (n >> 5) & 0x03; + mclk = ((1431818 * (m+2)) / (n1+2) / (1 << n2) + 50) / 100; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected current MCLK value of %1.3f MHz\n", + mclk / 1000.0); + +#if 0 + SavageUnmapMem(pScrn); +#endif + + psav->minClock = 20000; + + pScrn->maxHValue = 2048; + pScrn->maxVValue = 2048; + pScrn->virtualX = pScrn->display->virtualX; + + clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges->next = NULL; + clockRanges->minClock = psav->minClock; + clockRanges->maxClock = psav->maxClock; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = FALSE; + + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, NULL, + 256, 2048, 16 * pScrn->bitsPerPixel, + 128, 2048, + pScrn->virtualX, pScrn->display->virtualY, + psav->videoRambytes, LOOKUP_BEST_REFRESH); + + if (i == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n"); + SavageFreeRec(pScrn); + return FALSE; + } + + xf86PruneDriverModes(pScrn); + + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + SavageFreeRec(pScrn); + return FALSE; + } + + if( psav->UseBIOS ) + { + /* Go probe the BIOS for all the modes and refreshes at this depth. */ + + if( psav->ModeTable ) + { + SavageFreeBIOSModeTable( psav, &psav->ModeTable ); + } + + psav->ModeTable = SavageGetBIOSModeTable( psav, pScrn->bitsPerPixel ); + + if( !psav->ModeTable || !psav->ModeTable->NumModes ) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to fetch any BIOS modes.\n"); + SavageFreeRec(pScrn); + return FALSE; + } + + /*if( xf86Verbose )*/ + { + int i; + SavageModeEntryPtr pmt; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Found %d modes at this depth:\n", + psav->ModeTable->NumModes); + + for( + i = 0, pmt = psav->ModeTable->Modes; + i < psav->ModeTable->NumModes; + i++, pmt++ ) + { + int j; + ErrorF( " [%03x] %d x %d", + pmt->VesaMode, pmt->Width, pmt->Height ); + for( j = 0; j < pmt->RefreshCount; j++ ) + { + ErrorF( ", %dHz", pmt->RefreshRate[j] ); + } + ErrorF( "\n"); + } + } + } + + xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + pScrn->currentMode = pScrn->modes; + xf86PrintModes(pScrn); + xf86SetDpi(pScrn, 0, 0); + + /* load bpp-specific modules */ + switch (pScrn->bitsPerPixel) { + case 8: + mod = "cfb"; + reqSym = "cfbScreenInit"; + break; + case 16: + mod = "cfb16"; + reqSym = "cfb16ScreenInit"; + break; + case 32: + mod = "cfb32"; + reqSym = "cfb32ScreenInit"; + break; + } + + if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + SavageFreeRec(pScrn); + return FALSE; + } + + xf86LoaderReqSymbols(reqSym, NULL); + + if( !psav->NoAccel ) { + if( !xf86LoadSubModule(pScrn, "xaa") ) { + SavageFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(xaaSymbols, NULL ); + } + + if (psav->hwcursor) { + if (!xf86LoadSubModule(pScrn, "ramdac")) { + SavageFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(ramdacSymbols, NULL); + } + + if (psav->shadowFB) { + if (!xf86LoadSubModule(pScrn, "shadowfb")) { + SavageFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(shadowSymbols, NULL); + } + + return TRUE; +} + + +static Bool SavageEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + +#if 0 + SavageMapMem(pScrn); +#endif + SavageSave(pScrn); + return SavageModeInit(pScrn, pScrn->currentMode); +} + + +static void SavageLeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + vgaRegPtr vgaSavePtr = &hwp->SavedReg; + SavageRegPtr SavageSavePtr = &psav->SavedReg; + + SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr); + +#if 0 + SavageUnmapMem(pScrn); +#endif +} + + +static void SavageSave(ScrnInfoPtr pScrn) +{ + unsigned char cr3a, cr53, cr66; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaSavePtr = &hwp->SavedReg; + SavagePtr psav = SAVPTR(pScrn); + SavageRegPtr save = &psav->SavedReg; + int vgaCRIndex, vgaCRReg, vgaIOBase; + vgaIOBase = hwp->IOBase; + vgaCRReg = vgaIOBase + 5; + vgaCRIndex = vgaIOBase + 4; + + + VGAOUT16(vgaCRIndex, 0x4838); + VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(0x3c4, 0x0608); + + VGAOUT8(vgaCRIndex, 0x66); + cr66 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr66 | 0x80); + VGAOUT8(vgaCRIndex, 0x3a); + cr3a = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr3a | 0x80); + VGAOUT8(vgaCRIndex, 0x53); + cr53 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr53 & 0x7f); + + if (xf86IsPrimaryPci(psav->PciInfo)) + vgaHWSave(pScrn, vgaSavePtr, VGA_SR_ALL); + else + vgaHWSave(pScrn, vgaSavePtr, VGA_SR_MODE); + + VGAOUT8(vgaCRIndex, 0x66); + VGAOUT8(vgaCRReg, cr66); + VGAOUT8(vgaCRIndex, 0x3a); + VGAOUT8(vgaCRReg, cr3a); + + VGAOUT8(vgaCRIndex, 0x66); + VGAOUT8(vgaCRReg, cr66); + VGAOUT8(vgaCRIndex, 0x3a); + VGAOUT8(vgaCRReg, cr3a); + + /* unlock extended seq regs */ + VGAOUT8(0x3c4, 0x08); + save->SR08 = VGAIN8(0x3c5); + VGAOUT8(0x3c5, 0x06); + + /* now save all the extended regs we need */ + VGAOUT8(vgaCRIndex, 0x31); + save->CR31 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x32); + save->CR32 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x34); + save->CR34 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x36); + save->CR36 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x3a); + save->CR3A = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x40); + save->CR40 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x42); + save->CR42 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x45); + save->CR45 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x50); + save->CR50 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x51); + save->CR51 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x53); + save->CR53 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x58); + save->CR58 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x60); + save->CR60 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x66); + save->CR66 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x67); + save->CR67 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x68); + save->CR68 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x69); + save->CR69 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x6f); + save->CR6F = VGAIN8(vgaCRReg); + + VGAOUT8(vgaCRIndex, 0x33); + save->CR33 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x86); + save->CR86 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x88); + save->CR88 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x90); + save->CR90 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x91); + save->CR91 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0xb0); + save->CRB0 = VGAIN8(vgaCRReg) | 0x80; + + /* extended mode timing regs */ + VGAOUT8(vgaCRIndex, 0x3b); + save->CR3B = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x3c); + save->CR3C = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x43); + save->CR43 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x5d); + save->CR5D = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x5e); + save->CR5E = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x65); + save->CR65 = VGAIN8(vgaCRReg); + + /* save seq extended regs for DCLK PLL programming */ + VGAOUT8(0x3c4, 0x10); + save->SR10 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x11); + save->SR11 = VGAIN8(0x3c5); + + VGAOUT8(0x3c4, 0x12); + save->SR12 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x13); + save->SR13 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x29); + save->SR29 = VGAIN8(0x3c5); + + VGAOUT8(0x3c4, 0x15); + save->SR15 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x18); + save->SR18 = VGAIN8(0x3c5); + + /* Save flat panel expansion regsters. */ + + if( psav->Chipset == S3_SAVAGE_MX ) { + int i; + for( i = 0; i < 8; i++ ) { + VGAOUT8(0x3c4, 0x54+i); + save->SR54[i] = VGAIN8(0x3c5); + } + } + + VGAOUT8(vgaCRIndex, 0x66); + cr66 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr66 | 0x80); + VGAOUT8(vgaCRIndex, 0x3a); + cr3a = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr3a | 0x80); + + /* now save MIU regs */ + save->MMPR0 = INREG(FIFO_CONTROL_REG); + save->MMPR1 = INREG(MIU_CONTROL_REG); + save->MMPR2 = INREG(STREAMS_TIMEOUT_REG); + save->MMPR3 = INREG(MISC_TIMEOUT_REG); + + VGAOUT8(vgaCRIndex, 0x3a); + VGAOUT8(vgaCRReg, cr3a); + VGAOUT8(vgaCRIndex, 0x66); + VGAOUT8(vgaCRReg, cr66); + + if (!psav->ModeStructInit) { + vgaHWCopyReg(&hwp->ModeReg, vgaSavePtr); + memcpy(&psav->ModeReg, save, sizeof(SavageRegRec)); + psav->ModeStructInit = TRUE; + } + +#if 0 + if (xf86GetVerbosity() > 1) + SavagePrintRegs(pScrn); +#endif + + return; +} + + +static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, + SavageRegPtr restore) +{ + unsigned char tmp, cr3a, cr66, cr67; + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + int vgaCRIndex, vgaCRReg, vgaIOBase; + Bool graphicsMode = FALSE; + + + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + /* + * If we figured out a VESA mode number for this timing, just use + * the S3 BIOS to do the switching, with a few additional tweaks. + */ + + if( psav->UseBIOS && restore->mode > 0x13 ) + { + int width; + unsigned short cr6d; + unsigned short cr79 = 0; + + /* Set up the mode. Don't clear video RAM. */ + SavageSetVESAMode( psav, restore->mode | 0x8000, restore->refresh ); + + /* Restore the DAC. */ + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_CMAP); + + /* Unlock the extended registers. */ + +#if 0 + /* Which way is better? */ + hwp->writeCrtc( hwp, 0x38, 0x48 ); + hwp->writeCrtc( hwp, 0x39, 0xa0 ); + hwp->writeSeq( hwp, 0x08, 0x06 ); +#endif + + VGAOUT16(vgaCRIndex, 0x4838); + VGAOUT16(vgaCRIndex, 0xA039); + VGAOUT16(0x3c4, 0x0608); + + /* Enable linear addressing. */ + + VGAOUT16(vgaCRIndex, 0x1358); + + /* Disable old MMIO. */ + + VGAOUT8(vgaCRIndex, 0x53); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & ~0x10); + + /* We may need TV/panel fixups here. See s3bios.c line 2904. */ + + /* Set FIFO fetch delay. */ + VGAOUT8(vgaCRIndex, 0x85); + VGAOUT8(vgaCRReg, (VGAIN8(vgaCRReg) & 0xf8) | 0x03); + + /* Patch CR79. These values are magical. */ + + if( psav->Chipset != S3_SAVAGE_MX ) + { + VGAOUT8(vgaCRIndex, 0x6d); + cr6d = VGAIN8(vgaCRReg); + + cr79 = 0x04; + + if( pScrn->displayWidth >= 1024 ) + { + if(pScrn->bitsPerPixel == 32 ) + { + if( restore->refresh >= 130 ) + cr79 = 0x03; + else if( pScrn->displayWidth >= 1280 ) + cr79 = 0x02; + else if( + (pScrn->displayWidth == 1024) && + (restore->refresh >= 75) + ) + { + if( cr6d && LCD_ACTIVE ) + cr79 = 0x05; + else + cr79 = 0x08; + } + } + else if( pScrn->bitsPerPixel == 16) + { + +/* The windows driver uses 0x13 for 16-bit 130Hz, but I see terrible + * screen artifacts with that value. Let's keep it low for now. + * if( restore->refresh >= 130 ) + * cr79 = 0x13; + * else + */ + if( pScrn->displayWidth == 1024 ) + { + if( cr6d && LCD_ACTIVE ) + cr79 = 0x08; + else + cr79 = 0x0e; + } + } + } + } + + if( (psav->Chipset != S3_SAVAGE2000) && + (psav->Chipset != S3_SAVAGE_MX) ) + VGAOUT16(vgaCRIndex, (cr79 << 8) | 0x79); + + /* Make sure 16-bit memory access is enabled. */ + + VGAOUT16(vgaCRIndex, 0x0c31); + + /* Enable the graphics engine. */ + + VGAOUT16(vgaCRIndex, 0x0140); + #if 0 + if( !psav->NoAccel ) + S3SAVInitialize2DEngine(); + #endif + + /* Handle the pitch. */ + + VGAOUT8(vgaCRIndex, 0x50); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); + + width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3; + VGAOUT16(vgaCRIndex, ((width & 0xff) << 8) | 0x13 ); + VGAOUT16(vgaCRIndex, ((width & 0x300) << 4) | 0x51 ); + + /* Some non-S3 BIOSes enable block write even on non-SGRAM devices. */ + + if( psav->Chipset == S3_SAVAGE2000 ) + { + VGAOUT8(vgaCRIndex, 0x73); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & 0xdf ); + } + else if( psav->Chipset != S3_SAVAGE_MX ) + { + VGAOUT8(vgaCRIndex, 0x68); + if( !(VGAIN8(vgaCRReg) & 0x80) ) + { + /* Not SGRAM; disable block write. */ + VGAOUT8(vgaCRIndex, 0x88); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0x10); + } + } + + if( !psav->NoAccel ) + SavageInitialize2DEngine(pScrn); + + VGAOUT16(vgaCRIndex, 0x0140); + + SavageSetGBD(pScrn); + + return; + } + + VGAOUT8(0x3c2, 0x23); + VGAOUT16(vgaCRIndex, 0x4838); + VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(0x3c4, 0x0608); + + vgaHWProtect(pScrn, TRUE); + + /* will we be reenabling STREAMS for the new mode? */ + psav->STREAMSRunning = 0; + + graphicsMode = (restore->CR31 & 0x0a) ? TRUE : FALSE; + + /* reset GE to make sure nothing is going on */ + VGAOUT8(vgaCRIndex, 0x66); + if(VGAIN8(vgaCRReg) & 0x01) + SavageGEReset(pScrn,0,__LINE__,__FILE__); + + /* + * Some Savage/MX and /IX systems go nuts when trying to exit the + * server after WindowMaker has displayed a gradient background. I + * haven't been able to find what causes it, but a non-destructive + * switch to mode 3 here seems to eliminate the issue. + */ + +#define CLEAR_X86_REGS(pi) \ + (pi)->ax = (pi)->bx = (pi)->cx = (pi)->dx = (pi)->si = (pi)->di = 0 + + if( !graphicsMode && psav->pInt10 ) { + CLEAR_X86_REGS( psav->pInt10 ); + psav->pInt10->num = 0x10; + psav->pInt10->ax = 0x0083; + xf86ExecX86int10( psav->pInt10 ); + } + + VGAOUT8(vgaCRIndex, 0x67); + cr67 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c); /* no STREAMS yet */ + + /* restore extended regs */ + VGAOUT8(vgaCRIndex, 0x66); + VGAOUT8(vgaCRReg, restore->CR66); + VGAOUT8(vgaCRIndex, 0x3a); + VGAOUT8(vgaCRReg, restore->CR3A); + VGAOUT8(vgaCRIndex, 0x31); + VGAOUT8(vgaCRReg, restore->CR31); + VGAOUT8(vgaCRIndex, 0x32); + VGAOUT8(vgaCRReg, restore->CR32); + VGAOUT8(vgaCRIndex, 0x58); + VGAOUT8(vgaCRReg, restore->CR58); + VGAOUT8(vgaCRIndex, 0x53); + VGAOUT8(vgaCRReg, restore->CR53 & 0x7f); + + VGAOUT8(0x3c4, 0x08); + VGAOUT8(0x3c5, 0x06); + VGAOUT8(0x3c4, 0x12); + VGAOUT8(0x3c5, restore->SR12); + VGAOUT8(0x3c4, 0x13); + VGAOUT8(0x3c5, restore->SR13); + VGAOUT8(0x3c4, 0x29); + VGAOUT8(0x3c5, restore->SR29); + VGAOUT8(0x3c4, 0x15); + VGAOUT8(0x3c5, restore->SR15); + + /* Restore flat panel expansion regsters. */ + if( psav->Chipset == S3_SAVAGE_MX ) { + int i; + for( i = 0; i < 8; i++ ) { + VGAOUT8(0x3c4, 0x54+i); + VGAOUT8(0x3c5, restore->SR54[i]); + } + } + + /* restore the standard vga regs */ + if (xf86IsPrimaryPci(psav->PciInfo)) + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL); + else + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE); + + /* extended mode timing registers */ + VGAOUT8(vgaCRIndex, 0x53); + VGAOUT8(vgaCRReg, restore->CR53); + VGAOUT8(vgaCRIndex, 0x5d); + VGAOUT8(vgaCRReg, restore->CR5D); + VGAOUT8(vgaCRIndex, 0x5e); + VGAOUT8(vgaCRReg, restore->CR5E); + VGAOUT8(vgaCRIndex, 0x3b); + VGAOUT8(vgaCRReg, restore->CR3B); + VGAOUT8(vgaCRIndex, 0x3c); + VGAOUT8(vgaCRReg, restore->CR3C); + VGAOUT8(vgaCRIndex, 0x43); + VGAOUT8(vgaCRReg, restore->CR43); + VGAOUT8(vgaCRIndex, 0x65); + VGAOUT8(vgaCRReg, restore->CR65); + + /* restore the desired video mode with cr67 */ + VGAOUT8(vgaCRIndex, 0x67); + VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c); /* no STREAMS yet */ + + /* other mode timing and extended regs */ + VGAOUT8(vgaCRIndex, 0x34); + VGAOUT8(vgaCRReg, restore->CR34); + VGAOUT8(vgaCRIndex, 0x40); + VGAOUT8(vgaCRReg, restore->CR40); + VGAOUT8(vgaCRIndex, 0x42); + VGAOUT8(vgaCRReg, restore->CR42); + VGAOUT8(vgaCRIndex, 0x45); + VGAOUT8(vgaCRReg, restore->CR45); + VGAOUT8(vgaCRIndex, 0x50); + VGAOUT8(vgaCRReg, restore->CR50); + VGAOUT8(vgaCRIndex, 0x51); + VGAOUT8(vgaCRReg, restore->CR51); + + /* memory timings */ + VGAOUT8(vgaCRIndex, 0x36); + VGAOUT8(vgaCRReg, restore->CR36); + VGAOUT8(vgaCRIndex, 0x60); + VGAOUT8(vgaCRReg, restore->CR60); + VGAOUT8(vgaCRIndex, 0x68); + VGAOUT8(vgaCRReg, restore->CR68); + VGAOUT8(vgaCRIndex, 0x69); + VGAOUT8(vgaCRReg, restore->CR69); + VGAOUT8(vgaCRIndex, 0x6f); + VGAOUT8(vgaCRReg, restore->CR6F); + + VGAOUT8(vgaCRIndex, 0x33); + VGAOUT8(vgaCRReg, restore->CR33); + VGAOUT8(vgaCRIndex, 0x86); + VGAOUT8(vgaCRReg, restore->CR86); + VGAOUT8(vgaCRIndex, 0x88); + VGAOUT8(vgaCRReg, restore->CR88); + VGAOUT8(vgaCRIndex, 0x90); + VGAOUT8(vgaCRReg, restore->CR90); + VGAOUT8(vgaCRIndex, 0x91); + VGAOUT8(vgaCRReg, restore->CR91); + if( psav->Chipset == S3_SAVAGE4 ) + { + VGAOUT8(vgaCRIndex, 0xb0); + VGAOUT8(vgaCRReg, restore->CRB0); + } + + VGAOUT8(vgaCRIndex, 0x32); + VGAOUT8(vgaCRReg, restore->CR32); + + /* unlock extended seq regs */ + VGAOUT8(0x3c4, 0x08); + VGAOUT8(0x3c5, 0x06); + + /* Restore extended sequencer regs for MCLK. SR10 == 255 indicates that + * we should leave the default SR10 and SR11 values there. + */ + if (restore->SR10 != 255) { + VGAOUT8(0x3c4, 0x10); + VGAOUT8(0x3c5, restore->SR10); + VGAOUT8(0x3c4, 0x11); + VGAOUT8(0x3c5, restore->SR11); + } + + /* restore extended seq regs for dclk */ + VGAOUT8(0x3c4, 0x12); + VGAOUT8(0x3c5, restore->SR12); + VGAOUT8(0x3c4, 0x13); + VGAOUT8(0x3c5, restore->SR13); + VGAOUT8(0x3c4, 0x29); + VGAOUT8(0x3c5, restore->SR29); + + VGAOUT8(0x3c4, 0x18); + VGAOUT8(0x3c5, restore->SR18); + + /* load new m, n pll values for dclk & mclk */ + VGAOUT8(0x3c4, 0x15); + tmp = VGAIN8(0x3c5) & ~0x21; + + VGAOUT8(0x3c5, tmp | 0x03); + VGAOUT8(0x3c5, tmp | 0x23); + VGAOUT8(0x3c5, tmp | 0x03); + VGAOUT8(0x3c5, restore->SR15); + + VGAOUT8(0x3c4, 0x08); + VGAOUT8(0x3c5, restore->SR08); + + /* now write out cr67 in full, possibly starting STREAMS */ + VerticalRetraceWait(); + VGAOUT8(vgaCRIndex, 0x67); +#if 0 + VGAOUT8(vgaCRReg, 0x50); + usleep(10000); + VGAOUT8(vgaCRIndex, 0x67); +#endif + VGAOUT8(vgaCRReg, restore->CR67); + + VGAOUT8(vgaCRIndex, 0x66); + cr66 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr66 | 0x80); + VGAOUT8(vgaCRIndex, 0x3a); + cr3a = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr3a | 0x80); + + if (graphicsMode) + SavageGEReset(pScrn,0,__LINE__,__FILE__); + + VerticalRetraceWait(); + OUTREG(FIFO_CONTROL_REG, restore->MMPR0); + WaitIdle(); + OUTREG(MIU_CONTROL_REG, restore->MMPR1); + WaitIdle(); + OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); + WaitIdle(); + OUTREG(MISC_TIMEOUT_REG, restore->MMPR3); + + /* If we're going into graphics mode and acceleration was enabled, */ + /* go set up the BCI buffer and the global bitmap descriptor. */ + + if( graphicsMode && (!psav->NoAccel) ) + { + VGAOUT8(vgaCRIndex, 0x50); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); + SavageInitialize2DEngine(pScrn); + } + + VGAOUT8(vgaCRIndex, 0x66); + VGAOUT8(vgaCRReg, cr66); + VGAOUT8(vgaCRIndex, 0x3a); + VGAOUT8(vgaCRReg, cr3a); + + if( graphicsMode ) + SavageSetGBD(pScrn); + + vgaHWProtect(pScrn, FALSE); + + return; +} + + +static Bool SavageMapMem(ScrnInfoPtr pScrn) +{ + SavagePtr psav; + vgaHWPtr hwp; + + psav = SAVPTR(pScrn); + + if( S3_SAVAGE3D_SERIES(psav->Chipset) ) { + psav->MmioBase = psav->PciInfo->memBase[0] + SAVAGE_NEWMMIO_REGBASE_S3; + psav->FrameBufferBase = psav->PciInfo->memBase[0]; + } + else { + psav->MmioBase = psav->PciInfo->memBase[0] + SAVAGE_NEWMMIO_REGBASE_S4; + psav->FrameBufferBase = psav->PciInfo->memBase[1]; + } + + xf86DrvMsg( pScrn->scrnIndex, X_PROBED, + "mapping MMIO @ 0x%x with size 0x%x\n", + psav->MmioBase, SAVAGE_NEWMMIO_REGSIZE); + + psav->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, psav->PciTag, + psav->MmioBase, + SAVAGE_NEWMMIO_REGSIZE); +#if 0 + psav->MapBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, + psav->PciTag, + psav->PciInfo->memBase[0], + 0x8000); +#endif + if (!psav->MapBase) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal error: cound not map registers\n"); + return FALSE; + } + + psav->BciMem = psav->MapBase + 0x10000; + + xf86DrvMsg( pScrn->scrnIndex, X_PROBED, + "mapping framebuffer @ 0x%x with size 0x%x\n", + psav->FrameBufferBase, psav->videoRambytes); + + if (psav->videoRambytes) { + psav->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + psav->PciTag, psav->FrameBufferBase, + psav->videoRambytes); + if (!psav->FBBase) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal error: could not map framebuffer\n"); + return FALSE; + } + psav->FBStart = psav->FBBase; + } + pScrn->memPhysBase = psav->PciInfo->memBase[0]; + pScrn->fbOffset = 0; +/* psav->FBCursorOffset = psav->videoRambytes - 1024; */ + SavageEnableMMIO(pScrn); + hwp = VGAHWPTR(pScrn); +/* vgaHWSetMmioFuncs(hwp, psav->MapBase, SAVAGE_NEWMMIO_REGSIZE); */ + vgaHWGetIOBase(hwp); + +#if 0 + if (xf86IsPrimaryPci(psav->PciInfo)) { + hwp->MapSize = 0x10000; + if (!vgaHWMapMem(pScrn)) + return FALSE; + psav->PrimaryVidMapped = TRUE; + } +#endif + + return TRUE; +} + + +static void SavageUnmapMem(ScrnInfoPtr pScrn) +{ + SavagePtr psav; + + psav = SAVPTR(pScrn); + + if (psav->PrimaryVidMapped) { + vgaHWUnmapMem(pScrn); + psav->PrimaryVidMapped = FALSE; + } + + SavageDisableMMIO(pScrn); + if (psav->MapBase) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->MapBase, + SAVAGE_NEWMMIO_REGSIZE); + if (psav->FBBase) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->FBBase, + psav->videoRambytes); +#if 0 + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->MapBaseDense, + 0x8000); +#endif + + return; +} + + +static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, + int argc, char **argv) +{ + ScrnInfoPtr pScrn; + SavagePtr psav; + int ret; + + pScrn = xf86Screens[pScreen->myNum]; + psav = SAVPTR(pScrn); + + if (!SavageMapMem(pScrn)) + return FALSE; + + SavageSave(pScrn); + + vgaHWBlankScreen(pScrn, TRUE); + + if (!SavageModeInit(pScrn, pScrn->currentMode)) + return FALSE; + + miClearVisualTypes(); + + if (pScrn->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + } else { + if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + } + + ret = SavageInternalScreenInit(scrnIndex, pScreen); + if (!ret) + return FALSE; + + xf86SetBlackWhitePixels(pScreen); + + if (pScrn->bitsPerPixel > 8) { + VisualPtr visual; + + visual = pScreen->visuals + pScreen->numVisuals; + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + + if( !psav->NoAccel ) { + SavageInitAccel(pScreen); + } + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + +#if 0 + SavageDGAInit(pScreen); +#endif + + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + + if (psav->hwcursor) + if (!SavageHWCursorInit(pScreen)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + + if (psav->shadowFB) { + RefreshAreaFuncPtr refreshArea = SavageRefreshArea; + +#if 1 + if(psav->rotate) { + if (!psav->PointerMoved) { + psav->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = SavagePointerMoved; + } + + switch(pScrn->bitsPerPixel) { + case 8: refreshArea = SavageRefreshArea8; break; + case 16: refreshArea = SavageRefreshArea16; break; + case 24: refreshArea = SavageRefreshArea24; break; + case 32: refreshArea = SavageRefreshArea32; break; + } + } +#endif + + ShadowFBInit(pScreen, refreshArea); + } + + if (!miCreateDefColormap(pScreen)) + return FALSE; + + if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPalette, NULL, + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + + vgaHWBlankScreen(pScrn, FALSE); + + psav->CloseScreen = pScreen->CloseScreen; + pScreen->SaveScreen = SavageSaveScreen; + pScreen->CloseScreen = SavageCloseScreen; + + if (serverGeneration == 1) + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + + return TRUE; +} + + +static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) +{ + int ret = TRUE; + ScrnInfoPtr pScrn; + SavagePtr psav; + int width, height, displayWidth; + unsigned char *FBStart; + + pScrn = xf86Screens[pScreen->myNum]; + psav = SAVPTR(pScrn); + + displayWidth = pScrn->displayWidth; + + if (psav->rotate) { + height = pScrn->virtualX; + width = pScrn->virtualY; + } else { + width = pScrn->virtualX; + height = pScrn->virtualY; + } + + + if(psav->shadowFB) { + psav->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); + psav->ShadowPtr = xalloc(psav->ShadowPitch * height); + displayWidth = psav->ShadowPitch / (pScrn->bitsPerPixel >> 3); + FBStart = psav->ShadowPtr; + } else { + psav->ShadowPtr = NULL; + FBStart = psav->FBStart; + } + + switch (pScrn->bitsPerPixel) { + case 8: + ret = cfbScreenInit(pScreen, FBStart, width, height, + pScrn->xDpi, pScrn->yDpi, + displayWidth); + break; + case 16: + ret = cfb16ScreenInit(pScreen, FBStart, width, height, + pScrn->xDpi, pScrn->yDpi, + displayWidth); + break; + case 32: + ret = cfb32ScreenInit(pScreen, FBStart, width, height, + pScrn->xDpi, pScrn->yDpi, + displayWidth); + break; + default: + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: invalid bpp (%d) in SavageScreenInit\n", + pScrn->bitsPerPixel); + ret = FALSE; + break; + } + + return ret; +} + + +static ModeStatus SavageValidMode(int index, DisplayModePtr mode, + Bool verbose, int flags) +{ + /* TODO check modes */ + return MODE_OK; +} + +static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + int width, dclk, i, j; /*, refresh; */ + unsigned int m, n, r; + unsigned char tmp = 0; + SavageRegPtr new = &psav->ModeReg; + vgaRegPtr vganew = &hwp->ModeReg; + int vgaCRIndex, vgaCRReg, vgaIOBase; + + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + +#if 0 + ErrorF("Clock = %d, HDisplay = %d, HSStart = %d\n", + mode->Clock, mode->HDisplay, mode->HSyncStart); + ErrorF("HSEnd = %d, HSkew = %d\n", + mode->HSyncEnd, mode->HSkew); + ErrorF("VDisplay - %d, VSStart = %d, VSEnd = %d\n", + mode->VDisplay, mode->VSyncStart, mode->VSyncEnd); + ErrorF("VTotal = %d\n", + mode->VTotal); + ErrorF("HDisplay = %d, HSStart = %d\n", + mode->CrtcHDisplay, mode->CrtcHSyncStart); + ErrorF("HSEnd = %d, HSkey = %d\n", + mode->CrtcHSyncEnd, mode->CrtcHSkew); + ErrorF("VDisplay - %d, VSStart = %d, VSEnd = %d\n", + mode->CrtcVDisplay, mode->CrtcVSyncStart, mode->CrtcVSyncEnd); + ErrorF("VTotal = %d\n", + mode->CrtcVTotal); +#endif + + + + if (pScrn->bitsPerPixel == 8) + psav->HorizScaleFactor = 1; + else if (pScrn->bitsPerPixel == 16) + psav->HorizScaleFactor = 1; /* I don't think we ever want 2 */ + else + psav->HorizScaleFactor = 1; + + if (psav->HorizScaleFactor == 2) + if (!mode->CrtcHAdjusted) { + mode->CrtcHDisplay *= 2; + mode->CrtcHSyncStart *= 2; + mode->CrtcHSyncEnd *= 2; + mode->CrtcHTotal *= 2; + mode->CrtcHSkew *= 2; + mode->CrtcHAdjusted = TRUE; + } + + if (!vgaHWInit(pScrn, mode)) + return FALSE; + + new->mode = 0; + + if( psav->UseBIOS ) { + int refresh; + SavageModeEntryPtr pmt; + + /* Scan through our BIOS list to locate the closest valid mode. */ + + /* If we ever break 4GHz clocks on video boards, we'll need to + * change this. + */ + + refresh = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); + +#ifdef EXTENDED_DEBUG + ErrorF( "Desired refresh rate = %dHz\n", refresh ); +#endif + + for( i = 0, pmt = psav->ModeTable->Modes; + i < psav->ModeTable->NumModes; + i++, pmt++ ) + { + if( (pmt->Width == mode->HDisplay) && + (pmt->Height == mode->VDisplay) ) + { + int j; + int jDelta = 99; + int jBest = 0; + + /* We have an acceptable mode. Find a refresh rate. */ + + new->mode = pmt->VesaMode; + for( j = 0; j < pmt->RefreshCount; j++ ) + { + if( pmt->RefreshRate[j] == refresh ) + { + /* Exact match. */ + jBest = j; + break; + } + else if( iabs(pmt->RefreshRate[j] - refresh) < jDelta ) + { + jDelta = iabs(pmt->RefreshRate[j] - refresh); + jBest = j; + } + } + + new->refresh = pmt->RefreshRate[jBest]; + break; + } + } + } + + if( new->mode ) { + /* Success: we found a match in the BIOS. */ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chose mode %x at %dHz.\n", new->mode, new->refresh ); + } + else { + + /* We failed to find a match in the BIOS. */ + /* Fallthrough to the traditional register-crunching. */ + + VGAOUT8(vgaCRIndex, 0x3a); + tmp = VGAIN8(vgaCRReg); + if (psav->pci_burst) + new->CR3A = (tmp & 0x7f) | 0x15; + else + new->CR3A = tmp | 0x95; + + new->CR53 = 0x00; + new->CR31 = 0x8c; + new->CR66 = 0x89; + + VGAOUT8(vgaCRIndex, 0x58); + new->CR58 = VGAIN8(vgaCRReg) & 0x80; + new->CR58 |= 0x13; + +#if 0 + VGAOUT8(vgaCRIndex, 0x55); + new->CR55 = VGAIN8(vgaCRReg); + if (psav->hwcursor) + new->CR55 |= 0x10; +#endif + + dclk = mode->Clock; + new->CR67 = 0x00; + new->SR15 = 0x03 | 0x80; + new->SR18 = 0x00; + new->CR43 = new->CR45 = new->CR65 = 0x00; + + VGAOUT8(vgaCRIndex, 0x40); + new->CR40 = VGAIN8(vgaCRReg) & ~0x01; + + new->MMPR0 = 0x010400; + new->MMPR1 = 0x00; + new->MMPR2 = 0x0808; + new->MMPR3 = 0x08080810; + + if (psav->fifo_aggressive || psav->fifo_moderate || + psav->fifo_conservative) { + new->MMPR1 = 0x0200; + new->MMPR2 = 0x1808; + new->MMPR3 = 0x08081810; + } + + if (psav->MCLK <= 0) { + new->SR10 = 255; + new->SR11 = 255; + } + + psav->NeedSTREAMS = FALSE; + + /**** + * TODO + * old code uses the "dclk<=110000" path for all non-MX/IX, and the + * >110000 path for MX/IX. What does this mean? + ****/ + + if (pScrn->bitsPerPixel == 8) { + if (dclk <= 110000) + new->CR67 = 0x00; /* 8bpp, 135Mhz */ + else + new->CR67 = 0x10; /* 8bpp, 220Mhz */ + } else if ((pScrn->bitsPerPixel == 16) && (pScrn->weight.green == 5)) { + if (dclk <= 110000) + new->CR67 = 0x20; /* 15bpp, 135Mhz */ + else + new->CR67 = 0x30; /* 15bpp, 220Mhz */ + } else if (pScrn->bitsPerPixel == 16) { + if (dclk <= 110000) + new->CR67 = 0x40; /* 16bpp, 135Mhz */ + else + new->CR67 = 0x50; /* 16bpp, 220Mhz */ + } else if (pScrn->bitsPerPixel == 32) { + new->CR67 = 0xd0; + } + + SavageCalcClock(dclk, 1, 1, 127, 0, 4, 180000, 360000, + &m, &n, &r); + new->SR12 = (r << 6) | (n & 0x3f); + new->SR13 = m & 0xff; + new->SR29 = (r & 4) | (m & 0x100) >> 5 | (n & 0x40) >> 2; + + if (psav->fifo_moderate) { + if (pScrn->bitsPerPixel < 24) + new->MMPR0 -= 0x8000; + else + new->MMPR0 -= 0x4000; + } else if (psav->fifo_aggressive) { + if (pScrn->bitsPerPixel < 24) + new->MMPR0 -= 0xc000; + else + new->MMPR0 -= 0x6000; + } + + if (mode->Flags & V_INTERLACE) + new->CR42 = 0x20; + else + new->CR42 = 0x00; + + new->CR34 = 0x10; + + i = ((((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8) | + ((((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7) | + ((((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6) | + ((mode->CrtcHSyncStart & 0x800) >> 7); + + if ((mode->CrtcHSyncEnd >> 3) - (mode->CrtcHSyncStart >> 3) > 64) + i |= 0x08; + if ((mode->CrtcHSyncEnd >> 3) - (mode->CrtcHSyncStart >> 3) > 32) + i |= 0x20; + j = (vganew->CRTC[0] + ((i & 0x01) << 8) + + vganew->CRTC[4] + ((i & 0x10) << 4) + 1) / 2; + if (j - (vganew->CRTC[4] + ((i & 0x10) << 4)) < 4) { + if (vganew->CRTC[4] + ((i & 0x10) << 4) + 4 <= + vganew->CRTC[0] + ((i & 0x01) << 8)) + j = vganew->CRTC[4] + ((i & 0x10) << 4) + 4; + else + j = vganew->CRTC[0] + ((i & 0x01) << 8) + 1; + } + + new->CR3B = j & 0xff; + i |= (j & 0x100) >> 2; + new->CR3C = (vganew->CRTC[0] + ((i & 0x01) << 8)) / 2; + new->CR5D = i; + new->CR5E = (((mode->CrtcVTotal - 2) & 0x400) >> 10) | + (((mode->CrtcVDisplay - 1) & 0x400) >> 9) | + (((mode->CrtcVSyncStart) & 0x400) >> 8) | + (((mode->CrtcVSyncStart) & 0x400) >> 6) | 0x40; + width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3; + new->CR91 = vganew->CRTC[19] = 0xff & width; + new->CR51 = (0x300 & width) >> 4; + new->CR90 = 0x80 | (width >> 8); + vganew->MiscOutReg |= 0x0c; + + /* Set frame buffer description. */ + + if (pScrn->bitsPerPixel <= 8) + new->CR50 = 0; + else if (pScrn->bitsPerPixel <= 16) + new->CR50 = 0x10; + else + new->CR50 = 0x30; + + if (pScrn->displayWidth <= 640) + new->CR50 |= 0x40; + else if (pScrn->displayWidth <= 800) + new->CR50 |= 0x80; + else if (pScrn->displayWidth <= 1024) + new->CR50 |= 0x00; + else if (pScrn->displayWidth <= 1152) + new->CR50 |= 0x01; + else if (pScrn->displayWidth <= 1280) + new->CR50 |= 0xc0; + else if (pScrn->displayWidth <= 1600) + new->CR50 |= 0x81; + else + new->CR50 |= 0xc1; /* Use GBD */ + + if( psav->Chipset == S3_SAVAGE2000 ) + new->CR33 = 0x08; + else + new->CR33 = 0x20; + + vganew->CRTC[0x17] = 0xeb; + + new->CR67 |= 1; + + VGAOUT8(vgaCRIndex, 0x36); + new->CR36 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x68); + new->CR68 = VGAIN8(vgaCRReg); + new->CR69 = 0; + VGAOUT8(vgaCRIndex, 0x6f); + new->CR6F = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRIndex, 0x88); + new->CR86 = VGAIN8(vgaCRReg) | 0x08; + VGAOUT8(vgaCRIndex, 0xb0); + new->CRB0 = VGAIN8(vgaCRReg) | 0x80; + } + + pScrn->vtSema = TRUE; + + /* do it! */ + SavageWriteMode(pScrn, vganew, new); + SavageAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + return TRUE; +} + + +static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + vgaRegPtr vgaSavePtr = &hwp->SavedReg; + SavageRegPtr SavageSavePtr = &psav->SavedReg; + + if( psav->AccelInfoRec ) { + XAADestroyInfoRec( psav->AccelInfoRec ); + psav->AccelInfoRec = NULL; + } + +#if 0 + if( psav->pInt10 ) { + xf86FreeInt10( psav->pInt10 ); + psav->pInt10 = NULL; + } + + if (psav->pVbe) + { + vbeFree(psav->pVbe); + psav->pVbe = NULL; + } +#endif + + if (pScrn->vtSema) { + SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr); + vgaHWLock(hwp); + SavageUnmapMem(pScrn); + } + + pScrn->vtSema = FALSE; + pScreen->CloseScreen = psav->CloseScreen; + + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + + +static Bool SavageSaveScreen(ScreenPtr pScreen, int mode) +{ + return vgaHWSaveScreen(pScreen, mode); +} + + +void SavageAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + int Base; + int vgaCRIndex, vgaCRReg, vgaIOBase; + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + if (psav->ShowCache && y) + y += pScrn->virtualY - 1; + + Base = ((y * pScrn->displayWidth + x) * + (pScrn->bitsPerPixel / 8)) >> 2; + /* now program the start address registers */ + VGAOUT16(vgaCRIndex, (Base & 0x00ff00) | 0x0c); + VGAOUT16(vgaCRIndex, ((Base & 0x00ff) << 8) | 0x0d); + VGAOUT8(vgaCRIndex, 0x69); + VGAOUT8(vgaCRReg, (Base & 0x7f0000) >> 16); + + return; +} + + +Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + return SavageModeInit(xf86Screens[scrnIndex], mode); +} + + +void SavageEnableMMIO(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + /*SavagePtr psav = SAVPTR(pScrn); */ + int vgaCRIndex, vgaCRReg; + unsigned char val; + + vgaHWSetStdFuncs(hwp); + val = VGAIN8(0x3c3); + VGAOUT8(0x3c3, val | 0x01); + val = VGAIN8(VGA_MISC_OUT_R); + outb(VGA_MISC_OUT_W, val | 0x01); + vgaHWGetIOBase(hwp); + vgaCRIndex = hwp->IOBase + 4; + vgaCRReg = hwp->IOBase + 5; + + VGAOUT8(vgaCRIndex, 0x40); + val = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, val | 1); + + return; +} + + +void SavageDisableMMIO(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + /*SavagePtr psav = SAVPTR(pScrn);*/ + int vgaCRIndex, vgaCRReg; + unsigned char val; + + vgaHWGetIOBase(hwp); + vgaCRIndex = hwp->IOBase + 4; + vgaCRReg = hwp->IOBase + 5; + + VGAOUT8(vgaCRIndex, 0x40); + val = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, val | 1); + + return; +} + + +void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, + LOCO *colors, VisualPtr pVisual) +{ + int i, index; + + for (i=0; i<numColors; i++) { + index = indicies[i]; + VGAOUT8(0x3c8, index); + VGAOUT8(0x3c9, colors[index].red); + VGAOUT8(0x3c9, colors[index].green); + VGAOUT8(0x3c9, colors[index].blue); + } +} + + + +static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, + int min_n2, int max_n2, long freq_min, + long freq_max, unsigned int *mdiv, + unsigned int *ndiv, unsigned int *r) +{ + double ffreq, ffreq_min, ffreq_max; + double div, diff, best_diff; + unsigned int m; + unsigned char n1, n2, best_n1=16+2, best_n2=2, best_m=125+2; + + ffreq = freq / 1000.0 / BASE_FREQ; + ffreq_max = freq_max / 1000.0 / BASE_FREQ; + ffreq_min = freq_min / 1000.0 / BASE_FREQ; + + if (ffreq < ffreq_min / (1 << max_n2)) { + ErrorF("invalid frequency %1.3f Mhz\n", + ffreq*BASE_FREQ); + ffreq = ffreq_min / (1 << max_n2); + } + if (ffreq > ffreq_max / (1 << min_n2)) { + ErrorF("invalid frequency %1.3f Mhz\n", + ffreq*BASE_FREQ); + ffreq = ffreq_max / (1 << min_n2); + } + + /* work out suitable timings */ + + best_diff = ffreq; + + for (n2=min_n2; n2<=max_n2; n2++) { + for (n1=min_n1+2; n1<=max_n1+2; n1++) { + m = (int)(ffreq * n1 * (1 << n2) + 0.5); + if (m < min_m+2 || m > 127+2) + continue; + div = (double)(m) / (double)(n1); + if ((div >= ffreq_min) && + (div <= ffreq_max)) { + diff = ffreq - div / (1 << n2); + if (diff < 0.0) + diff = -diff; + if (diff < best_diff) { + best_diff = diff; + best_m = m; + best_n1 = n1; + best_n2 = n2; + } + } + } + } + + *ndiv = best_n1 - 2; + *r = best_n2; + *mdiv = best_m - 2; +} + + +void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) +{ + unsigned char cr66; + int r, success = 0; + CARD32 fifo_control = 0, miu_control = 0; + CARD32 streams_timeout = 0, misc_timeout = 0; + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePtr psav = SAVPTR(pScrn); + int vgaCRIndex, vgaCRReg, vgaIOBase; + + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + if (from_timeout) { + if (psav->GEResetCnt++ < 10 || xf86GetVerbosity() > 1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SavageGEReset called from %s line %d\n", file, line); + } else + WaitIdleEmpty(); + + if (from_timeout) { + fifo_control = INREG(FIFO_CONTROL_REG); + miu_control = INREG(MIU_CONTROL_REG); + streams_timeout = INREG(STREAMS_TIMEOUT_REG); + misc_timeout = INREG(MISC_TIMEOUT_REG); + } + + VGAOUT8(vgaCRIndex, 0x66); + cr66 = VGAIN8(vgaCRReg); + + usleep(10000); + for (r=1; r<10; r++) { + VGAOUT8(vgaCRReg, cr66 | 0x02); + usleep(10000); + VGAOUT8(vgaCRReg, cr66 & ~0x02); + usleep(10000); + + if (!from_timeout) + WaitIdleEmpty(); + OUTREG(DEST_SRC_STR, psav->Bpl << 16 | psav->Bpl); + + usleep(10000); + switch(psav->Chipset) { + case S3_SAVAGE3D: + case S3_SAVAGE_MX: + success = (STATUS_WORD0 & 0x0008ffff) == 0x00080000; + break; + case S3_SAVAGE4: + case S3_PROSAVAGE: + success = (ALT_STATUS_WORD0 & 0x0081ffff) == 0x00800000; + break; + case S3_SAVAGE2000: + success = (ALT_STATUS_WORD0 & 0x008fffff) == 0; + break; + } + if(!success) { + usleep(10000); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "restarting S3 graphics engine reset %2d ...\n", r); + } + else + break; + } + + if (from_timeout) { + OUTREG(FIFO_CONTROL_REG, fifo_control); + OUTREG(MIU_CONTROL_REG, miu_control); + OUTREG(STREAMS_TIMEOUT_REG, streams_timeout); + OUTREG(MISC_TIMEOUT_REG, misc_timeout); + } + + WaitQueue(2); + OUTREG(SRC_BASE, 0); + OUTREG(DEST_BASE, 0); + + WaitQueue(4); + OUTREG(CLIP_L_R, ((0) << 16) | pScrn->displayWidth); + OUTREG(CLIP_T_B, ((0) << 16) | psav->ScissB); + OUTREG(MONO_PAT_0, ~0); + OUTREG(MONO_PAT_1, ~0); + SavageSetGBD(pScrn); +} + + + +/* This function is used to debug, it prints out the contents of s3 regs */ + +void +SavagePrintRegs(ScrnInfoPtr pScrn) +{ + unsigned char i; + int vgaCRIndex = 0x3d4; + int vgaCRReg = 0x3d5; + + ErrorF( "SR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF" ); + + for( i = 0; i < 0x70; i++ ) { + if( !(i % 16) ) + ErrorF( "\nSR%xx ", i >> 4 ); + outb( 0x3c4, i ); + ErrorF( " %02x", inb(0x3c5) ); + } + + ErrorF( "\n\nCR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF" ); + + for( i = 0; i < 0xB7; i++ ) { + if( !(i % 16) ) + ErrorF( "\nCR%xx ", i >> 4 ); + outb( vgaCRIndex, i ); + ErrorF( " %02x", inb(vgaCRReg) ); + } + + ErrorF("\n\n"); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h new file mode 100644 index 000000000..42e742415 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h @@ -0,0 +1,219 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.2 2000/12/02 15:30:49 tsi Exp $ */ + +#ifndef SAVAGE_VGAHWMMIO_H +#define SAVAGE_VGAHWMMIO_H + +#include "vgaHW.h" +#include "xf86.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86_OSproc.h" +#include "compiler.h" +#include "xf86Cursor.h" +#include "mipointer.h" +#include "micmap.h" +#include "cfb.h" +#include "cfb16.h" +#include "cfb32.h" +#include "xf86cmap.h" +#include "vbe.h" +#include "xaa.h" + +#include "savage_regs.h" + +#define VGAIN8(addr) inb(addr) +#define VGAIN16(addr) inw(addr) +#define VGAIN(addr) inl(addr) + +#define VGAOUT8(addr,val) outb(addr,val) +#define VGAOUT16(addr,val) outw(addr,val) +#define VGAOUT(addr,val) outl(addr,val) + +#define INREG(addr) MMIO_IN32(psav->MapBase, addr) +#define OUTREG(addr,val) MMIO_OUT32(psav->MapBase, addr, val) +#define INREG16(addr) MMIO_IN16(psav->MapBase, addr) +#define OUTREG16(addr,val) MMIO_OUT16(psav->MapBase, addr, val) + + +typedef struct _S3VMODEENTRY { + unsigned short Width; + unsigned short Height; + unsigned short VesaMode; + unsigned char RefreshCount; + unsigned char * RefreshRate; +} SavageModeEntry, *SavageModeEntryPtr; + + +typedef struct _S3VMODETABLE { + unsigned short NumModes; + SavageModeEntry Modes[1]; +} SavageModeTableRec, *SavageModeTablePtr; + + +typedef struct { + unsigned int mode, refresh; + unsigned char SR08, SR0A, SR0F; + unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR29; + unsigned char SR54[8]; + unsigned char Clock; + unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C; + unsigned char CR40, CR41, CR42, CR43, CR45; + unsigned char CR50, CR51, CR53, CR55, CR58, CR5B, CR5D, CR5E; + unsigned char CR60, CR63, CR65, CR66, CR67, CR68, CR69, CR6D, CR6F; + unsigned char CR86, CR88; + unsigned char CR90, CR91, CRB0; + unsigned char ColorStack[8]; + unsigned int STREAMS[22]; /* yuck, streams regs */ + unsigned int MMPR0, MMPR1, MMPR2, MMPR3; +} SavageRegRec, *SavageRegPtr; + + +typedef struct _Savage { + SavageRegRec SavedReg; + SavageRegRec ModeReg; + xf86CursorInfoPtr CursorInfoRec; + Bool ModeStructInit; + Bool NeedSTREAMS; + Bool STREAMSRunning; + int Bpp, Bpl, ScissB; + unsigned PlaneMask; + + int videoRambytes; + int videoRamKbytes; + int MemOffScreen; + CARD32 CursorKByte; + + /* These are physical addresses. */ + unsigned long FrameBufferBase; + unsigned long MmioBase; + + /* These are linear addresses. */ + unsigned char* MapBase; + unsigned char* BciMem; + unsigned char* MapBaseDense; + unsigned char* FBBase; + unsigned char* FBStart; + + Bool PrimaryVidMapped; + int dacSpeedBpp; + int minClock, maxClock; + int HorizScaleFactor; + int MCLK, REFCLK, LCDclk; + double refclk_fact; + int GEResetCnt; + + /* Here are all the Options */ + + Bool ShowCache; + Bool pci_burst; + Bool NoPCIRetry; + Bool fifo_conservative; + Bool fifo_moderate; + Bool fifo_aggressive; + Bool slow_edodram; + Bool slow_dram; + Bool fast_dram; + Bool fpm_vram; + Bool early_ras_precharge; + Bool hwcursor; + Bool NoAccel; + Bool shadowFB; + Bool UseBIOS; + int rotate; + + CloseScreenProcPtr CloseScreen; + pciVideoPtr PciInfo; + PCITAG PciTag; + int Chipset; + int ChipId; + int ChipRev; + vbeInfoPtr pVbe; + int EntityIndex; + + /* The various Savage wait handlers. */ + int (*myWaitQueue)(struct _Savage *, int); + int (*myWaitIdle)(struct _Savage *); + int (*myWaitIdleEmpty)(struct _Savage *); + int (*myWaitCommandEmpty)(struct _Savage *); + + /* Support for shadowFB and rotation */ + unsigned char * ShadowPtr; + int ShadowPitch; + void (*PointerMoved)(int index, int x, int y); + + /* Support for XAA acceleration */ + XAAInfoRecPtr AccelInfoRec; + xRectangle Rect; + unsigned int SavedBciCmd; + unsigned int SavedFgColor; + unsigned int SavedBgColor; + unsigned int SavedGbdOffset; + unsigned int SavedGbd; + unsigned int SavedSbdOffset; + unsigned int SavedSbd; + + /* Support for Int10 processing */ + xf86Int10InfoPtr pInt10; + SavageModeTablePtr ModeTable; + + /* Support for the Savage command overflow buffer. */ + unsigned long cobIndex; /* size index */ + unsigned long cobSize; /* size in bytes */ + unsigned long cobOffset; /* offset in frame buffer */ + +} SavageRec, *SavagePtr; + +/* Shortcuts. These depend on a local symbol "psav". */ + +#define WaitIdle() psav->myWaitIdle(psav) +#define WaitIdleEmpty() psav->myWaitIdleEmpty(psav) +#define WaitQueue(k) psav->myWaitQueue(psav,k) +#define WaitCommandEmpty() psav->myWaitCommandEmpty(psav) + +#define SAVPTR(p) ((SavagePtr)((p)->driverPrivate)) + +/* Prototypes. */ + +extern void SavageCommonCalcClock(long freq, int min_m, int min_n1, + int max_n1, int min_n2, int max_n2, + long freq_min, long freq_max, + unsigned char *mdiv, unsigned char *ndiv); +void SavageAdjustFrame(int scrnIndex, int y, int x, int flags); +Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); + +/* In savage_cursor.c. */ + +Bool SavageHWCursorInit(ScreenPtr pScreen); + +/* In savage_accel.c. */ + +Bool SavageInitAccel(ScreenPtr); +void SavageInitialize2DEngine(ScrnInfoPtr); +void SavageSetGBD(ScrnInfoPtr); + +/* In savage_shadow.c */ + +void SavagePointerMoved(int index, int x, int y); +void SavageRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SavageRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SavageRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SavageRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SavageRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +/* In savage_vbe.c */ + +void SavageSetTextMode( SavagePtr psav ); +void SavageSetVESAMode( SavagePtr psav, int n, int Refresh ); +void SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ); +SavageModeTablePtr SavageGetBIOSModeTable( SavagePtr psav, int iDepth ); + +unsigned short SavageGetBIOSModes( + SavagePtr psav, + int iDepth, + SavageModeEntryPtr s3vModeTable ); + + +#endif /* SAVAGE_VGAHWMMIO_H */ + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c new file mode 100644 index 000000000..382ac54b0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c @@ -0,0 +1,168 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.2 2000/12/04 18:50:00 dawes Exp $ */ + +#include "savage_driver.h" +#include "xaarop.h" +#include "savage_bci.h" + +#if 0 +void SavageWriteBitmapScreenToScreenColorExpand( + ScrnPtr pScrn, + int x, + int y, + int w, + int h, + unsigned char * src, + int srcwidth, + int srcx, + int srcy, + int bg, + int fg, + int rop, + unsigned int planemask +) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + unsigned int cmd; + unsigned char * bd_offset; + unsigned int bd; + + cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_SEND_COLOR + | BCI_CMD_DEST_GBD | BCI_CMD_SRC_SBD_MONO_NEW; + cmd |= (bg != -1) ? BCI_CMD_SEND_COLOR : BCI_CMD_SRC_TRANSPARENT; + cmd |= s3vAlu[rop]; + + bd |= BCI_BD_BW_DISABLE; + BCI_BD_SET_BPP(bd, 1); + BCI_BD_SET_STRIDE(bd, srcwidth); + bd_offset = srcwidth * srcy + (srcx >> 3) + src; + + WaitQueue(10); + BCI_SEND(cmd); + BCI_SEND((unsigned int)bd_offset); + BCI_SEND(bd); + BCI_SEND(fg); + BCI_SEND((bg != -1) ? bg : 0); + BCI_SEND(BCI_X_Y(srcx, srcy)); + BCI_SEND(BCI_X_Y(x, y)); + BCI_SEND(BCI_W_H(w, h)); +} +#endif + +void +SavageWriteBitmapCPUToScreenColorExpand ( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned char * src, + int srcwidth, + int skipleft, + int fg, int bg, + int rop, + unsigned int planemask +) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + int i, j, count, reset; + unsigned int cmd; + unsigned int * srcp; + +/* We aren't using planemask at all here... */ + + if( !srcwidth ) + return; + + cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_SEND_COLOR | BCI_CMD_CLIP_LR + | BCI_CMD_DEST_GBD | BCI_CMD_SRC_MONO; + cmd |= XAACopyROP[rop] << 16; + + if( bg == -1 ) + cmd |= BCI_CMD_SRC_TRANSPARENT; + + BCI_SEND(cmd); + BCI_SEND(BCI_CLIP_LR(x+skipleft, x+w-1)); + BCI_SEND(fg); + if( bg != -1 ) + BCI_SEND(bg); + + /* Bitmaps come in in units of DWORDS, LSBFirst. This is exactly */ + /* reversed of what we expect. */ + + count = (w + 31) / 32; +/* src += ((srcx & ~31) / 8); */ + + /* The BCI region is 128k bytes. A screen-sized mono bitmap can */ + /* exceed that. */ + + reset = 65536 / count; + + for (j = 0; j < h; j ++) { + BCI_SEND(BCI_X_Y(x, y+j)); + BCI_SEND(BCI_W_H(w, 1)); + srcp = (unsigned int*) src; + for (i = count; i > 0; srcp ++, i --) { + /* We have to invert the bits in each byte. */ + unsigned long u = *srcp; + u = ((u & 0x0f0f0f0f) << 4) | ((u & 0xf0f0f0f0) >> 4); + u = ((u & 0x33333333) << 2) | ((u & 0xcccccccc) >> 2); + u = ((u & 0x55555555) << 1) | ((u & 0xaaaaaaaa) >> 1); + BCI_SEND(u); + } + src += srcwidth; + if( !--reset ) { + BCI_RESET; + reset = 65536 / count; + } + } +} + +void +SavageSetupForImageWrite( + ScrnInfoPtr pScrn, + int rop, + unsigned planemask, + int transparency_color, + int bpp, + int depth) +{ + SavagePtr psav = SAVPTR(pScrn); + int cmd; + + cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP + | BCI_CMD_CLIP_LR + | BCI_CMD_DEST_GBD | BCI_CMD_SRC_COLOR; + + cmd |= XAACopyROP[rop] << 16; + + if( transparency_color != -1 ) + cmd |= BCI_CMD_SRC_TRANSPARENT; + + psav->SavedBciCmd = cmd; + psav->SavedBgColor = transparency_color; +} + + +void SavageSubsequentImageWriteRect +( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft) +{ + SavagePtr psav = SAVPTR(pScrn); + BCI_GET_PTR; + int count; + + count = ((w * pScrn->bitsPerPixel + 31) / 32) * h; + WaitQueue( count ); + BCI_SEND(psav->SavedBciCmd); + BCI_SEND(BCI_CLIP_LR(x+skipleft, x+w-1)); + if( psav->SavedBgColor != -1 ) + BCI_SEND(psav->SavedBgColor); + BCI_SEND(BCI_X_Y(x, y)); + BCI_SEND(BCI_W_H(w, h)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h new file mode 100644 index 000000000..b1a21ea93 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h @@ -0,0 +1,108 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.3 2000/12/04 18:50:00 dawes Exp $ */ + +#ifndef _SAVAGE_REGS_H +#define _SAVAGE_REGS_H + +#include "savage_driver.h" + +#define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) + +#define S3_SAVAGE4_SERIES(chip) ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE)) + +#define S3_SAVAGE_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000)) + + +/* Chip tags. These are used to group the adapters into + * related families. + */ + +enum S3CHIPTAGS { + S3_UNKNOWN = 0, + S3_SAVAGE3D, + S3_SAVAGE_MX, + S3_SAVAGE4, + S3_PROSAVAGE, + S3_SAVAGE2000, + S3_LAST +}; + +#define BIOS_BSIZE 1024 +#define BIOS_BASE 0xc0000 + +#define SAVAGE_NEWMMIO_REGBASE_S3 0x1000000 /* 16MB */ +#define SAVAGE_NEWMMIO_REGBASE_S4 0x0000000 +#define SAVAGE_NEWMMIO_REGSIZE 0x0080000 /* 512kb */ +#define SAVAGE_NEWMMIO_VGABASE 0x8000 + +#define BASE_FREQ 14.31818 + +#define FIFO_CONTROL_REG 0x8200 +#define MIU_CONTROL_REG 0x8204 +#define STREAMS_TIMEOUT_REG 0x8208 +#define MISC_TIMEOUT_REG 0x820c + +#define PSTREAM_CONTROL_REG 0x8180 +#define COL_CHROMA_KEY_CONTROL_REG 0x8184 +#define SSTREAM_CONTROL_REG 0x8190 +#define CHROMA_KEY_UPPER_BOUND_REG 0x8194 +#define SSTREAM_STRETCH_REG 0x8198 +#define BLEND_CONTROL_REG 0x81a0 +#define PSTREAM_FBADDR0_REG 0x81c0 +#define PSTREAM_FBADDR1_REG 0x81c4 +#define PSTREAM_STRIDE_REG 0x81c8 +#define DOUBLE_BUFFER_REG 0x81cc +#define SSTREAM_FBADDR0_REG 0x81d0 +#define SSTREAM_FBADDR1_REG 0x81d4 +#define SSTREAM_STRIDE_REG 0x81d8 +#define OPAQUE_OVERLAY_CONTROL_REG 0x81dc +#define K1_VSCALE_REG 0x81e0 +#define K2_VSCALE_REG 0x81e4 +#define DDA_VERT_REG 0x81e8 +#define STREAMS_FIFO_REG 0x81ec +#define PSTREAM_START_REG 0x81f0 +#define PSTREAM_WINDOW_SIZE_REG 0x81f4 +#define SSTREAM_START_REG 0x81f8 +#define SSTREAM_WINDOW_SIZE_REG 0x81fC + +#define SUBSYS_STAT_REG 0x8504 + +#define SRC_BASE 0xa4d4 +#define DEST_BASE 0xa4d8 +#define CLIP_L_R 0xa4dc +#define CLIP_T_B 0xa4e0 +#define DEST_SRC_STR 0xa4e4 +#define MONO_PAT_0 0xa4e8 +#define MONO_PAT_1 0xa4ec + + +/* Constants for CR69. */ + +#define CRT_ACTIVE 0x01 +#define LCD_ACTIVE 0x02 +#define TV_ACTIVE 0x04 +#define CRT_ATTACHED 0x10 +#define LCD_ATTACHED 0x20 +#define TV_ATTACHED 0x40 + + +/* + * reads from SUBSYS_STAT + */ +#define STATUS_WORD0 (INREG(0x48C00)) +#define ALT_STATUS_WORD0 (INREG(0x48C60)) +#define MAXLOOP 0xffffff +#define IN_SUBSYS_STAT() (INREG(SUBSYS_STAT_REG)) + +#define MAXFIFO 0x7f00 + +#define VerticalRetraceWait() \ +{ \ + outb(vgaCRIndex, 0x17); \ + if (inb(vgaCRReg) & 0x80) { \ + while ((inb(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ + while ((inb(vgaIOBase + 0x0a) & 0x08) == 0x08) ; \ + while ((inb(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ + } \ +} + +#endif /* _SAVAGE_REGS_H */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c new file mode 100644 index 000000000..93e1ed084 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c @@ -0,0 +1,244 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c,v 1.1 2000/12/02 01:16:14 dawes Exp $ */ + +/* + Copyright (c) 1999,2000 The XFree86 Project Inc. + based on code written by Mark Vojkovich <markv@valinux.com> +*/ + +#include "savage_driver.h" +#include "shadowfb.h" +#include "servermd.h" + + +void +SavageRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SavagePtr psav = SAVPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + + while(num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = psav->ShadowPtr + (pbox->y1 * psav->ShadowPitch) + + (pbox->x1 * Bpp); + dst = psav->FBStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + + while(height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += psav->ShadowPitch; + } + + pbox++; + } +} + + +void +SavagePointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + SavagePtr psav = SAVPTR(pScrn); + int newX, newY; + + if(psav->rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + + (*psav->PointerMoved)(index, newX, newY); +} + +void +SavageRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SavagePtr psav = SAVPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -psav->rotate * psav->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if(psav->rotate == 1) { + dstPtr = psav->FBStart + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = psav->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = psav->FBStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = psav->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch * 2] << 16) | + (src[srcPitch * 3] << 24); + src += srcPitch * 4; + } + srcPtr += psav->rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +void +SavageRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SavagePtr psav = SAVPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -psav->rotate * psav->ShadowPitch >> 1; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + + if(psav->rotate == 1) { + dstPtr = (CARD16*)psav->FBStart + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16*)psav->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16*)psav->FBStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16*)psav->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch * 2; + } + srcPtr += psav->rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +/* this one could be faster */ +void +SavageRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SavagePtr psav = SAVPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = BitmapBytePad(pScrn->displayWidth * 24); + srcPitch = -psav->rotate * psav->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* blocks of 3 dwords */ + + if(psav->rotate == 1) { + dstPtr = psav->FBStart + + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); + srcPtr = psav->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); + } else { + dstPtr = psav->FBStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); + srcPtr = psav->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | + (src[srcPitch] << 24); + dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | + (src[srcPitch * 2] << 16) | + (src[(srcPitch * 2) + 1] << 24); + dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) | + (src[(srcPitch * 3) + 1] << 16) | + (src[(srcPitch * 3) + 2] << 24); + dst += 3; + src += srcPitch * 4; + } + srcPtr += psav->rotate * 3; + dstPtr += dstPitch; + } + + pbox++; + } +} + +void +SavageRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SavagePtr psav = SAVPTR(pScrn); + int count, width, height, dstPitch, srcPitch; + CARD32 *dstPtr, *srcPtr, *src, *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -psav->rotate * psav->ShadowPitch >> 2; + + while(num--) { + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + + if(psav->rotate == 1) { + dstPtr = (CARD32*)psav->FBStart + + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; + srcPtr = (CARD32*)psav->ShadowPtr + + ((1 - pbox->y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD32*)psav->FBStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; + srcPtr = (CARD32*)psav->ShadowPtr + + (pbox->y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = dstPtr; + count = height; + while(count--) { + *(dst++) = *src; + src += srcPitch; + } + srcPtr += psav->rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c new file mode 100644 index 000000000..0b24d29d3 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c @@ -0,0 +1,257 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.1 2000/12/02 01:16:15 dawes Exp $ */ + +#include "savage_driver.h" +#include "savage_vbe.h" + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +#define B_O16(x) (x) +#define B_O32(x) (x) +#else +#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) +#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ + | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) +#endif +#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) + +static void +SavageClearVM86Regs( xf86Int10InfoPtr pInt ) +{ + pInt->ax = 0; + pInt->bx = 0; + pInt->cx = 0; + pInt->dx = 0; + pInt->si = 0; + pInt->di = 0; + pInt->es = 0xc000; + pInt->num = 0x10; +} + +void +SavageSetTextMode( SavagePtr psav ) +{ +#if 0 + ioperm( 0x80, 1, 1 ); + ioperm( 0x61, 1, 1 ); + ioperm( 0x40, 4, 1 ); +#endif + + SavageClearVM86Regs( psav->pInt10 ); + + psav->pInt10->ax = 0x83; + + xf86ExecX86int10( psav->pInt10 ); + +#if 0 + ioperm( 0x40, 4, 0 ); + ioperm( 0x61, 1, 0 ); + ioperm( 0x80, 1, 1 ); +#endif +} + + +void +SavageSetVESAMode( SavagePtr psav, int n, int Refresh ) +{ +#if 0 + /* + * The Savage BIOS writes to a debug card on port 80h and to the + * timer chip at port 61. + */ + ioperm( 0x80, 1, 1 ); + ioperm( 0x61, 1, 1 ); + ioperm( 0x40, 4, 1 ); +#endif + + /* First, establish the refresh rate for this mode. */ + + SavageClearVM86Regs( psav->pInt10 ); + + xf86ExecX86int10( psav->pInt10 ); + + psav->pInt10->ax = 0x4f14; /* S3 extensions */ + psav->pInt10->bx = 0x0001; /* Set default refresh rate */ + psav->pInt10->cx = n; + psav->pInt10->di = Refresh; + + xf86ExecX86int10( psav->pInt10 ); + + /* Now, make this mode current. */ + + SavageClearVM86Regs( psav->pInt10 ); + psav->pInt10->ax = 0x4f02; /* Set vesa mode extensions */ + psav->pInt10->bx = n; /* Mode number */ + + xf86ExecX86int10( psav->pInt10 ); + + if ( (psav->pInt10->ax & 0xff) != 0x4f) + { + ErrorF("Set video mode failed\n"); + } + +#if 0 + ioperm( 0x40, 4, 0 ); + ioperm( 0x61, 1, 0 ); + ioperm( 0x80, 1, 1 ); +#endif +} + + +void +SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ) +{ + int i; + SavageModeEntryPtr pMode = (*ppTable)->Modes; + + for( i = (*ppTable)->NumModes; i--; ) + { + if( pMode->RefreshRate ) + { + xfree( pMode->RefreshRate ); + pMode->RefreshRate = NULL; + } + } + + xfree( *ppTable ); +} + + +SavageModeTablePtr +SavageGetBIOSModeTable( SavagePtr psav, int iDepth ) +{ + int nModes = SavageGetBIOSModes( psav, iDepth, NULL ); + SavageModeTablePtr pTable; + + pTable = (SavageModeTablePtr) + xcalloc( 1, sizeof(SavageModeTableRec) + + (nModes-1) * sizeof(SavageModeEntry) ); + if( pTable ) { + pTable->NumModes = nModes; + SavageGetBIOSModes( psav, iDepth, pTable->Modes ); + } + + return pTable; +} + + +unsigned short +SavageGetBIOSModes( + SavagePtr psav, + int iDepth, + SavageModeEntryPtr s3vModeTable ) +{ + unsigned short iModeCount = 0; + short int *mode_list; + pointer vbeLinear = NULL; + vbeControllerInfoPtr vbe = NULL; + int vbeReal; + struct vbe_mode_info_block * vmib; + + if( !psav->pVbe ) + return 0; + + vbe = (vbeControllerInfoPtr) psav->pVbe->memory; + + mode_list = xf86int10Addr( psav->pInt10, L_ADD(vbe->VideoModePtr) ); + + vbeLinear = xf86Int10AllocPages( psav->pInt10, 1, &vbeReal ); + vmib = (struct vbe_mode_info_block *) vbeLinear; + + while (*mode_list != -1) + { + /* + * This is a HACK to work around what I believe is a BUG in the + * Toshiba Satellite BIOSes in 08/2000 and 09/2000. The BIOS + * table for 1024x600 says it has six refresh rates, when in fact + * it only has 3. This causes the BIOS to go into an infinite + * loop until the user interrupts it, usually by pressing + * Ctrl-Alt-F1. For now, we'll just punt everything with a VESA + * number greater than or equal to 0200. + */ + if( *mode_list >= 0x0200 ) + { + mode_list++; + continue; + } + + SavageClearVM86Regs( psav->pInt10 ); + + psav->pInt10->ax = 0x4f01; + psav->pInt10->cx = *mode_list; + psav->pInt10->es = SEG_ADDR(vbeReal); + psav->pInt10->di = SEG_OFF(vbeReal); + psav->pInt10->num = 0x10; + + xf86ExecX86int10( psav->pInt10 ); + + if( + (vmib->bits_per_pixel == iDepth) && + ( + (vmib->memory_model == VBE_MODEL_256) || + (vmib->memory_model == VBE_MODEL_PACKED) || + (vmib->memory_model == VBE_MODEL_RGB) + ) + ) + { + /* This mode is a match. */ + + iModeCount++; + + /* If we're supposed to fetch information, do it now. */ + + if( s3vModeTable ) + { + int iRefresh = 0; + + s3vModeTable->Width = vmib->x_resolution; + s3vModeTable->Height = vmib->y_resolution; + s3vModeTable->VesaMode = *mode_list; + + /* Query the refresh rates at this mode. */ + + psav->pInt10->cx = *mode_list; + psav->pInt10->dx = 0; + + do + { + if( (iRefresh % 8) == 0 ) + { + if( s3vModeTable->RefreshRate ) + { + s3vModeTable->RefreshRate = (unsigned char *) + xrealloc( + s3vModeTable->RefreshRate, + (iRefresh+8) * sizeof(unsigned char) + ); + } + else + { + s3vModeTable->RefreshRate = (unsigned char *) + xcalloc( + sizeof(unsigned char), + (iRefresh+8) + ); + } + } + + psav->pInt10->ax = 0x4f14; /* S3 extended functions */ + psav->pInt10->bx = 0x0201; /* query refresh rates */ + psav->pInt10->num = 0x10; + xf86ExecX86int10( psav->pInt10 ); + + s3vModeTable->RefreshRate[iRefresh++] = psav->pInt10->di; + } + while( psav->pInt10->dx ); + + s3vModeTable->RefreshCount = iRefresh; + + s3vModeTable++; + } + } + + mode_list++; + } + + xf86Int10FreePages( psav->pInt10, vbeLinear, 1 ); + + return iModeCount; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h new file mode 100644 index 000000000..ad0cafa74 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h @@ -0,0 +1,113 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v 1.2 2000/12/04 22:41:54 dawes Exp $ */ + +/* +This file was originally part of the Linux Real-Mode Interface, or LRMI. +There is nothing LRMI-specific here; this is all good, general VBE info. + +Copyright (C) 1996 by Josh Vanderhoof + +You are free to distribute and modify this file, as long as you +do not remove this copyright notice and clearly label modified +versions as being modified. + +This software has NO WARRANTY. Use it at your own risk. +*/ + +#ifndef _SAVAGEVBE_H +#define _SAVAGEVBE_H + +/* structures for vbe 2.0 */ + +#ifndef __GNUC__ +#define __attribute__(a) +#endif + +struct vbe_info_block + { + char vbe_signature[4]; + short vbe_version; + unsigned short oem_string_off; + unsigned short oem_string_seg; + int capabilities; + unsigned short video_mode_list_off; + unsigned short video_mode_list_seg; + short total_memory; + short oem_software_rev; + unsigned short oem_vendor_name_off; + unsigned short oem_vendor_name_seg; + unsigned short oem_product_name_off; + unsigned short oem_product_name_seg; + unsigned short oem_product_rev_off; + unsigned short oem_product_rev_seg; + char reserved[222]; + char oem_data[256]; + } __attribute__ ((packed)); + +#define VBE_ATTR_MODE_SUPPORTED (1 << 0) +#define VBE_ATTR_TTY (1 << 2) +#define VBE_ATTR_COLOR (1 << 3) +#define VBE_ATTR_GRAPHICS (1 << 4) +#define VBE_ATTR_NOT_VGA (1 << 5) +#define VBE_ATTR_NOT_WINDOWED (1 << 6) +#define VBE_ATTR_LINEAR (1 << 7) + +#define VBE_WIN_RELOCATABLE (1 << 0) +#define VBE_WIN_READABLE (1 << 1) +#define VBE_WIN_WRITEABLE (1 << 2) + +#define VBE_MODEL_TEXT 0 +#define VBE_MODEL_CGA 1 +#define VBE_MODEL_HERCULES 2 +#define VBE_MODEL_PLANAR 3 +#define VBE_MODEL_PACKED 4 +#define VBE_MODEL_256 5 +#define VBE_MODEL_RGB 6 +#define VBE_MODEL_YUV 7 + +struct vbe_mode_info_block + { + unsigned short mode_attributes; + unsigned char win_a_attributes; + unsigned char win_b_attributes; + unsigned short win_granularity; + unsigned short win_size; + unsigned short win_a_segment; + unsigned short win_b_segment; + unsigned short win_func_ptr_off; + unsigned short win_func_ptr_seg; + unsigned short bytes_per_scanline; + unsigned short x_resolution; + unsigned short y_resolution; + unsigned char x_char_size; + unsigned char y_char_size; + unsigned char number_of_planes; + unsigned char bits_per_pixel; + unsigned char number_of_banks; + unsigned char memory_model; + unsigned char bank_size; + unsigned char number_of_image_pages; + unsigned char res1; + unsigned char red_mask_size; + unsigned char red_field_position; + unsigned char green_mask_size; + unsigned char green_field_position; + unsigned char blue_mask_size; + unsigned char blue_field_position; + unsigned char rsvd_mask_size; + unsigned char rsvd_field_position; + unsigned char direct_color_mode_info; + unsigned int phys_base_ptr; + unsigned int offscreen_mem_offset; + unsigned short offscreen_mem_size; + unsigned char res2[206]; + } __attribute__ ((packed)); + +struct vbe_palette_entry + { + unsigned char blue; + unsigned char green; + unsigned char red; + unsigned char align; + } __attribute__ ((packed)); + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c index 339ffffb7..1bbb6f7e7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project or Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.4 2000/12/02 15:30:50 tsi Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -84,7 +84,7 @@ static void SMI_FreeScreen(int ScrnIndex, int flags); static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index); -#define SILICONMOTION_NAME "Silicon Motion" +#define SILICONMOTION_NAME "Silicon Motion" #define SILICONMOTION_DRIVER_NAME "siliconmotion" #define SILICONMOTION_VERSION_NAME "1.1.8" #define SILICONMOTION_VERSION_MAJOR 1 @@ -411,7 +411,7 @@ static Bool SMI_Probe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -439,11 +439,7 @@ SMI_Probe(DriverPtr drv, int flags) numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ - if (devSections) - { - xfree(devSections); - } - devSections = NULL; + xfree(devSections); if (numUsed <= 0) { LEAVE_PROC("SMI_Probe"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile index 04819e1c8..b25dd5fcf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.21 2000/11/09 11:32:21 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.22 2000/12/02 01:16:16 dawes Exp $ XCOMM XCOMM This is an Imakefile for the SIS driver. XCOMM @@ -15,10 +15,10 @@ DRIDEFINES = $(GLX_DEFINES) #endif SRCS = sis_driver.c sis_dac.c sis_cursor.c sis_accel.c sis_setup.c\ - sis530_accel.c sis300_accel.c sis_vga.c sis_vb.c\ + sis530_accel.c sis300_accel.c sis_vga.c sis_vb.c sis_video.c\ sis_opt.c init300.c init301.c sis_dga.c $(DRISRCS) OBJS = sis_driver.o sis_dac.o sis_cursor.o sis_accel.o sis_setup.o\ - sis530_accel.o sis300_accel.o sis_vga.o sis_vb.o\ + sis530_accel.o sis300_accel.o sis_vga.o sis_vb.o sis_video.o\ sis_opt.o init300.o init301.o sis_dga.o $(DRIOBJS) #if defined(XF86DriverSDK) @@ -26,7 +26,7 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ -I$(XF86SRC)/xf24_32bpp \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c index 261d29ee1..c80dc34ae 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c,v 1.4 2000/09/26 15:57:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c,v 1.6 2000/12/02 15:30:50 tsi Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -43,19 +43,29 @@ Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) SetReg1(P3c4, 0x20, 0xa1); SetReg1(P3c4, 0x1E, 0x5A); - if(pSiS->LVDSFlags) + if(pSiS->VBFlags & VB_LVDS) IF_DEF_LVDS = 1; else IF_DEF_LVDS = 0; + if(pSiS->VBFlags & VB_CHRONTEL) + IF_DEF_CH7005 = 1; + else + IF_DEF_CH7005 = 0; + + +/* ynlai begin */ + IF_DEF_HiVision=0; +/* ynlai end */ PresetScratchregister(P3d4); /* add for CRT2 */ /* replace GetSenseStatus,SetTVSystem,SetDisplayInfo */ + DisplayOff(); SetReg1(P3c4,0x05,0x86); /* 1.Openkey */ temp=SearchModeID(ROMAddr,ModeNo); /* 2.Get ModeID Table */ if(temp==0) return(0); - SetTVSystem(); /* add for CRT2 */ + /* SetTVSystem(); */ /* add for CRT2 */ /*GetLCDDDCInfo(pScrn);*/ /* add for CRT2 */ GetVBInfo(BaseAddr,ROMAddr); /* add for CRT2 */ GetLCDResInfo(ROMAddr, P3d4); /* add for CRT2 */ @@ -95,10 +105,14 @@ Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) if(((cr30flag&0x01)==1)||((cr30flag&0x03)==0x02)|| (((cr30flag&0x03)==0x00)&&((cr31flag&0x20)==0x20))) { /* if CR30 d[0]=1 or d[1:0]=10, set CRT2 or cr30 cr31== 0x00 0x20 */ - SetCRT2Group(BaseAddr,ROMAddr,ModeNo, pScrn); /* add for CRT2 */ + SetCRT2Group(BaseAddr,ROMAddr,ModeNo, pScrn); /* add for CRT2 */ } +/* ynlai begin test */ +/* ynlai end test */ + SetPitch(pScrn, BaseAddr); /* 16.SetPitch */ + WaitVertical(); DisplayOn(); /* 17.DisplayOn */ return TRUE; } @@ -166,6 +180,13 @@ VOID SetSeqRegs(ULONG ROMAddr) StandTable=StandTable+0x05; SRdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get SR01 from file */ if(IF_DEF_LVDS==1){ + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + if(VBInfo&SetInSlaveMode) { + SRdata=SRdata|0x01; + } + } + } if(VBInfo&SetCRT2ToLCD){ if(VBInfo&SetInSlaveMode){ if(LCDInfo&LCDNonExpanding){ @@ -217,13 +238,16 @@ VOID SetATTRegs(ULONG ROMAddr) StandTable++; ARdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get AR for file */ if(IF_DEF_LVDS==1){ /*for LVDS*/ + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + if(VBInfo&SetInSlaveMode) { + if(i==0x13) ARdata=0; + } + } + } if(VBInfo&SetCRT2ToLCD){ if(VBInfo&SetInSlaveMode){ - if(LCDInfo&LCDNonExpanding){ - if(i==0x13){ - ARdata=0; - } - } + if(i==0x13) ARdata=0; } } } @@ -231,15 +255,7 @@ VOID SetATTRegs(ULONG ROMAddr) SetReg3(P3c0,i); /* set index */ SetReg3(P3c0,ARdata); /* set data */ } - if(IF_DEF_LVDS==1){ /*for LVDS*/ - if(VBInfo&SetCRT2ToLCD){ - if(VBInfo&SetInSlaveMode){ - if(LCDInfo&LCDNonExpanding){ - - } - } - } - } + GetReg2(P3da); /* reset 3da */ SetReg3(P3c0,0x14); /* set index */ SetReg3(P3c0,0x00); /* set data */ @@ -623,6 +639,15 @@ VOID DisplayOn() SetReg1(P3c4,0x01,data); } +VOID DisplayOff() +{ + USHORT data; + + data=GetReg1(P3c4,0x01); + data=data|0x20; + SetReg1(P3c4,0x01,data); +} + VOID SetReg1(USHORT port, USHORT index, USHORT data) { outb(port ,(UCHAR)(index & 0xff)); @@ -1076,3 +1101,19 @@ USHORT CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode) Rate |= Rate << 4; return(Rate); } + +VOID WaitVertical(VOID) +{ + USHORT tempax,tempdx; + +/* tempdx=0x3da; + do { + tempax=GetReg2(tempdx); + } while(!(tempax&01)); + + do { + tempax=GetReg2(tempdx); + } while(!(tempax&01)); +*/ + +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h index 76de15da2..ffb754ac5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h,v 1.3 2000/09/22 11:35:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h,v 1.4 2000/12/02 01:16:16 dawes Exp $ */ #include "initdef.h" @@ -74,6 +74,8 @@ int RAMType; int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData,MCLKData, ECLKData; int REFIndex,ModeType; USHORT IF_DEF_LVDS; +USHORT IF_DEF_HiVision; +USHORT IF_DEF_CH7005; USHORT VBInfo,LCDResInfo,LCDTypeInfo,LCDInfo; USHORT CalcRefreshRate(ScrnInfoPtr, DisplayModePtr); @@ -96,6 +98,7 @@ VOID SetCRT1FIFO2(ULONG); VOID SetCRT1VCLK(ULONG); VOID LoadDAC(ULONG); VOID DisplayOn(); +VOID DisplayOff(); VOID SetPitch(ScrnInfoPtr, USHORT); VOID SetCRT1ModeRegs(ULONG, USHORT); VOID SetVCLKState(ULONG, USHORT); @@ -105,6 +108,7 @@ USHORT GetRefindexLength(ULONG, USHORT); VOID SetInterlace(ULONG, USHORT); USHORT CalcDelay2(ULONG ,USHORT); USHORT CalcDelay(ULONG ,USHORT); +VOID WaitVertical(VOID); extern BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); extern VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c index e2ff6bea7..5cde319e6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.2 2000/09/22 11:35:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.3 2000/12/02 01:16:16 dawes Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -34,12 +34,13 @@ BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, ScrnInfoPtr pS } SetGroup1(BaseAddr,ROMAddr,ModeNo,pScrn); if(IF_DEF_LVDS==0) { - SetGroup2(BaseAddr,ROMAddr); - SetGroup3(BaseAddr); + SetGroup2(BaseAddr,ROMAddr,ModeNo); + SetGroup3(BaseAddr,ROMAddr); SetGroup4(BaseAddr,ROMAddr,ModeNo); SetGroup5(BaseAddr,ROMAddr); } else { + if(IF_DEF_CH7005==1) SetCHTVReg(ROMAddr,ModeNo); ModCRT1CRTC(ROMAddr,ModeNo); SetCRT2ECLK(ROMAddr,ModeNo); } @@ -73,22 +74,35 @@ VOID SetDefCRT2ExtRegs(USHORT BaseAddr) } USHORT GetRatePtrCRT2(ULONG ROMAddr, USHORT ModeNo) -{ /* return bit0=>0:standard mode 1:extended mode */ - SHORT index; /* bit1=>0:crt2 no support this mode */ - USHORT temp; /* 1:crt2 support this mode */ +{ /* return bit0=>0:standard mode 1:extended mode */ + SHORT index; /* bit1=>0:crt2 no support this mode */ + USHORT temp; /* 1:crt2 support this mode */ USHORT ulRefIndexLength; - USHORT temp1; + USHORT temp1,modeflag1,Flag; SHORT LCDRefreshIndex[2]={0x03,0x01}; - if(ModeNo<0x14) return(0); /* Mode No <= 13h then return */ + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK) return(0); + } + } + if(ModeNo<0x14) return(0); /* Mode No <= 13h then return */ - index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ - index=index>>SelectCRT2Rate; /* For CRT2,cl=SelectCRT2Rate=4, shr ah,cl */ - index=index&0x0F; /* Frame rate index */ + index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=index>>SelectCRT2Rate; /* For CRT2,cl=SelectCRT2Rate=4, shr ah,cl */ + index=index&0x0F; /* Frame rate index */ if(index!=0) index--; if(SetFlag&ProgrammingCRT2){ - if(VBInfo&SetCRT2ToLCD){ + Flag=1; + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + index=0; + Flag=0; + } + } + if((Flag)&&(VBInfo&SetCRT2ToLCD)){ if(IF_DEF_LVDS==0) { temp=LCDResInfo; temp1=LCDRefreshIndex[temp]; @@ -132,14 +146,13 @@ USHORT GetRatePtrCRT2(ULONG ROMAddr, USHORT ModeNo) temp1=0; } -/* REFIndex=0x2598; */ return(0x01|(temp1<<1)); } BOOLEAN AjustCRT2Rate(ULONG ROMAddr) { - USHORT tempax,tempbx=0,temp; - USHORT tempextinfoflag; + USHORT tempax,tempbx=0,temp,resinfo; + USHORT tempextinfoflag,Flag; tempax=0; if(IF_DEF_LVDS==0) { if(VBInfo&SetCRT2ToRAMDAC){ @@ -149,41 +162,55 @@ BOOLEAN AjustCRT2Rate(ULONG ROMAddr) tempax=tempax|SupportLCD; if(LCDResInfo!=Panel1280x1024){ temp=*((UCHAR *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ - if(temp>=9){ - tempax=0; + if(temp>=9) tempax=0; + } + } +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempax=tempax|SupportHiVisionTV; + if(VBInfo&SetInSlaveMode){ + resinfo=*((UCHAR *)(ROMAddr+ModeIDOffset+0x09)); /*si+Ext_ResInfo */ + if(resinfo==4) return(0); + if(resinfo==3) { + if(SetFlag&TVSimuMode) return(0); } + if(resinfo>7) return(0); } } - if(VBInfo&(SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)){ - tempax=tempax|SupportTV; - if(!(VBInfo&SetPALTV)){ - tempextinfoflag=*((USHORT *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ - if(tempextinfoflag&NoSupportSimuTV){ - if(VBInfo&SetInSlaveMode){ - if(!(VBInfo&SetNotSimuTVMode)){ - return 0; + else { + if(VBInfo&(SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)){ + tempax=tempax|SupportTV; + if(!(VBInfo&SetPALTV)){ + tempextinfoflag=*((USHORT *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag&NoSupportSimuTV){ + if(VBInfo&SetInSlaveMode){ + if(!(VBInfo&SetNotSimuMode)){ + return 0; + } } } } } } +/* ynlai end */ tempbx=*((USHORT *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ } - else { + else { /* for LVDS */ + Flag=1; + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + tempax=tempax|SupportCHTV; + Flag=0; + } + } tempbx=*((USHORT *)(ROMAddr+ModeIDOffset+0x04)); - if(VBInfo&SetCRT2ToLCD){ + if((Flag)&&(VBInfo&SetCRT2ToLCD)){ tempax=tempax|SupportLCD; temp=*((UCHAR *)(ROMAddr+ModeIDOffset+0x09)); /*si+Ext_ResInfo */ - if(temp>0x08){ /*1024x768 */ - return 0; - } + if(temp>0x08) return(0); /*1024x768 */ if(LCDResInfo<Panel1024x768){ - if(temp>0x07){ /*800x600 */ - return 0; - } - if(temp==0x04){ /*512x384 */ - return 0; - } + if(temp>0x07) return(0); /*800x600 */ + if(temp==0x04) return(0); /*512x384 */ } } } @@ -241,7 +268,7 @@ VOID DisableBridge(USHORT BaseAddr) if(IF_DEF_LVDS==0) { part2_02=(UCHAR)GetReg1(Part2Port,0x02); part2_05=(UCHAR)GetReg1(Part2Port,0x05); - if(!WaitVBRetrace(BaseAddr)) /* return 0:no enable read dram */ +/* if(!WaitVBRetrace(BaseAddr)) */ /* return 0:no enable read dram */ { LongWait(); DisableLockRegs(); @@ -326,7 +353,7 @@ VOID GetCRT2DataLVDS(ULONG ROMAddr,USHORT ModeNo) VOID GetCRT2Data301(ULONG ROMAddr,USHORT ModeNo) { USHORT tempax,tempbx,modeflag1,OldREFIndex; - USHORT tempal,tempah,tempbl; + USHORT tempal,tempah,tempbl,resinfo; OldREFIndex=REFIndex; /* push di */ RVBHRS=50;NewFlickerMode=0;RY1COE=0; @@ -367,7 +394,6 @@ VOID GetCRT2Data301(ULONG ROMAddr,USHORT ModeNo) tempax=*((USHORT *)(ROMAddr+REFIndex+6)); tempax=((tempax>>4)&0x07FF); VDE=tempax; - /* skipp something about hivisiontv */ tempax=*((USHORT *)(ROMAddr+REFIndex+8)); tempbl=(tempax>>8); tempax=tempax&0x0FFF; @@ -376,21 +402,50 @@ VOID GetCRT2Data301(ULONG ROMAddr,USHORT ModeNo) tempax=*((USHORT *)(ROMAddr+REFIndex+10)); } RVBHRS=tempax; - NewFlickerMode=(tempbl&0x080); - - tempax=*((USHORT *)(ROMAddr+REFIndex+12)); - RY1COE=(tempax&0x00FF); - RY2COE=((tempax&0xFF00)>>8); - tempax=*((USHORT *)(ROMAddr+REFIndex+14)); - RY3COE=(tempax&0x00FF); - RY4COE=((tempax&0xFF00)>>8); - if(!(VBInfo&SetPALTV)){ - tempax=NTSCHT; - tempbx=NTSCVT; - }else{ - tempax=PALHT; - tempbx=PALVT; +/* ynlai begin */ + tempbl=tempbl&0x80; + if(IF_DEF_HiVision==1) { + resinfo=*((UCHAR *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ + if(resinfo==8) tempbl=0x40; + else if(resinfo==9) tempbl=0x40; + else if(resinfo==10) tempbl=0x40; } +/* ynlai end */ + NewFlickerMode=tempbl; + +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(VGAVDE==350) SetFlag=SetFlag|TVSimuMode; + tempax=ExtHiTVHT; + tempbx=ExtHiTVVT; + if(VBInfo&SetInSlaveMode) { + if(SetFlag&TVSimuMode) { + tempax=StHiTVHT; + tempbx=StHiTVVT; + modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(modeflag1&Charx8Dot)){ + tempax=StHiTextTVHT; + tempbx=StHiTextTVVT; + } + } + } + } + else { + tempax=*((USHORT *)(ROMAddr+REFIndex+12)); + RY1COE=(tempax&0x00FF); + RY2COE=((tempax&0xFF00)>>8); + tempax=*((USHORT *)(ROMAddr+REFIndex+14)); + RY3COE=(tempax&0x00FF); + RY4COE=((tempax&0xFF00)>>8); + if(!(VBInfo&SetPALTV)){ + tempax=NTSCHT; + tempbx=NTSCVT; + }else{ + tempax=PALHT; + tempbx=PALVT; + } + } +/* ynlai end */ } HT=tempax; VT=tempbx; @@ -530,20 +585,37 @@ VOID GetRAMDAC2DATA(ULONG ROMAddr,USHORT ModeNo) VOID GetCRT2Ptr(ULONG ROMAddr,USHORT ModeNo) { USHORT tempcl,tempbx,tempal,tempax,CRT2PtrData=0; + USHORT Flag; + if(IF_DEF_LVDS==0) { if(VBInfo&SetCRT2ToLCD){ /* LCD */ tempbx=LCDResInfo; tempcl=LCDDataLen; tempbx=tempbx-Panel1024x768; if(!(SetFlag&LCDVESATiming)) tempbx+=5; - }else if(VBInfo&SetPALTV){ - tempcl=TVDataLen; - tempbx=3; - }else{ - tempbx=4; - tempcl=TVDataLen; } - +/* ynlai begin */ + else { + if(IF_DEF_HiVision==1) { + if(VGAVDE>480) SetFlag=SetFlag&(!TVSimuMode); + tempcl=HiTVDataLen; + tempbx=2; + if(VBInfo&SetInSlaveMode) { + if(!(SetFlag&TVSimuMode)) tempbx=10; + } + } + else { + if(VBInfo&SetPALTV){ + tempcl=TVDataLen; + tempbx=3; + } + else{ + tempbx=4; + tempcl=TVDataLen; + } + } + } +/* ynlai end */ if(SetFlag&TVSimuMode){ tempbx=tempbx+4; } @@ -558,17 +630,26 @@ VOID GetCRT2Ptr(ULONG ROMAddr,USHORT ModeNo) REFIndex=*((USHORT *)(ROMAddr + 0x20E + tempbx*2)); REFIndex+=tempax; } - else { - tempcl=LVDSDataLen; - tempbx=LCDResInfo-Panel800x600; - if(LCDInfo&LCDNonExpanding){ - tempbx=tempbx+3; - } - if(ModeNo<=0x13){ - tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - }else{ - tempal=*((UCHAR *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ + else { /* LVDS */ + Flag=1; + tempbx=0; + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + Flag=0; + tempbx=7; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + } } + tempcl=LVDSDataLen; + if(Flag==1) { + tempbx=LCDResInfo-Panel800x600; + if(LCDInfo&LCDNonExpanding){ + tempbx=tempbx+3; + } + } + if(ModeNo<=0x13) tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UCHAR *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ tempal=tempal&0x1F; tempax=tempal*tempcl; CRT2PtrData=*((USHORT *)(ROMAddr+ADR_CRT2PtrData)); /*ADR_CRT2PtrData is defined in init.def */ @@ -652,6 +733,27 @@ VOID SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo) temp3=temp3&(~0x0BF); temp3=temp3|tempah; SetReg1(Part4Port,0x0D,(USHORT)temp3); + +/* ynlai begin */ + tempah=0; + if(VBInfo&SetCRT2ToTV) { + if(VBInfo&SetInSlaveMode) { + if(!(SetFlag&TVSimuMode)) { + if(IF_DEF_HiVision==0) { + SetFlag=SetFlag|RPLLDIV2XO; + tempah=tempah|0x40; + } + } + } + else { + SetFlag=SetFlag|RPLLDIV2XO; + tempah=tempah|0x40; + } + } + if(LCDResInfo==Panel1280x1024) tempah=tempah|0x80; + if(LCDResInfo==Panel1280x960) tempah=tempah|0x80; + SetReg1(Part4Port,0x0C,(USHORT)temp3); +/* ynlai end */ } else { tempah=0; @@ -717,9 +819,15 @@ VOID SetGroup1_LVDS(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, SetReg1(Part1Port,0x0D,tempcl); /*BTVGA2HRE 0x0D */ tempcx=(VGAVT-1); tempah=tempcx&0x0FF; + if(IF_DEF_CH7005==1) { + if(VBInfo&0x0C) tempah=tempah-1; + } SetReg1(Part1Port,0x0E,tempah); /*BTVGA2TV 0x0E,0x12 */ tempbx=VGAVDE-1; tempah=tempbx&0x0FF; + if(IF_DEF_CH7005==1) { + if(VBInfo&0x0C) tempah=tempah-1; + } SetReg1(Part1Port,0x0F,tempah); /*BTVGA2VDEE 0x0F,0x12 */ tempah=((tempbx&0xFF00)<<3)>>8; tempah=tempah|((tempcx&0xFF00)>>8); @@ -784,14 +892,13 @@ VOID SetGroup1_LVDS(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, tempbx=LCDVDES; /*VGAVDES */ temppush1=tempbx; /*push bx temppush1 */ if(IF_DEF_TRUMPION==0){ - if(LCDResInfo==Panel800x600){ - tempax=600; - }else{ - tempax=768; + if(IF_DEF_CH7005==1) tempax=VGAVDE; + if(VBInfo&SetCRT2ToLCD) { + if(LCDResInfo==Panel800x600) tempax=600; + else tempax=768; } - }else{ - tempax=VGAVDE; } + else tempax=VGAVDE; tempbx=tempbx+tempax; tempax=VT; /*VT */ if(tempbx>=VT){ @@ -935,7 +1042,7 @@ VOID SetGroup1_301(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn SISPtr pSiS = SISPTR(pScrn); USHORT temp1,temp2,tempcl,tempch,tempbl,tempbh,tempal,tempah,tempax,tempbx; USHORT tempcx,OldREFIndex; - USHORT Part1Port; + USHORT Part1Port,resinfo,modeflag; Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; OldREFIndex=REFIndex; /* push di */ @@ -1011,16 +1118,16 @@ VOID SetGroup1_301(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn if( pSiS->Chipset == PCI_CHIP_SIS300 ){ tempah=0x10; - if((LCDResInfo!=Panel1024x768)&&(LCDResInfo==Panel1280x1024)){ - tempah=0x20; - } - }else{ - tempah=0x20; + if((LCDResInfo!=Panel1024x768)&&(LCDResInfo==Panel1280x1024)) tempah=0x20; } - if(VBInfo&SetCRT2ToTV){ - tempah=0x08; + else tempah=0x20; + if(VBInfo&SetCRT2ToTV) tempah=0x08; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(VBInfo&SetInSlaveMode) tempah=0x2c; + else tempah=0x20; } - +/* ynlai end */ SetRegANDOR(Part1Port,0x13,~0x03C,tempah); if(!(VBInfo&SetInSlaveMode)){ @@ -1060,42 +1167,62 @@ VOID SetGroup1_301(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn if(VBInfo&SetCRT2ToTV){ tempah=tempah+2; } +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + resinfo=*(USHORT *)(ROMAddr+ModeIDOffset+0x09); /* si+Ext_ResInfo */ + if(resinfo==7) tempah=tempah-2; + } +/* ynlai end */ SetReg1(Part1Port,0x05,tempah); /* 0x05 Horizontal Display Start */ SetReg1(Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ /* 0x07 horizontal Retrace Start */ - tempcx=(tempbl+tempbh)>>1; - tempah=(tempcx&0xFF)+2; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempah=tempbl-1; + modeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(modeflag&HalfDCLK)) { + tempah=tempah-6; + if(SetFlag&TVSimuMode) { + tempah=tempah-4; + if(ModeNo>0x13) tempah=tempah-10; + } + } + } +/* ynlai end */ + else { + tempcx=(tempbl+tempbh)>>1; + tempah=(tempcx&0xFF)+2; - if(VBInfo&SetCRT2ToTV){ - tempah=tempah-1; - if(!(temp1&HalfDCLK)){ - if((temp1&Charx8Dot)){ - tempah=tempah+4; - if(VGAHDE>=800){ - tempah=tempah-6; + if(VBInfo&SetCRT2ToTV){ + tempah=tempah-1; + if(!(temp1&HalfDCLK)){ + if((temp1&Charx8Dot)){ + tempah=tempah+4; + if(VGAHDE>=800){ + tempah=tempah-6; + } } } - } - }else{ - if(!(temp1&HalfDCLK)){ - tempah=tempah-4; - if(VGAHDE>=800){ - tempah=tempah-7; - if(ModeType==ModeEGA){ - if(VGAVDE==1024){ - tempah=tempah+15; - if(LCDResInfo!=Panel1280x1024){ - tempah=tempah+7; + }else{ + if(!(temp1&HalfDCLK)){ + tempah=tempah-4; + if(VGAHDE>=800){ + tempah=tempah-7; + if(ModeType==ModeEGA){ + if(VGAVDE==1024){ + tempah=tempah+15; + if(LCDResInfo!=Panel1280x1024){ + tempah=tempah+7; + } } } - } - if(VGAHDE>=1280){ - tempah=tempah+28; + if(VGAHDE>=1280){ + tempah=tempah+28; + } } } - } + } } - SetReg1(Part1Port,0x07,tempah); /* 0x07 Horizontal Retrace Start */ SetReg1(Part1Port,0x08,0); /* 0x08 Horizontal Retrace End */ @@ -1138,6 +1265,8 @@ VOID SetGroup1_301(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn temp2=tempax; /* push ax */ tempax=tempax<<1; tempbx=tempax+tempbx; +/* ynlai begin */ +/* ynlai end */ if((SetFlag&TVSimuMode)&&(VBInfo&SetPALTV)&&(VGAHDE==800)){ tempbx=tempbx+40; } @@ -1300,7 +1429,10 @@ VOID SetCRT2FIFO(USHORT Part1Port,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn temp1=(temp1&(~0x1F))|0x16; SetReg1(Part1Port,0x01,temp1); - if(temp2<=6) temp2=6; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { if(temp2<=10) temp2=10; } + else { if(temp2<=6) temp2=6; } +/* ynlai end */ if(temp2>0x14) temp2=0x14; temp1=(UCHAR)GetReg1(Part1Port,0x02); /* part1port index 02 */ temp1=(temp1&(~0x1F))|temp2; @@ -1338,7 +1470,7 @@ USHORT GetQueueConfig() USHORT GetVCLKPtr(ULONG ROMAddr,USHORT ModeNo) { - USHORT tempal; + USHORT tempal=0; if(IF_DEF_LVDS==0) { tempal=(UCHAR)GetReg2((USHORT)(P3ca+0x02)); /* Port 3cch */ tempal=((tempal>>2)&0x03); @@ -1437,35 +1569,77 @@ USHORT CalcDelayVB() USHORT GetVCLK2Ptr(ULONG ROMAddr,USHORT ModeNo) { - USHORT tempal; + USHORT tempal,tempbx,temp; USHORT LCDXlat1VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; USHORT LCDXlat2VCLK[4]={VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2}; + USHORT LVDSXlat1VCLK[4]={VCLK40,VCLK40,VCLK40,VCLK40}; + USHORT LVDSXlat2VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; + USHORT LVDSXlat3VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; - if(ModeNo<=0x13){ - tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - }else{ - tempal=*((UCHAR *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ - } - tempal=tempal>>6; - if(LCDResInfo!=Panel1024x768){ - tempal=LCDXlat2VCLK[tempal]; - }else{ - tempal=LCDXlat1VCLK[tempal]; - } - - if(VBInfo&SetCRT2ToLCD){ - tempal=tempal; - }else if(VBInfo&SetCRT2ToTV){ - if(SetFlag&RPLLDIV2XO){ - tempal=TVVCLKDIV2; + if(IF_DEF_LVDS==0) { + if(ModeNo<=0x13){ + tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ }else{ - tempal=TVVCLK; + tempal=*((UCHAR *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ } - }else{ - tempal=(UCHAR)GetReg2((USHORT)(P3ca+0x02)); /* Port 3cch */ - tempal=((tempal>>2)&0x03); - if(ModeNo>0x13){ - tempal=*((UCHAR *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ + tempal=tempal>>6; + if(LCDResInfo!=Panel1024x768){ + tempal=LCDXlat2VCLK[tempal]; + }else{ + tempal=LCDXlat1VCLK[tempal]; + } + + if(VBInfo&SetCRT2ToLCD){ + tempal=tempal; + } +/* ynlai begin */ + else { /* for TV */ + if(VBInfo&SetCRT2ToTV) { + if(IF_DEF_HiVision==1) { + if(SetFlag&RPLLDIV2XO) tempal=HiTVVCLKDIV2; + else tempal=HiTVVCLK; + if(SetFlag&TVSimuMode){ + temp=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(temp&Charx8Dot) tempal=HiTVSimuVCLK; + else tempal=HiTVTextVCLK; + } + } + else { + if(VBInfo&SetCRT2ToTV){ + if(SetFlag&RPLLDIV2XO) tempal=TVVCLKDIV2; + else tempal=TVVCLK; + } + else { + tempal=(UCHAR)GetReg2((USHORT)(P3ca+0x02)); /* Port 3cch */ + tempal=((tempal>>2)&0x03); + if(ModeNo>0x13) tempal=*((UCHAR *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ + } + } + } + } + } +/* ynlai end */ + else { /* LVDS */ + if(ModeNo<=0x13) tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); + else tempal=*((UCHAR *)(ROMAddr+REFIndex+0x04)); + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + tempal=tempal&0x1f; + tempbx=0; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + tempbx=tempbx<<1; + temp=(*((USHORT *)(ROMAddr+ADR_CHTVVCLKPtr))); + tempbx=(*((USHORT *)(ROMAddr+temp+tempbx))); + tempal=(*((USHORT *)(ROMAddr+tempbx+tempal))); + tempal=tempal&0x00FF; + } + } + else { + tempal=tempal>>6; + if(LCDResInfo==Panel800x600) tempal=LVDSXlat1VCLK[tempal]; + else if(LCDResInfo==Panel1024x768) tempal=LVDSXlat2VCLK[tempal]; + else tempal=LVDSXlat3VCLK[tempal]; } } VCLKLen=GetVCLKLen(ROMAddr); @@ -1545,7 +1719,7 @@ USHORT GetVGAHT2() return((USHORT)temp2); } -VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) +VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr, USHORT ModeNo) { USHORT tempah,tempbl,tempbh,tempcl,i,j,tempcx,pushcx,tempbx,tempax; USHORT tempmodeflag,tempflowflag; @@ -1553,7 +1727,9 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) USHORT *temp2; USHORT pushbx; USHORT Part2Port; + USHORT modeflag; long int longtemp; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; tempcx=VBInfo; tempah=VBInfo&0x0FF; @@ -1568,15 +1744,29 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) tempah=tempah|tempbl; tempah=tempah^0x0C; - if(VBInfo&SetPALTV){ + if(IF_DEF_HiVision==1) { temp1=(UCHAR *)(ROMAddr+0x0F1); /* PALPhase */ - temp2=PALTiming; - }else{ - tempah=tempah|0x10; - temp1=(UCHAR *)(ROMAddr+0x0ED); /* NTSCPhase */ - temp2=NTSCTiming; + tempah=tempah^0x01; + if(VBInfo&SetInSlaveMode) { + temp2=HiTVSt2Timing; + if(SetFlag&TVSimuMode) { + modeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + if(modeflag&Charx8Dot) temp2=HiTVSt1Timing; + else temp2=HiTVTextTiming; + } + } + else temp2=HiTVExtTiming; + } + else { + if(VBInfo&SetPALTV){ + temp1=(UCHAR *)(ROMAddr+0x0F1); /* PALPhase */ + temp2=PALTiming; + }else{ + tempah=tempah|0x10; + temp1=(UCHAR *)(ROMAddr+0x0ED); /* NTSCPhase */ + temp2=NTSCTiming; + } } - SetReg1(Part2Port,0x0,tempah); for(i=0x31;i<=0x34;i++,temp1++){ SetReg1(Part2Port,i,*(UCHAR *)temp1); @@ -1597,6 +1787,24 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) SetReg1(Part2Port,0x37,RY3COE); SetReg1(Part2Port,0x38,RY4COE); +/* ynlai begin */ + if(IF_DEF_HiVision==1) tempax=950; + else { + if(VBInfo&SetPALTV) tempax=520; + else tempax=440; + } + if(VDE<=tempax) { + tempax=tempax-VDE; + tempax=tempax>>2; + tempah=(tempax&0xFF00)>>8; + tempah=tempah+temp2[0]; + SetReg1(Part2Port,0x01,tempah); + tempah=tempax&0x00FF; + tempah=tempah+temp2[1]; + SetReg1(Part2Port,0x02,tempah); + } +/* begin end */ + tempcx=HT-1; tempah=tempcx&0xFF; SetReg1(Part2Port,0x1B,tempah); @@ -1607,6 +1815,9 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) pushcx=tempcx; /* push cx */ tempcx=tempcx+7; +/* ynlai begin */ + if(IF_DEF_HiVision==1) tempcx=tempcx-4; +/* ynlai end */ tempah=(tempcx&0xFF); tempah=(tempah<<4)&0xFF; SetRegANDOR(Part2Port,0x22,~0x0F0,tempah); @@ -1621,7 +1832,12 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) SetRegANDOR(Part2Port,0x25,~0x0F0,tempah); tempbx=tempbx+8; - +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempbx=tempbx-4; + tempcx=tempbx; + } +/* ynlai end */ tempah=((tempbx&0xFF)<<4)&0xFF; SetRegANDOR(Part2Port,0x29,~0x0F0,tempah); @@ -1632,7 +1848,9 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) SetRegANDOR(Part2Port,0x28,~0x0F0,tempah); tempcx=tempcx+8; - +/* ynlai begin */ + if(IF_DEF_HiVision==1) tempcx=tempcx-4; +/* ynlai end */ tempah=tempcx&0xFF; tempah=(tempah<<4)&0xFF; SetRegANDOR(Part2Port,0x2A,~0x0F0,tempah); @@ -1668,6 +1886,11 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) tempbx=tempbx-2; tempah=tempbx&0xFF; +/* ynlai begin */ + if(IF_DEF_HiVision==1) + if(VBInfo&SetInSlaveMode) + if(ModeNo==0x2f) tempah=tempah+1; +/* ynlai end */ SetReg1(Part2Port,0x2F,tempah); tempah=(tempcx&0xFF00)>>8; @@ -1675,11 +1898,14 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) tempbh=(tempbh<<6)&0xFF; tempah=tempah|tempbh; /* assuming <<ifndef>> hivisiontv */ - tempah=tempah|0x10; - if(!(VBInfo&SetCRT2ToSVIDEO)){ - tempah=tempah|0x20; +/* ynlai begin */ + if(IF_DEF_HiVision==0) { + tempah=tempah|0x10; + if(!(VBInfo&SetCRT2ToSVIDEO)){ + tempah=tempah|0x20; + } } - +/* ynlai end */ SetReg1(Part2Port,0x30,tempah); tempbh=0; @@ -1695,8 +1921,15 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) tempah=0; } } - /* assuming ifdef hivisiontv */ tempcx=0x0101; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(VGAHDE>=1024) { + tempcx=0x1920; + if(VGAHDE>=1280) tempcx=0x1420; + } + } +/* ynlai end */ if(!(tempbh&0x20)){ if(tempmodeflag&HalfDCLK){ tempcl=((tempcx&0xFF)<<1)&0xFF; @@ -1725,6 +1958,12 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) tempah=tempbh; SetRegANDOR(Part2Port,0x45,~0x03F,tempah); + if(IF_DEF_HiVision==1) { + if(!(VBInfo&SetInSlaveMode)) { + SetReg1(Part2Port,0x0B,0x00); + } + } + if(VBInfo&SetCRT2ToTV){ return; } @@ -1840,20 +2079,37 @@ VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) return; } -VOID SetGroup3(USHORT BaseAddr) +VOID SetGroup3(USHORT BaseAddr,ULONG ROMAddr) { USHORT i; USHORT *tempdi; USHORT Part3Port; + USHORT modeflag; Part3Port=BaseAddr+IND_SIS_CRT2_PORT_12; +/* ynlai begin */ + SetReg1(Part3Port,0x00,0x00); if(VBInfo&SetPALTV){ - tempdi=PALGroup3Data; - }else{ - tempdi=NTSCGroup3Data; + SetReg1(Part3Port,0x13,0xFA); + SetReg1(Part3Port,0x14,0xC8); } - for(i=0;i<=0x3E;i++){ - SetReg1(Part3Port,i,tempdi[i]); + else { + SetReg1(Part3Port,0x13,0xF6); + SetReg1(Part3Port,0x14,0xBF); + } + if(IF_DEF_HiVision==1) { + tempdi=HiTVGroup3Data; + if(SetFlag&TVSimuMode) { + tempdi=HiTVGroup3Simu; + modeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + if(!(modeflag&Charx8Dot)) { + tempdi=HiTVGroup3Text; + } + } + for(i=0;i<=0x3E;i++){ + SetReg1(Part3Port,i,tempdi[i]); + } } +/* ynlai end */ return; } @@ -1914,14 +2170,25 @@ VOID SetGroup4(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) tempbx=tempbx>>1; } - if(VBInfo&SetCRT2ToLCD){ - tempah=0; - if(tempbx>800){ - tempah=0x60; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempah=0xA0; + if(tempbx!=1024) { + tempah=0xC0; + if(tempbx!=1280) tempah=0; + } + } + else { + if(VBInfo&SetCRT2ToLCD){ + tempah=0; + if(tempbx>800){ + tempah=0x60; + } + }else{ + tempah=0x080; } - }else{ - tempah=0x080; } +/* ynlai end */ if(LCDResInfo!=Panel1280x1024){ tempah=tempah|0x0A; } @@ -1930,6 +2197,12 @@ VOID SetGroup4(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) tempebx=VDE; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(!(tempah&0xE0)) tempbx=tempbx>>1; + } +/* ynlai end */ + tempcx=RVBHRS; tempah=tempcx&0xFF; SetReg1(Part4Port,0x18,tempah); @@ -1968,7 +2241,8 @@ VOID SetCRT2VCLK(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) USHORT vclk2ptr; USHORT tempah,temp1; USHORT Part4Port; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); SetReg1(Part4Port,0x0A,0x01); tempah=*((UCHAR *)(ROMAddr+vclk2ptr+0x01)); /* di+1 */ @@ -2134,7 +2408,7 @@ VOID SetLockRegs() VOID EnableBridge(USHORT BaseAddr) { USHORT part2_02,part2_05; - USHORT Part2Port,Part1Port=0; + USHORT Part2Port; Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; if(IF_DEF_LVDS==0) { @@ -2157,7 +2431,7 @@ VOID EnableBridge(USHORT BaseAddr) VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr) { - USHORT flag1,tempbx,tempbl,tempbh,tempah; + USHORT flag1,tempbx,tempbl,tempbh,tempah,temp; SetFlag=0; tempbx=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ @@ -2165,7 +2439,7 @@ VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr) ModeType=tempbl; tempbx=0; flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ - if(IF_DEF_LVDS==0) { + if(IF_DEF_LVDS==0) { /* for 301 */ if(!(flag1&0x20)){ VBInfo=CRT2DisplayFlag; return; @@ -2173,25 +2447,24 @@ VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr) } tempbl=GetReg1(P3d4,0x30); tempbh=GetReg1(P3d4,0x31); - if(IF_DEF_LVDS==0) { - tempah=SetInSlaveMode; - tempah=tempah>>8; - tempah=tempah^0xFF; - tempbh=tempbh&tempah; + + tempah=((SetCHTVOverScan>>8)|(SetInSlaveMode>>8)|(DisableCRT2Display>>8)); + tempah=tempah^0xFF; + tempbh=tempbh&tempah; +/* ynlai begin */ + if(IF_DEF_LVDS==1){ /* for LVDS */ + if(IF_DEF_CH7005==1) temp=SetCRT2ToLCD|SetCRT2ToTV; + else temp=SetCRT2ToLCD; } else { - tempbh=tempbh&(!(SetInSlaveMode>>8)); + if(IF_DEF_HiVision==1) temp=0xFC; + else temp=0x7C; } - if(!(tempbl&0x07C)){ - VBInfo=CRT2DisplayFlag; + if(!(tempbl&temp)) { + VBInfo=DisableCRT2Display; return; } - if(IF_DEF_LVDS==1){ /* or LVDS */ - if(!(tempbl&SetCRT2ToLCD)){ - VBInfo=CRT2DisplayFlag; - return; - } - } +/* ynlai end */ if(IF_DEF_LVDS==0) { if(tempbl&SetCRT2ToRAMDAC){ tempbl=tempbl&(SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode); @@ -2199,14 +2472,21 @@ VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr) tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); }else if(tempbl&SetCRT2ToSCART){ tempbl=tempbl&(SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode); + tempbh=tempbh|(SetPALTV>>8); }else if(tempbl&SetCRT2ToHiVisionTV){ tempbl=tempbl&(SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode); +/* ynlai begin */ + tempbh=tempbh|(SetPALTV>>8); +/* ynlai end */ } } else { - if(tempbl&SetCRT2ToLCD){ + if(IF_DEF_CH7005==1) { + if(tempbl&SetCRT2ToTV) + tempbl=tempbl&(SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode); + } + if(tempbl&SetCRT2ToLCD) tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); - } } tempah=GetReg1(P3d4,0x31); if(tempah&(CRT2DisplayFlag>>8)){ @@ -2228,17 +2508,34 @@ VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr) } } } + else { + flag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(flag1&CRT2Mode)) { + VBInfo=VBInfo|SetSimuScanMode; + } + } } - if(!((VBInfo&(SetSimuScanMode|SwitchToCRT2)))){ - return; - } - if(!(VBInfo&DriverMode)){ - VBInfo=VBInfo|SetInSlaveMode; - return; - } - flag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(!(flag1&(CRT2Mode|CRT2DisplayFlag))){ - VBInfo=VBInfo|SetInSlaveMode; + if(!(VBInfo&DisableCRT2Display)) { + if(VBInfo&DriverMode) { + if(VBInfo&SetSimuScanMode) { + flag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(flag1&CRT2Mode)) { + VBInfo=VBInfo|SetInSlaveMode; + } + } + } + else { + VBInfo=VBInfo|SetSimuScanMode; + if(IF_DEF_LVDS==0) { + if(VBInfo&SetCRT2ToTV) { + if(!(VBInfo&SetNotSimuMode)) SetFlag=SetFlag|TVSimuMode; + } + } + } + } + if(IF_DEF_CH7005==1) { + tempah=GetReg1(P3d4,0x35); + if(tempah&TVOverScan) VBInfo=VBInfo|SetCHTVOverScan; } } @@ -2322,7 +2619,7 @@ BOOLEAN GetLCDResInfo(ULONG ROMAddr,USHORT P3d4) return 1; } if(VBInfo&SetInSlaveMode){ - if(VBInfo&SetNotSimuTVMode){ + if(VBInfo&SetNotSimuMode){ SetFlag=SetFlag|LCDVESATiming; } }else{ @@ -2469,19 +2766,16 @@ VOID SetCRT2ECLK(ULONG ROMAddr, USHORT ModeNo) { USHORT OldREFIndex,tempah,tempal; USHORT P3cc=P3c9+3; + OldREFIndex=(USHORT)REFIndex; if(IF_DEF_TRUMPION==0){ /*no trumpion */ tempal=GetReg2(P3cc); tempal=tempal&0x0C; -/* SetReg3(P3c2,tempal); */ - REFIndex=GetVCLKPtr(ROMAddr,ModeNo); + REFIndex=GetVCLK2Ptr(ROMAddr,ModeNo); }else{ /*trumpion */ SetFlag=SetFlag&(~ProgrammingCRT2); tempal=*((UCHAR *)(ROMAddr+REFIndex+0x03)); /*&di+Ext_CRTVCLK */ - /*[6/8/2000],Mars Wen,for vbios version >=v1.03.00 */ tempal=tempal&0x03F; - /*~[6/8/2000],Mars Wen,for vbios version >=v1.03.00 */ - /* tempal=tempal&0x01F; */ if(tempal==0x02){ /*31.5MHz */ REFIndex=REFIndex-Ext2StructSize; } @@ -2507,16 +2801,27 @@ VOID SetCRT2ECLK(ULONG ROMAddr, USHORT ModeNo) USHORT GetLVDSDesPtr(ULONG ROMAddr,USHORT ModeNo) { USHORT tempcl,tempbx,tempal,tempptr,LVDSDesPtrData; + USHORT Flag; + + Flag=1; + tempbx=0; + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + Flag=0; + tempbx=32; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + } + } tempcl=LVDSDesDataLen; - tempbx=LCDTypeInfo; - if(LCDInfo&LCDNonExpanding){ - tempbx=tempbx+16; - } - if(ModeNo<=0x13){ - tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - }else{ - tempal=*((UCHAR *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ - } + if(Flag) { + tempbx=LCDTypeInfo; + if(LCDInfo&LCDNonExpanding){ + tempbx=tempbx+16; + } + } + if(ModeNo<=0x13) tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UCHAR *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ tempal=tempal&0x1F; tempal=tempal*tempcl; tempbx=tempbx<<1; @@ -2530,27 +2835,32 @@ USHORT GetLVDSDesPtr(ULONG ROMAddr,USHORT ModeNo) BOOLEAN GetLVDSCRT1Ptr(ULONG ROMAddr,USHORT ModeNo) { USHORT tempal,tempbx,modeflag1; - USHORT LVDSCRT1DataPtr; + USHORT LVDSCRT1DataPtr,Flag; if(!(VBInfo&SetInSlaveMode)){ /* return 0; */ } - if(ModeNo<=0x13){ - tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - }else{ - tempal=*((UCHAR *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ + Flag=1; + tempbx=0; + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + Flag=0; + tempbx=12; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + } + } + if(Flag) { + tempbx=LCDResInfo; + tempbx=tempbx-Panel800x600; + if(LCDInfo&LCDNonExpanding) tempbx=tempbx+6; + modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK) tempbx=tempbx+3; } + if(ModeNo<=0x13) tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UCHAR *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ tempal=tempal&0x3F; - tempbx=LCDResInfo; - tempbx=tempbx-Panel800x600; - if(LCDInfo&LCDNonExpanding){ - tempbx=tempbx+6; - } - modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&HalfDCLK){ - tempbx=tempbx+3; - } tempbx=tempbx<<1; LVDSCRT1DataPtr=*((USHORT *)(ROMAddr+ADR_LVDSCRT1DataPtr)); REFIndex=*((USHORT *)(ROMAddr+LVDSCRT1DataPtr+tempbx)); @@ -2560,5 +2870,281 @@ BOOLEAN GetLVDSCRT1Ptr(ULONG ROMAddr,USHORT ModeNo) } +VOID SetCHTVReg(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT old_REFIndex,temp,tempbx,tempcl; + + old_REFIndex=(USHORT)REFIndex; /*push di */ + GetCHTVRegPtr(ROMAddr,ModeNo); + + if(VBInfo&SetPALTV) { + SetCH7005(0x4304); + SetCH7005(0x6909); + } + else { + SetCH7005(0x0304); + SetCH7005(0x7109); + } + + temp=*((USHORT *)(ROMAddr+REFIndex+0x00)); + tempbx=((temp&0x00FF)<<8)|0x00; + SetCH7005(tempbx); + temp=*((USHORT *)(ROMAddr+REFIndex+0x01)); + tempbx=((temp&0x00FF)<<8)|0x07; + SetCH7005(tempbx); + temp=*((USHORT *)(ROMAddr+REFIndex+0x02)); + tempbx=((temp&0x00FF)<<8)|0x08; + SetCH7005(tempbx); + temp=*((USHORT *)(ROMAddr+REFIndex+0x03)); + tempbx=((temp&0x00FF)<<8)|0x0A; + SetCH7005(tempbx); + temp=*((USHORT *)(ROMAddr+REFIndex+0x04)); + tempbx=((temp&0x00FF)<<8)|0x0B; + SetCH7005(tempbx); + + SetCH7005(0x2801); + SetCH7005(0x3103); + SetCH7005(0x003D); + SetCHTVRegANDOR(0x0010,0x1F); + SetCHTVRegANDOR(0x0211,0xF8); + SetCHTVRegANDOR(0x001C,0xEF); + + if(!(VBInfo&SetPALTV)) { + if(ModeNo<=0x13) tempcl=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempcl=*((UCHAR *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ + tempcl=tempcl&0x3F; + if(VBInfo&SetCHTVOverScan) { + if(tempcl==0x04) { /* 640x480 underscan */ + SetCHTVRegANDOR(0x0020,0xEF); + SetCHTVRegANDOR(0x0121,0xFE); + } + else { + if(tempcl==0x05) { /* 800x600 underscan */ + SetCHTVRegANDOR(0x0118,0xF0); + SetCHTVRegANDOR(0x0C19,0xF0); + SetCHTVRegANDOR(0x001A,0xF0); + SetCHTVRegANDOR(0x001B,0xF0); + SetCHTVRegANDOR(0x001C,0xF0); + SetCHTVRegANDOR(0x001D,0xF0); + SetCHTVRegANDOR(0x001E,0xF0); + SetCHTVRegANDOR(0x001F,0xF0); + SetCHTVRegANDOR(0x0120,0xEF); + SetCHTVRegANDOR(0x0021,0xFE); + } + } + } + else { + if(tempcl==0x04) { /* 640x480 overscan */ + SetCHTVRegANDOR(0x0020,0xEF); + SetCHTVRegANDOR(0x0121,0xFE); + } + else { + if(tempcl==0x05) { /* 800x600 overscan */ + SetCHTVRegANDOR(0x0118,0xF0); + SetCHTVRegANDOR(0x0F19,0xF0); + SetCHTVRegANDOR(0x011A,0xF0); + SetCHTVRegANDOR(0x0C1B,0xF0); + SetCHTVRegANDOR(0x071C,0xF0); + SetCHTVRegANDOR(0x011D,0xF0); + SetCHTVRegANDOR(0x0C1E,0xF0); + SetCHTVRegANDOR(0x071F,0xF0); + SetCHTVRegANDOR(0x0120,0xEF); + SetCHTVRegANDOR(0x0021,0xFE); + } + } + } + } + + REFIndex=old_REFIndex; +} + +VOID SetCHTVRegANDOR(USHORT tempax,USHORT tempbh) +{ + USHORT tempal,tempah,tempbl; + + tempal=tempax&0x00FF; + tempah=(tempax>>8)&0x00FF; + tempbl=GetCH7005(tempal); + tempbl=(((tempbl&tempbh)|tempah)<<8|tempal); + SetCH7005(tempbl); +} + +VOID GetCHTVRegPtr(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempbx,tempal,tempcl,CHTVRegDataPtr; + + if(VBInfo&SetCRT2ToTV) { + tempbx=0; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + + if(ModeNo<=0x13) tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UCHAR *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ + tempal=tempal&0x3F; + + tempcl=CHTVRegDataLen; + tempal=tempal*tempcl; + tempbx=tempbx<<1; + + CHTVRegDataPtr=*((USHORT *)(ROMAddr+ADR_CHTVRegDataPtr)); + REFIndex=*((USHORT *)(ROMAddr+CHTVRegDataPtr+tempbx)); + REFIndex=REFIndex+tempal; + } +} + +VOID SetCH7005(USHORT tempbx) +{ + USHORT tempah,temp; + + DDC_Port=0x3c4; + DDC_Index=0x11; + DDC_DataShift=0x00; + DDC_DeviceAddr=0xEA; + + SetSwitchDDC2(); + SetStart(); + tempah=DDC_DeviceAddr; + temp=WriteDDC2Data(tempah); + tempah=tempbx&0x00FF; + temp=WriteDDC2Data(tempah); + tempah=(tempbx&0xFF00)>>8; + temp=WriteDDC2Data(tempah); + SetStop(); +} + +USHORT GetCH7005(USHORT tempbx) +{ + USHORT tempah; + + DDC_Port=0x3c4; + DDC_Index=0x11; + DDC_DataShift=0x00; + DDC_DeviceAddr=0xEA; + DDC_ReadAddr=tempbx; + + SetSwitchDDC2(); + SetStart(); + tempah=DDC_DeviceAddr; + WriteDDC2Data(tempah); + tempah=DDC_ReadAddr; + WriteDDC2Data(tempah); + + SetStart(); + tempah=DDC_DeviceAddr; + tempah=tempah|0x01; + if(WriteDDC2Data(tempah)) { + } + tempah=ReadDDC2Data(tempah); + SetStop(); + return(tempah); +} + +VOID SetSwitchDDC2(VOID) +{ + USHORT i; + + SetSCLKHigh(); + for(i=0;i<1000;i++) { + GetReg1(DDC_Port,0x05); + } + SetSCLKLow(); + for(i=0;i<1000;i++) { + GetReg1(DDC_Port,0x05); + } +} + + +VOID SetStart(VOID) +{ + USHORT temp; + + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ + SetSCLKHigh(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ + SetSCLKHigh(); +} + +VOID SetStop(VOID) +{ + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ + SetSCLKHigh(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ + SetSCLKHigh(); +} + +USHORT WriteDDC2Data(USHORT tempax) +{ + USHORT i,flag,temp; + + flag=0x80; + for(i=0;i<8;i++) { + SetSCLKLow(); + if(tempax&flag) { + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + } + else { + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); + } + SetSCLKHigh(); + flag=flag>>1; + } + return(CheckACK()); +} + +USHORT ReadDDC2Data(USHORT tempax) +{ + USHORT i,temp,getdata; + getdata=0; + for(i=0;i<8;i++) { + getdata=getdata<<1; + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetSCLKHigh(); + temp=GetReg1(DDC_Port,DDC_Index); + if(temp&0x02) getdata=getdata|0x01; + } + return(getdata); +} +VOID SetSCLKLow(VOID) +{ + SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x00); /* SetSCLKLow() */ + DDC2Delay(); +} + + +VOID SetSCLKHigh(VOID) +{ + USHORT temp; + + SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x01); /* SetSCLKLow() */ + do { + temp=GetReg1(DDC_Port,DDC_Index); + } while(!(temp&0x01)); + DDC2Delay(); +} + +VOID DDC2Delay(VOID) +{ + USHORT i; + + for(i=0;i<DDC2DelayTime;i++) { + GetReg1(P3c4,0x05); + } +} + +USHORT CheckACK(VOID) +{ + USHORT tempah; + + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetSCLKHigh(); + tempah=GetReg1(DDC_Port,DDC_Index); + SetSCLKLow(); + if(tempah&0x01) return(1); + else return(0); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h index a2cb8f174..d47e35ca8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.3 2000/09/22 11:35:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.4 2000/12/02 01:16:17 dawes Exp $ */ #include "initdef.h" @@ -6,6 +6,13 @@ USHORT VBInfo,SetFlag,RVBHCFACT,RVBHCMAX,VGAVT,VGAHT,VT,HT,VGAVDE,VGAHDE; USHORT VDE,HDE,RVBHRS,NewFlickerMode,RY1COE,RY2COE,RY3COE,RY4COE; USHORT LCDResInfo,LCDTypeInfo,LCDInfo,VCLKLen; USHORT LCDHDES,LCDVDES; +USHORT DDC_Port; +USHORT DDC_Index; +USHORT DDC_DataShift; +USHORT DDC_DeviceAddr; +USHORT DDC_Flag; +USHORT DDC_ReadAddr; +USHORT DDC_Buffer; USHORT StResInfo[5][2]={{640,400},{640,350},{720,400},{720,350},{640,480}}; USHORT ModeResInfo[15][4]={{320,200,8,8},{320,240,8,8},{320,400,8,8}, @@ -14,6 +21,74 @@ USHORT ModeResInfo[15][4]={{320,200,8,8},{320,240,8,8},{320,400,8,8}, {1280,1024,8,16},{1600,1200,8,16},{1920,1440,8,16}, {720,480,8,16},{720,576,8,16},{1280,960,8,16}}; +USHORT HiTVExtTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x64,0x90,0x33,0x8C,0x18,0x36,0x3E,0x13, + 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, + 0x8E,0x8E,0x82,0x07,0x0B, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x14,0x3D,0x63,0x4F, + 0x027,0xFFFC,0x6A}; + +USHORT HiTVSt1Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x65,0x90,0x7B,0xA8,0x03,0xF0,0x87,0x03, + 0x11,0x15,0x11,0xCF,0x10,0x11,0xCF,0x10, + 0x35,0x35,0x3B,0x69,0x1D, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x04,0x86,0xAF,0x5D, + 0xE,0xFFFC,0x2D}; + +USHORT HiTVSt2Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x64,0x90,0x33,0x8C,0x18,0x36,0x3E,0x13, + 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, + 0x8E,0x8E,0x82,0x07,0x0B, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x14,0x3D,0x63,0x4F, + 0x27,0xFFFC,0x6A}; + +USHORT HiTVTextTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x65,0x90,0xE7,0xBC,0x03,0x0C,0x97,0x03, + 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, + 0xC8,0xC8,0x3B,0xD2,0x26, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x04,0x96,0x72,0x5C, + 0x11,0xFFFC,0x32}; + +USHORT HiTVGroup3Data[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x5F, + 0x05,0x21,0xB2,0xB2,0x55,0x77,0x2A,0xA6, + 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, + 0x8C,0x6E,0x60,0x2E,0x58,0x48,0x72,0x44, + 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, + 0x4F,0x7F,0x03,0xA8,0x7D,0x20,0x1A,0xA9, + 0x14,0x05,0x03,0x7E,0x64,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; + +USHORT HiTVGroup3Simu[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x95, + 0xDB,0x20,0xB8,0xB8,0x55,0x47,0x2A,0xA6, + 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, + 0x8C,0x6E,0x60,0x15,0x26,0xD3,0xE4,0x11, + 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, + 0x67,0x36,0x01,0x47,0x0E,0x10,0xBE,0xB4, + 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; + +USHORT HiTVGroup3Text[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0xA7, + 0xF5,0x20,0xCE,0xCE,0x55,0x47,0x2A,0xA6, + 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, + 0x8C,0x6E,0x60,0x18,0x2C,0x0C,0x20,0x22, + 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, + 0x93,0x3C,0x01,0x50,0x2F,0x10,0xF4,0xCA, + 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; + + USHORT NTSCTiming[61]={0x017,0x01D,0x003,0x009,0x005,0x006,0x00C,0x00C, 0x094,0x049,0x001,0x00A,0x006,0x00D,0x004,0x00A, 0x006,0x014,0x00D,0x004,0x00A,0x000,0x085,0x01B, @@ -94,8 +169,8 @@ VOID SetCRT2Sync(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); VOID GetCRT1Ptr(ULONG ROMAddr); VOID SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR); USHORT GetVGAHT2(VOID); -VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr); -VOID SetGroup3(USHORT BaseAddr); +VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr, USHORT ModeNo); +VOID SetGroup3(USHORT BaseAddr,ULONG ROMAddr); VOID SetGroup4(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); VOID SetCRT2VCLK(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); VOID SetGroup5(USHORT BaseAddr,ULONG ROMAddr); @@ -126,6 +201,20 @@ VOID SetGroup1_LVDS(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScr VOID SetTPData(); BOOLEAN GetPanelID(); BOOLEAN GetLVDSCRT1Ptr(ULONG ROMAddr,USHORT ModeNo); +VOID SetCHTVReg(ULONG ROMAddr,USHORT ModeNo); +VOID SetCHTVRegANDOR(USHORT tempax,USHORT tempbh); +VOID GetCHTVRegPtr(ULONG ROMAddr,USHORT ModeNo); +VOID SetCH7005(USHORT tempax); +USHORT GetCH7005(USHORT tempax); +VOID SetSwitchDDC2(VOID); +VOID SetStart(VOID); +VOID SetStop(VOID); +VOID DDC2Delay(VOID); +VOID SetSCLKLow(VOID); +VOID SetSCLKHigh(VOID); +USHORT ReadDDC2Data(USHORT tempax); +USHORT WriteDDC2Data(USHORT tempax); +USHORT CheckACK(VOID); extern USHORT MDA_DAC[]; extern USHORT CGA_DAC[]; @@ -139,6 +228,8 @@ extern int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData,MCLKData extern int REFIndex,ModeType; extern USHORT VBInfo,LCDResInfo,LCDTypeInfo,LCDInfo; extern USHORT IF_DEF_LVDS; +extern USHORT IF_DEF_HiVision; +extern USHORT IF_DEF_CH7005; extern VOID SetReg1(USHORT, USHORT, USHORT); extern VOID SetReg3(USHORT, USHORT); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h index 5fdb37121..d3fd81d78 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h @@ -1,77 +1,149 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.3 2000/09/22 11:35:46 alanh Exp $ */ - -#define ModeInfoFlag 0x07 -#define MemoryInfoFlag 0x1E0 -#define MemorySizeShift 0x05 -#define ModeText 0x00 -#define ModeCGA 0x01 -#define ModeEGA 0x02 -#define ModeVGA 0x03 -#define Mode15Bpp 0x04 -#define Mode16Bpp 0x05 -#define Mode24Bpp 0x06 -#define Mode32Bpp 0x07 -#define CRT1Len 17 -#define DoubleScanMode 0x8000 - -#define ULONG unsigned long -#define USHORT unsigned short -#define SHORT short -#define UCHAR unsigned char -#define VOID void -#define BOOLEAN Bool - -#define InterlaceMode 0x80 -#define HalfDCLK 0x1000 -#define DACInfoFlag 0x18 -#define LineCompareOff 0x400 +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.4 2000/12/02 01:16:17 dawes Exp $ */ + +#define ULONG unsigned long +#define USHORT unsigned short +#define SHORT short +#define UCHAR unsigned char +#define VOID void +#define BOOLEAN Bool + +#define CRT1Len 17 +#define LVDSCRT1Len 15 +#define CHTVRegDataLen 5 + +#define ModeInfoFlag 0x07 +#define IsTextMode 0x07 +#define ModeText 0x00 +#define ModeCGA 0x01 +#define ModeEGA 0x02 +#define ModeVGA 0x03 +#define Mode15Bpp 0x04 +#define Mode16Bpp 0x05 +#define Mode24Bpp 0x06 +#define Mode32Bpp 0x07 + +#define DACInfoFlag 0x18 +#define MemoryInfoFlag 0x1E0 +#define MemorySizeShift 0x05 -#define SelectCRT2Rate 0x4 -#define ProgrammingCRT2 0x1 -#define CRT2DisplayFlag 0x2000 -#define SetCRT2ToRAMDAC 0x0040 #define Charx8Dot 0x0200 -#define LCDDataLen 8 +#define LineCompareOff 0x0400 +#define CRT2Mode 0x0800 +#define HalfDCLK 0x1000 +#define NoSupportSimuTV 0x2000 +#define DoubleScanMode 0x8000 + +#define SupportAllCRT2 0x0078 +#define SupportTV 0x0008 +#define SupportHiVisionTV 0x0010 +#define SupportLCD 0x0020 +#define SupportRAMDAC2 0x0040 +#define NoSupportTV 0x0070 +#define NoSupportHiVisionTV 0x0060 +#define NoSupportLCD 0x0058 +#define SupportCHTV 0x0800 +#define InterlaceMode 0x0080 +#define SyncPP 0x0000 +#define SyncPN 0x4000 +#define SyncNP 0x8000 +#define SyncNN 0xc000 +#define ECLKindex0 0x0000 +#define ECLKindex1 0x0100 +#define ECLKindex2 0x0200 +#define ECLKindex3 0x0300 +#define ECLKindex4 0x0400 + +#define SetSimuScanMode 0x0001 +#define SwitchToCRT2 0x0002 +#define SetCRT2ToTV 0x009C +#define SetCRT2ToAVIDEO 0x0004 +#define SetCRT2ToSVIDEO 0x0008 +#define SetCRT2ToSCART 0x0010 #define SetCRT2ToLCD 0x0020 +#define SetCRT2ToRAMDAC 0x0040 #define SetCRT2ToHiVisionTV 0x0080 +#define SetNTSCTV 0x0000 +#define SetPALTV 0x0100 +#define SetInSlaveMode 0x0200 +#define SetNotSimuMode 0x0400 +#define SetDispDevSwitch 0x0800 +#define LoadDACFlag 0x1000 +#define DisableCRT2Display 0x2000 +#define DriverMode 0x4000 +#define HotKeySwitch 0x8000 +#define SetCHTVOverScan 0x8000 + +#define TVOverScan 0x10 +#define TVOverScanShift 4 +#define ClearBufferFlag 0x20 + +#define SetSCARTOutput 0x01 +#define BoardTVType 0x02 + +#define ProgrammingCRT2 0x01 +#define TVSimuMode 0x02 +#define RPLLDIV2XO 0x04 +#define LCDVESATiming 0x08 +#define EnableLVDSDDA 0x10 +#define SetDispDevSwitchFlag 0x20 +#define CheckWinDos 0x40 +#define SetJDOSMode 0x80 + +#define Panel800x600 0x01 +#define Panel1024x768 0x02 +#define Panel1280x1024 0x03 +#define Panel1280x960 0x04 +#define Panel640x480 0x05 +#define LCDRGB18Bit 0x01 +#define ExtChipType 0x0e +#define ExtChip301 0x02 +#define ExtChipLVDS 0x04 +#define ExtChipTrumpion 0x06 +#define ExtChipCH7005 0x08 +#define ExtChipMitacTV 0x0a +#define LCDNonExpanding 0x10 +#define LCDNonExpandingShift 4 +#define LCDSync 0x20 +#define LCDSyncBit 0xe0 +#define LCDSyncshift 6 + +#define DDC2DelayTime 10 + +#define CRT2DisplayFlag 0x2000 +#define LCDDataLen 8 #define HiTVDataLen 12 #define TVDataLen 16 #define SetPALTV 0x0100 -#define SetInSlaveMode 0x0200 -#define SetCRT2ToTV 0x009C -#define SetNotSimuTVMode 0x0400 -#define SetSimuScanMode 0x0001 -#define DriverMode 0x4000 -#define CRT2Mode 0x0800 #define HalfDCLK 0x1000 #define NTSCHT 1716 #define NTSCVT 525 #define PALHT 1728 #define PALVT 625 +#define StHiTVHT 892 +#define StHiTVVT 1126 +#define StHiTextTVHT 1000 +#define StHiTextTVVT 1126 +#define ExtHiTVHT 2100 +#define ExtHiTVVT 1125 +#define SelectCRT2Rate 0x4 #define VCLKStartFreq 25 #define SoftDramType 0x80 #define VCLK40 0x04 #define VCLK65 0x09 #define VCLK108_2 0x14 -#define TVSimuMode 0x02 -#define SetCRT2ToSVIDEO 0x08 #define LCDRGB18Bit 0x01 -#define Panel1280x1024 0x03 -#define Panel1024x768 0x02 -#define Panel800x600 0x01 -#define RPLLDIV2XO 0x04 #define LoadDACFlag 0x1000 #define AfterLockCRT2 0x4000 -#define SupportRAMDAC2 0x0040 -#define SupportLCD 0x0020 #define SetCRT2ToAVIDEO 0x0004 #define SetCRT2ToSCART 0x0010 -#define NoSupportSimuTV 0x2000 #define Ext2StructSize 5 -#define SupportTV 0x0008 #define TVVCLKDIV2 0x021 #define TVVCLK 0x022 +#define HiTVVCLKDIV2 0x023 +#define HiTVVCLK 0x024 +#define HiTVSimuVCLK 0x025 +#define HiTVTextVCLK 0x026 #define SwitchToCRT2 0x0002 #define LCDVESATiming 0x08 #define SetSCARTOutput 0x01 @@ -92,28 +164,23 @@ #define IF_DEF_TRUMPION 0 #define LCDNonExpanding 0x10 -#define LVDSCRT1Len 15 #define ADR_CRT2PtrData 0x20E -#define offset_Zurac 0x210 +#define offset_Zurac 0x210 #define ADR_LVDSDesPtrData 0x212 #define ADR_LVDSCRT1DataPtr 0x214 +#define ADR_CHTVVCLKPtr 0x216 +#define ADR_CHTVRegDataPtr 0x218 -#define ExtChip301 0x02 -#define ExtChipLVDS 0x04 -#define ExtChipTrumpion 0x06 -#define LCDNonExpanding 0x10 -#define LCDNonExpandingShift 4 #define LVDSDataLen 6 #define EnableLVDSDDA 0x10 -#define LCDSync 0x20 -#define SyncPP 0x0000 -#define LCDSyncBit 0xE0 #define LVDSDesDataLen 3 -#define LVDSCRT1Len 15 #define ActiveNonExpanding 0x40 #define ActiveNonExpandingShift 6 #define ModeSwitchStatus 0x0F #define SoftTVType 0x40 + +#define SelectCRT1Rate 0x4 +#define SelectCRT2Rate 0x4 #define PanelType00 0x00 #define PanelType01 0x08 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h index f5c5d862a..17656cd80 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.18 2000/09/26 15:57:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.19 2000/12/02 01:16:17 dawes Exp $ */ #ifndef _SIS_H #define _SIS_H_ @@ -48,6 +48,8 @@ #include "sis_dri.h" #endif +#include "xf86xv.h" + #define SIS_NAME "SIS" #define SIS_DRIVER_NAME "sis" #define SIS_MAJOR_VERSION 0 @@ -64,6 +66,7 @@ #define BIOS_BASE 0xC0000 #define BIOS_SIZE 0x10000 +#define CRT2_DEFAULT 0x00000001 #define CRT2_LCD 0x00000010 #define CRT2_TV 0x00000020 #define CRT2_VGA 0x00000040 @@ -80,10 +83,11 @@ #define TV_SVIDEO 0x00020000 #define TV_SCART 0x00040000 #define TV_INTERFACE 0x00070000 -#define SIS301 0x00100000 -#define SIS302 0x00200000 -#define LVDS 0x01000000 -#define CHRONTEL_TV 0x02000000 +#define VB_301 0x00100000 +#define VB_302 0x00200000 +#define VB_303 0x00400000 +#define VB_LVDS 0x01000000 +#define VB_CHRONTEL 0x02000000 #define SINGLE_MODE 0x00000000 #define SIMU_MODE 0x10000000 #define MM_MODE 0x20000000 @@ -108,6 +112,7 @@ typedef struct { unsigned char VBPart2[0x46]; unsigned char VBPart3[0x3F]; unsigned char VBPart4[0x1C]; + unsigned short ch7005[0x11]; } SISRegRec, *SISRegPtr; #define SISPTR(p) ((SISPtr)((p)->driverPrivate)) @@ -143,12 +148,10 @@ typedef struct { Bool HWCursor; Bool UsePCIRetry; Bool TurboQueue; + int ForceCRT2Type; Bool ValidWidth; Bool FastVram; - int LVDSFlags; int VBFlags; - int LCDFlags; - int TVFlags; short scrnOffset; short DstColor; int Xdirection; @@ -175,9 +178,11 @@ typedef struct { void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSSaveLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSaveChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestoreLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestoreChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, @@ -194,6 +199,15 @@ typedef struct { unsigned int agpCmdBufFree; Bool irqEnabled; int irq; + int ColorExpandRingHead; + int ColorExpandRingTail; + int PerColorExpandBufferSize; + int ColorExpandBufferNumber; + int ColorExpandBufferCountMask; + unsigned char *ColorExpandBufferAddr[32]; + int ColorExpandBufferScreenOffset[32]; + int ImageWriteBufferSize; + unsigned char *ImageWriteBufferAddr; #ifdef XF86DRI Bool directRenderingEnabled; @@ -204,6 +218,9 @@ typedef struct { SISConfigPrivPtr pVisualConfigsPriv; SISRegRec DRContextRegs; #endif + + XF86VideoAdaptorPtr adaptor; + ScreenBlockHandlerProcPtr BlockHandler; } SISRec, *SISPtr; /* Prototypes */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c index 326ed77b7..3ff55a73b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c @@ -1,14 +1,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.3 2000/03/31 20:13:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.4 2000/12/02 01:16:17 dawes Exp $ */ /* * - * Acceleration for SiS300 SiS630 SiS540. - * It is done in a separate file because the register formats are + * Acceleration for SiS300 SiS630 SiS540. + * It is done in a separate file because the register formats are * very different from the previous chips. * * - * - * Xavier Ducoin <x.ducoin@lectra.com> + * + * Xavier Ducoin <x.ducoin@lectra.com> */ #if 0 #define DEBUG @@ -17,6 +17,7 @@ #include <xf86.h> #include <xf86_OSproc.h> #include <xf86_ansic.h> +#include <xf86_libc.h> #include <xf86PciInfo.h> #include <xf86Pci.h> @@ -32,612 +33,709 @@ #include "sis.h" #include "sis300_accel.h" - -#ifdef DEBUG +#ifdef DEBUG static void MMIODump(ScrnInfoPtr pScrn); #endif static void SiSSync(ScrnInfoPtr pScrn); static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, int trans_color); + int xdir, int ydir, int rop, + unsigned int planemask, int trans_color); static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int width, int height); + int x1, int y1, int x2, int y2, + int width, int height); static void SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); + int rop, unsigned int planemask); static void SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h); + int x, int y, int w, int h); static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); + int rop, unsigned int planemask); static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, - int y1, int x2, int y2, int flags); + int y1, int x2, int y2, int flags); static void SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir); + int x, int y, int len, int dir); static void SiSSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, unsigned char *pattern); + int fg, int bg, int rop, unsigned int planemask, + int length, unsigned char *pattern); static void SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase); + int x1, int y1, int x2, int y2, + int flags, int phase); static void SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask); + int patx, int paty, int fg, int bg, + int rop, unsigned int planemask); static void SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h); + int patx, int paty, + int x, int y, int w, int h); static void SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int rop, - unsigned int planemask, - int trans_color); + int patx, int paty, int rop, + unsigned int planemask, + int trans_color); static void SiSSubsequentColorPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h); + int patx, int paty, + int x, int y, int w, int h); static void SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask); + int fg, int bg, + int rop, unsigned int planemask); static void SiSSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); + int x, int y, int w, int h, int skipleft); static void SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask); + int fg, int bg, + int rop, unsigned int planemask); static void SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft); + int x, int y, int w, int h, + int srcx, int srcy, int skipleft); + +static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); +static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); +static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); + + +static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth); +static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); + +static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth) {} +static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) {} void SiSInitializeAccelerator(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - pSiS->DoColorExpand = FALSE; + pSiS->DoColorExpand = FALSE; } Bool SiS300AccelInit(ScreenPtr pScreen) { - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSiS = SISPTR(pScrn); - int reservedFbSize, UsableFbSize; - BoxRec Avail; - - pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - SiSInitializeAccelerator(pScrn); - - infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; - - /* sync */ - infoPtr->Sync = SiSSync; - - if ((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && - (pScrn->bitsPerPixel != 32)) return FALSE; - - /* BitBlt */ - infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; - - /* solid fills */ - infoPtr->SetupForSolidFill = SiSSetupForSolidFill; - infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* solid line */ - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* dashed line */ - infoPtr->SetupForDashedLine = SiSSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; - infoPtr->DashPatternMaxLength = 64; - infoPtr->DashedLineFlags = NO_PLANEMASK | - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - - /* 8x8 mono pattern fill - infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - SiSSubsequentMonoPatternFill; - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - NO_TRANSPARENCY | - BIT_ORDER_IN_BYTE_MSBFIRST ; + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + int reservedFbSize; + int UsableFbSize; + unsigned char *AvailBufBase; + BoxRec Avail; + int i, divider; + + pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); + if (!infoPtr) return FALSE; + + SiSInitializeAccelerator(pScrn); + + infoPtr->Flags = LINEAR_FRAMEBUFFER | + OFFSCREEN_PIXMAPS | + PIXMAP_CACHE; + + /* sync */ + infoPtr->Sync = SiSSync; + + if ((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && + (pScrn->bitsPerPixel != 32)) return FALSE; + + /* BitBlt */ + infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; + infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; + + /* solid fills */ + infoPtr->SetupForSolidFill = SiSSetupForSolidFill; + infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; + infoPtr->SolidFillFlags = NO_PLANEMASK; + + /* solid line */ + infoPtr->SetupForSolidLine = SiSSetupForSolidLine; + infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; + infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; + infoPtr->SolidFillFlags = NO_PLANEMASK; + + /* dashed line */ + infoPtr->SetupForDashedLine = SiSSetupForDashedLine; + infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; + infoPtr->DashPatternMaxLength = 64; + infoPtr->DashedLineFlags = NO_PLANEMASK | + LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; + + /* 8x8 mono pattern fill */ + infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = + SiSSubsequentMonoPatternFill; + infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS | + NO_TRANSPARENCY | + BIT_ORDER_IN_BYTE_MSBFIRST ; + +/* 8x8 color pattern fill ---seems not useful by xaa + infoPtr->SetupForColor8x8PatternFill = + SiSSetupForColorPatternFill; + infoPtr->SubsequentColor8x8PatternFillRect = + SiSSubsequentColorPatternFill; + infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS ; */ - /* 8x8 color pattern fill - infoPtr->SetupForColor8x8PatternFill = - SiSSetupForColorPatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - SiSSubsequentColorPatternFill; - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS ; + /* Screen To Screen Color Expand */ +/* infoPtr->SetupForScreenToScreenColorExpandFill = + SiSSetupForScreenToScreenColorExpand; + infoPtr->SubsequentScreenToScreenColorExpandFill = + SiSSubsequentScreenToScreenColorExpand; */ - /* CPU To Screen Color Expand - infoPtr->SetupForCPUToScreenColorExpandFill = - SiSSetupForCPUToScreenColorExpand; - infoPtr->SubsequentCPUToScreenColorExpandFill = - SiSSubsequentCPUToScreenColorExpand; - infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; - infoPtr->ColorExpandRange = PATREGSIZE; - infoPtr->ColorExpandBase = pSiS->IOBase+PBR(0); - infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST | - NO_TRANSPARENCY | - SYNC_AFTER_COLOR_EXPAND | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS ; +/* CPU To Screen Color Expand ---implement another instead of this one! + infoPtr->SetupForCPUToScreenColorExpandFill = + SiSSetupForCPUToScreenColorExpand; + infoPtr->SubsequentCPUToScreenColorExpandFill = + SiSSubsequentCPUToScreenColorExpand; + infoPtr->ColorExpandRange = PATREGSIZE; + infoPtr->ColorExpandBase = pSiS->IOBase+PBR(0); + infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_TRANSPARENCY | + SYNC_AFTER_COLOR_EXPAND | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS ; */ - /* Screen To Screen Color Expand - infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpand; - infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST | - SYNC_AFTER_COLOR_EXPAND | - NO_TRANSPARENCY; +/* per-scanline color expansion*/ + pSiS->ColorExpandBufferNumber = 16; + pSiS->ColorExpandBufferCountMask = 0x0F; + pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; + infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; + infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0]; + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiSSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = SiSSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = SiSSubsequentColorExpandScanline; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + NO_PLANEMASK | + CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST | + LEFT_EDGE_CLIPPING; + +/* divider = ((pScrn->virtualX*pScrn->bitsPerPixel)/8)+8; + pSiS->ImageWriteBufferSize = (((12*1024)+divider-1)/divider)*divider; + infoPtr->SetupForImageWrite = SiSSetupForImageWrite; + infoPtr->SubsequentImageWriteRect = SiSSubsequentImageWriteRect; + infoPtr->ImageWriteFlags = CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + LEFT_EDGE_CLIPPING | + NO_PLANEMASK| + NO_TRANSPARENCY | + NO_GXCOPY | + SYNC_AFTER_IMAGE_WRITE; +*/ + /* init Frame Buffer Manager */ + reservedFbSize = 0; + if (pSiS->TurboQueue) reservedFbSize += 1024*512; + if (pSiS->HWCursor) reservedFbSize += 4096; + reservedFbSize += (pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize); + UsableFbSize = pSiS->FbMapSize - reservedFbSize; + AvailBufBase = pSiS->FbBase + UsableFbSize; + for (i=0; i<pSiS->ColorExpandBufferNumber; i++) + { pSiS->ColorExpandBufferAddr[i] = AvailBufBase + i*pSiS->PerColorExpandBufferSize; + pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize + i*pSiS->PerColorExpandBufferSize; + } +/* reservedFbSize += pSiS->ImageWriteBufferSize; + UsableFbSize = pSiS->FbMapSize - reservedFbSize; + pSiS->ImageWriteBufferAddr = AvailBufBase = pSiS->FbBase + UsableFbSize; + infoPtr->ImageWriteRange = pSiS->ImageWriteBufferAddr; */ + Avail.x1 = 0; + Avail.y1 = 0; + Avail.x2 = pScrn->displayWidth; + Avail.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1; + if (Avail.y2 < 0) Avail.y2 = 32767; - /* init Frame Buffer Manager */ - reservedFbSize = 0; - if (pSiS->TurboQueue) reservedFbSize += 1024*512; - if (pSiS->HWCursor) reservedFbSize += 4096; - reservedFbSize = 4096*1024; - UsableFbSize = pSiS->FbMapSize - reservedFbSize; - Avail.x1 = 0; - Avail.y1 = 0; - Avail.x2 = pScrn->displayWidth; - Avail.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Frame Buffer From (%d,%d) To (%d,%d)\n", - Avail.x1, Avail.y1, Avail.x2, Avail.y2); -/* xf86InitFBManager(pScreen, &Avail); */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Frame Buffer From (%d,%d) To (%d,%d)\n", + Avail.x1, Avail.y1, Avail.x2, Avail.y2); + xf86InitFBManager(pScreen, &Avail); - return(XAAInit(pScreen, infoPtr)); + return(XAAInit(pScreen, infoPtr)); } static void SiSSync(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("SiSSync()\n")); + PDEBUG(ErrorF("SiSSync()\n")); + pSiS->DoColorExpand = FALSE; + SiSIdle - if (pSiS->DoColorExpand) - SiSDoCMD - pSiS->DoColorExpand = FALSE; - SiSIdle } static int sisALUConv[] = { - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0x88, /* dest &= src; DSa, GXand, 0x1 */ - 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ - 0xCC, /* dest = src; S, GXcopy, 0x3 */ - 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ - 0xEE, /* dest |= src; DSo, GXor, 0x7 */ - 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ - 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ - 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ - 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ - 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ + 0x00, /* dest = 0; 0, GXclear, 0 */ + 0x88, /* dest &= src; DSa, GXand, 0x1 */ + 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ + 0xCC, /* dest = src; S, GXcopy, 0x3 */ + 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ + 0xAA, /* dest = dest; D, GXnoop, 0x5 */ + 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ + 0xEE, /* dest |= src; DSo, GXor, 0x7 */ + 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ + 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ + 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ + 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ + 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ + 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ + 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ + 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ }; /* same ROP but with Pattern as Source */ static int sisPatALUConv[] = { - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0xA0, /* dest &= src; DPa, GXand, 0x1 */ - 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ - 0xF0, /* dest = src; P, GXcopy, 0x3 */ - 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ - 0xFA, /* dest |= src; DPo, GXor, 0x7 */ - 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ - 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ - 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ - 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ - 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ + 0x00, /* dest = 0; 0, GXclear, 0 */ + 0xA0, /* dest &= src; DPa, GXand, 0x1 */ + 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ + 0xF0, /* dest = src; P, GXcopy, 0x3 */ + 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ + 0xAA, /* dest = dest; D, GXnoop, 0x5 */ + 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ + 0xFA, /* dest |= src; DPo, GXor, 0x7 */ + 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ + 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ + 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ + 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ + 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ + 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ + 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ + 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ }; static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, int trans_color) + int xdir, int ydir, int rop, + unsigned int planemask, int trans_color) { - SISPtr pSiS = SISPTR(pScrn); -/* XAAInfoRecPtr pXAA = XAAPTR(pScrn);*/ - - PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n", - xdir, ydir, rop, planemask, trans_color)); + SISPtr pSiS = SISPTR(pScrn); +/* XAAInfoRecPtr pXAA = XAAPTR(pScrn);*/ + PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n", + xdir, ydir, rop, planemask, trans_color)); /* - ErrorF("XAAInfoPtr->UsingPixmapCache = %s\n" - "XAAInfoPtr->CanDoMono8x8 = %s\n" - "XAAInfoPtr->CanDoColor8x8 = %s\n" - "XAAInfoPtr->CachePixelGranularity = %d\n" - "XAAInfoPtr->MaxCacheableTileWidth = %d\n" - "XAAInfoPtr->MaxCacheableTileHeight = %d\n" - "XAAInfoPtr->MaxCacheableStippleWidth = %d\n" - "XAAInfoPtr->MaxCacheableStippleHeight = %d\n" - "XAAInfoPtr->MonoPatternPitch = %d\n" - "XAAInfoPtr->CacheWidthMono8x8Pattern = %d\n" - "XAAInfoPtr->CacheHeightMono8x8Pattern = %d\n" - "XAAInfoPtr->ColorPatternPitch = %d\n" - "XAAInfoPtr->CacheWidthColor8x8Pattern = %d\n" - "XAAInfoPtr->CacheHeightColor8x8Pattern = %d\n" - "XAAInfoPtr->CacheColorExpandDensity = %d\n" - "XAAInfoPtr->maxOffPixWidth = %d\n" - "XAAInfoPtr->maxOffPixHeight= %d\n" - "XAAInfoPtr->NeedToSync = %s\n" - "\n", - pXAA->UsingPixmapCache ? "True" : "False", - pXAA->CanDoMono8x8 ? "True" : "False", - pXAA->CanDoColor8x8 ? "True" : "False", - pXAA->CachePixelGranularity, - pXAA->MaxCacheableTileWidth, - pXAA->MaxCacheableTileHeight, - pXAA->MaxCacheableStippleWidth, - pXAA->MaxCacheableStippleHeight, - pXAA->MonoPatternPitch, - pXAA->CacheWidthMono8x8Pattern, - pXAA->CacheHeightMono8x8Pattern, - pXAA->ColorPatternPitch, - pXAA->CacheWidthColor8x8Pattern, - pXAA->CacheHeightColor8x8Pattern, - pXAA->CacheColorExpandDensity, - pXAA->maxOffPixWidth, - pXAA->maxOffPixHeight, - pXAA->NeedToSync ? "True" : "False"); + ErrorF("XAAInfoPtr->UsingPixmapCache = %s\n" + "XAAInfoPtr->CanDoMono8x8 = %s\n" + "XAAInfoPtr->CanDoColor8x8 = %s\n" + "XAAInfoPtr->CachePixelGranularity = %d\n" + "XAAInfoPtr->MaxCacheableTileWidth = %d\n" + "XAAInfoPtr->MaxCacheableTileHeight = %d\n" + "XAAInfoPtr->MaxCacheableStippleWidth = %d\n" + "XAAInfoPtr->MaxCacheableStippleHeight = %d\n" + "XAAInfoPtr->MonoPatternPitch = %d\n" + "XAAInfoPtr->CacheWidthMono8x8Pattern = %d\n" + "XAAInfoPtr->CacheHeightMono8x8Pattern = %d\n" + "XAAInfoPtr->ColorPatternPitch = %d\n" + "XAAInfoPtr->CacheWidthColor8x8Pattern = %d\n" + "XAAInfoPtr->CacheHeightColor8x8Pattern = %d\n" + "XAAInfoPtr->CacheColorExpandDensity = %d\n" + "XAAInfoPtr->maxOffPixWidth = %d\n" + "XAAInfoPtr->maxOffPixHeight= %d\n" + "XAAInfoPtr->NeedToSync = %s\n" + "\n", + pXAA->UsingPixmapCache ? "True" : "False", + pXAA->CanDoMono8x8 ? "True" : "False", + pXAA->CanDoColor8x8 ? "True" : "False", + pXAA->CachePixelGranularity, + pXAA->MaxCacheableTileWidth, + pXAA->MaxCacheableTileHeight, + pXAA->MaxCacheableStippleWidth, + pXAA->MaxCacheableStippleHeight, + pXAA->MonoPatternPitch, + pXAA->CacheWidthMono8x8Pattern, + pXAA->CacheHeightMono8x8Pattern, + pXAA->ColorPatternPitch, + pXAA->CacheWidthColor8x8Pattern, + pXAA->CacheHeightColor8x8Pattern, + pXAA->CacheColorExpandDensity, + pXAA->maxOffPixWidth, + pXAA->maxOffPixHeight, + pXAA->NeedToSync ? "True" : "False"); */ - - SiSSetupSRCBase(0) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCPitch(pSiS->scrnOffset) - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupROP(sisALUConv[rop]) - if (xdir > 0) SiSSetupCMDFlag(X_INC) - if (ydir > 0) SiSSetupCMDFlag(Y_INC) + + SiSSetupSRCBase(0) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupSRCPitch(pSiS->scrnOffset) + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupROP(sisALUConv[rop]) + if (xdir > 0) SiSSetupCMDFlag(X_INC) + if (ydir > 0) SiSSetupCMDFlag(Y_INC) } static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int src_x, int src_y, int dst_x, int dst_y, - int width, int height) + int src_x, int src_y, int dst_x, int dst_y, + int width, int height) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n", - src_x, src_y, dst_x, dst_y, width, height)); - - if (!(pSiS->CommandReg & X_INC)) { - src_x += width-1; - dst_x += width-1; - } - if (!(pSiS->CommandReg & Y_INC)) { - src_y += height-1; - dst_y += height-1; - } - SiSSetupRect(width, height) - SiSSetupSRCXY(src_x,src_y) - SiSSetupDSTXY(dst_x,dst_y) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n", + src_x, src_y, dst_x, dst_y, width, height)); + + if (!(pSiS->CommandReg & X_INC)) { + src_x += width-1; + dst_x += width-1; + } + if (!(pSiS->CommandReg & Y_INC)) { + src_y += height-1; + dst_y += height-1; + } + SiSSetupRect(width, height) + SiSSetupSRCXY(src_x,src_y) + SiSSetupDSTXY(dst_x,dst_y) + SiSDoCMD } static void SiSSetupForSolidFill(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) + int color, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Setup SolidFill(0x%x, 0x%x, 0x%x)\n", - color, rop, planemask)); - - SiSSetupPATFG(color) - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | PATFG | BITBLT) + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup SolidFill(0x%x, 0x%x, 0x%x)\n", + color, rop, planemask)); + + SiSSetupPATFG(color) + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(X_INC | Y_INC | PATFG | BITBLT) } static void SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h) + int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n", - x, y, w, h)); + SISPtr pSiS = SISPTR(pScrn); - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n", + x, y, w, h)); + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) + int color, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n", - color, rop, planemask)); - - SiSSetupLineCount(1) - SiSSetupPATFG(color) - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATFG | LINE) + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n", + color, rop, planemask)); + + SiSSetupLineCount(1) + SiSSetupPATFG(color) + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATFG | LINE) } static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) + int x1, int y1, int x2, int y2, int flags) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n", - x1, y1, x2, y2, flags)); + PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n", + x1, y1, x2, y2, flags)); - SiSSetupX0Y0(x1,y1) - SiSSetupX1Y1(x2,y2) - if (flags & OMIT_LAST) - SiSSetupCMDFlag(NO_LAST_PIXEL) - SiSDoCMD + SiSSetupX0Y0(x1,y1) + SiSSetupX1Y1(x2,y2) + if (flags & OMIT_LAST) + SiSSetupCMDFlag(NO_LAST_PIXEL) + SiSDoCMD } static void SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir) + int x, int y, int len, int dir) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", - x, y, len, dir)); + PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", + x, y, len, dir)); - SiSSetupX0Y0(x,y) - if (dir==DEGREES_0) - SiSSetupX1Y1(x+len,y) - else - SiSSetupX1Y1(x,y+len) - SiSDoCMD + SiSSetupX0Y0(x,y) + if (dir==DEGREES_0) + { SiSSetupX1Y1(x+len,y);} + else + { SiSSetupX1Y1(x,y+len);} + SiSDoCMD } static void SiSSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, unsigned char *pattern) + int fg, int bg, int rop, unsigned int planemask, + int length, unsigned char *pattern) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Setup DashedLine(0x%x, 0x%x, 0x%x, 0x%x, %d, 0x%x:%x)\n", - fg, bg, rop, planemask, length, *(pattern+4), *pattern)); - - SiSSetupLineCount(1) - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupStyleLow(*pattern) - SiSSetupStyleHigh(*(pattern+4)) - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupPATFG(fg) - if (bg != -1) SiSSetupPATBG(bg) + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup DashedLine(0x%x, 0x%x, 0x%x, 0x%x, %d, 0x%x:%x)\n", + fg, bg, rop, planemask, length, *(pattern+4), *pattern)); + + SiSSetupLineCount(1) + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupStyleLow(*pattern) + SiSSetupStyleHigh(*(pattern+4)) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupPATFG(fg) + if (bg != -1) SiSSetupPATBG(bg) } static void SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase) + int x1, int y1, int x2, int y2, + int flags, int phase) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n", - x1, y1, x2, y2, flags, phase)); + PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n", + x1, y1, x2, y2, flags, phase)); - SiSSetupX0Y0(x1,y1) - SiSSetupX1Y1(x2,y2) - if (flags & OMIT_LAST) - SiSSetupCMDFlag(NO_LAST_PIXEL) - SiSDoCMD + SiSSetupX0Y0(x1,y1) + SiSSetupX1Y1(x2,y2) + if (flags & OMIT_LAST) + SiSSetupCMDFlag(NO_LAST_PIXEL) + SiSDoCMD } + + static void SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask) + int patx, int paty, int fg, int bg, + int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n", - patx, paty, fg, bg, rop, planemask)); - - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupMONOPAT(patx,paty) - SiSSetupPATFG(fg) - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATMONO | X_INC | Y_INC) -/* if (bg==-1) - SiSSetupCMDFlag(TRANSPARENT) - else*/ - SiSSetupPATBG(bg) + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n", + patx, paty, fg, bg, rop, planemask)); + + SiSSetupDSTBase(0) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupMONOPAT(patx,paty) + SiSSetupPATFG(fg) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATMONO | X_INC | Y_INC) + SiSSetupPATBG(bg) } static void SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h) + int patx, int paty, + int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", - patx, paty, x, y, w, h)); - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", + patx, paty, x, y, w, h)); + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int rop, - unsigned int planemask, - int trans_color) + int patx, int paty, int rop, + unsigned int planemask, + int trans_color) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup ColorPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x)\n", - patx, paty, rop, planemask, trans_color)); + PDEBUG(ErrorF("Setup ColorPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x)\n", + patx, paty, rop, planemask, trans_color)); - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATPATREG | X_INC | Y_INC) + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATPATREG | X_INC | Y_INC) } static void SiSSubsequentColorPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h) + int patx, int paty, + int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Subsequent ColorPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", - patx, paty, x, y, w, h)); - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + PDEBUG(ErrorF("Subsequent ColorPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", + patx, paty, x, y, w, h)); + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) + int fg, int bg, + int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - XAAInfoRecPtr pXAA = XAAPTR(pScrn); - - PDEBUG(ErrorF("Setup CPUToScreen ColorExpand(0x%x,0x%x, 0x%x,0x%x)\n", - fg, bg, rop, planemask)); - - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCXY(0,0) - SiSSetupSRCFG(fg) - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP) - if (bg==-1) - SiSSetupCMDFlag(TRANSPARENT) - else - SiSSetupSRCBG(bg) + SISPtr pSiS = SISPTR(pScrn); +/* XAAInfoRecPtr pXAA = XAAPTR(pScrn); */ + + PDEBUG(ErrorF("Setup CPUToScreen ColorExpand(0x%x,0x%x, 0x%x,0x%x)\n", + fg, bg, rop, planemask)); + + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupSRCXY(0,0) + SiSSetupSRCFG(fg) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP) + if (bg==-1) + SiSSetupCMDFlag(TRANSPARENT) + else + SiSSetupSRCBG(bg) } static void SiSSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) + int x, int y, int w, int h, int skipleft) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Subsequent CPUToScreen ColorExpand(%d,%d, %d,%d, %d)\n", - x, y, w, h, skipleft)); + PDEBUG(ErrorF("Subsequent CPUToScreen ColorExpand(%d,%d, %d,%d, %d)\n", + x, y, w, h, skipleft)); -/* SiSSetupSRCPitch(((w+31)&0xFFE0)/8)*/ - SiSSetupSRCPitch((w+7)/8) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) -/* SiSDoCMD*/ - pSiS->DoColorExpand = TRUE; +/* SiSSetupSRCPitch(((w+31)&0xFFE0)/8)*/ + SiSSetupSRCPitch((w+7)/8) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) +/* SiSDoCMD*/ + pSiS->DoColorExpand = TRUE; } static void SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) + int fg, int bg, + int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n", - fg, bg, rop)); - - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCFG(fg) - SiSSetupSRCBG(bg) - SiSSetupSRCXY(0,0) - SiSSetupROP(sisALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | ENCOLOREXP) + SISPtr pSiS = SISPTR(pScrn); + PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n", + fg, bg, rop)); + + SiSSetupDSTBase(0) +/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupSRCFG(fg) + SiSSetupSRCBG(bg) + SiSSetupSRCXY(0,0) + SiSSetupROP(sisALUConv[rop]) + SiSSetupCMDFlag(X_INC | Y_INC | ENCOLOREXP) } static void SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft) + int x, int y, int w, int h, + int srcx, int srcy, int skipleft) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", - x, y, w, h, srcx, srcy, skipleft)); + PDEBUG(ErrorF("Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", + x, y, w, h, srcx, srcy, skipleft)); - SiSSetupSRCPitch(((w+31)&0xFFE0)/8) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + SiSSetupSRCPitch(((w+31)&0xFFE0)/8) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } +static void +SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) +{ + SISPtr pSiS=SISPTR(pScrn); + + while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00)!=0) {} + pSiS->ColorExpandRingHead = 0; + pSiS->ColorExpandRingTail = pSiS->ColorExpandBufferNumber - 1; + SiSSetupDSTBase(0); + SiSSetupSRCXY(0,0); + SiSSetupROP(sisALUConv[rop]); + SiSSetupSRCFG(fg); + SiSSetupDSTRect(pSiS->scrnOffset, -1); + SiSSetupDSTColorDepth(pSiS->DstColor); + if (bg==-1) + { SiSSetupCMDFlag(TRANSPARENT|ENCOLOREXP|X_INC|Y_INC|SRCSYSTEM); + } + else + { SiSSetupSRCBG(bg); + SiSSetupCMDFlag(ENCOLOREXP|X_INC|Y_INC|SRCSYSTEM); + }; +} + +int srcpitch; +int xcurrent, ycurrent; +static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) +{ + SISPtr pSiS=SISPTR(pScrn); + int _x0,_y0,_x1,_y1; + if (skipleft > 0) + { _x0=x+skipleft; + _y0=y; + _x1=x+w; + _y1=y+h; + SiSSetupClipLT(_x0,_y0); + SiSSetupClipRB(_x1,_y1); + SiSSetupCMDFlag(CLIPENABLE); + } + SiSSetupRect(w,1); + srcpitch = ((((w+7)/8)+3)>>2)*4; + SiSSetupSRCPitch(srcpitch); + ycurrent=y; + xcurrent=x; +} + +static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + SISPtr pSiS=SISPTR(pScrn); + int newhead,bltbufstage,newtail; + + SiSSetupSRCBase(pSiS->ColorExpandBufferScreenOffset[bufno]); + SiSSetupDSTXY(xcurrent,ycurrent); + ycurrent++; + SiSDoCMD + newhead = pSiS->ColorExpandRingHead = (bufno + 1) & pSiS->ColorExpandBufferCountMask; + while (newhead == pSiS->ColorExpandRingTail) + { bltbufstage = (int)((MMIO_IN16(pSiS->IOBase,0x8242) & 0x1F00)>>8); + newtail = newhead - (bltbufstage + 1); + pSiS->ColorExpandRingTail = (newtail>=0)? newtail: (pSiS->ColorExpandBufferNumber+newtail); + } +} + -#ifdef DEBUG static void MMIODump(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int i; - - SiSIdle - for (i=0x8200; i<0x8250; i+=16) { - ErrorF("MMIO %x: %0X %0X %0X %0X\n", i, - MMIO_IN32(pSiS->IOBase, i ), - MMIO_IN32(pSiS->IOBase, i+ 4), - MMIO_IN32(pSiS->IOBase, i+ 8), - MMIO_IN32(pSiS->IOBase, i+12)); - } + SISPtr pSiS = SISPTR(pScrn); + int i; + + SiSIdle + for (i=0x8200; i<=0x823c; i+=4) { + ErrorF("[%x] %0X \n", i, + MMIO_IN32(pSiS->IOBase,i)); + } + } -#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h index 0d6293801..a5930f729 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h @@ -26,52 +26,52 @@ * David Thomas <davtom@dream.org.uk>. * Xavier Ducoin <x.ducoin@lectra.com> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.1 2000/02/12 20:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.2 2000/12/02 01:16:17 dawes Exp $ */ /* Definitions for the SIS engine communication. */ -#define PATREGSIZE 384 -#define BR(x) (0x8200 | (x) << 2) -#define PBR(x) (0x8300 | (x) << 2) +#define PATREGSIZE 384 +#define BR(x) (0x8200 | (x) << 2) +#define PBR(x) (0x8300 | (x) << 2) /* Definitions for the SiS300 engine command */ #define BITBLT 0x00000000 #define COLOREXP 0x00000001 -#define ENCOLOREXP 0x00000002 +#define ENCOLOREXP 0x00000002 #define MULTIPLE_SCANLINE 0x00000003 #define LINE 0x00000004 #define TRAPAZOID_FILL 0x00000005 #define TRANSPARENT_BITBLT 0x00000006 -#define SRCVIDEO 0x00000000 -#define SRCSYSTEM 0x00000010 +#define SRCVIDEO 0x00000000 +#define SRCSYSTEM 0x00000010 #define SRCAGP 0x00000020 -#define PATFG 0x00000000 -#define PATPATREG 0x00000040 -#define PATMONO 0x00000080 +#define PATFG 0x00000000 +#define PATPATREG 0x00000040 +#define PATMONO 0x00000080 #define X_INC 0x00010000 #define X_DEC 0x00000000 #define Y_INC 0x00020000 #define Y_DEC 0x00000000 -#define NOCLIP 0x00000000 -#define NOMERGECLIP 0x04000000 -#define CLIPENABLE 0x00040000 -#define CLIPWITHOUTMERGE 0x04040000 +#define NOCLIP 0x00000000 +#define NOMERGECLIP 0x04000000 +#define CLIPENABLE 0x00040000 +#define CLIPWITHOUTMERGE 0x04040000 #define OPAQUE 0x00000000 -#define TRANSPARENT 0x00100000 +#define TRANSPARENT 0x00100000 -#define DSTAGP 0x02000000 +#define DSTAGP 0x02000000 #define DSTVIDEO 0x02000000 /* Line */ -#define LINE_STYLE 0x00800000 -#define NO_RESET_COUNTER 0x00400000 -#define NO_LAST_PIXEL 0x00200000 +#define LINE_STYLE 0x00800000 +#define NO_RESET_COUNTER 0x00400000 +#define NO_LAST_PIXEL 0x00200000 /* Macros to do useful things with the SIS BitBLT engine */ @@ -81,80 +81,130 @@ bit 29 Command queue: 1 is empty */ +int CmdQueLen; + #define SiSIdle \ - while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; + while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + CmdQueLen=MMIO_IN16(pSiS->IOBase, 0x8240); + #define SiSSetupSRCBase(base) \ - MMIO_OUT32(pSiS->IOBase, BR(0), base); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(0), base);\ + CmdQueLen --; + #define SiSSetupSRCPitch(pitch) \ - MMIO_OUT16(pSiS->IOBase, BR(1), pitch); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, BR(1), pitch);\ + CmdQueLen --; #define SiSSetupSRCXY(x,y) \ - MMIO_OUT32(pSiS->IOBase, BR(2), (x)<<16 | (y) ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(2), (x)<<16 | (y) );\ + CmdQueLen --; #define SiSSetupDSTBase(base) \ - MMIO_OUT32(pSiS->IOBase, BR(4), base); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(4), base);\ + CmdQueLen --; #define SiSSetupDSTXY(x,y) \ - MMIO_OUT32(pSiS->IOBase, BR(3), (x)<<16 | (y) ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(3), (x)<<16 | (y) );\ + CmdQueLen --; #define SiSSetupDSTRect(x,y) \ - MMIO_OUT32(pSiS->IOBase, BR(5), (y)<<16 | (x) ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(5), (y)<<16 | (x) );\ + CmdQueLen --; #define SiSSetupDSTColorDepth(bpp) \ - MMIO_OUT16(pSiS->IOBase, BR(1)+2, bpp); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, BR(1)+2, bpp);\ + CmdQueLen --; #define SiSSetupRect(w,h) \ - MMIO_OUT32(pSiS->IOBase, BR(6), (h)<<16 | (w) ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(6), (h)<<16 | (w) );\ + CmdQueLen --; #define SiSSetupPATFG(color) \ - MMIO_OUT32(pSiS->IOBase, BR(7), color); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(7), color);\ + CmdQueLen --; #define SiSSetupPATBG(color) \ - MMIO_OUT32(pSiS->IOBase, BR(8), color); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(8), color);\ + CmdQueLen --; #define SiSSetupSRCFG(color) \ - MMIO_OUT32(pSiS->IOBase, BR(9), color); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(9), color);\ + CmdQueLen --; #define SiSSetupSRCBG(color) \ - MMIO_OUT32(pSiS->IOBase, BR(10), color); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(10), color);\ + CmdQueLen --; #define SiSSetupMONOPAT(p0,p1) \ - MMIO_OUT32(pSiS->IOBase, BR(11), p0); \ - MMIO_OUT32(pSiS->IOBase, BR(12), p1); + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(11), p0);\ + MMIO_OUT32(pSiS->IOBase, BR(12), p1);\ + CmdQueLen =CmdQueLen-2; #define SiSSetupClipLT(left,top) \ - MMIO_OUT32(pSiS->IOBase, BR(13), ((left) & 0xFFFF) | (top)<<16 ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\ + CmdQueLen--; #define SiSSetupClipRB(right,bottom) \ - MMIO_OUT32(pSiS->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ + CmdQueLen --; #define SiSSetupROP(rop) \ - pSiS->CommandReg = (rop) << 8; + pSiS->CommandReg = (rop) << 8; #define SiSSetupCMDFlag(flags) \ - pSiS->CommandReg |= (flags); + pSiS->CommandReg |= (flags); #define SiSDoCMD \ - MMIO_OUT32(pSiS->IOBase, BR(15), pSiS->CommandReg); \ - MMIO_OUT32(pSiS->IOBase, BR(16), 0); + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(15), pSiS->CommandReg); \ + MMIO_OUT32(pSiS->IOBase, BR(16), 0);\ + CmdQueLen =CmdQueLen-2; #define SiSSetupX0Y0(x,y) \ - MMIO_OUT32(pSiS->IOBase, BR(2), (y)<<16 | (x) ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(2), (y)<<16 | (x) );\ + CmdQueLen --; #define SiSSetupX1Y1(x,y) \ - MMIO_OUT32(pSiS->IOBase, BR(3), (y)<<16 | (x) ); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(3), (y)<<16 | (x) );\ + CmdQueLen --; #define SiSSetupLineCount(c) \ - MMIO_OUT16(pSiS->IOBase, BR(6), c); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, BR(6), c);\ + CmdQueLen --; #define SiSSetupStylePeriod(p) \ - MMIO_OUT16(pSiS->IOBase, BR(6)+2, p); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, BR(6)+2, p);\ + CmdQueLen --; #define SiSSetupStyleLow(ls) \ - MMIO_OUT32(pSiS->IOBase, BR(11), ls); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(11), ls);\ + CmdQueLen --; #define SiSSetupStyleHigh(ls) \ - MMIO_OUT32(pSiS->IOBase, BR(12), ls); + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, BR(12), ls);\ + CmdQueLen --; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c index 8468b1ad6..380261b90 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.18 2000/08/04 16:13:33 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.19 2000/12/02 01:16:17 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -138,13 +138,14 @@ SiSAccelInit(ScreenPtr pScreen) #endif AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; + AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->displayWidth; if (pSiS->HWCursor || pSiS->TurboQueue) offset = 262144; else offset = 0; AvailFBArea.y2 = (pSiS->FbMapSize - offset) / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + + if (AvailFBArea.y2 < 0) AvailFBArea.y2 = 32767; xf86InitFBManager(pScreen, &AvailFBArea); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c index 44bbdd440..bedd1bc1d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.16 2000/09/22 11:35:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.18 2000/12/02 15:30:50 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -49,6 +49,7 @@ static void SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiSLVDSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); @@ -62,6 +63,9 @@ static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); +unsigned short ch7005idx[0x11]={0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; + + int compute_vclk( int Clock, @@ -465,10 +469,11 @@ SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) /*sisReg->sisRegs3C2 = inb(0x3CC);*/ sisReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c); - if (pSiS->LVDSFlags) + if ((pSiS->VBFlags & (VB_LVDS | CRT2_LCD))==(VB_LVDS|CRT2_LCD)) (*pSiS->SiSSaveLVDS)(pScrn, sisReg); - - if (pSiS->VBFlags & CRT2_ENABLE) + if ((pSiS->VBFlags & (VB_CHRONTEL | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) + (*pSiS->SiSSaveChrontel)(pScrn,sisReg); + if ((pSiS->VBFlags & (VB_301|VB_302|VB_303)) && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) (*pSiS->SiSSave2)(pScrn, sisReg); } @@ -514,12 +519,14 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) "Restore to - %02X Read after - %02X\n", sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); } - if (pSiS->LVDSFlags) { /* For SiS LVDS */ - (*pSiS->SiSRestoreLVDS)(pScrn, sisReg); - } - if (pSiS->VBFlags & CRT2_ENABLE) { /* For SiS301 */ - (*pSiS->SiSRestore2)(pScrn, sisReg); - } + + if ((pSiS->VBFlags & (VB_LVDS | CRT2_LCD))==(VB_LVDS|CRT2_LCD)) + (*pSiS->SiSRestoreLVDS)(pScrn, sisReg); + if ((pSiS->VBFlags & (VB_CHRONTEL | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) + (*pSiS->SiSRestoreChrontel)(pScrn,sisReg); + if ((pSiS->VBFlags & (VB_301|VB_302|VB_303)) && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) + (*pSiS->SiSRestore2)(pScrn, sisReg); + /*outb(0x3C2, sisReg->sisRegs3C2);*/ outb(pSiS->RelIO+0x42, sisReg->sisRegs3C2); @@ -567,6 +574,23 @@ SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) } static void +SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + int i; + + /* for SiS Chrontel TV */ + for (i=0; i<0x29; i++) { + inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + } + for (i=0; i<0x11; i++) + sisReg->ch7005[i]=GetCH7005(ch7005idx[i]); + + sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ +} + + +static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); @@ -649,6 +673,42 @@ SiSLVDSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) LockCRT2(pSiS->RelIO+0x30); } +static void +SiSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + int i; + unsigned short wtemp; + + DisableBridge(pSiS->RelIO+0x30); + UnLockCRT2(pSiS->RelIO+0x30); + + for (i=0; i<0x11; i++) + { wtemp = ((sisReg->ch7005[i]) << 8) + (ch7005idx[i] & 0x00FF); + SetCH7005(wtemp); + } + + /* SetCRT2ModeRegs() */ + outSISIDXREG(pSiS->RelIO+0x04, 4, 0); + outSISIDXREG(pSiS->RelIO+0x04, 5, 0); + outSISIDXREG(pSiS->RelIO+0x04, 6, 0); + outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); + outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); + + if (!(sisReg->sisRegs3D4[0x30] & 0x03) && + (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ + LockCRT2(pSiS->RelIO+0x30); + return; + } + SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); + + orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); + andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ + + EnableBridge(pSiS->RelIO+0x30); + LockCRT2(pSiS->RelIO+0x30); +} + unsigned int SiSddc1Read(ScrnInfoPtr pScrn) { @@ -1139,9 +1199,11 @@ SISDACPreInit(ScrnInfoPtr pScrn) pSiS->SiSSave = SiS300Save; pSiS->SiSSave2 = SiS301Save; pSiS->SiSSaveLVDS = SiSLVDSSave; + pSiS->SiSSaveChrontel = SiSChrontelSave; pSiS->SiSRestore = SiS300Restore; pSiS->SiSRestore2 = SiS301Restore; pSiS->SiSRestoreLVDS = SiSLVDSRestore; + pSiS->SiSRestoreChrontel= SiSChrontelRestore; pSiS->LoadCRT2Palette = SiS301LoadPalette; pSiS->SetThreshold = SiS630Threshold; break; @@ -1150,9 +1212,11 @@ SISDACPreInit(ScrnInfoPtr pScrn) pSiS->SiSSave = SiS300Save; pSiS->SiSSave2 = SiS301Save; pSiS->SiSSaveLVDS = SiSLVDSSave; + pSiS->SiSSaveChrontel = SiSChrontelSave; pSiS->SiSRestore = SiS300Restore; pSiS->SiSRestore2 = SiS301Restore; pSiS->SiSRestoreLVDS = SiSLVDSRestore; + pSiS->SiSRestoreChrontel= SiSChrontelRestore; pSiS->LoadCRT2Palette = SiS301LoadPalette; pSiS->SetThreshold = SiS300Threshold; break; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c index 1ef028274..79cb34251 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.7 2000/11/09 11:32:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.8 2000/12/02 01:16:17 dawes Exp $ */ /* modified from tdfx_dri.c, mga_dri.c */ @@ -179,29 +179,6 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) DRIInfoPtr pDRIInfo; SISDRIPtr pSISDRI; -{ - unsigned int port_3c5_value; - -#if 0 - /* Set magic number */ - outb (0x3c4, 0x05); - if (inb (0x3c5) == 0x21){ - outb (0x3c4, 0x05); - outb (0x3c5, 0x86); - } - - /* Enable 2D/3D */ - outb (0x3c4, 0x1E); - port_3c5_value = inb (0x3c5); - port_3c5_value |= 0x5A; - outb (0x3c5, port_3c5_value); - - /* Enable HW to retry MMIO command */ - outb (0x3c4, 0x22); - outb (0x3c5, 0xb2); -#endif -} - /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for canonical symbols in each module. */ if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c index 9b0b6c11a..be2b5cecf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.53 2000/11/09 11:32:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.55 2000/12/02 15:30:51 tsi Exp $ */ #include "fb.h" @@ -63,6 +63,11 @@ #include "extensions/dpms.h" #endif +#ifdef XvExtension +#include "xf86xv.h" +#include "Xv.h" +#endif + #ifdef XF86DRI #include "dri.h" #endif @@ -473,9 +478,7 @@ SISProbe(DriverPtr drv, int flags) numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -820,6 +823,38 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) SISLCDPreInit(pScrn); SISTVPreInit(pScrn); SISCRT2PreInit(pScrn); + if (pSiS->ForceCRT2Type == CRT2_DEFAULT) + { if (pSiS->VBFlags & CRT2_VGA) + pSiS->ForceCRT2Type = CRT2_VGA; + else if (pSiS->VBFlags & CRT2_LCD) + pSiS->ForceCRT2Type = CRT2_LCD; + else if (pSiS->VBFlags & CRT2_TV) + pSiS->ForceCRT2Type = CRT2_TV; + } + switch (pSiS->ForceCRT2Type) + { case CRT2_TV: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD | CRT2_VGA); + if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) + pSiS->VBFlags = pSiS->VBFlags | CRT2_TV; + else + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV); + break; + case CRT2_LCD: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_VGA); + if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) + pSiS->VBFlags = pSiS->VBFlags | CRT2_LCD; + else + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD); + break; + case CRT2_VGA: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_LCD); + if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) + pSiS->VBFlags = pSiS->VBFlags | CRT2_VGA; + else + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_VGA); + break; + } + SISDACPreInit(pScrn); outw(VGA_SEQ_INDEX, (unlock << 8) | 0x05); @@ -1370,6 +1405,19 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); #endif +#ifdef XvExtension + { + XF86VideoAdaptorPtr *ptr; + int n; + + n = xf86XVListGenericAdaptors(pScrn, &ptr); + if (n) { + xf86XVScreenInit(pScreen, ptr, n); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "use generic Xv\n" ); + } + } +#endif + #ifdef XF86DRI if (pSiS->directRenderingEnabled) { /* Now that mi, cfb, drm and others have done their thing, @@ -1386,6 +1434,8 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif + SISInitVideo(pScreen); + pSiS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SISCloseScreen; pScreen->SaveScreen = SISSaveScreen; @@ -1716,47 +1766,38 @@ SISModifyModeInfo(DisplayModePtr mode) void SiSPreSetMode(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - unsigned char ulDispType; - unsigned char ulTemp; - unsigned char usTVType; - unsigned char usScratchCR30, usScratchCR31, usScratchCR32; + unsigned char usScratchCR30, usScratchCR31; unsigned short SR26, SR27; unsigned long temp; - - ulDispType = 0; /* Default connect CRT */ - ulTemp = GetReg1(SISCR, 0x32); - if( ulTemp & 0x10 ) - ulDispType = MASK_DISPTYPE_CRT2; - if( ulTemp & 0x08 ) - ulDispType = MASK_DISPTYPE_LCD; - if( ulTemp & 0x07 ) - ulDispType = MASK_DISPTYPE_TV; - - switch(ulDispType & MASK_DISPTYPE_DISP2) - { - case MASK_DISPTYPE_CRT2: - usScratchCR30 = 0x41; - usScratchCR31 = 0x40; - break; - case MASK_DISPTYPE_LCD: - usScratchCR30 = 0x21; - usScratchCR31 = 0x40; - break; - case MASK_DISPTYPE_TV: - usScratchCR32 = GetReg1(SISCR, 0x32) & 0x07; - usScratchCR32 <<= 2; - usScratchCR30 = 0x01 | usScratchCR32; - usTVType = GetReg1(SISSR, 0x38) & 0x01; - if(usTVType) /* PAL */ - usScratchCR31 = 0x41; - else /* NTSC */ - usScratchCR31 = 0x40; - break; - default: - /* disable CRT2 */ - usScratchCR30 = 0x00; - usScratchCR31 = 0x60; - } + int vbflag; + + usScratchCR30 = usScratchCR31 = 0; + outb(SISCR, 0x31); + usScratchCR31 = inb(SISCR+1) & 0x06; + vbflag=pSiS->VBFlags; + switch (vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) + { case CRT2_TV: + if (vbflag & TV_HIVISION) usScratchCR30 |= 0x80; + else if (vbflag & TV_PAL) usScratchCR31 |= 0x01; + + if (vbflag & TV_AVIDEO) usScratchCR30 |= 0x04; + else if (vbflag & TV_SVIDEO) usScratchCR30 |= 0x08; + else if (vbflag & TV_SCART) usScratchCR30 |= 0x10; + usScratchCR30 |= 0x01; + usScratchCR31 |= 0x40; + break; + case CRT2_LCD: + usScratchCR30 |= 0x21; + usScratchCR31 |= 0x40; + break; + case CRT2_VGA: + usScratchCR30 |= 0x41; + usScratchCR31 |= 0x40; + break; + default: + usScratchCR30 |= 0x00; + usScratchCR31 |= 0x60; + } SetReg1(SISCR, 0x30, usScratchCR30); SetReg1(SISCR, 0x31, usScratchCR31); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c index 01a92422f..a136a702b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.3 2000/08/01 20:52:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.4 2000/12/02 01:16:18 dawes Exp $ */ #include "xf86.h" @@ -12,7 +12,8 @@ typedef enum { OPTION_NOACCEL, OPTION_TURBOQUEUE, OPTION_FAST_VRAM, - OPTION_SET_MEMCLOCK + OPTION_SET_MEMCLOCK, + OPTION_FORCE_CRT2TYPE } SISOpts; static OptionInfoRec SISOptions[] = { @@ -24,6 +25,7 @@ static OptionInfoRec SISOptions[] = { { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type",OPTV_ANYSTR, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -33,6 +35,7 @@ SiSOptions(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); MessageType from; double temp; + char *strptr; /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); @@ -85,6 +88,18 @@ SiSOptions(ScrnInfoPtr pScrn) } */ pSiS->TurboQueue = TRUE; + + pSiS->ForceCRT2Type= CRT2_DEFAULT; + strptr = (char *)xf86GetOptValString(SISOptions,OPTION_FORCE_CRT2TYPE); + if (strptr != 0) + { + if (!xf86strcmp(strptr,"TV")) + pSiS->ForceCRT2Type = CRT2_TV; + if (!xf86strcmp(strptr,"LCD")) + pSiS->ForceCRT2Type = CRT2_LCD; + if (!xf86strcmp(strptr,"VGA")) + pSiS->ForceCRT2Type = CRT2_VGA; + } } OptionInfoPtr diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h index ab405acf7..432eaf99c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.13 2000/02/14 19:20:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.14 2000/12/02 01:16:18 dawes Exp $ */ #include "vgaHW.h" @@ -98,6 +98,12 @@ #define SISCR pSiS->RelIO+CROFFSET #define SISMISCR pSiS->RelIO+MISCROFFSET #define SISMISCW pSiS->RelIO+MISCWOFFSET +#define SISPART1 pSiS->RelIO+0x04 +#define SISPART2 pSiS->RelIO+0x10 +#define SISPART3 pSiS->RelIO+0x12 +#define SISPART4 pSiS->RelIO+0x14 +#define SISPART5 pSiS->RelIO+0x16 + /* 3C4 */ #define BankReg 0x06 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c index 78ec6efb0..371e43435 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.1 2000/08/01 20:52:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.2 2000/12/02 01:16:18 dawes Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -14,9 +14,8 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); int temp; - - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, temp); - if (!(temp & 0x20)) + + if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) return; inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); @@ -25,11 +24,11 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); if (temp == 1) - pSiS->VBFlags = CRT2_LCD | LCD_800x600; + pSiS->VBFlags |= LCD_800x600; if (temp == 2) - pSiS->VBFlags = CRT2_LCD | LCD_1024x768; + pSiS->VBFlags |= LCD_1024x768; if (temp == 3) - pSiS->VBFlags = CRT2_LCD | LCD_1280x1024; + pSiS->VBFlags |= LCD_1280x1024; } void SISTVPreInit(ScrnInfoPtr pScrn) @@ -37,22 +36,18 @@ void SISTVPreInit(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); int temp; - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, temp); - if (!(temp & 0x20)) + if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) return; inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); - if (temp & 0x07) - pSiS->VBFlags |= CRT2_TV; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); - if (temp & 0x10) - pSiS->VBFlags = CRT2_TV | TV_SCART; - else if (temp & 0x08) - pSiS->VBFlags = CRT2_TV | TV_SVIDEO; - else if (temp & 0x04) - pSiS->VBFlags = CRT2_TV | TV_AVIDEO; - else + if (temp & 0x04) + pSiS->VBFlags |= (CRT2_TV | TV_SCART); + else if (temp & 0x02) + pSiS->VBFlags |= (CRT2_TV | TV_SVIDEO); + else if (temp & 0x01) + pSiS->VBFlags |= (CRT2_TV | TV_AVIDEO); + else if (temp & 0x40) + pSiS->VBFlags |= (CRT2_TV | TV_HIVISION); return; inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); @@ -67,8 +62,7 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); int temp; - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, temp); - if (!(temp & 0x20)) + if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) return; inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h index f767c45fd..bd374e186 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.3 2000/12/02 01:16:18 dawes Exp $ */ /* CR30 VBInfo = CR31:CR30 */ #define SET_SIMU_SCAN_MODE 0x0001 @@ -27,6 +27,8 @@ extern void EnableBridge(unsigned short); extern void DisableBridge(unsigned short); extern void LockCRT2(unsigned short); extern void UnLockCRT2(unsigned short); +extern void SetCH7005(unsigned short); +extern unsigned short GetCH7005(unsigned short); typedef struct _SiS301Reg { CARD8 *VBPart1; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c index e9f9dd0df..25d95725a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.5 2000/09/22 11:35:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.6 2000/12/02 01:16:18 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -381,6 +381,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->sisRegs3C4[8] = (CRT_CPUthresholdLow & 0xf) << 4 | 0xF; pReg->sisRegs3C4[9] &= 0xF0; pReg->sisRegs3C4[9] |= (CRT_CPUthresholdHigh & 0xF); + /*pReg->sisRegs3C4[0x3F] &= 0xE3;*/ pReg->sisRegs3C4[0x3F] &= 0xE3; pReg->sisRegs3C4[0x3F] |= (CRT_CPUthresholdHigh & 0x10) | (CRT_CPUthresholdLow & 0x10) >> 2 | @@ -578,25 +579,36 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); int temp; - unsigned short usOffsetHigh, usOffsetLow, vBiosVersion; + unsigned short usOffsetHigh, usOffsetLow, vBiosVersion; unsigned long ROMAddr = (unsigned long) SISPTR(pScrn)->BIOS; usOffsetHigh = *((unsigned char *)(ROMAddr+0x08)) - 0x30; usOffsetLow = *((unsigned char *)(ROMAddr+0x09)) - 0x30; - vBiosVersion = usOffsetHigh << 4 | usOffsetLow; - if(vBiosVersion < 0x02) - { + vBiosVersion = usOffsetHigh << 4 | usOffsetLow; + if(vBiosVersion < 0x02) + { outSISIDXREG(pSiS->RelIO+CROFFSET, 0x37, 0); inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - temp &= 0x07; + temp &= 0x07; outSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - } - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x37, temp); - if(temp & 0x0C) - pSiS->LVDSFlags = TRUE; - else - pSiS->LVDSFlags = FALSE; + } + outb(SISPART4, 0x00); + temp = inb(SISPART4+1) & 0x0F; + pSiS->VBFlags = 0; /*reset*/ + if (temp == 1) + pSiS->VBFlags|=VB_301; /*301*/ + else if (temp == 2) + pSiS->VBFlags|=VB_302; /*302*/ + else if (temp == 3) + pSiS->VBFlags|=VB_303; /*303*/ + else + { + outb(SISCR, 0x37); + temp = ((inb(SISCR+1))>>1) & 0x07; + if ((temp==2) || (temp==3) || (temp==4)) pSiS->VBFlags|=VB_LVDS; + if (temp==4) pSiS->VBFlags |= VB_CHRONTEL; + } + switch (pSiS->Chipset) { case PCI_CHIP_SIS300: case PCI_CHIP_SIS630: diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c new file mode 100644 index 000000000..9c91fd320 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c @@ -0,0 +1,1270 @@ +/*************************************************************************** + +Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. +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, sub license, 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 (including the +next paragraph) 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 NON-INFRINGEMENT. +IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS 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. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.1 2000/12/02 01:16:19 dawes Exp $ */ + +/* + * sis_video.c: SIS Xv driver. Based on the mga Xv driver by Mark Vojkovich + * and i810 Xv driver by Jonathan Bian <jonathan.bian@intel.com>. + * + * Authors: + * Sung-Ching Lin <sclin@sis.com.tw> + * + * Notes: + * + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "sis.h" +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" + +/* TODO: move to sis_regs.h */ +#include "sis_vidregs.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +static XF86VideoAdaptorPtr SISSetupImageVideo(ScreenPtr); +static void SISStopVideo(ScrnInfoPtr, pointer, Bool); +static int SISSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int SISGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void SISQueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int SISPutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int SISQueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); + +static void SISBlockHandler(int, pointer, pointer, pointer); + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey; + +#define IMAGE_MIN_WIDTH 32 +#define IMAGE_MIN_HEIGHT 24 +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 + +#define DISPMODE_SINGLE1 0x1 +#define DISPMODE_SINGLE2 0x2 +#define DISPMODE_MIRROR 0x4 + +/**************************************************************************** +* raw register access : these routines directly interact with the sis's +* control aperature. must not be called until after +* the board's pci memory has been mapped. +****************************************************************************/ + +static CARD32 _sisread(SISPtr pSIS, CARD32 reg) +{ + return *(pSIS->IOBase + reg); +} + +static void _siswrite(SISPtr pSIS, CARD32 reg, CARD32 data) +{ + *(pSIS->IOBase + reg) = data; +} + +static CARD8 getvideoreg(SISPtr pSIS, CARD8 reg) +{ + outb (pSIS->RelIO + vi_index_offset, reg); + return inb(pSIS->RelIO + vi_data_offset); +} + +static void setvideoreg(SISPtr pSIS, CARD8 reg, CARD8 data) +{ + outb (pSIS->RelIO + vi_index_offset, reg); + outb (pSIS->RelIO + vi_data_offset, data); +} + +static void setvideoregmask(SISPtr pSIS, CARD8 reg, CARD8 data, CARD8 mask) +{ + CARD8 old; + + outb (pSIS->RelIO + vi_index_offset, reg); + old = inb(pSIS->RelIO + vi_data_offset); + data = (data & mask) | (old & (~mask)); + outb (pSIS->RelIO + vi_data_offset, data); +} + +static CARD8 getsrreg(SISPtr pSIS, CARD8 reg) +{ + outb (pSIS->RelIO + sr_index_offset, 0x05); + if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) + outb (pSIS->RelIO + sr_data_offset, 0x86); + outb (pSIS->RelIO + sr_index_offset, reg); + return inb(pSIS->RelIO + sr_data_offset); +} + +static void setsrreg(SISPtr pSIS, CARD8 reg, CARD8 data) +{ + outb (pSIS->RelIO + sr_index_offset, 0x05); + if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) + outb (pSIS->RelIO + sr_data_offset, 0x86); + outb (pSIS->RelIO + sr_index_offset, reg); + outb (pSIS->RelIO + sr_data_offset, data); +} + +static void setsrregmask(SISPtr pSIS, CARD8 reg, CARD8 data, CARD8 mask) +{ + CARD8 old; + + outb (pSIS->RelIO + sr_index_offset, 0x05); + if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) + outb (pSIS->RelIO + sr_data_offset, 0x86); + outb (pSIS->RelIO + sr_index_offset, reg); + old = inb(pSIS->RelIO + sr_data_offset); + data = (data & mask) | (old & (~mask)); + outb (pSIS->RelIO + sr_data_offset, data); +} + +static CARD8 getsisreg(SISPtr pSIS, CARD8 index_offset, CARD8 reg) +{ + outb (pSIS->RelIO + index_offset, reg); + return inb(pSIS->RelIO + index_offset+1); +} + +static void setsisreg(SISPtr pSIS, CARD8 index_offset, CARD8 reg, CARD8 data) +{ + outb (pSIS->RelIO + index_offset, reg); + outb (pSIS->RelIO + index_offset+1, data); +} + +/* VBlank */ +static CARD8 vblank_active_CRT1(SISPtr pSIS) +{ + return (inb(pSIS->RelIO + input_stat) & 0x08); +} + +static CARD8 vblank_active_CRT2(SISPtr pSIS) +{ + return (getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VR) & 0x02); +} + +/* Scanline */ +static CARD32 get_scanline_CRT1(SISPtr pSIS) +{ + CARD32 line; + + _siswrite (pSIS, REG_PRIM_CRT_COUNTER, 0x00000001); + line = _sisread (pSIS, REG_PRIM_CRT_COUNTER); + + return ((line >> 16) & 0x07FF); +} + +static CARD32 get_scanline_CRT2(SISPtr pSIS) +{ + CARD32 line; + + line = (CARD32)(getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount1) & 0x70) * 16 + + getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount); + + return line; +} + +void SISInitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + + if (pScrn->bitsPerPixel != 8) + { + newAdaptor = SISSetupImageVideo(pScreen); + } + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); +} + + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 2 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = +{ + {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} +}; + +#define NUM_IMAGES 2 +#define PIXEL_FMT_YV12 0x32315659 +#define PIXEL_FMT_YUY2 0x32595559 + +static XF86ImageRec Images[NUM_IMAGES] = +{ + { + PIXEL_FMT_YUY2, + XvYUV, + LSBFirst, + {'Y','U','Y','2', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 16, + XvPacked, + 1, + 0, 0, 0, 0 , + 8, 8, 8, + 1, 2, 2, + 1, 1, 1, + {'Y','U','Y','V', + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, + { + PIXEL_FMT_YV12, + XvYUV, + LSBFirst, + {'Y','V','1','2', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 12, + XvPlanar, + 3, + 0, 0, 0, 0 , + 8, 8, 8, + 1, 2, 2, + 1, 2, 2, + {'Y','V','U', + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + } +}; + +typedef struct { + int pixelFormat; + + CARD16 pitch; + + CARD8 keyOP; + CARD16 HUSF; + CARD16 VUSF; + CARD8 IntBit; + CARD8 wHPre; + + CARD16 srcW; + CARD16 srcH; + + BoxRec dstBox; + + CARD32 PSY; + CARD32 PSV; + CARD32 PSU; + CARD8 bobEnable; + + CARD8 contrastCtrl; + CARD8 contrastFactor; + + CARD8 lineBufSize; + + CARD8 (*VBlankActiveFunc)(SISPtr); + CARD32 (*GetScanLineFunc)(SISPtr pSIS); +} SISOverlayRec, *SISOverlayPtr; + +typedef struct { + FBAreaPtr fbAreaPtr; + int fbSize; + CARD32 bufAddr[2]; + + unsigned char currentBuf; + + short drw_x, drw_y, drw_w, drw_h; + short src_x, src_y, src_w, src_h; + int id; + short srcPitch, height; + + unsigned char brightness; + unsigned char contrast; + + RegionRec clip; + CARD32 colorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; + + CARD32 displayMode; +} SISPortPrivRec, *SISPortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (SISPortPrivPtr)((SISPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + + +static void +SISResetVideo(ScrnInfoPtr pScrn) +{ + SISPtr pSIS = SISPTR(pScrn); + + if (getsrreg (pSIS, 0x05) != 0xa1) + { + setsrreg (pSIS, 0x05, 0x86); + if (getsrreg (pSIS, 0x05) != 0xa1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Standard password not initialize\n"); + } + if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) + { + setvideoreg (pSIS, Index_VI_Passwd, 0x86); + if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Video password not initialize\n"); + } + + /* Initial first set */ + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x80, 0x81); + setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); + setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); + setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); + + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); + + /* Initial second set */ + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x81, 0x81); + setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); + setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); + setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); + + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); + + /* set default contrast */ + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x00, 0x01); + setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSIS, Index_VI_Brightness, 0x20); + + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x01, 0x01); + setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSIS, Index_VI_Brightness, 0x20); + +} + + +static XF86VideoAdaptorPtr +SISSetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSIS = SISPTR(pScrn); + XF86VideoAdaptorPtr adapt; + SISPortPrivPtr pPriv; + + if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(SISPortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "SIS Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPriv = (SISPortPrivPtr)(&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = 2; + adapt->nAttributes = 3; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = SISStopVideo; + adapt->SetPortAttribute = SISSetPortAttribute; + adapt->GetPortAttribute = SISGetPortAttribute; + adapt->QueryBestSize = SISQueryBestSize; + adapt->PutImage = SISPutImage; + adapt->QueryImageAttributes = SISQueryImageAttributes; + + pPriv->colorKey = 0x000101fe; + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 128; + + pPriv->currentBuf = 0; + + pPriv->fbAreaPtr = NULL; + pPriv->fbSize = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pSIS->adaptor = adapt; + + pSIS->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = SISBlockHandler; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + /* set display mode */ + /* TODO: support CRT2-only mode */ + if(pSIS->VBFlags) { + pPriv->displayMode = DISPMODE_MIRROR; + setsrregmask (pSIS, 0x06, 0x80, 0xc0); + setsrregmask (pSIS, 0x32, 0x80, 0xc0); + } + else { + pPriv->displayMode = DISPMODE_SINGLE1; + setsrregmask (pSIS, 0x06, 0x00, 0xc0); + setsrregmask (pSIS, 0x32, 0x00, 0xc0); + } + + SISResetVideo(pScrn); + + return adapt; +} + + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} + + + +static int +SISSetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + + if(attribute == xvBrightness) { + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + } else + if(attribute == xvContrast) { + if((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + } else + if(attribute == xvColorKey) { + pPriv->colorKey = value; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else return BadMatch; + + return Success; +} + +static int +SISGetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + + if(attribute == xvBrightness) { + *value = pPriv->brightness; + } else + if(attribute == xvContrast) { + *value = pPriv->contrast; + } else + if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } else return BadMatch; + + return Success; +} + +static void +SISQueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + *p_w = drw_w; + *p_h = drw_h; + + /* TODO: report the HW limitation */ +} + + +static void +set_scale_factor(SISOverlayPtr pOverlay) +{ + CARD32 I=0; + + int dstW = pOverlay->dstBox.x2 - pOverlay->dstBox.x1; + int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1; + int srcW = pOverlay->srcW; + int srcH = pOverlay->srcH; + + int srcPitch = pOverlay->pitch; + + if (dstW == srcW) { + pOverlay->HUSF = 0x00; + pOverlay->IntBit = 0x05; + } + else if (dstW > srcW) { + dstW += 2; + pOverlay->HUSF = (srcW << 16) / dstW; + pOverlay->IntBit = 0x04; + } + else { + int tmpW = dstW; + + I = 0x00; + pOverlay->IntBit = 0x01; + while (srcW >= tmpW) + { + tmpW <<= 1; + I++; + } + pOverlay->wHPre = (CARD8)(I - 1); + dstW <<= (I - 1); + if ((srcW % dstW)) + pOverlay->HUSF = ((srcW - dstW) << 16) / dstW; + else + pOverlay->HUSF = 0x00; + } + + if (dstH == srcH) { + pOverlay->VUSF = 0x00; + pOverlay->IntBit |= 0x0A; + } + else if (dstH > srcH) { + dstH += 0x02; + pOverlay->VUSF = (srcH << 16) / dstH; + pOverlay->IntBit |= 0x08; + } + else { + CARD32 realI; + + I = realI = srcH / dstH; + pOverlay->IntBit |= 0x02; + + if (I < 2) + { + pOverlay->VUSF = ((srcH - dstH)<<16)/dstH; + } + else + { +#if 0 + if (((pOverlay->bobEnable & 0x08) == 0x00) && + (((srcPitch * I)>>2) > 0xFFF)) + { + pOverlay->bobEnable |= 0x08; + srcPitch >>= 1; + } +#endif + if (((srcPitch * I)>>2) > 0xFFF) + { + I = (0xFFF*2/srcPitch); + pOverlay->VUSF = 0xFFFF; + } + else + { + dstH = I * dstH; + if (srcH % dstH) + pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; + else + pOverlay->VUSF = 0x00; + } + /* set video frame buffer offset */ + pOverlay->pitch = (CARD16)(srcPitch*I); + } + } +} + + +static void +set_line_buf_size(SISOverlayPtr pOverlay) +{ + CARD8 preHIDF; + CARD32 I; + CARD32 line = pOverlay->srcW; + + if (pOverlay->pixelFormat == PIXEL_FMT_YV12) + { + preHIDF = pOverlay->wHPre & 0x07; + switch (preHIDF) + { + case 3 : + if ((line & 0xffffff00) == line) + I = (line >> 8); + else + I = (line >> 8) + 1; + pOverlay->lineBufSize = (CARD8)(I * 32 - 1); + break; + case 4 : + if ((line & 0xfffffe00) == line) + I = (line >> 9); + else + I = (line >> 9) + 1; + pOverlay->lineBufSize = (CARD8)(I * 64 - 1); + break; + case 5 : + if ((line & 0xfffffc00) == line) + I = (line >> 10); + else + I = (line >> 10) + 1; + pOverlay->lineBufSize = (CARD8)(I * 128 - 1); + break; + case 6 : + if ((line & 0xfffff800) == line) + I = (line >> 11); + else + I = (line >> 11) + 1; + pOverlay->lineBufSize = (CARD8)(I * 256 - 1); + break; + default : + if ((line & 0xffffff80) == line) + I = (line >> 7); + else + I = (line >> 7) + 1; + pOverlay->lineBufSize = (CARD8)(I * 16 - 1); + break; + } + } + else + { + if ((line & 0xffffff8) == line) + I = (line >> 3); + else + I = (line >> 3) + 1; + pOverlay->lineBufSize = (CARD8)(I - 1); + } +} + +static void +merge_line_buf(SISPtr pSIS, SISPortPrivPtr pPriv, Bool enable) +{ + if(enable) { + if(pPriv->displayMode == DISPMODE_MIRROR) { + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x04, 0x04); + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x04, 0x04); + } + else { + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x10, 0x11); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x11, 0x11); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); + } + } + else { + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); + } +} + + +static void +set_format(SISPtr pSIS, SISOverlayPtr pOverlay) +{ + CARD8 fmt; + + switch (pOverlay->pixelFormat) + { + case PIXEL_FMT_YV12: + fmt = 0x0c; + break; + case PIXEL_FMT_YUY2: + fmt = 0x28; + break; + default: + fmt = 0x00; + break; + } + setvideoregmask(pSIS, Index_VI_Control_Misc0, fmt, 0x7c); +} + +static void +set_colorkey(SISPtr pSIS, CARD32 colorkey) +{ + CARD8 r, g, b; + + b = (CARD8)(colorkey & 0xFF); + g = (CARD8)((colorkey>>8) & 0xFF); + r = (CARD8)((colorkey>>16) & 0xFF); + + /* Activate the colorkey mode */ + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Min ,(CARD8)b); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Min ,(CARD8)g); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Min ,(CARD8)r); + + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Max ,(CARD8)b); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Max ,(CARD8)g); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Max ,(CARD8)r); +} + + +static void +set_brightness(SISPtr pSIS, CARD8 brightness) +{ + setvideoreg(pSIS, Index_VI_Brightness ,brightness); +} + + +static void +set_overlay(SISPtr pSIS, SISOverlayPtr pOverlay) +{ + ScrnInfoPtr pScrn = pSIS->pScrn; + + CARD16 pitch=0; + CARD8 h_over=0, v_over=0; + CARD16 bottom, right; + CARD16 screenX = pScrn->currentMode->HDisplay; + CARD16 screenY = pScrn->currentMode->VDisplay; + + bottom = pOverlay->dstBox.y2; + if (bottom > screenY) + bottom = screenY; + + right = pOverlay->dstBox.x2; + if (right > screenX) + right = screenX; + + h_over = (((pOverlay->dstBox.x1>>8) & 0x0f) | ((right>>4) & 0xf0)); + v_over = (((pOverlay->dstBox.y1>>8) & 0x0f) | ((bottom>>4) & 0xf0)); + + pitch = pOverlay->pitch; + + /* set line buffer size */ + setvideoreg(pSIS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize); + + setvideoregmask (pSIS, Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0f); + + while (pOverlay->VBlankActiveFunc(pSIS)); + while (!pOverlay->VBlankActiveFunc(pSIS)); + + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch>>2)); + setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 10), 0x0f); + + setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x20, 0x20); + if (pOverlay->pixelFormat == PIXEL_FMT_YV12) + { + CARD32 PSU=0, PSV=0; + + PSU = pOverlay->PSU; + PSV = pOverlay->PSV; + + setvideoreg (pSIS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)(pitch >> 3)); + setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 7), 0xf0); + /* set U/V start address */ + setvideoreg (pSIS, Index_VI_U_Buf_Start_Low, (CARD8)PSU); + setvideoreg (pSIS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU>>8)); + setvideoreg (pSIS, Index_VI_U_Buf_Start_High, (CARD8)(PSU>>16)); + + setvideoreg (pSIS, Index_VI_V_Buf_Start_Low, (CARD8)PSV); + setvideoreg (pSIS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV>>8)); + setvideoreg (pSIS, Index_VI_V_Buf_Start_High, (CARD8)(PSV>>16)); + } + /* set scale factor */ + setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF)); + setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF)>>8)); + setvideoreg (pSIS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF)); + setvideoreg (pSIS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF)>>8)); + + setvideoregmask (pSIS, Index_VI_Scale_Control, (pOverlay->IntBit << 3)|(pOverlay->wHPre), 0x7f); + + /* set destination position */ + setvideoreg(pSIS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)pOverlay->dstBox.x1); + setvideoreg(pSIS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right); + setvideoreg(pSIS, Index_VI_Win_Hor_Over, (CARD8)h_over); + + setvideoreg(pSIS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)pOverlay->dstBox.y1); + setvideoreg(pSIS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom); + setvideoreg(pSIS, Index_VI_Win_Ver_Over, (CARD8)v_over); + + /* set display start address */ + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY)); + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8)); + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_High, (CARD8)((pOverlay->PSY)>>16)); + setvideoregmask(pSIS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a); + setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x00, 0x20); + + /* set contrast factor */ +/* + setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, pOverlay->contrastCtrl<<6, 0xc0); + setvideoreg (pSIS, Index_VI_Contrast_Factor, pOverlay->contrastFactor); +*/ +} + + +static void +close_overlay(SISPtr pSIS, SISPortPrivPtr pPriv) +{ + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0, 0x01); + setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); + setvideoregmask (pSIS, Index_VI_Control_Misc2, 1, 0x01); + setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); +} + + +static void +SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) +{ + SISPtr pSIS = SISPTR(pScrn); + + short srcPitch = pPriv->srcPitch; + short height = pPriv->height; + SISOverlayRec overlay; + int srcOffsetX=0, srcOffsetY=0; + int sx, sy; + int index = 0; + + memset(&overlay, 0, sizeof(overlay)); + overlay.pixelFormat = pPriv->id; + overlay.pitch = srcPitch; + overlay.keyOP = 0x03; + /* overlay.bobEnable = 0x02; */ + overlay.bobEnable = 0x00; + + overlay.dstBox.x1 = pPriv->drw_x - pScrn->frameX0; + overlay.dstBox.x2 = pPriv->drw_x + pPriv->drw_w - pScrn->frameX0; + overlay.dstBox.y1 = pPriv->drw_y - pScrn->frameY0; + overlay.dstBox.y2 = pPriv->drw_y + pPriv->drw_h - pScrn->frameY0; + + /* FIXME: assume (x2 > x1), (y2 > y1) */ + if((overlay.dstBox.x2 < 0) || (overlay.dstBox.y2 < 0)) + return; + + if(overlay.dstBox.x1 < 0) { + srcOffsetX = pPriv->src_w * (-overlay.dstBox.x1) / pPriv->drw_w; + overlay.dstBox.x1 = 0; + } + if(overlay.dstBox.y1 < 0) { + srcOffsetY = pPriv->src_h * (-overlay.dstBox.y1) / pPriv->drw_h; + overlay.dstBox.y1 = 0; + } + + switch(pPriv->id){ + case PIXEL_FMT_YV12: + sx = (pPriv->src_x + srcOffsetX) & ~7; + sy = (pPriv->src_y + srcOffsetY) & ~1; + overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy*srcPitch; + overlay.PSV = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch + ((sx + sy*srcPitch/2) >> 1); + overlay.PSU = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch*5/4 + ((sx + sy*srcPitch/2) >> 1); + overlay.PSY >>= 2; + overlay.PSV >>= 2; + overlay.PSU >>= 2; + break; + case PIXEL_FMT_YUY2: + default: + sx = (pPriv->src_x + srcOffsetX) & ~1; + sy = (pPriv->src_y + srcOffsetY); + overlay.PSY = (pPriv->bufAddr[pPriv->currentBuf] + sx*2 + sy*srcPitch) >> 2; + break; + } + + /* FIXME: is it possible that srcW < 0 */ + overlay.srcW = pPriv->src_w - (sx - pPriv->src_x); + overlay.srcH = pPriv->src_h - (sy - pPriv->src_y); + + /* merge line buffer */ + /* TODO: unnecessay to do it several times */ + merge_line_buf (pSIS, pPriv, (overlay.srcW > 384)); + + /* set line buffer length */ + set_line_buf_size (&overlay); + + /* set scale factor */ + set_scale_factor (&overlay); + + if(pPriv->displayMode == DISPMODE_SINGLE2) { + index = 1; + overlay.VBlankActiveFunc = vblank_active_CRT2; + overlay.GetScanLineFunc = get_scanline_CRT2; + } + else { + index = 0; + overlay.VBlankActiveFunc = vblank_active_CRT1; + overlay.GetScanLineFunc = get_scanline_CRT1; + } + +MIRROR: + + setvideoregmask (pSIS, Index_VI_Control_Misc2, index, 0x01); + + /* set scale temporarily */ + { + int dstW = overlay.dstBox.x2 - overlay.dstBox.x1; + int srcW = overlay.srcW; + unsigned char i = 0; + + dstW <<= 1; + while(srcW > dstW) { + dstW <<= 1; + i++; + } + setvideoregmask (pSIS, Index_VI_Scale_Control, i, 0x07); + } + + /* set format */ + set_format(pSIS, &overlay); + + /* set color key */ + /* TODO: update only when colorkey changed */ + /* FIXME, is the RGB order correct? */ + set_colorkey(pSIS, pPriv->colorKey); + + /* set brightness */ + set_brightness(pSIS, pPriv->brightness); + + /* set overlay */ + set_overlay(pSIS, &overlay); + + /* enable overlay */ + setvideoregmask (pSIS, Index_VI_Control_Misc0, 0x02, 0x02); + + if((pPriv->displayMode == DISPMODE_MIRROR) && (index == 0)) { + index = 1; + overlay.VBlankActiveFunc = vblank_active_CRT2; + overlay.GetScanLineFunc = get_scanline_CRT2; + goto MIRROR; + } +} + + +static void +SISStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + SISPtr pSIS = SISPTR(pScrn); + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(exit) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + close_overlay(pSIS, pPriv); + } + if(pPriv->fbAreaPtr) { + xf86FreeOffscreenArea(pPriv->fbAreaPtr); + pPriv->fbAreaPtr = NULL; + pPriv->fbSize = 0; + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + /* FIXME */ +/* SISDisplayVideo(pScrn, pPriv); */ + } + } +} + + +static int +SISPutImage( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data +){ + SISPtr pSIS = SISPTR(pScrn); + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + + int totalSize=0; + + pPriv->drw_x = drw_x; + pPriv->drw_y = drw_y; + pPriv->drw_w = drw_w; + pPriv->drw_h = drw_h; + pPriv->src_x = src_x; + pPriv->src_y = src_y; + pPriv->src_w = src_w; + pPriv->src_h = src_h; + pPriv->id = id; + pPriv->height = height; + + switch(id){ + case PIXEL_FMT_YV12: + pPriv->srcPitch = (width + 7) & ~7; + totalSize = (pPriv->srcPitch * height * 3) >> 1; + break; + case PIXEL_FMT_YUY2: + default: + pPriv->srcPitch = (width*2 + 3) & ~3; + totalSize = pPriv->srcPitch * height; + } + + /* allocate memory */ + do { + int lines, pitch, depth; + BoxPtr pBox; + + if(totalSize == pPriv->fbSize) + break; + + pPriv->fbSize = totalSize; + + /* TODO: use xf86AllocateOffscreenLinear is better */ + if(pPriv->fbAreaPtr) { + /* TODO: resize */ + xf86FreeOffscreenArea(pPriv->fbAreaPtr); + } + depth = (pScrn->bitsPerPixel + 7 ) / 8; + pitch = pScrn->displayWidth * depth; + lines = ((totalSize * 2) / pitch) + 1; + pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen, + pScrn->displayWidth, + lines, 0, NULL, NULL, NULL); + + if(!pPriv->fbAreaPtr) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Allocate video memory fails\n"); + return BadAlloc; + } + pBox = &(pPriv->fbAreaPtr->box); + pPriv->bufAddr[0] = (pBox->x1 * depth) + (pBox->y1 * pitch); + pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize; + } while(0); + + /* copy data */ + /* TODO: subimage */ + memcpy(pSIS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); + + SISDisplayVideo(pScrn, pPriv); + + /* update cliplist */ + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + if (pPriv->currentBuf == 0) + pPriv->currentBuf = 1; + else + pPriv->currentBuf = 0; + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + + +static int +SISQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int pitchY, pitchUV; + int size, sizeY, sizeUV; + + if(*w < IMAGE_MIN_WIDTH) *w = IMAGE_MIN_WIDTH; + if(*h < IMAGE_MIN_HEIGHT) *h = IMAGE_MIN_HEIGHT; + + if(*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; + + switch(id) { + case PIXEL_FMT_YV12: + *w = (*w + 7) & ~7; + *h = (*h + 1) & ~1; + pitchY = *w; + pitchUV = *w >> 1; + if(pitches) { + pitches[0] = pitchY; + pitches[1] = pitches[2] = pitchUV; + } + sizeY = pitchY * (*h); + sizeUV = pitchUV * ((*h) >> 1); + if(offsets) { + offsets[0] = 0; + offsets[1] = sizeY; + offsets[2] = sizeY + sizeUV; + } + size = sizeY + (sizeUV << 1); + break; + case PIXEL_FMT_YUY2: + default: + *w = (*w + 1) & ~1; + pitchY = *w << 1; + if(pitches) pitches[0] = pitchY; + if(offsets) offsets[0] = 0; + size = pitchY * (*h); + break; + } + + return size; +} + +static void +SISBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + SISPtr pSIS = SISPTR(pScrn); + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + pScreen->BlockHandler = pSIS->BlockHandler; + + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + + pScreen->BlockHandler = SISBlockHandler; + + if(pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < currentTime.milliseconds) { + /* Turn off the overlay */ + close_overlay(pSIS, pPriv); + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < currentTime.milliseconds) { + if(pPriv->fbAreaPtr) { + xf86FreeOffscreenArea(pPriv->fbAreaPtr); + pPriv->fbAreaPtr = NULL; + pPriv->fbSize = 0; + } + pPriv->videoStatus = 0; + } + } + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h new file mode 100644 index 000000000..6d4247620 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h @@ -0,0 +1,156 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h,v 1.2 2000/12/04 18:50:01 dawes Exp $ */ + +#ifndef SISREG_H +#define SISREG_H + +/* VGA standard register */ +#define Index_SR_Graphic_Mode 0x06 +#define Index_SR_RAMDAC_Ctrl 0x07 +#define Index_SR_Threshold_Ctrl1 0x08 +#define Index_SR_Threshold_Ctrl2 0x09 +#define Index_SR_Misc_Ctrl 0x0F +#define Index_SR_DDC 0x11 +#define Index_SR_Feature_Connector_Ctrl 0x12 +#define Index_SR_DRAM_Sizing 0x14 +#define Index_SR_DRAM_State_Machine_Ctrl 0x15 +#define Index_SR_AGP_PCI_State_Machine 0x21 +#define Index_SR_Internal_MCLK0 0x28 +#define Index_SR_Internal_MCLK1 0x29 +#define Index_SR_Internal_DCLK1 0x2B +#define Index_SR_Internal_DCLK2 0x2C +#define Index_SR_Internal_DCLK3 0x2D +#define Index_SR_Ext_Clock_Sel 0x32 +#define Index_SR_Int_Status 0x34 +#define Index_SR_Int_Enable 0x35 +#define Index_SR_Int_Reset 0x36 +#define Index_SR_Power_On_Trap 0x38 +#define Index_SR_Power_On_Trap2 0x39 +#define Index_SR_Power_On_Trap3 0x3A + +/* video registers */ +#define Index_VI_Passwd 0x00 +#define Index_VI_Win_Hor_Disp_Start_Low 0x01 +#define Index_VI_Win_Hor_Disp_End_Low 0x02 +#define Index_VI_Win_Hor_Over 0x03 + +#define Index_VI_Win_Ver_Disp_Start_Low 0x04 +#define Index_VI_Win_Ver_Disp_End_Low 0x05 +#define Index_VI_Win_Ver_Over 0x06 + +#define Index_VI_Disp_Y_Buf_Start_Low 0x07 +#define Index_VI_Disp_Y_Buf_Start_Middle 0x08 +#define Index_VI_Disp_Y_Buf_Start_High 0x09 + +#define Index_VI_U_Buf_Start_Low 0x0A +#define Index_VI_U_Buf_Start_Middle 0x0B +#define Index_VI_U_Buf_Start_High 0x0C + +#define Index_VI_V_Buf_Start_Low 0x0D +#define Index_VI_V_Buf_Start_Middle 0x0E +#define Index_VI_V_Buf_Start_High 0x0F + +#define Index_VI_Disp_Y_Buf_Pitch_Low 0x10 +#define Index_VI_Disp_UV_Buf_Pitch_Low 0x11 +#define Index_VI_Disp_Y_UV_Buf_Pitch_High 0x12 + +#define Index_VI_Disp_Y_Buf_Preset_Low 0x13 +#define Index_VI_Disp_Y_Buf_Preset_Middle 0x14 +#define Index_VI_UV_Buf_Preset_Low 0x15 +#define Index_VI_UV_Buf_Preset_Middle 0x16 +#define Index_VI_Disp_Y_UV_Buf_Preset_High 0x17 + +#define Index_VI_Hor_Post_Up_Scale_Low 0x18 +#define Index_VI_Hor_Post_Up_Scale_High 0x19 +#define Index_VI_Ver_Up_Scale_Low 0x1A +#define Index_VI_Ver_Up_Scale_High 0x1B +#define Index_VI_Scale_Control 0x1C + +#define Index_VI_Play_Threshold_Low 0x1D +#define Index_VI_Play_Threshold_High 0x1E +#define Index_VI_Line_Buffer_Size 0x1F + +/* Destination color key */ +#define Index_VI_Overlay_ColorKey_Red_Min 0x20 +#define Index_VI_Overlay_ColorKey_Green_Min 0x21 +#define Index_VI_Overlay_ColorKey_Blue_Min 0x22 +#define Index_VI_Overlay_ColorKey_Red_Max 0x23 +#define Index_VI_Overlay_ColorKey_Green_Max 0x24 +#define Index_VI_Overlay_ColorKey_Blue_Max 0x25 + +/* Source color key */ +#define Index_VI_Overlay_ChromaKey_Red_Y_Min 0x26 +#define Index_VI_Overlay_ChromaKey_Green_U_Min 0x27 +#define Index_VI_Overlay_ChromaKey_Blue_V_Min 0x28 +#define Index_VI_Overlay_ChromaKey_Red_Y_Max 0x29 +#define Index_VI_Overlay_ChromaKey_Green_U_Max 0x2A +#define Index_VI_Overlay_ChromaKey_Blue_V_Max 0x2B + +#define Index_VI_Contrast_Factor 0x2C + +#define Index_VI_Brightness 0x2D +#define Index_VI_Contrast_Enh_Ctrl 0x2E + +#define Index_VI_Key_Overlay_OP 0x2F + +#define Index_VI_Control_Misc0 0x30 +#define Index_VI_Control_Misc1 0x31 +#define Index_VI_Control_Misc2 0x32 + +#define Index_MPEG_Read_Ctrl0 0x60 +#define Index_MPEG_Read_Ctrl1 0x61 +#define Index_MPEG_Read_Ctrl2 0x62 +#define Index_MPEG_Read_Ctrl3 0x63 +#define Index_MPEG_Ver_Up_Scale_Low 0x64 +#define Index_MPEG_Ver_Up_Scale_High 0x65 + +/* + CRT_2 function control register + */ +#define Index_CRT2_FC_CONTROL 0x00 +#define Index_CRT2_FC_SCREEN_HIGH 0x04 +#define Index_CRT2_FC_SCREEN_MID 0x05 +#define Index_CRT2_FC_SCREEN_LOW 0x06 +#define Index_CRT2_FC_ENABLE_WRITE 0x24 +#define Index_CRT2_FC_VR 0x25 +#define Index_CRT2_FC_VCount 0x27 +#define Index_CRT2_FC_VCount1 0x28 + +/* video attributes - these should probably be configurable on the fly + * so users with different desktop sizes can keep + * captured data off the desktop + */ +#define _VINWID 704 +#define _VINHGT _VINHGT_NTSC +#define _VINHGT_NTSC 240 +#define _VINHGT_PAL 290 +#define _VIN_WINDOW (704 * 291 * 2) +#define _VBI_WINDOW (704 * 64 * 2) + +#define _VIN_FIELD_EVEN 1 +#define _VIN_FIELD_ODD 2 +#define _VIN_FIELD_BOTH 4 + +#define vc_index_offset 0x00 +#define vc_data_offset 0x01 +#define vi_index_offset 0x02 +#define vi_data_offset 0x03 +#define crt2_index_offset 0x04 +#define crt2_port_offset 0x05 +#define sr_index_offset 0x44 +#define sr_data_offset 0x45 +#define cr_index_offset 0x54 +#define cr_data_offset 0x55 +#define input_stat 0x5A + +/* i2c registers */ +#define X_INDEXREG 0x14 +#define X_PORTREG 0x15 +#define X_DATA 0x0f +#define I2C_SCL 0x00 +#define I2C_SDA 0x01 +#define I2C_DELAY 10 + +/* mmio registers */ +#define REG_PRIM_CRT_COUNTER 0x8514 + +#endif /* SISREG_H */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c index 6bfe6916c..0313a249e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c,v 1.1 2000/06/30 17:15:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c,v 1.2 2000/12/02 15:30:52 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -184,7 +184,7 @@ static Bool BW2Probe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -229,9 +229,7 @@ BW2Probe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -267,6 +265,7 @@ BW2Probe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c index 542933ce5..6a2468164 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.1 2000/06/30 17:15:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.2 2000/12/02 15:30:53 tsi Exp $ */ #define PSZ 8 #include "xf86.h" @@ -189,7 +189,7 @@ static Bool CG14Probe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -234,9 +234,7 @@ CG14Probe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -272,6 +270,7 @@ CG14Probe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c index a7030d536..a5acd802d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c,v 1.1 2000/06/30 17:15:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c,v 1.2 2000/12/02 15:30:54 tsi Exp $ */ #define PSZ 8 #include "xf86.h" @@ -185,7 +185,7 @@ static Bool CG3Probe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -230,9 +230,7 @@ CG3Probe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -268,6 +266,7 @@ CG3Probe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c index ffdf5ff90..228567d3b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c,v 1.2 2000/06/30 17:15:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c,v 1.4 2000/12/02 15:30:54 tsi Exp $ */ #define PSZ 8 #include "xf86.h" @@ -194,7 +194,7 @@ static Bool CG6Probe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -239,9 +239,7 @@ CG6Probe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -277,6 +275,7 @@ CG6Probe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } @@ -611,10 +610,14 @@ CG6CloseScreen(int scrnIndex, ScreenPtr pScreen) Cg6Ptr pCg6 = GET_CG6_FROM_SCRN(pScrn); pScrn->vtSema = FALSE; + xf86UnmapSbusMem(pCg6->psdp, pCg6->fbc, CG6_RAM_VOFF - CG6_FBC_VOFF + (pCg6->psdp->width * pCg6->psdp->height)); + if (pCg6->HWCursor) + xf86SbusHideOsHwCursor(pCg6->psdp); + pScreen->CloseScreen = pCg6->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h index 89efd0c14..1a93ec075 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.4 2000/06/23 19:29:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.5 2000/12/01 00:24:34 dawes Exp $ */ #ifndef FFB_H #define FFB_H @@ -192,6 +192,7 @@ typedef struct { sbusDevicePtr psdp; Bool HWCursor; Bool NoAccel; + Bool vtSema; CloseScreenProcPtr CloseScreen; xf86CursorInfoPtr CursorInfoRec; unsigned char CursorShiftX, CursorShiftY; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c index f65b6dcd5..587debf36 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.3 2000/06/23 19:29:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.4 2000/12/01 00:24:34 dawes Exp $ */ #include <asm/types.h> #include <math.h> @@ -328,6 +328,9 @@ CreatorPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) WindowPtr pBgWin; int depth = pWin->drawable.depth; + if (pFfb->vtSema) + return; + FFBLOG(("CreatorPaintWindow: WIN(%p) what(%d)\n", pWin, what)); pPrivWin = cfbGetWindowPrivate(pWin); pFfbPrivWin = CreatorGetWindowPrivate(pWin); @@ -452,6 +455,9 @@ CreatorCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) int i, nbox; WindowPtr pwinRoot; + if (pFfb->vtSema) + return; + FFBLOG(("CreatorCopyWindow: WIN(%p)\n", pWin)); REGION_INIT(pScreen, &rgnDst, NullBox, 0); @@ -510,7 +516,10 @@ CreatorSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, Wind register BoxPtr pBox; register int i; PixmapPtr pScrPix; - + + if (pFfb->vtSema) + return; + FFBLOG(("CreatorSaveAreas: WIN(%p)\n", pWin)); i = REGION_NUM_RECTS(prgnSave); pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec)); @@ -556,7 +565,11 @@ CreatorRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg cfb8_32WidScreenPtr pScreenPriv = CFB8_32WID_GET_SCREEN_PRIVATE(pScreen); PixmapPtr pScrPix; - + + pFfb = GET_FFB_FROM_SCREEN(pScreen); + if (pFfb->vtSema) + return; + FFBLOG(("CreatorRestoreAreas: WIN(%p)\n", pWin)); i = REGION_NUM_RECTS(prgnRestore); pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c index 21115a100..b9bc424fc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.5 2000/06/30 17:15:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.7 2000/12/02 15:30:54 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -202,7 +202,7 @@ static Bool FFBProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -247,9 +247,7 @@ FFBProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -285,6 +283,7 @@ FFBProbe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } @@ -979,6 +978,7 @@ FFBEnterVT(int scrnIndex, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); + pFfb->vtSema = FALSE; if (!pFfb->NoAccel) CreatorVtChange (pScrn->pScreen, TRUE); if (pFfb->HWCursor) @@ -1005,6 +1005,11 @@ FFBLeaveVT(int scrnIndex, int flags) if (!pFfb->NoAccel) CreatorVtChange (pScrn->pScreen, FALSE); + + if (pFfb->HWCursor) + xf86SbusHideOsHwCursor (pFfb->psdp); + + pFfb->vtSema = TRUE; return; } @@ -1041,6 +1046,9 @@ FFBCloseScreen(int scrnIndex, ScreenPtr pScreen) xf86UnmapSbusMem(pFfb->psdp, pFfb->dac, 8192); xf86UnmapSbusMem(pFfb->psdp, (void *)pFfb->strapping_bits, 8192); + if (pFfb->HWCursor) + xf86SbusHideOsHwCursor (pFfb->psdp); + pScreen->CloseScreen = pFfb->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c index eb357fac5..235f649e1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c,v 1.2 2000/05/23 04:47:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c,v 1.3 2000/12/01 00:24:34 dawes Exp $ */ #include "ffb.h" #include "ffb_regs.h" @@ -454,11 +454,13 @@ CreatorValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) /* flags for changing the proc vector */ cfbPrivGCPtr devPriv; CreatorPrivGCPtr gcPriv; - int oneRect; + int oneRect, type; int accel, drawableChanged; + FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); gcPriv = CreatorGetGCPrivate (pGC); - if (pDrawable->type != DRAWABLE_WINDOW) { + type = pFfb->vtSema ? -1 : pDrawable->type; + if (type != DRAWABLE_WINDOW) { if (gcPriv->type == DRAWABLE_WINDOW) { extern GCOps cfbNonTEOps; extern GCOps cfb32NonTEOps; @@ -472,7 +474,7 @@ CreatorValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) changes = (1 << (GCLastBit+1)) - 1; pGC->stateChanges = changes; - gcPriv->type = pDrawable->type; + gcPriv->type = type; } if (pGC->depth == 8) cfbValidateGC (pGC, changes, pDrawable); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wid.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wid.c index dfc110fdb..f84c0bca1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wid.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wid.c @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wid.c,v 1.2 2000/06/20 05:08:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wid.c,v 1.3 2000/12/01 00:24:34 dawes Exp $ */ #include "ffb.h" @@ -204,6 +204,9 @@ update_wids(FFBPtr pFfb, int index) unsigned int base; int limit; + if (pFfb->vtSema) + return; + if (p->flags & FFB_DAC_PAC1) base = FFBDAC_PAC1_SPWLUT(index); else diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h index 46ca45162..70b4f808c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h,v 1.2 2000/06/30 17:15:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h,v 1.3 2000/12/01 00:24:35 dawes Exp $ */ #ifndef LEO_H #define LEO_H @@ -77,6 +77,7 @@ typedef struct { sbusDevicePtr psdp; Bool HWCursor; Bool NoAccel; + Bool vtSema; CloseScreenProcPtr CloseScreen; xf86CursorInfoPtr CursorInfoRec; unsigned char CursorShiftX, CursorShiftY; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c index cbe010ca9..e70821732 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.1 2000/05/18 23:21:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.2 2000/12/01 00:24:35 dawes Exp $ */ #define PSZ 32 #include <asm/types.h> @@ -73,6 +73,8 @@ int leoRopTable[16] = { static void LeoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { + ScreenPtr pScreen = pWin->drawable.pScreen; + LeoPtr pLeo = LeoGetScreenPrivate (pScreen); DDXPointPtr pptSrc; DDXPointPtr ppt; RegionPtr prgnDst; @@ -80,7 +82,9 @@ LeoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) int dx, dy; int i, nbox; WindowPtr pwinRoot; - extern WindowPtr *WindowTable; + + if (pLeo->vtSema) + return; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c index 6ad57f3b2..513b76a92 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c @@ -1,3 +1,4 @@ + /* * Leo (ZX) framebuffer driver. * @@ -20,7 +21,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c,v 1.2 2000/05/23 04:47:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c,v 1.4 2000/12/02 15:30:56 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -195,7 +196,7 @@ static Bool LeoProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -240,9 +241,7 @@ LeoProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -278,6 +277,7 @@ LeoProbe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } @@ -604,6 +604,7 @@ LeoEnterVT(int scrnIndex, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); + pLeo->vtSema = FALSE; LeoVtChange (pScrn->pScreen, TRUE); if (pLeo->HWCursor) xf86SbusHideOsHwCursor (pLeo->psdp); @@ -620,8 +621,10 @@ static void LeoLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); LeoVtChange (pScrn->pScreen, FALSE); + pLeo->vtSema = TRUE; } @@ -640,6 +643,9 @@ LeoCloseScreen(int scrnIndex, ScreenPtr pScreen) pScrn->vtSema = FALSE; xf86UnmapSbusMem(pLeo->psdp, pLeo->fb, 0x803000); + if (pLeo->HWCursor) + xf86SbusHideOsHwCursor (pLeo->psdp); + pScreen->CloseScreen = pLeo->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c index 2a49d9121..b6010a11b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c,v 1.1 2000/05/18 23:21:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c,v 1.2 2000/12/01 00:24:35 dawes Exp $ */ #define PSZ 32 @@ -233,10 +233,12 @@ LeoValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) /* flags for changing the proc vector */ LeoPrivGCPtr gcPriv; cfbPrivGCPtr devPriv; - int oneRect; + int oneRect, type; + LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen); gcPriv = LeoGetGCPrivate (pGC); - if (pDrawable->type != DRAWABLE_WINDOW) { + type = pLeo->vtSema ? -1 : pDrawable->type; + if (type != DRAWABLE_WINDOW) { if (gcPriv->type == DRAWABLE_WINDOW) { extern GCOps cfbNonTEOps; @@ -244,7 +246,7 @@ LeoValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) pGC->ops = &cfbNonTEOps; changes = (1 << (GCLastBit+1)) - 1; pGC->stateChanges = changes; - gcPriv->type = pDrawable->type; + gcPriv->type = type; } cfbValidateGC (pGC, changes, pDrawable); return; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c index 8741adec5..14e689239 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c @@ -20,7 +20,7 @@ * 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. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c,v 1.1 2000/06/30 17:15:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c,v 1.3 2000/12/02 15:30:57 tsi Exp $ */ #define PSZ 8 #include "xf86.h" @@ -195,7 +195,7 @@ static Bool TCXProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -240,9 +240,7 @@ TCXProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -278,6 +276,7 @@ TCXProbe(DriverPtr drv, int flags) } xfree(pEnt); } + xfree(usedChips); return foundScreen; } @@ -699,6 +698,9 @@ TCXCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pTcx->thc) xf86UnmapSbusMem(pTcx->psdp, pTcx->fb, 8192); + if (pTcx->HWCursor) + xf86SbusHideOsHwCursor (pTcx->psdp); + pScreen->CloseScreen = pTcx->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile index 7ec7f391b..75347890d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.17 2000/09/20 00:09:29 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.18 2000/12/01 14:28:58 dawes Exp $ XCOMM XCOMM This is the Imakefile for the TDFX driver. XCOMM @@ -18,10 +18,10 @@ DRIDEFINES = $(GLX_DEFINES) #endif SRCS = tdfx_driver.c tdfx_io.c tdfx_hwcurs.c tdfx_accel.c \ - tdfx_dga.c tdfx_priv.c tdfx_sli.c $(DRISRCS) + tdfx_dga.c tdfx_priv.c tdfx_sli.c tdfx_video.c $(DRISRCS) OBJS = tdfx_driver.o tdfx_io.o tdfx_hwcurs.o tdfx_accel.o \ - tdfx_dga.o tdfx_priv.o tdfx_sli.o $(DRIOBJS) + tdfx_dga.o tdfx_priv.o tdfx_sli.o tdfx_video.o $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -71,5 +71,6 @@ InstallDriverSDKNonExecFile(tdfx_io.c,$(DRIVERSDKDIR)/drivers/tdfx) InstallDriverSDKNonExecFile(tdfx_priv.c,$(DRIVERSDKDIR)/drivers/tdfx) InstallDriverSDKNonExecFile(tdfx_priv.h,$(DRIVERSDKDIR)/drivers/tdfx) InstallDriverSDKNonExecFile(tdfx_sli.c,$(DRIVERSDKDIR)/drivers/tdfx) +InstallDriverSDKNonExecFile(tdfx_video.c,$(DRIVERSDKDIR)/drivers/tdfx) InstallDriverSDKObjectModule(tdfx,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp index a92c55a65..847c24b9d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp,v 1.4 2000/06/14 02:13:15 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp,v 1.5 2000/12/01 14:28:59 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH TDFX __drivermansuffix__ "Version 4.0.1" "XFree86" @@ -15,7 +15,7 @@ tdfx \- 3Dfx video driver .SH DESCRIPTION .B tdfx is an XFree86 driver for 3Dfx video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. +It supports the Voodoo Banshee, Voodoo3, Voodoo4 and Voodoo5 cards. .SH SUPPORTED HARDWARE The .B tdfx diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index 17221f249..3f78a9230 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h @@ -5,7 +5,7 @@ Copyright: 1998,1999 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.11 2000/09/26 15:57:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.13 2000/12/01 16:07:15 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ @@ -41,16 +41,14 @@ typedef struct _TDFXRec *TDFXPtr; #define PIXMAP_CACHE_LINES 512 #endif -#ifdef PROP_3DFX #include "tdfx_priv.h" -#else -#define PROPDATA -#define PROPSAREADATA -#endif -extern Bool TDFXInitPrivate(ScreenPtr pScreen); -extern void TDFXShutdownPrivate(ScreenPtr pScreen); -extern void TDFXSwapContextPrivate(ScreenPtr pScreen); + +extern Bool TDFXInitFifo(ScreenPtr pScreen); +extern void TDFXShutdownFifo(ScreenPtr pScreen); +extern void TDFXSwapContextFifo(ScreenPtr pScreen); extern void TDFXLostContext(ScreenPtr pScreen); +extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples); +extern Bool TDFXDisableSLI(TDFXPtr pTDFX); #ifdef XF86DRI extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); @@ -126,6 +124,7 @@ typedef struct { unsigned int srcbaseaddr; unsigned int dstbaseaddr; unsigned char ExtVga[2]; + unsigned int dactable[512]; } TDFXRegRec, *TDFXRegPtr; typedef struct TextureData_t { @@ -198,6 +197,18 @@ typedef struct _TDFXRec { TDFXConfigPrivPtr pVisualConfigsPriv; TDFXRegRec DRContextRegs; #endif + /* State for video */ + FBAreaPtr offscreenYUVBuf; + int offscreenYUVBufWidth; + int offscreenYUVBufHeight; + + /* This is a small register shadow. I'm only shadowing + * sst2dDstFmt + * sst2dSrcFmt + * If a real register shadow is ever needed we should probably + * shadow everything and make it happen automatically for every write. */ + INT32 sst2DSrcFmtShadow; + INT32 sst2DDstFmtShadow; } TDFXRec; typedef struct { @@ -232,7 +243,7 @@ extern Bool TDFXDRIFinishScreenInit(ScreenPtr pScreen); extern Bool TDFXDGAInit(ScreenPtr pScreen); extern void TDFXCursorGrabMemory(ScreenPtr pScreen); extern void TDFXSetLFBConfig(TDFXPtr pTDFX); -extern void TDFXSendNOPPrivate(ScrnInfoPtr pScrn); +extern void TDFXSendNOPFifo(ScrnInfoPtr pScrn); extern Bool TDFXSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); extern void TDFXAdjustFrame(int scrnIndex, int x, int y, int flags); @@ -259,34 +270,6 @@ extern void TDFXSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which); - -#ifndef PROP_3DFX -#define DECLARE(a) -#define DECLARE_LAUNCH(size, x) -#ifdef TDFX_DEBUG_CMDS -#define TDFXMakeRoom(p, n) \ - do { \ - if (cmdCnt) \ - ErrorF("Previous TDFXMakeRoom passed incorrect size\n"); \ - cmdCnt=n; \ - lastAddr=0; - TDFXMakeRoomNoProp(p, n); \ - } while(0) -#define TDFXWriteLong(p, a, v) \ - do { \ - if (lastAddr && a<lastAddr) \ - ErrorF("TDFXWriteLong not ordered\n"); \ - lastAddr=a; \ - cmdCnt--; \ - TDFXWriteLongMMIO(p, a, v); \ - while (0) -#else -#define TDFXMakeRoom(p, n) TDFXMakeRoomNoProp(p, n) -#define TDFXWriteLong(p, a, v) TDFXWriteLongMMIO(p, a, v) -#endif -#define TDFXSendNOP TDFXSendNOPNoProp -#endif - #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c index 89ba45a50..66af1fda2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.15 2000/09/24 13:51:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.16 2000/12/01 14:28:59 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -73,6 +73,8 @@ static void TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int skipleft); static void TDFXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +void TDFXSelectBuffer(TDFXPtr pTDFX, int which); + void TDFXNeedSync(ScrnInfoPtr pScrn) { TDFXPtr pTDFX = TDFXPTR(pScrn); @@ -88,7 +90,7 @@ TDFXFirstSync(ScrnInfoPtr pScrn) { #ifdef XF86DRI if (pTDFX->directRenderingEnabled) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - TDFXSwapContextPrivate(screenInfo.screens[pScrn->scrnIndex]); + TDFXSwapContextFifo(screenInfo.screens[pScrn->scrnIndex]); } #endif pTDFX->syncDone=TRUE; @@ -105,7 +107,6 @@ TDFXCheckSync(ScrnInfoPtr pScrn) { pTDFX->syncDone=FALSE; #ifdef XF86DRI if (pTDFX->directRenderingEnabled) { - TDFXLostContext(screenInfo.screens[pScrn->scrnIndex]); DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); } #endif @@ -124,8 +125,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { else fmt=pTDFX->stride|((pTDFX->cpp+1)<<16); TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->fbOffset); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->fbOffset); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; case TDFX_BACK: if (pTDFX->cpp==2) @@ -134,8 +137,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */ TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->backOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->backOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; case TDFX_DEPTH: if (pTDFX->cpp==2) @@ -144,8 +149,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */ TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->depthOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->depthOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; default: ; @@ -233,21 +240,7 @@ TDFXAccelInit(ScreenPtr pScreen) infoPtr->SubsequentScreenToScreenCopy = TDFXSubsequentScreenToScreenCopy; infoPtr->ScreenToScreenCopyFlags = commonFlags; -#ifndef PROP_3DFX - /* We can use direct method because we're writing straight to the board */ - infoPtr->SetupForCPUToScreenColorExpandFill = - TDFXSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - TDFXSubsequentCPUToScreenColorExpandFill; - infoPtr->ColorExpandBase = pTDFX->MMIOBase[0]+SST_2D_LAUNCH; - infoPtr->ColorExpandRange = 128; - infoPtr->CPUToScreenColorExpandFillFlags = commonFlags | - CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | - LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */ - pTDFX->scanlineColorExpandBuffers[0]=0; - pTDFX->scanlineColorExpandBuffers[1]=0; -#else - /* When we're using the proprietary interface we have to use indirect */ + /* When we're using the fifo we have to use indirect expansion */ pTDFX->scanlineColorExpandBuffers[0] = xalloc((pScrn->virtualX+62)/32*4); pTDFX->scanlineColorExpandBuffers[1] = xalloc((pScrn->virtualX+62)/32*4); infoPtr->NumScanlineColorExpandBuffers=2; @@ -261,7 +254,6 @@ TDFXAccelInit(ScreenPtr pScreen) infoPtr->ScanlineCPUToScreenColorExpandFillFlags = commonFlags | CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */ -#endif infoPtr->SetupForMono8x8PatternFill = TDFXSetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = @@ -289,6 +281,9 @@ TDFXAccelInit(ScreenPtr pScreen) pTDFX->ModeReg.dstbaseaddr=pTDFX->fbOffset; TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, pTDFX->ModeReg.dstbaseaddr); + pTDFX->sst2DSrcFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_SRCFORMAT); + pTDFX->sst2DDstFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_DSTFORMAT); + /* Fill in acceleration functions */ return XAAInit(pScreen, infoPtr); } @@ -433,7 +428,9 @@ TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, TDFXMakeRoom(pTDFX, 2); DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; } void @@ -491,6 +488,7 @@ TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, DECLARE(SSTCP_DSTFORMAT|SSTCP_COLORFORE| SSTCP_COLORBACK); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_COLORBACK, color); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, color); } @@ -540,6 +538,7 @@ TDFXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, |SSTCP_PATTERN1ALIAS|SSTCP_COLORFORE| SSTCP_COLORBACK); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_PATTERN0, patx); TDFXWriteLong(pTDFX, SST_2D_PATTERN1, paty); TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg); @@ -655,6 +654,7 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n, (pbox->x2&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD); + pTDFX->sst2DSrcFmtShadow = SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD; TDFXWriteLong(pTDFX, SST_2D_SRCXY, 0); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg); TDFXWriteLong(pTDFX, SST_2D_COMMAND, pTDFX->Cmd); @@ -788,9 +788,11 @@ TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, SSTCP_DSTSIZE|SSTCP_DSTXY|SSTCP_COMMAND | SSTCP_CLIP1MIN|SSTCP_CLIP1MAX); TDFXWriteLong(pTDFX,SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX,SST_2D_CLIP1MIN, (x&0x1FFF) | ((y&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_CLIP1MAX, ((x+w)&0x1FFF) | (((y+h)&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_SRCFORMAT, pTDFX->stride); + pTDFX->sst2DSrcFmtShadow = pTDFX->stride; TDFXWriteLong(pTDFX,SST_2D_SRCXY, (srcx&0x1FFF) | ((srcy&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_DSTSIZE, ((w+offset)&0x1FFF) | ((h&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_DSTXY, ((x-offset)&0x1FFF) | ((y&0x1FFF)<<16)); @@ -849,9 +851,11 @@ TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, SSTCP_DSTFORMAT|SSTCP_DSTSIZE|SSTCP_SRCXY| SSTCP_DSTXY|SSTCP_COMMAND); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_CLIP1MIN, ((y&0x1FFF)<<16)|(x&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, (((y+h)&0x1FFF)<<16)|((x+w)&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF); + pTDFX->sst2DSrcFmtShadow = (((w+31)/32)*4) & 0x3FFF; TDFXWriteLong(pTDFX, SST_2D_SRCXY, skipleft&0x1F); TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, ((w-skipleft)&0x1FFF)|((h&0x1FFF)<<16)); TDFXWriteLong(pTDFX, SST_2D_DSTXY, ((x+skipleft)&0x1FFF) | ((y&0x1FFF)<<16)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index a9fc4499b..c64e0d049 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.12 2000/09/26 15:57:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.13 2000/12/01 14:28:59 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -26,6 +26,8 @@ static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, void *readContextStore, DRIContextType writeContextType, void *writeContextStore); +static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen); +static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen); static void TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); @@ -489,21 +491,6 @@ TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, DRIContextType newContextType, void *newContext) { -#if 0 - ScrnInfoPtr pScrn; - - pScrn = xf86Screens[pScreen->myNum]; - if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && - (newContextType==DRI_2D_CONTEXT)) { /* Exiting from Block Handler */ - TDFXCheckSync(pScrn); - TDFXLostContext(pScreen); - } - if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && - (newContextType==DRI_2D_CONTEXT)) { /* Entering from Wakeup */ - TDFXSwapContextPrivate(pScreen); - TDFXNeedSync(pScrn); - } -#endif } static void @@ -684,3 +671,34 @@ TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, pTDFX->AccelInfoRec->NeedToSync = TRUE; } + +static Bool +TDFXDRIOpenFullScreen(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn; + TDFXPtr pTDFX; + + xf86DrvMsg(pScreen->myNum, X_INFO, "OpenFullScreen\n"); +#if 0 + pScrn = xf86Screens[pScreen->myNum]; + pTDFX=TDFXPTR(pScrn); + if (pTDFX->numChips>1) { + TDFXSetupSLI(pScrn); + } +#endif + return TRUE; +} + +static Bool +TDFXDRICloseFullScreen(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn; + + xf86DrvMsg(pScreen->myNum, X_INFO, "CloseFullScreen\n"); +#if 0 + pScrn = xf86Screens[pScreen->myNum]; + TDFXDisableSLI(pScrn); +#endif + return TRUE; +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index 72a7bef23..6081cd54e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.45 2000/11/14 13:12:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.47 2000/12/02 15:30:57 tsi Exp $ */ /* * Authors: @@ -172,7 +172,6 @@ static PciChipsets TDFXPciChipsets[] = { { -1, -1, RES_UNDEFINED } }; -/* !!! Do we want an option for PIO address space? !!! */ /* !!! Do we want an option for alternate clocking? !!! */ typedef enum { @@ -281,6 +280,9 @@ static const char *driSymbols[] = { "DRIGetSAREAPrivate", "DRIGetContext", "DRIQueryVersion", + "DRIAdjustFrame", + "DRIOpenFullScreen", + "DRICloseFullScreen", "GlxSetVisualConfigs", NULL }; @@ -389,7 +391,7 @@ TDFXAvailableOptions(int chipid, int busid) return TDFXOptions; } -void +static void TDFXProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; @@ -412,7 +414,7 @@ TDFXProbeDDC(ScrnInfoPtr pScrn, int index) static Bool TDFXProbe(DriverPtr drv, int flags) { int i, numUsed, numDevSections, *usedChips; - GDevPtr *devSections = NULL; + GDevPtr *devSections; Bool foundScreen = FALSE; TDFXTRACE("TDFXProbe start\n"); @@ -435,8 +437,7 @@ TDFXProbe(DriverPtr drv, int flags) { devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); + xfree(devSections); if (numUsed<=0) return FALSE; if (flags & PROBE_DETECT) @@ -497,7 +498,10 @@ TDFXCountRam(ScrnInfoPtr pScrn) { /* set memory interface delay values and enable refresh */ /* these apply to all RAM vendors */ dramInit1 = 0x0; - dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + if (pTDFX->ChipType==PCI_CHIP_BANSHEE) + dramInit1 |= 7<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + else + dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; dramInit1 |= SST_SGRAM_CLK_NODELAY; dramInit1 |= SST_DRAM_REFRESH_EN; dramInit1 |= (0x18 << SST_DRAM_REFRESH_VALUE_SHIFT) & SST_DRAM_REFRESH_VALUE; @@ -599,28 +603,31 @@ static void TDFXInitChips(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int i, cfgbits, initbits; + int i, v, cfgbits, initbits; int mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits; pTDFX=TDFXPTR(pScrn); cfgbits=pciReadLong(pTDFX->PciTag[0], CFG_PCI_DECODE); mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE); mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE); + initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE); mem0size=32*1024*1024; /* Registers are always 32MB */ mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */ mem0bits=TDFXSizeToCfg(mem0size); mem1bits=TDFXSizeToCfg(mem1size)<<4; cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits; for (i=0; i<pTDFX->numChips; i++) { - initbits=pciReadLong(pTDFX->PciTag[i], CFG_INIT_ENABLE); initbits|=BIT(10); pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits); + v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND); + if (!i) + pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3); + else + pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2); pTDFX->MMIOAddr[i]=mem0base+i*mem0size; - pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, 0xFFFFFFFF); pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, pTDFX->MMIOAddr[i]); pTDFX->MMIOAddr[i]&=0xFFFFFF00; pTDFX->LinearAddr[i]=mem1base+i*mem1size; - pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, 0xFFFFFFFF); pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, pTDFX->LinearAddr[i]); pTDFX->LinearAddr[i]&=0xFFFFFF00; pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits); @@ -661,8 +668,8 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) pTDFX->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (flags & PROBE_DETECT) { - TDFXProbeDDC(pScrn, pTDFX->pEnt->index); - return TRUE; + TDFXProbeDDC(pScrn, pTDFX->pEnt->index); + return TRUE; } if (pTDFX->pEnt->location.type != BUS_PCI) return FALSE; @@ -1090,6 +1097,7 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts) { TDFXPtr pTDFX; vgaHWPtr hwp; + int i, dummy, count; TDFXTRACE("TDFXDoSave start\n"); pTDFX = TDFXPTR(pScrn); @@ -1120,6 +1128,15 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts) tdfxReg->clip1max=TDFXReadLongMMIO(pTDFX, SST_2D_CLIP1MAX); tdfxReg->srcbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_SRCBASEADDR); tdfxReg->dstbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_DSTBASEADDR); + for (i=0; i<512; i++) { + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACADDR, i); + dummy=TDFXReadLongMMIO(pTDFX, DACADDR); + } while (count++<100 && dummy!=i); + tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA); + dummy=tdfxReg->dactable[i]; + } } static void @@ -1139,6 +1156,7 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool restoreFonts) { TDFXPtr pTDFX; vgaHWPtr hwp; + int i, dummy, count; TDFXTRACE("TDFXDoRestore start\n"); pTDFX = TDFXPTR(pScrn); @@ -1169,8 +1187,19 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, pTDFX->writeLong(pTDFX, VIDPROCCFG, tdfxReg->vidcfg); TDFXWriteLongMMIO(pTDFX, SST_2D_SRCBASEADDR, tdfxReg->srcbaseaddr); TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, tdfxReg->dstbaseaddr); - vgaHWProtect(pScrn, FALSE); + for (i=0; i<512; i++) { + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACADDR, i); + dummy=TDFXReadLongMMIO(pTDFX, DACADDR); + } while (count++<100 && dummy!=i); + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACDATA, tdfxReg->dactable[i]); + dummy=TDFXReadLongMMIO(pTDFX, DACDATA); + } while (count++<100 && dummy!=tdfxReg->dactable[i]); + } pTDFX->sync(pScrn); } @@ -1458,7 +1487,7 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #ifdef XF86DRI if (pTDFX->directRenderingEnabled) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - TDFXSwapContextPrivate(screenInfo.screens[pScrn->scrnIndex]); + TDFXSwapContextFifo(screenInfo.screens[pScrn->scrnIndex]); } #endif DoRestore(pScrn, &hwp->ModeReg, &pTDFX->ModeReg, FALSE); @@ -1487,8 +1516,8 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, for (j=index<<2; j<max; j++) { repeat=100; do { - pTDFX->writeLong(pTDFX, DACADDR, j); - } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=j); + TDFXWriteLongMMIO(pTDFX, DACADDR, j); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=j); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " "bypassing CLUT\n"); @@ -1497,8 +1526,8 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, } repeat=100; do { - pTDFX->writeLong(pTDFX, DACDATA, v); - } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v); + TDFXWriteLongMMIO(pTDFX, DACDATA, v); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " "bypassing CLUT\n"); @@ -1522,8 +1551,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, v=(colors[index].red<<16)|(colors[index].green<<8)|colors[index].blue; repeat=100; do { - pTDFX->writeLong(pTDFX, DACADDR, index); - } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=index); + TDFXWriteLongMMIO(pTDFX, DACADDR, index); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=index); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " "bypassing CLUT\n"); @@ -1532,8 +1561,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, } repeat=100; do { - pTDFX->writeLong(pTDFX, DACDATA, v); - } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v); + TDFXWriteLongMMIO(pTDFX, DACDATA, v); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " "bypassing CLUT\n"); @@ -1662,12 +1691,12 @@ static void allocateMemory(ScrnInfoPtr pScrn) { fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12; /* We give 4096 bytes to the cursor, fifoSize to the */ /* FIFO, and everything to textures. */ - texSize = (pTDFX->fbOffset - fifoSize - 4096); - pTDFX->texOffset = pTDFX->fbOffset - texSize; + texSize = (pTDFX->fbOffset - fifoSize - 4096 - 16*1024); + pTDFX->texOffset = pTDFX->fbOffset - texSize + 16*1024; pTDFX->texSize = texSize; - pTDFX->fifoOffset = 4096; + pTDFX->fifoOffset = 4096+16*1024; pTDFX->fifoSize = fifoSize; - pTDFX->cursorOffset = 0; + pTDFX->cursorOffset = 0+16*1024; #if 0 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Cursor Offset: [0x%08X,0x%08X)\n", @@ -1722,6 +1751,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { allocateMemory(pScrn); +#if 0 if (pTDFX->numChips>1) { if (xf86ReturnOptValBool(TDFXOptions, OPTION_NO_SLI, FALSE)) { TDFXSetupSLI(pScrn, FALSE, 0); @@ -1729,13 +1759,14 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXSetupSLI(pScrn, TRUE, 0); } } +#endif TDFXSetLFBConfig(pTDFX); /* We initialize in the state that our FIFO is up to date */ pTDFX->syncDone=TRUE; #ifdef PROP_3DFX - if (!TDFXInitPrivate(pScreen)) { + if (!TDFXInitFifo(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize private\n"); return FALSE; } @@ -1743,7 +1774,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { pTDFX->sync=TDFXSync; #endif - maxy=pScrn->virtualY+128; + maxy=pScrn->virtualY+PIXMAP_CACHE_LINES; MemBox.y1 = pScrn->virtualY; MemBox.x1 = 0; MemBox.x2 = pScrn->displayWidth; @@ -1754,6 +1785,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXSave(pScrn); if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; + TDFXSetLFBConfig(pTDFX); + miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -1769,12 +1802,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { * is called. fbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - if (!pTDFX->NoAccel) { + if (!pTDFX->NoAccel) pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen); - /* Force the initialization of the context */ - if (pTDFX->directRenderingEnabled) - TDFXLostContext(pScreen); - } #endif switch (pScrn->bitsPerPixel) { @@ -1878,6 +1907,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } #endif +#if 0 + /* Disable for now, not up with latest XFree release */ #ifdef XvExtension { XF86VideoAdaptorPtr *ptr; @@ -1889,6 +1920,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } } #endif +#endif pScreen->SaveScreen = TDFXSaveScreen; pTDFX->CloseScreen = pScreen->CloseScreen; @@ -1934,12 +1966,12 @@ TDFXEnterVT(int scrnIndex, int flags) { TDFXTRACE("TDFXEnterVT start\n"); pScrn = xf86Screens[scrnIndex]; + InstallFifo(pScrn); #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRIUnlock(pScreen); - TDFXLostContext(pScreen); } #endif if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1962,11 +1994,12 @@ TDFXLeaveVT(int scrnIndex, int flags) { TDFXRestore(pScrn); vgaHWLock(hwp); pScreen = screenInfo.screens[scrnIndex]; + TDFXShutdownFifo(pScreen); #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { DRILock(pScreen, 0); - TDFXSwapContextPrivate(pScreen); + TDFXSwapContextFifo(pScreen); } #endif } @@ -1990,9 +2023,7 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) } #endif -#ifdef PROP_3DFX - TDFXShutdownPrivate(pScreen); -#endif + TDFXShutdownFifo(pScreen); if (pScrn->vtSema) { TDFXRestore(pScrn); @@ -2059,7 +2090,7 @@ TDFXBlankScreen(ScrnInfoPtr pScrn, Bool unblank) scrn |= 0x20; /* blank screen */ } - vgaHWSeqReset(hwp, TRUE); + vgaHWSeqReset(hwp, TRUE); hwp->writeSeq(hwp, 0x01, scrn); /* change mode */ vgaHWSeqReset(hwp, FALSE); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c index 41d9d2270..b5b16978a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c @@ -1,9 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.10 2000/06/21 21:40:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.11 2000/12/01 14:29:00 dawes Exp $ */ -#if 0 -#include <sys/time.h> -#endif #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -23,7 +20,7 @@ C - D-1 : Z buffer */ -void TDFXSendNOPPrivate3D(ScrnInfoPtr pScrn) +void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -33,7 +30,7 @@ void TDFXSendNOPPrivate3D(ScrnInfoPtr pScrn) WRITE_FIFO(pTDFX, 0, 0); } -void TDFXSendNOPPrivate2D(ScrnInfoPtr pScrn) +void TDFXSendNOPFifo2D(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -47,10 +44,10 @@ void TDFXSendNOPPrivate2D(ScrnInfoPtr pScrn) WRITE_FIFO(pTDFX, SST_2D_COMMAND, SST_2D_NOP|SST_2D_GO); } -void TDFXSendNOPPrivate(ScrnInfoPtr pScrn) +void TDFXSendNOPFifo(ScrnInfoPtr pScrn) { - TDFXSendNOPPrivate2D(pScrn); - TDFXSendNOPPrivate3D(pScrn); + TDFXSendNOPFifo2D(pScrn); + TDFXSendNOPFifo3D(pScrn); } void InstallFifo(ScrnInfoPtr pScrn) @@ -78,7 +75,7 @@ void InstallFifo(ScrnInfoPtr pScrn) pTDFX->fifoPtr = pTDFX->fifoBase; pTDFX->fifoSlots = (pTDFX->fifoSize>>2) - 1; pTDFX->fifoEnd = pTDFX->fifoBase+pTDFX->fifoSlots; - TDFXSendNOPPrivate(pScrn); + TDFXSendNOPFifo(pScrn); } void TDFXResetFifo(ScrnInfoPtr pScrn) @@ -122,15 +119,16 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) TDFXPtr pTDFX; int i, cnt; int stat; - long start_sec, end_sec, dummy; + long start_sec, end_sec, dummy, readptr; TDFXTRACEACCEL("TDFXSyncFifo start\n"); pTDFX=TDFXPTR(pScrn); - TDFXSendNOPPrivate(pScrn); + TDFXSendNOPFifo(pScrn); i=0; cnt=0; start_sec=0; do { + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); stat=TDFXReadLongMMIO(pTDFX, 0); if (stat&SST_BUSY) i=0; else i++; cnt++; @@ -140,7 +138,9 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) } else { getsecs(&end_sec, &dummy); if (end_sec-start_sec>3) { - TDFXResetFifo(pScrn); + dummy=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); + if (dummy=readptr) + TDFXResetFifo(pScrn); start_sec=0; } } @@ -152,7 +152,7 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) pTDFX->prevBlitDest.x2=pTDFX->prevBlitDest.y2=0; } -Bool TDFXInitPrivate(ScreenPtr pScreen) +Bool TDFXInitFifo(ScreenPtr pScreen) { ScrnInfoPtr pScrn; TDFXPtr pTDFX; @@ -172,7 +172,7 @@ Bool TDFXInitPrivate(ScreenPtr pScreen) return TRUE; } -void TDFXShutdownPrivate(ScreenPtr pScreen) +void TDFXShutdownFifo(ScreenPtr pScreen) { ScrnInfoPtr pScrn; TDFXPtr pTDFX; @@ -200,7 +200,7 @@ GetReadPtr(TDFXPtr pTDFX) } #ifdef XF86DRI -void TDFXSwapContextPrivate(ScreenPtr pScreen) +void TDFXSwapContextFifo(ScreenPtr pScreen) { ScrnInfoPtr pScrn; TDFXPtr pTDFX; @@ -240,24 +240,6 @@ void TDFXSwapContextPrivate(ScreenPtr pScreen) pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8; } -void TDFXLostContext(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn; - TDFXPtr pTDFX; - TDFXSAREAPriv *sPriv; - - pScrn = xf86Screens[pScreen->myNum]; - pTDFX=TDFXPTR(pScrn); - sPriv=(TDFXSAREAPriv*)DRIGetSAREAPrivate(pScreen); - if (!sPriv) return; - if (sPriv->fifoPtr!=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase) || - sPriv->fifoRead!=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase)) { - sPriv->fifoPtr=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase); - sPriv->fifoRead=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase); - sPriv->fifoOwner=DRIGetContext(pScreen); - /* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */ - } -} #endif static void diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h index 657992d21..a98f86366 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.5 2000/02/18 12:20:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.6 2000/12/01 14:29:00 dawes Exp $ */ #ifndef _TDFX_FIFO_H_ @@ -11,7 +11,7 @@ typedef int int32; typedef short int16; typedef char int8; -#define CMDFIFO_PAGES 64 +#define CMDFIFO_PAGES 255 #define PROPSAREADATA \ volatile int fifoPtr; \ @@ -58,7 +58,7 @@ typedef char int8; #endif #define DECLARE SET_PKT2_HEADER #define DECLARE_LAUNCH SET_PK1_HEADER_LAUNCH -#define TDFXSendNOP TDFXSendNOPPrivate +#define TDFXSendNOP TDFXSendNOPFifo /* ** Structures for Banshee AGP/CMD Transfer/MISC registers. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c index 07d4a711e..25b87acc0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.4 2000/08/25 16:25:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.5 2000/12/01 14:29:00 dawes Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -12,7 +12,7 @@ /* #define RD_ABORT_ERROR */ #define H3VDD -static Bool TDFXDisableSLI(TDFXPtr pTDFX) +Bool TDFXDisableSLI(TDFXPtr pTDFX) { int i; int v; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c new file mode 100644 index 000000000..a7e3c71cf --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c @@ -0,0 +1,695 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.2 2000/12/02 15:30:57 tsi Exp $ */ + +/* Adapted from ../mga/mga_video.c */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "tdfx.h" + +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +/* These should move into tdfxdefs.h with better names */ +#define YUV_Y_BASE 0xC00000 +#define YUV_U_BASE 0xD00000 +#define YUV_V_BASE 0xE00000 + +#define SST_2D_FORMAT_YUYV 0x8 +#define SST_2D_FORMAT_UYVY 0x9 + +#define YUVBASEADDR 0x80100 +#define YUVSTRIDE 0x80104 + +#ifndef XvExtension +void TDFXInitVideo(ScreenPtr pScreen) {} +#else + + +void TDFXInitVideo(ScreenPtr pScreen); +void TDFXCloseVideo (ScreenPtr pScreen); + +static XF86VideoAdaptorPtr TDFXSetupImageVideo(ScreenPtr); +static int TDFXSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int TDFXGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); + +static void TDFXStopVideo(ScrnInfoPtr, pointer, Bool); +static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, + unsigned int *, unsigned int *, pointer); +static int TDFXPutImage(ScrnInfoPtr, short, short, short, short, short, + short, short, short, int, unsigned char*, short, + short, Bool, RegionPtr, pointer); +#if 0 +/* This isn't done yet, but eventually it will put images to the + * video overlay. */ +static int TDFXPutImageOverlay(ScrnInfoPtr pScrn, short, short, + short, short, short, short, + short, short, int, unsigned char*, + short, short, Bool, RegionPtr , pointer); +#endif + +static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); + +/* These function is from tdfx_accel.c */ +extern void TDFXFirstSync(ScrnInfoPtr pScrn); + +static FBAreaPtr +TDFXAllocateOffscreenBuffer (ScrnInfoPtr pScrn, int id, int width, int height); + +static void +TDFXDeallocateOffscreenBuffer (ScrnInfoPtr pScrn, int id); + +void TDFXInitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + TDFXPtr pTDFX = TDFXPTR(pScrn); + int num_adaptors; + + /* The hardware can't convert YUV->8 bit color */ + if(pTDFX->cpp == 1) + return; + + newAdaptor = TDFXSetupImageVideo(pScreen); + + /* Initialize the offscreen buffer */ + pTDFX->offscreenYUVBuf = 0; + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + { + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + } + + if(newAdaptors) + xfree(newAdaptors); +} + +void TDFXCloseVideo (ScreenPtr pScreen) +{ + +} + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[2] = +{ + { /* blit limit */ + 0, + "XV_IMAGE", + 1024, PIXMAP_CACHE_LINES, /* Height is a limitation of pixmap space. */ + {1, 1} + }, +}; + +#define NUM_FORMATS_OVERLAY 3 + +static XF86VideoFormatRec Formats[NUM_FORMATS_OVERLAY] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, +}; + +/* #define NUM_IMAGES 4*/ +#define NUM_IMAGES 2 + +static XF86ImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YV12, /* YVU planar */ + XVIMAGE_I420 /* YUV planar */ +#if 0 + /* These could be supported (without a temp bufer) using the + * host-to-screen-stretch */ + XVIMAGE_YUY2, /* YUYV packed */ + XVIMAGE_UYVY /* UYVY packed */ +#endif +}; + + +static XF86VideoAdaptorPtr +TDFXAllocAdaptor(ScrnInfoPtr pScrn) +{ + XF86VideoAdaptorPtr adapt; + + if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) + return NULL; + + return adapt; +} + + + +static XF86VideoAdaptorPtr +TDFXSetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr adapt; + + adapt = TDFXAllocAdaptor(pScrn); + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + /* Add VIDEO_OVERLAID_IMAGES if using the overlay */ + adapt->flags = 0; + adapt->name = "3dfx Accelerated Video Engine"; + adapt->nEncodings = 1; + adapt->pEncodings = &DummyEncoding[0]; + adapt->nFormats = NUM_FORMATS_OVERLAY; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->nAttributes = 0; + adapt->pAttributes = NULL; + adapt->nImages = 3; + adapt->pImages = Images; + + /* XXX For now all I'm implementing is PutImage so that programs like OMS + * will work. More will follow as I have time and need. */ + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = TDFXStopVideo; + adapt->SetPortAttribute = TDFXSetPortAttribute; + adapt->GetPortAttribute = TDFXGetPortAttribute; + adapt->QueryBestSize = TDFXQueryBestSize; + adapt->PutImage = TDFXPutImage; + /*adapt->PutImage = TDFXPutImageOverlay; */ + adapt->QueryImageAttributes = TDFXQueryImageAttributes; + + return adapt; +} + + +static void +TDFXStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + if (cleanup) + { + /* Deallocate the offscreen temporary buffer. */ + TDFXDeallocateOffscreenBuffer (pScrn, 0); + } +} + + +static int +TDFXSetPortAttribute (ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data) +{ + return BadMatch; +} + + +static int +TDFXGetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data) +{ + return BadMatch; +} + + + +static void +TDFXQueryBestSize(ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data) +{ + /* No alignment restrictions */ + *p_w = drw_w; + *p_h = drw_h; +} + + + +/* This performs a screen to screen stretch blit. All coordinates are + * in screen memory. This function assumes that the src and dst format + * registers have been setup already. This function does not save + * the registers it trashes. */ +static void +TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn, + short src_x1, short src_y1, + short src_x2, short src_y2, + short dst_x1, short dst_y1, + short dst_x2, short dst_y2) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + + /* reformulate the paramaters the way the hardware wants them */ + INT32 + src_x = src_x1 & 0x1FFF, + src_y = src_y1 & 0x1FFF, + dst_x = dst_x1 & 0x1FFF, + dst_y = dst_y1 & 0x1FFF, + src_w = (src_x2 - src_x) & 0x1FFF, + src_h = (src_y2 - src_y) & 0x1FFF, + dst_w = (dst_x2 - dst_x) & 0x1FFF, + dst_h = (dst_y2 - dst_y) & 0x1FFF; + + /* Setup for blit src and dest */ + TDFXMakeRoom(pTDFX, 5); + DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY| + SSTCP_COMMAND|SSTCP_COMMANDEXTRA); + /* We want the blit to wait for vsync. */ + TDFXWriteLong(pTDFX, SST_2D_COMMANDEXTRA, 4); + TDFXWriteLong(pTDFX, SST_2D_SRCSIZE, src_w | (src_h<<16)); + TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, dst_w | (dst_h<<16)); + TDFXWriteLong(pTDFX, SST_2D_DSTXY, dst_x | (dst_y<<16)); + /* XXX find the ROP table and figure out why CC is the right choice. */ + TDFXWriteLong(pTDFX, SST_2D_COMMAND, + (0xCC<<24)|SST_2D_SCRNTOSCRNSTRETCH); + /* Write to the launch area to start the blit */ + TDFXMakeRoom(pTDFX, 1); + DECLARE_LAUNCH (1, 0); + TDFXWriteLong(pTDFX, SST_2D_LAUNCH, src_x | (src_y<<16)); +} + +static void +YUVPlanarToPacked (ScrnInfoPtr pScrn, + short src_x, short src_y, + short src_h, short src_w, + int id, char *buf, + short width, short height, + FBAreaPtr fbarea) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + + INT32 y; + void *dst; + char *psrc = buf, + *pdst = 0; + + /* Register saves */ + INT32 + yuvBaseAddr, + yuvStride; + + /* Save these registers I can restore them when we are done. */ + yuvBaseAddr = TDFXReadLongMMIO(pTDFX, YUVBASEADDR); + yuvStride = TDFXReadLongMMIO(pTDFX, YUVSTRIDE); + + + dst = 0; + + /* Set yuvBaseAddress register to point to the buffer. */ + TDFXWriteLongMMIO (pTDFX, YUVBASEADDR, pTDFX->fbOffset + + pTDFX->stride * (fbarea->box.y1 + pScrn->virtualY) + + fbarea->box.x1); + /* Set yuvStride register to reflect stride of U and V planes */ + TDFXWriteLongMMIO (pTDFX, YUVSTRIDE, pTDFX->stride); + + psrc = (char*)buf; + + /* psrc points to the base of the Y plane, move out to src_x, src_y */ + psrc += src_x + src_y * width; + + pdst = (char *)pTDFX->MMIOBase[0] + YUV_Y_BASE; + for (y = 0; y < height; y++) + { + memcpy (pdst, psrc, src_w); + psrc += width; + pdst += 1024; + } + + /* The difference between FOURCC_YV12 and FOURCC_I420 is the + * order that the U and V planes appear in the buffer. But I at + * this point I just send them in the order they appear. + * Depending on the format the order in the packing ends up + * different and we handle it in the the way we pick the source + * format later on. */ + + pdst = (char *)pTDFX->MMIOBase[0] + YUV_V_BASE; + psrc = (char*)buf + width * height; + /* psrc now points to the base of the V plane, move out to src_x, src_y */ + psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); + for (y = 0; y < height >> 1; y++) + { + memcpy (pdst, psrc, src_w >> 1); + psrc += width >> 1; + pdst += 1024; + } + pdst = (char *)pTDFX->MMIOBase[0] + YUV_U_BASE; + psrc = (char*)buf + width * height + (width >> 1) * (height >> 1); + /* psrc now points to the base of the U plane, move out to src_x, src_y */ + psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); + for (y = 0; y < height >> 1; y++) + { + memcpy (pdst, psrc, src_w >> 1); + psrc += width >> 1; + pdst += 1024; + } + + /* Restore trashed registers */ + TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, yuvBaseAddr); + TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, yuvStride); +} + +static int +TDFXPutImage( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data + ) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + + BoxPtr pbox; + int nbox; + + FBAreaPtr fbarea; + + /* Make sure we are synced up (this really mean, lock and find the + * fifo pointer. */ + TDFXFirstSync (pScrn); + + /* Do the right thing for the given format */ + switch (id) + { + case FOURCC_YV12: + case FOURCC_I420: + /* Get a buffer to use to store the packed YUV data */ + fbarea = TDFXAllocateOffscreenBuffer (pScrn, id, src_w, src_h); + + if (!fbarea) + { + return Success; + } + + YUVPlanarToPacked (pScrn, src_x, src_y, src_h, src_w, + id, (char *)buf, width, height, + fbarea); + /* Don't know what executed last so we need to send a NOP */ + TDFXSendNOP(pScrn); + + /* Setup the dst and src format once, they don't change for all the + * blits. */ + TDFXMakeRoom(pTDFX, 2); + DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); + TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, + pTDFX->stride|((pTDFX->cpp+1)<<16)); + if (id == FOURCC_YV12) + { + /* Packed format is YUYV */ + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, + pTDFX->stride|((SST_2D_FORMAT_YUYV)<<16)); + } + else + { + /* Packed format is UYVY */ + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, + pTDFX->stride|((SST_2D_FORMAT_UYVY)<<16)); + } + + /* Traverse the clip boxes */ + nbox = REGION_NUM_RECTS(clipBoxes); + pbox = REGION_RECTS(clipBoxes); + + while (nbox--) + { + /* The destination clip regions come with the clip boxes, but + * the src coordinates have to be computed because we are doing + * a stretch blit. These macros perform that compuation, but + * they could use some work. When testing with still images these + * computations caused some jitter in the resulting output, but + * with actual video playback I haven't noticed any problems. */ +#define SRC_X1 (fbarea->box.x1) +#define SRC_Y1 (fbarea->box.y1 + pScrn->virtualY) +#define SCALEX(dx) ((int)(((dx) * src_w + (drw_w>>1)) / drw_w)) +#define SCALEY(dy) ((int)(((dy) * src_h + (drw_h>>1)) / drw_h)) + + /* Do the screen-to-screen blit clipped to the clip boxes. */ + TDFXScreenToScreenYUVStretchBlit + (pScrn, + SRC_X1 + SCALEX(pbox->x1 - drw_x), + SRC_Y1 + SCALEY(pbox->y1 - drw_y), + SRC_X1 + SCALEX(pbox->x2 - drw_x), + SRC_Y1 + SCALEY(pbox->y2 - drw_y), + /* these destination coordinates come + * right from the clip box. */ + pbox->x1, pbox->y1, + pbox->x2, pbox->y2); + pbox++; + } + + /* Restore the WAX registers we trashed */ + TDFXMakeRoom(pTDFX, 2); + DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); + TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->sst2DDstFmtShadow); + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->sst2DSrcFmtShadow); + + /* The rest of the driver won't know what I have done so I do a stall to + * make sure the next command sent will work. */ + TDFXSendNOP(pScrn); + break; + } + + return Success; +} + +/* This code doesn't work yet. Eventually this should use the video overlay + * instead of the YUV-stretch-blit. The overlay is better because it uses + * bilinear filtering when scaling. */ +#if 0 +static int +TDFXPutImageOverlay( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data + ) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + + BoxPtr pbox; + int nbox; + + /* Computed Register values */ + INT32 + vidInFormat; + + static FBAreaPtr fbarea; + + /* Do the right thing for the given format */ + switch (id) + { + case FOURCC_YV12: + case FOURCC_I420: + + + /* Get a buffer to use to store the packed YUV data */ + fbarea = TDFXAllocateOffscreenBuffer (pScrn, id, src_w, src_h); + + if (!fbarea) + return Success; + + YUVPlanarToPacked (pScrn, + src_x, src_y, src_h, src_w, + id, buf, width, height, + fbarea); + + /* Setup the overlay */ + TDFXWriteLongMMIO(pTDFX, VIDOVERLAYSTARTCOORDS, + (drw_x&0x7FF) | ((drw_y & 0x7FF) << 12) + /* XXX Lower 2 bits of X and Y? */); + TDFXWriteLongMMIO(pTDFX, VIDOVERLAYENDSCREENCOORDS, + ((drw_x+drw_w)&0x7FF) | (((drw_y+drw_h)&0x7FF) << 12)); + + /* Set the Video in format */ + vidInFormat = 0; + /* These magic numbers come from the spec on page 151 */ + if (id == FOURCC_YV12) + { + /* Packed format is YUYV */ + vidInFormat = 0x9 << 1; + } + else + { + /* Packed format is UYVY */ + vidInFormat = 0xA << 1; + } + + TDFXWriteLongMMIO (pTDFX, VIDINFORMAT, vidInFormat); + TDFXWriteLongMMIO (pTDFX, VIDINSTRIDE, src_w); + + /* Use magenta as the chroma color */ + if (pTDFX->cpp == 2) + { + TDFXWriteLongMMIO(pTDFX, VIDCHROMAMIN, + 0x0000F71F); + TDFXWriteLongMMIO(pTDFX, VIDCHROMAMAX, + 0x0000F71F); + } + else /* (pTDFX->cpp == 3) */ + { + TDFXWriteLongMMIO(pTDFX, VIDCHROMAMIN, + 0x00FF00FF); + TDFXWriteLongMMIO(pTDFX, VIDCHROMAMAX, + 0x00FF00FF); + } + + /* Set the src address */ + TDFXWriteLongMMIO (pTDFX, VIDINADDR0, + pTDFX->fbOffset + + pTDFX->stride * (fbarea->box.y1 + pScrn->virtualY) + + fbarea->box.x1); + + /* Traverse the clip boxes */ + nbox = REGION_NUM_RECTS(clipBoxes); + pbox = REGION_RECTS(clipBoxes); + + while (nbox--) + { + pbox++; + } + break; + } + return Success; +} + +#endif + +static void +TDFXDeallocateOffscreenBuffer (ScrnInfoPtr pScrn, int id) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + + /* There is only one buffer so just deallocate it */ + if (pTDFX->offscreenYUVBuf) + xf86FreeOffscreenArea (pTDFX->offscreenYUVBuf); +} + +static FBAreaPtr +TDFXAllocateOffscreenBuffer (ScrnInfoPtr pScrn, int id, int width, int height) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + + if (!pTDFX) + return NULL; + + if (pTDFX->offscreenYUVBuf != NULL && + width == pTDFX->offscreenYUVBufWidth && + height == pTDFX->offscreenYUVBufHeight) + { + /* we already have a buffer, don't do anything. */ + return pTDFX->offscreenYUVBuf; + } + + /* We have a buffer, but its not the right size so resize it */ + if (pTDFX->offscreenYUVBuf != NULL) + { + if (!xf86ResizeOffscreenArea (pTDFX->offscreenYUVBuf, + /* I always want an 8 bit buffer. */ + width / pTDFX->cpp + 1, + height)) + { + return (NULL); + } + } + else + { + /* Allocate a brand new buffer */ + pTDFX->offscreenYUVBuf = + xf86AllocateOffscreenArea (pScrn->pScreen, + /* I always want an 8 bit buffer. */ + width / pTDFX->cpp + 1, + height, + 0, + NULL, NULL, NULL); + } + + /* Return the buffer */ + pTDFX->offscreenYUVBufWidth = width; + pTDFX->offscreenYUVBufHeight = height; + return (pTDFX->offscreenYUVBuf); +} + + +static int +TDFXQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + + int size; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + /* The Maximum size for 3dfx YUV planar space + * but our temporary buffer has to fit in the pixmap region which + * is the same width as the desktop and PIXMAP_CACHE_LINES pixels high. + */ + if(*w > 1024) *w = 1024; + if (*w > pTDFX->stride) *w = pTDFX->stride; + if(*h > PIXMAP_CACHE_LINES) *h = PIXMAP_CACHE_LINES; + + + + if (offsets) offsets[0] = 0; + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + if (pitches) pitches[0] = *w; + /* Size of Y plane plus the size of U and V planes */ + size = *w * *h; + if (offsets) offsets[1] = size; + size += ((*w >> 1) * (*h >> 1)); + if (offsets) offsets[2] = size; + size += ((*w >> 1) * (*h >> 1)); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + return size; +} + +#endif /* !XvExtension */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h index 850f35398..cd822f4bf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.7 2000/09/24 13:51:31 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.8 2000/12/01 14:29:00 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.1 @@ -201,6 +201,7 @@ #define SST_3D_CHIPMASK SST_3D_OFFSET+0x214 /* NAPALM REGISTERS */ +#define CFG_PCI_COMMAND 4 #define CFG_MEM0BASE 16 #define CFG_MEM1BASE 20 #define CFG_INIT_ENABLE 64 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c index 0ec04a01f..86419d5da 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c @@ -22,7 +22,7 @@ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> * Matthew Grossman, <mattg@oz.net> - acceleration and misc fixes */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.47 2000/10/20 12:57:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.49 2000/12/02 15:30:57 tsi Exp $ */ /* everybody includes these */ #include "xf86.h" @@ -308,8 +308,7 @@ static Bool TGAProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; -/* GDevPtr *usedDevs; */ + GDevPtr *devSections; int *usedChips; int numDevSections; int numUsed; @@ -365,9 +364,7 @@ TGAProbe(DriverPtr drv, int flags) TGAChipsets, TGAPciChipsets, devSections, numDevSections, drv, &usedChips); - if (devSections) - xfree(devSections); - devSections = NULL; + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -399,6 +396,7 @@ TGAProbe(DriverPtr drv, int flags) foundScreen = TRUE; } } + xfree(usedChips); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c index 8fea7a726..a20eacbda 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c @@ -23,7 +23,7 @@ * * Trident Blade3D accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.10 2000/11/28 00:04:39 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.13 2000/12/04 08:46:17 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -71,12 +71,11 @@ static void BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, static void BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int offset); -static void BladeSetupForScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn, +static void BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); -static void BladeSubsequentScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn, +static void BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); -static void BladeSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); static void BladeSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2); static void BladeDisableClipping(ScrnInfoPtr pScrn); @@ -92,18 +91,21 @@ static void BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, static void BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); -static void BladeSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, +static void BladeSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); -static void BladeSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, +static void BladeSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); -static void BladeSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); static void BladeInitializeAccelerator(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD32 stride; + + BLADE_OUT(0x2124, 1<<7); + BLADE_OUT(0x2124, 0); + BladeSync(pScrn); stride = (pScrn->displayWidth >> 3) << 20; @@ -163,9 +165,6 @@ BladeAccelInit(ScreenPtr pScreen) infoPtr->SetClippingRectangle = BladeSetClippingRectangle; infoPtr->DisableClipping = BladeDisableClipping; - infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_FILL | - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | - HARDWARE_CLIP_MONO_8x8_FILL; #if 0 infoPtr->SolidLineFlags = 0; @@ -220,45 +219,27 @@ BladeAccelInit(ScreenPtr pScreen) #endif infoPtr->CPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD | - NO_TRANSPARENCY | LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | + SYNC_AFTER_COLOR_EXPAND | NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD; infoPtr->ColorExpandRange = 0x10000; infoPtr->ColorExpandBase = pTrident->IOBase + 0x10000; infoPtr->SetupForCPUToScreenColorExpandFill = - BladeSetupForScanlineCPUToScreenColorExpand; + BladeSetupForCPUToScreenColorExpand; infoPtr->SubsequentCPUToScreenColorExpandFill = - BladeSubsequentScanlineCPUToScreenColorExpand; - infoPtr->SubsequentColorExpandScanline = - BladeSubsequentColorExpandScanline; - - pTrident->XAAScanlineColorExpandBuffers[0] = - xnfalloc(((pScrn->virtualX + 63)) *4* (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = - pTrident->XAAScanlineColorExpandBuffers; + BladeSubsequentCPUToScreenColorExpand; - infoPtr->SetupForImageWrite = BladeSetupForScanlineImageWrite; - infoPtr->SubsequentImageWriteRect = BladeSubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = - BladeSubsequentImageWriteScanline; + infoPtr->SetupForImageWrite = BladeSetupForImageWrite; + infoPtr->SubsequentImageWriteRect = + BladeSubsequentImageWriteRect; infoPtr->ImageWriteFlags = NO_PLANEMASK | - NO_TRANSPARENCY | - LEFT_EDGE_CLIPPING_NEGATIVE_X | LEFT_EDGE_CLIPPING | CPU_TRANSFER_PAD_DWORD | SYNC_AFTER_IMAGE_WRITE; infoPtr->ImageWriteBase = pTrident->IOBase + 0x10000; infoPtr->ImageWriteRange = 0x10000; - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = pTrident->XAAImageScanlineBuffer; - - pTrident->XAAImageScanlineBuffer[0] = - xnfalloc(pScrn->virtualX * pScrn->bitsPerPixel / 8); AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; @@ -273,25 +254,6 @@ BladeAccelInit(ScreenPtr pScreen) } static void -BladeSyncClip(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int busy; - int cnt = 10000000; - - BLADEBUSY(busy); - while (busy != 0) { - if (--cnt < 0) { - ErrorF("GE timeout\n"); - BLADE_OUT(0x2124, 1<<7); - BLADE_OUT(0x2124, 0); - break; - } - BLADEBUSY(busy); - } -} - -static void BladeSync(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); @@ -360,8 +322,6 @@ BladeSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, BLADE_OUT(0x2108, y2<<16 | x2); BLADE_OUT(0x210C, ((y2+h-1)&0xfff)<<16 | ((x2+w-1)&0xfff)); } - if (!pTrident->UsePCIRetry) - BladeSyncClip(pScrn); } static void @@ -435,9 +395,6 @@ BladeSubsequentSolidBresenhamLine( ScrnInfoPtr pScrn, BLADE_OUT(0x2140, E<<30 | (y&0xfff)<<20 | ((x&0xfff)<<4)); BLADE_OUT(0x2144, D<<30 | (((dmaj-dmin)&0xfff) << 16) | (-dmin&0xfff)); BLADE_OUT(0x2148, ((-(dmin+e)&0xfff) << 16)); - - if (!pTrident->UsePCIRetry) - BladeSyncClip(pScrn); } @@ -461,9 +418,6 @@ BladeSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, if (flags & OMIT_LAST) BladeDisableClipping(pScrn); #endif - - if (!pTrident->UsePCIRetry) - BladeSyncClip(pScrn); } static void @@ -511,9 +465,6 @@ BladeSubsequentDashedTwoPointLine( ScrnInfoPtr pScrn, if (flags & OMIT_LAST) BladeDisableClipping(pScrn); - - if (!pTrident->UsePCIRetry) - BladeSyncClip(pScrn); } static void @@ -541,8 +492,6 @@ BladeSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) BLADE_OUT(0x2144, 0x20000000 | pTrident->BltScanDirection | 1<<19 | 1<<4 | 2<<2 | (pTrident->Clipping ? 1:0)); BLADE_OUT(0x2108, y<<16 | x); BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff)); - if (!pTrident->UsePCIRetry) - BladeSyncClip(pScrn); } static void @@ -581,36 +530,8 @@ BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, IMAGE_OUT(0x24, 0x80000000 | 3<<22 | 1<<7 | pTrident->BltScanDirection | (pTrident->ROP == GXcopy ? 0 : 1<<10) | offset<<25); } -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 1) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 2) return; - *dest = *src; - dest += 1; - src += 1; -} - static void -BladeSetupForScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn, +BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) { @@ -638,7 +559,7 @@ BladeSetupForScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn, } static void -BladeSubsequentScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn, +BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); @@ -647,23 +568,6 @@ BladeSubsequentScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn, BLADE_OUT(0x2144, 0xE0000000 | pTrident->BltScanDirection | 1<<4 | (skipleft ? 1 : 0)); BLADE_OUT(0x2108, (y&0xfff)<<16 | (x&0xfff)); BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff)); - pTrident->dwords = (w + 31) >> 5; - pTrident->h = h; -} - -static void -BladeSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - XAAInfoRecPtr infoRec; - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - MoveDWORDS((CARD32*)infoRec->ColorExpandBase, - (CARD32*)pTrident->XAAScanlineColorExpandBuffers[bufno], pTrident->dwords); - - pTrident->h--; - if (!pTrident->h) - BladeSync(pScrn); } static void @@ -717,8 +621,6 @@ BladeSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, BLADE_OUT(0x2144, 0x20000000 | pTrident->BltScanDirection | 7<<12 | 1<<4 | 1<<19 | 2<<2 | clip); BLADE_OUT(0x2108, y<<16 | x); BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff)); - if (!pTrident->UsePCIRetry) - BladeSyncClip(pScrn); } static void @@ -759,7 +661,7 @@ BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, CHECKCLIPPING; } -static void BladeSetupForScanlineImageWrite( +static void BladeSetupForImageWrite( ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -777,33 +679,15 @@ static void BladeSetupForScanlineImageWrite( } } -static void BladeSubsequentScanlineImageWriteRect( +static void BladeSubsequentImageWriteRect( ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft ){ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - pTrident->dwords = ((w * (pScrn->bitsPerPixel/8)) + 3) >> 2; - pTrident->h = h; - if (skipleft) BladeSetClippingRectangle(pScrn,x+skipleft,y,(x+w-1),(y+h-1)); BLADE_OUT(0x2144, 0xE0000000 | 1<<19 | 1<<4 | pTrident->BltScanDirection | (skipleft ? 1 : 0)); BLADE_OUT(0x2108, y<<16 | (x&0xfff)); BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff)); } - -static void -BladeSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - XAAInfoRecPtr infoRec; - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - MoveDWORDS((CARD32*)infoRec->ImageWriteBase, - (CARD32*)pTrident->XAAImageScanlineBuffer[bufno], pTrident->dwords); - - pTrident->h--; - if (!pTrident->h) - BladeSync(pScrn); -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h index 453d33e2e..91744dd1e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.29 2000/11/26 10:08:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.31 2000/11/30 11:53:25 alanh Exp $ */ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ @@ -247,7 +247,9 @@ typedef enum { CYBERBLADEI7, CYBERBLADEI7D, CYBERBLADEI1, - CYBERBLADEI1D + CYBERBLADEI1D, + CYBERBLADEAI1, + CYBERBLADEAI1D } TRIDENTType; #define UseMMIO (pTrident->NoMMIO == FALSE) @@ -272,6 +274,8 @@ typedef enum { (pTrident->Chipset == CYBERBLADEI7D) || \ (pTrident->Chipset == CYBERBLADEI1) || \ (pTrident->Chipset == CYBERBLADEI1D) || \ + (pTrident->Chipset == CYBERBLADEAI1) || \ + (pTrident->Chipset == CYBERBLADEAI1D) || \ (pTrident->Chipset == BLADE3D)) /* diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c index 849d25c78..8166ab42b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.32 2000/11/27 23:07:27 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.33 2000/11/30 10:19:48 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -314,6 +314,8 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case CYBERBLADEI7D: case CYBERBLADEI1: case CYBERBLADEI1D: + case CYBERBLADEAI1: + case CYBERBLADEAI1D: case CYBERBLADEE4: case BLADE3D: OUTB(vgaIOBase + 4, RAMDACTiming); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c index 191984040..145076dee 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c @@ -28,7 +28,7 @@ * Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the * clockchip programming code. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.111 2000/11/26 10:08:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.113 2000/12/02 15:30:58 tsi Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -159,6 +159,8 @@ static SymTabRec TRIDENTChipsets[] = { { CYBERBLADEI7D, "cyberbladei7d" }, { CYBERBLADEI1, "cyberbladei1" }, { CYBERBLADEI1D, "cyberbladei1d" }, + { CYBERBLADEAI1, "cyberbladeAi1" }, + { CYBERBLADEAI1D, "cyberbladeAi1d" }, { -1, NULL } }; @@ -190,6 +192,8 @@ static PciChipsets TRIDENTPciChipsets[] = { { CYBERBLADEI7D, PCI_CHIP_8420, RES_SHARED_VGA }, { CYBERBLADEI1, PCI_CHIP_8500, RES_SHARED_VGA }, { CYBERBLADEI1D, PCI_CHIP_8520, RES_SHARED_VGA }, + { CYBERBLADEAI1, PCI_CHIP_8600, RES_SHARED_VGA }, + { CYBERBLADEAI1D, PCI_CHIP_8620, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -300,6 +304,8 @@ static int ClockLimit[] = { 230000, 230000, 230000, + 230000, + 230000, }; static int ClockLimit16bpp[] = { @@ -338,6 +344,8 @@ static int ClockLimit16bpp[] = { 230000, 230000, 230000, + 230000, + 230000, }; static int ClockLimit24bpp[] = { @@ -376,6 +384,8 @@ static int ClockLimit24bpp[] = { 115000, 115000, 115000, + 115000, + 115000, }; static int ClockLimit32bpp[] = { @@ -415,6 +425,8 @@ static int ClockLimit32bpp[] = { 115000, 115000, 115000, + 115000, + 115000, }; /* @@ -837,7 +849,7 @@ static Bool TRIDENTProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips = NULL; int numDevSections; int numUsed; @@ -897,6 +909,7 @@ TRIDENTProbe(DriverPtr drv, int flags) foundScreen = TRUE; } } + xfree(usedChips); } } @@ -931,8 +944,7 @@ TRIDENTProbe(DriverPtr drv, int flags) xfree(usedChips); } - if (devSections) - xfree(devSections); + xfree(devSections); return foundScreen; } @@ -1669,6 +1681,24 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; + case CYBERBLADEAI1: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SDRAM"; + pTrident->IsCyber = TRUE; + Support24bpp = TRUE; + chipset = "CyberBlade/Ai1"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; + case CYBERBLADEAI1D: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SDRAM"; + pTrident->IsCyber = TRUE; + Support24bpp = TRUE; + chipset = "CyberBlade/DSTN/Ai1"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; } if (!pScrn->progClock) { @@ -2177,6 +2207,8 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case CYBERBLADEI7D: case CYBERBLADEI1: case CYBERBLADEI1D: + case CYBERBLADEAI1: + case CYBERBLADEAI1D: case CYBER9520: case CYBER9525DVD: case CYBERBLADEE4: @@ -2476,6 +2508,8 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) (pTrident->Chipset == CYBERBLADEI7D) || (pTrident->Chipset == CYBERBLADEI1) || (pTrident->Chipset == CYBERBLADEI1D) || + (pTrident->Chipset == CYBERBLADEAI1) || + (pTrident->Chipset == CYBERBLADEAI1D) || (pTrident->Chipset == CYBERBLADEE4) || (pTrident->Chipset == BLADE3D)) BladeAccelInit(pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h index 22b1bedd4..754192162 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.15 2000/11/28 00:04:39 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.16 2000/12/04 08:46:17 alanh Exp $ */ #define DEBUG 1 @@ -325,7 +325,7 @@ #define IMAGEBUSY(b) \ (b = MMIO_IN32(pTrident->IOBase,IMAGE_GE_STATUS) & 0xF0000000) #define BLADEBUSY(b) \ - (b = MMIO_IN32(pTrident->IOBase,BLADE_GE_STATUS) & 0xF0000000) + (b = MMIO_IN32(pTrident->IOBase,BLADE_GE_STATUS) & 0xFA800000) #define IMAGE_OUT(addr, c) \ MMIO_OUT32(pTrident->IOBase, addr, (c)) #define BLADE_OUT(addr, c) \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c index 92d1e151f..52496e1a0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.76 2000/11/16 19:45:01 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.77 2000/12/02 15:30:59 tsi Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -511,7 +511,7 @@ static Bool TsengProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int numDevSections; int numUsed; int *usedChips = NULL; @@ -572,8 +572,8 @@ TsengProbe(DriverPtr drv, int flags) TsengAssignFPtr(pScrn); foundScreen = TRUE; } - xfree(usedChips); } + xfree(usedChips); } } @@ -595,8 +595,7 @@ TsengProbe(DriverPtr drv, int flags) } xfree(usedChips); } - if (devSections) - xfree(devSections); + xfree(devSections); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c index 68b7adf65..edc2421b2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c @@ -26,7 +26,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.6 2000/11/14 16:54:54 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.8 2000/12/02 15:31:00 tsi Exp $ */ #include "vesa.h" @@ -40,7 +40,7 @@ /* Colormap handling */ #include "micmap.h" #include "xf86cmap.h" -#define DEBUG + /* Mandatory functions */ static OptionInfoPtr VESAAvailableOptions(int chipid, int busid); static void VESAIdentify(int flags); @@ -220,7 +220,7 @@ VESAProbe(DriverPtr drv, int flags) { Bool foundScreen = FALSE; int numDevSections, numUsed; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int i; @@ -240,7 +240,7 @@ VESAProbe(DriverPtr drv, int flags) drv, &usedChips); if (numUsed > 0) { if (flags & PROBE_DETECT) - return (TRUE); + foundScreen = TRUE; else { for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; @@ -261,9 +261,9 @@ VESAProbe(DriverPtr drv, int flags) pScrn->FreeScreen = VESAFreeScreen; foundScreen = TRUE; } - xfree(usedChips); } } + xfree(usedChips); } } @@ -274,8 +274,8 @@ VESAProbe(DriverPtr drv, int flags) numDevSections, &usedChips); if(numUsed > 0) { if (flags & PROBE_DETECT) - return (TRUE); - for (i = 0; i < numUsed; i++) { + foundScreen = TRUE; + else for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; if ((pScrn = xf86ConfigIsaEntity(pScrn, 0,usedChips[i], VESAISAchipsets, NULL, @@ -294,12 +294,11 @@ VESAProbe(DriverPtr drv, int flags) pScrn->FreeScreen = VESAFreeScreen; foundScreen = TRUE; } - xfree(usedChips); } + xfree(usedChips); } - if (devSections) - xfree(devSections); + xfree(devSections); return (foundScreen); } @@ -1165,7 +1164,8 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pVesa->bank.nBankDepth = pScrn->depth; if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY, pScrn->virtualX, &pVesa->bank)) { - ErrorF("Bank switch initialization failed!\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Bank switch initialization failed!\n"); return (FALSE); } } @@ -1266,7 +1266,7 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) data->mode &= ~(1 << 11); } else { - ErrorF("Set VBE Mode failed!\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); return (FALSE); } } @@ -1313,15 +1313,18 @@ VESAMapVidMem(ScrnInfoPtr pScrn) pVesa->base = xf86MapVidMem(pScrn->scrnIndex, 0, pScrn->memPhysBase, pVesa->mapSize); + if (pVesa->base) { + if (pVesa->mapPhys != 0xa0000) + pVesa->VGAbase = xf86MapVidMem(pScrn->scrnIndex, 0, + 0xa0000, 0x10000); + else + pVesa->VGAbase = pVesa->base; + } #ifdef DEBUG ErrorF("virtual address = %p - physical address = %p - size = %d\n", pVesa->base, pScrn->memPhysBase, pVesa->mapSize); #endif -#if 0 - pVesa->base = xf86int10Addr(pVesa->pInt, 0xa0000); -#endif - return (pVesa->base != NULL); } @@ -1334,6 +1337,8 @@ VESAUnmapVidMem(ScrnInfoPtr pScrn) return; xf86UnMapVidMem(pScrn->scrnIndex, pVesa->base, pVesa->mapSize); + if (pVesa->mapPhys != 0xa0000) + xf86UnMapVidMem(pScrn->scrnIndex, pVesa->VGAbase, 0x10000); pVesa->base = NULL; } @@ -1506,18 +1511,18 @@ static void SaveFonts(ScrnInfoPtr pScrn) { VESAPtr pVesa = VESAGetRec(pScrn); - unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4; + unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4, scrn; if (pVesa->fonts != NULL) return; - pVesa->fonts = xalloc(16384); - /* If in graphics mode, don't save anything */ attr10 = ReadAttr(0x10); if (attr10 & 0x01) return; + pVesa->fonts = xalloc(16384); + /* save the registers that are needed here */ miscOut = ReadMiscOut(); gr4 = ReadGr(0x04); @@ -1529,6 +1534,11 @@ SaveFonts(ScrnInfoPtr pScrn) /* Force into colour mode */ WriteMiscOut(miscOut | 0x01); + scrn = ReadSeq(0x01) | 0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); + WriteAttr(0x10, 0x01); /* graphics mode */ /*font1 */ @@ -1537,7 +1547,7 @@ SaveFonts(ScrnInfoPtr pScrn) WriteGr(0x04, 0x02); /* read plane 2 */ WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_frombus(pVesa->base, pVesa->fonts, 8192); + slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts, 8192); /* font2 */ WriteSeq(0x02, 0x08); /* write to plane 3 */ @@ -1545,7 +1555,12 @@ SaveFonts(ScrnInfoPtr pScrn) WriteGr(0x04, 0x03); /* read plane 3 */ WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_frombus(pVesa->base, pVesa->fonts + 8192, 8192); + slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts + 8192, 8192); + + scrn = ReadSeq(0x01) & ~0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); /* Restore clobbered registers */ WriteAttr(0x10, attr10); @@ -1561,11 +1576,14 @@ static void RestoreFonts(ScrnInfoPtr pScrn) { VESAPtr pVesa = VESAGetRec(pScrn); - unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4; + unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4, scrn; if (pVesa->fonts == NULL) return; + if (pVesa->mapPhys == 0xa0000 && pVesa->curBank != 0) + VESABankSwitch(pScrn->pScreen, 0); + /* save the registers that are needed here */ miscOut = ReadMiscOut(); attr10 = ReadAttr(0x10); @@ -1581,6 +1599,11 @@ RestoreFonts(ScrnInfoPtr pScrn) /* Force into colour mode */ WriteMiscOut(miscOut | 0x01); + scrn = ReadSeq(0x01) | 0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); + WriteAttr(0x10, 0x01); /* graphics mode */ if (pScrn->depth == 4) { /* GJA */ @@ -1594,14 +1617,19 @@ RestoreFonts(ScrnInfoPtr pScrn) WriteGr(0x04, 0x02); /* read plane 2 */ WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_tobus(pVesa->fonts, pVesa->base, 8192); + slowbcopy_tobus(pVesa->fonts, pVesa->VGAbase, 8192); WriteSeq(0x02, 0x08); /* write to plane 3 */ WriteSeq(0x04, 0x06); /* enable plane graphics */ WriteGr(0x04, 0x03); /* read plane 3 */ WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_tobus(pVesa->fonts + 8192, pVesa->base, 8192); + slowbcopy_tobus(pVesa->fonts + 8192, pVesa->VGAbase, 8192); + + scrn = ReadSeq(0x01) & ~0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); /* restore the registers that were changed */ WriteMiscOut(miscOut); @@ -1973,53 +2001,59 @@ VESASaveRestore(ScrnInfoPtr pScrn, int function) (void)VESAGetVBEMode(pScrn, &pVesa->stateMode); SaveFonts(pScrn); - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = 0; - pVesa->pInt->cx = 0x000f; - xf86ExecX86int10(pVesa->pInt); - if (pVesa->pInt->ax != 0x4f) - return (FALSE); + if (pVesa->major > 1) { + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x4f04; + pVesa->pInt->dx = 0; + pVesa->pInt->cx = 0x000f; + xf86ExecX86int10(pVesa->pInt); + if (pVesa->pInt->ax != 0x4f) + return (FALSE); - npages = (pVesa->pInt->bx * 64) / 4096 + 1; - if ((pVesa->state = xf86Int10AllocPages(pVesa->pInt, npages, - &pVesa->statePage)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Cannot allocate memory to save SVGA state.\n"); - return (FALSE); + npages = (pVesa->pInt->bx * 64) / 4096 + 1; + if ((pVesa->state = xf86Int10AllocPages(pVesa->pInt, npages, + &pVesa->statePage)) == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Cannot allocate memory to save SVGA state.\n"); + return (FALSE); + } } } /* Save/Restore Super VGA state */ if (function != MODE_QUERY) { - int ax_reg; + int ax_reg = 0; - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = function; - pVesa->pInt->cx = 0x000f; + if (pVesa->major > 1) { + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x4f04; + pVesa->pInt->dx = function; + pVesa->pInt->cx = 0x000f; - if (function == MODE_RESTORE) - memcpy(pVesa->state, pVesa->pstate, pVesa->stateSize); + if (function == MODE_RESTORE) + memcpy(pVesa->state, pVesa->pstate, pVesa->stateSize); - pVesa->pInt->es = SEG_ADDR(pVesa->statePage); - pVesa->pInt->bx = SEG_OFF(pVesa->statePage); - xf86ExecX86int10(pVesa->pInt); - ax_reg = pVesa->pInt->ax; + pVesa->pInt->es = SEG_ADDR(pVesa->statePage); + pVesa->pInt->bx = SEG_OFF(pVesa->statePage); + xf86ExecX86int10(pVesa->pInt); + ax_reg = pVesa->pInt->ax; + } if (function == MODE_RESTORE) { VESASetVBEMode(pScrn, pVesa->stateMode, NULL); RestoreFonts(pScrn); } - if (ax_reg != 0x4f) - return (FALSE); + if (pVesa->major > 1) { + if (ax_reg != 0x4f) + return (FALSE); - if (function == MODE_SAVE && pVesa->pstate == NULL) { - /* don't rely on the memory not being touched */ - pVesa->stateSize = pVesa->pInt->bx * 64; - pVesa->pstate = xalloc(pVesa->stateSize); - memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); + if (function == MODE_SAVE && pVesa->pstate == NULL) { + /* don't rely on the memory not being touched */ + pVesa->stateSize = pVesa->pInt->bx * 64; + pVesa->pstate = xalloc(pVesa->stateSize); + memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); + } } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h index 86cab01ae..1233698a1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h @@ -1,16 +1,16 @@ /* * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * + * * 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 @@ -18,7 +18,7 @@ * 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. - * + * * Except as contained in this notice, the name of Conectiva Linux shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from @@ -26,7 +26,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.4 2000/10/27 18:31:05 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.5 2000/12/01 19:56:01 paulo Exp $ */ #ifndef _VESA_H_ @@ -102,7 +102,7 @@ typedef struct _VESARec int curBank, bankSwitchWindowB; CARD16 maxBytesPerScanline; int mapPhys, mapOff, mapSize; /* video memory */ - void *base; + void *base, *VGAbase; CARD8 *state, *pstate; /* SVGA state */ int statePage, stateSize, stateMode; int page; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c b/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c index ef0dfc062..43ed83f73 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.47 2000/11/16 19:45:02 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.48 2000/12/02 15:31:00 tsi Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -235,7 +235,7 @@ GenericProbe(DriverPtr drv, int flags) { Bool foundScreen = FALSE; int numDevSections, numUsed; - GDevPtr *devSections = NULL; + GDevPtr *devSections; int *usedChips; int i; @@ -279,8 +279,8 @@ GenericProbe(DriverPtr drv, int flags) foundScreen = TRUE; } } - xfree(usedChips); } + xfree(usedChips); } } @@ -291,8 +291,8 @@ GenericProbe(DriverPtr drv, int flags) numDevSections,&usedChips); if(numUsed > 0) { if (flags & PROBE_DETECT) - return TRUE; - for (i = 0; i < numUsed; i++) { + foundScreen = TRUE; + else for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; if ((pScrn = xf86ConfigIsaEntity(pScrn,0,usedChips[i], GenericISAchipsets,NULL, @@ -312,12 +312,11 @@ GenericProbe(DriverPtr drv, int flags) pScrn->ValidMode = GenericValidMode; foundScreen = TRUE; } - xfree(usedChips); } + xfree(usedChips); } - if (devSections) - xfree(devSections); + xfree(devSections); return foundScreen; } diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list index 40c03194a..7bd4548b9 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list @@ -3,7 +3,7 @@ lib/libGL.so.1.2 lib/libICE.so.6.3 lib/libPEX5.so.6.0 lib/libSM.so.6.0 -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libXIE.so.6.0 lib/libXThrStub.so.6.0 lib/libXaw.so.6.1 @@ -11,7 +11,7 @@ lib/libXaw.so.7.0 lib/libXext.so.6.4 lib/libXfont.so.1.3 lib/libXi.so.6.0 -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXp.so.6.2 lib/libXpm.so.4.11 lib/libXt.so.6.0 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list index 071c399e9..10aaba215 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list @@ -11,7 +11,7 @@ lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so lib/libXIE.so.6.0 @@ -31,7 +31,7 @@ lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so.6 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so lib/libXp.so.6.2 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list index 071c399e9..10aaba215 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list @@ -11,7 +11,7 @@ lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so lib/libXIE.so.6.0 @@ -31,7 +31,7 @@ lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so.6 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so lib/libXp.so.6.2 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list index 071c399e9..10aaba215 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list @@ -11,7 +11,7 @@ lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so lib/libXIE.so.6.0 @@ -31,7 +31,7 @@ lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so.6 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so lib/libXp.so.6.2 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list index 071c399e9..10aaba215 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list @@ -11,7 +11,7 @@ lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so lib/libXIE.so.6.0 @@ -31,7 +31,7 @@ lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so.6 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so lib/libXp.so.6.2 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list index 071c399e9..10aaba215 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list @@ -11,7 +11,7 @@ lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so lib/libXIE.so.6.0 @@ -31,7 +31,7 @@ lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so.6 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so lib/libXp.so.6.2 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list index c7e9bd845..293d1c4a4 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list @@ -3,14 +3,14 @@ lib/libGL.so.1.2 lib/libICE.so.6.3 lib/libPEX5.so.6.0 lib/libSM.so.6.0 -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libXIE.so.6.0 lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXext.so.6.4 lib/libXfont.so.1.3 lib/libXi.so.6.0 -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXp.so.6.2 lib/libXpm.so.4.11 lib/libXt.so.6.0 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list index 3adce5d13..bb6e90d8a 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list @@ -3,7 +3,7 @@ lib/libGL.so.1.2 lib/libICE.so.6.3 lib/libPEX5.so.6.0 lib/libSM.so.6.0 -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libXIE.so.6.0 lib/libXThrStub.so.6.0 lib/libXaw.so.6.1 @@ -11,7 +11,7 @@ lib/libXaw.so.7.0 lib/libXext.so.6.4 lib/libXfont.so.1.3 lib/libXi.so.6.0 -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXp.so.6.2 lib/libXpm.so.4.11 lib/libXt.so.6.0 diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list index 10ec8123e..40ea17e7e 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list @@ -7,7 +7,7 @@ lib/libPEX5.so.6.0 lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so lib/libXIE.so.6.0 lib/libXIE.so @@ -20,7 +20,7 @@ lib/libXfont.so.1.3 lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so lib/libXp.so.6.2 lib/libXp.so diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list index 10ec8123e..40ea17e7e 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list @@ -7,7 +7,7 @@ lib/libPEX5.so.6.0 lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so lib/libXIE.so.6.0 lib/libXIE.so @@ -20,7 +20,7 @@ lib/libXfont.so.1.3 lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so lib/libXp.so.6.2 lib/libXp.so diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list index 10ec8123e..40ea17e7e 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list @@ -7,7 +7,7 @@ lib/libPEX5.so.6.0 lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so -lib/libX11.so.6.1 +lib/libX11.so.6.2 lib/libX11.so lib/libXIE.so.6.0 lib/libXIE.so @@ -20,7 +20,7 @@ lib/libXfont.so.1.3 lib/libXfont.so lib/libXi.so.6.0 lib/libXi.so -lib/libXmu.so.6.1 +lib/libXmu.so.6.2 lib/libXmu.so lib/libXp.so.6.2 lib/libXp.so diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def index 643edd2ef..e39bb10f6 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def @@ -6,7 +6,7 @@ * - XFree86 doctools package (requires groff) * - nroff/troff or groff * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.5 2000/11/28 18:50:22 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.6 2000/12/05 00:32:03 dawes Exp $ */ #define HasSgmlFmt YES @@ -15,8 +15,8 @@ #define BuildSpecsDocs YES #define SpecsDocDirs BDF CTEXT FSProtocol ICCCM \ - /*XProtocol*/ Xserver X11 XDMCP XLFD Xaw \ - Xmu Xt Xext /*Xi*/ xfs /*PEX5*/ ICE SM xtrans \ - xterm rstart GL Xv /*i18n*/ programs + XProtocol Xserver X11 XDMCP XLFD Xaw \ + Xmu Xt Xext Xi xfs /*PEX5*/ ICE SM xtrans \ + xterm rstart GL Xv i18n programs diff --git a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c index b7f1c796b..d9b3f0ef9 100644 --- a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c +++ b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.36 2000/10/24 18:07:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.37 2000/12/02 01:16:24 dawes Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -594,8 +594,8 @@ static unsigned char proto[PROT_NUMPROTOS][8] = { { 0xc0, 0x00, 0x00, 0x00, 6, 0x00, 0xff, MPF_NONE }, /* NetScroll */ /* Bus Mouse */ { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* BusMouse */ - /* Auto */ - { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* dummy entry */ + { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* Auto (dummy) */ + { 0xf8, 0x80, 0x00, 0x00, 8, 0x00, 0xff, MPF_NONE }, /* SysMouse */ }; /* diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile b/xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile index 571f3ba2e..8a5d5b3d8 100644 --- a/xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile @@ -1,8 +1,12 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile,v 1.6 2000/03/03 01:05:51 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile,v 1.7 2000/12/01 17:43:06 dawes Exp $ #define IHaveModules #include <Server.tmpl> +#if HasLinuxInput +DEFINES = -DLINUX_INPUT +#endif + SRCS = xf86Wacom.c OBJS = xf86Wacom.o @@ -26,6 +30,11 @@ CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif +XCOMM Build a standalone executable to be able to test the driver without +XCOMM a running X server. +LinkFile(testwacom.c,xf86Wacom.c) +SpecialCObjectRule(testwacom,NullParameter,-DTEST) + DependTarget() InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp b/xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp index 57c7bdf7e..7233cc226 100644 --- a/xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp +++ b/xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp,v 1.4 2000/06/14 02:13:19 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp,v 1.5 2000/12/01 17:43:06 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH WACOM __drivermansuffix__ "Version 4.0.1" "XFree86" @@ -33,4 +33,4 @@ Config details... .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). .SH AUTHORS -Authors include... +Frederic Lepied diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c index 19f01fdcc..973b793de 100644 --- a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c +++ b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.20 2000/11/14 17:33:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.21 2000/12/01 17:43:06 dawes Exp $ */ /* * This driver is only able to handle the Wacom IV and Wacom V protocols. @@ -32,6 +32,13 @@ * * Many thanks to Dave Fleck from Wacom for the help provided to * build this driver. + * + * Modified for Linux USB by MATSUMURA Namihiko. + * Daniel Egger, Germany. <egger@suse.de>, + * Frederic Lepied <lepied@xfree86.org>. + * Brion Vibber <brion@pobox.com>, + * Aaron Optimizer Digulla <digulla@hepe.com> + * */ /* @@ -49,7 +56,19 @@ * */ -static const char identification[] = "$Identification: 19 $"; +static const char identification[] = "$Identification: 20 $"; + +#ifdef LINUX_INPUT +#include <asm/types.h> +#include <linux/input.h> + +#ifndef O_NDELAY +#ifndef O_NONBLOCK +#define O_NONBLOCK 04000 +#endif +#define O_NDELAY O_NONBLOCK +#endif +#endif #include <xf86Version.h> @@ -291,6 +310,7 @@ typedef struct _WacomCommonRec WacomDeviceState wcmDevStat[2]; /* device state for each tool */ int wcmInitNumber; /* magic number for the init phasis */ unsigned int wcmLinkSpeed; /* serial link speed */ + Bool (*wcmOpen)(LocalDevicePtr /*local*/); /* function used to open the line (serial or USB) */ } WacomCommonRec, *WacomCommonPtr; /****************************************************************************** @@ -800,7 +820,13 @@ xf86WcmConfig(LocalDevicePtr *array, break; case USB: - /* local->read_input=xf86WcmReadUSBInput; */ +#ifdef LINUX_INPUT + local->read_input=xf86WcmReadUSBInput; + common->wcmOpen=xf86WcmUSBOpen; + ErrorF("%s Wacom reading USB link\n", XCONFIG_GIVEN); +#else + ErrorF("The USB version of the driver isn't available for your platform\n"); +#endif break; case EOF: @@ -1735,15 +1761,15 @@ xf86WcmReadInput(LocalDevicePtr local) if (common->wcmMaxZ == 512) { z = z*4 + ((common->wcmData[0] & ZAXIS_BIT) >> 1); - if (common->wcmData[6] & ZAXIS_SIGN_BIT) { - z /= 2; + if (!(common->wcmData[6] & ZAXIS_SIGN_BIT)) { + z += 256; } DBG(10, ErrorF("graphire pressure(%c)=%d\n", (common->wcmData[6] & ZAXIS_SIGN_BIT) ? '-' : '+', z)); } else { - if (common->wcmData[6] & ZAXIS_SIGN_BIT) { - z /= 2; + if (!(common->wcmData[6] & ZAXIS_SIGN_BIT)) { + z += (common->wcmMaxZ / 2); } } @@ -2056,6 +2082,237 @@ xf86WcmReadInput(LocalDevicePtr local) local, priv, common->wcmIndex)); } +#ifdef LINUX_INPUT +/* + *************************************************************************** + * + * xf86WcmReadUSBInput -- + * Read the new events from the device, and enqueue them. + * + *************************************************************************** + */ +static void +xf86WcmReadUSBInput(LocalDevicePtr local) +{ + WacomDevicePtr priv = (WacomDevicePtr) local->private; + WacomCommonPtr common = priv->common; + int device = common->wcmIndex; + int serial; + int is_proximity; + int x; + int y; + int pressure; + int buttons; + int tilt_x; + int tilt_y; + int wheel; + + ssize_t len; + int idx; + struct input_event * event; + char eventbuf[BUFFER_SIZE]; +#define MOD_BUTTONS(bit, value) \ + { int _b=bit, _v=value; buttons = (((_v) != 0) ? (buttons | _b) : (buttons & ~ _b)); } + + SYSCALL(len = read(local->fd, eventbuf, BUFFER_SIZE)); + + if (len <= 0) { + ErrorF("Error reading wacom device : %s\n", strerror(errno)); + return; + } + + for (event=(struct input_event *)eventbuf; + event<(struct input_event *)(eventbuf+len); event++) { + DBG(10, ErrorF("event->type=%d\n", event->type)); + + switch (event->type) { + case EV_ABS: + switch (event->code) { + case ABS_X: + x = event->value; + break; + + case ABS_Y: + y = event->value; + break; + + case ABS_TILT_X: + tilt_x = event->value; + break; + + case ABS_TILT_Y: + tilt_y = event->value; + break; + + case ABS_PRESSURE: + pressure = event->value; + break; + + case ABS_DISTANCE: + /* This is not sent by the driver */ + break; + } + break; /* EV_ABS */ + + case EV_REL: + switch (event->code) { + case REL_WHEEL: + /* FIXME */ + break; + } + break; /* EV_REL */ + + case EV_KEY: + switch (event->code) { + case BTN_TOOL_PEN: + device = STYLUS_ID; + is_proximity = (event->value != 0); + break; + + case BTN_TOOL_RUBBER: + device = ERASER_ID; + is_proximity = (event->value != 0); + break; + + case BTN_TOOL_MOUSE: + device = CURSOR_ID; + is_proximity = (event->value != 0); + break; + + case BTN_TOUCH: + MOD_BUTTONS (1, event->value); + break; + + case BTN_STYLUS: + MOD_BUTTONS (2, event->value); + break; + + case BTN_STYLUS2: + MOD_BUTTONS (4, event->value); + break; + + case BTN_LEFT: + MOD_BUTTONS (1, event->value); + break; + + case BTN_RIGHT: + MOD_BUTTONS (2, event->value); + break; + + case BTN_MIDDLE: + MOD_BUTTONS (4, event->value); + break; + } + break; /* EV_KEY */ + } + +#if 0 + if ((priv->oldX != -1) && + (ABS(x - priv->oldX) <= common->wcmSuppress) && + (ABS(y - priv->oldY) <= common->wcmSuppress) && + (ABS(pressure - priv->oldZ) < 3) && + (ABS(tilt_x - priv->oldTiltX) < 3) && + (ABS(tilt_y - priv->oldTiltY) < 3)) { + DBG(10, ErrorF("filtered\n")); + continue; + } +#endif + + for (idx=0; idx<common->wcmNumDevices; idx++) { + WacomDevicePtr dev; + int id; + + dev = common->wcmDevices[idx]->private; + id = DEVICE_ID (dev->flags); + + /* Find the device the current events are meant for */ + if (id == device) { + xf86WcmSendEvents(common->wcmDevices[idx], + device, + serial, + (device == STYLUS_ID || device == ERASER_ID), + !!(buttons), + is_proximity, + x, y, pressure, buttons, + tilt_x, tilt_y, wheel + ); + } + } + priv->oldX = x; + priv->oldY = y; + priv->oldZ = pressure; + priv->oldTiltX = tilt_x; + priv->oldTiltY = tilt_y; + } +} + +/* + *************************************************************************** + * + * xf86WcmUSBOpen -- + * + *************************************************************************** + */ +static Bool +xf86WcmUSBOpen(LocalDevicePtr local) +{ + int err = 0; + WacomDevicePtr priv = (WacomDevicePtr)local->private; + WacomCommonPtr common = priv->common; + + SYSCALL(local->fd = open(common->wcmDevice, O_RDONLY|O_NDELAY, 0)); + if (local->fd == -1) { + ErrorF("Error opening %s : %s\n", common->wcmDevice, strerror(errno)); + return !Success; + } + + DBG(2, ErrorF("setup is max X=%d max Y=%d resol X=%d resol Y=%d\n", + common->wcmMaxX, common->wcmMaxY, common->wcmResolX, + common->wcmResolY)); + + /* send the tilt mode command after setup because it must be enabled */ + /* after multi-mode to take precedence */ + if (HANDLE_TILT(common)) { + /* Unfortunately, the USB driver doesn't allow to send this + * command to the tablet. Any other solutions ? */ + DBG(2, ErrorF("Sending tilt mode order\n")); + } + + { + if (common->wcmSuppress < 0) { + common->wcmSuppress = 0; + } else { + if (common->wcmSuppress > 100) { + common->wcmSuppress = 99; + } + } + /* Cannot send WC_SUPPRESS to the table. Will have to do + * this manually. */ + } + + priv->topX = 0; + priv->bottomX = common->wcmMaxX; + priv->topY = 0; + priv->bottomY = common->wcmMaxY; + + if (xf86Verbose) + ErrorF("%s Wacom tablet maximum X=%d maximum Y=%d " + "X resolution=%d Y resolution=%d suppress=%d%s\n", + XCONFIG_PROBED, common->wcmMaxX, common->wcmMaxY, + common->wcmResolX, common->wcmResolY, common->wcmSuppress, + HANDLE_TILT(common) ? " Tilt" : ""); + + if (err < 0) { + ErrorF("ERROR: %d\n", err); + SYSCALL(close(local->fd)); + return !Success; + } + + return Success; +} + +#endif /* LINUX_INPUT */ + /* *************************************************************************** * @@ -2523,7 +2780,7 @@ xf86WcmOpenDevice(DeviceIntPtr pWcm) if (local->fd < 0) { if (common->wcmInitNumber > 2 || priv->initNumber == common->wcmInitNumber) { - if (xf86WcmOpen(local) != Success) { + if (common->wcmOpen(local) != Success) { if (local->fd >= 0) { SYSCALL(close(local->fd)); } @@ -3025,6 +3282,7 @@ xf86WcmAllocate(char * name, common->wcmThreshold = INVALID_THRESHOLD; /* button 1 threshold for some tablet models */ common->wcmInitNumber = 0; /* magic number for the init phasis */ common->wcmLinkSpeed = 9600; /* serial link speed */ + common->wcmOpen = xf86WcmOpen; /* function used to open the line (serial or USB) */ return local; } @@ -3303,8 +3561,14 @@ xf86WcmInit(InputDriverPtr drv, common->wcmFlags |= TILT_FLAG; } - if (xf86SetBoolOption(local->options, "Usb", 0)) { - /*local->read_input = xf86WcmReadUSBInput;*/ + if (xf86SetBoolOption(local->options, "USB", 0)) { +#ifdef LINUX_INPUT + local->read_input=xf86WcmReadUSBInput; + common->wcmOpen=xf86WcmUSBOpen; + xf86Msg(X_CONFIG, "%s: reading USB link\n", dev->identifier); +#else + ErrorF("The USB version of the driver isn't available for your platform\n"); +#endif } if (xf86SetBoolOption(local->options, "KeepShape", 0)) { diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c index 6e9c6fefa..58493d2f7 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c +++ b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.13 2000/11/21 23:10:38 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.14 2000/12/02 15:31:01 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -174,14 +174,10 @@ int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem) ((codeSeg << 4) >= SYS_SIZE)) return FALSE; - if ((codeSeg << 4) >= SYS_BIOS) - return TRUE; - if (xf86IsPc98()) return FALSE; - if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2) || - (*(vbiosMem+2) > 0x80U)) + if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2)) return FALSE; size = *(vbiosMem + 2) * 512; diff --git a/xc/programs/Xserver/hw/xfree86/int10/pci.c b/xc/programs/Xserver/hw/xfree86/int10/pci.c index 49512cd28..262e095cf 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/pci.c +++ b/xc/programs/Xserver/hw/xfree86/int10/pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.4 2000/11/03 18:46:16 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.5 2000/12/02 15:31:01 tsi Exp $ */ /* * XFree86 int10 module @@ -18,93 +18,85 @@ mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address) PCITAG tag; unsigned long offset = 0; unsigned char *mem, *ptr; - unsigned char *scratch = NULL; - int length = 0; + int length, rlength, blength; pciVideoPtr pvp = xf86GetPciInfoForEntity(pInt->entityIndex); - + if (pvp == NULL) { #ifdef DEBUG - ErrorF("mapPciRom: no PCI info\n"); + ErrorF("mapPciRom: no PCI info\n"); #endif return 0; } - + tag = pciTag(pvp->bus,pvp->device,pvp->func); - - mem = ptr = xnfcalloc(0x10000, 1); - if (! xf86ReadPciBIOS(offset,tag,-1,mem,0xFFFF) < 0) { - xfree(mem); + rlength = blength = 1 << pvp->biosSize; + + /* Read in entire PCI ROM in 64kB chunks */ + mem = ptr = xnfcalloc(blength, 1); + while ((length = rlength) > 0) { + if (length > 0x10000) length = 0x10000; + if (xf86ReadPciBIOS(offset, tag, -1, ptr, length) < length) { + xfree(mem); #ifdef DEBUG - ErrorF("mapPciRom: cannot read BIOS\n"); + ErrorF("mapPciRom: cannot read BIOS\n"); #endif - return 0; + return 0; + } + offset += length; + rlength -= length; + ptr += length; } - while ( *ptr == 0x55 && *(ptr+1) == 0xAA) { - unsigned short data_off = *(ptr+0x18) | (*(ptr+0x19)<< 8); + ptr = mem; + while ((ptr[0] == 0x55) && (ptr[1] == 0xAA)) { + unsigned short data_off = ptr[0x18] | (ptr[0x19] << 8); unsigned char *data = ptr + data_off; unsigned char type; - - if (*data!='P' || *(data+1)!='C' || *(data+2)!='I' || *(data+3)!='R') + + if ((data[0] != 'P') || + (data[1] != 'C') || + (data[2] != 'I') || + (data[3] != 'R')) break; - type = *(data + 0x14); + type = data[0x14]; #ifdef PRINT_PCI - ErrorF("data segment in BIOS: 0x%x, type: 0x%x ",data_off,type); + ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); #endif - if (type != 0) { /* not PC-AT image: find next one */ + if (type) { /* not PC-AT image: find next one */ unsigned int image_length; - unsigned char indicator = *(data + 0x15); + unsigned char indicator = data[0x15]; if (indicator & 0x80) /* last image */ break; - image_length = (*(data + 0x10) - | (*(data + 0x11) << 8)) << 9; + image_length = (data[0x10] | (data[0x11] << 8)) << 9; #ifdef PRINT_PCI ErrorF("data image length: 0x%x, ind: 0x%x\n", - image_length,indicator); -#endif - offset = offset + image_length; - if (xf86ReadPciBIOS(offset,tag,-1,mem,0xFFFF) < 0) { - xfree(mem); -#ifdef DEBUG - ErrorF("mapPciRom: cannot read BIOS\n"); + image_length, indicator); #endif - return 0; - } - continue; + ptr += image_length; + continue; } /* OK, we have a PC Image */ - length = (*(ptr + 2) << 9); + length = ptr[2] << 9; #ifdef PRINT_PCI - ErrorF("BIOS length: 0x%x\n",length); + ErrorF("BIOS length: 0x%x\n", length); #endif - scratch = (unsigned char *)xnfalloc(length); - - if (xf86ReadPciBIOS(offset,tag,-1,scratch,length) < 0) { - xfree(mem); - xfree(scratch); -#ifdef DEBUG - ErrorF("mapPciRom: cannot read BIOS\n"); -#endif - return 0; - } break; } + + if (length > 0) + memcpy(address, ptr, length); /* unmap/close/disable PCI bios mem */ xfree(mem); - if (scratch && length) { - memcpy(address, scratch, length); - xfree(scratch); - } #ifdef DEBUG if (!length) ErrorF("mapPciRom: no BIOS found\n"); #ifdef PRINT_PCI - if (length) + else dprint(address,0x20); #endif #endif + return length; } - diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c index a93f6e1ec..0218e73ba 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c +++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.173 2000/11/21 23:10:39 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.174 2000/12/02 01:16:25 dawes Exp $ */ /* * @@ -874,7 +874,7 @@ LOOKUP xfree86LookupTab[] = { of the X server) easier. */ SYMFUNC(xf86InstallSIGIOHandler) SYMFUNC(xf86RemoveSIGIOHandler) -# ifdef __alpha__ +# if defined(__alpha__) && defined(linux) SYMFUNC(_bus_base) # endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile index c37b982df..1adef2ef6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile @@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/16 1996/10/27 18:07:43 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.14 2000/11/06 19:24:09 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.15 2000/12/01 00:24:35 dawes Exp $ #include <Server.tmpl> @@ -23,7 +23,7 @@ PCIDRVROBJ = sparcPci.o SBUSDRVSRC = linuxSbus.c SBUSDRVOBJ = linuxSbus.o -#elif defined(LinuxArchitecture) && (defined(PpcArchitecture) || defined(MipsArchitecture)) +#elif defined(LinuxArchitecture) && (defined(PpcArchitecture) || defined(MipsArchitecture) || defined(ia64Architecture)) XCOMM generic linux PCI driver (using /proc/bus/pci, requires kernel 2.2) @@ -44,7 +44,7 @@ XCOMM PowerPC PCI drivers PCIDRVRSRC = ppcPci.c PCIDRVROBJ = ppcPci.o -#elif defined(LinuxArchitecture) && ( defined(i386Architecture) || defined(ia64Architecture)) +#elif defined(LinuxArchitecture) && (defined(i386Architecture)) XCOMM ix86 PCI driver with OS fallback for Linux diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h index b73bb6446..2909d6776 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.15 2000/11/06 19:24:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.16 2000/12/01 00:24:35 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -158,8 +158,7 @@ # define ARCH_PCI_OS_INIT linuxPciInit # define INCLUDE_XF86_MAP_PCI_MEM #elif defined(__ia64__) && defined(linux) -# define ARCH_PCI_INIT ix86PciInit -# define ARCH_PCI_OS_INIT linuxPciInit +# define ARCH_PCI_INIT linuxPciInit # define INCLUDE_XF86_MAP_PCI_MEM #elif defined(__alpha__) && defined(__FreeBSD__) # define ARCH_PCI_INIT freebsdPciInit diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel index b1b8d9768..278ff264c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel @@ -38,7 +38,8 @@ endif gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o -r128-objs := $(lib-objs) r128_drv.o r128_dma.o r128_context.o r128_bufs.o +r128-objs := $(lib-objs) r128_drv.o r128_cce.o r128_context.o r128_bufs.o\ + r128_state.o ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o mga_bufs.o \ mga_state.o diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index adf190059..2d8abbb58 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -11,11 +11,11 @@ # 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 (including the next # paragraph) 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 @@ -60,7 +60,7 @@ GAMMAHEADERS= gamma_drv.h $(DRMHEADERS) TDFXOBJS= tdfx_drv.o tdfx_context.o TDFXHEADERS= tdfx_drv.h $(DRMHEADERS) -R128OBJS= r128_drv.o r128_dma.o r128_bufs.o r128_context.o +R128OBJS= r128_drv.o r128_cce.o r128_bufs.o r128_state.o r128_context.o R128HEADERS= r128_drv.h r128_drm.h $(DRMHEADERS) INC= /usr/include diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h new file mode 100644 index 000000000..abcf9f51d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h @@ -0,0 +1,115 @@ +/* agpsupport-pre24.h -- Support for pre-2.4.0 kernels -*- linux-c -*- + * Created: Mon Nov 13 10:54:15 2000 by faith@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 (including the next + * paragraph) 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * Author: Rickard E. (Rik) Faith <faith@valinux.com> + * + */ + +#ifndef _AGPSUPPORT_PRE24_H_ +#define _AGPSUPPORT_PRE24_H_ +typedef struct { + void (*free_memory)(agp_memory *); + agp_memory *(*allocate_memory)(size_t, u32); + int (*bind_memory)(agp_memory *, off_t); + int (*unbind_memory)(agp_memory *); + void (*enable)(u32); + int (*acquire)(void); + void (*release)(void); + void (*copy_info)(agp_kern_info *); +} drm_agp_t; + +static drm_agp_t drm_agp_struct = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + +/* The C standard says that 'void *' is not guaranteed to hold a function + pointer, so we use this union to define a generic pointer that is + guaranteed to hold any of the function pointers we care about. */ +typedef union { + void (*free_memory)(agp_memory *); + agp_memory *(*allocate_memory)(size_t, u32); + int (*bind_memory)(agp_memory *, off_t); + int (*unbind_memory)(agp_memory *); + void (*enable)(u32); + int (*acquire)(void); + void (*release)(void); + void (*copy_info)(agp_kern_info *); + unsigned long address; +} drm_agp_func_u; + +typedef struct drm_agp_fill { + const char *name; + drm_agp_func_u *f; +} drm_agp_fill_t; + +static drm_agp_fill_t drm_agp_fill[] = { + { __MODULE_STRING(agp_free_memory), + (drm_agp_func_u *)&drm_agp_struct.free_memory }, + { __MODULE_STRING(agp_allocate_memory), + (drm_agp_func_u *)&drm_agp_struct.allocate_memory }, + { __MODULE_STRING(agp_bind_memory), + (drm_agp_func_u *)&drm_agp_struct.bind_memory }, + { __MODULE_STRING(agp_unbind_memory), + (drm_agp_func_u *)&drm_agp_struct.unbind_memory }, + { __MODULE_STRING(agp_enable), + (drm_agp_func_u *)&drm_agp_struct.enable }, + { __MODULE_STRING(agp_backend_acquire), + (drm_agp_func_u *)&drm_agp_struct.acquire }, + { __MODULE_STRING(agp_backend_release), + (drm_agp_func_u *)&drm_agp_struct.release }, + { __MODULE_STRING(agp_copy_info), + (drm_agp_func_u *)&drm_agp_struct.copy_info }, + { NULL, NULL } +}; + +#define DRM_AGP_GET _drm_agp_get() +#define DRM_AGP_PUT _drm_agp_put() + +static drm_agp_t *_drm_agp_get(void) +{ + drm_agp_fill_t *fill; + int agp_available = 1; + + for (fill = &drm_agp_fill[0]; fill->name; fill++) { + char *n = (char *)fill->name; + *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n); + DRM_DEBUG("%s resolves to 0x%08lx\n", n, (*fill->f).address); + if (!(*fill->f).address) agp_available = 0; + } + return &drm_agp_struct; +} + +static void _drm_agp_put(void) +{ + drm_agp_fill_t *fill; + + for (fill = &drm_agp_fill[0]; fill->name; fill++) { +#if LINUX_VERSION_CODE >= 0x020400 + if ((*fill->f).address) put_module_symbol((*fill->f).address); +#endif + (*fill->f).address = 0; + } +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c index 24fd59cdf..c996df8f4 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c @@ -31,48 +31,14 @@ #define __NO_VERSION__ #include "drmP.h" #include <linux/module.h> +#if LINUX_VERSION_CODE < 0x020400 +#include "agpsupport-pre24.h" +#else +#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp") +#define DRM_AGP_PUT inter_module_put("drm_agp") +#endif -drm_agp_func_t drm_agp = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - -/* The C standard says that 'void *' is not guaranteed to hold a function - pointer, so we use this union to define a generic pointer that is - guaranteed to hold any of the function pointers we care about. */ -typedef union { - void (*free_memory)(agp_memory *); - agp_memory *(*allocate_memory)(size_t, u32); - int (*bind_memory)(agp_memory *, off_t); - int (*unbind_memory)(agp_memory *); - void (*enable)(u32); - int (*acquire)(void); - void (*release)(void); - void (*copy_info)(agp_kern_info *); - unsigned long address; -} drm_agp_func_u; - -typedef struct drm_agp_fill { - const char *name; - drm_agp_func_u *f; -} drm_agp_fill_t; - -static drm_agp_fill_t drm_agp_fill[] = { - { __MODULE_STRING(agp_free_memory), - (drm_agp_func_u *)&drm_agp.free_memory }, - { __MODULE_STRING(agp_allocate_memory), - (drm_agp_func_u *)&drm_agp.allocate_memory }, - { __MODULE_STRING(agp_bind_memory), - (drm_agp_func_u *)&drm_agp.bind_memory }, - { __MODULE_STRING(agp_unbind_memory), - (drm_agp_func_u *)&drm_agp.unbind_memory }, - { __MODULE_STRING(agp_enable), - (drm_agp_func_u *)&drm_agp.enable }, - { __MODULE_STRING(agp_backend_acquire), - (drm_agp_func_u *)&drm_agp.acquire }, - { __MODULE_STRING(agp_backend_release), - (drm_agp_func_u *)&drm_agp.release }, - { __MODULE_STRING(agp_copy_info), - (drm_agp_func_u *)&drm_agp.copy_info }, - { NULL, NULL } -}; +static const drm_agp_t *drm_agp = NULL; int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) @@ -82,7 +48,7 @@ int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd, agp_kern_info *kern; drm_agp_info_t info; - if (!dev->agp->acquired || !drm_agp.copy_info) return -EINVAL; + if (!dev->agp->acquired || !drm_agp->copy_info) return -EINVAL; kern = &dev->agp->agp_info; info.agp_version_major = kern->version.major; @@ -107,8 +73,8 @@ int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; int retcode; - if (dev->agp->acquired || !drm_agp.acquire) return -EINVAL; - if ((retcode = (*drm_agp.acquire)())) return retcode; + if (dev->agp->acquired || !drm_agp->acquire) return -EINVAL; + if ((retcode = drm_agp->acquire())) return retcode; dev->agp->acquired = 1; return 0; } @@ -119,13 +85,18 @@ int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - if (!dev->agp->acquired || !drm_agp.release) return -EINVAL; - (*drm_agp.release)(); + if (!dev->agp->acquired || !drm_agp->release) return -EINVAL; + drm_agp->release(); dev->agp->acquired = 0; return 0; } +void _drm_agp_release(void) +{ + if (drm_agp->release) drm_agp->release(); +} + int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -133,13 +104,13 @@ int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_agp_mode_t mode; - if (!dev->agp->acquired || !drm_agp.enable) return -EINVAL; + if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL; if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode))) return -EFAULT; dev->agp->mode = mode.mode; - (*drm_agp.enable)(mode.mode); + drm_agp->enable(mode.mode); dev->agp->base = dev->agp->agp_info.aper_base; dev->agp->enabled = 1; return 0; @@ -231,7 +202,7 @@ int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, int retcode; int page; - if (!dev->agp->acquired || !drm_agp.bind_memory) return -EINVAL; + if (!dev->agp->acquired || !drm_agp->bind_memory) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) @@ -270,24 +241,14 @@ int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, drm_agp_head_t *drm_agp_init(void) { - drm_agp_fill_t *fill; drm_agp_head_t *head = NULL; - int agp_available = 1; - - for (fill = &drm_agp_fill[0]; fill->name; fill++) { - char *n = (char *)fill->name; - *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n); - DRM_DEBUG("%s resolves to 0x%08lx\n", n, (*fill->f).address); - if (!(*fill->f).address) agp_available = 0; - } - - DRM_DEBUG("agp_available = %d\n", agp_available); - if (agp_available) { + drm_agp = DRM_AGP_GET; + if (drm_agp) { if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) return NULL; memset((void *)head, 0, sizeof(*head)); - (*drm_agp.copy_info)(&head->agp_info); + drm_agp->copy_info(&head->agp_info); if (head->agp_info.chipset == NOT_SUPPORTED) { drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS); return NULL; @@ -337,12 +298,31 @@ drm_agp_head_t *drm_agp_init(void) void drm_agp_uninit(void) { - drm_agp_fill_t *fill; - - for (fill = &drm_agp_fill[0]; fill->name; fill++) { -#if LINUX_VERSION_CODE >= 0x020400 - if ((*fill->f).address) put_module_symbol((*fill->f).address); -#endif - (*fill->f).address = 0; - } + DRM_AGP_PUT; + drm_agp = NULL; +} + +agp_memory *drm_agp_allocate_memory(size_t pages, u32 type) +{ + if (!drm_agp->allocate_memory) return NULL; + return drm_agp->allocate_memory(pages, type); +} + +int drm_agp_free_memory(agp_memory *handle) +{ + if (!handle || !drm_agp->free_memory) return 0; + drm_agp->free_memory(handle); + return 1; +} + +int drm_agp_bind_memory(agp_memory *handle, off_t start) +{ + if (!handle || !drm_agp->bind_memory) return -EINVAL; + return drm_agp->bind_memory(handle, start); +} + +int drm_agp_unbind_memory(agp_memory *handle) +{ + if (!handle || !drm_agp->unbind_memory) return -EINVAL; + return drm_agp->unbind_memory(handle); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h index 257baca15..77a2bee1c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h @@ -38,4 +38,8 @@ #define block_all_signals(a,b,c) #define unblock_all_signals() +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) +#define __exit +#endif + #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c index 5cc3ec369..56dd2441e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c @@ -405,6 +405,7 @@ int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *d) schedule(); if (signal_pending(current)) { atomic_dec(&q->use_count); + remove_wait_queue(&q->write_queue, &entry); return -EINTR; } } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h index 57032d6e2..20691ccf2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h @@ -11,11 +11,11 @@ * 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 (including the next * paragraph) 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 @@ -23,7 +23,7 @@ * 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. - * + * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * @@ -363,12 +363,20 @@ typedef struct drm_agp_info { #define DRM_IOCTL_I810_DOCOPY DRM_IO ( 0x48) /* Rage 128 specific ioctls */ -#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) -#define DRM_IOCTL_R128_RESET DRM_IO( 0x41) -#define DRM_IOCTL_R128_FLUSH DRM_IO( 0x42) -#define DRM_IOCTL_R128_IDLE DRM_IO( 0x43) -#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t) -#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) +#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) +#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) +#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) +#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) +#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) +#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) +#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) +#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) +#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) +#define DRM_IOCTL_R128_PACKET DRM_IOWR(0x4e, drm_r128_packet_t) /* SiS specific ioctls */ #define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h index 46e08e057..affeae705 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h @@ -59,15 +59,6 @@ #include <asm/io.h> #include <asm/mman.h> #include <asm/uaccess.h> - -#ifndef copy_to_user_ret -#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) -#endif - -#ifndef copy_from_user_ret -#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) -#endif - #ifdef CONFIG_MTRR #include <asm/mtrr.h> #endif @@ -519,19 +510,6 @@ typedef struct drm_agp_head { unsigned long base; int agp_mtrr; } drm_agp_head_t; - -typedef struct { - void (*free_memory)(agp_memory *); - agp_memory *(*allocate_memory)(size_t, u32); - int (*bind_memory)(agp_memory *, off_t); - int (*unbind_memory)(agp_memory *); - void (*enable)(u32); - int (*acquire)(void); - void (*release)(void); - void (*copy_info)(agp_kern_info *); -} drm_agp_func_t; - -extern drm_agp_func_t drm_agp; #endif typedef struct drm_sigdata { @@ -833,6 +811,7 @@ extern drm_agp_head_t *drm_agp_init(void); extern void drm_agp_uninit(void); extern int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern void _drm_agp_release(void); extern int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_agp_enable(struct inode *inode, struct file *filp, @@ -847,6 +826,10 @@ extern int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern agp_memory *drm_agp_allocate_memory(size_t pages, u32 type); +extern int drm_agp_free_memory(agp_memory *handle); +extern int drm_agp_bind_memory(agp_memory *handle, off_t start); +extern int drm_agp_unbind_memory(agp_memory *handle); #endif #endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c index dba974c2b..a17bc1a9f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c @@ -339,7 +339,7 @@ int gamma_find_devices(void) /* gamma_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int gamma_init(void) +static int __init gamma_init(void) { int retcode; drm_device_t *dev = &gamma_device; @@ -380,7 +380,7 @@ static int gamma_init(void) /* gamma_cleanup is called via cleanup_module at module unload time. */ -static void gamma_cleanup(void) +static void __exit gamma_cleanup(void) { drm_device_t *dev = &gamma_device; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c index ed880c41a..7152eac3a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c @@ -255,8 +255,7 @@ static int i810_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; @@ -338,7 +337,7 @@ static int i810_takedown(drm_device_t *dev) /* i810_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int i810_init(void) +static int __init i810_init(void) { int retcode; drm_device_t *dev = &i810_device; @@ -397,7 +396,7 @@ static int i810_init(void) /* i810_cleanup is called via cleanup_module at module unload time. */ -static void i810_cleanup(void) +static void __exit i810_cleanup(void) { drm_device_t *dev = &i810_device; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c index 34d19b203..261fb34a3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c @@ -352,16 +352,13 @@ agp_memory *drm_alloc_agp(int pages, u32 type) return NULL; } - if (drm_agp.allocate_memory) { - if ((handle = (*drm_agp.allocate_memory)(pages, - type))) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; - drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated - += pages << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - return handle; - } + if ((handle = drm_agp_allocate_memory(pages, type))) { + spin_lock(&drm_mem_lock); + ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; + drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated + += pages << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + return handle; } spin_lock(&drm_mem_lock); ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count; @@ -381,8 +378,7 @@ int drm_free_agp(agp_memory *handle, int pages) return retval;; } - if (drm_agp.free_memory) { - (*drm_agp.free_memory)(handle); + if (drm_agp_free_memory(handle)) { spin_lock(&drm_mem_lock); free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count; alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; @@ -403,24 +399,19 @@ int drm_bind_agp(agp_memory *handle, unsigned int start) { int retcode = -EINVAL; - DRM_DEBUG("drm_bind_agp called\n"); if (!handle) { DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, "Attempt to bind NULL AGP handle\n"); return retcode; } - DRM_DEBUG("drm_agp.bind_memory : %p\n", drm_agp.bind_memory); - if (drm_agp.bind_memory) { - if (!(retcode = (*drm_agp.bind_memory)(handle, start))) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; - drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated - += handle->page_count << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - DRM_DEBUG("drm_agp.bind_memory: retcode %d\n", retcode); - return retcode; - } + if (!(retcode = drm_agp_bind_memory(handle, start))) { + spin_lock(&drm_mem_lock); + ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; + drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated + += handle->page_count << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + return retcode; } spin_lock(&drm_mem_lock); ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count; @@ -440,20 +431,17 @@ int drm_unbind_agp(agp_memory *handle) return retcode; } - if (drm_agp.unbind_memory) { - int c = handle->page_count; - if ((retcode = (*drm_agp.unbind_memory)(handle))) - return retcode; - spin_lock(&drm_mem_lock); - free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count; - alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; - drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed += c << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - if (free_count > alloc_count) { - DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } + if ((retcode = drm_agp_unbind_memory(handle))) return retcode; + spin_lock(&drm_mem_lock); + free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count; + alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; + drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed + += handle->page_count << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); } return retcode; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c index 00c0ea7f9..05d941b4c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c @@ -420,7 +420,6 @@ int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, sizeof(dma->bufs[0] .freelist.high_mark))) return -EFAULT; - ++count; } } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c index 4aaac6254..883eb75ca 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c @@ -255,8 +255,7 @@ static int mga_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; @@ -338,7 +337,7 @@ static int mga_takedown(drm_device_t *dev) /* mga_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int mga_init(void) +static int __init mga_init(void) { int retcode; drm_device_t *dev = &mga_device; @@ -398,7 +397,7 @@ static int mga_init(void) /* mga_cleanup is called via cleanup_module at module unload time. */ -static void mga_cleanup(void) +static void __exit mga_cleanup(void) { drm_device_t *dev = &mga_device; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c index 7e76441ee..a060749e3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c @@ -11,11 +11,11 @@ * 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 (including the next * paragraph) 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 @@ -23,11 +23,11 @@ * 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. - * + * * Authors: Kevin E. Martin <martin@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com> * Jeff Hartmann <jhartmann@valinux.com> - * + * */ #define __NO_VERSION__ @@ -94,7 +94,7 @@ int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, } atomic_inc(&dev->buf_alloc); spin_unlock(&dev->count_lock); - + down(&dev->struct_sem); entry = &dma->bufs[order]; if (entry->buf_count) { @@ -102,7 +102,7 @@ int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, atomic_dec(&dev->buf_alloc); return -ENOMEM; /* May only call once for each order */ } - + entry->buflist = drm_alloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS); if (!entry->buflist) { @@ -111,7 +111,7 @@ int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, return -ENOMEM; } memset(entry->buflist, 0, count * sizeof(*entry->buflist)); - + entry->buf_size = size; entry->page_order = page_order; offset = 0; @@ -243,16 +243,16 @@ int r128_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, if (dma->flags & _DRM_DMA_USE_AGP) { drm_map_t *map; - map = dev_priv->agp_vertbufs; + map = dev_priv->buffers; if (!map) { retcode = -EINVAL; goto done; } down(¤t->mm->mmap_sem); - virtual = do_mmap(filp, 0, map->size, + virtual = do_mmap(filp, 0, map->size, PROT_READ|PROT_WRITE, - MAP_SHARED, + MAP_SHARED, (unsigned long)map->offset); up(¤t->mm->mmap_sem); } else { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c new file mode 100644 index 000000000..0b1576a90 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c @@ -0,0 +1,1248 @@ +/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- + * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 (including the next + * paragraph) 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#define __NO_VERSION__ +#include "drmP.h" +#include "r128_drv.h" + +#include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> + + +/* FIXME: Temporary CCE packet buffer */ +u32 r128_cce_buffer[(1 << 14)] __attribute__ ((aligned (32))); + +/* CCE microcode (from ATI) */ +static u32 r128_cce_microcode[] = { + 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, + 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, + 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1, + 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11, + 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28, + 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, + 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, + 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, + 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071, + 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2, + 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1, + 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, + 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, + 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, + 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1, + 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82, + 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729, + 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008, + 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, + 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, + 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, + 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0, + 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370, + 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1, + 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793, + 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, + 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, + 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1, + 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1, + 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894, + 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14, + 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1, + 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, + 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, + 409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +#define DO_REMAP(_m) (_m)->handle = drm_ioremap((_m)->offset, (_m)->size) + +#define DO_REMAPFREE(_m) \ + do { \ + if ((_m)->handle && (_m)->size) \ + drm_ioremapfree((_m)->handle, (_m)->size); \ + } while (0) + +#define DO_FIND_MAP(_m, _o) \ + do { \ + int _i; \ + for (_i = 0; _i < dev->map_count; _i++) { \ + if (dev->maplist[_i]->offset == _o) { \ + _m = dev->maplist[_i]; \ + break; \ + } \ + } \ + } while (0) + + +int R128_READ_PLL(drm_device_t *dev, int addr) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + + R128_WRITE8(R128_CLOCK_CNTL_INDEX, addr & 0x1f); + return R128_READ(R128_CLOCK_CNTL_DATA); +} + + +static void r128_status( drm_r128_private_t *dev_priv ) +{ + printk( "GUI_STAT = 0x%08x\n", + (unsigned int)R128_READ( R128_GUI_STAT ) ); + printk( "PM4_STAT = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_STAT ) ); + printk( "PM4_BUFFER_DL_WPTR = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_DL_WPTR ) ); + printk( "PM4_BUFFER_DL_RPTR = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_DL_RPTR ) ); + printk( "PM4_MICRO_CNTL = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_MICRO_CNTL ) ); + printk( "PM4_BUFFER_CNTL = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_CNTL ) ); +} + + +/* ================================================================ + * Engine, FIFO control + */ + +static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) +{ + u32 tmp; + int i; + + tmp = R128_READ( R128_PC_NGUI_CTLSTAT ) | R128_PC_FLUSH_ALL; + R128_WRITE( R128_PC_NGUI_CTLSTAT, tmp ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(R128_READ( R128_PC_NGUI_CTLSTAT ) & R128_PC_BUSY) ) { + return 0; + } + udelay( 1 ); + } + + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); + return -EBUSY; +} + +static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + int slots = R128_READ( R128_GUI_STAT ) & R128_GUI_FIFOCNT_MASK; + if ( slots >= entries ) return 0; + udelay( 1 ); + } + + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); + return -EBUSY; +} + +static int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) +{ + int i, ret; + + ret = r128_do_wait_for_fifo( dev_priv, 64 ); + if ( !ret ) return ret; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { + r128_do_pixcache_flush( dev_priv ); + return 0; + } + udelay( 1 ); + } + + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); + return -EBUSY; +} + + +/* ================================================================ + * CCE control, initialization + */ + +/* Load the microcode for the CCE */ +static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) +{ + int i; + + r128_do_wait_for_idle( dev_priv ); + + R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); + for ( i = 0 ; i < 256 ; i++ ) { + R128_WRITE( R128_PM4_MICROCODE_DATAH, + r128_cce_microcode[i * 2] ); + R128_WRITE( R128_PM4_MICROCODE_DATAL, + r128_cce_microcode[i * 2 + 1] ); + } +} + +/* Flush any pending commands to the CCE. This should only be used just + * prior to a wait for idle, as it informs the engine that the command + * stream is ending. + */ +static void r128_do_cce_flush( drm_r128_private_t *dev_priv ) +{ + u32 tmp; + + tmp = R128_READ( R128_PM4_BUFFER_DL_WPTR ) | R128_PM4_BUFFER_DL_DONE; + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, tmp ); +} + +/* Wait for the CCE to go idle. + */ +static int r128_do_cce_idle( drm_r128_private_t *dev_priv ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( *dev_priv->ring.head == dev_priv->ring.tail ) { + int pm4stat = R128_READ( R128_PM4_STAT ); + if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= + dev_priv->cce_fifo_size ) && + !(pm4stat & (R128_PM4_BUSY | + R128_PM4_GUI_ACTIVE)) ) { + return r128_do_pixcache_flush( dev_priv ); + } + } + udelay( 1 ); + } + +#if 0 + DRM_ERROR( "failed!\n" ); + r128_status( dev_priv ); +#endif + return -EBUSY; +} + +/* Start the Concurrent Command Engine. + */ +static void r128_do_cce_start( drm_r128_private_t *dev_priv ) +{ + r128_do_wait_for_idle( dev_priv ); + + R128_WRITE( R128_PM4_BUFFER_CNTL, + dev_priv->cce_mode | dev_priv->ring.size_l2qw ); + R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ + R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); + + dev_priv->cce_running = 1; +} + +/* Reset the Concurrent Command Engine. This will not flush any pending + * commangs, so you must wait for the CCE command stream to complete + * before calling this routine. + */ +static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) +{ + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); + R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); + *dev_priv->ring.head = 0; + dev_priv->ring.tail = 0; +} + +/* Stop the Concurrent Command Engine. This will not flush any pending + * commangs, so you must flush the command stream and wait for the CCE + * to go idle before calling this routine. + */ +static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) +{ + R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); + R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 ); + + dev_priv->cce_running = 0; +} + +/* Reset the engine. This will stop the CCE if it is running. + */ +static int r128_do_engine_reset( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; + + r128_do_pixcache_flush( dev_priv ); + + clock_cntl_index = R128_READ( R128_CLOCK_CNTL_INDEX ); + mclk_cntl = R128_READ_PLL( dev, R128_MCLK_CNTL ); + + R128_WRITE_PLL( R128_MCLK_CNTL, + mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP ); + + gen_reset_cntl = R128_READ( R128_GEN_RESET_CNTL ); + + /* Taken from the sample code - do not change */ + R128_WRITE( R128_GEN_RESET_CNTL, + gen_reset_cntl | R128_SOFT_RESET_GUI ); + R128_READ( R128_GEN_RESET_CNTL ); + R128_WRITE( R128_GEN_RESET_CNTL, + gen_reset_cntl & ~R128_SOFT_RESET_GUI ); + R128_READ( R128_GEN_RESET_CNTL ); + + R128_WRITE_PLL( R128_MCLK_CNTL, mclk_cntl ); + R128_WRITE( R128_CLOCK_CNTL_INDEX, clock_cntl_index ); + R128_WRITE( R128_GEN_RESET_CNTL, gen_reset_cntl ); + + /* Reset the CCE ring */ + r128_do_cce_reset( dev_priv ); + + /* The CCE is no longer running after an engine reset */ + dev_priv->cce_running = 0; + + /* Reset any pending vertex, indirect buffers */ + r128_freelist_reset( dev ); + + return 0; +} + +static void r128_cce_init_ring_buffer( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + u32 ring_start; + u32 tmp; + + /* The manual (p. 2) says this address is in "VM space". This + * means it's an offset from the start of AGP space. + */ + ring_start = dev_priv->cce_ring->offset - dev->agp->base; + R128_WRITE( R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET ); + + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); + R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); + + /* DL_RPTR_ADDR is a physical address in AGP space. */ + *dev_priv->ring.head = 0; + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + + /* Set watermark control */ + R128_WRITE( R128_PM4_BUFFER_WM_CNTL, + ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) + | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) + | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) + | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT) ); + + /* Force read. Why? Because it's in the examples... */ + R128_READ( R128_PM4_BUFFER_ADDR ); + + /* Turn on bus mastering */ + tmp = R128_READ( R128_BUS_CNTL ) & ~R128_BUS_MASTER_DIS; + R128_WRITE( R128_BUS_CNTL, tmp ); +} + +static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) +{ + drm_r128_private_t *dev_priv; + int i; + + dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); + if ( dev_priv == NULL ) + return -ENOMEM; + dev->dev_private = (void *)dev_priv; + + memset( dev_priv, 0, sizeof(drm_r128_private_t) ); + + dev_priv->is_pci = init->is_pci; + + /* GH: We don't support PCI cards until PCI GART is implemented. + * Fail here so we can remove all checks for PCI cards around + * the CCE ring code. + */ + if ( dev_priv->is_pci ) { + drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } + + dev_priv->usec_timeout = init->usec_timeout; + if ( dev_priv->usec_timeout < 1 || + dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { + drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } + + dev_priv->cce_mode = init->cce_mode; + dev_priv->cce_secure = init->cce_secure; + + /* GH: Simple idle check. + */ + atomic_set( &dev_priv->idle_count, 0 ); + + /* We don't support anything other than bus-mastering ring mode, + * but the ring can be in either AGP or PCI space for the ring + * read pointer. + */ + if ( ( init->cce_mode != R128_PM4_192BM ) && + ( init->cce_mode != R128_PM4_128BM_64INDBM ) && + ( init->cce_mode != R128_PM4_64BM_128INDBM ) && + ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { + drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } + + switch ( init->cce_mode ) { + case R128_PM4_NONPM4: + dev_priv->cce_fifo_size = 0; + break; + case R128_PM4_192PIO: + case R128_PM4_192BM: + dev_priv->cce_fifo_size = 192; + break; + case R128_PM4_128PIO_64INDBM: + case R128_PM4_128BM_64INDBM: + dev_priv->cce_fifo_size = 128; + break; + case R128_PM4_64PIO_128INDBM: + case R128_PM4_64BM_128INDBM: + case R128_PM4_64PIO_64VCBM_64INDBM: + case R128_PM4_64BM_64VCBM_64INDBM: + case R128_PM4_64PIO_64VCPIO_64INDPIO: + dev_priv->cce_fifo_size = 64; + break; + } + + dev_priv->fb_bpp = init->fb_bpp; + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; + + dev_priv->depth_bpp = init->depth_bpp; + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; + dev_priv->span_offset = init->span_offset; + + dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch/8) << 21) | + (dev_priv->front_offset >> 5)); + dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch/8) << 21) | + (dev_priv->back_offset >> 5)); + dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | + (dev_priv->depth_offset >> 5) | + R128_DST_TILE); + dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | + (dev_priv->span_offset >> 5)); + + /* FIXME: We want multiple shared areas, including one shared + * only by the X Server and kernel module. + */ + for ( i = 0 ; i < dev->map_count ; i++ ) { + if ( dev->maplist[i]->type == _DRM_SHM ) { + dev_priv->sarea = dev->maplist[i]; + break; + } + } + + DO_FIND_MAP( dev_priv->fb, init->fb_offset ); + DO_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DO_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); + DO_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + DO_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + + if ( !dev_priv->is_pci ) { + DO_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); + } + + dev_priv->sarea_priv = + (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + DO_REMAP( dev_priv->cce_ring ); + DO_REMAP( dev_priv->ring_rptr ); + DO_REMAP( dev_priv->buffers ); +#if 0 + if ( !dev_priv->is_pci ) { + DO_REMAP( dev_priv->agp_textures ); + } +#endif + + dev_priv->ring.head = ((__volatile__ u32 *) + dev_priv->ring_rptr->handle); + + dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; + dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle + + init->ring_size / sizeof(u32)); + dev_priv->ring.size = init->ring_size; + dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); + + dev_priv->ring.tail_mask = + (dev_priv->ring.size / sizeof(u32)) - 1; + + dev_priv->sarea_priv->last_frame = 0; + R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); + + dev_priv->sarea_priv->last_dispatch = 0; + R128_WRITE( R128_LAST_DISPATCH_REG, + dev_priv->sarea_priv->last_dispatch ); + + r128_cce_init_ring_buffer( dev ); + r128_cce_load_microcode( dev_priv ); + r128_do_engine_reset( dev ); + + return 0; +} + +static int r128_do_cleanup_cce( drm_device_t *dev ) +{ + if ( dev->dev_private ) { + drm_r128_private_t *dev_priv = dev->dev_private; + + DO_REMAPFREE( dev_priv->cce_ring ); + DO_REMAPFREE( dev_priv->ring_rptr ); + DO_REMAPFREE( dev_priv->buffers ); +#if 0 + if ( !dev_priv->is_pci ) { + DO_REMAPFREE( dev_priv->agp_textures ); + } +#endif + + drm_free( dev->dev_private, sizeof(drm_r128_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int r128_cce_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_init_t init; + + if ( copy_from_user( &init, (drm_r128_init_t *)arg, sizeof(init) ) ) + return -EFAULT; + + switch ( init.func ) { + case R128_INIT_CCE: + return r128_do_init_cce( dev, &init ); + case R128_CLEANUP_CCE: + return r128_do_cleanup_cce( dev ); + } + + return -EINVAL; +} + +int r128_cce_start( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { + DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); + return 0; + } + + r128_do_cce_start( dev_priv ); + + return 0; +} + +/* Stop the CCE. The engine must have been idled before calling this + * routine. + */ +int r128_cce_stop( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_cce_stop_t stop; + int ret; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &stop, (drm_r128_init_t *)arg, sizeof(stop) ) ) + return -EFAULT; + + /* Flush any pending CCE commands. This ensures any outstanding + * commands are exectuted by the engine before we turn it off. + */ + if ( stop.flush ) { + r128_do_cce_flush( dev_priv ); + } + + /* If we fail to make the engine go idle, we return an error + * code so that the DRM ioctl wrapper can try again. + */ + if ( stop.idle ) { + ret = r128_do_cce_idle( dev_priv ); + if ( ret < 0 ) return ret; + } + + /* Finally, we can turn off the CCE. If the engine isn't idle, + * we will get some dropped triangles as they won't be fully + * rendered before the CCE is shut down. + */ + r128_do_cce_stop( dev_priv ); + + /* Reset the engine */ + r128_do_engine_reset( dev ); + + return 0; +} + +/* Just reset the CCE ring. Called as part of an X Server engine reset. + */ +int r128_cce_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + if ( !dev_priv ) { + DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); + return -EINVAL; + } + + r128_do_cce_reset( dev_priv ); + + /* The CCE is no longer running after an engine reset */ + dev_priv->cce_running = 0; + + return 0; +} + +int r128_cce_idle( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( dev_priv->cce_running ) { + r128_do_cce_flush( dev_priv ); + } + + return r128_do_cce_idle( dev_priv ); +} + +int r128_engine_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + return r128_do_engine_reset( dev ); +} + + +/* ================================================================ + * Freelist management + */ +#define R128_BUFFER_USED 0xffffffff +#define R128_BUFFER_FREE 0 + +static int r128_freelist_init( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_freelist_t *entry; + int i; + + dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + return -ENOMEM; + + memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) ); + dev_priv->head->age = R128_BUFFER_USED; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + + entry = drm_alloc( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); + if ( !entry ) return -ENOMEM; + + entry->age = R128_BUFFER_FREE; + entry->buf = buf; + entry->prev = dev_priv->head; + entry->next = dev_priv->head->next; + if ( !entry->next ) + dev_priv->tail = entry; + + buf_priv->discard = 0; + buf_priv->dispatched = 0; + buf_priv->list_entry = entry; + + dev_priv->head->next = entry; + + if ( dev_priv->head->next ) + dev_priv->head->next->prev = entry; + } + + return 0; + +} + +drm_buf_t *r128_freelist_get( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv; + drm_buf_t *buf; + int i, t; + + /* FIXME: Optimize -- use freelist code */ + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pid == 0 ) + return buf; + } + + for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { + u32 done_age = R128_READ( R128_LAST_DISPATCH_REG ); + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pending && buf_priv->age <= done_age ) { + /* The buffer has been processed, so it + * can now be used. + */ + buf->pending = 0; + return buf; + } + } + udelay( 1 ); + } + + DRM_ERROR( "returning NULL!\n" ); + return NULL; +} + +void r128_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + drm_buf_t *buf = dma->buflist[i]; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + buf_priv->age = 0; + } +} + + +/* ================================================================ + * CCE packet submission + */ + +int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) +{ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + ring->space = *ring->head - ring->tail; + if ( ring->space <= 0 ) + ring->space += ring->size; + + if ( ring->space >= n ) + return 0; + + udelay( 1 ); + } + + return -EBUSY; +} + +void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ) +{ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; + + ring->space = *ring->head - ring->tail; +#if R128_PERFORMANCE_BOXES + if ( ring->space == 0 ) + atomic_inc( &dev_priv->idle_count ); +#endif + if ( ring->space <= 0 ) + ring->space += ring->size; +} + +static int r128_verify_command( drm_r128_private_t *dev_priv, + u32 cmd, int *size ) +{ + int writing = 1; + + *size = 0; + + switch ( cmd & R128_CCE_PACKET_MASK ) { + case R128_CCE_PACKET0: + if ( (cmd & R128_CCE_PACKET0_REG_MASK) <= (0x1004 >> 2) && + (cmd & R128_CCE_PACKET0_REG_MASK) != + (R128_PM4_VC_FPU_SETUP >> 2) ) { + writing = 0; + } + *size = ((cmd & R128_CCE_PACKET_COUNT_MASK) >> 16) + 2; + break; + + case R128_CCE_PACKET1: + if ( (cmd & R128_CCE_PACKET1_REG0_MASK) <= (0x1004 >> 2) && + (cmd & R128_CCE_PACKET1_REG0_MASK) != + (R128_PM4_VC_FPU_SETUP >> 2) ) { + writing = 0; + } + if ( (cmd & R128_CCE_PACKET1_REG1_MASK) <= (0x1004 << 9) && + (cmd & R128_CCE_PACKET1_REG1_MASK) != + (R128_PM4_VC_FPU_SETUP << 9) ) { + writing = 0; + } + *size = 3; + break; + + case R128_CCE_PACKET2: + break; + + case R128_CCE_PACKET3: + *size = ((cmd & R128_CCE_PACKET_COUNT_MASK) >> 16) + 2; + break; + + } + + return writing; +} + +static int r128_submit_packet_ring_secure( drm_r128_private_t *dev_priv, + u32 *commands, int *count ) +{ +#if 0 + int write = dev_priv->sarea_priv->ring_write; + int *write_ptr = dev_priv->ring_start + write; + int c = *count; + u32 tmp = 0; + int psize = 0; + int writing = 1; + int timeout; + + while ( c > 0 ) { + tmp = *commands++; + if ( !psize ) { + writing = r128_verify_command( dev_priv, tmp, &psize ); + } + psize--; + + if ( writing ) { + write++; + *write_ptr++ = tmp; + } + if ( write >= dev_priv->ring_entries ) { + write = 0; + write_ptr = dev_priv->ring_start; + } + timeout = 0; + while ( write == *dev_priv->ring_read_ptr ) { + R128_READ( R128_PM4_BUFFER_DL_RPTR ); + if ( timeout++ >= dev_priv->usec_timeout ) + return -EBUSY; + udelay( 1 ); + } + c--; + } + + if ( write < 32 ) { + memcpy( dev_priv->ring_end, + dev_priv->ring_start, + write * sizeof(u32) ); + } + + /* Make sure WC cache has been flushed */ + r128_flush_write_combine(); + + dev_priv->sarea_priv->ring_write = write; + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); + + *count = 0; +#endif + return 0; +} + +static int r128_submit_packet_ring_insecure( drm_r128_private_t *dev_priv, + u32 *commands, int *count ) +{ +#if 0 + int write = dev_priv->sarea_priv->ring_write; + int *write_ptr = dev_priv->ring_start + write; + int c = *count; + int timeout; + + while ( c > 0 ) { + write++; + *write_ptr++ = *commands++; + if ( write >= dev_priv->ring_entries ) { + write = 0; + write_ptr = dev_priv->ring_start; + } + + timeout = 0; + while ( write == *dev_priv->ring_read_ptr ) { + R128_READ( R128_PM4_BUFFER_DL_RPTR ); + if ( timeout++ >= dev_priv->usec_timeout ) + return -EBUSY; + udelay( 1 ); + } + c--; + } + + if ( write < 32 ) { + memcpy( dev_priv->ring_end, + dev_priv->ring_start, + write * sizeof(u32) ); + } + + /* Make sure WC cache has been flushed */ + r128_flush_write_combine(); + + dev_priv->sarea_priv->ring_write = write; + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); + + *count = 0; +#endif + return 0; +} + +/* Internal packet submission routine. This uses the insecure versions + * of the packet submission functions, and thus should only be used for + * packets generated inside the kernel module. + */ +int r128_do_submit_packet( drm_r128_private_t *dev_priv, + u32 *buffer, int count ) +{ + int c = count; + int ret = 0; + +#if 0 + int left = 0; + + if ( c >= dev_priv->ring_entries ) { + c = dev_priv->ring_entries - 1; + left = count - c; + } + + /* Since this is only used by the kernel we can use the + * insecure ring buffer submit packet routine. + */ + ret = r128_submit_packet_ring_insecure( dev_priv, buffer, &c ); + c += left; +#endif + + return ( ret < 0 ) ? ret : c; +} + +/* External packet submission routine. This uses the secure versions + * by default, and can thus submit packets received from user space. + */ +int r128_cce_packet( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_packet_t packet; + u32 *buffer; + int c; + int size; + int ret = 0; + +#if 0 + /* GH: Disable packet submission for now. + */ + return -EINVAL; +#endif + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "r128_submit_packet called without lock held\n" ); + return -EINVAL; + } + + if ( copy_from_user( &packet, (drm_r128_packet_t *)arg, + sizeof(packet) ) ) + return -EFAULT; + +#if 0 + c = packet.count; + size = c * sizeof(*buffer); + + { + int left = 0; + + if ( c >= dev_priv->ring_entries ) { + c = dev_priv->ring_entries - 1; + size = c * sizeof(*buffer); + left = packet.count - c; + } + + buffer = kmalloc( size, 0 ); + if ( buffer == NULL) + return -ENOMEM; + if ( copy_from_user( buffer, packet.buffer, size ) ) + return -EFAULT; + + if ( dev_priv->cce_secure ) { + ret = r128_submit_packet_ring_secure( dev_priv, + buffer, &c ); + } else { + ret = r128_submit_packet_ring_insecure( dev_priv, + buffer, &c ); + } + c += left; + } + + kfree( buffer ); +#else + c = 0; +#endif + + packet.count = c; + if ( copy_to_user( (drm_r128_packet_t *)arg, &packet, + sizeof(packet) ) ) + return -EFAULT; + + if ( ret ) { + return ret; + } else if ( c > 0 ) { + return -EAGAIN; + } + return 0; +} + +#if 0 +static int r128_send_vertbufs( drm_device_t *dev, drm_r128_vertex_t *v ) +{ + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv; + drm_buf_t *buf; + int i, ret; + RING_LOCALS; + + /* Make sure we have valid data */ + for (i = 0; i < v->send_count; i++) { + int idx = v->send_indices[i]; + + if (idx < 0 || idx >= dma->buf_count) { + DRM_ERROR("Index %d (of %d max)\n", + idx, dma->buf_count - 1); + return -EINVAL; + } + buf = dma->buflist[idx]; + if (buf->pid != current->pid) { + DRM_ERROR("Process %d using buffer owned by %d\n", + current->pid, buf->pid); + return -EINVAL; + } + if (buf->pending) { + DRM_ERROR("Sending pending buffer:" + " buffer %d, offset %d\n", + v->send_indices[i], i); + return -EINVAL; + } + } + + /* Wait for idle, if we've wrapped to make sure that all pending + buffers have been processed */ + if (dev_priv->submit_age == R128_MAX_VBUF_AGE) { + if ((ret = r128_do_cce_idle(dev)) < 0) return ret; + dev_priv->submit_age = 0; + r128_freelist_reset(dev); + } + + /* Make sure WC cache has been flushed (if in PIO mode) */ + if (!dev_priv->cce_is_bm_mode) r128_flush_write_combine(); + + /* FIXME: Add support for sending vertex buffer to the CCE here + instead of in client code. The v->prim holds the primitive + type that should be drawn. Loop over the list buffers in + send_indices[] and submit a packet for each VB. + + This will require us to loop over the clip rects here as + well, which implies that we extend the kernel driver to allow + cliprects to be stored here. Note that the cliprects could + possibly come from the X server instead of the client, but + this will require additional changes to the DRI to allow for + this optimization. */ + + /* Submit a CCE packet that writes submit_age to R128_VB_AGE_REG */ +#if 0 + cce_buffer[0] = R128CCE0(R128_CCE_PACKET0, R128_VB_AGE_REG, 0); + cce_buffer[1] = dev_priv->submit_age; + + if ((ret = r128_do_submit_packet(dev, cce_buffer, 2)) < 0) { + /* Until we add support for sending VBs to the CCE in + this routine, we can recover from this error. After + we add that support, we won't be able to easily + recover, so we will probably have to implement + another mechanism for handling timeouts from packets + submitted directly by the kernel. */ + return ret; + } +#else + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_VB_AGE_REG, 0 ) ); + OUT_RING( dev_priv->submit_age ); + + ADVANCE_RING(); +#endif + /* Now that the submit packet request has succeeded, we can mark + the buffers as pending */ + for (i = 0; i < v->send_count; i++) { + buf = dma->buflist[v->send_indices[i]]; + buf->pending = 1; + + buf_priv = buf->dev_private; + buf_priv->age = dev_priv->submit_age; + } + + dev_priv->submit_age++; + + return 0; +} +#endif + + + + +static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + int i; + drm_buf_t *buf; + + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = r128_freelist_get( dev ); + if ( !buf ) return -EAGAIN; + + buf->pid = current->pid; + + if ( copy_to_user( &d->request_indices[i], &buf->idx, + sizeof(buf->idx) ) ) + return -EFAULT; + if ( copy_to_user( &d->request_sizes[i], &buf->total, + sizeof(buf->total) ) ) + return -EFAULT; + + d->granted_count++; + } + return 0; +} + +int r128_cce_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + int ret = 0; + drm_dma_t d; + + if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) ) + return -EFAULT; + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + current->pid, d.send_count ); + return -EINVAL; + } + + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + current->pid, d.request_count, dma->buf_count ); + return -EINVAL; + } + + d.granted_count = 0; + + if ( d.request_count ) { + ret = r128_cce_get_buffers( dev, &d ); + } + + if ( copy_to_user( (drm_dma_t *) arg, &d, sizeof(d) ) ) + return -EFAULT; + + return ret; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c index 9cadadbaf..0741e7745 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c @@ -11,11 +11,11 @@ * 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 (including the next * paragraph) 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 @@ -23,7 +23,7 @@ * 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. - * + * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -53,21 +53,21 @@ int r128_context_switch(drm_device_t *dev, int old, int new) #if DRM_DMA_HISTOGRAM dev->ctx_start = get_cycles(); #endif - + DRM_DEBUG("Context switch from %d to %d\n", old, new); if (new == dev->last_context) { clear_bit(0, &dev->context_flag); return 0; } - + if (drm_flags & DRM_FLAG_NOCTX) { r128_context_switch_complete(dev, new); } else { sprintf(buf, "C %d %d\n", old, new); drm_write_string(dev, buf); } - + return 0; } @@ -75,7 +75,7 @@ int r128_context_switch_complete(drm_device_t *dev, int new) { dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ dev->last_switch = jiffies; - + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("Lock isn't held after context switch\n"); } @@ -86,11 +86,11 @@ int r128_context_switch_complete(drm_device_t *dev, int new) #if DRM_DMA_HISTOGRAM atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - dev->ctx_start)]); - + #endif clear_bit(0, &dev->context_flag); wake_up(&dev->context_wait); - + return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h index 8a0cd1967..b81d2fca2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h @@ -11,11 +11,11 @@ * 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 (including the next * paragraph) 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 @@ -24,7 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Kevin E. Martin <martin@valinux.com> + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -32,80 +34,241 @@ #define _R128_DRM_H_ /* WARNING: If you change any of these defines, make sure to change the + * defines in the X server file (r128_sarea.h) + */ +#ifndef __R128_SAREA_DEFINES__ +#define __R128_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define R128_UPLOAD_CONTEXT 0x001 +#define R128_UPLOAD_SETUP 0x002 +#define R128_UPLOAD_TEX0 0x004 +#define R128_UPLOAD_TEX1 0x008 +#define R128_UPLOAD_TEX0IMAGES 0x010 +#define R128_UPLOAD_TEX1IMAGES 0x020 +#define R128_UPLOAD_CORE 0x040 +#define R128_UPLOAD_MASKS 0x080 +#define R128_UPLOAD_WINDOW 0x100 +#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ +#define R128_REQUIRE_QUIESCENCE 0x400 +#define R128_UPLOAD_ALL 0x7ff + +#define R128_FRONT 0x1 +#define R128_BACK 0x2 +#define R128_DEPTH 0x4 + +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#if 1 +#define R128_BUFFER_SIZE 16384 +#else +#define R128_BUFFER_SIZE (128 * 1024) +#endif + +/* Byte offsets for indirect buffer data + */ +#define R128_INDEX_PRIM_OFFSET 20 +#define R128_HOSTDATA_BLIT_OFFSET 32 + +/* 2048x2048 @ 32bpp texture requires this many indirect buffers + */ +#define R128_MAX_BLIT_BUFFERS ((2048 * 2048 * 4) / R128_BUFFER_SIZE) + +/* Keep these small for testing. + */ +#define R128_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define R128_LOCAL_TEX_HEAP 0 +#define R128_AGP_TEX_HEAP 1 +#define R128_NR_TEX_HEAPS 2 +#define R128_NR_TEX_REGIONS 64 +#define R128_LOG_TEX_GRANULARITY 16 + +#define R128_NR_CONTEXT_REGS 12 +#define R128_TEX_MAXLEVELS 11 + +#endif /* __R128_SAREA_DEFINES__ */ + +typedef struct { + /* Context state - can be written in one large chunk */ + unsigned int dst_pitch_offset_c; + unsigned int dp_gui_master_cntl_c; + unsigned int sc_top_left_c; + unsigned int sc_bottom_right_c; + unsigned int z_offset_c; + unsigned int z_pitch_c; + unsigned int z_sten_cntl_c; + unsigned int tex_cntl_c; + unsigned int misc_3d_state_cntl_reg; + unsigned int texture_clr_cmp_clr_c; + unsigned int texture_clr_cmp_msk_c; + unsigned int fog_color_c; + + /* Texture state */ + unsigned int tex_size_pitch_c; + unsigned int constant_color_c; + + /* Setup state */ + unsigned int pm4_vc_fpu_setup; + unsigned int setup_cntl; + + /* Mask state */ + unsigned int dp_write_mask; + unsigned int sten_ref_mask_c; + unsigned int plane_3d_mask_c; + + /* Window state */ + unsigned int window_xy_offset; + + /* Core state */ + unsigned int scale_3d_cntl; +} drm_r128_context_regs_t; + +/* Setup registers for each texture unit */ +typedef struct { + unsigned int tex_cntl; + unsigned int tex_combine_cntl; + unsigned int tex_size_pitch; + unsigned int tex_offset[R128_TEX_MAXLEVELS]; + unsigned int tex_border_color; +} drm_r128_texture_regs_t; + + +typedef struct drm_tex_region { + unsigned char next, prev; + unsigned char in_use; + int age; +} drm_tex_region_t; + +typedef struct drm_r128_sarea { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + drm_r128_context_regs_t context_state; + drm_r128_texture_regs_t tex_state[R128_NR_TEX_HEAPS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + + drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; + int tex_age[R128_NR_TEX_HEAPS]; + int ctx_owner; +} drm_r128_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmR128.h) */ typedef struct drm_r128_init { - enum { + enum { R128_INIT_CCE = 0x01, R128_CLEANUP_CCE = 0x02 } func; int sarea_priv_offset; int is_pci; int cce_mode; - int cce_fifo_size; int cce_secure; int ring_size; int usec_timeout; - int fb_offset; - int agp_ring_offset; - int agp_read_ptr_offset; - int agp_vertbufs_offset; - int agp_indbufs_offset; - int agp_textures_offset; - int mmio_offset; + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + + unsigned int fb_offset; + unsigned int mmio_offset; + unsigned int ring_offset; + unsigned int ring_rptr_offset; + unsigned int buffers_offset; + unsigned int agp_textures_offset; } drm_r128_init_t; -typedef struct drm_r128_packet { - void *buffer; - int count; - int flags; -} drm_r128_packet_t; +typedef struct drm_r128_cce_stop { + int flush; + int idle; +} drm_r128_cce_stop_t; -typedef enum drm_r128_prim { - _DRM_R128_PRIM_NONE = 0x0001, - _DRM_R128_PRIM_POINT = 0x0002, - _DRM_R128_PRIM_LINE = 0x0004, - _DRM_R128_PRIM_POLY_LINE = 0x0008, - _DRM_R128_PRIM_TRI_LIST = 0x0010, - _DRM_R128_PRIM_TRI_FAN = 0x0020, - _DRM_R128_PRIM_TRI_STRIP = 0x0040, - _DRM_R128_PRIM_TRI_TYPE2 = 0x0080 -} drm_r128_prim_t; +typedef struct drm_r128_clear { + unsigned int flags; + int x, y, w, h; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drm_r128_clear_t; typedef struct drm_r128_vertex { - /* Indices here refer to the offset into - buflist in drm_buf_get_t. */ - int send_count; /* Number of buffers to send */ - int *send_indices; /* List of handles to buffers */ - int *send_sizes; /* Lengths of data to send */ - drm_r128_prim_t prim; /* Primitive type */ - int request_count; /* Number of buffers requested */ - int *request_indices; /* Buffer information */ - int *request_sizes; - int granted_count; /* Number of buffers granted */ + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ } drm_r128_vertex_t; -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (r128_sarea.h) - */ -#define R128_LOCAL_TEX_HEAP 0 -#define R128_AGP_TEX_HEAP 1 -#define R128_NR_TEX_HEAPS 2 -#define R128_NR_TEX_REGIONS 64 -#define R128_LOG_TEX_GRANULARITY 16 +typedef struct drm_r128_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_r128_indices_t; -typedef struct drm_tex_region { - unsigned char next, prev; - unsigned char in_use; - int age; -} drm_tex_region_t; +typedef struct drm_r128_blit { + int idx; + int pitch; + int offset; + int format; + unsigned short x, y; + unsigned short width, height; +} drm_r128_blit_t; -typedef struct drm_r128_sarea { - drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; - int tex_age[R128_NR_TEX_HEAPS]; - int ctx_owner; - int ring_write; -} drm_r128_sarea_t; +typedef struct drm_r128_depth { + enum { + R128_WRITE_SPAN = 0x01, + R128_WRITE_PIXELS = 0x02, + R128_READ_SPAN = 0x03, + R128_READ_PIXELS = 0x04 + } func; + int n; + int *x; + int *y; + unsigned int *buffer; + unsigned char *mask; +} drm_r128_depth_t; + +typedef struct drm_r128_stipple { + unsigned int *mask; +} drm_r128_stipple_t; + +typedef struct drm_r128_packet { + unsigned int *buffer; + int count; + int flags; +} drm_r128_packet_t; #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c index 7ae498014..89b68696e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c @@ -24,8 +24,10 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ @@ -33,15 +35,15 @@ #include "drmP.h" #include "r128_drv.h" -#define R128_NAME "r128" -#define R128_DESC "ATI Rage 128" -#define R128_DATE "20000928" -#define R128_MAJOR 1 -#define R128_MINOR 0 -#define R128_PATCHLEVEL 0 +#define R128_NAME "r128" +#define R128_DESC "ATI Rage 128" +#define R128_DATE "20001201" +#define R128_MAJOR 2 +#define R128_MINOR 1 +#define R128_PATCHLEVEL 0 -static drm_device_t r128_device; -drm_ctx_t r128_res_ctx; +static drm_device_t r128_device; +drm_ctx_t r128_res_ctx; static struct file_operations r128_fops = { #if LINUX_VERSION_CODE >= 0x020400 @@ -65,52 +67,61 @@ static struct miscdevice r128_misc = { }; static drm_ioctl_desc_t r128_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { r128_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { r128_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { r128_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { r128_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { r128_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { r128_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { r128_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { r128_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { r128_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { r128_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { r128_version, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { r128_addbufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { r128_mapbufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { r128_addctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { r128_rmctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { r128_modctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { r128_getctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { r128_switchctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { r128_newctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { r128_resctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, #endif - [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_init_cce, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_eng_reset, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_FLUSH)] = { r128_eng_flush, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_PACKET)] = { r128_submit_pkt, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_IDLE)] = { r128_cce_idle, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_vertex_buf, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_PACKET)] = { r128_cce_packet, 1, 0 }, }; #define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) @@ -252,8 +263,7 @@ static int r128_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; @@ -323,7 +333,7 @@ static int r128_takedown(drm_device_t *dev) /* r128_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int r128_init(void) +static int __init r128_init(void) { int retcode; drm_device_t *dev = &r128_device; @@ -350,12 +360,12 @@ static int r128_init(void) #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) dev->agp = drm_agp_init(); - if (dev->agp == NULL) { - DRM_ERROR("Cannot initialize agpgart module.\n"); - drm_proc_cleanup(); - misc_deregister(&r128_misc); - r128_takedown(dev); - return -ENOMEM; + if (dev->agp == NULL) { + DRM_ERROR("Cannot initialize agpgart module.\n"); + drm_proc_cleanup(); + misc_deregister(&r128_misc); + r128_takedown(dev); + return -ENOMEM; } #ifdef CONFIG_MTRR @@ -387,7 +397,7 @@ static int r128_init(void) /* r128_cleanup is called via cleanup_module at module unload time. */ -static void r128_cleanup(void) +static void __exit r128_cleanup(void) { drm_device_t *dev = &r128_device; @@ -414,8 +424,8 @@ module_init(r128_init); module_exit(r128_cleanup); -int r128_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_version(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_version_t version; int len; @@ -425,13 +435,13 @@ int r128_version(struct inode *inode, struct file *filp, unsigned int cmd, sizeof(version))) return -EFAULT; -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ +#define DRM_COPY(name,value) \ + len = strlen(value); \ + if (len > name##_len) len = name##_len; \ + name##_len = strlen(value); \ + if (len && name) { \ + if (copy_to_user(name, value, len)) \ + return -EFAULT; \ } version.version_major = R128_MAJOR; @@ -507,9 +517,8 @@ int r128_release(struct inode *inode, struct file *filp) } /* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { int nr = DRM_IOCTL_NR(cmd); drm_file_t *priv = filp->private_data; @@ -535,19 +544,25 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, DRM_DEBUG("no function\n"); retcode = -EINVAL; } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { + || (ioctl->auth_needed && !priv->authenticated)) { retcode = -EACCES; } else { retcode = (func)(inode, filp, cmd, arg); } } +#if 0 + if ( retcode ) { + DRM_INFO( "%s 0x%x ret = %d\n", __FUNCTION__, nr, retcode ); + } +#endif + atomic_dec(&dev->ioctl_count); return retcode; } -int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_lock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; @@ -573,33 +588,10 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, lock.context, current->pid, dev->lock.hw_lock->lock, lock.flags); -#if 0 - /* dev->queue_count == 0 right now for - r128. FIXME? */ - if (lock.context < 0 || lock.context >= dev->queue_count) + if (lock.context < 0) return -EINVAL; -#endif if (!ret) { -#if 0 - if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) - != lock.context) { - long j = jiffies - dev->lock.lock_time; - - if (lock.context == r128_res_ctx.handle && - j >= 0 && j < DRM_LOCK_SLICE) { - /* Can't take lock if we just had it and - there is contention. */ - DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", - lock.context, current->pid, j, - dev->lock.lock_time, jiffies); - current->state = TASK_INTERRUPTIBLE; - current->policy |= SCHED_YIELD; - schedule_timeout(DRM_LOCK_SLICE-j); - DRM_DEBUG("jiffies=%d\n", jiffies); - } - } -#endif add_wait_queue(&dev->lock.lock_queue, &entry); for (;;) { current->state = TASK_INTERRUPTIBLE; @@ -618,9 +610,6 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, /* Contention */ atomic_inc(&dev->total_sleeps); -#if 1 - current->policy |= SCHED_YIELD; -#endif schedule(); if (signal_pending(current)) { ret = -ERESTARTSYS; @@ -631,32 +620,6 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, remove_wait_queue(&dev->lock.lock_queue, &entry); } -#if 0 - if (!ret && dev->last_context != lock.context && - lock.context != r128_res_ctx.handle && - dev->last_context != r128_res_ctx.handle) { - add_wait_queue(&dev->context_wait, &entry); - current->state = TASK_INTERRUPTIBLE; - /* PRE: dev->last_context != lock.context */ - r128_context_switch(dev, dev->last_context, lock.context); - /* POST: we will wait for the context - switch and will dispatch on a later call - when dev->last_context == lock.context - NOTE WE HOLD THE LOCK THROUGHOUT THIS - TIME! */ - current->policy |= SCHED_YIELD; - schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(&dev->context_wait, &entry); - if (signal_pending(current)) { - ret = -EINTR; - } else if (dev->last_context != lock.context) { - DRM_ERROR("Context mismatch: %d %d\n", - dev->last_context, lock.context); - } - } -#endif - if (!ret) { sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); @@ -671,6 +634,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, } if (lock.flags & _DRM_LOCK_QUIESCENT) { /* Make hardware quiescent */ + DRM_DEBUG( "not quiescent!\n" ); #if 0 r128_quiescent(dev); #endif @@ -693,8 +657,8 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, } -int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_unlock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h index da2f676d3..cffd08002 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h @@ -24,75 +24,136 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> * */ -#ifndef _R128_DRV_H_ -#define _R128_DRV_H_ +#ifndef __R128_DRV_H__ +#define __R128_DRV_H__ -typedef struct drm_r128_private { - int is_pci; - - int cce_mode; - int cce_fifo_size; - int cce_is_bm_mode; - int cce_secure; - - drm_r128_sarea_t *sarea_priv; - - __volatile__ u32 *ring_read_ptr; +typedef struct drm_r128_freelist { + unsigned int age; + drm_buf_t *buf; + struct drm_r128_freelist *next; + struct drm_r128_freelist *prev; +} drm_r128_freelist_t; - u32 *ring_start; - u32 *ring_end; - int ring_size; - int ring_sizel2qw; - int ring_entries; +typedef struct drm_r128_ring_buffer { + u32 *start; + u32 *end; + int size; + int size_l2qw; - int submit_age; + volatile u32 *head; + u32 tail; + u32 tail_mask; + int space; +} drm_r128_ring_buffer_t; - int usec_timeout; +typedef struct drm_r128_private { + drm_r128_ring_buffer_t ring; + drm_r128_sarea_t *sarea_priv; - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *agp_ring; - drm_map_t *agp_read_ptr; - drm_map_t *agp_vertbufs; - drm_map_t *agp_indbufs; - drm_map_t *agp_textures; - drm_map_t *mmio; + int cce_mode; + int cce_fifo_size; + int cce_secure; + int cce_running; + + drm_r128_freelist_t *head; + drm_r128_freelist_t *tail; + + int usec_timeout; + int is_pci; + + atomic_t idle_count; + + unsigned int fb_bpp; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + unsigned int depth_bpp; + unsigned int depth_offset; + unsigned int depth_pitch; + unsigned int span_offset; + + u32 front_pitch_offset_c; + u32 back_pitch_offset_c; + u32 depth_pitch_offset_c; + u32 span_pitch_offset_c; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *cce_ring; + drm_map_t *ring_rptr; + drm_map_t *buffers; + drm_map_t *agp_textures; } drm_r128_private_t; typedef struct drm_r128_buf_priv { - u32 age; + u32 age; + int prim; + int discard; + int dispatched; + drm_r128_freelist_t *list_entry; } drm_r128_buf_priv_t; /* r128_drv.c */ -extern int r128_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_open(struct inode *inode, struct file *filp); -extern int r128_release(struct inode *inode, struct file *filp); -extern int r128_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - /* r128_dma.c */ -extern int r128_init_cce(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_eng_reset(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_eng_flush(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_submit_pkt(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_cce_idle(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_vertex_buf(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +extern int r128_version( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_open( struct inode *inode, struct file *filp ); +extern int r128_release( struct inode *inode, struct file *filp ); +extern int r128_ioctl( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_lock( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_unlock( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + + /* r128_cce.c */ +extern int r128_cce_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_start( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_stop( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_idle( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_engine_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_packet( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern void r128_freelist_reset( drm_device_t *dev ); +extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); + +extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); +extern void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ); + + /* r128_state.c */ +extern int r128_cce_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_blit( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_depth( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int r128_cce_stipple( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); /* r128_bufs.c */ extern int r128_addbufs(struct inode *inode, struct file *filp, @@ -124,80 +185,207 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new); * for Rage 128 kernel driver. */ -#define R128_PC_NGUI_CTLSTAT 0x0184 -# define R128_PC_FLUSH_ALL 0x00ff -# define R128_PC_BUSY (1 << 31) - -#define R128_CLOCK_CNTL_INDEX 0x0008 -#define R128_CLOCK_CNTL_DATA 0x000c -# define R128_PLL_WR_EN (1 << 7) - -#define R128_MCLK_CNTL 0x000f -# define R128_FORCE_GCP (1 << 16) -# define R128_FORCE_PIPE3D_CP (1 << 17) -# define R128_FORCE_RCP (1 << 18) - -#define R128_GEN_RESET_CNTL 0x00f0 -# define R128_SOFT_RESET_GUI (1 << 0) - -#define R128_PM4_BUFFER_CNTL 0x0704 -# define R128_PM4_NONPM4 (0 << 28) -# define R128_PM4_192PIO (1 << 28) -# define R128_PM4_192BM (2 << 28) -# define R128_PM4_128PIO_64INDBM (3 << 28) -# define R128_PM4_128BM_64INDBM (4 << 28) -# define R128_PM4_64PIO_128INDBM (5 << 28) -# define R128_PM4_64BM_128INDBM (6 << 28) -# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) - - -#define R128_PM4_BUFFER_DL_RPTR 0x0710 -#define R128_PM4_BUFFER_DL_WPTR 0x0714 -# define R128_PM4_BUFFER_DL_DONE (1 << 31) - -#define R128_PM4_VC_FPU_SETUP 0x071c - -#define R128_PM4_STAT 0x07b8 -# define R128_PM4_FIFOCNT_MASK 0x0fff -# define R128_PM4_BUSY (1 << 16) -# define R128_PM4_GUI_ACTIVE (1 << 31) - -#define R128_PM4_BUFFER_ADDR 0x07f0 -#define R128_PM4_MICRO_CNTL 0x07fc -# define R128_PM4_MICRO_FREERUN (1 << 30) - -#define R128_PM4_FIFO_DATA_EVEN 0x1000 -#define R128_PM4_FIFO_DATA_ODD 0x1004 - -#define R128_GUI_SCRATCH_REG0 0x15e0 -#define R128_GUI_SCRATCH_REG1 0x15e4 -#define R128_GUI_SCRATCH_REG2 0x15e8 -#define R128_GUI_SCRATCH_REG3 0x15ec -#define R128_GUI_SCRATCH_REG4 0x15f0 -#define R128_GUI_SCRATCH_REG5 0x15f4 - -#define R128_GUI_STAT 0x1740 -# define R128_GUI_FIFOCNT_MASK 0x0fff -# define R128_GUI_ACTIVE (1 << 31) - +#define R128_AUX_SC_CNTL 0x1660 +# define R128_AUX1_SC_EN (1 << 0) +# define R128_AUX1_SC_MODE_OR (0 << 1) +# define R128_AUX1_SC_MODE_NAND (1 << 1) +# define R128_AUX2_SC_EN (1 << 2) +# define R128_AUX2_SC_MODE_OR (0 << 3) +# define R128_AUX2_SC_MODE_NAND (1 << 3) +# define R128_AUX3_SC_EN (1 << 4) +# define R128_AUX3_SC_MODE_OR (0 << 5) +# define R128_AUX3_SC_MODE_NAND (1 << 5) +#define R128_AUX1_SC_LEFT 0x1664 +#define R128_AUX1_SC_RIGHT 0x1668 +#define R128_AUX1_SC_TOP 0x166c +#define R128_AUX1_SC_BOTTOM 0x1670 +#define R128_AUX2_SC_LEFT 0x1674 +#define R128_AUX2_SC_RIGHT 0x1678 +#define R128_AUX2_SC_TOP 0x167c +#define R128_AUX2_SC_BOTTOM 0x1680 +#define R128_AUX3_SC_LEFT 0x1684 +#define R128_AUX3_SC_RIGHT 0x1688 +#define R128_AUX3_SC_TOP 0x168c +#define R128_AUX3_SC_BOTTOM 0x1690 + +#define R128_BRUSH_DATA0 0x1480 +#define R128_BUS_CNTL 0x0030 +# define R128_BUS_MASTER_DIS (1 << 6) + +#define R128_CLOCK_CNTL_INDEX 0x0008 +#define R128_CLOCK_CNTL_DATA 0x000c +# define R128_PLL_WR_EN (1 << 7) + +#define R128_CONSTANT_COLOR_C 0x1d34 + +#define R128_DP_GUI_MASTER_CNTL 0x146c +# define R128_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define R128_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define R128_GMC_BRUSH_NONE (15 << 4) +# define R128_GMC_DST_16BPP (4 << 8) +# define R128_GMC_DST_24BPP (5 << 8) +# define R128_GMC_DST_32BPP (6 << 8) +# define R128_GMC_DST_DATATYPE_SHIFT 8 +# define R128_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define R128_DP_SRC_SOURCE_MEMORY (2 << 24) +# define R128_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define R128_GMC_AUX_CLIP_DIS (1 << 29) +# define R128_GMC_WR_MSK_DIS (1 << 30) +# define R128_ROP3_S 0x00cc0000 +# define R128_ROP3_P 0x00f00000 +#define R128_DP_WRITE_MASK 0x16cc +#define R128_DST_PITCH_OFFSET_C 0x1c80 +# define R128_DST_TILE (1 << 31) + +#define R128_GEN_RESET_CNTL 0x00f0 +# define R128_SOFT_RESET_GUI (1 << 0) + +#define R128_GUI_SCRATCH_REG0 0x15e0 +#define R128_GUI_SCRATCH_REG1 0x15e4 +#define R128_GUI_SCRATCH_REG2 0x15e8 +#define R128_GUI_SCRATCH_REG3 0x15ec +#define R128_GUI_SCRATCH_REG4 0x15f0 +#define R128_GUI_SCRATCH_REG5 0x15f4 + +#define R128_GUI_STAT 0x1740 +# define R128_GUI_FIFOCNT_MASK 0x0fff +# define R128_GUI_ACTIVE (1 << 31) + +#define R128_MCLK_CNTL 0x000f +# define R128_FORCE_GCP (1 << 16) +# define R128_FORCE_PIPE3D_CP (1 << 17) +# define R128_FORCE_RCP (1 << 18) + +#define R128_PC_GUI_CTLSTAT 0x1748 +#define R128_PC_NGUI_CTLSTAT 0x0184 +# define R128_PC_FLUSH_GUI (3 << 0) +# define R128_PC_RI_GUI (1 << 2) +# define R128_PC_FLUSH_ALL 0x00ff +# define R128_PC_BUSY (1 << 31) + +#define R128_PRIM_TEX_CNTL_C 0x1cb0 + +#define R128_SCALE_3D_CNTL 0x1a00 +#define R128_SEC_TEX_CNTL_C 0x1d00 +#define R128_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c +#define R128_SETUP_CNTL 0x1bc4 +#define R128_STEN_REF_MASK_C 0x1d40 + +#define R128_TEX_CNTL_C 0x1c9c +# define R128_TEX_CACHE_FLUSH (1 << 23) + +#define R128_WINDOW_XY_OFFSET 0x1bcc + + +/* CCE registers + */ +#define R128_PM4_BUFFER_OFFSET 0x0700 +#define R128_PM4_BUFFER_CNTL 0x0704 +# define R128_PM4_MASK (15 << 28) +# define R128_PM4_NONPM4 (0 << 28) +# define R128_PM4_192PIO (1 << 28) +# define R128_PM4_192BM (2 << 28) +# define R128_PM4_128PIO_64INDBM (3 << 28) +# define R128_PM4_128BM_64INDBM (4 << 28) +# define R128_PM4_64PIO_128INDBM (5 << 28) +# define R128_PM4_64BM_128INDBM (6 << 28) +# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) + +#define R128_PM4_BUFFER_WM_CNTL 0x0708 +# define R128_WMA_SHIFT 0 +# define R128_WMB_SHIFT 8 +# define R128_WMC_SHIFT 16 +# define R128_WB_WM_SHIFT 24 + +#define R128_PM4_BUFFER_DL_RPTR_ADDR 0x070c +#define R128_PM4_BUFFER_DL_RPTR 0x0710 +#define R128_PM4_BUFFER_DL_WPTR 0x0714 +# define R128_PM4_BUFFER_DL_DONE (1 << 31) + +#define R128_PM4_VC_FPU_SETUP 0x071c + +#define R128_PM4_IW_INDOFF 0x0738 +#define R128_PM4_IW_INDSIZE 0x073c + +#define R128_PM4_STAT 0x07b8 +# define R128_PM4_FIFOCNT_MASK 0x0fff +# define R128_PM4_BUSY (1 << 16) +# define R128_PM4_GUI_ACTIVE (1 << 31) + +#define R128_PM4_MICROCODE_ADDR 0x07d4 +#define R128_PM4_MICROCODE_RADDR 0x07d8 +#define R128_PM4_MICROCODE_DATAH 0x07dc +#define R128_PM4_MICROCODE_DATAL 0x07e0 + +#define R128_PM4_BUFFER_ADDR 0x07f0 +#define R128_PM4_MICRO_CNTL 0x07fc +# define R128_PM4_MICRO_FREERUN (1 << 30) + +#define R128_PM4_FIFO_DATA_EVEN 0x1000 +#define R128_PM4_FIFO_DATA_ODD 0x1004 + + +/* CCE command packets + */ +#define R128_CCE_PACKET0 0x00000000 +#define R128_CCE_PACKET1 0x40000000 +#define R128_CCE_PACKET2 0x80000000 +#define R128_CCE_PACKET3 0xC0000000 +# define R128_CNTL_HOSTDATA_BLT 0x00009400 +# define R128_CNTL_PAINT_MULTI 0x00009A00 +# define R128_CNTL_BITBLT_MULTI 0x00009B00 +# define R128_3D_RNDR_GEN_INDX_PRIM 0x00002300 + +#define R128_CCE_PACKET_MASK 0xC0000000 +#define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 +#define R128_CCE_PACKET0_REG_MASK 0x000007ff +#define R128_CCE_PACKET1_REG0_MASK 0x000007ff +#define R128_CCE_PACKET1_REG1_MASK 0x003ff800 + +#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 +#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 +#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 +#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 +#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 +#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 +#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 +#define R128_CCE_VC_CNTL_NUM_SHIFT 16 + +#define R128_DATATYPE_CI8 2 +#define R128_DATATYPE_ARGB1555 3 +#define R128_DATATYPE_RGB565 4 +#define R128_DATATYPE_RGB888 5 +#define R128_DATATYPE_ARGB8888 6 +#define R128_DATATYPE_RGB332 7 +#define R128_DATATYPE_RGB8 9 +#define R128_DATATYPE_ARGB4444 15 + +/* Constants */ +#define R128_AGP_OFFSET 0x02000000 + +#define R128_WATERMARK_L 16 +#define R128_WATERMARK_M 8 +#define R128_WATERMARK_N 8 +#define R128_WATERMARK_K 128 -/* CCE command packets */ -#define R128_CCE_PACKET0 0x00000000 -#define R128_CCE_PACKET1 0x40000000 -#define R128_CCE_PACKET2 0x80000000 -# define R128_CCE_PACKET_MASK 0xC0000000 -# define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 -# define R128_CCE_PACKET0_REG_MASK 0x000007ff -# define R128_CCE_PACKET1_REG0_MASK 0x000007ff -# define R128_CCE_PACKET1_REG1_MASK 0x003ff800 +#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ +#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 +#define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 +#define R128_MAX_VB_AGE 0xffffffff -#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ +#define R128_MAX_VB_VERTS (0xffff) -#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) +#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle)) #define R128_ADDR(reg) (R128_BASE(reg) + reg) #define R128_DEREF(reg) *(__volatile__ int *)R128_ADDR(reg) @@ -221,4 +409,58 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr); #define R128CCE2(p) ((p)) #define R128CCE3(p,n) ((p) | ((n) << 16)) -#endif + + + +#define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \ + ((n) << 16) | ((reg) >> 2)) +#define CCE_PACKET1( reg0, reg1 ) (R128_CCE_PACKET1 | \ + (((reg1) >> 2) << 11) | ((reg0) >> 2)) +#define CCE_PACKET2() (R128_CCE_PACKET2) +#define CCE_PACKET3( pkt, n ) (R128_CCE_PACKET3 | \ + (pkt) | ((n) << 16)) + + +#define r128_flush_write_combine() mb() + + +#define R128_VERBOSE 0 + +#define RING_LOCALS int write; unsigned int tail_mask; volatile u32 *ring; + +#define BEGIN_RING( n ) do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ + n, __FUNCTION__ ); \ + } \ + if ( dev_priv->ring.space < n * sizeof(u32) ) { \ + r128_wait_ring( dev_priv, n * sizeof(u32) ); \ + } \ + dev_priv->ring.space -= n * sizeof(u32); \ + ring = dev_priv->ring.start; \ + write = dev_priv->ring.tail; \ + tail_mask = dev_priv->ring.tail_mask; \ +} while (0) + +#define ADVANCE_RING() do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( "ADVANCE_RING() tail=0x%06x wr=0x%06x\n", \ + write, dev_priv->ring.tail ); \ + } \ + r128_flush_write_combine(); \ + dev_priv->ring.tail = write; \ + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ +} while (0) + +#define OUT_RING( x ) do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ + (unsigned int)(x), write ); \ + } \ + ring[write++] = x; \ + write &= tail_mask; \ +} while (0) + +#define R128_PERFORMANCE_BOXES 0 + +#endif /* __R128_DRV_H__ */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c new file mode 100644 index 000000000..faad25a2d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c @@ -0,0 +1,1630 @@ +/* r128_state.c -- State support for r128 -*- linux-c -*- + * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 (including the next + * paragraph) 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#define __NO_VERSION__ +#include "drmP.h" +#include "r128_drv.h" +#include "drm.h" + + +/* ================================================================ + * CCE hardware state programming functions + */ + +static void r128_emit_clip_rects( drm_r128_private_t *dev_priv, + drm_clip_rect_t *boxes, int count ) +{ + u32 aux_sc_cntl = 0x00000000; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 17 ); + + if ( count >= 1 ) { + OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) ); + OUT_RING( boxes[0].x1 ); + OUT_RING( boxes[0].x2 - 1 ); + OUT_RING( boxes[0].y1 ); + OUT_RING( boxes[0].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX1_SC_EN | R128_AUX1_SC_MODE_OR); + } + if ( count >= 2 ) { + OUT_RING( CCE_PACKET0( R128_AUX2_SC_LEFT, 3 ) ); + OUT_RING( boxes[1].x1 ); + OUT_RING( boxes[1].x2 - 1 ); + OUT_RING( boxes[1].y1 ); + OUT_RING( boxes[1].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX2_SC_EN | R128_AUX2_SC_MODE_OR); + } + if ( count >= 3 ) { + OUT_RING( CCE_PACKET0( R128_AUX3_SC_LEFT, 3 ) ); + OUT_RING( boxes[2].x1 ); + OUT_RING( boxes[2].x2 - 1 ); + OUT_RING( boxes[2].y1 ); + OUT_RING( boxes[2].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX3_SC_EN | R128_AUX3_SC_MODE_OR); + } + + OUT_RING( CCE_PACKET0( R128_AUX_SC_CNTL, 0 ) ); + OUT_RING( aux_sc_cntl ); + + ADVANCE_RING(); +} + +static inline void r128_emit_core( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_SCALE_3D_CNTL, 0 ) ); + OUT_RING( ctx->scale_3d_cntl ); + + ADVANCE_RING(); +} + +static inline void r128_emit_context( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 13 ); + + OUT_RING( CCE_PACKET0( R128_DST_PITCH_OFFSET_C, 11 ) ); + OUT_RING( ctx->dst_pitch_offset_c ); + OUT_RING( ctx->dp_gui_master_cntl_c ); + OUT_RING( ctx->sc_top_left_c ); + OUT_RING( ctx->sc_bottom_right_c ); + OUT_RING( ctx->z_offset_c ); + OUT_RING( ctx->z_pitch_c ); + OUT_RING( ctx->z_sten_cntl_c ); + OUT_RING( ctx->tex_cntl_c ); + OUT_RING( ctx->misc_3d_state_cntl_reg ); + OUT_RING( ctx->texture_clr_cmp_clr_c ); + OUT_RING( ctx->texture_clr_cmp_msk_c ); + OUT_RING( ctx->fog_color_c ); + + ADVANCE_RING(); +} + +static inline void r128_emit_setup( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 3 ); + + OUT_RING( CCE_PACKET1( R128_SETUP_CNTL, R128_PM4_VC_FPU_SETUP ) ); + OUT_RING( ctx->setup_cntl ); + OUT_RING( ctx->pm4_vc_fpu_setup ); + + ADVANCE_RING(); +} + +static inline void r128_emit_masks( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( ctx->dp_write_mask ); + + OUT_RING( CCE_PACKET0( R128_STEN_REF_MASK_C, 1 ) ); + OUT_RING( ctx->sten_ref_mask_c ); + OUT_RING( ctx->plane_3d_mask_c ); + + ADVANCE_RING(); +} + +static inline void r128_emit_window( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_WINDOW_XY_OFFSET, 0 ) ); + OUT_RING( ctx->window_xy_offset ); + + ADVANCE_RING(); +} + +static inline void r128_emit_tex0( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0]; + int i; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 7 + R128_TEX_MAXLEVELS ); + + OUT_RING( CCE_PACKET0( R128_PRIM_TEX_CNTL_C, + 2 + R128_TEX_MAXLEVELS ) ); + OUT_RING( tex->tex_cntl ); + OUT_RING( tex->tex_combine_cntl ); + OUT_RING( ctx->tex_size_pitch_c ); + for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + OUT_RING( tex->tex_offset[i] ); + } + + OUT_RING( CCE_PACKET0( R128_CONSTANT_COLOR_C, 1 ) ); + OUT_RING( ctx->constant_color_c ); + OUT_RING( tex->tex_border_color ); + + ADVANCE_RING(); +} + +static inline void r128_emit_tex1( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; + int i; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 + R128_TEX_MAXLEVELS ); + + OUT_RING( CCE_PACKET0( R128_SEC_TEX_CNTL_C, + 1 + R128_TEX_MAXLEVELS ) ); + OUT_RING( tex->tex_cntl ); + OUT_RING( tex->tex_combine_cntl ); + for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + OUT_RING( tex->tex_offset[i] ); + } + + OUT_RING( CCE_PACKET0( R128_SEC_TEXTURE_BORDER_COLOR_C, 0 ) ); + OUT_RING( tex->tex_border_color ); + + ADVANCE_RING(); +} + +static inline void r128_emit_state( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); + + if ( dirty & R128_UPLOAD_CORE ) { + r128_emit_core( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_CORE; + } + + if ( dirty & R128_UPLOAD_CONTEXT ) { + r128_emit_context( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_CONTEXT; + } + + if ( dirty & R128_UPLOAD_SETUP ) { + r128_emit_setup( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_SETUP; + } + + if ( dirty & R128_UPLOAD_MASKS ) { + r128_emit_masks( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_MASKS; + } + + if ( dirty & R128_UPLOAD_WINDOW ) { + r128_emit_window( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_WINDOW; + } + + if ( dirty & R128_UPLOAD_TEX0 ) { + r128_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_TEX0; + } + + if ( dirty & R128_UPLOAD_TEX1 ) { + r128_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_TEX1; + } + + /* Turn off the texture cache flushing */ + sarea_priv->context_state.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; + + sarea_priv->dirty &= ~R128_REQUIRE_QUIESCENCE; +} + + +#if R128_PERFORMANCE_BOXES +/* ================================================================ + * Performance monitoring functions + */ + +static void r128_clear_box( drm_r128_private_t *dev_priv, + int x, int y, int w, int h, + int r, int g, int b ) +{ + u32 pitch, offset; + u32 fb_bpp, color; + RING_LOCALS; + + switch ( dev_priv->fb_bpp ) { + case 16: + fb_bpp = R128_GMC_DST_16BPP; + color = (((r & 0xf8) << 8) | + ((g & 0xfc) << 3) | + ((b & 0xf8) >> 3)); + break; + case 24: + fb_bpp = R128_GMC_DST_24BPP; + color = ((r << 16) | (g << 8) | b); + break; + case 32: + default: + fb_bpp = R128_GMC_DST_32BPP; + color = (((0xff) << 24) | (r << 16) | (g << 8) | b); + break; + } + + offset = dev_priv->back_offset; + pitch = dev_priv->back_pitch >> 3; + + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | fb_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( (pitch << 21) | (offset >> 5) ); + OUT_RING( color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); +} + +static void r128_cce_performance_boxes( drm_r128_private_t *dev_priv ) +{ + if ( atomic_read( &dev_priv->idle_count ) == 0 ) { + r128_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); + } else { + atomic_set( &dev_priv->idle_count, 0 ); + } +} + +#endif + + +/* ================================================================ + * CCE command dispatch functions + */ + +static void r128_print_dirty( const char *msg, unsigned int flags ) +{ + DRM_INFO( "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & R128_UPLOAD_CORE) ? "core, " : "", + (flags & R128_UPLOAD_CONTEXT) ? "context, " : "", + (flags & R128_UPLOAD_SETUP) ? "setup, " : "", + (flags & R128_UPLOAD_TEX0) ? "tex0, " : "", + (flags & R128_UPLOAD_TEX1) ? "tex1, " : "", + (flags & R128_UPLOAD_MASKS) ? "masks, " : "", + (flags & R128_UPLOAD_WINDOW) ? "window, " : "", + (flags & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "", + (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); +} + +static void r128_cce_dispatch_clear( drm_device_t *dev, + unsigned int flags, + int cx, int cy, int cw, int ch, + unsigned int clear_color, + unsigned int clear_depth, + unsigned int color_mask, + unsigned int depth_mask ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + u32 fb_bpp, depth_bpp; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + switch ( dev_priv->fb_bpp ) { + case 16: + fb_bpp = R128_GMC_DST_16BPP; + break; + case 24: + fb_bpp = R128_GMC_DST_24BPP; + break; + case 32: + default: + fb_bpp = R128_GMC_DST_32BPP; + break; + } + switch ( dev_priv->depth_bpp ) { + case 16: + depth_bpp = R128_GMC_DST_16BPP; + break; + case 24: + depth_bpp = R128_GMC_DST_32BPP; + break; + case 32: + depth_bpp = R128_GMC_DST_32BPP; + break; + default: + return; + } + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", + pbox[i].x1, pbox[i].y1, pbox[i].x2, + pbox[i].y2, flags ); + + if ( flags & (R128_FRONT | R128_BACK) ) { + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( color_mask ); + + ADVANCE_RING(); + } + + if ( flags & R128_FRONT ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | fb_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( dev_priv->front_pitch_offset_c ); + OUT_RING( clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & R128_BACK ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | fb_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( dev_priv->back_pitch_offset_c ); + OUT_RING( clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & R128_DEPTH ) { + BEGIN_RING( 8 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( depth_mask ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( clear_depth ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + } +} + +static void r128_cce_dispatch_swap( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + u32 fb_bpp; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + +#if R128_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + r128_cce_performance_boxes( dev_priv ); +#endif + + switch ( dev_priv->fb_bpp ) { + case 16: + fb_bpp = R128_GMC_DST_16BPP; + break; + case 24: + fb_bpp = R128_GMC_DST_24BPP; + break; + case 32: + default: + fb_bpp = R128_GMC_DST_32BPP; + break; + } + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + BEGIN_RING( 7 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL + | R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_NONE + | fb_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_S + | R128_DP_SRC_SOURCE_MEMORY + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_AUX_CLIP_DIS + | R128_GMC_WR_MSK_DIS ); + +#if 1 + OUT_RING( dev_priv->back_pitch_offset_c ); + OUT_RING( dev_priv->front_pitch_offset_c ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); +#else + OUT_RING( dev_priv->depth_pitch_offset_c /*& ~R128_DST_TILE*/ ); + OUT_RING( dev_priv->front_pitch_offset_c ); + + OUT_RING( (0 << 16) | 0 ); + OUT_RING( (0 << 16) | 0 ); + OUT_RING( (800 << 16) | 600 ); +#endif + + ADVANCE_RING(); + } + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); + OUT_RING( dev_priv->sarea_priv->last_frame ); + + ADVANCE_RING(); +} + +static void r128_cce_dispatch_vertex( drm_device_t *dev, + drm_buf_t *buf ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int format = sarea_priv->vc_format; + int offset = dev_priv->buffers->offset + buf->offset - dev->agp->base; + int size = buf->used; + int prim = buf_priv->prim; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "%s: buf=%d nbox=%d\n", + __FUNCTION__, buf->idx, sarea_priv->nbox ); + + r128_update_ring_snapshot( dev_priv ); + + if ( 0 ) + r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); + + if ( buf->used ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128_emit_state( dev_priv ); + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + r128_emit_clip_rects( dev_priv, + &sarea_priv->boxes[i], + sarea_priv->nbox - i ); + } + + /* Emit the vertex buffer rendering commands */ + BEGIN_RING( 5 ); + + OUT_RING( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, 3 ) ); + OUT_RING( offset ); + OUT_RING( size ); + OUT_RING( format ); + OUT_RING( prim | R128_CCE_VC_CNTL_PRIM_WALK_LIST | + (size << R128_CCE_VC_CNTL_NUM_SHIFT) ); + + ADVANCE_RING(); + + i += 3; + } while ( i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( buf_priv->age ); + + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + +#if 0 + if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { + ret = r128_do_cce_idle( dev_priv ); + if ( ret < 0 ) return ret; + dev_priv->submit_age = 0; + r128_freelist_reset( dev ); + } +#endif + + sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + + + + +static void r128_cce_dispatch_indirect( drm_device_t *dev, + drm_buf_t *buf, + int start, int end ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + RING_LOCALS; + DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", + buf->idx, start, end ); + + r128_update_ring_snapshot( dev_priv ); + + if ( start != end ) { + int offset = (dev_priv->buffers->offset - dev->agp->base + + buf->offset + start); + int dwords = (end - start + 3) / sizeof(u32); + + /* Indirect buffer data must be an even number of + * dwords, so if we've been given an odd number we must + * pad the data with a Type-2 CCE packet. + */ + if ( dwords & 1 ) { + u32 *data = (u32 *) + ((char *)dev_priv->buffers->handle + + buf->offset + start); + data[dwords++] = R128_CCE_PACKET2; + } + + buf_priv->dispatched = 1; + + /* Fire off the indirect buffer */ + BEGIN_RING( 3 ); + + OUT_RING( CCE_PACKET0( R128_PM4_IW_INDOFF, 1 ) ); + OUT_RING( offset ); + OUT_RING( dwords ); + + ADVANCE_RING(); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the indirect buffer age */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( buf_priv->age ); + + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + +#if 0 + if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { + ret = r128_do_cce_idle( dev_priv ); + if ( ret < 0 ) return ret; + dev_priv->submit_age = 0; + r128_freelist_reset( dev ); + } +#endif +} + +static void r128_cce_dispatch_indices( drm_device_t *dev, + drm_buf_t *buf, + int start, int end, + int count ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int format = sarea_priv->vc_format; + int offset = dev_priv->buffers->offset - dev->agp->base; + int prim = buf_priv->prim; + u32 *data; + int dwords; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); + + r128_update_ring_snapshot( dev_priv ); + + if ( 0 ) + r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); + + if ( start != end ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128_emit_state( dev_priv ); + } + + dwords = (end - start + 3) / sizeof(u32); + + data = (u32 *)((char *)dev_priv->buffers->handle + + buf->offset + start); + + data[0] = CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, dwords-2 ); + + data[1] = offset; + data[2] = R128_MAX_VB_VERTS; + data[3] = format; + data[4] = (prim | R128_CCE_VC_CNTL_PRIM_WALK_IND | + (count << 16)); + + if ( count & 0x1 ) { + data[dwords-1] &= 0x0000ffff; + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + r128_emit_clip_rects( dev_priv, + &sarea_priv->boxes[i], + sarea_priv->nbox - i ); + } + + r128_cce_dispatch_indirect( dev, buf, start, end ); + + i += 3; + } while ( i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( buf_priv->age ); + + ADVANCE_RING(); + + buf->pending = 1; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + +#if 0 + if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { + ret = r128_do_cce_idle( dev_priv ); + if ( ret < 0 ) return ret; + dev_priv->submit_age = 0; + r128_freelist_reset( dev ); + } +#endif + + sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + +static int r128_cce_dispatch_blit( drm_device_t *dev, + drm_r128_blit_t *blit ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + u32 *data; + int dword_shift, dwords; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + /* The compiler won't optimize away a division by a variable, + * even if the only legal values are powers of two. Thus, we'll + * use a shift instead. + */ + switch ( blit->format ) { + case R128_DATATYPE_ARGB1555: + case R128_DATATYPE_RGB565: + case R128_DATATYPE_ARGB4444: + dword_shift = 1; + break; + case R128_DATATYPE_ARGB8888: + dword_shift = 0; + break; + default: + DRM_ERROR( "invalid blit format %d\n", blit->format ); + return -EINVAL; + } + + /* Flush the pixel cache, and mark the contents as Read Invalid. + * This ensures no pixel data gets mixed up with the texture + * data from the host data blit, otherwise part of the texture + * image may be corrupted. + */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); + OUT_RING( R128_PC_RI_GUI | R128_PC_FLUSH_GUI ); + + ADVANCE_RING(); + + /* Dispatch the indirect buffer. + */ + buf = dma->buflist[blit->idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != current->pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", blit->idx ); + return -EINVAL; + } + + buf_priv->discard = 1; + + dwords = (blit->width * blit->height) >> dword_shift; + + data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); + + data[0] = CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 ); + data[1] = ( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_NONE + | (blit->format << 8) + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_S + | R128_DP_SRC_SOURCE_HOST_DATA + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_AUX_CLIP_DIS + | R128_GMC_WR_MSK_DIS ); + + data[2] = (blit->pitch << 21) | (blit->offset >> 5); + data[3] = 0xffffffff; + data[4] = 0xffffffff; + data[5] = (blit->y << 16) | blit->x; + data[6] = (blit->height << 16) | blit->width; + data[7] = dwords; + + buf->used = (dwords + 8) * sizeof(u32); + + r128_cce_dispatch_indirect( dev, buf, 0, buf->used ); + + /* Flush the pixel cache after the blit completes. This ensures + * the texture data is written out to memory before rendering + * continues. + */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); + OUT_RING( R128_PC_FLUSH_GUI ); + + ADVANCE_RING(); + + return 0; +} + + +/* ================================================================ + * Tiled depth buffer management + */ + +static int r128_cce_dispatch_write_span( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, x, y; + u32 *buffer; + u8 *mask; + u32 depth_bpp; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + switch ( dev_priv->depth_bpp ) { + case 16: + depth_bpp = R128_GMC_DST_16BPP; + break; + case 24: + depth_bpp = R128_GMC_DST_32BPP; + break; + case 32: + depth_bpp = R128_GMC_DST_32BPP; + break; + default: + return -EINVAL; + } + + count = depth->n; + if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { + return -EFAULT; + } + if ( copy_from_user( &y, depth->y, sizeof(y) ) ) { + return -EFAULT; + } + + buffer = kmalloc( depth->n * sizeof(u32), 0 ); + if ( buffer == NULL ) + return -ENOMEM; + if ( copy_from_user( buffer, depth->buffer, + depth->n * sizeof(u32) ) ) { + kfree( buffer ); + return -EFAULT; + } + + if ( depth->mask ) { + mask = kmalloc( depth->n * sizeof(u8), 0 ); + if ( mask == NULL ) { + kfree( buffer ); + return -ENOMEM; + } + if ( copy_from_user( mask, depth->mask, + depth->n * sizeof(u8) ) ) { + kfree( buffer ); + kfree( mask ); + return -EFAULT; + } + + for ( i = 0 ; i < count ; i++, x++ ) { + if ( mask[i] ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, + 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + kfree( mask ); + } else { + for ( i = 0 ; i < count ; i++, x++ ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + kfree( buffer ); + + return 0; +} + +static int r128_cce_dispatch_write_pixels( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, *x, *y; + u32 *buffer; + u8 *mask; + u32 depth_bpp; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + switch ( dev_priv->depth_bpp ) { + case 16: + depth_bpp = R128_GMC_DST_16BPP; + break; + case 24: + depth_bpp = R128_GMC_DST_32BPP; + break; + case 32: + depth_bpp = R128_GMC_DST_32BPP; + break; + default: + return -EINVAL; + } + + count = depth->n; + + x = kmalloc( count * sizeof(*x), 0 ); + if ( x == NULL ) { + return -ENOMEM; + } + y = kmalloc( count * sizeof(*y), 0 ); + if ( y == NULL ) { + kfree( x ); + return -ENOMEM; + } + if ( copy_from_user( x, depth->x, count * sizeof(int) ) ) { + kfree( x ); + kfree( y ); + return -EFAULT; + } + if ( copy_from_user( y, depth->y, count * sizeof(int) ) ) { + kfree( x ); + kfree( y ); + return -EFAULT; + } + + buffer = kmalloc( depth->n * sizeof(u32), 0 ); + if ( buffer == NULL ) { + kfree( x ); + kfree( y ); + return -ENOMEM; + } + if ( copy_from_user( buffer, depth->buffer, + depth->n * sizeof(u32) ) ) { + kfree( x ); + kfree( y ); + kfree( buffer ); + return -EFAULT; + } + + if ( depth->mask ) { + mask = kmalloc( depth->n * sizeof(u8), 0 ); + if ( mask == NULL ) { + kfree( x ); + kfree( y ); + kfree( buffer ); + return -ENOMEM; + } + if ( copy_from_user( mask, depth->mask, + depth->n * sizeof(u8) ) ) { + kfree( x ); + kfree( y ); + kfree( buffer ); + kfree( mask ); + return -EFAULT; + } + + for ( i = 0 ; i < count ; i++ ) { + if ( mask[i] ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, + 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + kfree( mask ); + } else { + for ( i = 0 ; i < count ; i++ ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_SOLID_COLOR + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_P + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + kfree( x ); + kfree( y ); + kfree( buffer ); + + return 0; +} + +static int r128_cce_dispatch_read_span( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, x, y; + u32 depth_bpp; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + switch ( dev_priv->depth_bpp ) { + case 16: + depth_bpp = R128_GMC_DST_16BPP; + break; + case 24: + depth_bpp = R128_GMC_DST_32BPP; + break; + case 32: + depth_bpp = R128_GMC_DST_32BPP; + break; + default: + return -EINVAL; + } + + count = depth->n; + if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { + return -EFAULT; + } + if ( copy_from_user( &y, depth->y, sizeof(y) ) ) { + return -EFAULT; + } + + BEGIN_RING( 7 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL + | R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_NONE + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_S + | R128_DP_SRC_SOURCE_MEMORY + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( dev_priv->span_pitch_offset_c ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (0 << 16) | 0 ); + OUT_RING( (count << 16) | 1 ); + + ADVANCE_RING(); + + return 0; +} + +static int r128_cce_dispatch_read_pixels( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, *x, *y; + u32 depth_bpp; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + switch ( dev_priv->depth_bpp ) { + case 16: + depth_bpp = R128_GMC_DST_16BPP; + break; + case 24: + depth_bpp = R128_GMC_DST_32BPP; + break; + case 32: + depth_bpp = R128_GMC_DST_32BPP; + break; + default: + return -EINVAL; + } + + count = depth->n; + if ( count > dev_priv->depth_pitch ) { + count = dev_priv->depth_pitch; + } + + x = kmalloc( count * sizeof(*x), 0 ); + if ( x == NULL ) { + return -ENOMEM; + } + y = kmalloc( count * sizeof(*y), 0 ); + if ( y == NULL ) { + kfree( x ); + return -ENOMEM; + } + if ( copy_from_user( x, depth->x, count * sizeof(int) ) ) { + kfree( x ); + kfree( y ); + return -EFAULT; + } + if ( copy_from_user( y, depth->y, count * sizeof(int) ) ) { + kfree( x ); + kfree( y ); + return -EFAULT; + } + + for ( i = 0 ; i < count ; i++ ) { + BEGIN_RING( 7 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL + | R128_GMC_DST_PITCH_OFFSET_CNTL + | R128_GMC_BRUSH_NONE + | depth_bpp + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP3_S + | R128_DP_SRC_SOURCE_MEMORY + | R128_GMC_CLR_CMP_CNTL_DIS + | R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( dev_priv->span_pitch_offset_c ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (i << 16) | 0 ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + + kfree( x ); + kfree( y ); + + return 0; +} + + +/* ================================================================ + * Polygon stipple + */ + +static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_update_ring_snapshot( dev_priv ); + + BEGIN_RING( 33 ); + + OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); + for ( i = 0 ; i < 32 ; i++ ) { + OUT_RING( stipple[i] ); + } + + ADVANCE_RING(); +} + + +/* ================================================================ + * IOCTL functions + */ + +int r128_cce_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_clear_t clear; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "r128_cce_clear called without lock held\n" ); + return -EINVAL; + } + + if ( copy_from_user( &clear, (drm_r128_clear_t *) arg, + sizeof(clear) ) ) + return -EFAULT; + + if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; + + r128_cce_dispatch_clear( dev, clear.flags, + clear.x, clear.y, clear.w, clear.h, + clear.clear_color, clear.clear_depth, + clear.color_mask, clear.depth_mask ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + + return 0; +} + +int r128_cce_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "r128_cce_swap called without lock held\n" ); + return -EINVAL; + } + + if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; + + r128_cce_dispatch_swap( dev ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + + return 0; +} + +int r128_cce_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_vertex_t vertex; + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + if ( !dev_priv || dev_priv->is_pci ) { + DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &vertex, (drm_r128_vertex_t *)arg, + sizeof(vertex) ) ) + return -EFAULT; + + DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", + __FUNCTION__, current->pid, + vertex.idx, vertex.count, vertex.discard ); + + if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + vertex.idx, dma->buf_count - 1 ); + return -EINVAL; + } + if ( vertex.prim < 0 || + vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + return -EINVAL; + } + + buf = dma->buflist[vertex.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != current->pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + return -EINVAL; + } + + buf->used = vertex.count; + buf_priv->prim = vertex.prim; + buf_priv->discard = vertex.discard; + + r128_cce_dispatch_vertex( dev, buf ); + + return 0; +} + +int r128_cce_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_indices_t elts; + int count; + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + if ( !dev_priv || dev_priv->is_pci ) { + DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &elts, (drm_r128_indices_t *)arg, + sizeof(elts) ) ) + return -EFAULT; + + DRM_DEBUG( "%s: pid=%d buf=%d s=%d e=%d d=%d\n", + __FUNCTION__, current->pid, + elts.idx, elts.start, elts.end, elts.discard ); + + if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + elts.idx, dma->buf_count - 1 ); + return -EINVAL; + } + if ( elts.prim < 0 || + elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", elts.prim ); + return -EINVAL; + } + + buf = dma->buflist[elts.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != current->pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", elts.idx ); + return -EINVAL; + } + + count = (elts.end - elts.start) / sizeof(u16); + elts.start -= R128_INDEX_PRIM_OFFSET; + + if ( elts.start & 0x7 ) { + DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); + return -EINVAL; + } + if ( elts.start < buf->used ) { + DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); + return -EINVAL; + } + + buf->used = elts.end; + buf_priv->prim = elts.prim; + buf_priv->discard = elts.discard; + + r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count ); + + return 0; +} + +int r128_cce_blit( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_r128_blit_t blit; + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &blit, (drm_r128_blit_t *)arg, + sizeof(blit) ) ) + return -EFAULT; + + DRM_DEBUG( "%s: pid=%d index=%d\n", + __FUNCTION__, current->pid, blit.idx ); + + if ( blit.idx < 0 || blit.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + blit.idx, dma->buf_count - 1 ); + return -EINVAL; + } + + return r128_cce_dispatch_blit( dev, &blit ); +} + +int r128_cce_depth( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_depth_t depth; + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &depth, (drm_r128_depth_t *)arg, + sizeof(depth) ) ) + return -EFAULT; + + switch ( depth.func ) { + case R128_WRITE_SPAN: + return r128_cce_dispatch_write_span( dev, &depth ); + case R128_WRITE_PIXELS: + return r128_cce_dispatch_write_pixels( dev, &depth ); + case R128_READ_SPAN: + return r128_cce_dispatch_read_span( dev, &depth ); + case R128_READ_PIXELS: + return r128_cce_dispatch_read_pixels( dev, &depth ); + } + + return -EINVAL; +} + +int r128_cce_stipple( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_r128_stipple_t stipple; + u32 mask[32]; + + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || + dev->lock.pid != current->pid ) { + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &stipple, (drm_r128_stipple_t *)arg, + sizeof(stipple) ) ) + return -EFAULT; + + if ( copy_from_user( &mask, stipple.mask, + 32 * sizeof(u32) ) ) + return -EFAULT; + + r128_cce_dispatch_stipple( dev, mask ); + + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c index f2fdf6dd3..accd789ae 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c @@ -106,19 +106,19 @@ int sis_resctx(struct inode *inode, struct file *filp, unsigned int cmd, int i; DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT); + if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) + return -EFAULT; if (res.count >= DRM_RESERVED_CONTEXTS) { memset(&ctx, 0, sizeof(ctx)); for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { ctx.handle = i; - copy_to_user_ret(&res.contexts[i], - &i, - sizeof(i), - -EFAULT); + if (copy_to_user(&res.contexts[i], &i, sizeof(i))) + return -EFAULT; } } res.count = DRM_RESERVED_CONTEXTS; - copy_to_user_ret((drm_ctx_res_t *)arg, &res, sizeof(res), -EFAULT); + if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) + return -EFAULT; return 0; } @@ -130,7 +130,8 @@ int sis_addctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_ctx_t ctx; - copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; if ((ctx.handle = sis_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { /* Skip kernel's context and get a new one. */ ctx.handle = sis_alloc_queue(dev); @@ -145,7 +146,8 @@ int sis_addctx(struct inode *inode, struct file *filp, unsigned int cmd, /* new added */ sis_init_context(ctx.handle); - copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); + if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) + return -EFAULT; return 0; } @@ -154,7 +156,8 @@ int sis_modctx(struct inode *inode, struct file *filp, unsigned int cmd, { drm_ctx_t ctx; - copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) + return -EFAULT; if (ctx.flags==_DRM_CONTEXT_PRESERVED) sis_res_ctx.handle=ctx.handle; return 0; @@ -165,10 +168,12 @@ int sis_getctx(struct inode *inode, struct file *filp, unsigned int cmd, { drm_ctx_t ctx; - copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) + return -EFAULT; /* This is 0, because we don't hanlde any context flags */ ctx.flags = 0; - copy_to_user_ret((drm_ctx_t*)arg, &ctx, sizeof(ctx), -EFAULT); + if (copy_to_user((drm_ctx_t*)arg, &ctx, sizeof(ctx))) + return -EFAULT; return 0; } @@ -179,7 +184,8 @@ int sis_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_ctx_t ctx; - copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; DRM_DEBUG("%d\n", ctx.handle); return sis_context_switch(dev, dev->last_context, ctx.handle); } @@ -191,7 +197,8 @@ int sis_newctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_ctx_t ctx; - copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; DRM_DEBUG("%d\n", ctx.handle); sis_context_switch_complete(dev, ctx.handle); @@ -205,7 +212,8 @@ int sis_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_ctx_t ctx; - copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; DRM_DEBUG("%d\n", ctx.handle); drm_ctxbitmap_free(dev, ctx.handle); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c index 2f98e3221..92ec32ddd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c @@ -250,7 +250,7 @@ static int sis_takedown(drm_device_t *dev) drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); temp = temp_next; } - if (dev->agp->acquired) (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); } #endif /* Clear vma list (only built for debugging) */ @@ -394,17 +394,16 @@ int sis_version(struct inode *inode, struct file *filp, unsigned int cmd, drm_version_t version; int len; - copy_from_user_ret(&version, - (drm_version_t *)arg, - sizeof(version), - -EFAULT); + if (copy_from_user(&version, (drm_version_t *)arg, sizeof(version))) + return -EFAULT; #define DRM_COPY(name,value) \ len = strlen(value); \ if (len > name##_len) len = name##_len; \ name##_len = strlen(value); \ if (len && name) { \ - copy_to_user_ret(name, value, len, -EFAULT); \ + if (copy_to_user(name, value, len)) \ + return -EFAULT; \ } version.version_major = SIS_MAJOR; @@ -415,10 +414,8 @@ int sis_version(struct inode *inode, struct file *filp, unsigned int cmd, DRM_COPY(version.date, SIS_DATE); DRM_COPY(version.desc, SIS_DESC); - copy_to_user_ret((drm_version_t *)arg, - &version, - sizeof(version), - -EFAULT); + if (copy_to_user((drm_version_t *)arg, &version, sizeof(version))) + return -EFAULT; return 0; } @@ -533,7 +530,8 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->lck_start = start = get_cycles(); #endif - copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + return -EFAULT; if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", @@ -667,7 +665,8 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_lock_t lock; - copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + return -EFAULT; if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c index 9a8f83ea9..4c2b5a6c6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c @@ -78,7 +78,8 @@ int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, struct sis_memreq req; int retval = 0; - copy_from_user_ret(&fb, (drm_sis_mem_t *)arg, sizeof(fb), -EFAULT); + if (copy_from_user(&fb, (drm_sis_mem_t *)arg, sizeof(fb))) + return -EFAULT; req.size = fb.size; sis_malloc(&req); @@ -98,7 +99,7 @@ int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, fb.free = 0; } - copy_to_user_ret((drm_sis_mem_t *)arg, &fb, sizeof(fb), -EFAULT); + if (copy_to_user((drm_sis_mem_t *)arg, &fb, sizeof(fb))) return -EFAULT; DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset); @@ -111,7 +112,8 @@ int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd, drm_sis_mem_t fb; int retval = 0; - copy_from_user_ret(&fb, (drm_sis_mem_t *)arg, sizeof(fb), -EFAULT); + if (copy_from_user(&fb, (drm_sis_mem_t *)arg, sizeof(fb))) + return -EFAULT; if(!fb.free){ return -1; @@ -152,7 +154,8 @@ int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, { drm_sis_agp_t agp; - copy_from_user_ret(&agp, (drm_sis_agp_t *)arg, sizeof(agp), -EFAULT); + if (copy_from_user(&agp, (drm_sis_agp_t *)arg, sizeof(agp))) + return -EFAULT; AgpHeap = mmInit(agp.offset, agp.size); @@ -171,7 +174,8 @@ int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, if(!AgpHeap) return -1; - copy_from_user_ret(&agp, (drm_sis_mem_t *)arg, sizeof(agp), -EFAULT); + if (copy_from_user(&agp, (drm_sis_mem_t *)arg, sizeof(agp))) + return -EFAULT; block = mmAllocMem(AgpHeap, agp.size, 0, 0); if(block){ @@ -190,7 +194,7 @@ int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, agp.free = 0; } - copy_to_user_ret((drm_sis_mem_t *)arg, &agp, sizeof(agp), -EFAULT); + if (copy_to_user((drm_sis_mem_t *)arg, &agp, sizeof(agp))) return -EFAULT; DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset); @@ -206,7 +210,8 @@ int sis_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, if(!AgpHeap) return -1; - copy_from_user_ret(&agp, (drm_sis_mem_t *)arg, sizeof(agp), -EFAULT); + if (copy_from_user(&agp, (drm_sis_mem_t *)arg, sizeof(agp))) + return -EFAULT; if(!agp.free){ return -1; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c index 5f2c804af..7d79a013b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c @@ -235,7 +235,7 @@ static int tdfx_takedown(drm_device_t *dev) drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); temp = temp_next; } - if (dev->agp->acquired) (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); } #endif /* Clear vma list (only built for debugging) */ @@ -298,7 +298,7 @@ static int tdfx_takedown(drm_device_t *dev) /* tdfx_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int tdfx_init(void) +static int __init tdfx_init(void) { int retcode; drm_device_t *dev = &tdfx_device; @@ -346,7 +346,7 @@ static int tdfx_init(void) /* tdfx_cleanup is called via cleanup_module at module unload time. */ -static void tdfx_cleanup(void) +static void __exit tdfx_cleanup(void) { drm_device_t *dev = &tdfx_device; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c index e7d88f11a..b40299e4a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c @@ -22,11 +22,11 @@ * 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. - * + * * Author: Kevin E. Martin <martin@valinux.com> - * + * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.3 2000/08/24 22:20:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.5 2000/12/04 19:21:54 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -77,124 +77,337 @@ extern int xf86RemoveSIGIOHandler(int fd); #include "xf86drmR128.h" #include "drm.h" -int drmR128InitCCE(int fd, drmR128Init *info) +#define R128_BUFFER_RETRY 32 +#define R128_IDLE_RETRY 16 + + +int drmR128InitCCE( int fd, drmR128Init *info ) { - drm_r128_init_t init; + drm_r128_init_t init; + + memset( &init, 0, sizeof(drm_r128_init_t) ); + + init.func = R128_INIT_CCE; + init.sarea_priv_offset = info->sarea_priv_offset; + init.is_pci = info->is_pci; + init.cce_mode = info->cce_mode; + init.cce_secure = info->cce_secure; + init.ring_size = info->ring_size; + init.usec_timeout = info->usec_timeout; + + init.fb_bpp = info->fb_bpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_bpp = info->depth_bpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + init.span_offset = info->span_offset; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.ring_offset = info->ring_offset; + init.ring_rptr_offset = info->ring_rptr_offset; + init.buffers_offset = info->buffers_offset; + init.agp_textures_offset = info->agp_textures_offset; + + if ( ioctl( fd, DRM_IOCTL_R128_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} - memset(&init, 0, sizeof(drm_r128_init_t)); +int drmR128CleanupCCE( int fd ) +{ + drm_r128_init_t init; - init.func = R128_INIT_CCE; - init.sarea_priv_offset = info->sarea_priv_offset; - init.is_pci = info->is_pci; - init.cce_mode = info->cce_mode; - init.cce_fifo_size = info->cce_fifo_size; - init.cce_secure = info->cce_secure; - init.ring_size = info->ring_size; - init.usec_timeout = info->usec_timeout; + memset( &init, 0, sizeof(drm_r128_init_t) ); - init.fb_offset = info->fb_offset; - init.agp_ring_offset = info->agp_ring_offset; - init.agp_read_ptr_offset = info->agp_read_ptr_offset; - init.agp_vertbufs_offset = info->agp_vertbufs_offset; - init.agp_indbufs_offset = info->agp_indbufs_offset; - init.agp_textures_offset = info->agp_textures_offset; - init.mmio_offset = info->mmio_offset; + init.func = R128_CLEANUP_CCE; - if (ioctl(fd, DRM_IOCTL_R128_INIT, &init)) return -errno; + if ( ioctl( fd, DRM_IOCTL_R128_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} - return 0; +int drmR128StartCCE( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_R128_CCE_START, NULL ) ) { + return -errno; + } else { + return 0; + } } -int drmR128CleanupCCE(int fd) +int drmR128StopCCE( int fd ) { - drm_r128_init_t init; + drm_r128_cce_stop_t stop; + int ret, i = 0; - memset(&init, 0, sizeof(drm_r128_init_t)); + stop.flush = 1; + stop.idle = 1; - init.func = R128_CLEANUP_CCE; + ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); - if (ioctl(fd, DRM_IOCTL_R128_INIT, &init)) return -errno; + if ( ret && errno != EBUSY ) + return -errno; - return 0; + stop.flush = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); + } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); + + if ( ret && errno != EBUSY ) + return -errno; + + stop.idle = 0; + + if ( ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ) ) { + return -errno; + } else { + return 0; + } } -int drmR128EngineReset(int fd) +int drmR128ResetCCE( int fd ) { - if (ioctl(fd, DRM_IOCTL_R128_RESET, NULL)) return -errno; + if ( ioctl( fd, DRM_IOCTL_R128_CCE_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128WaitForIdleCCE( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_R128_CCE_IDLE, NULL ); + } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); - return 0; + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } } -int drmR128EngineFlush(int fd) +int drmR128EngineReset( int fd ) { - if (ioctl(fd, DRM_IOCTL_R128_FLUSH, NULL)) return -errno; + if ( ioctl( fd, DRM_IOCTL_R128_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} - return 0; +int drmR128SwapBuffers( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_R128_SWAP, NULL ) ) { + return -errno; + } else { + return 0; + } } -int drmR128WaitForIdle(int fd) +int drmR128Clear( int fd, unsigned int flags, + int x, int y, int w, int h, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) { - if (ioctl(fd, DRM_IOCTL_R128_IDLE, NULL)) return -errno; + drm_r128_clear_t clear; + + clear.flags = flags; + clear.x = x; + clear.y = y; + clear.w = w; + clear.h = h; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + + if ( ioctl( fd, DRM_IOCTL_R128_CLEAR, &clear ) < 0 ) { + return -errno; + } else { + return 0; + } +} - return 0; +int drmR128FlushVertexBuffer( int fd, int prim, int index, + int count, int discard ) +{ + drm_r128_vertex_t v; + + v.prim = prim; + v.idx = index; + v.count = count; + v.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_R128_VERTEX, &v ) < 0 ) { + return -errno; + } else { + return 0; + } } -int drmR128SubmitPacket(int fd, CARD32 *buffer, int *count, int flags) +int drmR128FlushIndices( int fd, int prim, int index, + int start, int end, int discard ) { - drm_r128_packet_t packet; - int ret; + drm_r128_indices_t elts; + + elts.prim = prim; + elts.idx = index; + elts.start = start; + elts.end = end; + elts.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_R128_INDICES, &elts ) < 0 ) { + return -errno; + } else { + return 0; + } +} - memset(&packet, 0, sizeof(drm_r128_packet_t)); +int drmR128TextureBlit( int fd, int index, + int offset, int pitch, int format, + int x, int y, int width, int height ) +{ + drm_r128_blit_t blit; + + blit.idx = index; + blit.offset = offset; + blit.pitch = pitch; + blit.format = format; + blit.x = x; + blit.y = y; + blit.width = width; + blit.height = height; + + if ( ioctl( fd, DRM_IOCTL_R128_BLIT, &blit ) < 0 ) { + return -errno; + } else { + return 0; + } +} - packet.count = *count; - packet.flags = flags; +int drmR128WriteDepthSpan( int fd, int n, int x, int y, + const unsigned int depth[], + const unsigned char mask[] ) +{ + drm_r128_depth_t d; + + d.func = R128_WRITE_SPAN; + d.n = n; + d.x = &x; + d.y = &y; + d.buffer = (unsigned int *)depth; + d.mask = (unsigned char *)mask; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} - while (packet.count > 0) { - packet.buffer = buffer + (*count - packet.count); - ret = ioctl(fd, DRM_IOCTL_R128_PACKET, &packet); - if (ret < 0 && ret != -EAGAIN) { - *count = packet.count; - return -errno; - } - } +int drmR128WriteDepthPixels( int fd, int n, + const int x[], const int y[], + const unsigned int depth[], + const unsigned char mask[] ) +{ + drm_r128_depth_t d; + + d.func = R128_WRITE_PIXELS; + d.n = n; + d.x = (int *)x; + d.y = (int *)y; + d.buffer = (unsigned int *)depth; + d.mask = (unsigned char *)mask; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} - *count = 0; - return 0; +int drmR128ReadDepthSpan( int fd, int n, int x, int y ) +{ + drm_r128_depth_t d; + + d.func = R128_READ_SPAN; + d.n = n; + d.x = &x; + d.y = &y; + d.buffer = NULL; + d.mask = NULL; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } } -int drmR128GetVertexBuffers(int fd, int count, int *indices, int *sizes) +int drmR128ReadDepthPixels( int fd, int n, + const int x[], const int y[] ) { - drm_r128_vertex_t v; + drm_r128_depth_t d; + + d.func = R128_READ_PIXELS; + d.n = n; + d.x = (int *)x; + d.y = (int *)y; + d.buffer = NULL; + d.mask = NULL; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} - v.send_count = 0; - v.send_indices = NULL; - v.send_sizes = NULL; - v.prim = DRM_R128_PRIM_NONE; - v.request_count = count; - v.request_indices = indices; - v.request_sizes = sizes; - v.granted_count = 0; +int drmR128PolygonStipple( int fd, unsigned int *mask ) +{ + drm_r128_stipple_t stipple; - if (ioctl(fd, DRM_IOCTL_R128_VERTEX, &v)) return -errno; + stipple.mask = mask; - return v.granted_count; + if ( ioctl( fd, DRM_IOCTL_R128_STIPPLE, &stipple ) < 0 ) { + return -errno; + } else { + return 0; + } } -int drmR128FlushVertexBuffers(int fd, int count, int *indices, - int *sizes, drmR128PrimType prim) +int drmR128SubmitPacket( int fd, void *buffer, int *count, int flags ) { - drm_r128_vertex_t v; + drm_r128_packet_t packet; + int ret; + + memset( &packet, 0, sizeof(drm_r128_packet_t) ); - v.send_count = count; - v.send_indices = indices; - v.send_sizes = sizes; - v.prim = prim; - v.request_count = 0; - v.request_indices = NULL; - v.request_sizes = NULL; - v.granted_count = 0; + packet.count = *count; + packet.flags = flags; - if (ioctl(fd, DRM_IOCTL_R128_VERTEX, &v) < 0) return -errno; + while (packet.count > 0) { + packet.buffer = (unsigned int *)buffer + (*count - packet.count); + ret = ioctl(fd, DRM_IOCTL_R128_PACKET, &packet); + if (ret < 0 && ret != -EAGAIN) { + *count = packet.count; + return -errno; + } + } - return 0; + *count = 0; + return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile index 42026b33d..1ca230f27 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.11 2000/08/09 02:33:49 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.12 2000/12/02 15:31:01 tsi Exp $ #define IHaveModules @@ -91,6 +91,7 @@ OBJS = $(OBJS1) xf86x86emu.o linux.o $(X86EMUOBJS) #if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC +ModuleObjectRule() LibraryModuleTarget(int10, $(OBJS)) InstallLibraryModule(int10,$(MODULEDIR),linux) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c index c2954e3e0..03bff4aad 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.7 2000/11/16 19:45:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.8 2000/12/01 17:43:07 dawes Exp $ */ #include "X.h" #include "os.h" @@ -90,13 +90,15 @@ lnxPMConfirmEventToOs(int fd, pmEvent event) switch (event) { case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: - ioctl( fd, APM_IOC_STANDBY, NULL ); - return PM_CONTINUE; + (void) ioctl( fd, APM_IOC_STANDBY, NULL ); + return PM_NONE; case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: - ioctl( fd, APM_IOC_SUSPEND, NULL ); - return PM_CONTINUE; + if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0) + return PM_WAIT; + else + return PM_NONE; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c index 47e33b66e..673591460 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.41 2000/11/21 23:45:56 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.42 2000/12/01 08:56:02 alanh Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -69,8 +69,6 @@ extern void sethae(unsigned long hae); # define isJensen (axpSystem == JENSEN) # endif -# define needSparse (_bus_base_sparse() != 0) - # define BUS_BASE _bus_base() #else diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h index 57032d6e2..20691ccf2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h @@ -11,11 +11,11 @@ * 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 (including the next * paragraph) 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 @@ -23,7 +23,7 @@ * 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. - * + * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * @@ -363,12 +363,20 @@ typedef struct drm_agp_info { #define DRM_IOCTL_I810_DOCOPY DRM_IO ( 0x48) /* Rage 128 specific ioctls */ -#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) -#define DRM_IOCTL_R128_RESET DRM_IO( 0x41) -#define DRM_IOCTL_R128_FLUSH DRM_IO( 0x42) -#define DRM_IOCTL_R128_IDLE DRM_IO( 0x43) -#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t) -#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) +#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) +#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) +#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) +#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) +#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) +#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) +#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) +#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) +#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) +#define DRM_IOCTL_R128_PACKET DRM_IOWR(0x4e, drm_r128_packet_t) /* SiS specific ioctls */ #define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h index 43fc85490..941d350e1 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.3 2000/08/14 17:47:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.4 2000/12/05 00:32:04 dawes Exp $ */ #ifndef _SOL8KEYNAMES_H #define _SOL8KEYNAMES_H @@ -53,7 +53,7 @@ unsigned char sol8map[256] = { KEY_UNKNOWN, /* 42 */ KEY_Enter, /* 43 */ KEY_ShiftL, /* 44 */ - KEY_UNKNOWN, /* 45 */ + KEY_BSlash, /* 45 */ KEY_Z, /* 46 */ KEY_X, /* 47 */ KEY_C, /* 48 */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h index 92a429bf7..1e2823c17 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h @@ -25,7 +25,7 @@ * * Author: Kevin E. Martin <kevin@precisioninsight.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.2 2000/11/18 19:37:21 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.3 2000/12/04 21:04:47 dawes Exp $ * */ @@ -39,45 +39,72 @@ * the kernel include file as well (r128_drm.h) */ -typedef struct _drmR128Init { - int sarea_priv_offset; - int is_pci; - int cce_mode; - int cce_fifo_size; - int cce_secure; - int ring_size; - int usec_timeout; - - int fb_offset; - int agp_ring_offset; - int agp_read_ptr_offset; - int agp_vertbufs_offset; - int agp_indbufs_offset; - int agp_textures_offset; - int mmio_offset; +#define DRM_R128_FRONT 0x1 +#define DRM_R128_BACK 0x2 +#define DRM_R128_DEPTH 0x4 + +typedef struct { + int sarea_priv_offset; + int is_pci; + int cce_mode; + int cce_secure; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + + unsigned int fb_offset; + unsigned int mmio_offset; + unsigned int ring_offset; + unsigned int ring_rptr_offset; + unsigned int buffers_offset; + unsigned int agp_textures_offset; } drmR128Init; -typedef enum { - DRM_R128_PRIM_NONE = 0x0001, - DRM_R128_PRIM_POINT = 0x0002, - DRM_R128_PRIM_LINE = 0x0004, - DRM_R128_PRIM_POLY_LINE = 0x0008, - DRM_R128_PRIM_TRI_LIST = 0x0010, - DRM_R128_PRIM_TRI_FAN = 0x0020, - DRM_R128_PRIM_TRI_STRIP = 0x0040, - DRM_R128_PRIM_TRI_TYPE2 = 0x0080 -} drmR128PrimType; - - -extern int drmR128InitCCE(int fd, drmR128Init *info); -extern int drmR128CleanupCCE(int fd); -extern int drmR128EngineReset(int fd); -extern int drmR128EngineFlush(int fd); -extern int drmR128WaitForIdle(int fd); -extern int drmR128SubmitPacket(int fd, CARD32 *buffer, int *count, int flags); -extern int drmR128GetVertexBuffers(int fd, int count, int *indices, - int *sizes); -extern int drmR128FlushVertexBuffers(int fd, int count, int *indices, - int *sizes, drmR128PrimType prim); +extern int drmR128InitCCE( int fd, drmR128Init *info ); +extern int drmR128CleanupCCE( int fd ); + +extern int drmR128StartCCE( int fd ); +extern int drmR128StopCCE( int fd ); +extern int drmR128ResetCCE( int fd ); +extern int drmR128WaitForIdleCCE( int fd ); + +extern int drmR128EngineReset( int fd ); + +extern int drmR128SwapBuffers( int fd ); +extern int drmR128Clear( int fd, unsigned int flags, + int x, int y, int w, int h, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); + +extern int drmR128FlushVertexBuffer( int fd, int prim, int index, + int count, int discard ); +extern int drmR128FlushIndices( int fd, int prim, int index, + int start, int end, int discard ); + +extern int drmR128TextureBlit( int fd, int index, + int offset, int pitch, int format, + int x, int y, int width, int height ); + +extern int drmR128WriteDepthSpan( int fd, int n, int x, int y, + const unsigned int depth[], + const unsigned char mask[] ); +extern int drmR128WriteDepthPixels( int fd, int n, + const int x[], const int y[], + const unsigned int depth[], + const unsigned char mask[] ); +extern int drmR128ReadDepthSpan( int fd, int n, int x, int y ); +extern int drmR128ReadDepthPixels( int fd, int n, + const int x[], const int y[] ); + +extern int drmR128PolygonStipple( int fd, unsigned int *mask ); + +extern int drmR128SubmitPacket( int fd, void *buffer, + int *count, int flags ); #endif diff --git a/xc/programs/Xserver/hw/xfree86/parser/DRI.c b/xc/programs/Xserver/hw/xfree86/parser/DRI.c index eaa5a6d52..86ee209ab 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/DRI.c +++ b/xc/programs/Xserver/hw/xfree86/parser/DRI.c @@ -24,7 +24,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.7 2000/10/20 14:59:02 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.8 2000/11/30 20:45:33 paulo Exp $ * */ @@ -133,6 +133,8 @@ xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr) fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name); else if (ptr->dri_group >= 0) fprintf (cf, "\tGroup %d\n", ptr->dri_group); + if (ptr->dri_mode) + fprintf (cf, "\tMode 0%o\n", ptr->dri_mode); for (bufs = ptr->dri_buffers_lst; bufs; bufs = bufs->list.next) { fprintf (cf, "\tBuffers %d %d", bufs->buf_count, bufs->buf_size); @@ -147,6 +149,7 @@ xf86freeDRI (XF86ConfDRIPtr ptr) if (ptr == NULL) return; + xf86freeBuffersList (ptr->dri_buffers_lst); xf86conffree (ptr); } diff --git a/xc/programs/Xserver/hw/xfree86/parser/Device.c b/xc/programs/Xserver/hw/xfree86/parser/Device.c index 127d76a75..d24cc6e60 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Device.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Device.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.16 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.17 2000/11/30 20:45:33 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -318,7 +318,7 @@ xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr) if (ptr->dev_busid) fprintf (cf, "\tBusID \"%s\"\n", ptr->dev_busid); if (ptr->dev_screen > 0) - fprintf (cf, "\tScreen \"%d\"\n", ptr->dev_screen); + fprintf (cf, "\tScreen %d\n", ptr->dev_screen); if (ptr->dev_irq >= 0) fprintf (cf, "\tIRQ %d\n", ptr->dev_irq); fprintf (cf, "EndSection\n\n"); diff --git a/xc/programs/Xserver/hw/xfree86/parser/Screen.c b/xc/programs/Xserver/hw/xfree86/parser/Screen.c index 399f3417d..e09b2bbe1 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Screen.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.14 2000/11/28 16:10:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.16 2000/12/01 16:10:01 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -59,6 +59,8 @@ xf86parseDisplaySubSection (void) { parsePrologue (XF86ConfDisplayPtr, XF86ConfDisplayRec) + ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1; + ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1; while ((token = xf86getToken (DisplayTab)) != ENDSUBSECTION) { switch (token) @@ -405,9 +407,24 @@ xf86printScreenSection (FILE * cf, XF86ConfScreenPtr ptr) { fprintf (cf, "\t\tVisual \"%s\"\n", dptr->disp_visual); } + if (dptr->disp_weight.red != 0) + { + fprintf (cf, "\t\tWeight %d %d %d\n", + dptr->disp_weight.red, dptr->disp_weight.green, dptr->disp_weight.blue); + } + if (dptr->disp_black.red != -1) + { + fprintf (cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n", + dptr->disp_black.red, dptr->disp_black.green, dptr->disp_black.blue); + } + if (dptr->disp_white.red != -1) + { + fprintf (cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n", + dptr->disp_white.red, dptr->disp_white.green, dptr->disp_white.blue); + } if (dptr->disp_mode_lst) { - fprintf (cf, "\t\tModes"); + fprintf (cf, "\t\tModes "); } for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next) { diff --git a/xc/programs/Xserver/hw/xfree86/parser/Vendor.c b/xc/programs/Xserver/hw/xfree86/parser/Vendor.c index fb010dcf2..a5adb3bde 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Vendor.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Vendor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.7 2000/11/02 19:58:20 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.8 2000/11/30 20:45:34 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -206,10 +206,10 @@ xf86printVendorSection (FILE * cf, XF86ConfVendorPtr ptr) { fprintf (cf, "\tSubSection \"Vendor\"\n"); if (pptr->vs_identifier) - fprintf (cf, "\tIdentifier \"%s\"\n", pptr->vs_identifier); + fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier); for (optr = pptr->vs_option_lst; optr; optr = optr->list.next) { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); + fprintf (cf, "\t\tOption \"%s\"", optr->opt_name); if (optr->opt_val) fprintf (cf, " \"%s\"", optr->opt_val); fprintf (cf, "\n"); @@ -226,6 +226,7 @@ xf86freeVendorList (XF86ConfVendorPtr p) { if (p == NULL) return; + xf86freeVendorSubList (p->vnd_sub_lst); TestFree (p->vnd_identifier); xf86optionListFree (p->vnd_option_lst); xf86conffree (p); @@ -239,6 +240,7 @@ xf86freeVendorSubList (XF86ConfVendSubPtr ptr) while (ptr) { TestFree (ptr->vs_identifier); + TestFree (ptr->vs_name); xf86optionListFree (ptr->vs_option_lst); prev = ptr; ptr = ptr->list.next; diff --git a/xc/programs/Xserver/hw/xfree86/parser/Video.c b/xc/programs/Xserver/hw/xfree86/parser/Video.c index bb9387500..941a6cf76 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Video.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Video.c @@ -25,7 +25,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.5 2000/11/28 16:10:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.6 2000/11/30 20:45:34 paulo Exp $ */ /* View/edit this file with tab stops set to 4 */ @@ -228,10 +228,10 @@ xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr) { fprintf (cf, "\tSubSection \"VideoPort\"\n"); if (pptr->vp_identifier) - fprintf (cf, "\tIdentifier \"%s\"\n", pptr->vp_identifier); + fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier); for (optr = pptr->vp_option_lst; optr; optr = optr->list.next) { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); + fprintf (cf, "\t\tOption \"%s\"", optr->opt_name); if (optr->opt_val) fprintf (cf, " \"%s\"", optr->opt_val); fprintf (cf, "\n"); diff --git a/xc/programs/Xserver/hw/xfree86/parser/read.c b/xc/programs/Xserver/hw/xfree86/parser/read.c index b684ab210..f06fb22ac 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/read.c +++ b/xc/programs/Xserver/hw/xfree86/parser/read.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.15 2000/11/15 00:22:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.16 2000/11/30 20:45:34 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -216,6 +216,8 @@ xf86freeConfig (XF86ConfigPtr p) xf86freeScreenList (p->conf_screen_lst); xf86freeLayoutList (p->conf_layout_lst); xf86freeInputList (p->conf_input_lst); + xf86freeVendorList (p->conf_vendor_lst); + xf86freeDRI (p->conf_dri); xf86conffree (p); } diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h index c62543ea9..8d45406f6 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86Version.h +++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h @@ -1,13 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.452 2000/11/29 15:51:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.454 2000/12/04 18:49:49 dawes Exp $ */ -#define XF86_VERSION " 4.0.1g " +#define XF86_VERSION " 4.0.1h " /* The finer points in versions... */ #define XF86_VERSION_MAJOR 4 #define XF86_VERSION_MINOR 0 #define XF86_VERSION_SUBMINOR 1 #define XF86_VERSION_BETA 0 /* 0="", 1="A", 2="B", etc... */ -#define XF86_VERSION_ALPHA 7 /* 0="", 1="a", 2="b", etc... */ +#define XF86_VERSION_ALPHA 8 /* 0="", 1="a", 2="b", etc... */ #define XF86_VERSION_NUMERIC(major,minor,subminor,beta,alpha) \ ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha) @@ -18,6 +18,6 @@ XF86_VERSION_BETA, \ XF86_VERSION_ALPHA) -#define XF86_DATE "29 November 2000" +#define XF86_DATE "4 December 2000" /* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile index 8b81fb207..a893c2643 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.9 2000/10/23 21:16:51 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.10 2000/11/30 20:55:16 paulo Exp $ XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic @@ -12,6 +12,7 @@ SRCS =\ card-cfg.c\ cards.c\ config.c\ + expert.c\ help.c\ interface.c\ keyboard-cfg.c\ @@ -31,6 +32,7 @@ OBJS =\ cards.o\ config.o\ card-cfg.o\ + expert.o\ help.o\ interface.o\ keyboard-cfg.o\ @@ -72,12 +74,14 @@ AllTarget(ProgramTargetName($(PROG))) #if DoLoadableServer LOADERLIB = -L../loader -lxloader -L../dummylib -ldummy -DEFINES = -DUSE_MODULES +MODULEDEFINES = -DUSE_MODULES INCLUDES = -I../common -I../loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) WRAPPERDEFINES = -DSELF_CONTAINED_WRAPPER #endif +DEFINES = -DXF86CONFIG=\"XConfigFile\" $(MODULEDEFINES) + #if HasDlopen DLLIB = DlLibrary #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad index 4702a17e2..7a0bd2059 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad @@ -26,7 +26,7 @@ !! !! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> !! -!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.5 2000/10/20 14:59:05 alanh Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.6 2000/11/30 20:55:16 paulo Exp $ !! *Form.background: gray85 @@ -178,7 +178,6 @@ lines -1,0,0,0,0,-1 *card.label: Card *monitor.label: Monitor -!*commands.background: black *commands.borderWidth: 0 *commands.defaultDistance: 2 *commands.?.bottom: chainTop @@ -193,6 +192,10 @@ lines -1,0,0,0,0,-1 *commands.card.tip: Add video card *commands.monitor.tip: Add monitor +*hpane.showGrip: False +*hpane.expert.label: Expert Mode +*topM.min: 200 +*topM.max: 200 *topM.justify: left *topM.label: Configure Layout *topM*layout.label: Configure Layout @@ -445,6 +448,9 @@ XF86Cfg.translations: #override \ <Message>WM_PROTOCOLS: accessx-close() .xf86cfg.test.translations: #override \ <Message>WM_PROTOCOLS: testmode-cancel() +.xf86cfg.Expert.translations: #override \ +<Message>WM_PROTOCOLS: expert-close() + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Options @@ -1248,6 +1254,9 @@ font -*-helvetica-bold-o-*-*-8-*-*-*-*-*-*-1;\ draw-string 12,21, "Button";\ draw-string 9,30, "Release" +*panner.width: 100 +*panner.height: 100 + *help*text.properties:\ default?family=Times&weight=Medium&slant=R&pixelsize=12®istry=ISO8859&encoding=1,\ b?weight=Bold,\ @@ -1327,3 +1336,434 @@ Press in the <b>Enable ???</b> label to set specific options.\ <p>\ <font color=red>Note</font>: currently, if you press the \ <tt><b>Apply changes</b></tt> button there is no way to undo your changes.</font> + + +*Expert.geometry: 800x600 +*Expert*vpane.min: 64 +*Expert*vpane.max: 64 +*Expert*vpane.showGrip: False +*Expert*vpane.close.showGrip: False +*Expert*vpane.close.min: 26 +*Expert*vpane.close.max: 26 +*panner.internalSpace: 1 +*panner.shadowThickness: 0 +*panner.shadowColor: gray60 +*panner.backgroundStipple: black +*panner.borderColor: gray40 + +*expert*tree.hSpace: 12 +*expert*tree*Box.hSpace: 4 +*expert*tree*vSpace: 4 +*expert*tree*LogFile.Text.width: 192 +*expert*tree*RgbPath.Text.width: 192 +*expert*tree*ModulePath.Text.width: 192 + +*expert*tree*Form.defaultDistance: 4 + +*expert*tree.backgroundPixmap: xlogo64?foreground=gray90&background=gray92 +*expert*tree.foreground: gray45 + +*expert*tree*Label.backgroundPixmap: ParentRelative + +*expert*tree*Box.backgroundPixmap: gradient:vertical?dimension=3&start=gray85&end=gray95 +*expert*tree*Box.borderWidth: 0 +*expert*tree*Box.background: gray85 +*expert*Box.displayList:\ +foreground gray40;\ +lines 1,-1,-1,-1,-1,1;\ +foreground white;\ +lines -1,0,0,0,0,-1 + +*expert*tree*Form.backgroundPixmap: gradient:vertical?dimension=3&start=gray85&end=gray95 +*expert*tree*Form.borderWidth: 0 +*expert*tree*Form.background: gray85 +*expert*Form.displayList:\ +foreground gray40;\ +lines 1,-1,-1,-1,-1,1;\ +foreground white;\ +lines -1,0,0,0,0,-1 + +*expert*tree*Text.width: 160 + +*expert*tree*fontpath.Text.width: 228 +*expert*tree*fontpath.value.fromVert: remove +*expert*tree*fontpath.valueNew.fromVert: new + +*expert*tree*modulepath.Text.width: 228 +*expert*tree*modulepath.value.fromVert: remove +*expert*tree*modulepath.valueNew.fromVert: new + +*expert*tree*module.options.fromHoriz: remove +*expert*tree*module.label.fromVert: remove +*expert*tree*module.value.fromHoriz: new +*expert*tree*module.value.width: 78 + +*expert*tree*video*Label.justify: left +*expert*tree*video.options.fromHoriz: remove +*expert*tree*video.adaptor.fromHoriz: options +*expert*tree*video.vendorL.width: 78 +*expert*tree*video.vendorL.label: VendorName +*expert*tree*video.vendorL.fromVert: remove +*expert*tree*video.vendor.fromVert: remove +*expert*tree*video.vendor.fromHoriz: vendorL +*expert*tree*video.boardL.width: 78 +*expert*tree*video.boardL.label: BoardName +*expert*tree*video.boardL.fromVert: vendor +*expert*tree*video.board.fromVert: vendor +*expert*tree*video.board.fromHoriz: boardL +*expert*tree*video.busidL.width: 78 +*expert*tree*video.busidL.label: BusID +*expert*tree*video.busidL.fromVert: board +*expert*tree*video.busid.fromVert: board +*expert*tree*video.busid.fromHoriz: busidL +*expert*tree*video.driverL.width: 78 +*expert*tree*video.driverL.label: Driver +*expert*tree*video.driverL.fromVert: busid +*expert*tree*video.driver.fromVert: busid +*expert*tree*video.driver.fromHoriz: driverL +*expert*tree*video.value.fromHoriz: new +*expert*tree*video.value.width: 78 +*expert*tree*VideoPort.fromVert: driver +*expert*tree*VideoPort.horizDistance: 120 +*expert*tree*video.value.width: 149 + +*expert*tree*port.value.fromHoriz: new +*expert*tree*port.options.fromHoriz: remove +*expert*tree*port.label.fromVert: remove +*expert*tree*port.value.width: 78 + +*expert*tree*modes.mode.fromHoriz: remove +*expert*tree*modes.value.fromHoriz: new +*expert*tree*modes.value.width: 78 + +*expert*tree*modeline.label.fromHoriz: remove +*expert*tree*modeline.modeline.fromVert: remove +*expert*tree*modeline.modeline.width: 480 +*expert*tree*modeline.value.fromHoriz: new +*expert*tree*modeline.value.width: 120 +*expert*tree*modeline.modelineNew.fromVert: value +*expert*tree*modeline.modelineNew.width: 480 + +*expert*tree*monitor.options.fromHoriz: remove +*expert*tree*monitor.label.fromHoriz: options + +*expert*tree*monitor.Label.justify: left +*expert*tree*monitor.Text.width: 120 +*expert*tree*monitor.vendorL.width: 100 +*expert*tree*monitor.vendorL.label: VendorName +*expert*tree*monitor.vendorL.fromVert: remove +*expert*tree*monitor.vendor.fromVert: remove +*expert*tree*monitor.vendor.fromHoriz: vendorL +*expert*tree*monitor.modelnameL.width: 100 +*expert*tree*monitor.modelnameL.label: ModelName +*expert*tree*monitor.modelnameL.fromVert: vendor +*expert*tree*monitor.modelname.fromVert: vendor +*expert*tree*monitor.modelname.fromHoriz: modelnameL +*expert*tree*monitor.widthL.width: 100 +*expert*tree*monitor.widthL.label: Width (mm) +*expert*tree*monitor.widthL.fromVert: modelname +*expert*tree*monitor.width.fromVert: modelname +*expert*tree*monitor.width.fromHoriz: widthL +*expert*tree*monitor.heightL.width: 100 +*expert*tree*monitor.heightL.label: Height (mm) +*expert*tree*monitor.heightL.fromVert: width +*expert*tree*monitor.height.fromVert: width +*expert*tree*monitor.height.fromHoriz: heightL +*expert*tree*monitor.hsyncL.width: 100 +*expert*tree*monitor.hsyncL.label: Hsync +*expert*tree*monitor.hsyncL.fromVert: heightL +*expert*tree*monitor.hsync.fromVert: height +*expert*tree*monitor.hsync.fromHoriz: hsyncL +*expert*tree*monitor.vrefreshL.width: 100 +*expert*tree*monitor.vrefreshL.label: Vrefresh +*expert*tree*monitor.vrefreshL.fromVert: hsync +*expert*tree*monitor.vrefresh.fromVert: hsync +*expert*tree*monitor.vrefresh.fromHoriz: vrefreshL +*expert*tree*monitor.gammaRedL.width: 100 +*expert*tree*monitor.gammaRedL.label: Gamma (red) +*expert*tree*monitor.gammaRedL.fromVert: vrefresh +*expert*tree*monitor.gammaRed.fromVert: vrefresh +*expert*tree*monitor.gammaRed.fromHoriz: gammaRedL +*expert*tree*monitor.gammaGreenL.width: 100 +*expert*tree*monitor.gammaGreenL.label: Gamma (green) +*expert*tree*monitor.gammaGreenL.fromVert: gammaRed +*expert*tree*monitor.gammaGreen.fromVert: gammaRed +*expert*tree*monitor.gammaGreen.fromHoriz: gammaGreenL +*expert*tree*monitor.gammaBlueL.width: 100 +*expert*tree*monitor.gammaBlueL.label: Gamma (blue) +*expert*tree*monitor.gammaBlueL.fromVert: gammaGreen +*expert*tree*monitor.gammaBlue.fromVert: gammaGreen +*expert*tree*monitor.gammaBlue.fromHoriz: gammaBlueL +*expert*tree*monitor.value.width: 191 +*expert*tree*monitor.value.fromHoriz: new + +*expert*tree*device.Label.justify: left +*expert*tree*device.options.fromHoriz: remove +*expert*tree*device.label.fromHoriz: options +*expert*tree*device.vendorL.label: VendorName +*expert*tree*device.vendorL.width: 100 +*expert*tree*device.vendorL.fromVert: remove +*expert*tree*device.vendor.fromVert: remove +*expert*tree*device.vendor.fromHoriz: vendorL +*expert*tree*device.boardL.label: BoardName +*expert*tree*device.boardL.width: 100 +*expert*tree*device.boardL.fromVert: vendor +*expert*tree*device.board.fromVert: vendor +*expert*tree*device.board.fromHoriz: boardL +*expert*tree*device.chipsetL.label: Chipset +*expert*tree*device.chipsetL.width: 100 +*expert*tree*device.chipsetL.fromVert: board +*expert*tree*device.chipset.fromVert: board +*expert*tree*device.chipset.fromHoriz: chipsetL +*expert*tree*device.busidL.label: BusID +*expert*tree*device.busidL.width: 100 +*expert*tree*device.busidL.fromVert: chipset +*expert*tree*device.busid.fromVert: chipset +*expert*tree*device.busid.fromHoriz: chipsetL +*expert*tree*device.cardL.label: Card +*expert*tree*device.cardL.width: 100 +*expert*tree*device.cardL.fromVert: busid +*expert*tree*device.card.fromVert: busid +*expert*tree*device.card.fromHoriz: cardL +*expert*tree*device.driverL.label: Driver +*expert*tree*device.driverL.width: 100 +*expert*tree*device.driverL.fromVert: card +*expert*tree*device.driver.fromVert: card +*expert*tree*device.driver.fromHoriz: driverL +*expert*tree*device.ramdacL.label: Ramdac +*expert*tree*device.ramdacL.width: 100 +*expert*tree*device.ramdacL.fromVert: driverL +*expert*tree*device.ramdac.fromVert: driver +*expert*tree*device.ramdac.fromHoriz: ramdacL +*expert*tree*device.dacSpeedL.label: DacSpeed +*expert*tree*device.dacSpeedL.width: 100 +*expert*tree*device.dacSpeedL.fromVert: ramdac +*expert*tree*device.dacSpeed.fromVert: ramdac +*expert*tree*device.dacSpeed.fromHoriz: dacSpeedL +*expert*tree*device.videoRamL.label: VideoRam +*expert*tree*device.videoRamL.width: 100 +*expert*tree*device.videoRamL.fromVert: dacSpeed +*expert*tree*device.videoRam.fromVert: dacSpeed +*expert*tree*device.videoRam.fromHoriz: videoRamL +*expert*tree*device.textClockFreqL.label: TextClockFreq +*expert*tree*device.textClockFreqL.width: 100 +*expert*tree*device.textClockFreqL.fromVert: videoRam +*expert*tree*device.textClockFreq.fromVert: videoRam +*expert*tree*device.textClockFreq.fromHoriz: textClockFreqL +*expert*tree*device.biosBaseL.label: BiosBase +*expert*tree*device.biosBaseL.width: 100 +*expert*tree*device.biosBaseL.fromVert: textClockFreq +*expert*tree*device.biosBase.fromVert: textClockFreq +*expert*tree*device.biosBase.fromHoriz: biosBaseL +*expert*tree*device.memBaseL.label: MemBase +*expert*tree*device.memBaseL.width: 100 +*expert*tree*device.memBaseL.fromVert: biosBase +*expert*tree*device.memBase.fromVert: biosBase +*expert*tree*device.memBase.fromHoriz: memBaseL +*expert*tree*device.ioBaseL.label: IOBase +*expert*tree*device.ioBaseL.width: 100 +*expert*tree*device.ioBaseL.fromVert: memBase +*expert*tree*device.ioBase.fromVert: memBase +*expert*tree*device.ioBase.fromHoriz: ioBaseL +*expert*tree*device.clockChipL.label: ClockChip +*expert*tree*device.clockChipL.width: 100 +*expert*tree*device.clockChipL.fromVert: ioBase +*expert*tree*device.clockChip.fromVert: ioBase +*expert*tree*device.clockChip.fromHoriz: clockChipL +*expert*tree*device.devClockL.label: Clocks +*expert*tree*device.devClockL.width: 100 +*expert*tree*device.devClockL.fromVert: clockChip +*expert*tree*device.devClock.fromVert: clockChip +*expert*tree*device.devClock.fromHoriz: devClockL +*expert*tree*device.chipIdL.label: ChipId +*expert*tree*device.chipIdL.width: 100 +*expert*tree*device.chipIdL.fromVert: devClock +*expert*tree*device.chipId.fromVert: devClock +*expert*tree*device.chipId.fromHoriz: chipIdL +*expert*tree*device.chipRevL.label: ChipRev +*expert*tree*device.chipRevL.width: 100 +*expert*tree*device.chipRevL.fromVert: chipId +*expert*tree*device.chipRev.fromVert: chipId +*expert*tree*device.chipRev.fromHoriz: chipRevL +*expert*tree*device.irqL.label: IRQ +*expert*tree*device.irqL.width: 100 +*expert*tree*device.irqL.fromVert: chipRev +*expert*tree*device.irq.fromVert: chipRev +*expert*tree*device.irq.fromHoriz: irqL +*expert*tree*device.screenL.label: Screen +*expert*tree*device.screenL.width: 100 +*expert*tree*device.screenL.fromVert: irq +*expert*tree*device.screen.fromVert: irq +*expert*tree*device.screen.fromHoriz: screenL +*expert*tree*device.value.fromHoriz: new + +*expert*tree*screen.Label.justify: left +*expert*tree*screen.options.fromHoriz: remove +*expert*tree*screen.label.fromHoriz: options +*expert*tree*screen.defaultDepthL.label: DefaultDepth +*expert*tree*screen.defaultDepthL.width: 92 +*expert*tree*screen.defaultDepthL.fromVert: remove +*expert*tree*screen.defaultDepth.fromVert: remove +*expert*tree*screen.defaultDepth.fromHoriz: defaultDepthL +*expert*tree*screen.defaultBppL.label: DefaultBpp +*expert*tree*screen.defaultBppL.width: 92 +*expert*tree*screen.defaultBppL.fromVert: defaultDepth +*expert*tree*screen.defaultBpp.fromVert: defaultDepth +*expert*tree*screen.defaultBpp.fromHoriz: defaultBppL +*expert*tree*screen.defaultFbBppL.label: DefaultFbBpp +*expert*tree*screen.defaultFbBppL.width: 92 +*expert*tree*screen.defaultFbBppL.fromVert: defaultBpp +*expert*tree*screen.defaultFbBpp.fromVert: defaultBpp +*expert*tree*screen.defaultFbBpp.fromHoriz: defaultFbBppL +*expert*tree*screen.monitorL.label: Monitor +*expert*tree*screen.monitorL.width: 92 +*expert*tree*screen.monitorL.fromVert: defaultFbBpp +*expert*tree*screen.monitor.fromVert: defaultFbBpp +*expert*tree*screen.monitor.fromHoriz: monitorL +*expert*tree*screen.deviceL.label: Device +*expert*tree*screen.deviceL.width: 92 +*expert*tree*screen.deviceL.fromVert: monitor +*expert*tree*screen.device.fromVert: monitor +*expert*tree*screen.device.fromHoriz: deviceL +*expert*tree*screen.value.fromHoriz: new + +*expert*tree*adaptor.label.fromHoriz: remove + +*expert*tree*display.Label.width: 64 +*expert*tree*display.Label.justify: left +*expert*tree*display.options.fromHoriz: remove +*expert*tree*display.viewportL.label: Viewport +*expert*tree*display.viewportL.fromVert: remove +*expert*tree*display.viewport.fromVert: remove +*expert*tree*display.viewport.fromHoriz: viewportL +*expert*tree*display.virtualL.label: Virtual +*expert*tree*display.virtualL.fromVert: viewport +*expert*tree*display.virtual.fromVert: viewport +*expert*tree*display.virtual.fromHoriz: virtualL +*expert*tree*display.depthL.label: Depth +*expert*tree*display.depthL.fromVert: virtual +*expert*tree*display.depth.fromVert: virtual +*expert*tree*display.depth.fromHoriz: depthL +*expert*tree*display.bppL.label: FbBPP +*expert*tree*display.bppL.fromVert: depth +*expert*tree*display.bpp.fromVert: depth +*expert*tree*display.bpp.fromHoriz: bppL +*expert*tree*display.visualL.label: Visual +*expert*tree*display.visualL.fromVert: bpp +*expert*tree*display.visual.fromVert: bpp +*expert*tree*display.visual.fromHoriz: visualL +*expert*tree*display.weightL.label: Weight +*expert*tree*display.weightL.fromVert: visual +*expert*tree*display.weight.fromVert: visual +*expert*tree*display.weight.fromHoriz: weightL +*expert*tree*display.blackL.label: Black +*expert*tree*display.blackL.fromVert: weight +*expert*tree*display.black.fromVert: weight +*expert*tree*display.black.fromHoriz: blackL +*expert*tree*display.whiteL.label: White +*expert*tree*display.whiteL.fromVert: black +*expert*tree*display.white.fromVert: black +*expert*tree*display.white.fromHoriz: whiteL + +*expert*tree*mode.label.fromHoriz: remove +*expert*tree*mode.value.fromHoriz: new +*expert*tree*mode.value.width: 100 + +*expert*tree*input.options.fromHoriz: remove +*expert*tree*input.label.fromHoriz: options +*expert*tree*input.driverL.label: Driver +*expert*tree*input.driverL.fromVert: remove +*expert*tree*input.driver.fromVert: remove +*expert*tree*input.driver.fromHoriz: driverL +*expert*tree*input.value.fromHoriz: new + +*expert*tree*layout.options.fromHoriz: remove +*expert*tree*layout.label.fromHoriz: options +*expert*tree*layout.value.fromHoriz: new + +*expert*tree*adjacency.Text.width: 46 +*expert*tree*adjacency.MenuButton.width: 122 +*expert*tree*adjacency.label.fromHoriz: remove +*expert*tree*adjacency.scrnumL.label: Screen number +*expert*tree*adjacency.scrnumL.horizDistance: 50 +*expert*tree*adjacency.scrnum.width: 32 +*expert*tree*adjacency.scrnumL.fromVert: remove +*expert*tree*adjacency.scrnum.fromVert: remove +*expert*tree*adjacency.scrnum.fromHoriz: scrnumL +*expert*tree*adjacency.above.label: Above +*expert*tree*adjacency.above.fromVert: scrnumL +*expert*tree*adjacency.above.vertDistance: 20 +*expert*tree*adjacency.above.horizDistance: 96 +*expert*tree*adjacency.below.label: Below +*expert*tree*adjacency.below.horizDistance: 96 +*expert*tree*adjacency.leftOf.label: LeftOf +*expert*tree*adjacency.leftOf.fromVert: above +*expert*tree*adjacency.screen.fromVert: above +*expert*tree*adjacency.screen.fromHoriz: leftOf +*expert*tree*adjacency.rightOf.label: RightOf +*expert*tree*adjacency.rightOf.fromVert: above +*expert*tree*adjacency.rightOf.fromHoriz: screen +*expert*tree*adjacency.below.fromVert: screen +*expert*tree*adjacency.relative.label: Relative +*expert*tree*adjacency.relative.horizDistance: 53 +*expert*tree*adjacency.relative.fromVert: below +*expert*tree*adjacency.absolute.fromVert: below +*expert*tree*adjacency*absolute.label: Absolute +*expert*tree*adjacency*absolute.fromHoriz: relative +*expert*tree*adjacency*adjxL.label: X +*expert*tree*adjacency*adjxL.horizDistance: 42 +*expert*tree*adjacency*adjxL.fromVert: absolute +*expert*tree*adjacency*adjx.fromVert: absolute +*expert*tree*adjacency*adjx.fromHoriz: adjxL +*expert*tree*adjacency*adjyL.label: Y +*expert*tree*adjacency*adjyL.horizDistance: 12 +*expert*tree*adjacency*adjyL.fromVert: absolute +*expert*tree*adjacency*adjyL.fromHoriz: adjx +*expert*tree*adjacency*adjy.fromVert: absolute +*expert*tree*adjacency*adjy.fromHoriz: adjyL + +*expert*tree*inputref.options.fromHoriz: remove +*expert*tree*inputref.label.fromHoriz: options + +*expert*tree*vendor.Text.width: 100 +*expert*tree*vendor.options.fromHoriz: remove +*expert*tree*vendor.label.fromHoriz: options +*expert*tree*vendor.value.fromHoriz: new + +*expert*tree*vendorSub.Text.width: 140 +*expert*tree*vendorSub.options.fromHoriz: remove +*expert*tree*vendorSub.label.fromHoriz: options +*expert*tree*vendorSub.nameL.label: Name +*expert*tree*vendorSub.nameL.fromVert: remove +*expert*tree*vendorSub.name.fromVert: remove +*expert*tree*vendorSub.name.fromHoriz: nameL +*expert*tree*vendorSub.value.fromHoriz: new + +*expert*tree*dri.Text.width: 100 +*expert*tree*dri.Label.width: 78 +*expert*tree*dri.Label.justify: left +*expert*tree*dri.nameL.label: Group name +*expert*tree*dri.name.fromHoriz: nameL +*expert*tree*dri.groupL.label: Group +*expert*tree*dri.groupL.fromVert: name +*expert*tree*dri.group.fromVert: name +*expert*tree*dri.group.fromHoriz: groupL +*expert*tree*dri.modeL.label: Mode +*expert*tree*dri.modeL.fromVert: group +*expert*tree*dri.mode.fromVert: group +*expert*tree*dri.mode.fromHoriz: modeL + +*expert*tree*buffers.Label.width: 50 +*expert*tree*buffers.Text.width: 100 +*expert*tree*buffers.countL.label: Count +*expert*tree*buffers.countL.fromVert: remove +*expert*tree*buffers.count.fromVert: remove +*expert*tree*buffers.count.fromHoriz: countL +*expert*tree*buffers.sizeL.label: Size +*expert*tree*buffers.sizeL.fromVert: count +*expert*tree*buffers.size.fromVert: count +*expert*tree*buffers.size.fromHoriz: sizeL +*expert*tree*buffers.flagsL.label: Flags +*expert*tree*buffers.flagsL.fromVert: size +*expert*tree*buffers.flags.fromVert: size +*expert*tree*buffers.flags.fromHoriz: flagsL diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c index a8bb243d2..ee7b7d07f 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.3 2000/10/20 14:59:05 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.4 2000/12/01 23:27:54 paulo Exp $ */ #include "xf86config.h" @@ -111,7 +111,7 @@ CardConfig(XtPointer config) XtSetArg(args[0], XtNstring, card->dev_busid); XtSetValues(busid, args, 1); #ifdef USE_MODULES - XtSetArg(args[0], XtNlabel, driver_str = card->dev_driver); + XtSetArg(args[0], XtNlabel, driver_str = XtNewString(card->dev_driver)); #else XtSetArg(args[0], XtNstring, card->dev_driver); #endif @@ -136,7 +136,7 @@ CardConfig(XtPointer config) XtSetArg(args[0], XtNstring, ""); XtSetValues(busid, args, 1); #ifdef USE_MODULES - XtSetArg(args[0], XtNlabel, driver_str = "vga"); + XtSetArg(args[0], XtNlabel, driver_str = XtNewString("vga")); #else XtSetArg(args[0], XtNstring, "vga"); #endif @@ -194,8 +194,15 @@ CardConfig(XtPointer config) XtFree(card->dev_driver); card->dev_driver = XtNewString(drv_nam); +#ifdef USE_MODULES + XtFree(driver_str); +#endif + return ((XtPointer)card); } +#ifdef USE_MODULES + XtFree(driver_str); +#endif return (NULL); } @@ -249,9 +256,15 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) if (card_entry->chipset != NULL) len += XmuSnprintf(tip + len, sizeof(tip) - len, "Chipset: %s\n", card_entry->chipset); - if (card_entry->driver != NULL) + if (card_entry->driver != NULL) { +#ifdef USE_MODULES + XtFree(driver_str); + driver_str = XtNewString(card_entry->driver); + XtVaSetValues(driver, XtNlabel, driver_str, NULL, 0); +#endif len += XmuSnprintf(tip + len, sizeof(tip) - len, "Driver: %s\n", card_entry->driver); + } if (card_entry->ramdac != NULL) len += XmuSnprintf(tip + len, sizeof(tip), "Ramdac: %s\n", card_entry->ramdac); @@ -274,8 +287,10 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) else first = 0; +#ifndef USE_MODULES XtSetArg(args[0], XtNstring, card_entry->driver ? card_entry->driver : "vga"); XtSetValues(driver, args, 1); +#endif str = XtNewString(tip); XtSetArg(args[0], XtNtip, str); @@ -327,7 +342,8 @@ DriverCallback(Widget w, XtPointer user_data, XtPointer call_data) { Arg args[1]; - driver_str = XtName(w); + XtFree(driver_str); + driver_str = XtNewString(XtName(w)); XtSetArg(args[0], XtNlabel, driver_str); XtSetValues(driver, args, 1); } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h index 658072f28..cb1fd7242 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.7 2000/11/03 18:46:17 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.8 2000/11/30 20:55:16 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -176,6 +176,10 @@ Bool startx(void); void endx(void); void startaccessx(void); void ConfigCancelAction(Widget, XEvent*, String*, Cardinal*); +void ExpertConfigureStart(void); +void ExpertConfigureEnd(void); +void ExpertCloseAction(Widget, XEvent*, String*, Cardinal*); +void ExpertCallback(Widget, XtPointer, XtPointer); /* * Initialization diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c new file mode 100644 index 000000000..a3696be89 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c @@ -0,0 +1,4707 @@ +/* + * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) + * + * 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 + * CONECTIVA LINUX 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. + * + * Except as contained in this notice, the name of Conectiva Linux shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from + * Conectiva Linux. + * + * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.5 2000/12/02 15:31:02 tsi Exp $ + */ + +#include "config.h" +#include "xf86config.h" +#include "options.h" +#include "screen.h" +#include "monitor-cfg.h" +#include <X11/Shell.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/Box.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Label.h> +#include <X11/Xaw/MenuButton.h> +#include <X11/Xaw/Paned.h> +#include <X11/Xaw/Panner.h> +#include <X11/Xaw/Porthole.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/Toggle.h> +#include <X11/Xaw/Tree.h> +#include <ctype.h> + +/* + * Types + */ +typedef struct _TreeNode TreeNode; +typedef union _TreeData TreeData; +typedef void (*NodeDeleteFunc)(TreeNode*); +typedef void (*NodeUpdateFunc)(TreeNode*); + +union _TreeData { + struct { + Widget text; + } files; + struct { + Widget text; + XF86LoadPtr load; + } module; + struct { + Widget text; + XF86ConfModesPtr modes; + } modes; + struct { + Widget text, value; + XF86ConfModeLinePtr modeline; + } modeline; + struct { + Widget text, vendor, board, busid, driver; + XF86ConfVideoAdaptorPtr video; + } video; + struct { + Widget text; + XF86ConfVideoPortPtr port; + } port; + struct { + Widget text, vendor, model, width, height, hsync, vrefresh, + gammaRed, gammaGreen, gammaBlue; + XF86ConfMonitorPtr monitor; + } monitor; + struct { + Widget menu; + XF86ConfModesLinkPtr modeslink; + } modeslink; + struct { + Widget text, vendor, board, chipset, busid, card, driver, ramdac, + dacSpeed, videoRam, textClockFreq, biosBase, memBase, ioBase, + clockChip, devClock, chipId, chipRev, irq, screen; + XF86ConfDevicePtr device; + } device; + struct { + Widget text, defaultDepth, defaultBpp, defaultFbBpp, + monitor, device; + XF86ConfScreenPtr screen; + } screen; + struct { + Widget menu; + XF86ConfAdaptorLinkPtr adaptorlink; + } adaptorlink; + struct { + Widget viewport, c_virtual, depth, bpp, visual, weight, black, white; + XF86ConfDisplayPtr display; + } display; + struct { + Widget text; + XF86ModePtr mode; + } mode; + struct { + Widget text; + XF86ConfInputPtr input; + } input; + struct { + Widget text; + XF86ConfLayoutPtr layout; + } layout; + struct { + Widget menu, button, scrnum, adjx, adjy; + XF86ConfAdjacencyPtr adjacency; + } adjacency; + struct { + Widget menu; + XF86ConfInputrefPtr inputref; + } inputref; + struct { + Widget text; + XF86ConfVendorPtr vendor; + } vendor; + struct { + Widget text; + XF86ConfVendSubPtr vendsub; + } vendsub; + struct { + Widget name, group, mode; + XF86ConfDRIPtr dri; + } dri; + struct { + Widget count, size, flags; + XF86ConfBuffersPtr buffers; + } buffers; +}; + +struct _TreeNode { + Widget node, toggle, treeParent; + TreeNode *parent, *child, *next; + TreeData *data; + NodeDeleteFunc destroy; + NodeUpdateFunc update; +}; + +/* + * Prototypes + */ +static Bool ExpertInitialize(void); +static TreeNode *NewNode(TreeNode*, Widget, Widget, Widget, TreeData*); +static void DeleteNode(TreeNode*); +static void DestroyCallback(Widget, XtPointer, XtPointer); +static void PannerCallback(Widget, XtPointer, XtPointer); +static void PortholeCallback(Widget, XtPointer, XtPointer); +static void ToggleCallback(Widget, XtPointer, XtPointer); +static void ToggleNode(TreeNode*, Bool); +static void ToggleNodeRecursive(TreeNode*); +static void OptionsCallback(Widget, XtPointer, XtPointer); +static void RelayoutTree(void); +static void PopdownCallback(Widget, XtPointer, XtPointer); +static void UpdateConfig(TreeNode*); +static void DestroyTree(TreeNode*); + +static void CreateFiles(TreeNode*); +static void CreateFilesField(TreeNode*, char*, char*); +static void UpdateFiles(TreeNode*); + +static void CreateFontPath(TreeNode*, char*); +static Widget CreateFontPathField(TreeNode*, char*, Bool); +static void FontPathChanged(TreeNode*); +static void NewFontPathCallback(Widget, XtPointer, XtPointer); + +static void CreateModulePath(TreeNode*, char*); +static Widget CreateModulePathField(TreeNode*, char*, Bool); +static void ModulePathChanged(TreeNode*); +static void NewModulePathCallback(Widget, XtPointer, XtPointer); + +static void CreateModule(TreeNode*, XF86LoadPtr); +static void CreateModuleField(TreeNode*, Bool); +static void ModuleDestroy(TreeNode*); +static void NewModuleCallback(Widget, XtPointer, XtPointer); + +static void CreateModes(TreeNode*, XF86ConfModesPtr); +static void CreateModesField(TreeNode*, Bool); +static void ModesDestroy(TreeNode*); +static void NewModesCallback(Widget, XtPointer, XtPointer); +static void CreateModesModeLine(TreeNode*, XF86ConfModeLinePtr); +static void ModesModeLineDestroy(TreeNode*); +static void NewModesModeLineCallback(Widget, XtPointer, XtPointer); + +static void CreateModeLineField(TreeNode*, Bool, Bool); +static XF86ConfModeLinePtr ParseModeLine(char*, char*); + +static void CreateVideoAdaptor(TreeNode*, XF86ConfVideoAdaptorPtr); +static void CreateVideoAdaptorField(TreeNode*, Bool); +static void VideoAdaptorDestroy(TreeNode*); +static void NewVideoAdaptorCallback(Widget, XtPointer, XtPointer); +static void VideoAdaptorUpdate(TreeNode*); +static void CreateVideoPort(TreeNode*, XF86ConfVideoPortPtr); +static void CreateVideoPortField(TreeNode*, Bool); +static void VideoPortDestroy(TreeNode*); +static void NewVideoPortCallback(Widget, XtPointer, XtPointer); + +static void CreateMonitor(TreeNode*, XF86ConfMonitorPtr); +static void CreateMonitorField(TreeNode*, Bool); +static void MonitorDestroy(TreeNode*); +static void NewMonitorCallback(Widget, XtPointer, XtPointer); +static void MonitorUpdate(TreeNode*); +static void CreateMonitorModeLine(TreeNode*, XF86ConfModeLinePtr); +static void MonitorModeLineDestroy(TreeNode*); +static void NewMonitorModeLineCallback(Widget, XtPointer, XtPointer); +static void CreateMonitorModes(TreeNode*, XF86ConfModesLinkPtr); +static void CreateMonitorModesField(TreeNode*, Bool); +static void MonitorModesLinkDestroy(TreeNode*); +static void NewMonitorModesCallback(Widget, XtPointer, XtPointer); + +static void CreateDevice(TreeNode*, XF86ConfDevicePtr); +static void CreateDeviceField(TreeNode*, Bool); +static void NewDeviceCallback(Widget, XtPointer, XtPointer); +static void DeviceDestroy(TreeNode*); +static void DeviceUpdate(TreeNode*); + +static void CreateScreen(TreeNode*, XF86ConfScreenPtr); +static void CreateScreenField(TreeNode*, Bool); +static void NewScreenCallback(Widget, XtPointer, XtPointer); +static void ScreenDestroy(TreeNode*); +static void ScreenUpdate(TreeNode*); +static void CreateScreenAdaptor(TreeNode*, XF86ConfAdaptorLinkPtr); +static void CreateScreenAdaptorField(TreeNode*, Bool); +static void NewScreenAdaptorCallback(Widget, XtPointer, XtPointer); +static void ScreenAdaptorDestroy(TreeNode*); +static void CreateScreenDisplay(TreeNode*, XF86ConfDisplayPtr); +static void CreateScreenDisplayField(TreeNode*, Bool); +static void NewScreenDisplayCallback(Widget, XtPointer, XtPointer); +static void ScreenDisplayDestroy(TreeNode*); +static void ScreenDisplayUpdate(TreeNode*); +static void CreateDisplayMode(TreeNode*, XF86ModePtr); +static void CreateDisplayModeField(TreeNode*, Bool); +static void NewDisplayModeCallback(Widget, XtPointer, XtPointer); +static void DisplayModeDestroy(TreeNode*); + +static void CreateInput(TreeNode*, XF86ConfInputPtr); +static void CreateInputField(TreeNode*, Bool); +static void InputDestroy(TreeNode*); +static void NewInputCallback(Widget, XtPointer, XtPointer); + +static void CreateLayout(TreeNode*, XF86ConfLayoutPtr); +static void CreateLayoutField(TreeNode*, Bool); +static void LayoutDestroy(TreeNode*); +static void NewLayoutCallback(Widget, XtPointer, XtPointer); +static void CreateAdjacency(TreeNode*, XF86ConfAdjacencyPtr); +static void CreateAdjacencyField(TreeNode*, Bool); +static void AdjacencyDestroy(TreeNode*); +static void NewAdjacencyCallback(Widget, XtPointer, XtPointer); +static void AdjacencyMenuCallback(Widget, XtPointer, XtPointer); +static void AdjacencyToggleCallback(Widget, XtPointer, XtPointer); +static void CreateInputref(TreeNode*, XF86ConfInputrefPtr); +static void CreateInputrefField(TreeNode*, Bool); +static void InputrefDestroy(TreeNode*); +static void NewInputrefCallback(Widget, XtPointer, XtPointer); + +static void CreateVendor(TreeNode*, XF86ConfVendorPtr); +static void CreateVendorField(TreeNode*, Bool); +static void VendorDestroy(TreeNode*); +static void NewVendorCallback(Widget, XtPointer, XtPointer); +static void CreateVendorSub(TreeNode*, XF86ConfVendSubPtr); +static void CreateVendorSubField(TreeNode*, Bool); +static void NewVendorSubCallback(Widget, XtPointer, XtPointer); +static void VendorSubDestroy(TreeNode*); +static void VendorSubUpdate(TreeNode*); + +static void CreateDRI(TreeNode*, XF86ConfDRIPtr); +static void CreateDRIField(TreeNode*); +static void DRIUpdate(TreeNode*); + +static void CreateBuffers(TreeNode*, XF86ConfBuffersPtr); +static void CreateBuffersField(TreeNode*, Bool); +static void BuffersDestroy(TreeNode*); +static void NewBuffersCallback(Widget, XtPointer, XtPointer); +static void BuffersUpdate(TreeNode*); + +extern void CreateOptionsShell(void); +extern void RemoveDeviceCallback(Widget, XtPointer, XtPointer); + +/* + * Initialization + */ +static Widget shell, expert, tree, panner; +extern Widget work, optionsShell, config; +extern xf86cfgDevice cpu_device; +static TreeNode *mainNode, *monitorTree, *screenTree, *layoutTree; + +/* + * Implementation + */ +void +ExpertConfigureStart(void) +{ + ExpertInitialize(); + + XtPopup(shell, XtGrabExclusive); + if (optionsShell == NULL) + CreateOptionsShell(); + XtVaSetValues(optionsShell, XtNtransientFor, shell, NULL, 0); +} + +void +ExpertConfigureEnd(void) +{ + int i; + + XtVaSetValues(optionsShell, XtNtransientFor, toplevel, NULL, 0); + XtPopdown(shell); + + for (i = 0; i < computer.num_screens; i++) { + XF86OptionPtr option, options; + int rotate; + + options = computer.screens[i]->screen->scrn_option_lst; + if ((option = xf86findOption(options, "Rotate")) != NULL) { + if (option->opt_val != NULL) + rotate = strcasecmp(option->opt_val, "CW") == 0 ? 1 : + strcasecmp(option->opt_val, "CCW") == 0 ? -1 : 0; + XtFree(option->opt_val); + option->opt_val = XtNewString(rotate > 0 ? "CW" : "CCW"); + computer.screens[i]->rotate = rotate; + } + else + computer.screens[i]->rotate = 0; + UpdateScreenUI(); + AdjustScreenUI(); + SetTip((xf86cfgDevice*)computer.screens[i]); + } + if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst) + SetTip(&cpu_device); + for (i = 0; i < computer.num_devices; i++) + SetTip(computer.devices[i]); + + /* Need to do this to avoid all code elsewhere needing to update the + * "expert" widget tree + */ + UpdateConfig(mainNode); + DestroyTree(mainNode); + XtDestroyWidget(shell); + expert = NULL; +} + +/*ARGSUSED*/ +void +ExpertCloseAction(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + ExpertConfigureEnd(); +} + +/*ARGSUSED*/ +void +ExpertCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + ExpertConfigureStart(); +} + +/*ARGSUSED*/ +static void +PopdownCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + ExpertConfigureEnd(); +} + +/* Files */ +static void +CreateFiles(TreeNode *files) +{ + XF86ConfFilesPtr file = XF86Config->conf_files; + TreeNode *node, *fontpath, *modulepath; + Widget w; + char *value; + + value = file->file_logfile ? file->file_logfile : ""; + node = NewNode(files, NULL, NULL, files->node, + (TreeData*)XtCalloc(1, sizeof(TreeData))); + CreateFilesField(node, "LogFile", value); + files->child = node; + files->update = UpdateFiles; + + if (XF86RGB_path) + value = XF86RGB_path; + else + value = file->file_rgbpath ? file->file_rgbpath : ""; + node->next = NewNode(files, NULL, NULL, files->node, + (TreeData*)XtCalloc(1, sizeof(TreeData))); + node = node->next; + CreateFilesField(node, "RgbPath", value); + + w = XtVaCreateManagedWidget("ModulePath", toggleWidgetClass, tree, + XtNtreeParent, files->node, NULL, 0); + node->next = modulepath = NewNode(files, w, w, files->node, NULL); + node = node->next; + CreateModulePath(modulepath, NULL); + + w = XtVaCreateManagedWidget("FontPath", toggleWidgetClass, tree, + XtNtreeParent, files->node, NULL, 0); + node->next = fontpath = NewNode(files, w, w, files->node, NULL); + node = node->next; + CreateFontPath(fontpath, NULL); +} + +static void +CreateFilesField(TreeNode *node, char *name, char *value) +{ + Widget box, label, text; + + box = XtVaCreateManagedWidget(name, boxWidgetClass, tree, + XtNtreeParent, node->node, NULL, 0); + node->node = box; + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, name, NULL, 0); + text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, value, + NULL, 0); + node->data->files.text = text; +} + +static void +UpdateFiles(TreeNode *files) +{ + char *str; + + /* LogFile */ + files = files->child; + XtVaGetValues(files->data->files.text, XtNstring, &str, NULL, 0); + XtFree(XF86Config->conf_files->file_logfile); + if (*str) + XF86Config->conf_files->file_logfile = XtNewString(str); + else + XF86Config->conf_files->file_logfile = NULL; + + /* LogFile */ + files = files->next; + XtVaGetValues(files->data->files.text, XtNstring, &str, NULL, 0); + XtFree(XF86Config->conf_files->file_rgbpath); + if (*str) + XF86Config->conf_files->file_rgbpath = XtNewString(str); + else + XF86Config->conf_files->file_rgbpath = NULL; +} + +/* FontPath */ +/* Don't need to set the update tree field, as it is already set + * as the destroy field */ +static void +CreateFontPath(TreeNode *fontpath, char *path) +{ + TreeNode *prev, *node; + Widget w; + + if (path == NULL) { + if (XF86Font_path) { + path = XtNewString(XF86Font_path); + if (XF86Config->conf_files && XF86Config->conf_files->file_fontpath) { + XtFree(XF86Config->conf_files->file_fontpath); + XF86Config->conf_files->file_fontpath = XtNewString(path); + } + } + else if (XF86Config->conf_files && XF86Config->conf_files->file_fontpath) + path = XtNewString(XF86Config->conf_files->file_fontpath); + } + else { + path = XtNewString(path); + if ((prev = fontpath->child) != NULL) + while (prev->next) + prev = prev->next; + } + + if (path) { + char *s; + + for (s = strtok(path, ","); s != NULL; s = strtok(NULL, ",")) { + node = NewNode(fontpath, NULL, NULL, fontpath->node, NULL); + node->destroy = FontPathChanged; + w = CreateFontPathField(node, s, False); + if (fontpath->child == NULL) + fontpath->child = node; + else + prev->next = node; + prev = node; + } + XtFree(path); + } + + node = NewNode(fontpath, NULL, NULL, fontpath->node, NULL); + w = CreateFontPathField(node, "", True); + if (fontpath->child == NULL) + fontpath->child = node; + else + prev->next = node; +} + +static Widget +CreateFontPathField(TreeNode *fontpath, char *value, Bool addnew) +{ + Widget box, command, text; + TreeData *data; + + box = XtVaCreateWidget("fontpath", formWidgetClass, tree, + XtNtreeParent, fontpath->treeParent, NULL, 0); + fontpath->node = box; + if (!addnew) { + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, + (XtPointer)fontpath); + text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, value, NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, NewFontPathCallback, + (XtPointer)fontpath); + text = XtVaCreateManagedWidget("valueNew", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, value, NULL, 0); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->files.text = text; + fontpath->data = data; + + if (fontpath->treeParent && XtIsRealized(fontpath->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); + + return (box); +} + +static void +FontPathChanged(TreeNode *node) +{ + TreeNode *parent = node->parent; + char *fontpath = NULL, *str; + Arg args[1]; + int pos = 0, len; + + /* last node is the "new" */ + for (node = parent->child; node->next != NULL; node = node->next) { + if (pos) + fontpath[pos++] = ','; + XtSetArg(args[0], XtNstring, &str); + XtGetValues(node->data->files.text, args, 1); + len = strlen(str) + 2; + fontpath = XtRealloc(fontpath, pos + len); + strcpy(fontpath + pos, str); + pos += len - 2; + } + + if (XF86Config->conf_files->file_fontpath) + XtFree(XF86Config->conf_files->file_fontpath); + XF86Config->conf_files->file_fontpath = fontpath; +} + +static void +NewFontPathCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *fontpath, *node = (TreeNode*)user_data; + Arg args[1]; + char *str; + + XtSetArg(args[0], XtNstring, &str); + XtGetValues(node->data->files.text, args, 1); + if (*str == '\0') + return; + + fontpath = node->parent; + DeleteNode(node); + CreateFontPath(fontpath, str); + + FontPathChanged(fontpath->child); + RelayoutTree(); +} + +/* ModulePath */ +/* Don't need to set the update tree field, as it is already set + * as the destroy field */ +static void +CreateModulePath(TreeNode *modulepath, char *path) +{ + TreeNode *prev, *node; + Widget w; + + if (path == NULL) { + if (XF86Module_path) { + path = XtNewString(XF86Module_path); + if (XF86Config->conf_files && XF86Config->conf_files->file_modulepath) { + XtFree(XF86Config->conf_files->file_modulepath); + XF86Config->conf_files->file_modulepath = XtNewString(path); + } + } + else if (XF86Config->conf_files && XF86Config->conf_files->file_modulepath) + path = XtNewString(XF86Config->conf_files->file_modulepath); + } + else { + path = XtNewString(path); + if ((prev = modulepath->child) != NULL) + while (prev->next) + prev = prev->next; + } + + if (path) { + char *s; + + for (s = strtok(path, ","); s != NULL; s = strtok(NULL, ",")) { + node = NewNode(modulepath, NULL, NULL, modulepath->node, NULL); + node->destroy = ModulePathChanged; + w = CreateModulePathField(node, s, False); + if (modulepath->child == NULL) + modulepath->child = node; + else + prev->next = node; + prev = node; + } + XtFree(path); + } + + node = NewNode(modulepath, NULL, NULL, modulepath->node, NULL); + w = CreateModulePathField(node, "", True); + if (modulepath->child == NULL) + modulepath->child = node; + else + prev->next = node; +} + +static Widget +CreateModulePathField(TreeNode *modulepath, char *value, Bool addnew) +{ + Widget box, command, text; + TreeData *data; + + box = XtVaCreateWidget("modulepath", formWidgetClass, tree, + XtNtreeParent, modulepath->treeParent, NULL, 0); + modulepath->node = box; + if (!addnew) { + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, + (XtPointer)modulepath); + text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, value, NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, NewModulePathCallback, + (XtPointer)modulepath); + text = XtVaCreateManagedWidget("valueNew", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, value, NULL, 0); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->files.text = text; + modulepath->data = data; + + if (modulepath->treeParent && XtIsRealized(modulepath->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); + + return (box); +} + +static void +ModulePathChanged(TreeNode *node) +{ + TreeNode *parent = node->parent; + char *modulepath = NULL, *str; + Arg args[1]; + int pos = 0, len; + + /* last node is the "new" */ + for (node = parent->child; node->next != NULL; node = node->next) { + if (pos) + modulepath[pos++] = ','; + XtSetArg(args[0], XtNstring, &str); + XtGetValues(node->data->files.text, args, 1); + len = strlen(str) + 2; + modulepath = XtRealloc(modulepath, pos + len); + strcpy(modulepath + pos, str); + pos += len - 2; + } + + if (XF86Config->conf_files->file_modulepath) + XtFree(XF86Config->conf_files->file_modulepath); + XF86Config->conf_files->file_modulepath = modulepath; +} + +static void +NewModulePathCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *modulepath, *node = (TreeNode*)user_data; + Arg args[1]; + char *str; + + XtSetArg(args[0], XtNstring, &str); + XtGetValues(node->data->files.text, args, 1); + if (*str == '\0') + return; + + modulepath = node->parent; + DeleteNode(node); + CreateModulePath(modulepath, str); + + ModulePathChanged(modulepath->child); + RelayoutTree(); +} + +/* Module */ +static void +CreateModule(TreeNode *module, XF86LoadPtr load) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = module->child) != NULL) + while (prev->next) + prev = prev->next; + + while (load) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->module.load = load; + node = NewNode(module, NULL, NULL, module->node, data); + node->destroy = ModuleDestroy; + CreateModuleField(node, False); + if (module->child == NULL) + module->child = node; + else + prev->next = node; + prev = node; + load = (XF86LoadPtr)(load->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(module, NULL, NULL, module->node, data); + CreateModuleField(node, True); + if (module->child == NULL) + module->child = node; + else + prev->next = node; +} + +static void +CreateModuleField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("module", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86OptionPtr *options; + XF86LoadPtr load = node->data->module.load; + + options = &(load->load_opt); + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, load->load_name, NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewModuleCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->module.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +ModuleDestroy(TreeNode *node) +{ + if (node->data->module.load) + xf86removeModule(XF86Config, node->data->module.load); +} + +/*ARGSUSED*/ +static void +NewModuleCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *module, *node = (TreeNode*)user_data; + XF86LoadPtr load; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->module.text, args, 1); + if (*label == '\0') + return; + + module = node->parent; + DeleteNode(node); + load = (XF86LoadPtr)XtCalloc(1, sizeof(XF86LoadRec)); + load->load_name = XtNewString(label); + XF86Config->conf_modules->mod_load_lst = + xf86addModule(XF86Config->conf_modules->mod_load_lst, load); + + CreateModule(module, load); + RelayoutTree(); +} + +/* Modes */ +static void +CreateModes(TreeNode *parent, XF86ConfModesPtr modes) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (modes) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->modes.modes = modes; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = ModesDestroy; + CreateModesField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + + modes = (XF86ConfModesPtr)(modes->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateModesField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateModesField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("modes", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86ConfModesPtr modes = node->data->modes.modes; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("mode", toggleWidgetClass, box, + XtNlabel, modes->modes_identifier, + XtNstate, True, + NULL, 0); + node->toggle = label; + XtAddCallback(label, XtNcallback, ToggleCallback, (XtPointer)node); + CreateModesModeLine(node, node->data->modes.modes->mon_modeline_lst); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewModesCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->modes.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +ModesDestroy(TreeNode *node) +{ + if (node->data->modes.modes) { + int i; + TreeNode *mon = monitorTree->child; + + /* last one is the "new" entry */ + while (mon && mon->next) { + /* UseModes is the second entry */ + TreeNode *mod = mon->child->next->child; + CompositeWidget composite; + + while (mod && mod->next) { + TreeNode *next = mod->next; + + if (mod && strcmp(mod->data->modeslink.modeslink->ml_modes_str, + node->data->modes.modes->modes_identifier) == 0) + /* Needs to do string comparison because may be deleting + * a "test" Modes section, with no Modelines. + */ + DeleteNode(mod); + mod = next; + } + composite = (CompositeWidget)mod->data->modeslink.menu; + + for (i = 0; i < composite->composite.num_children; ++i) + if (strcmp(XtName(composite->composite.children[i]), + node->data->modes.modes->modes_identifier) == 0) + XtDestroyWidget(composite->composite.children[i]); + + mon = mon->next; + } + + xf86removeModes(XF86Config, node->data->modes.modes); + } +} + +/*ARGSUSED*/ +static void +NewModesCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfModesPtr modes; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->modes.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + modes = (XF86ConfModesPtr)XtCalloc(1, sizeof(XF86ConfModesRec)); + modes->modes_identifier = XtNewString(label); + XF86Config->conf_modes_lst = + xf86addModes(XF86Config->conf_modes_lst, modes); + + { + TreeNode *mon = monitorTree->child; + Widget sme; + + /* last one is the "new" entry */ + while (mon && mon->next) { + /* UseModes is the second entry */ + TreeNode *mod = mon->child->next->child; + + while (mod && mod->next) + mod = mod->next; + + sme = XtCreateManagedWidget(modes->modes_identifier, + smeBSBObjectClass, + mod->data->modeslink.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, NewMonitorModesCallback, + (XtPointer)mod); + + mon = mon->next; + } + } + + CreateModes(parent, modes); + RelayoutTree(); +} + +static void +CreateModesModeLine(TreeNode *parent, XF86ConfModeLinePtr modeline) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (modeline) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->modeline.modeline = modeline; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = ModesModeLineDestroy; + CreateModeLineField(node, False, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + modeline = (XF86ConfModeLinePtr)(modeline->list.next); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + CreateModeLineField(node, True, False); +} + +/* This function should allow creating modelines for the + Mode and Monitor section */ +static void +CreateModeLineField(TreeNode *node, Bool addnew, Bool monitor) +{ + Widget box, command; + char buf[512], tmp[32]; + + box = XtVaCreateWidget("modeline", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86ConfModeLinePtr mod = node->data->modeline.modeline; + + command = XtCreateManagedWidget("remove", commandWidgetClass, + box, NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, mod->ml_identifier, NULL, 0); + + XmuSnprintf(buf, sizeof(buf), "%g %d %d %d %d %d %d %d %d", + mod->ml_clock / 1000., mod->ml_hdisplay, mod->ml_hsyncstart, + mod->ml_hsyncend, mod->ml_htotal, mod->ml_vdisplay, + mod->ml_vsyncstart, mod->ml_vsyncend, mod->ml_vtotal); + if (mod->ml_flags & XF86CONF_INTERLACE) + strcat(buf, " interlace"); + if (mod->ml_flags & XF86CONF_PHSYNC) + strcat(buf, " +hsync"); + if (mod->ml_flags & XF86CONF_NHSYNC) + strcat(buf, " -hsync"); + if (mod->ml_flags & XF86CONF_PVSYNC) + strcat(buf, " +vsync"); + if (mod->ml_flags & XF86CONF_NVSYNC) + strcat(buf, " -vsync"); + if (mod->ml_flags & XF86CONF_CSYNC) + strcat(buf, " composite"); + if (mod->ml_flags & XF86CONF_PCSYNC) + strcat(buf, " +csync"); + if (mod->ml_flags & XF86CONF_NCSYNC) + strcat(buf, " -csync"); + if (mod->ml_flags & XF86CONF_DBLSCAN) + strcat(buf, " doublescan"); + if (mod->ml_flags & XF86CONF_BCAST) + strcat(buf, " bcast"); + if (mod->ml_flags & XF86CONF_HSKEW) { + XmuSnprintf(tmp, sizeof(tmp), " hskew %d", mod->ml_hskew); + strcat(buf, tmp); + } + if (mod->ml_flags & XF86CONF_VSCAN) { + XmuSnprintf(tmp, sizeof(tmp), " vscan %d", mod->ml_vscan); + strcat(buf, tmp); + } + if (mod->ml_flags & XF86CONF_CUSTOM) + strcat(buf, " custom"); + node->data->modeline.value = + XtVaCreateManagedWidget("modeline", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + } + else { + *buf = '\0'; + command = XtCreateManagedWidget("new", commandWidgetClass, + box, NULL, 0); + XtAddCallback(command, XtNcallback, monitor ? + NewMonitorModeLineCallback : NewModesModeLineCallback, + (XtPointer)node); + node->data->modeline.text = + XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, NULL, 0); + node->data->modeline.value = + XtVaCreateManagedWidget("modelineNew", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, NULL, 0); + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +ModesModeLineDestroy(TreeNode *node) +{ + if (node->data->modeline.modeline) + xf86removeModesModeLine(node->parent->data->modes.modes, + node->data->modeline.modeline); +} + +/*ARGSUSED*/ +static void +NewModesModeLineCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfModeLinePtr modeline; + Arg args[1]; + char *ident, *value; + + XtSetArg(args[0], XtNstring, &ident); + XtGetValues(node->data->modeline.text, args, 1); + XtSetArg(args[0], XtNstring, &value); + XtGetValues(node->data->modeline.value, args, 1); + if (*ident == '\0' || *value == '\0') + return; + + parent = node->parent; + DeleteNode(node); + modeline = ParseModeLine(ident, value); + parent->data->modes.modes->mon_modeline_lst = + xf86addModeLine(parent->data->modes.modes->mon_modeline_lst, modeline); + + CreateModesModeLine(parent, modeline); + RelayoutTree(); +} + +static XF86ConfModeLinePtr +ParseModeLine(char *identifier, char *modeline) +{ + XF86ConfModeLinePtr ml = (XF86ConfModeLinePtr) + XtCalloc(1, sizeof(XF86ConfModeLineRec)); + char *s, *ptr = modeline; + + /* Identifier */ + ml->ml_identifier = XtNewString(identifier); + + ml->ml_clock = (int)(strtod(ptr, &ptr) * 1000.0 + 0.5); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_hdisplay = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_hsyncstart = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_hsyncend = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_htotal = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_vdisplay = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_vsyncstart = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_vsyncend = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + ml->ml_vtotal = strtol(ptr, &ptr, 10); + while (*ptr && isspace(*ptr)) ++ptr; + + s = ptr; + while (*s) { + *s = tolower(*s); + ++s; + } + s = ptr; + + while (*ptr) { + while (*s && isspace(*s)) + s++; + ptr = s; + while (*s && !isspace(*s)) + s++; + + if (s != ptr) { + Bool done = *s == '\0'; + + *s = '\0'; + if (strcmp(ptr, "interlace") == 0) + ml->ml_flags |= XF86CONF_INTERLACE; + else if (strcmp(ptr, "+hsync") == 0) + ml->ml_flags |= XF86CONF_PHSYNC; + else if (strcmp(ptr, "-hsync") == 0) + ml->ml_flags |= XF86CONF_NHSYNC; + else if (strcmp(ptr, "+vsync") == 0) + ml->ml_flags |= XF86CONF_PVSYNC; + else if (strcmp(ptr, "-vsync") == 0) + ml->ml_flags |= XF86CONF_NVSYNC; + else if (strcmp(ptr, "composite") == 0) + ml->ml_flags |= XF86CONF_CSYNC; + else if (strcmp(ptr, "+csync") == 0) + ml->ml_flags |= XF86CONF_PCSYNC; + else if (strcmp(ptr, "-csync") == 0) + ml->ml_flags |= XF86CONF_NCSYNC; + else if (strcmp(ptr, "doublescan") == 0) + ml->ml_flags |= XF86CONF_DBLSCAN; + else if (strcmp(ptr, "bcast") == 0) + ml->ml_flags |= XF86CONF_BCAST; + else if (strcmp(ptr, "hskew") == 0) { + ++s; + while (*s && isspace(*s)) + ++s; + ptr = s; + while (*s && !isspace(*s)) + ++s; + if (ptr != s) { + ml->ml_hskew = strtol(ptr, &s, 10); + ml->ml_flags |= XF86CONF_HSKEW; + --s; + } + } + else if (strcmp(ptr, "vscan") == 0) { + ++s; + while (*s && isspace(*s)) + ++s; + ptr = s; + while (*s && !isspace(*s)) + ++s; + if (ptr != s) { + ml->ml_vscan = strtol(ptr, &s, 10); + ml->ml_flags |= XF86CONF_VSCAN; + --s; + } + } + else if (strcmp(ptr, "custom") == 0) + ml->ml_flags |= XF86CONF_CUSTOM; + ++s; + if (done) + break; + ptr = s; + } + } + + return (ml); +} + +/* VideoAdpator */ +static void +CreateVideoAdaptor(TreeNode *parent, XF86ConfVideoAdaptorPtr video) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (video) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->video.video = video; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = VideoAdaptorDestroy; + node->update = VideoAdaptorUpdate; + CreateVideoAdaptorField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + + video = (XF86ConfVideoAdaptorPtr)(video->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateVideoAdaptorField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateVideoAdaptorField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("video", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + char *str; + TreeNode *port; + XF86ConfVideoAdaptorPtr video = node->data->video.video; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, + (XtPointer)&(video->va_option_lst)); + label = XtVaCreateManagedWidget("adaptor", labelWidgetClass, box, + XtNlabel, video->va_identifier, + NULL, 0); + + XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0); + str = video->va_vendor ? video->va_vendor : ""; + node->data->video.vendor = + XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("boardL", labelWidgetClass, box, NULL, 0); + str = video->va_board ? video->va_board : ""; + node->data->video.board = + XtVaCreateManagedWidget("board", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("busidL", labelWidgetClass, box, NULL, 0); + str = video->va_busid ? video->va_busid : ""; + node->data->video.busid = + XtVaCreateManagedWidget("busid", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0); + str = video->va_driver ? video->va_driver : ""; + node->data->video.driver = + XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + label = XtVaCreateManagedWidget("VideoPort", toggleWidgetClass, tree, + XtNstate, True, + XtNtreeParent, box, + NULL, 0); + port = NewNode(node, label, label, node->node, NULL); + node->child = port; + CreateVideoPort(port, video->va_port_lst); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewVideoAdaptorCallback, + (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->video.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +VideoAdaptorDestroy(TreeNode *node) +{ + if (node->data->video.video) { + int i; + TreeNode *scrn = screenTree->child; + + /* last one is the "new" entry */ + while (scrn && scrn->next) { + /* VideoAdator is the first entry */ + TreeNode *ad = scrn->child->child; + CompositeWidget composite; + + while (ad && ad->next) { + TreeNode *next = ad->next; + + if (ad && strcmp(ad->data->adaptorlink.adaptorlink->al_adaptor_str, + node->data->video.video->va_identifier) == 0) + DeleteNode(ad); + ad = next; + } + composite = (CompositeWidget)ad->data->adaptorlink.menu; + + for (i = 0; i < composite->composite.num_children; ++i) + if (strcmp(XtName(composite->composite.children[i]), + node->data->video.video->va_identifier) == 0) + XtDestroyWidget(composite->composite.children[i]); + + scrn = scrn->next; + } + + xf86removeVideoAdaptor(XF86Config, node->data->video.video); + } +} + +/*ARGSUSED*/ +static void +NewVideoAdaptorCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfVideoAdaptorPtr video; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->video.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + video = (XF86ConfVideoAdaptorPtr) + XtCalloc(1, sizeof(XF86ConfVideoAdaptorRec)); + video->va_identifier = XtNewString(label); + XF86Config->conf_videoadaptor_lst = + xf86addVideoAdaptor(XF86Config->conf_videoadaptor_lst, video); + + { + TreeNode *scrn = screenTree->child; + Widget sme; + + /* last one is the "new" entry */ + while (scrn && scrn->next) { + /* VideoAdaptor is the first entry */ + TreeNode *ad = scrn->child->child; + + while (ad && ad->next) + ad = ad->next; + + sme = XtCreateManagedWidget(video->va_identifier, + smeBSBObjectClass, + ad->data->adaptorlink.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, NewScreenAdaptorCallback, + (XtPointer)ad); + + scrn = scrn->next; + } + } + + CreateVideoAdaptor(parent, video); + RelayoutTree(); +} + +static void +VideoAdaptorUpdate(TreeNode *node) +{ + char *str; + + /* vendor */ + XtVaGetValues(node->data->video.vendor, XtNstring, &str, NULL, 0); + XtFree(node->data->video.video->va_vendor); + if (*str) + node->data->video.video->va_vendor = XtNewString(str); + else + node->data->video.video->va_vendor = NULL; + + /* board */ + XtVaGetValues(node->data->video.board, XtNstring, &str, NULL, 0); + XtFree(node->data->video.video->va_board); + if (*str) + node->data->video.video->va_board = XtNewString(str); + else + node->data->video.video->va_board = NULL; + + /* busid */ + XtVaGetValues(node->data->video.busid, XtNstring, &str, NULL, 0); + XtFree(node->data->video.video->va_busid); + if (*str) + node->data->video.video->va_busid = XtNewString(str); + else + node->data->video.video->va_busid = NULL; + + /* driver */ + XtVaGetValues(node->data->video.driver, XtNstring, &str, NULL, 0); + XtFree(node->data->video.video->va_driver); + if (*str) + node->data->video.video->va_driver = XtNewString(str); + else + node->data->video.video->va_driver = NULL; +} + +static void +CreateVideoPort(TreeNode *parent, XF86ConfVideoPortPtr port) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (port) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->port.port = port; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = VideoPortDestroy; + CreateVideoPortField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + port = (XF86ConfVideoPortPtr)(port->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateVideoPortField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateVideoPortField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("port", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86OptionPtr *options; + XF86ConfVideoPortPtr port = node->data->port.port; + + options = &(port->vp_option_lst); + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, port->vp_identifier, NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewVideoPortCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->port.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +VideoPortDestroy(TreeNode *node) +{ + if (node->data->port.port) + xf86removeVideoPort(node->parent->parent->data->video.video, + node->data->port.port); +} + +/*ARGSUSED*/ +static void +NewVideoPortCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *video, *node = (TreeNode*)user_data; + XF86ConfVideoPortPtr port; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->port.text, args, 1); + if (*label == '\0') + return; + + video = node->parent->parent; + DeleteNode(node); + port = (XF86ConfVideoPortPtr)XtCalloc(1, sizeof(XF86ConfVideoPortRec)); + port->vp_identifier = XtNewString(label); + video->data->video.video->va_port_lst = + xf86addVideoPort(video->data->video.video->va_port_lst, port); + + CreateVideoPort(video, port); + RelayoutTree(); +} + +/* Monitor */ +static void +CreateMonitor(TreeNode *parent, XF86ConfMonitorPtr mon) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (mon) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->monitor.monitor = mon; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = MonitorDestroy; + node->update = MonitorUpdate; + CreateMonitorField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + mon = (XF86ConfMonitorPtr)(mon->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateMonitorField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateMonitorField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("monitor", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + char *str, buf[256]; + XF86OptionPtr *options; + XF86ConfMonitorPtr mon = node->data->monitor.monitor; + Widget useModes; + TreeNode *modeline, *modes, *prev; + + options = &(mon->mon_option_lst); + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, mon->mon_identifier, NULL, 0); + + XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0); + str = mon->mon_vendor ? mon->mon_vendor : ""; + node->data->monitor.vendor = + XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("modelnameL", labelWidgetClass, box, NULL, 0); + str = mon->mon_modelname ? mon->mon_modelname : ""; + node->data->monitor.model = + XtVaCreateManagedWidget("modelname", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("widthL", labelWidgetClass, box, NULL, 0); + if (mon->mon_width) + XmuSnprintf(buf, sizeof(buf), "%d", mon->mon_width); + else + *buf = '\0'; + node->data->monitor.width = + XtVaCreateManagedWidget("width", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("heightL", labelWidgetClass, box, NULL, 0); + if (mon->mon_height) + XmuSnprintf(buf, sizeof(buf), "%d", mon->mon_height); + else + *buf = '\0'; + node->data->monitor.height = + XtVaCreateManagedWidget("height", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("hsyncL", labelWidgetClass, box, NULL, 0); + if (mon->mon_n_hsync > 0) + parser_range_to_string(buf, &(mon->mon_hsync[0]), + mon->mon_n_hsync); + else + *buf = '\0'; + node->data->monitor.hsync = + XtVaCreateManagedWidget("hsync", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("vrefreshL", labelWidgetClass, box, NULL, 0); + if (mon->mon_n_vrefresh > 0) + parser_range_to_string(buf, &(mon->mon_vrefresh[0]), + mon->mon_n_vrefresh); + else + *buf = '\0'; + node->data->monitor.vrefresh = + XtVaCreateManagedWidget("vrefresh", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("gammaRedL", labelWidgetClass, box, NULL, 0); + if (mon->mon_gamma_red) + XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_red); + else + *buf = '\0'; + node->data->monitor.gammaRed = + XtVaCreateManagedWidget("gammaRed", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("gammaGreenL", labelWidgetClass, box, NULL, 0); + if (mon->mon_gamma_green) + XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_green); + else + *buf = '\0'; + node->data->monitor.gammaGreen = + XtVaCreateManagedWidget("gammaGreen", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("gammaBlueL", labelWidgetClass, box, NULL, 0); + if (mon->mon_gamma_blue) + XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_blue); + else + *buf = '\0'; + node->data->monitor.gammaBlue = + XtVaCreateManagedWidget("gammaBlue", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + if ((prev = node->child) != NULL) + while (prev->next) + prev = prev->next; + command = XtVaCreateManagedWidget("ModeLine", toggleWidgetClass, tree, + XtNstate, True, + XtNtreeParent, box, NULL, 0); + modeline = NewNode(node, command, command, node->node, NULL); + CreateMonitorModeLine(modeline, + node->data->monitor.monitor->mon_modeline_lst); + if (prev == NULL) + prev = node->child = modeline; + else { + prev->next = modeline; + prev = prev->next; + } + + useModes = XtVaCreateManagedWidget("UseModes", toggleWidgetClass, tree, + XtNstate, True, + XtNtreeParent, box, NULL, 0); + prev->next = modes = NewNode(node, useModes, useModes, node->node, NULL); + CreateMonitorModes(modes, + node->data->monitor.monitor->mon_modes_sect_lst); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewMonitorCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->monitor.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +MonitorDestroy(TreeNode *node) +{ + int i; + TreeNode *sc = screenTree; + + for (i = 0; i < computer.num_devices; i++) + if ((XF86ConfMonitorPtr)(computer.devices[i]->config) == + node->data->monitor.monitor) { + config = computer.devices[i]->widget; + RemoveDeviceCallback(NULL, NULL, NULL); + } + + if (sc) { + TreeNode *prev; + + sc = prev = sc->child; + while (sc->next) { + TreeNode *next = sc->next; + + if (sc->data->screen.screen->scrn_monitor == + node->data->monitor.monitor) { + XtDestroyWidget(sc->node); + + if (sc->child) + DestroyTree(sc->child); + if (sc->data) + XtFree((XtPointer)sc->data); + XtFree((XtPointer)sc); + + if (sc == screenTree->child) + sc = prev = next = screenTree->child = next; + else + prev->next = sc = next; + continue; + } + prev = sc; + sc = next; + } + } +} + +static void +NewMonitorCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfMonitorPtr mon; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->monitor.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + mon = (XF86ConfMonitorPtr)XtCalloc(1, sizeof(XF86ConfMonitorRec)); + mon->mon_identifier = XtNewString(label); + XF86Config->conf_monitor_lst = + xf86addMonitor(XF86Config->conf_monitor_lst, mon); + + CreateMonitor(parent, mon); + + RelayoutTree(); +} + +static void +MonitorUpdate(TreeNode *node) +{ + char *str; + + /* vendor */ + XtVaGetValues(node->data->monitor.vendor, XtNstring, &str, NULL, 0); + XtFree(node->data->monitor.monitor->mon_vendor); + if (*str) + node->data->monitor.monitor->mon_vendor = XtNewString(str); + else + node->data->monitor.monitor->mon_vendor = NULL; + + /* model */ + XtVaGetValues(node->data->monitor.model, XtNstring, &str, NULL, 0); + XtFree(node->data->monitor.monitor->mon_modelname); + if (*str) + node->data->monitor.monitor->mon_modelname = XtNewString(str); + else + node->data->monitor.monitor->mon_modelname = NULL; + + /* width */ + XtVaGetValues(node->data->monitor.width, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_width = atoi(str); + + /* height */ + XtVaGetValues(node->data->monitor.height, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_height = atoi(str); + + /* hsync */ + XtVaGetValues(node->data->monitor.hsync, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_n_hsync = + string_to_parser_range(str, + &(node->data->monitor.monitor->mon_hsync[0]), + CONF_MAX_HSYNC); + + /* vrefresh */ + XtVaGetValues(node->data->monitor.vrefresh, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_n_vrefresh = + string_to_parser_range(str, + &(node->data->monitor.monitor->mon_vrefresh[0]), + CONF_MAX_VREFRESH); + + /* gammaRed */ + XtVaGetValues(node->data->monitor.gammaRed, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_gamma_red = strtod(str, NULL); + + /* gammaGreen */ + XtVaGetValues(node->data->monitor.gammaGreen, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_gamma_green = strtod(str, NULL); + + /* gammaBlue */ + XtVaGetValues(node->data->monitor.gammaBlue, XtNstring, &str, NULL, 0); + node->data->monitor.monitor->mon_gamma_blue = strtod(str, NULL); +} + +static void +CreateMonitorModeLine(TreeNode *parent, XF86ConfModeLinePtr modeline) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (modeline) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->modeline.modeline = modeline; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = MonitorModeLineDestroy; + CreateModeLineField(node, False, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + modeline = (XF86ConfModeLinePtr)(modeline->list.next); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + CreateModeLineField(node, True, True); +} + +/*ARGUSED*/ +static void +MonitorModeLineDestroy(TreeNode *node) +{ + if (node->data->modeline.modeline) + xf86removeMonitorModeLine(node->parent->parent->data->monitor.monitor, + node->data->modeline.modeline); +} + +/*ARGSUSED*/ +static void +NewMonitorModeLineCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfModeLinePtr modeline; + Arg args[1]; + char *ident, *value; + + XtSetArg(args[0], XtNstring, &ident); + XtGetValues(node->data->modeline.text, args, 1); + XtSetArg(args[0], XtNstring, &value); + XtGetValues(node->data->modeline.value, args, 1); + if (*ident == '\0' || *value == '\0') + return; + + parent = node->parent; + DeleteNode(node); + modeline = ParseModeLine(ident, value); + parent->parent->data->monitor.monitor->mon_modeline_lst = + xf86addModeLine(parent->parent->data->monitor.monitor->mon_modeline_lst, + modeline); + + CreateMonitorModeLine(parent, modeline); + RelayoutTree(); +} + +static void +CreateMonitorModes(TreeNode *parent, XF86ConfModesLinkPtr lnk) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (lnk) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->modeslink.modeslink = lnk; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = MonitorModesLinkDestroy; + CreateMonitorModesField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + lnk = (XF86ConfModesLinkPtr)(lnk->list.next); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + CreateMonitorModesField(node, True); +} + +static void +CreateMonitorModesField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("modes", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86ConfModesLinkPtr lnk = node->data->modeslink.modeslink; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("mode", labelWidgetClass, box, + XtNlabel, lnk->ml_modes_str, NULL, 0); + } + else { + Widget sme; + XF86ConfModesPtr ptr = XF86Config->conf_modes_lst; + + command = XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, + XtNmenuName, "modesMenu", NULL, 0); + node->data->modeslink.menu = + XtVaCreatePopupShell("modesMenu", simpleMenuWidgetClass, box, + XtNleftMargin, 1, XtNrightMargin, 1, + XtNtopMargin, 1, XtNbottomMargin, 1, + NULL, 0); + while (ptr) { + sme = XtCreateManagedWidget(ptr->modes_identifier, smeBSBObjectClass, + node->data->modeslink.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, NewMonitorModesCallback, + (XtPointer)node); + ptr = (XF86ConfModesPtr)(ptr->list.next); + } + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +MonitorModesLinkDestroy(TreeNode *node) +{ + if (node->data->modeslink.modeslink) + xf86removeMonitorModesLink(node->parent->parent->data->monitor.monitor, + node->data->modeslink.modeslink); +} + +/*ARGSUSED*/ +static void +NewMonitorModesCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfModesLinkPtr link; + char *ident = XtName(w); + + parent = node->parent; + DeleteNode(node); + link = (XF86ConfModesLinkPtr)XtCalloc(1, sizeof(XF86ConfModesLinkRec)); + link->ml_modes_str = XtNewString(ident); + parent->parent->data->monitor.monitor->mon_modes_sect_lst = + xf86addModesLink(parent->parent->data->monitor.monitor->mon_modes_sect_lst, + link); + + CreateMonitorModes(parent, link); + RelayoutTree(); +} + +/* Device */ +static void +CreateDevice(TreeNode *parent, XF86ConfDevicePtr dev) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (dev) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->device.device = dev; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = DeviceDestroy; + node->update = DeviceUpdate; + CreateDeviceField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + dev = (XF86ConfDevicePtr)(dev->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateDeviceField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateDeviceField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("device", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + int i, tmp, len; + char buf[1024], *str; + XF86OptionPtr *options; + XF86ConfDevicePtr dev = node->data->device.device; + + options = &(dev->dev_option_lst); + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, dev->dev_identifier, NULL, 0); + + XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0); + str = dev->dev_vendor ? dev->dev_vendor : ""; + node->data->device.vendor = + XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("boardL", labelWidgetClass, box, NULL, 0); + str = dev->dev_board ? dev->dev_board : ""; + node->data->device.board = + XtVaCreateManagedWidget("board", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("chipsetL", labelWidgetClass, box, NULL, 0); + str = dev->dev_chipset ? dev->dev_chipset : ""; + node->data->device.chipset = + XtVaCreateManagedWidget("chipset", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("busidL", labelWidgetClass, box, NULL, 0); + str = dev->dev_busid ? dev->dev_busid : ""; + node->data->device.busid = + XtVaCreateManagedWidget("busid", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("cardL", labelWidgetClass, box, NULL, 0); + str = dev->dev_card ? dev->dev_card : ""; + node->data->device.card = + XtVaCreateManagedWidget("card", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0); + str = dev->dev_driver ? dev->dev_driver : ""; + node->data->device.driver = + XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("ramdacL", labelWidgetClass, box, NULL, 0); + str = dev->dev_ramdac ? dev->dev_ramdac : ""; + node->data->device.ramdac = + XtVaCreateManagedWidget("ramdac", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("dacSpeedL", labelWidgetClass, box, NULL, 0); + if (dev->dev_dacSpeeds[0] > 0) { + for (i = len = 0; i < CONF_MAXDACSPEEDS && + dev->dev_dacSpeeds[i] > 0; i++) { + tmp = XmuSnprintf(buf + len, sizeof(buf) - len, "%g ", + dev->dev_dacSpeeds[i] / 1000.); + len += tmp; + } + } + else + *buf = '\0'; + node->data->device.dacSpeed = + XtVaCreateManagedWidget("dacSpeed", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("videoRamL", labelWidgetClass, box, NULL, 0); + if (dev->dev_videoram) + XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_videoram); + else + *buf = '\0'; + node->data->device.videoRam = + XtVaCreateManagedWidget("videoRam", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("textClockFreqL", labelWidgetClass, box, NULL, 0); + if (dev->dev_textclockfreq) + XmuSnprintf(buf, sizeof(buf), "%.1f", + (double)dev->dev_textclockfreq / 1000.0); + else + *buf = '\0'; + node->data->device.textClockFreq = + XtVaCreateManagedWidget("textClockFreq", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("biosBaseL", labelWidgetClass, box, NULL, 0); + if (dev->dev_bios_base) + XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_bios_base); + else + *buf = '\0'; + node->data->device.biosBase = + XtVaCreateManagedWidget("biosBase", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("memBaseL", labelWidgetClass, box, NULL, 0); + if (dev->dev_mem_base) + XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_mem_base); + else + *buf = '\0'; + node->data->device.memBase = + XtVaCreateManagedWidget("memBase", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("ioBaseL", labelWidgetClass, box, NULL, 0); + if (dev->dev_io_base) + XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_io_base); + else + *buf = '\0'; + node->data->device.ioBase = + XtVaCreateManagedWidget("ioBase", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("clockChipL", labelWidgetClass, box, NULL, 0); + str = dev->dev_clockchip ? dev->dev_clockchip : ""; + node->data->device.clockChip = + XtVaCreateManagedWidget("clockChip", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + *buf = '\0'; + for (i = len = 0; i < dev->dev_clocks; i++) { + tmp = XmuSnprintf(buf + len, sizeof(buf) - len, "%.1f ", + (double)dev->dev_clock[i] / 1000.0); + len += tmp; + } + XtCreateManagedWidget("devClockL", labelWidgetClass, box, NULL, 0); + node->data->device.devClock = + XtVaCreateManagedWidget("devClock", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("chipIdL", labelWidgetClass, box, NULL, 0); + if (dev->dev_chipid != -1) + XmuSnprintf(buf, sizeof(buf), "0x%x", dev->dev_chipid); + else + *buf = '\0'; + node->data->device.chipId = + XtVaCreateManagedWidget("chipId", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("chipRevL", labelWidgetClass, box, NULL, 0); + if (dev->dev_chiprev != -1) + XmuSnprintf(buf, sizeof(buf), "0x%x", dev->dev_chiprev); + else + *buf = '\0'; + node->data->device.chipRev = + XtVaCreateManagedWidget("chipRev", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("irqL", labelWidgetClass, box, NULL, 0); + if (dev->dev_irq != -1) + XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_irq); + else + *buf = '\0'; + node->data->device.irq = + XtVaCreateManagedWidget("irq", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("screenL", labelWidgetClass, box, NULL, 0); + if (dev->dev_screen > 0) + XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_screen); + else + *buf = '\0'; + node->data->device.screen = + XtVaCreateManagedWidget("screen", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewDeviceCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->device.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +NewDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfDevicePtr dev; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->device.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + dev = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec)); + dev->dev_identifier = XtNewString(label); + XF86Config->conf_device_lst = + xf86addDevice(XF86Config->conf_device_lst, dev); + + CreateDevice(parent, dev); + + RelayoutTree(); +} + +static void +DeviceDestroy(TreeNode *node) +{ + int i; + TreeNode *sc = screenTree; + + for (i = 0; i < computer.num_devices; i++) + if ((XF86ConfDevicePtr)(computer.devices[i]->config) == + node->data->device.device) { + config = computer.devices[i]->widget; + RemoveDeviceCallback(NULL, NULL, NULL); + } + + if (sc) { + TreeNode *prev; + + sc = prev = sc->child; + while (sc->next) { + TreeNode *next = sc->next; + + if (sc->data->screen.screen->scrn_monitor == + node->data->monitor.monitor) { + XtDestroyWidget(sc->node); + + if (sc->child) + DestroyTree(sc->child); + if (sc->data) + XtFree((XtPointer)sc->data); + XtFree((XtPointer)sc); + + if (sc == screenTree->child) + sc = prev = next = screenTree->child = next; + else + prev->next = sc = next; + continue; + } + prev = sc; + sc = next; + } + } +} + +static void +DeviceUpdate(TreeNode *node) +{ + int i; + char *str, *tmp; + + /* vendor */ + XtVaGetValues(node->data->device.vendor, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_vendor); + if (*str) + node->data->device.device->dev_vendor = XtNewString(str); + else + node->data->device.device->dev_vendor = NULL; + + /* board */ + XtVaGetValues(node->data->device.board, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_board); + if (*str) + node->data->device.device->dev_board = XtNewString(str); + else + node->data->device.device->dev_board = NULL; + + /* chipset */ + XtVaGetValues(node->data->device.chipset, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_chipset); + if (*str) + node->data->device.device->dev_chipset = XtNewString(str); + else + node->data->device.device->dev_chipset = NULL; + + /* busid */ + XtVaGetValues(node->data->device.busid, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_busid); + if (*str) + node->data->device.device->dev_busid = XtNewString(str); + else + node->data->device.device->dev_busid = NULL; + + /* card */ + XtVaGetValues(node->data->device.card, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_card); + if (*str) + node->data->device.device->dev_card = XtNewString(str); + else + node->data->device.device->dev_card = NULL; + + /* driver */ + XtVaGetValues(node->data->device.driver, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_driver); + if (*str) + node->data->device.device->dev_driver = XtNewString(str); + else + node->data->device.device->dev_driver = NULL; + + /* ramdac */ + XtVaGetValues(node->data->device.ramdac, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_ramdac); + if (*str) + node->data->device.device->dev_ramdac = XtNewString(str); + else + node->data->device.device->dev_ramdac = NULL; + + /* dacSpeed */ + tmp = NULL; + XtVaGetValues(node->data->device.dacSpeed, XtNstring, &str, NULL, 0); + for (i = 0; i < CONF_MAXDACSPEEDS && str != tmp; i++) { + if ((node->data->device.device->dev_dacSpeeds[i] = + (strtod(str, &tmp) * 1000. + .5)) == 0) + break; + str = tmp; + while (isspace(*str)) + ++str; + } + + /* videoRam */ + XtVaGetValues(node->data->device.videoRam, XtNstring, &str, NULL, 0); + node->data->device.device->dev_videoram = atoi(str); + + /* textClockFreq */ + XtVaGetValues(node->data->device.textClockFreq, XtNstring, &str, NULL, 0); + node->data->device.device->dev_textclockfreq = + strtod(str, NULL) * 1000. + .5; + + /* biosBase */ + XtVaGetValues(node->data->device.biosBase, XtNstring, &str, NULL, 0); + node->data->device.device->dev_bios_base = strtoul(str, NULL, 0); + + /* memBase */ + XtVaGetValues(node->data->device.memBase, XtNstring, &str, NULL, 0); + node->data->device.device->dev_mem_base = strtoul(str, NULL, 0); + + /* ioBase */ + XtVaGetValues(node->data->device.ioBase, XtNstring, &str, NULL, 0); + node->data->device.device->dev_io_base = strtoul(str, NULL, 0); + + /* clockChip */ + XtVaGetValues(node->data->device.clockChip, XtNstring, &str, NULL, 0); + XtFree(node->data->device.device->dev_clockchip); + if (*str) + node->data->device.device->dev_clockchip = XtNewString(str); + else + node->data->device.device->dev_clockchip = NULL; + + /* devSpeed */ + tmp = NULL; + XtVaGetValues(node->data->device.devClock, XtNstring, &str, NULL, 0); + for (i = 0; i < CONF_MAXCLOCKS && str != tmp; i++) { + if ((node->data->device.device->dev_clock[i] = + (strtod(str, &tmp) * 1000. + .5)) == 0) + break; + str = tmp; + while (isspace(*str)) + ++str; + } + node->data->device.device->dev_clocks = i; + + /* chipId */ + XtVaGetValues(node->data->device.chipId, XtNstring, &str, NULL, 0); + if (*str) + node->data->device.device->dev_chipid = atoi(str); + else + node->data->device.device->dev_chipid = -1; + + /* chipRev */ + XtVaGetValues(node->data->device.chipRev, XtNstring, &str, NULL, 0); + if (*str) + node->data->device.device->dev_chiprev = atoi(str); + else + node->data->device.device->dev_chiprev = -1; + + /* irq */ + XtVaGetValues(node->data->device.irq, XtNstring, &str, NULL, 0); + if (*str) + node->data->device.device->dev_irq = atoi(str); + else + node->data->device.device->dev_irq = -1; + + /* screen */ + XtVaGetValues(node->data->device.screen, XtNstring, &str, NULL, 0); + if (*str) + node->data->device.device->dev_screen = atoi(str); + else + node->data->device.device->dev_screen = -1; +} + +/* Screen */ +static void +CreateScreen(TreeNode *parent, XF86ConfScreenPtr scrn) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (scrn) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->screen.screen = scrn; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = ScreenDestroy; + node->update = ScreenUpdate; + CreateScreenField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + scrn = (XF86ConfScreenPtr)(scrn->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateScreenField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateScreenField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("screen", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + char buf[256], *str; + XF86OptionPtr *options; + TreeNode *adaptor, *display; + XF86ConfScreenPtr scrn = node->data->screen.screen; + + options = &(scrn->scrn_option_lst); + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, scrn->scrn_identifier, NULL, 0); + + XtCreateManagedWidget("defaultDepthL", labelWidgetClass, box, NULL, 0); + if (scrn->scrn_defaultdepth) + XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultdepth); + else + *buf = '\0'; + node->data->screen.defaultDepth = + XtVaCreateManagedWidget("defaultDepth", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("defaultBppL", labelWidgetClass, box, NULL, 0); + if (scrn->scrn_defaultbpp) + XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultbpp); + else + *buf = '\0'; + node->data->screen.defaultBpp = + XtVaCreateManagedWidget("defaultBpp", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("defaultFbBppL", labelWidgetClass, box, NULL, 0); + if (scrn->scrn_defaultfbbpp) + XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultfbbpp); + else + *buf = '\0'; + node->data->screen.defaultFbBpp = + XtVaCreateManagedWidget("defaultFbBpp", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("monitorL", labelWidgetClass, box, NULL, 0); + str = scrn->scrn_monitor_str ? scrn->scrn_monitor_str : ""; + node->data->screen.monitor = + XtVaCreateManagedWidget("monitor", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("deviceL", labelWidgetClass, box, NULL, 0); + str = scrn->scrn_device_str ? scrn->scrn_device_str : ""; + node->data->screen.device = + XtVaCreateManagedWidget("device", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, + NULL, 0); + + command = XtVaCreateManagedWidget("videoAdaptor", toggleWidgetClass, + tree, XtNstate, True, + XtNtreeParent, box, NULL, 0); + adaptor = NewNode(node, command, command, node->node, NULL); + CreateScreenAdaptor(adaptor, scrn->scrn_adaptor_lst); + node->child = adaptor; + + command = XtVaCreateManagedWidget("Display", toggleWidgetClass, + tree, XtNstate, True, + XtNtreeParent, box, NULL, 0); + display = NewNode(node, command, command, node->node, NULL); + CreateScreenDisplay(display, scrn->scrn_display_lst); + adaptor->next = display; + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewScreenCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->screen.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +NewScreenCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfScreenPtr scrn; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->screen.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + scrn = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec)); + scrn->scrn_identifier = XtNewString(label); + XF86Config->conf_screen_lst = + xf86addScreen(XF86Config->conf_screen_lst, scrn); + + { + TreeNode *lay = layoutTree->child; + Widget sme; + + /* last one is the "new" entry */ + while (lay && lay->next != NULL) { + /* Adjacency is the first entry */ + TreeNode *adj = lay->child->child; + + while (adj != NULL) { + sme = XtCreateManagedWidget(label, smeBSBObjectClass, + adj->data->adjacency.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, adj->next != NULL ? + AdjacencyMenuCallback : NewAdjacencyCallback, + (XtPointer)adj); + adj = adj->next; + } + lay = lay->next; + } + } + + CreateScreen(parent, scrn); + + RelayoutTree(); +} + +static void +ScreenDestroy(TreeNode *node) +{ + if (node->data->screen.screen) { + int i; + TreeNode *lay = layoutTree->child; + + /* last one is the "new" entry */ + while (lay && lay->next) { + /* Adjacency is the first entry */ + TreeNode *adj = lay->child->child; + CompositeWidget composite; + + while (adj) { + TreeNode *next = adj->next; + + composite = (CompositeWidget)adj->data->adjacency.menu; + + for (i = 0; i < composite->composite.num_children; ++i) + if (strcmp(XtName(composite->composite.children[i]), + node->data->screen.screen->scrn_identifier) == 0) + XtDestroyWidget(composite->composite.children[i]); + + if (adj && adj->data->adjacency.adjacency && + strcmp(adj->data->adjacency.adjacency->adj_screen_str, + node->data->screen.screen->scrn_identifier) == 0) + DeleteNode(adj); + adj = next; + } + + lay = lay->next; + } + + for (i = 0; i < computer.num_screens; i++) + if (computer.screens[i]->screen == node->data->screen.screen) { + config = computer.screens[i]->widget; + RemoveDeviceCallback(NULL, NULL, NULL); + } + } +} + +static void +ScreenUpdate(TreeNode *node) +{ + char *str; + + /* defautDepth */ + XtVaGetValues(node->data->screen.defaultDepth, XtNstring, &str, NULL, 0); + node->data->screen.screen->scrn_defaultdepth = atoi(str); + + /* defautBpp */ + XtVaGetValues(node->data->screen.defaultBpp, XtNstring, &str, NULL, 0); + node->data->screen.screen->scrn_defaultbpp = atoi(str); + + /* defautFbBpp */ + XtVaGetValues(node->data->screen.defaultFbBpp, XtNstring, &str, NULL, 0); + node->data->screen.screen->scrn_defaultfbbpp = atoi(str); + + + /* XXX Monitor and Device should be changed to a menu interface */ + /* monitor */ + XtVaGetValues(node->data->screen.monitor, XtNstring, &str, NULL, 0); + XtFree(node->data->screen.screen->scrn_monitor_str); + if (*str) + node->data->screen.screen->scrn_monitor_str = XtNewString(str); + else + node->data->screen.screen->scrn_monitor_str = NULL; + + /* XXX Monitor and Device should be changed to a menu interface */ + /* device */ + XtVaGetValues(node->data->screen.device, XtNstring, &str, NULL, 0); + XtFree(node->data->screen.screen->scrn_device_str); + if (*str) + node->data->screen.screen->scrn_device_str = XtNewString(str); + else + node->data->screen.screen->scrn_device_str = NULL; +} + +static void +CreateScreenAdaptor(TreeNode *parent, XF86ConfAdaptorLinkPtr lnk) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (lnk) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->adaptorlink.adaptorlink = lnk; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = ScreenAdaptorDestroy; + CreateScreenAdaptorField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + lnk = (XF86ConfAdaptorLinkPtr)(lnk->list.next); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + CreateScreenAdaptorField(node, True); +} + +static void +CreateScreenAdaptorField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("adaptor", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86ConfAdaptorLinkPtr lnk = node->data->adaptorlink.adaptorlink; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, lnk->al_adaptor_str, NULL, 0); + } + else { + Widget sme; + XF86ConfVideoAdaptorPtr ptr = XF86Config->conf_videoadaptor_lst; + + command = XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, + XtNmenuName, "adaptorMenu", NULL, 0); + node->data->adaptorlink.menu = + XtVaCreatePopupShell("adaptorMenu", simpleMenuWidgetClass, box, + XtNleftMargin, 1, XtNrightMargin, 1, + XtNtopMargin, 1, XtNbottomMargin, 1, + NULL, 0); + while (ptr) { + sme = XtCreateManagedWidget(ptr->va_identifier, smeBSBObjectClass, + node->data->adaptorlink.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, NewScreenAdaptorCallback, + (XtPointer)node); + ptr = (XF86ConfVideoAdaptorPtr)(ptr->list.next); + } + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGSUSED*/ +static void +NewScreenAdaptorCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfAdaptorLinkPtr link; + char *ident = XtName(w); + + parent = node->parent; + DeleteNode(node); + link = (XF86ConfAdaptorLinkPtr)XtCalloc(1, sizeof(XF86ConfAdaptorLinkRec)); + link->al_adaptor_str = XtNewString(ident); + parent->parent->data->screen.screen->scrn_adaptor_lst = + xf86addScreenAdaptor(parent->parent->data->screen.screen->scrn_adaptor_lst, + link); + + CreateScreenAdaptor(parent, link); + RelayoutTree(); +} + +/*ARGUSED*/ +static void +ScreenAdaptorDestroy(TreeNode *node) +{ + if (node->data->adaptorlink.adaptorlink) + xf86removeScreenAdaptorLink(node->parent->parent->data->screen.screen, + node->data->adaptorlink.adaptorlink); +} + +static void +CreateScreenDisplay(TreeNode *parent, XF86ConfDisplayPtr dsp) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (dsp) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->display.display = dsp; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = ScreenDisplayDestroy; + node->update = ScreenDisplayUpdate; + CreateScreenDisplayField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + dsp = (XF86ConfDisplayPtr)(dsp->list.next); + } + node = NewNode(parent, NULL, NULL, parent->node, NULL); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + CreateScreenDisplayField(node, True); +} + +static void +CreateScreenDisplayField(TreeNode *node, Bool addnew) +{ + Widget box, command; + + box = XtVaCreateWidget("display", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + char *str, buf[256]; + XF86OptionPtr *options; + XF86ConfDisplayPtr dsp = node->data->display.display; + TreeNode *modes; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + options = &(dsp->disp_option_lst); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + + XtCreateManagedWidget("viewportL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_frameX0 != 0 || dsp->disp_frameY0 != 0) + XmuSnprintf(buf, sizeof(buf), "%d %d", dsp->disp_frameX0, dsp->disp_frameY0); + else + *buf = '\0'; + node->data->display.viewport = + XtVaCreateManagedWidget("viewport", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("virtualL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_virtualX != 0 || dsp->disp_virtualY != 0) + XmuSnprintf(buf, sizeof(buf), "%d %d", dsp->disp_virtualX, dsp->disp_virtualY); + else + *buf = '\0'; + node->data->display.c_virtual = + XtVaCreateManagedWidget("virtual", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("depthL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_depth != 0) + XmuSnprintf(buf, sizeof(buf), "%d", dsp->disp_depth); + else + *buf = '\0'; + node->data->display.depth = + XtVaCreateManagedWidget("depth", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("bppL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_bpp != 0) + XmuSnprintf(buf, sizeof(buf), "%d", dsp->disp_bpp); + else + *buf = '\0'; + node->data->display.bpp = + XtVaCreateManagedWidget("bpp", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("visualL", labelWidgetClass, box, NULL, 0); + str = dsp->disp_visual != NULL ? dsp->disp_visual : ""; + node->data->display.visual = + XtVaCreateManagedWidget("visual", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, NULL, 0); + + XtCreateManagedWidget("weightL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_weight.red > 0) + XmuSnprintf(buf, sizeof(buf), "%d %d %d", + dsp->disp_weight.red, dsp->disp_weight.green, dsp->disp_weight.blue); + else + *buf = '\0'; + node->data->display.weight = + XtVaCreateManagedWidget("weight", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("blackL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_black.red >= 0) + XmuSnprintf(buf, sizeof(buf), "0x%04x 0x%04x 0x%04x", + dsp->disp_black.red, dsp->disp_black.green, dsp->disp_black.blue); + else + *buf = '\0'; + node->data->display.black = + XtVaCreateManagedWidget("black", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("whiteL", labelWidgetClass, box, NULL, 0); + if (dsp->disp_white.red >= 0) + XmuSnprintf(buf, sizeof(buf), "0x%04x 0x%04x 0x%04x", + dsp->disp_white.red, dsp->disp_white.green, dsp->disp_white.blue); + else + *buf = '\0'; + node->data->display.white = + XtVaCreateManagedWidget("white", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + command = XtVaCreateManagedWidget("Modes", toggleWidgetClass, tree, + XtNstate, True, XtNtreeParent, box, + NULL, 0); + modes = NewNode(node, command, command, node->node, NULL); + node->child = modes; + CreateDisplayMode(modes, dsp->disp_mode_lst); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, NewScreenDisplayCallback, + (XtPointer)node); + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGSUSED*/ +static void +NewScreenDisplayCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfDisplayPtr dsp; + + parent = node->parent; + DeleteNode(node); + dsp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec)); + parent->parent->data->screen.screen->scrn_display_lst = + xf86addScreenDisplay(parent->parent->data->screen.screen->scrn_display_lst, + dsp); + + CreateScreenDisplay(parent, dsp); + RelayoutTree(); +} + +static void +ScreenDisplayDestroy(TreeNode *node) +{ + if (node->data->display.display) + xf86removeScreenDisplay(node->parent->parent->data->screen.screen, + node->data->display.display); +} + +static void +ScreenDisplayUpdate(TreeNode *node) +{ + char *str, *tmp; + int x, y; + + /* viewport */ + XtVaGetValues(node->data->display.viewport, XtNstring, &str, NULL, 0); + if (sscanf(str, "%d %d", &x, &y) == 2) { + node->data->display.display->disp_frameX0 = x; + node->data->display.display->disp_frameY0 = y; + } + + /* virtual */ + XtVaGetValues(node->data->display.c_virtual, XtNstring, &str, NULL, 0); + if (sscanf(str, "%d %d", &x, &y) == 2) { + node->data->display.display->disp_virtualX = x; + node->data->display.display->disp_virtualY = y; + } + + /* depth */ + XtVaGetValues(node->data->display.depth, XtNstring, &str, NULL, 0); + node->data->display.display->disp_depth = atoi(str); + + /* bpp */ + XtVaGetValues(node->data->display.bpp, XtNstring, &str, NULL, 0); + node->data->display.display->disp_bpp = atoi(str); + + /* visual */ + XtVaGetValues(node->data->display.visual, XtNstring, &str, NULL, 0); + XtFree(node->data->display.display->disp_visual); + if (*str) + node->data->display.display->disp_visual = XtNewString(str); + else + node->data->display.display->disp_visual = NULL; + + /* weight */ + XtVaGetValues(node->data->display.weight, XtNstring, &str, NULL, 0); + node->data->display.display->disp_weight.red = strtoul(str, &tmp, 0); + if (str == tmp) + node->data->display.display->disp_weight.red = 0; + else { + str = tmp; + while (isspace(*str)) + ++str; + node->data->display.display->disp_weight.green = strtoul(str, &tmp, 0); + if (str != tmp) { + str = tmp; + while (isspace(*str)) + ++str; + node->data->display.display->disp_weight.blue = strtoul(str, &tmp, 0); + } + } + + /* black */ + XtVaGetValues(node->data->display.black, XtNstring, &str, NULL, 0); + node->data->display.display->disp_black.red = strtoul(str, &tmp, 0); + if (str == tmp) + node->data->display.display->disp_black.red = -1; + else { + str = tmp; + while (isspace(*str)) + ++str; + node->data->display.display->disp_black.green = strtoul(str, &tmp, 0); + if (str != tmp) { + str = tmp; + while (isspace(*str)) + ++str; + node->data->display.display->disp_black.blue = strtoul(str, &tmp, 0); + } + } + + /* white */ + XtVaGetValues(node->data->display.white, XtNstring, &str, NULL, 0); + node->data->display.display->disp_white.red = strtoul(str, &tmp, 0); + if (str == tmp) + node->data->display.display->disp_white.red = -1; + else { + str = tmp; + while (isspace(*str)) + ++str; + node->data->display.display->disp_white.green = strtoul(str, &tmp, 0); + if (str != tmp) { + str = tmp; + while (isspace(*str)) + ++str; + node->data->display.display->disp_white.blue = strtoul(str, &tmp, 0); + } + } +} + +static void +CreateDisplayMode(TreeNode *parent, XF86ModePtr modes) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (modes) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->mode.mode = modes; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = DisplayModeDestroy; + CreateDisplayModeField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + modes = (XF86ModePtr)(modes->list.next); + } + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + CreateDisplayModeField(node, True); +} + +static void +CreateDisplayModeField(TreeNode *node, Bool addnew) +{ + Widget box, command, text; + + box = XtVaCreateWidget("mode", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + if (!addnew) { + XF86ModePtr mode = node->data->mode.mode; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, + (XtPointer)node); + text = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, mode->mode_name, NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, NewDisplayModeCallback, + (XtPointer)node); + text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, NULL, 0); + } + node->data->mode.text = text; + if (node->treeParent && XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGSUSED*/ +static void +NewDisplayModeCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ModePtr mode; + Arg args[1]; + char *ident; + + XtSetArg(args[0], XtNstring, &ident); + XtGetValues(node->data->mode.text, args, 1); + if (*ident == '\0') + return; + + parent = node->parent; + DeleteNode(node); + mode = (XF86ModePtr)XtCalloc(1, sizeof(XF86ModeRec)); + mode->mode_name = XtNewString(ident); + parent->parent->data->display.display->disp_mode_lst = + xf86addDisplayMode(parent->parent->data->display.display->disp_mode_lst, + mode); + + CreateDisplayMode(parent, mode); + RelayoutTree(); +} + +/*ARGUSED*/ +static void +DisplayModeDestroy(TreeNode *node) +{ + if (node->data->mode.mode) + xf86removeDisplayMode(node->parent->parent->data->display.display, + node->data->mode.mode); +} + +/* Input */ +static void +CreateInput(TreeNode *parent, XF86ConfInputPtr input) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (input) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->input.input = input; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = InputDestroy; + CreateInputField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + input = (XF86ConfInputPtr)(input->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateInputField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateInputField(TreeNode *node, Bool addnew) +{ + Widget box, command; + + box = XtVaCreateWidget("input", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + char *str; + XF86OptionPtr *options; + XF86ConfInputPtr inp = node->data->input.input; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + options = &(inp->inp_option_lst); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, inp->inp_identifier, NULL, 0); + + XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0); + str = inp->inp_driver != NULL ? inp->inp_driver : ""; + node->data->input.text = + XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, str, NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, NewInputCallback, + (XtPointer)node); + node->data->input.text = + XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, NULL, 0); + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGSUSED*/ +static void +NewInputCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfInputPtr input; + Arg args[1]; + char *ident; + + XtSetArg(args[0], XtNstring, &ident); + XtGetValues(node->data->input.text, args, 1); + if (*ident == '\0') + return; + + parent = node->parent; + DeleteNode(node); + input = (XF86ConfInputPtr)XtCalloc(1, sizeof(XF86ConfInputRec)); + input->inp_identifier = XtNewString(ident); + XF86Config->conf_input_lst = + xf86addInput(XF86Config->conf_input_lst, input); + + { + TreeNode *lay = layoutTree->child; + Widget sme; + + /* last one is the "new" entry */ + while (lay && lay->next != NULL) { + /* Inputref is the second entry */ + TreeNode *iref = lay->child->next->child; + + while (iref && iref->next) + iref = iref->next; + sme = XtCreateManagedWidget(ident, smeBSBObjectClass, + iref->data->inputref.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, NewInputrefCallback, + (XtPointer)iref); + lay = lay->next; + } + } + + CreateInput(parent, input); + RelayoutTree(); +} + +/*ARGUSED*/ +static void +InputDestroy(TreeNode *node) +{ + if (node->data->input.input) { + int i; + TreeNode *lay = layoutTree->child; + + /* last one is the "new" entry */ + while (lay && lay->next) { + /* Inputref is the second entry */ + TreeNode *iref = lay->child->next->child; + CompositeWidget composite; + + while (iref && iref->next) { + TreeNode *next = iref->next; + + if (iref && strcmp(iref->data->inputref.inputref->iref_inputdev_str, + node->data->input.input->inp_identifier) == 0) + DeleteNode(iref); + iref = next; + } + + composite = (CompositeWidget)iref->data->inputref.menu; + + for (i = 0; i < composite->composite.num_children; ++i) + if (strcmp(XtName(composite->composite.children[i]), + node->data->input.input->inp_identifier) == 0) + XtDestroyWidget(composite->composite.children[i]); + + lay = lay->next; + } + + for (i = 0; i < computer.num_devices; i++) + if ((XF86ConfInputPtr)(computer.devices[i]->config) == + node->data->input.input) { + config = computer.devices[i]->widget; + RemoveDeviceCallback(NULL, NULL, NULL); + } + } +} + +/* Layout */ +static void +CreateLayout(TreeNode *parent, XF86ConfLayoutPtr lay) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (lay) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->layout.layout = lay; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = LayoutDestroy; + CreateLayoutField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + lay = (XF86ConfLayoutPtr)(lay->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateLayoutField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateLayoutField(TreeNode *node, Bool addnew) +{ + Widget box, command, label; + + box = XtVaCreateWidget("layout", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + TreeNode *adjacency, *inputref; + XF86OptionPtr *options; + XF86ConfLayoutPtr lay = node->data->layout.layout; + + options = &(lay->lay_option_lst); + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, lay->lay_identifier, NULL, 0); + + command = XtVaCreateManagedWidget("Adjacency", toggleWidgetClass, tree, + XtNstate, True, XtNtreeParent, box, + NULL, 0); + adjacency = NewNode(node, command, command, box, NULL); + node->child = adjacency; + CreateAdjacency(adjacency, lay->lay_adjacency_lst); + + command = XtVaCreateManagedWidget("Inputref", toggleWidgetClass, tree, + XtNstate, True, XtNtreeParent, box, + NULL, 0); + inputref = NewNode(node, command, command, box, NULL); + adjacency->next = inputref; + CreateInputref(inputref, lay->lay_input_lst); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewLayoutCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + NULL, 0); + node->data->layout.text = label; + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +LayoutDestroy(TreeNode *node) +{ + if (node->data->layout.layout) + xf86removeLayout(XF86Config, node->data->layout.layout); +} + +/*ARGSUSED*/ +static void +NewLayoutCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfLayoutPtr lay; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->layout.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + lay = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec)); + lay->lay_identifier = XtNewString(label); + XF86Config->conf_layout_lst = xf86addLayout(XF86Config->conf_layout_lst, lay); + + CreateLayout(parent, lay); + RelayoutTree(); +} + +static void +CreateAdjacency(TreeNode *parent, XF86ConfAdjacencyPtr adj) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (adj) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->adjacency.adjacency = adj; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = AdjacencyDestroy; + CreateAdjacencyField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + adj = (XF86ConfAdjacencyPtr)(adj->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateAdjacencyField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateAdjacencyField(TreeNode *node, Bool addnew) +{ + Widget box, command, label, sme; + XF86ConfScreenPtr ptr = XF86Config->conf_screen_lst; + + box = XtVaCreateWidget("adjacency", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + node->data->adjacency.menu = + XtVaCreatePopupShell("screenMenu", simpleMenuWidgetClass, box, + XtNleftMargin, 1, XtNrightMargin, 1, + XtNtopMargin, 1, XtNbottomMargin, 1, + NULL, 0); + while (ptr) { + sme = XtCreateManagedWidget(ptr->scrn_identifier, smeBSBObjectClass, + node->data->adjacency.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, !addnew ? + AdjacencyMenuCallback : NewAdjacencyCallback, + (XtPointer)node); + ptr = (XF86ConfScreenPtr)(ptr->list.next); + } + + if (!addnew) { + char buf[32]; + Cardinal width, height; + Widget left, right, above, below, relative, absolute; + XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + label = XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, adj->adj_screen->scrn_identifier, + NULL, 0); + + XtCreateManagedWidget("scrnumL", labelWidgetClass, box, NULL, 0); + if (adj->adj_scrnum >= 0) + XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_scrnum); + else + *buf = 0; + node->data->adjacency.scrnum = + XtVaCreateManagedWidget("scrnum", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + above = XtVaCreateManagedWidget("above", toggleWidgetClass, box, + XtNstate, adj->adj_where == CONF_ADJ_ABOVE ? + True : False, NULL, 0); + XtAddCallback(above, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); + left = XtVaCreateManagedWidget("leftOf", toggleWidgetClass, box, + XtNradioGroup, above, + XtNstate, adj->adj_where == CONF_ADJ_LEFTOF ? + True : False, NULL, 0); + XtAddCallback(left, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); + + node->data->adjacency.button = + XtVaCreateManagedWidget("screen", menuButtonWidgetClass, box, + XtNmenuName, "screenMenu", NULL, 0); + + right = XtVaCreateManagedWidget("rightOf", toggleWidgetClass, box, + XtNradioGroup, left, + XtNstate, adj->adj_where == CONF_ADJ_RIGHTOF ? + True : False, NULL, 0); + XtAddCallback(right, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); + below = XtVaCreateManagedWidget("below", toggleWidgetClass, box, + XtNradioGroup, right, + XtNstate, adj->adj_where == CONF_ADJ_BELOW ? + True : False, NULL, 0); + XtAddCallback(below, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); + relative = XtVaCreateManagedWidget("relative", toggleWidgetClass, box, + XtNradioGroup, below, + XtNstate, adj->adj_where == CONF_ADJ_RELATIVE ? + True : False, NULL, 0); + XtAddCallback(relative, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); + absolute = XtVaCreateManagedWidget("absolute", toggleWidgetClass, box, + XtNradioGroup, relative, + XtNstate, adj->adj_where == CONF_ADJ_ABSOLUTE ? + True : False, NULL, 0); + XtAddCallback(absolute, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); + + XtCreateManagedWidget("adjxL", labelWidgetClass, box, NULL, 0); + XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_x); + node->data->adjacency.adjx = + XtVaCreateManagedWidget("adjx", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtCreateManagedWidget("adjyL", labelWidgetClass, box, NULL, 0); + XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_y); + node->data->adjacency.adjy = + XtVaCreateManagedWidget("adjy", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, + XtNstring, buf, NULL, 0); + + XtVaGetValues(node->data->adjacency.button, XtNwidth, &width, + XtNheight, &height, NULL, 0); + if (adj->adj_where > CONF_ADJ_ABSOLUTE && + adj->adj_where <= CONF_ADJ_RELATIVE) + XtVaSetValues(node->data->adjacency.button, XtNlabel, + adj->adj_refscreen, XtNwidth, width, + XtNheight, height, NULL, 0); + else + XtVaSetValues(node->data->adjacency.button, XtNlabel, "", + XtNwidth, width, XtNheight, height, NULL, 0); + } + else + XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, + XtNmenuName, "screenMenu", NULL, 0); + + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +AdjacencyDestroy(TreeNode *node) +{ + if (node->data->adjacency.adjacency) + xf86removeAdjacency(node->parent->parent->data->layout.layout, + node->data->adjacency.adjacency); +} + +/*ARGSUSED*/ +static void +NewAdjacencyCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfAdjacencyPtr adj; + char *ident = XtName(w); + + parent = node->parent; + DeleteNode(node); + adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec)); + adj->adj_screen = xf86findScreen(ident, XF86Config->conf_screen_lst); + parent->parent->data->layout.layout->lay_adjacency_lst = + xf86addAdjacency(parent->parent->data->layout.layout->lay_adjacency_lst, + adj); + + CreateAdjacency(parent, adj); + RelayoutTree(); +} + +/*ARGUSED*/ +static void +AdjacencyMenuCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *node = (TreeNode*)user_data; + XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; + + XtFree(adj->adj_refscreen); + adj->adj_refscreen = XtNewString(XtName(w)); + XtVaSetValues(node->data->adjacency.button, XtNlabel, XtName(w), NULL, 0); +} + +static void +AdjacencyToggleCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *node = (TreeNode*)user_data; + XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; + char *x, *y; + + if ((Bool)call_data == False) + return; + + XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL, 0); + XtVaGetValues(node->data->adjacency.adjy, XtNstring, &y, NULL, 0); + + adj->adj_x = atoi(x); + adj->adj_y = atoi(y); + + if (strcmp(XtName(w), "absolute") == 0) { + XtVaSetValues(node->data->adjacency.button, XtNlabel, "", NULL, 0); + adj->adj_where = CONF_ADJ_ABSOLUTE; + return; + } + if (strcmp(XtName(w), "relative") == 0) + adj->adj_where = CONF_ADJ_RELATIVE; + else if (strcmp(XtName(w), "leftOf") == 0) + adj->adj_where = CONF_ADJ_LEFTOF; + else if (strcmp(XtName(w), "rightOf") == 0) + adj->adj_where = CONF_ADJ_RIGHTOF; + else if (strcmp(XtName(w), "above") == 0) + adj->adj_where = CONF_ADJ_ABOVE; + else if (strcmp(XtName(w), "below") == 0) + adj->adj_where = CONF_ADJ_BELOW; +} + +/* Inputref */ +static void +CreateInputref(TreeNode *parent, XF86ConfInputrefPtr input) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (input) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->inputref.inputref = input; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = InputrefDestroy; + CreateInputrefField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + input = (XF86ConfInputrefPtr)(input->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateInputrefField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateInputrefField(TreeNode *node, Bool addnew) +{ + Widget box, command; + + box = XtVaCreateWidget("inputref", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86OptionPtr *options; + XF86ConfInputrefPtr inp = node->data->inputref.inputref; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + options = &(inp->iref_option_lst); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, inp->iref_inputdev_str, NULL, 0); + } + else { + Widget sme; + XF86ConfInputPtr ptr = XF86Config->conf_input_lst; + + XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, + XtNmenuName, "inputMenu", NULL, 0); + node->data->inputref.menu = + XtVaCreatePopupShell("inputMenu", simpleMenuWidgetClass, box, + XtNleftMargin, 1, XtNrightMargin, 1, + XtNtopMargin, 1, XtNbottomMargin, 1, + NULL, 0); + + while (ptr) { + sme = XtCreateManagedWidget(ptr->inp_identifier, smeBSBObjectClass, + node->data->inputref.menu, NULL, 0); + XtAddCallback(sme, XtNcallback, NewInputrefCallback, + (XtPointer)node); + ptr = (XF86ConfInputPtr)(ptr->list.next); + } + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGSUSED*/ +static void +NewInputrefCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfInputrefPtr input; + char *ident = XtName(w); + + parent = node->parent; + DeleteNode(node); + input = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec)); + input->iref_inputdev_str = XtNewString(ident); + parent->parent->data->layout.layout->lay_input_lst = + xf86addInputref(parent->parent->data->layout.layout->lay_input_lst, input); + + CreateInputref(parent, input); + RelayoutTree(); +} + +/*ARGUSED*/ +static void +InputrefDestroy(TreeNode *node) +{ + if (node->data->inputref.inputref) + xf86removeInputRef(node->parent->parent->data->layout.layout, node->data->inputref.inputref->iref_inputdev); +} + +/* Vendor */ +static void +CreateVendor(TreeNode *parent, XF86ConfVendorPtr vendor) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (vendor) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->vendor.vendor = vendor; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = VendorDestroy; + CreateVendorField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + vendor = (XF86ConfVendorPtr)(vendor->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateVendorField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateVendorField(TreeNode *node, Bool addnew) +{ + Widget box, command; + + box = XtVaCreateWidget("vendor", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + TreeNode *sub; + XF86OptionPtr *options; + XF86ConfVendorPtr vendor = node->data->vendor.vendor; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + options = &(vendor->vnd_option_lst); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, vendor->vnd_identifier, NULL, 0); + + command = XtVaCreateManagedWidget("VendSub", toggleWidgetClass, tree, + XtNstate, True, + XtNtreeParent, box, + NULL, 0); + sub = NewNode(node, command, command, box, NULL); + node->child = sub; + CreateVendorSub(sub, vendor->vnd_sub_lst); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewVendorCallback, (XtPointer)node); + node->data->vendor.text = + XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, NULL, 0); + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +VendorDestroy(TreeNode *node) +{ + if (node->data->vendor.vendor) + xf86removeVendor(XF86Config, node->data->vendor.vendor); +} + +static void +NewVendorCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfVendorPtr vnd; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->vendor.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + vnd = (XF86ConfVendorPtr)XtCalloc(1, sizeof(XF86ConfVendorRec)); + vnd->vnd_identifier = XtNewString(label); + XF86Config->conf_vendor_lst = xf86addVendor(XF86Config->conf_vendor_lst, vnd); + + CreateVendor(parent, vnd); + RelayoutTree(); +} + +/* VendorSub */ +static void +CreateVendorSub(TreeNode *parent, XF86ConfVendSubPtr vendor) +{ + TreeNode *prev, *node; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (vendor) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->vendsub.vendsub = vendor; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = VendorSubDestroy; + node->update = VendorSubUpdate; + CreateVendorSubField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + vendor = (XF86ConfVendSubPtr)(vendor->list.next); + } + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + node = NewNode(parent, NULL, NULL, parent->node, data); + CreateVendorSubField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateVendorSubField(TreeNode *node, Bool addnew) +{ + Widget box, command; + + box = XtVaCreateWidget("vendorSub", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + XF86OptionPtr *options; + XF86ConfVendSubPtr vendor = node->data->vendsub.vendsub; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + options = &(vendor->vs_option_lst); + command = XtCreateManagedWidget("options", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); + XtVaCreateManagedWidget("label", labelWidgetClass, box, + XtNlabel, vendor->vs_identifier, NULL, 0); + + XtCreateManagedWidget("nameL", labelWidgetClass, box, NULL, 0); + node->data->vendsub.text = + XtVaCreateManagedWidget("name", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, + vendor->vs_name ? vendor->vs_name : "", + NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewVendorSubCallback, (XtPointer)node); + node->data->vendsub.text = + XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, NULL, 0); + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +VendorSubDestroy(TreeNode *node) +{ + if (node->data->vendsub.vendsub) + xf86removeVendorSub(node->parent->parent->data->vendor.vendor, + node->data->vendsub.vendsub); +} + +static void +VendorSubUpdate(TreeNode *node) +{ + char *str; + + XtVaGetValues(node->data->vendsub.text, XtNstring, &str, NULL, 0); + XtFree(node->data->vendsub.vendsub->vs_name); + if (*str) + node->data->vendsub.vendsub->vs_name = XtNewString(str); + else + node->data->vendsub.vendsub->vs_name = NULL; +} + +static void +NewVendorSubCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfVendSubPtr vnd; + Arg args[1]; + char *label; + + XtSetArg(args[0], XtNstring, &label); + XtGetValues(node->data->vendsub.text, args, 1); + if (*label == '\0') + return; + + parent = node->parent; + DeleteNode(node); + vnd = (XF86ConfVendSubPtr)XtCalloc(1, sizeof(XF86ConfVendSubRec)); + vnd->vs_identifier = XtNewString(label); + parent->parent->data->vendor.vendor->vnd_sub_lst = + xf86addVendorSub(parent->parent->data->vendor.vendor->vnd_sub_lst, vnd); + + CreateVendorSub(parent, vnd); + RelayoutTree(); +} + +/* DRI */ +static void +CreateDRI(TreeNode *parent, XF86ConfDRIPtr dri) +{ + TreeNode *node; + TreeData *data; + + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->dri.dri = dri; + node = NewNode(parent, NULL, NULL, parent->node, data); + parent->child = node; + node->update = DRIUpdate; + CreateDRIField(node); +} + +static void +CreateDRIField(TreeNode *node) +{ + Widget box, toggle; + XF86ConfDRIPtr dri = node->data->dri.dri; + TreeNode *buffers; + char buf[32]; + + box = XtVaCreateWidget("dri", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + XtCreateManagedWidget("nameL", labelWidgetClass, box, NULL, 0); + node->data->dri.name = + XtVaCreateManagedWidget("name", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, + dri->dri_group_name ? dri->dri_group_name : "", + NULL, 0); + + XtCreateManagedWidget("groupL", labelWidgetClass, box, NULL, 0); + if (dri->dri_group >= 0) + XmuSnprintf(buf, sizeof(buf), "%d", dri->dri_group); + else + *buf = '\0'; + node->data->dri.group = + XtVaCreateManagedWidget("group", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, buf, + NULL, 0); + + XtCreateManagedWidget("modeL", labelWidgetClass, box, NULL, 0); + if (dri->dri_mode > 0) + XmuSnprintf(buf, sizeof(buf), "0%o", dri->dri_mode); + else + *buf = '\0'; + node->data->dri.mode = + XtVaCreateManagedWidget("mode", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, buf, + NULL, 0); + + toggle = XtVaCreateManagedWidget("Buffers", toggleWidgetClass, tree, + XtNstate, True, XtNtreeParent, box, + NULL, 0); + buffers = NewNode(node, toggle, toggle, box, NULL); + node->child = buffers; + CreateBuffers(buffers, dri->dri_buffers_lst); + + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +static void +DRIUpdate(TreeNode *node) +{ + char *str; + + /* name */ + XtVaGetValues(node->data->dri.name, XtNstring, &str, NULL, 0); + XtFree(node->data->dri.dri->dri_group_name); + if (*str) + node->data->dri.dri->dri_group_name = XtNewString(str); + else + node->data->dri.dri->dri_group_name = NULL; + + /* group */ + XtVaGetValues(node->data->dri.group, XtNstring, &str, NULL, 0); + if (*str) + node->data->dri.dri->dri_group = atoi(str); + else + node->data->dri.dri->dri_group = -1; + + /* mode */ + XtVaGetValues(node->data->dri.mode, XtNstring, &str, NULL, 0); + node->data->dri.dri->dri_mode = strtoul(str, NULL, 0); +} + +/* Buffers */ +static void +CreateBuffers(TreeNode *parent, XF86ConfBuffersPtr buf) +{ + TreeNode *node, *prev; + TreeData *data; + + if ((prev = parent->child) != NULL) + while (prev->next) + prev = prev->next; + + while (buf) { + data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->buffers.buffers = buf; + node = NewNode(parent, NULL, NULL, parent->node, data); + node->destroy = BuffersDestroy; + node->update = BuffersUpdate; + CreateBuffersField(node, False); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; + prev = node; + + buf = (XF86ConfBuffersPtr)(buf->list.next); + } + node = NewNode(parent, NULL, NULL, parent->node, NULL); + CreateBuffersField(node, True); + if (parent->child == NULL) + parent->child = node; + else + prev->next = node; +} + +static void +CreateBuffersField(TreeNode *node, Bool addnew) +{ + Widget box, command; + + box = XtVaCreateWidget("buffers", formWidgetClass, tree, + XtNtreeParent, node->treeParent, NULL, 0); + node->node = box; + + if (!addnew) { + char str[32]; + XF86ConfBuffersPtr buf = node->data->buffers.buffers; + + command = XtCreateManagedWidget("remove", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); + + XtCreateManagedWidget("countL", labelWidgetClass, box, NULL, 0); + XmuSnprintf(str, sizeof(str), "%d", buf->buf_count); + node->data->buffers.count = + XtVaCreateManagedWidget("count", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("sizeL", labelWidgetClass, box, NULL, 0); + XmuSnprintf(str, sizeof(str), "%d", buf->buf_size); + node->data->buffers.size = + XtVaCreateManagedWidget("size", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, str, + NULL, 0); + + XtCreateManagedWidget("flagsL", labelWidgetClass, box, NULL, 0); + node->data->buffers.flags = + XtVaCreateManagedWidget("flags", asciiTextWidgetClass, box, + XtNeditType, XawtextEdit, XtNstring, + buf->buf_flags ? buf->buf_flags : "", + NULL, 0); + } + else { + command = XtCreateManagedWidget("new", commandWidgetClass, box, + NULL, 0); + XtAddCallback(command, XtNcallback, NewBuffersCallback, (XtPointer)node); + } + if (XtIsRealized(node->treeParent)) + XtRealizeWidget(box); + XtManageChild(box); +} + +/*ARGUSED*/ +static void +BuffersDestroy(TreeNode *node) +{ + if (node->data->buffers.buffers) + xf86removeBuffers(XF86Config->conf_dri, node->data->buffers.buffers); +} + +/*ARGSUSED*/ +static void +NewBuffersCallback(Widget unused, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node = (TreeNode*)user_data; + XF86ConfBuffersPtr buf; + + parent = node->parent; + DeleteNode(node); + buf = (XF86ConfBuffersPtr)XtCalloc(1, sizeof(XF86ConfBuffersRec)); + XF86Config->conf_dri->dri_buffers_lst = + xf86addBuffers(XF86Config->conf_dri->dri_buffers_lst, buf); + + CreateBuffers(parent, buf); + RelayoutTree(); +} + +static void +BuffersUpdate(TreeNode *node) +{ + char *str; + + /* count */ + XtVaGetValues(node->data->buffers.count, XtNstring, &str, NULL, 0); + node->data->buffers.buffers->buf_count = atoi(str); + + /* size */ + XtVaGetValues(node->data->buffers.size, XtNstring, &str, NULL, 0); + node->data->buffers.buffers->buf_size = atoi(str); + + /* flags */ + XtVaGetValues(node->data->buffers.flags, XtNstring, &str, NULL, 0); + if (*str) + node->data->buffers.buffers->buf_flags = XtNewString(str); + else + node->data->buffers.buffers->buf_flags = NULL; +} + +static TreeNode * +NewNode(TreeNode *parent, Widget node, Widget toggle, Widget treeParent, + TreeData *data) +{ + TreeNode *tree = (TreeNode*)XtCalloc(1, sizeof(TreeNode)); + + tree->parent = parent; + tree->node = node; + if ((tree->toggle = toggle) != NULL) + XtAddCallback(toggle, XtNcallback, ToggleCallback, (XtPointer)tree); + tree->treeParent = treeParent; + tree->data = data; + + return (tree); +} + +static void +DeleteNode(TreeNode *node) +{ + TreeNode *ptr = node->child; + + while (ptr != NULL) { + TreeNode *next = ptr->next; + + DeleteNode(ptr); + ptr = next; + } + + if (node->parent && node->parent->child == node) + node->parent->child = node->next; + else if (node->parent) { + for (ptr = node->parent->child; ptr && ptr->next != node; + ptr = ptr->next) + ; + if (ptr) + ptr->next = node->next; + } + + if (node->destroy) + (node->destroy)(node); + if (node->data) + XtFree((XtPointer)node->data); + + /* sets treeParent to NULL so that RelayoutTree works correctly, + * as the tree will properly calculate it's new size. + */ + XtVaSetValues(node->node, XtNtreeParent, NULL, NULL, 0); + + XtDestroyWidget(node->node); + XtFree((XtPointer)node); +} + +/*ARGUSED*/ +static void +DestroyCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *node = (TreeNode*)user_data; + + DeleteNode(node); + RelayoutTree(); +} + +static void +ToggleNodeRecursive(TreeNode *node) +{ + while (node) { + if (!XtIsRealized(node->node)) + XtRealizeWidget(node->node); + XtVaSetValues(node->node, XtNtreeParent, node->treeParent, NULL, 0); + XtManageChild(node->node); + + if (node->child && !node->toggle) + ToggleNodeRecursive(node->child); + + node = node->next; + } +} + +static void +ToggleNode(TreeNode *node, Bool toggle) +{ + while (node) { + if (toggle) { + if (!XtIsRealized(node->node)) + XtRealizeWidget(node->node); + XtVaSetValues(node->node, XtNtreeParent, node->treeParent, NULL, 0); + XtManageChild(node->node); + + if (node->child && !node->toggle) + ToggleNodeRecursive(node->child); + } + else { + if (node->child) + ToggleNode(node->child, False); + XtVaSetValues(node->node, XtNtreeParent, NULL, NULL, 0); + XtUnmanageChild(node->node); + if (node->toggle) + XtVaSetValues(node->toggle, XtNstate, False, NULL, 0); + } + node = node->next; + } +} + +/* + * XXX This callback can show side effects in the way it is called. If + * the structure holding the XF86OptionPtr is reallocated, a bogus pointer + * will be passed to this callback. + */ +static void +OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + XF86OptionPtr *options = (XF86OptionPtr*)user_data; + +#ifdef USE_MODULES + OptionsPopup(options, NULL, NULL); +#else + OptionsPopup(options); +#endif +} + +static void +RelayoutTree(void) +{ + Arg args[4]; + Dimension sliderWidth, sliderHeight, canvasWidth, canvasHeight; + + XtSetArg(args[0], XtNwidth, &sliderWidth); + XtSetArg(args[1], XtNheight, &sliderHeight); + XtGetValues(shell, args, 2); + + XtSetArg(args[2], XtNwidth, &canvasWidth); + XtSetArg(args[3], XtNheight, &canvasHeight); + XtGetValues(tree, args + 2, 2); + + XtSetArg(args[0], XtNsliderWidth, sliderWidth); + XtSetArg(args[1], XtNsliderHeight, sliderHeight); + XtSetArg(args[2], XtNcanvasWidth, canvasWidth); + XtSetArg(args[3], XtNcanvasHeight, canvasHeight); + XtSetValues(panner, args, 4); +} + +static void +ToggleCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *nodeParent = (TreeNode*)user_data; + + if (nodeParent->child) { + if (XtIsRealized(tree)) + XtUnmapWidget(tree); + ToggleNode(nodeParent->child, (Bool)call_data); + RelayoutTree(); + if (XtIsRealized(tree)) + XtMapWidget(tree); + } +} + +/*ARGSUSED*/ +static void +PannerCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + Arg args[2]; + XawPannerReport *rep = (XawPannerReport *)call_data; + + XtSetArg (args[0], XtNx, -rep->slider_x); + XtSetArg (args[1], XtNy, -rep->slider_y); + XtSetValues(tree, args, 2); +} + +/*ARGSUSED*/ +static void +PortholeCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + XawPannerReport *rep = (XawPannerReport*)call_data; + Arg args[6]; + Cardinal n = 2; + + XtSetArg (args[0], XtNsliderX, rep->slider_x); + XtSetArg (args[1], XtNsliderY, rep->slider_y); + if (rep->changed != (XawPRSliderX | XawPRSliderY)) { + XtSetArg (args[2], XtNsliderWidth, rep->slider_width); + XtSetArg (args[3], XtNsliderHeight, rep->slider_height); + XtSetArg (args[4], XtNcanvasWidth, rep->canvas_width); + XtSetArg (args[5], XtNcanvasHeight, rep->canvas_height); + n = 6; + } + XtSetValues(panner, args, n); +} + +static void +DestroyTree(TreeNode *node) +{ + while (node) { + TreeNode *next = node->next; + if (node->child) + DestroyTree(node->child); + + if (node->data) + XtFree((XtPointer)node->data); + XtFree((XtPointer)node); + + node = next; + } +} + +static void +UpdateConfig(TreeNode *node) +{ + while (node) { + if (node->child) + UpdateConfig(node->child); + if (node->update) + (node->update)(node); + node = node->next; + } +} + +static Bool +ExpertInitialize(void) +{ + Widget paned, vpane, close, config, files, modules, flags, video, modes, + monitor, device, screen, input, layout, vendor, dri; + Arg args[4]; + Dimension width, height, canvasWidth, canvasHeight; + TreeNode *node; + + if (expert != NULL) + return (False); + + shell = XtCreatePopupShell("Expert", transientShellWidgetClass, + toplevel, NULL, 0); + paned = XtVaCreateManagedWidget("paned", panedWidgetClass, shell, + XtNorientation, XtorientHorizontal, NULL, 0); + vpane = XtCreateManagedWidget("vpane", panedWidgetClass, paned, NULL, 0); + panner = XtCreateManagedWidget ("panner", pannerWidgetClass, vpane, NULL, 0); + close = XtCreateManagedWidget("close", commandWidgetClass, vpane, NULL, 0); + XtAddCallback(close, XtNcallback, PopdownCallback, NULL); + + expert = XtCreateManagedWidget("expert", portholeWidgetClass, paned, NULL, 0); + XtAddCallback(expert, XtNreportCallback, PortholeCallback, NULL); + XtAddCallback(panner, XtNreportCallback, PannerCallback, NULL); + tree = XtCreateManagedWidget("tree", treeWidgetClass, expert, NULL, 0); + + config = XtVaCreateManagedWidget("XF86Config", toggleWidgetClass, tree, + XtNstate, True, NULL, 0); + mainNode = NewNode(NULL, config, config, NULL, NULL); + + files = XtVaCreateManagedWidget("Files", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node = NewNode(mainNode, files, files, config, NULL); + mainNode->child = node; + CreateFiles(node); + + modules = XtVaCreateManagedWidget("Module", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, modules, modules, config, NULL); + node = node->next; + CreateModule(node, XF86Config->conf_modules ? + XF86Config->conf_modules->mod_load_lst : NULL); + + flags = XtVaCreateManagedWidget("ServerFlags", commandWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, flags, NULL, config, NULL); + node = node->next; + XtAddCallback(flags, XtNcallback, OptionsCallback, + (XtPointer)&(XF86Config->conf_flags->flg_option_lst)); + + video = XtVaCreateManagedWidget("VideoAdaptor", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, video, video, config, NULL); + node = node->next; + CreateVideoAdaptor(node, XF86Config->conf_videoadaptor_lst); + + modes = XtVaCreateManagedWidget("Mode", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, modes, modes, config, NULL); + node = node->next; + CreateModes(node, XF86Config->conf_modes_lst); + + monitor = XtVaCreateManagedWidget("Monitor", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, monitor, monitor, config, NULL); + node = node->next; + CreateMonitor(monitorTree = node, XF86Config->conf_monitor_lst); + + device = XtVaCreateManagedWidget("Device", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, device, device, config, NULL); + node = node->next; + CreateDevice(node, XF86Config->conf_device_lst); + + screen = XtVaCreateManagedWidget("Screen", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, screen, screen, config, NULL); + node = node->next; + CreateScreen(screenTree = node, XF86Config->conf_screen_lst); + + input = XtVaCreateManagedWidget("Input", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, input, input, config, NULL); + node = node->next; + CreateInput(node, XF86Config->conf_input_lst); + + layout = XtVaCreateManagedWidget("Layout", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, layout, layout, config, NULL); + node = node->next; + CreateLayout(layoutTree = node, XF86Config->conf_layout_lst); + + vendor = XtVaCreateManagedWidget("Vendor", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, vendor, vendor, config, NULL); + node = node->next; + CreateVendor(node, XF86Config->conf_vendor_lst); + + dri = XtVaCreateManagedWidget("DRI", toggleWidgetClass, tree, + XtNtreeParent, config, NULL, 0); + node->next = NewNode(mainNode, dri, dri, config, NULL); + node = node->next; + if (XF86Config->conf_dri == NULL) + XF86Config->conf_dri = (XF86ConfDRIPtr) + XtCalloc(1, sizeof(XF86ConfDRIRec)); + CreateDRI(node, XF86Config->conf_dri); + + XtRealizeWidget(shell); + + XtSetArg(args[0], XtNwidth, &width); + XtSetArg(args[1], XtNheight, &height); + XtGetValues(shell, args, 2); + XtSetArg(args[0], XtNwidth, width); + XtSetArg(args[1], XtNheight, height); + XtSetValues(expert, args, 2); + + XtSetArg(args[0], XtNsliderWidth, width); + XtSetArg(args[1], XtNsliderHeight, height); + XtSetArg(args[2], XtNwidth, &canvasWidth); + XtSetArg(args[3], XtNheight, &canvasHeight); + XtGetValues(tree, args + 2, 2); + XtSetArg(args[2], XtNcanvasWidth, canvasWidth); + XtSetArg(args[3], XtNcanvasHeight, canvasHeight); + XtSetValues(panner, args, 4); + + /* needs to do the apparently NOP code bellow to correctly layout the + * tree widget */ + + /* close all open entries */ + ToggleCallback(config, mainNode, (XtPointer)0); + /* open first level */ + ToggleCallback(config, mainNode, (XtPointer)1); + + XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); + + return (True); +} diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c index af1a697f3..40eac0f45 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.9 2000/11/03 18:46:17 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.11 2000/12/01 18:31:07 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -153,6 +153,7 @@ static XtActionsRec actions[] = { {"accessx-close", CloseAccessXAction}, {"testmode-cancel", CancelTestModeAction}, {"help-close", HelpCancelAction}, + {"expert-close", ExpertCloseAction}, }; static char *device_names[] = { @@ -185,7 +186,7 @@ static XrmOptionDescRec optionDescList[] = { int main(int argc, char *argv[]) { - Widget pane, popup, mouse, keyboard, card, monitor; + Widget pane, hpane, expert, popup, mouse, keyboard, card, monitor; Widget bottom, sme, smemodeline, help, quit, layopt; XColor color, tmp; Pixmap pixmap; @@ -201,31 +202,26 @@ main(int argc, char *argv[]) XFree86Dir = DefaultXFree86Dir; chdir(XFree86Dir); - + for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-xf86config") == 0) { if (i + 1 < argc) XF86Config_path = argv[++i]; - continue; } else if (strcmp(argv[i], "-modulepath") == 0) { if (i + 1 < argc) XF86Module_path = argv[++i]; - continue; } else if (strcmp(argv[i], "-serverpath") == 0) { if (i + 1 < argc) XFree86_path = argv[++i]; - continue; } else if (strcmp(argv[i], "-fontpath") == 0) { if (i + 1 < argc) XF86Font_path = argv[++i]; - continue; } else if (strcmp(argv[i], "-rgbpath") == 0) { if (i + 1 < argc) XF86RGB_path = argv[++i]; - continue; } } - + startedx = startx(); /* if (XF86Config_path == NULL) XF86Config_path = "/etc/X11/XF86Config-4";*/ @@ -253,8 +249,12 @@ main(int argc, char *argv[]) pane = XtCreateManagedWidget("pane", panedWidgetClass, toplevel, NULL, 0); + hpane = XtVaCreateManagedWidget("hpane", panedWidgetClass, pane, + XtNorientation, XtorientHorizontal, NULL, 0); menu = XtCreateManagedWidget("topM", menuButtonWidgetClass, - pane, NULL, 0); + hpane, NULL, 0); + expert = XtCreateManagedWidget("expert", commandWidgetClass, hpane, NULL, 0); + XtAddCallback(expert, XtNcallback, ExpertCallback, NULL); popup = XtCreatePopupShell("menu", simpleMenuWidgetClass, menu, NULL, 0); sme = XtCreateManagedWidget("layout", smeBSBObjectClass, @@ -447,6 +447,7 @@ AskConfig(void) if (shell_cf == NULL) { Arg args[1]; char *l, *label; + int len; shell_cf = XtCreatePopupShell("quit", transientShellWidgetClass, toplevel, NULL, 0); @@ -459,8 +460,8 @@ AskConfig(void) XSetWMProtocols(DPY, XtWindow(shell_cf), &wm_delete_window, 1); XtSetArg(args[0], XtNlabel, &l); XtGetValues(dialog, args, 1); - label = XtMalloc(strlen(l) + 12); - strcpy(label, "XF86Config\n"); + label = XtMalloc(len = (strlen(l) + strlen(XF86CONFIG) + 1)); + XmuSnprintf(label, len, "%s\n", XF86CONFIG); strcat(label, l); XtSetArg(args[0], XtNlabel, label); XtSetValues(dialog, args, 1); @@ -475,7 +476,7 @@ AskConfig(void) XtGetValues(dialog, args, 1); switch (cf_state) { case CF_XF86Config: - str = "XF86Config"; + str = XF86CONFIG; XtSetArg(args[num_args], XtNvalue, XF86Config_path); ++num_args; break; @@ -1499,41 +1500,19 @@ DisableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) } } +/* ARGSUSED */ void RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) { int i, j; - if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == config) { - xf86cfgDevice *mon, *dev; - - RemoveScreen(mon = computer.screens[i]->monitor, - dev = computer.screens[i]->card); - -/* - for (j = 0; j < computer.num_devices; j++) { - if (computer.devices[j] == mon || - computer.devices[j] == dev) { - if (--computer.devices[j]->refcount <= 0) { - XtDestroyWidget(computer.devices[j]->widget); - XtFree((XtPointer)computer.devices[j]); - if (--computer.num_devices > j) - memmove(&computer.devices[j], - &computer.devices[j + 1], - (computer.num_devices - j) * - sizeof(xf86cfgDevice*)); - --j; - } - } - } -*/ - - ScreenSetup(False); - } - return; - } + for (i = 0; i < computer.num_screens; i++) + if (computer.screens[i]->widget == config) { + RemoveScreen(computer.screens[i]->monitor, + computer.screens[i]->card); + ScreenSetup(False); + return; + } for (i = 0; i < computer.num_devices; i++) { if (computer.devices[i]->widget == config) { diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c index 4a562d422..8b811e6fb 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.2 2000/11/08 17:58:43 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.3 2000/12/01 18:31:07 paulo Exp $ */ #define LOADER_PRIVATE #include "loader.h" @@ -35,6 +35,7 @@ #ifdef USE_MODULES void xf86AddDriver(DriverPtr, void*, int); +Bool xf86ServerIsOnlyDetecting(void); xf86cfgDriverOptions *video_driver_info; @@ -229,6 +230,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86longjmp) SYMFUNC(xf86AddDriver) + SYMFUNC(xf86ServerIsOnlyDetecting) {0,0} }; @@ -341,4 +343,10 @@ xf86AddDriver(DriverPtr drv, void *module, int flags) { driver = drv; } + +Bool +xf86ServerIsOnlyDetecting(void) +{ + return (True); +} #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c index 3bfdbf57c..ddde6aace 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.3 2000/10/20 14:59:06 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.4 2000/11/30 20:55:18 paulo Exp $ */ #include "xf86config.h" @@ -52,10 +52,6 @@ static Bool MonitorConfigCheck(void); static void MonitorHsyncCallback(Widget, XtPointer, XtPointer); static void MonitorVsyncCallback(Widget, XtPointer, XtPointer); static void MonitorSelectCardCallback(Widget, XtPointer, XtPointer); -static int string_to_parser_range(char*, parser_range*, int); -#define PARSER_RANGE_SIZE 256 -/* string must have at least 256 bytes */ -static int parser_range_to_string(char*, parser_range*, int); extern void DrawCables(void); @@ -258,7 +254,7 @@ MonitorConfigCheck(void) return (True); } -static int +int string_to_parser_range(char *str, parser_range *range, int nrange) { double val; @@ -295,7 +291,7 @@ string_to_parser_range(char *str, parser_range *range, int nrange) return (i); } -static int +int parser_range_to_string(char *str, parser_range *range, int nrange) { int i, len; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.h index 8265e4340..03ca18a41 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.h,v 1.2 2000/05/18 16:29:59 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.h,v 1.3 2000/11/30 20:55:18 paulo Exp $ */ #include "config.h" @@ -40,5 +40,9 @@ XtPointer MonitorConfig(XtPointer); void MonitorLayout(XF86SetupInfo*); void MonitorVidtune(XF86SetupInfo*); +int string_to_parser_range(char*, parser_range*, int); +#define PARSER_RANGE_SIZE 256 +/* string must have at least 256 bytes */ +int parser_range_to_string(char*, parser_range*, int); #endif /* _xf86cfg_monitor_h */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c index e3ff91b51..792002001 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.3 2000/10/20 14:59:07 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.4 2000/11/30 20:55:18 paulo Exp $ */ #include "options.h" @@ -57,14 +57,22 @@ static void AddDriverOption(Widget, XtPointer, XtPointer); /* * Initialization */ +Widget optionsShell; static XF86OptionPtr *options; -static Widget shell, add, remov, update, list, name, value; +static Widget add, remov, update, list, name, value; static char *option_str; static int option_index, popped = False; /* * Implementation */ +void +CreateOptionsShell(void) +{ + optionsShell = XtCreatePopupShell("options", transientShellWidgetClass, + toplevel, NULL, 0); +} + #ifdef USE_MODULES void OptionsPopup(XF86OptionPtr *opts, char *driver, OptionInfoPtr drv_opts) @@ -91,10 +99,10 @@ OptionsPopup(XF86OptionPtr *opts) first = 0; - shell = XtCreatePopupShell("options", transientShellWidgetClass, - toplevel, NULL, 0); + if (optionsShell == NULL) + CreateOptionsShell(); pane = XtCreateManagedWidget("pane", panedWidgetClass, - shell, NULL, 0); + optionsShell, NULL, 0); form = XtCreateManagedWidget("commands", formWidgetClass, pane, NULL, 0); add = XtCreateManagedWidget("add", commandWidgetClass, @@ -142,8 +150,8 @@ OptionsPopup(XF86OptionPtr *opts) #endif XtAddCallback(popdown, XtNcallback, PopdownCallback, NULL); - XtRealizeWidget(shell); - XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); + XtRealizeWidget(optionsShell); + XSetWMProtocols(DPY, XtWindow(optionsShell), &wm_delete_window, 1); #ifdef USE_MODULES { @@ -204,10 +212,10 @@ OptionsPopup(XF86OptionPtr *opts) UpdateOptionList(); popped = True; - XtPopup(shell, XtGrabExclusive); + XtPopup(optionsShell, XtGrabExclusive); while (popped) - XtAppProcessEvent(XtWidgetToApplicationContext(shell), XtIMAll); + XtAppProcessEvent(XtWidgetToApplicationContext(optionsShell), XtIMAll); } static void @@ -263,7 +271,7 @@ UpdateOptionList(void) static void PopdownCallback(Widget w, XtPointer user_data, XtPointer call_data) { - XtPopdown(shell); + XtPopdown(optionsShell); popped = False; } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c index bda0942df..364e96fa9 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.4 2000/10/20 14:59:07 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.5 2000/12/01 18:31:07 paulo Exp $ */ #include "xf86config.h" @@ -102,8 +102,10 @@ ScreenConfig(XtPointer conf) default_depth = 8; sel_index = unsel_index = -1; for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->screen == screen) + if (computer.screens[i]->screen == screen) { + SetScreenRotate(computer.screens[i]); rotate = computer.screens[i]->rotate; + } oldrotate = rotate; ndefmodes = 0; @@ -207,7 +209,6 @@ ScreenConfig(XtPointer conf) computer.screens[i]->rotate = rotate; if (oldrotate != rotate) { - XF86OptionPtr option; static char *Rotate = "Rotate"; if (screen->scrn_option_lst != NULL) diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c index 0876e89d9..a1bbf8c8f 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.4 2000/10/20 14:59:07 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.5 2000/12/01 18:31:07 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -56,17 +56,11 @@ static int *mon_widths, *mon_heights; * Implementation */ void -CreateScreenWidget(xf86cfgScreen *screen) +SetScreenRotate(xf86cfgScreen *screen) { static char *Rotate = "Rotate", *_CW = "CW", *_CCW = "CCW"; int rotate = 0; XF86OptionPtr option, options; - Widget w = XtCreateWidget("screen", simpleWidgetClass, - XtParent(computer.cpu), NULL, 0); - - /* When this function is called, the monitor and card fields should have - * been already set. - */ /* This is the only place where xf86cfg is intrusive, and deletes options * added by the user directly in the config file. The "Rotate" option @@ -108,7 +102,15 @@ CreateScreenWidget(xf86cfgScreen *screen) XtNewString(Rotate), XtNewString(rotate > 0 ? _CW : _CCW)); screen->rotate = rotate; +} + +void +CreateScreenWidget(xf86cfgScreen *screen) +{ + Widget w = XtCreateWidget("screen", simpleWidgetClass, + XtParent(computer.cpu), NULL, 0); + SetScreenRotate(screen); XtRealizeWidget(w); screen->widget = w; screen->column = screen->row = -1; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.h index c0e30923c..7c3e2c75f 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.h,v 1.2 2000/05/18 16:30:00 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.h,v 1.3 2000/12/01 18:31:07 paulo Exp $ */ #include "xf86config.h" @@ -44,6 +44,7 @@ void RemoveScreen(xf86cfgDevice*, xf86cfgDevice*); void DrawScreen(Display*, Drawable, int, int, int, int, Bool, int); void DrawScreenMask(Display*, Drawable, GC, int, int, int, int, int); void CreateScreenWidget(xf86cfgScreen*); +void SetScreenRotate(xf86cfgScreen*); void AdjustScreenUI(void); void UpdateScreenUI(void); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c index f3053ed1e..c983bacbe 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.4 2000/11/03 18:46:18 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.5 2000/11/30 20:55:18 paulo Exp $ */ #include "config.h" @@ -60,10 +60,10 @@ startx(void) if (XFree86_path) c_pos = XmuSnprintf(commandline, sizeof(commandline), - "%s/XFree86 :8 -configure ",XFree86_path); + "%s/X :8 -configure ",XFree86_path); else c_pos = XmuSnprintf(commandline, sizeof(commandline), - "%s/bin/XFree86 :8 -configure ", XFree86Dir); + "%s/bin/X :8 -configure ", XFree86Dir); if (XF86Module_path && ((len = sizeof(commandline) - c_pos) > 0)) c_pos += XmuSnprintf(commandline + c_pos,len, " -modulepath %s",XF86Module_path); @@ -75,7 +75,7 @@ startx(void) " -rgbpath %s",XF86RGB_path); if (system(commandline) != 0) { - fprintf(stderr, "Failed to run \"XFree86 -configure\".\n"); + fprintf(stderr, "Failed to run \"X -configure\".\n"); exit(1); } @@ -96,9 +96,9 @@ startx(void) case 0: { char path[PATH_MAX]; if (XFree86_path) - XmuSnprintf(path, sizeof(path), "%s/XFree86", XFree86_path); + XmuSnprintf(path, sizeof(path), "%s/X", XFree86_path); else - XmuSnprintf(path, sizeof(path), "%s/bin/XFree86", XFree86Dir); + XmuSnprintf(path, sizeof(path), "%s/bin/X", XFree86Dir); execl(path, "X", ":8", /*"+xinerama",*/ "+accessx","-allowMouseOpenFail", "-xf86config", XF86Config_path, NULL); exit(-127); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c index 908568967..08fd8285e 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.3 2000/10/20 14:59:08 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.4 2000/11/30 20:55:18 paulo Exp $ */ #include "xf86config.h" @@ -153,7 +153,7 @@ xf86removeDevice(XF86ConfigPtr config, XF86ConfDevicePtr device) if (scr->scrn_device == device) { xf86removeScreen(config, scr); if (scr == psc) - scr = config->conf_screen_lst; + scr = psc = config->conf_screen_lst; else scr = psc; continue; @@ -206,10 +206,7 @@ xf86removeMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor) while (scr != NULL) { if (scr->scrn_monitor == monitor) { xf86removeScreen(config, scr); - if (scr == psc) - scr = config->conf_screen_lst; - else - scr = psc; + scr = psc = config->conf_screen_lst; continue; } psc = scr; @@ -310,8 +307,10 @@ xf86removeScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen) lay = (XF86ConfLayoutPtr)(lay->list.next); } + xf86freeAdaptorLinkList(screen->scrn_adaptor_lst); + xf86freeDisplayList(screen->scrn_display_lst); + XtFree(screen->scrn_identifier); - XtFree(screen->scrn_obso_driver); XtFree(screen->scrn_monitor_str); XtFree(screen->scrn_device_str); xf86optionListFree(screen->scrn_option_lst); @@ -437,6 +436,414 @@ xf86removeLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout) } int +xf86removeModule(XF86ConfigPtr config, XF86LoadPtr load) +{ + XF86LoadPtr prev, mod; + + if (config == NULL || config->conf_modules == NULL || + config->conf_modules->mod_load_lst == NULL) + return (False); + + for (mod = prev = config->conf_modules->mod_load_lst; + mod != NULL; prev = mod, mod = (XF86LoadPtr)(mod->list.next)) + if (load == mod) { + if (mod == prev) + config->conf_modules->mod_load_lst = + (XF86LoadPtr)(mod->list.next); + else + prev->list.next = mod->list.next; + XtFree(mod->load_name); + xf86optionListFree(mod->load_opt); + + return (True); + } + + return (False); +} + +int +xf86removeModes(XF86ConfigPtr config, XF86ConfModesPtr modes) +{ + XF86ConfModesPtr mod; + XF86ConfModeLinePtr ml, next; + XF86ConfMonitorPtr mon; + + if (config == NULL || modes == NULL) + return (False); + + /* check if modes is in config */ + if ((mod = config->conf_modes_lst) == modes) + config->conf_modes_lst = (XF86ConfModesPtr)(mod->list.next); + else + for (; mod != NULL; mod = (XF86ConfModesPtr)(mod->list.next)) + if ((XF86ConfModesPtr)(mod->list.next) == modes) { + mod->list.next = modes->list.next; + break; + } + + if (mod == NULL) + return (False); + + /* remove references in monitor sections */ + mon = config->conf_monitor_lst; + while (mon) { + XF86ConfModesLinkPtr m, p; + + m = p = mon->mon_modes_sect_lst; + while (m) { + if (m->ml_modes == modes) { + XtFree(m->ml_modes_str); + if (m == mon->mon_modes_sect_lst) + p = mon->mon_modes_sect_lst = + (XF86ConfModesLinkPtr)(m->list.next); + else { + p->list.next = m->list.next; + p = p->list.next; + } + XtFree((XtPointer)m); + m = p; + continue; + } + p = m; + m = (XF86ConfModesLinkPtr)(m->list.next); + } + mon = (XF86ConfMonitorPtr)(mon->list.next); + } + + /* free modelines */ + ml = modes->mon_modeline_lst; + while (ml) { + next = (XF86ConfModeLinePtr)(ml->list.next); + XtFree(ml->ml_identifier); + XtFree((XtPointer)ml); + ml = next; + } + + /* free mode */ + XtFree(modes->modes_identifier); + XtFree((XtPointer)modes); + + return (True); +} + +int +xf86removeModesModeLine(XF86ConfModesPtr modes, XF86ConfModeLinePtr modeline) +{ + XF86ConfModeLinePtr ml, prev; + + if (modes == NULL || modeline == NULL || modes->mon_modeline_lst == NULL) + return (False); + + for (ml = prev = modes->mon_modeline_lst; ml; + prev = ml, ml = (XF86ConfModeLinePtr)(ml->list.next)) + if (ml == modeline) { + if (prev == ml) + modes->mon_modeline_lst = (XF86ConfModeLinePtr)(ml->list.next); + else + prev->list.next = ml->list.next; + XtFree(modeline->ml_identifier); + XtFree((XtPointer)modeline); + return (True); + } + + return (False); +} + +int +xf86removeMonitorModeLine(XF86ConfMonitorPtr monitor, XF86ConfModeLinePtr modeline) +{ + XF86ConfModeLinePtr ml, prev; + + if (monitor == NULL || modeline == NULL || monitor->mon_modeline_lst == NULL) + return (False); + + for (ml = prev = monitor->mon_modeline_lst; ml; + prev = ml, ml = (XF86ConfModeLinePtr)(ml->list.next)) + if (ml == modeline) { + if (prev == ml) + monitor->mon_modeline_lst = (XF86ConfModeLinePtr)(ml->list.next); + else + prev->list.next = ml->list.next; + XtFree(modeline->ml_identifier); + XtFree((XtPointer)modeline); + return (True); + } + + return (False); +} + +int +xf86removeMonitorModesLink(XF86ConfMonitorPtr monitor, XF86ConfModesLinkPtr link) +{ + XF86ConfModesLinkPtr lnk, prev; + + if (monitor == NULL || link == NULL || monitor->mon_modes_sect_lst == NULL) + return (False); + + for (lnk = prev = monitor->mon_modes_sect_lst; lnk != NULL; + prev = lnk, lnk = (XF86ConfModesLinkPtr)(lnk->list.next)) + if (lnk == link) { + if (prev == lnk) + monitor->mon_modes_sect_lst = (XF86ConfModesLinkPtr)(lnk->list.next); + else + prev->list.next = lnk->list.next; + XtFree(link->ml_modes_str); + XtFree((XtPointer)link); + + return (True); + } + + return (False); +} + +int +xf86removeScreenAdaptorLink(XF86ConfScreenPtr scrn, XF86ConfAdaptorLinkPtr link) +{ + XF86ConfAdaptorLinkPtr lnk, prev; + + if (scrn == NULL || link == NULL || scrn->scrn_adaptor_lst == NULL) + return (False); + + for (lnk = prev = scrn->scrn_adaptor_lst; lnk != NULL; + prev = lnk, lnk = (XF86ConfAdaptorLinkPtr)(lnk->list.next)) + if (lnk == link) { + if (prev == lnk) + scrn->scrn_adaptor_lst = + (XF86ConfAdaptorLinkPtr)(lnk->list.next); + else + prev->list.next = lnk->list.next; + XtFree(link->al_adaptor_str); + XtFree((XtPointer)link); + + return (True); + } + + return (False); +} + +int +xf86removeScreenDisplay(XF86ConfScreenPtr scrn, XF86ConfDisplayPtr display) +{ + XF86ConfDisplayPtr dsp, prev; + + if (scrn == NULL || display == NULL || scrn->scrn_display_lst == NULL) + return (False); + + for (dsp = prev = scrn->scrn_display_lst; dsp != NULL; + prev = dsp, dsp = (XF86ConfDisplayPtr)(dsp->list.next)) + if (dsp == display) { + if (prev == dsp) + scrn->scrn_display_lst = + (XF86ConfDisplayPtr)(dsp->list.next); + else + prev->list.next = dsp->list.next; + xf86optionListFree(display->disp_option_lst); + XtFree((XtPointer)display->disp_visual); + xf86freeModeList(display->disp_mode_lst); + XtFree((XtPointer)display); + + return (True); + } + + return (False); +} + +int +xf86removeVideoAdaptor(XF86ConfigPtr config, XF86ConfVideoAdaptorPtr video) +{ + XF86ConfVideoAdaptorPtr vid; + XF86ConfScreenPtr scrn; + XF86ConfVideoPortPtr vp, next; + + if (config == NULL || video == NULL) + return (False); + + /* check if video is in config and update videoadaptor list */ + if ((vid = config->conf_videoadaptor_lst) == video) + config->conf_videoadaptor_lst = (XF86ConfVideoAdaptorPtr)(vid->list.next); + else + for (; vid != NULL; vid = (XF86ConfVideoAdaptorPtr)(vid->list.next)) + if ((XF86ConfVideoAdaptorPtr)(vid->list.next) == video) { + vid->list.next = video->list.next; + break; + } + + if (vid == NULL) + return (False); + + /* remove references in screen sections */ + scrn = config->conf_screen_lst; + while (scrn) { + XF86ConfAdaptorLinkPtr v, p; + + v = p = scrn->scrn_adaptor_lst; + while (v) { + if (v->al_adaptor == video) { + XtFree(v->al_adaptor_str); + if (v == scrn->scrn_adaptor_lst) + p = scrn->scrn_adaptor_lst = + (XF86ConfAdaptorLinkPtr)(v->list.next); + else { + p->list.next = v->list.next; + p = p->list.next; + } + XtFree((XtPointer)v); + v = p; + continue; + } + p = v; + v = (XF86ConfAdaptorLinkPtr)(v->list.next); + } + scrn = (XF86ConfScreenPtr)(scrn->list.next); + } + + /* free videoports */ + vp = video->va_port_lst; + while (vp) { + next = (XF86ConfVideoPortPtr)(vp->list.next); + XtFree(vp->vp_identifier); + xf86optionListFree(vp->vp_option_lst); + XtFree((XtPointer)vp); + vp = next; + } + + /* free videoadaptor */ + XtFree(video->va_identifier); + XtFree(video->va_vendor); + XtFree(video->va_board); + XtFree(video->va_busid); + XtFree(video->va_driver); + XtFree(video->va_fwdref); + xf86optionListFree(video->va_option_lst); + XtFree((XtPointer)video); + + return (True); +} + +int +xf86removeVideoPort(XF86ConfVideoAdaptorPtr va, XF86ConfVideoPortPtr vp) +{ + XF86ConfVideoPortPtr prev; + + if (va == NULL || vp == NULL) + return (False); + + if ((prev = va->va_port_lst) == vp) + va->va_port_lst = (XF86ConfVideoPortPtr)(va->va_port_lst->list.next); + else { + while (prev && (XF86ConfVideoPortPtr)(prev->list.next) != vp) + prev = (XF86ConfVideoPortPtr)(prev->list.next); + if (prev == NULL) + return (False); + prev->list.next = vp->list.next; + } + + xf86optionListFree(vp->vp_option_lst); + XtFree((XtPointer)vp); + + return (True); +} + +int +xf86removeDisplayMode(XF86ConfDisplayPtr display, XF86ModePtr mode) +{ + XF86ModePtr prev; + + if (display == NULL || mode == NULL) + return (False); + + if ((prev = display->disp_mode_lst) == mode) + display->disp_mode_lst = (XF86ModePtr)(display->disp_mode_lst->list.next); + else { + while (prev && (XF86ModePtr)(prev->list.next) != mode) + prev = (XF86ModePtr)(prev->list.next); + if (prev == NULL) + return (False); + prev->list.next = mode->list.next; + } + + XtFree((XtPointer)mode); + + return (True); +} + +int +xf86removeVendor(XF86ConfigPtr config, XF86ConfVendorPtr vendor) +{ + XF86ConfVendorPtr prev; + + if (config == NULL || vendor == NULL) + return (False); + + if ((prev = config->conf_vendor_lst) == vendor) + config->conf_vendor_lst = (XF86ConfVendorPtr)(config->conf_vendor_lst->list.next); + else { + while (prev && (XF86ConfVendorPtr)(prev->list.next) != vendor) + prev = (XF86ConfVendorPtr)(prev->list.next); + if (prev == NULL) + return (False); + prev->list.next = vendor->list.next; + } + + xf86optionListFree(vendor->vnd_option_lst); + xf86freeVendorSubList(vendor->vnd_sub_lst); + XtFree(vendor->vnd_identifier); + XtFree((XtPointer)vendor); + + return (True); +} + +int +xf86removeVendorSub(XF86ConfVendorPtr vendor, XF86ConfVendSubPtr sub) +{ + XF86ConfVendSubPtr prev; + + if (vendor == NULL || sub == NULL) + return (False); + + if ((prev = vendor->vnd_sub_lst) == sub) + vendor->vnd_sub_lst = (XF86ConfVendSubPtr)(vendor->vnd_sub_lst->list.next); + else { + while (prev && (XF86ConfVendSubPtr)(prev->list.next) != sub) + prev = (XF86ConfVendSubPtr)(prev->list.next); + if (prev == NULL) + return (False); + prev->list.next = sub->list.next; + } + + xf86optionListFree(sub->vs_option_lst); + XtFree(sub->vs_name); + XtFree(sub->vs_identifier); + XtFree((XtPointer)sub); + + return (True); +} + +int +xf86removeBuffers(XF86ConfDRIPtr dri, XF86ConfBuffersPtr buf) +{ + XF86ConfBuffersPtr prev; + + if (dri == NULL || buf == NULL) + return (False); + + if ((prev = dri->dri_buffers_lst) == buf) + dri->dri_buffers_lst = (XF86ConfBuffersPtr)(dri->dri_buffers_lst->list.next); + else { + while (prev && (XF86ConfBuffersPtr)(prev->list.next) != buf) + prev = (XF86ConfBuffersPtr)(prev->list.next); + if (prev == NULL) + return (False); + prev->list.next = buf->list.next; + } + + XtFree(buf->buf_flags); + XtFree((XtPointer)buf); + + return (True); +} + +int xf86renameInput(XF86ConfigPtr config, XF86ConfInputPtr input, char *name) { XF86ConfLayoutPtr lay = config->conf_layout_lst; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h index 4392a53db..575c3c9d0 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h,v 1.3 2000/10/20 14:59:08 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h,v 1.4 2000/11/30 20:55:18 paulo Exp $ */ #include "config.h" @@ -40,6 +40,8 @@ (XF86ConfInputrefPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) #define xf86addDevice(head, ptr) \ (XF86ConfDevicePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addDisplayMode(head, ptr) \ + (XF86ModePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) #define xf86addMonitor(head, ptr) \ (XF86ConfMonitorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) #define xf86addScreen(head, ptr) \ @@ -48,16 +50,52 @@ (XF86ConfLayoutPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) #define xf86addModeLine(head, ptr) \ (XF86ConfModeLinePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addModes(head, ptr) \ + (XF86ConfModesPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addModesLink(head, ptr) \ + (XF86ConfModesLinkPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addModule(head, ptr) \ + (XF86LoadPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addScreenAdaptor(head, ptr) \ + (XF86ConfAdaptorLinkPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addScreenDisplay(head, ptr) \ + (XF86ConfDisplayPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addVideoAdaptor(head, ptr) \ + (XF86ConfVideoAdaptorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addVideoPort(head, ptr) \ + (XF86ConfVideoPortPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addAdjacency(head, ptr) \ + (XF86ConfAdjacencyPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addVendor(head, ptr) \ + (XF86ConfVendorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addVendorSub(head, ptr) \ + (XF86ConfVendSubPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) +#define xf86addBuffers(head, ptr) \ + (XF86ConfBuffersPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr)) + int xf86removeOption(XF86OptionPtr*, char*); int xf86removeInput(XF86ConfigPtr, XF86ConfInputPtr); int xf86removeInputRef(XF86ConfLayoutPtr, XF86ConfInputPtr); int xf86removeDevice(XF86ConfigPtr, XF86ConfDevicePtr); +int xf86removeDisplayMode(XF86ConfDisplayPtr, XF86ModePtr); int xf86removeMonitor(XF86ConfigPtr, XF86ConfMonitorPtr); int xf86removeScreen(XF86ConfigPtr, XF86ConfScreenPtr); int xf86removeAdjacency(XF86ConfLayoutPtr, XF86ConfAdjacencyPtr); int xf86removeInactive(XF86ConfLayoutPtr, XF86ConfInactivePtr); int xf86removeLayout(XF86ConfigPtr, XF86ConfLayoutPtr); +int xf86removeModule(XF86ConfigPtr, XF86LoadPtr); +int xf86removeModes(XF86ConfigPtr, XF86ConfModesPtr); +int xf86removeModesModeLine(XF86ConfModesPtr, XF86ConfModeLinePtr); +int xf86removeMonitorModeLine(XF86ConfMonitorPtr, XF86ConfModeLinePtr); +int xf86removeMonitorModesLink(XF86ConfMonitorPtr, XF86ConfModesLinkPtr); +int xf86removeScreenAdaptorLink(XF86ConfScreenPtr, XF86ConfAdaptorLinkPtr); +int xf86removeScreenDisplay(XF86ConfScreenPtr, XF86ConfDisplayPtr); +int xf86removeVideoAdaptor(XF86ConfigPtr, XF86ConfVideoAdaptorPtr); +int xf86removeVideoPort(XF86ConfVideoAdaptorPtr, XF86ConfVideoPortPtr); +int xf86removeVendor(XF86ConfigPtr, XF86ConfVendorPtr); +int xf86removeVendorSub(XF86ConfVendorPtr, XF86ConfVendSubPtr); +int xf86removeBuffers(XF86ConfDRIPtr, XF86ConfBuffersPtr); int xf86renameInput(XF86ConfigPtr, XF86ConfInputPtr, char*); int xf86renameDevice(XF86ConfigPtr, XF86ConfDevicePtr, char*); @@ -65,5 +103,9 @@ int xf86renameMonitor(XF86ConfigPtr, XF86ConfMonitorPtr, char*); int xf86renameLayout(XF86ConfigPtr, XF86ConfLayoutPtr, char*); int xf86renameScreen(XF86ConfigPtr, XF86ConfScreenPtr, char*); -#endif /* _xf86cfg_xf86config_h */ +extern void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr); +extern void xf86freeDisplayList(XF86ConfDisplayPtr); +extern void xf86freeModeList(XF86ModePtr); +extern void xf86freeVendorSubList(XF86ConfVendSubPtr); +#endif /* _xf86cfg_xf86config_h */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/Cards b/xc/programs/Xserver/hw/xfree86/xf86config/Cards index 648e872f1..20fa52a5b 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/Cards +++ b/xc/programs/Xserver/hw/xfree86/xf86config/Cards @@ -18,7 +18,7 @@ # The majority of entries are just a binding of a model name to a # chipset/server and untested. # -# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.73 2000/11/28 20:59:20 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.74 2000/12/01 23:27:55 paulo Exp $ # VGA @@ -2302,10 +2302,12 @@ NOCLOCKPROBE NAME SiS 530 CHIPSET SIS520 +SERVER SVGA DRIVER sis NAME SiS 620 CHIPSET SIS620 +SERVER SVGA DRIVER sis NAME SiS SG86C201 @@ -2840,7 +2842,7 @@ NAME Silicon Motion Lynx family CHIPSET Lynx SERVER SVGA DRIVER siliconmotion -NOCLOCPROBE +NOCLOCKPROBE # Rendition diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c index a6badd59e..485ed0756 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c +++ b/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.54 2000/10/27 18:31:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.55 2000/12/03 19:46:18 herrb Exp $ */ /* * This is a configuration program that will create a base XF86Config @@ -616,7 +616,7 @@ keyboard_configuration(void) sprintf(config_xkblayout,"%s", rules->layouts.desc[number].name); emptylines(); - printf(xkbvarianttext); + printf(xkbvarianttext, config_xkblayout); getstring(s); if (strlen(s) != 0) { config_xkbvariant = Malloc(strlen(s) + 1); diff --git a/xc/programs/Xserver/include/os.h b/xc/programs/Xserver/include/os.h index 6243ad504..1eed89a48 100644 --- a/xc/programs/Xserver/include/os.h +++ b/xc/programs/Xserver/include/os.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/os.h,v 3.35 2000/08/02 15:30:36 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/include/os.h,v 3.36 2000/11/30 23:30:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -567,6 +567,7 @@ extern int Pclose(pointer); #endif extern void CheckUserParameters(int argc, char **argv, char **envp); +extern void CheckUserAuthorization(void); extern int AddHost( #if NeedFunctionPrototypes diff --git a/xc/programs/Xserver/os/Imakefile b/xc/programs/Xserver/os/Imakefile index 68c0e3f5c..1854c7ecb 100644 --- a/xc/programs/Xserver/os/Imakefile +++ b/xc/programs/Xserver/os/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/85 1997/12/07 18:26:23 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.27 2000/05/05 17:47:29 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.28 2000/11/30 23:30:06 dawes Exp $ #include <Server.tmpl> /* @@ -108,6 +108,9 @@ BOOTSTRAPCFLAGS = KRB5_DEFINES = Krb5Defines XALLOC_DEFINES = XallocDefines ERROR_DEFINES = ServerErrorDefines +#if HasPam && HasPamMisc + PAM_DEFINES = -DUSE_PAM +#endif DEFINES = -DXSERV_t -DTRANS_SERVER $(CONNECTION_FLAGS) $(MEM_DEFINES) $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) $(KRB5_DEFINES) $(RGB_DEFINES) INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(TOP)/lib/Xau -I../lbx Krb5Includes DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) $(CONNECTION_FLAGS) @@ -145,7 +148,7 @@ SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES)) #if BuildLBX SpecialCObjectRule(lbxio,$(ICONFIGFILES),$(EXT_DEFINES)) #endif -SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES)) +SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES) $(PAM_DEFINES)) SpecialCObjectRule(xalloc,$(ICONFIGFILES),$(XALLOC_DEFINES)) #if defined(SparcArchitecture) && HasGcc && !HasGcc2 oscolor.o: oscolor.c $(ICONFIGFILES) diff --git a/xc/programs/Xserver/os/utils.c b/xc/programs/Xserver/os/utils.c index e9e138d29..3b0b2af99 100644 --- a/xc/programs/Xserver/os/utils.c +++ b/xc/programs/Xserver/os/utils.c @@ -45,7 +45,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.66 2000/11/14 18:20:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.67 2000/11/30 23:30:06 dawes Exp $ */ #ifdef __CYGWIN__ #include <stdlib.h> #include <signal.h> @@ -2064,4 +2064,57 @@ CheckUserParameters(int argc, char **argv, char **envp) FatalError("X server aborted because of unsafe environment\n"); } +/* + * CheckUserAuthorization: check if the user is allowed to start the + * X server. This usually means some sort of PAM checking, and it is + * usually only done for setuid servers (uid != euid). + */ + +#ifdef USE_PAM +#include <security/pam_appl.h> +#include <security/pam_misc.h> +#include <pwd.h> +#endif /* USE_PAM */ + +void +CheckUserAuthorization() +{ +#ifdef USE_PAM + static struct pam_conv conv = { + misc_conv, + NULL + }; + + pam_handle_t *pamh = NULL; + struct passwd *pw; + int retval; + + if (getuid() != geteuid()) { + pw = getpwuid(getuid()); + if (pw == NULL) + FatalError("getpwuid() failed for uid %d\n", getuid()); + + retval = pam_start("xserver", pw->pw_name, &conv, &pamh); + if (retval != PAM_SUCCESS) + FatalError("pam_start() failed.\n" + "\tMissing or mangled PAM config file or module?\n"); + + retval = pam_authenticate(pamh, 0); + if (retval != PAM_SUCCESS) { + pam_end(pamh, retval); + FatalError("PAM authentication failed, cannot start X server.\n" + "\tPerhaps you do not have console ownership?\n"); + } + + retval = pam_acct_mgmt(pamh, 0); + if (retval != PAM_SUCCESS) { + pam_end(pamh, retval); + FatalError("PAM authentication failed, cannot start X server.\n" + "\tPerhaps you do not have console ownership?\n"); + } + /* this is not a session, so do not do session management */ + pam_end(pamh, PAM_SUCCESS); + } +#endif +} |