Compare commits
	
		
			736 Commits
		
	
	
		
			mesa_6_4
			...
			texman_0_1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b3b325e560 | ||
|  | 382ce985ac | ||
|  | 54b7eca7a0 | ||
|  | f74e06bf11 | ||
|  | 9c02649d18 | ||
|  | 2c34704e41 | ||
|  | 85d0041ff0 | ||
|  | 67ff8b354e | ||
|  | 08e7957571 | ||
|  | 9c1f7089d8 | ||
|  | 5381ac5f11 | ||
|  | a6f78d4eee | ||
|  | ae695e3566 | ||
|  | c82c3335e1 | ||
|  | f8246f504b | ||
|  | 499458bcdb | ||
|  | 37a53fd6a0 | ||
|  | 5ec38fb2ea | ||
|  | 11c0215bf8 | ||
|  | 6a13b6c346 | ||
|  | a103097ee5 | ||
|  | 7efad0d84c | ||
|  | 42c88cd072 | ||
|  | 2541c54e79 | ||
|  | 33529e3d8e | ||
|  | 84c1b82081 | ||
|  | a97a1439ae | ||
|  | 2fd2910010 | ||
|  | fbbda155e0 | ||
|  | a49c3c0fae | ||
|  | baf5998d59 | ||
|  | 4c5acef241 | ||
|  | 9839e272cf | ||
|  | b57e79ff14 | ||
|  | 43824acb4e | ||
|  | d8f509e749 | ||
|  | eb91c93c2e | ||
|  | 79de983b6f | ||
|  | fdb3acf016 | ||
|  | 2807d1f58a | ||
|  | 93f913926e | ||
|  | 33ca04f379 | ||
|  | 398cb30c72 | ||
|  | f67bb30314 | ||
|  | 4578d7b9f0 | ||
|  | dcdfc154c3 | ||
|  | 696ba32779 | ||
|  | dcfe55539f | ||
|  | ff84b1f1b2 | ||
|  | 3bca9c47f4 | ||
|  | d4d7fdb43b | ||
|  | d65dab5777 | ||
|  | 638ca019ef | ||
|  | b4f70646b4 | ||
|  | 8defce2cf1 | ||
|  | 0f488bb16d | ||
|  | 1bcc323857 | ||
|  | 93d0935ef7 | ||
|  | 4078c647d5 | ||
|  | 458479fedb | ||
|  | 1814d6541b | ||
|  | 2d4ff6a8cf | ||
|  | c217d5a3a8 | ||
|  | 0946e0f418 | ||
|  | 7a028bd1ca | ||
|  | d469e5e5a0 | ||
|  | c2901e4f4c | ||
|  | 41b9756e9a | ||
|  | 8bc4dae67e | ||
|  | eda59aa87e | ||
|  | ca188de098 | ||
|  | 30cc822163 | ||
|  | 413a49ce59 | ||
|  | 31be39742b | ||
|  | 3086efe357 | ||
|  | cabecbd314 | ||
|  | 1d43e729ec | ||
|  | 8c137e2f94 | ||
|  | fb83a42d31 | ||
|  | 456a513daa | ||
|  | 577d23011b | ||
|  | 369ae3e2c4 | ||
|  | 77a7c2ad92 | ||
|  | 4dac78463e | ||
|  | edf570da67 | ||
|  | 49b9355020 | ||
|  | 1b6a081885 | ||
|  | bc8390fa6c | ||
|  | ad960612ce | ||
|  | 11decab34a | ||
|  | 3ad366dff2 | ||
|  | d57ce4a2c1 | ||
|  | 707343dcf5 | ||
|  | feb7221ecb | ||
|  | 1d32fc7332 | ||
|  | fd1627312d | ||
|  | e34700af7a | ||
|  | c9b4acfeb8 | ||
|  | 782291ab91 | ||
|  | 924fb5e916 | ||
|  | 841c9018b1 | ||
|  | b6d7a0c5a5 | ||
|  | 0970787228 | ||
|  | c8d1741b78 | ||
|  | 1add059bd1 | ||
|  | c9797f6b76 | ||
|  | 0063084804 | ||
|  | 40332059e4 | ||
|  | 3e1a5a38ae | ||
|  | 790ab0a0b6 | ||
|  | f06ce1ba71 | ||
|  | 98d9bb66a4 | ||
|  | 215aa20f5c | ||
|  | 4882279633 | ||
|  | b04dd5c587 | ||
|  | ad6f8eba00 | ||
|  | 6002d2ff4e | ||
|  | 21b2784ff5 | ||
|  | 5abc246f8d | ||
|  | 72d1bb5756 | ||
|  | 91ed68b2b9 | ||
|  | 5262c225ba | ||
|  | 1acea5f289 | ||
|  | 5bdec89da5 | ||
|  | 59af97420e | ||
|  | 0694adaf71 | ||
|  | 4c3443b460 | ||
|  | f2b9fa03da | ||
|  | 0fa8c59e64 | ||
|  | 98bebc7212 | ||
|  | abccd5b729 | ||
|  | 9309ba78d1 | ||
|  | 9580179dfb | ||
|  | d5179613d5 | ||
|  | b4ebb68202 | ||
|  | f27c07c99e | ||
|  | 923257fe07 | ||
|  | f93feb7aed | ||
|  | eb06704a7c | ||
|  | 99f13343cf | ||
|  | 1b3128cc9a | ||
|  | 8716e7570d | ||
|  | 5abff7bc4d | ||
|  | c9515bf1ae | ||
|  | bfba2705b6 | ||
|  | dd4f0d1a93 | ||
|  | f285f0d8f6 | ||
|  | 6b25193b92 | ||
|  | 0e31e02aef | ||
|  | cf2702e3db | ||
|  | 31e739a189 | ||
|  | 94ae2b4f25 | ||
|  | 5910dfacf1 | ||
|  | 96f216565e | ||
|  | 2d8eb9eaf3 | ||
|  | 126482a12f | ||
|  | 9790e641ef | ||
|  | 58f45fa44d | ||
|  | 5285c32a17 | ||
|  | f576450cae | ||
|  | 4683e8e954 | ||
|  | 2b8e66d210 | ||
|  | aae2b8b8eb | ||
|  | 4f12aa5a6a | ||
|  | a913d9f2f7 | ||
|  | 3070a581fc | ||
|  | d548bf41d3 | ||
|  | 49b2d2e90f | ||
|  | 024b5896f0 | ||
|  | 96bf6abb66 | ||
|  | 2a76d952b8 | ||
|  | 1ac1c1c423 | ||
|  | daf585d0f0 | ||
|  | d2c64e0b83 | ||
|  | b1abf1ea8e | ||
|  | ff707ead2b | ||
|  | 181f2b92cb | ||
|  | 023c95481b | ||
|  | 957b517c4f | ||
|  | 39591da355 | ||
|  | a3d2c69e61 | ||
|  | b8829facc7 | ||
|  | b711eb793b | ||
|  | f049ca4e33 | ||
|  | 9bcc9e9174 | ||
|  | 286f3fbb3a | ||
|  | e6e1c3fc11 | ||
|  | ec1ffd9f25 | ||
|  | 5a771857d9 | ||
|  | bf44f6cfac | ||
|  | 1ea61b5cad | ||
|  | ec770b8c60 | ||
|  | 1a61462318 | ||
|  | e31ac05223 | ||
|  | 22db535776 | ||
|  | 55194df035 | ||
|  | 1353ebed81 | ||
|  | 5d7b49f7e7 | ||
|  | 1ad3b7e28b | ||
|  | 6f445a1061 | ||
|  | 41c8eabe0f | ||
|  | 63d683091f | ||
|  | 430c469c5b | ||
|  | 47e511c36d | ||
|  | 9fd133511c | ||
|  | 8c41a14c5e | ||
|  | 5754809421 | ||
|  | 8c765ad312 | ||
|  | ddf61bfec9 | ||
|  | f31448f3c8 | ||
|  | 40ca5b455f | ||
|  | 311bcf5090 | ||
|  | 948ab5d8a9 | ||
|  | 74e9a43a2a | ||
|  | 5ba41dfa81 | ||
|  | 11f179e01b | ||
|  | f81c78f87d | ||
|  | 547113c16c | ||
|  | 154cc16d08 | ||
|  | 0ba7be0a50 | ||
|  | 32fe233d54 | ||
|  | 0f29ef6092 | ||
|  | 94f70fab64 | ||
|  | 1a5f1bdb42 | ||
|  | 909e8a7abb | ||
|  | 847160466c | ||
|  | 06185363dd | ||
|  | c731d6223c | ||
|  | 0ad64faec7 | ||
|  | 738f501f73 | ||
|  | 62620d349b | ||
|  | daeb0056df | ||
|  | 7edf68e081 | ||
|  | 1e134cf7e4 | ||
|  | 5ef524cd01 | ||
|  | a163256cc2 | ||
|  | e5700a1ba3 | ||
|  | cb6b47b795 | ||
|  | 7b98b40e47 | ||
|  | b3c095f074 | ||
|  | 662fbf8a62 | ||
|  | ba3da6154c | ||
|  | e3636b4114 | ||
|  | bed8363aa6 | ||
|  | de99760bf3 | ||
|  | 77ee31930a | ||
|  | 0325bc6359 | ||
|  | 418a7dbd75 | ||
|  | 6297799fee | ||
|  | db40ebfbb7 | ||
|  | 1984aabe83 | ||
|  | a8446f72f4 | ||
|  | a8717180d9 | ||
|  | cfca72cfb1 | ||
|  | 8850a7e20f | ||
|  | 5374e4ba7e | ||
|  | 4884db6eb2 | ||
|  | e1a5edf083 | ||
|  | bdd80bf819 | ||
|  | 0bffb1192a | ||
|  | 3e9c099088 | ||
|  | 02df9e1ed4 | ||
|  | 832026f906 | ||
|  | beff21e7bf | ||
|  | 189bbe0b8c | ||
|  | c657d8e3e4 | ||
|  | 30d6a4bffa | ||
|  | 237dae74f7 | ||
|  | bf41bc03c2 | ||
|  | b7c87974b3 | ||
|  | c289f48342 | ||
|  | b88fb724e6 | ||
|  | 1fcdaf1c3b | ||
|  | 637c375ee2 | ||
|  | 9ba4ef3102 | ||
|  | 7e807510d8 | ||
|  | 73347516be | ||
|  | 41c8b71871 | ||
|  | 47adbde5e5 | ||
|  | 8894a55d5f | ||
|  | fd4395b8d1 | ||
|  | 613e1ad5d5 | ||
|  | 4d0b7618cb | ||
|  | 95ebb5f485 | ||
|  | 2cb1cf484a | ||
|  | 8ff68b2bf3 | ||
|  | c12ee99d11 | ||
|  | f805cdfedf | ||
|  | 84f3ff91d9 | ||
|  | d78834b306 | ||
|  | 72030e0d91 | ||
|  | ccfe3d4683 | ||
|  | 7ae9713a60 | ||
|  | 1624162b0c | ||
|  | 45cd2f9305 | ||
|  | bcf4ae7816 | ||
|  | 60031ace75 | ||
|  | 90ebb581e6 | ||
|  | 5a02209cd2 | ||
|  | eda460035e | ||
|  | 26b1c97a9d | ||
|  | e4894177ba | ||
|  | 3a5626cb84 | ||
|  | a9b927cb6e | ||
|  | a546abc8da | ||
|  | f4fbda35b0 | ||
|  | c3626a91ce | ||
|  | 6aa6d440d9 | ||
|  | e7d6bb9dc4 | ||
|  | 3cf156df2b | ||
|  | da70bc6baa | ||
|  | a605d9c3de | ||
|  | d9f362a667 | ||
|  | 0505103710 | ||
|  | ffec105109 | ||
|  | dcf4c17fb1 | ||
|  | 821b3dd562 | ||
|  | 37f2eaa316 | ||
|  | 18e7c5c5fe | ||
|  | 7aebaf3deb | ||
|  | 094a1ddf24 | ||
|  | 5d04101d18 | ||
|  | 32df89e12d | ||
|  | 5b3cf5af74 | ||
|  | 1a979736a6 | ||
|  | 5244fc6d60 | ||
|  | 3c2f8b22b9 | ||
|  | a2e696e521 | ||
|  | af13891dbd | ||
|  | 4174f79b19 | ||
|  | db02ab767f | ||
|  | 4570364097 | ||
|  | aba878d8c2 | ||
|  | d7d41ceeb0 | ||
|  | 3eec2901db | ||
|  | 86734ddae4 | ||
|  | b3c98e6205 | ||
|  | b5ee368baf | ||
|  | f51bf9e23c | ||
|  | 8cb2923038 | ||
|  | ca33e21165 | ||
|  | 5222c58a68 | ||
|  | dc44372ba7 | ||
|  | eb171b0c10 | ||
|  | 3b3adf3daa | ||
|  | a4af1119f5 | ||
|  | 9c8f649930 | ||
|  | c57be49099 | ||
|  | 4b9f1308e5 | ||
|  | 215c4c3a9c | ||
|  | 512c994b92 | ||
|  | 170a61ec00 | ||
|  | 2d0c92d81b | ||
|  | 03833ba2ca | ||
|  | d240b29b95 | ||
|  | 22605caea8 | ||
|  | 4dc3249f0d | ||
|  | 23f076ca67 | ||
|  | 5f79025e0d | ||
|  | f8a5898ca0 | ||
|  | 9eaed1178d | ||
|  | 896735e412 | ||
|  | 2330ed08c3 | ||
|  | a09d002bb5 | ||
|  | f1113fa99d | ||
|  | 7e4cc1c29f | ||
|  | 005070a62a | ||
|  | 7040b7ad88 | ||
|  | f33beed330 | ||
|  | 81d3bf58ff | ||
|  | 310f1551b4 | ||
|  | 32340aea13 | ||
|  | c92adf4682 | ||
|  | 414b742c97 | ||
|  | 60b639b9a6 | ||
|  | 971bdc193c | ||
|  | 9e87119d87 | ||
|  | 9192ab3f5d | ||
|  | 6efd595bf5 | ||
|  | dc793d4e9a | ||
|  | 3265585b15 | ||
|  | 1c04be573e | ||
|  | 52f686c480 | ||
|  | 7d3b26022b | ||
|  | e516654dec | ||
|  | f28cbb6a7f | ||
|  | 32a7ab2197 | ||
|  | 54cfe69436 | ||
|  | b3f2e15035 | ||
|  | 3a09ea919c | ||
|  | 2ea6b800c0 | ||
|  | 8975cbb36b | ||
|  | eedc45709f | ||
|  | f468dfde17 | ||
|  | adfd5510c0 | ||
|  | a90909e892 | ||
|  | f344be793c | ||
|  | 255afe4abd | ||
|  | c8f86105d0 | ||
|  | 6f980dbf21 | ||
|  | b50a51118c | ||
|  | 806e25a5d9 | ||
|  | 301c3dcb6c | ||
|  | 2420318cd9 | ||
|  | e0cb784e03 | ||
|  | d76c7d7d3e | ||
|  | dc4070c787 | ||
|  | ca2db58166 | ||
|  | deadd47aab | ||
|  | bf3f0bcf80 | ||
|  | b83435f53b | ||
|  | d99c37bca6 | ||
|  | 1c236fd5c7 | ||
|  | 005469005d | ||
|  | 05e1a49ab4 | ||
|  | 730200303d | ||
|  | 2d61d30117 | ||
|  | dd5a86339f | ||
|  | 247f3b3e81 | ||
|  | ccf1378131 | ||
|  | 30daa75293 | ||
|  | ed2f8635f0 | ||
|  | 6ff023fe3a | ||
|  | 96e1ccedec | ||
|  | c81de36223 | ||
|  | f525d3e139 | ||
|  | d084c3d4dc | ||
|  | 44b1bd7597 | ||
|  | e7325294d0 | ||
|  | ac04a4fa7f | ||
|  | 8d29d463a3 | ||
|  | 1c0f11046a | ||
|  | 30f2d6f0cb | ||
|  | b4269c07f8 | ||
|  | cf085db28a | ||
|  | 474f28e57c | ||
|  | 81a22ef539 | ||
|  | f2802c40ff | ||
|  | dfe7aedf84 | ||
|  | 9dd973ec3b | ||
|  | 24a44d74b6 | ||
|  | 44dace86ea | ||
|  | 26f69d87a4 | ||
|  | ea20c324ae | ||
|  | 11f763f505 | ||
|  | a3c8de2fa7 | ||
|  | 06f606ce57 | ||
|  | 198a88923c | ||
|  | 8184ec9fb6 | ||
|  | a9fc8ba756 | ||
|  | 91802fdf73 | ||
|  | 7edf1e80bd | ||
|  | 9e920fb93c | ||
|  | bc6cced479 | ||
|  | 14c38b8f4f | ||
|  | eb063cfa38 | ||
|  | 199ef86b5e | ||
|  | a6296dd2c3 | ||
|  | 071b30aba1 | ||
|  | b0e7d850d1 | ||
|  | 8ef0519bbe | ||
|  | 9a3a1497e5 | ||
|  | 1fc4b21eb2 | ||
|  | 2794507289 | ||
|  | 184a970722 | ||
|  | b0a0ca8bd9 | ||
|  | 0899afae33 | ||
|  | cef88397a6 | ||
|  | 7f78c93015 | ||
|  | 9758ef9e7b | ||
|  | 252194d74e | ||
|  | 31340f6645 | ||
|  | 3d61c2e778 | ||
|  | d0529b67f4 | ||
|  | 76560af99d | ||
|  | 82b29819a9 | ||
|  | f493a04be0 | ||
|  | 1ad6e08090 | ||
|  | b2404b132d | ||
|  | 3fd819aef8 | ||
|  | 8d0edf015d | ||
|  | 5208867f12 | ||
|  | d95000da2f | ||
|  | f7a8d8ffbb | ||
|  | 1ad7b99925 | ||
|  | b955474093 | ||
|  | 1b5d3d647e | ||
|  | ac3ec5096a | ||
|  | dbd0fa920e | ||
|  | 78b3b667b5 | ||
|  | 99796464c5 | ||
|  | 70c3bebcde | ||
|  | afb9fb0965 | ||
|  | 84c9e671ed | ||
|  | ad271b8c98 | ||
|  | 4aeaff2ae7 | ||
|  | 310a10b0f2 | ||
|  | d997b90433 | ||
|  | 79b4dbc496 | ||
|  | 048b13df65 | ||
|  | d5861c06f2 | ||
|  | 36d9ee1828 | ||
|  | 6d3637849b | ||
|  | 0efc17c105 | ||
|  | e5fce1694c | ||
|  | 7b01068a23 | ||
|  | 676d0accf5 | ||
|  | f1e2826856 | ||
|  | 4fd11949f0 | ||
|  | 63016507d7 | ||
|  | 7d39e82976 | ||
|  | 8bdc1ae358 | ||
|  | 978ef2bb6d | ||
|  | 3e37bafab0 | ||
|  | 4092fbd55a | ||
|  | 5bfb9356d6 | ||
|  | 5434695017 | ||
|  | 9e4e3adcf8 | ||
|  | 8fadf8f900 | ||
|  | 14570e6d7c | ||
|  | f39569f550 | ||
|  | 000abaa12d | ||
|  | 7265556b9a | ||
|  | 22607975b4 | ||
|  | 3211b28ee6 | ||
|  | cd81190d5c | ||
|  | 17d6fff30c | ||
|  | c650bb0b7d | ||
|  | 02237f447f | ||
|  | b3aefd1cfb | ||
|  | a01cb26a90 | ||
|  | 26bb7bc025 | ||
|  | 6707433272 | ||
|  | 82e314252f | ||
|  | f2ea634c0c | ||
|  | 6ae8747539 | ||
|  | 62a2f8cdd6 | ||
|  | db64b60225 | ||
|  | aa2069586d | ||
|  | 3cc67cb8cd | ||
|  | aa8abf8081 | ||
|  | 792a1bcbe4 | ||
|  | 8885b077ed | ||
|  | e00ac11d4d | ||
|  | 0f540f4b04 | ||
|  | e64874ac2d | ||
|  | 63b5b8eaff | ||
|  | 9a22b555cf | ||
|  | da9f65268d | ||
|  | 7fb9352fe4 | ||
|  | 55187ea63e | ||
|  | 2cd8791cad | ||
|  | 6ce60beb28 | ||
|  | 5f16244879 | ||
|  | a25fe61607 | ||
|  | b43671c8bf | ||
|  | 04adb70f32 | ||
|  | a702bbfff3 | ||
|  | 5250aa7c6a | ||
|  | 7a534dcab1 | ||
|  | 41cf68b4cb | ||
|  | a400a1e404 | ||
|  | f157e2dee4 | ||
|  | ff9d235042 | ||
|  | 48799287b3 | ||
|  | a60ff20c58 | ||
|  | 67a8decffe | ||
|  | e42a31350d | ||
|  | 9ae952a88c | ||
|  | f084f60f8b | ||
|  | 7909dd920d | ||
|  | 56ff8ed6d8 | ||
|  | 363344f5b8 | ||
|  | 7bb7f97594 | ||
|  | 914ec8ef58 | ||
|  | 878c371e6c | ||
|  | 42c34efd23 | ||
|  | bdf8441f80 | ||
|  | 56a2e084be | ||
|  | b5932cfc9d | ||
|  | a96f889a57 | ||
|  | 5179f671e7 | ||
|  | 8d2139e513 | ||
|  | fd9de710f5 | ||
|  | f6e3234639 | ||
|  | f20917de5b | ||
|  | 11543624ed | ||
|  | 28569c25f6 | ||
|  | 68d436140d | ||
|  | 758f447a17 | ||
|  | 2745df2774 | ||
|  | 654286eab1 | ||
|  | 2eef2eca87 | ||
|  | 7f8cb30ccc | ||
|  | 80cef697f4 | ||
|  | 26c7e65785 | ||
|  | 5704b8e57a | ||
|  | f15b499cfd | ||
|  | 392c93e398 | ||
|  | 0ca6715ba5 | ||
|  | c53d2d0ca8 | ||
|  | 6c2e82b601 | ||
|  | 402b2bea64 | ||
|  | 036a99452d | ||
|  | a3dd2ce29e | ||
|  | 338cbb0e5c | ||
|  | b346213960 | ||
|  | 95db1f0127 | ||
|  | 7e3be5559e | ||
|  | 45ba4e4332 | ||
|  | d9b9b4b3be | ||
|  | b5cbaf945d | ||
|  | b15f46a093 | ||
|  | 5cf1397710 | ||
|  | 4618a9bfc2 | ||
|  | f36954ec3c | ||
|  | f4ff4d36ed | ||
|  | 21ed29598f | ||
|  | ce3350770c | ||
|  | 692147ebf7 | ||
|  | 526242614f | ||
|  | ab8ef280ec | ||
|  | f0da327c87 | ||
|  | b683b0df45 | ||
|  | 8693b70e8f | ||
|  | eba4ff6e0a | ||
|  | d869a43554 | ||
|  | 20354edf35 | ||
|  | bd07168eb2 | ||
|  | 158a2aa488 | ||
|  | c0b4b9fc3e | ||
|  | e2399effa0 | ||
|  | 3622f4f27f | ||
|  | fcb6a0fa3e | ||
|  | 6575e37cbf | ||
|  | e3c8a0c16d | ||
|  | 3952d6d4bb | ||
|  | f66084b834 | ||
|  | e15c2d077a | ||
|  | 53a3c70580 | ||
|  | e81cbd876e | ||
|  | b4b040f7d8 | ||
|  | 16e7aebfe3 | ||
|  | 87ce68e1b3 | ||
|  | 61ba6b5a74 | ||
|  | 6e0e6eff05 | ||
|  | d575a4c4a1 | ||
|  | 0cfd4f92dd | ||
|  | eae73dbd91 | ||
|  | 90cfbd3dd5 | ||
|  | f8cc27ecfc | ||
|  | 16f76703a5 | ||
|  | 05aed23d1b | ||
|  | acafeeb6dc | ||
|  | 54be0763e1 | ||
|  | 2b81c8999f | ||
|  | 6e57725061 | ||
|  | b0715811e8 | ||
|  | f6540c6252 | ||
|  | 687918b794 | ||
|  | e6925b51e1 | ||
|  | c6262cd8c5 | ||
|  | 3ba814ae07 | ||
|  | 7fa6c1afb9 | ||
|  | 624ad14a58 | ||
|  | 712e5042de | ||
|  | 93cfdfe1ef | ||
|  | 14520eb25e | ||
|  | c799e9ec24 | ||
|  | 4fb995084e | ||
|  | 8cdf372946 | ||
|  | 350a167635 | ||
|  | 3c450b2917 | ||
|  | a02febb8cc | ||
|  | a517cc1ef6 | ||
|  | b343f06a09 | ||
|  | f519a770d0 | ||
|  | b252e0f47f | ||
|  | 238de2db12 | ||
|  | da84f0b642 | ||
|  | 98e92d261b | ||
|  | 4d11d45d84 | ||
|  | fcbfeb5d28 | ||
|  | 982e8e4d5c | ||
|  | 8e5479c7f8 | ||
|  | f1d269060b | ||
|  | f069e74dd8 | ||
|  | 5545245fe7 | ||
|  | db84ec2c6d | ||
|  | af39910f94 | ||
|  | c958a9798a | ||
|  | 26bb5239c8 | ||
|  | 527835977a | ||
|  | 36603539cc | ||
|  | d5783737f1 | ||
|  | 2c8524b4fb | ||
|  | cbafed8716 | ||
|  | 3d4d6d29e2 | ||
|  | 275a563bea | ||
|  | f830f640b6 | ||
|  | 513a553d4a | ||
|  | 16fb04ccb5 | ||
|  | f98b9853e1 | ||
|  | b41c025420 | ||
|  | 9165d46fdb | ||
|  | d5cc77e37c | ||
|  | 156dc55628 | ||
|  | f0d0e50994 | ||
|  | d9089ab96e | ||
|  | 3a165edc9a | ||
|  | 49fd874f24 | ||
|  | 082501a74c | ||
|  | 23ffc3a85d | ||
|  | ca1ac986a1 | ||
|  | f4166a1fd7 | ||
|  | adbf932ec1 | ||
|  | 59d680db22 | ||
|  | 713635adef | ||
|  | a2c65f4793 | ||
|  | 2735b33638 | ||
|  | 8bc0b3f961 | ||
|  | 8de9d92acf | ||
|  | 8e247d52e3 | ||
|  | b8a804d24f | ||
|  | 6e4f594a02 | ||
|  | dd1a9f75dc | ||
|  | 7e6553c1aa | ||
|  | 61d386a93f | ||
|  | d545d916a8 | ||
|  | 9e385282fc | ||
|  | 5d7c486d90 | ||
|  | c58cea0085 | ||
|  | 334f2d8077 | ||
|  | 17756df903 | ||
|  | edf0d14bd4 | ||
|  | 249160fdfa | 
							
								
								
									
										42
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								Makefile
									
									
									
									
									
								
							| @@ -137,6 +137,7 @@ ultrix-gcc: | ||||
| DIRECTORY = Mesa-6.5 | ||||
| LIB_NAME = MesaLib-6.5 | ||||
| DEMO_NAME = MesaDemos-6.5 | ||||
| GLUT_NAME = MesaGLUT-6.5 | ||||
|  | ||||
| MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/Makefile*						\ | ||||
| @@ -213,7 +214,6 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/directfb/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dos/*.[chS]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/glide/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch]			\ | ||||
| @@ -260,16 +260,15 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj | ||||
|  | ||||
| DRI_FILES = \ | ||||
| 	$(DIRECTORY)/include/GL/internal/*.h				\ | ||||
| 	$(DIRECTORY)/include/GL/internal/dri_interface.h		\ | ||||
| 	$(DIRECTORY)/include/GL/internal/sarea.h			\ | ||||
| 	$(DIRECTORY)/src/glx/Makefile					\ | ||||
| 	$(DIRECTORY)/src/glx/x11/Makefile				\ | ||||
| 	$(DIRECTORY)/src/glx/x11/*.[ch]					\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch]		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/dri_client/imports/*.h	\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile			\ | ||||
| @@ -312,7 +311,7 @@ GLW_FILES = \ | ||||
| 	$(DIRECTORY)/src/glw/README			\ | ||||
| 	$(DIRECTORY)/src/glw/depend | ||||
|  | ||||
| PROG_FILES = \ | ||||
| DEMO_FILES = \ | ||||
| 	$(DIRECTORY)/progs/beos/*.cpp			\ | ||||
| 	$(DIRECTORY)/progs/beos/Makefile		\ | ||||
| 	$(DIRECTORY)/progs/images/*.rgb			\ | ||||
| @@ -323,6 +322,8 @@ PROG_FILES = \ | ||||
| 	$(DIRECTORY)/progs/demos/*.cxx			\ | ||||
| 	$(DIRECTORY)/progs/demos/*.dat			\ | ||||
| 	$(DIRECTORY)/progs/demos/README			\ | ||||
| 	$(DIRECTORY)/progs/osdemos/Makefile		\ | ||||
| 	$(DIRECTORY)/progs/osdemos/*.c			\ | ||||
| 	$(DIRECTORY)/progs/xdemos/Makefile*		\ | ||||
| 	$(DIRECTORY)/progs/xdemos/descrip.mms		\ | ||||
| 	$(DIRECTORY)/progs/xdemos/*.[chf]		\ | ||||
| @@ -337,10 +338,8 @@ PROG_FILES = \ | ||||
| 	$(DIRECTORY)/progs/windml/*.bmp			\ | ||||
| 	$(DIRECTORY)/progs/ggi/*.c			\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/demos/*.dsp	\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp	\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/progs.dsw	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/demos/*.vcproj	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/progs.sln | ||||
|  | ||||
| GLUT_FILES = \ | ||||
| @@ -359,7 +358,9 @@ GLUT_FILES = \ | ||||
| 	$(DIRECTORY)/src/glut/dos/Makefile.DJ		\ | ||||
| 	$(DIRECTORY)/src/glut/dos/PC_HW/*.[chS]		\ | ||||
| 	$(DIRECTORY)/src/glut/ggi/*.[ch]		\ | ||||
| 	$(DIRECTORY)/src/glut/ggi/Makefile | ||||
| 	$(DIRECTORY)/src/glut/ggi/Makefile		\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj | ||||
|  | ||||
| DEPEND_FILES = \ | ||||
| 	$(TOP)/src/mesa/depend		\ | ||||
| @@ -370,11 +371,9 @@ DEPEND_FILES = \ | ||||
|  | ||||
| LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES) | ||||
|  | ||||
| DEMO_FILES = $(PROG_FILES) $(GLUT_FILES) | ||||
|  | ||||
|  | ||||
| # Everything for new a Mesa release: | ||||
| tarballs: rm_depend lib_gz demo_gz lib_bz2 demo_bz2 lib_zip demo_zip md5 | ||||
| tarballs: rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5 | ||||
|  | ||||
|  | ||||
| rm_depend: | ||||
| @@ -396,6 +395,12 @@ demo_gz: | ||||
| 	gzip $(DEMO_NAME).tar ; \ | ||||
| 	mv $(DEMO_NAME).tar.gz $(DIRECTORY) | ||||
|  | ||||
| glut_gz: | ||||
| 	cd .. ; \ | ||||
| 	tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \ | ||||
| 	gzip $(GLUT_NAME).tar ; \ | ||||
| 	mv $(GLUT_NAME).tar.gz $(DIRECTORY) | ||||
|  | ||||
| lib_bz2: | ||||
| 	rm -f configs/current ; \ | ||||
| 	cd .. ; \ | ||||
| @@ -409,6 +414,12 @@ demo_bz2: | ||||
| 	bzip2 $(DEMO_NAME).tar ; \ | ||||
| 	mv $(DEMO_NAME).tar.bz2 $(DIRECTORY) | ||||
|  | ||||
| glut_bz2: | ||||
| 	cd .. ; \ | ||||
| 	tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \ | ||||
| 	bzip2 $(GLUT_NAME).tar ; \ | ||||
| 	mv $(GLUT_NAME).tar.bz2 $(DIRECTORY) | ||||
|  | ||||
| lib_zip: | ||||
| 	rm -f configs/current ; \ | ||||
| 	rm -f $(LIB_NAME).zip ; \ | ||||
| @@ -422,6 +433,12 @@ demo_zip: | ||||
| 	zip -qr $(DEMO_NAME).zip $(DEMO_FILES) ; \ | ||||
| 	mv $(DEMO_NAME).zip $(DIRECTORY) | ||||
|  | ||||
| glut_zip: | ||||
| 	rm -f $(GLUT_NAME).zip ; \ | ||||
| 	cd .. ; \ | ||||
| 	zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \ | ||||
| 	mv $(GLUT_NAME).zip $(DIRECTORY) | ||||
|  | ||||
| md5: | ||||
| 	@-md5sum $(LIB_NAME).tar.gz | ||||
| 	@-md5sum $(LIB_NAME).tar.bz2 | ||||
| @@ -429,3 +446,6 @@ md5: | ||||
| 	@-md5sum $(DEMO_NAME).tar.gz | ||||
| 	@-md5sum $(DEMO_NAME).tar.bz2 | ||||
| 	@-md5sum $(DEMO_NAME).zip | ||||
| 	@-md5sum $(GLUT_NAME).tar.gz | ||||
| 	@-md5sum $(GLUT_NAME).tar.bz2 | ||||
| 	@-md5sum $(GLUT_NAME).zip | ||||
|   | ||||
| @@ -12,7 +12,7 @@ TOP=. | ||||
| INCLUDE_DIR="/usr/local/include" | ||||
| LIB_DIR="/usr/local/lib" | ||||
|  | ||||
| if [ x$# == "x0" ] ; then | ||||
| if [ "x$#" = "x0" ] ; then | ||||
| echo | ||||
| echo "***** Mesa installation - You may need root privileges to do this *****" | ||||
| echo | ||||
| @@ -20,7 +20,7 @@ echo "Default directory for header files is:" ${INCLUDE_DIR} | ||||
| echo "Enter new directory or press <Enter> to accept this default." | ||||
|  | ||||
| read INPUT | ||||
| if [ x${INPUT} != "x" ] ; then | ||||
| if [ "x${INPUT}" != "x" ] ; then | ||||
| 	INCLUDE_DIR=${INPUT} | ||||
| fi | ||||
|  | ||||
| @@ -29,7 +29,7 @@ echo "Default directory for library files is:" ${LIB_DIR} | ||||
| echo "Enter new directory or press <Enter> to accept this default." | ||||
|  | ||||
| read INPUT | ||||
| if [ x${INPUT} != "x" ] ; then | ||||
| if [ "x${INPUT}" != "x" ] ; then | ||||
| 	LIB_DIR=${INPUT} | ||||
| fi | ||||
|  | ||||
| @@ -47,7 +47,16 @@ fi | ||||
|  | ||||
| # flags: | ||||
| #  -f = force | ||||
| #  -d = preserve symlinks | ||||
| #  -d = preserve symlinks (does not work on BSD) | ||||
|  | ||||
| if [ `uname` = "FreeBSD" ] ; then | ||||
| 	CP_FLAGS="-f" | ||||
| elif [ `uname` = "Darwin" ] ; then | ||||
| 	CP_FLAGS="-f" | ||||
| else | ||||
| 	CP_FLAGS="-fd" | ||||
| fi | ||||
|  | ||||
|  | ||||
| set -v | ||||
|  | ||||
| @@ -56,7 +65,8 @@ mkdir ${INCLUDE_DIR}/GL | ||||
| mkdir ${INCLUDE_DIR}/GLES | ||||
| mkdir ${LIB_DIR} | ||||
| cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL | ||||
| cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES | ||||
| cp -fd ${TOP}/lib*/lib* ${LIB_DIR} | ||||
| cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL | ||||
| # NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES | ||||
| cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR} | ||||
|  | ||||
| echo "Done." | ||||
|   | ||||
							
								
								
									
										32
									
								
								bin/mklib
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								bin/mklib
									
									
									
									
									
								
							| @@ -209,10 +209,8 @@ case $ARCH in | ||||
|         elif [ $STATIC = 1 ] ; then | ||||
| 	    LIBNAME="lib${LIBNAME}"     # prefix with "lib" | ||||
|             echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a | ||||
|             LINK="ar" | ||||
|             OPTS="-ru" | ||||
|             # make lib | ||||
|             ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} | ||||
|             rm -f ${LIBNAME}.a | ||||
|             ar -ru ${LIBNAME}.a ${OBJECTS} | ||||
| 	    ranlib ${LIBNAME}.a | ||||
|             # finish up | ||||
|             FINAL_LIBS=${LIBNAME}.a | ||||
| @@ -309,11 +307,23 @@ case $ARCH in | ||||
| 	;; | ||||
|  | ||||
|     'FreeBSD') | ||||
| 	# we assume gcc | ||||
|  | ||||
| 	if [ "x$LINK" = "x" ] ; then | ||||
| 	    # -linker was not specified so set default link command now | ||||
|             if [ $CPLUSPLUS = 1 ] ; then | ||||
|                 LINK=g++ | ||||
|             else | ||||
|                 LINK=gcc | ||||
|             fi | ||||
| 	fi | ||||
|  | ||||
| 	if [ $NOPREFIX = 1 ] ; then | ||||
| 	    # No "lib" or ".so" part | ||||
| 	    echo "mklib: Making FreeBSD shared library: " ${LIBNAME} | ||||
| 	    OPTS="-shared" | ||||
| 	    rm -f ${LIBNAME} | ||||
| 	    ld -Bshareable -o ${LIBNAME} ${OBJECTS} | ||||
| 	    ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} | ||||
| 	    FINAL_LIBS=${LIBNAME} | ||||
|         elif [ $STATIC = 1 ] ; then | ||||
| 	    STLIB="lib${LIBNAME}.a" | ||||
| @@ -323,12 +333,13 @@ case $ARCH in | ||||
| 	    ranlib ${STLIB} | ||||
| 	    FINAL_LIBS=${STLIB} | ||||
| 	else | ||||
| 	    SHLIB="lib${LIBNAME}.so.${MAJOR}.${MINOR}" | ||||
| 	    SHLIB="lib${LIBNAME}.so.${MAJOR}" | ||||
| 	    OPTS="-shared -Wl,-soname,${SHLIB}" | ||||
| 	    echo "mklib: Making FreeBSD shared library: " ${SHLIB} | ||||
| 	    rm -f ${SHLIB} | ||||
| 	    ld -Bshareable -o ${SHLIB} ${OBJECTS} | ||||
| 	    # XXX make lib${LIBNAME}.so.${MAJOR} symlink? | ||||
| 	    FINAL_LIBS=${SHLIB} | ||||
| 	    ${LINK} ${OPTS} -o ${SHLIB} ${OBJECTS} ${DEPS} | ||||
| 	    ln -sf ${SHLIB} "lib${LIBNAME}.so" | ||||
| 	    FINAL_LIBS="${SHLIB} lib${LIBNAME}.so" | ||||
| 	fi | ||||
| 	;; | ||||
|  | ||||
| @@ -415,6 +426,7 @@ case $ARCH in | ||||
|         if [ $STATIC = 1 ] ; then | ||||
|             LIBNAME="lib${LIBNAME}.a" | ||||
|             echo "mklib: Making AIX static library: " ${LIBNAME} | ||||
| 	    rm -f ${LIBNAME} | ||||
|             ar -ruv ${X64} ${LIBNAME} ${OBJECTS} | ||||
|             FINAL_LIBS=${LIBNAME} | ||||
|         else | ||||
| @@ -492,7 +504,7 @@ case $ARCH in | ||||
|         else | ||||
|             LIBNAME="lib${LIBNAME}.dylib" | ||||
|             echo "mklib: Making Darwin shared library: " ${LIBNAME} | ||||
|             FLAGS="-dynamiclib -multiply_defined suppress" | ||||
|             FLAGS="-dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0" | ||||
| 	    if [ $CPLUSPLUS = 1 ] ; then | ||||
| 		LINK="g++" | ||||
| 	    else | ||||
|   | ||||
| @@ -26,7 +26,8 @@ ifeq ($(CPU), x86) | ||||
| 		-DUSE_3DNOW_ASM \ | ||||
| 		-DUSE_SSE_ASM | ||||
| 	 | ||||
| 	ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
| 	ASM_SOURCES = $(X86_SOURCES) | ||||
| 	ASM_API = $(X86_API) | ||||
|  | ||||
| 	CC = gcc | ||||
| 	CXX = g++ | ||||
|   | ||||
| @@ -5,11 +5,13 @@ include $(TOP)/configs/default | ||||
| CONFIG_NAME = darwin | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = cc | ||||
| CXX = cc | ||||
| CC = c++ | ||||
| CXX = c++ | ||||
| CFLAGS = -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin | ||||
| CXXFLAGS = -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin | ||||
|  | ||||
| MKLIB_OPTIONS = -cplusplus | ||||
|  | ||||
| # Library names (actual file names) | ||||
| GL_LIB_NAME = libGL.dylib | ||||
| GLU_LIB_NAME = libGLU.dylib | ||||
|   | ||||
| @@ -7,8 +7,8 @@ CONFIG_NAME = default | ||||
|  | ||||
| # Version info | ||||
| MESA_MAJOR=6 | ||||
| MESA_MINOR=3 | ||||
| MESA_TINY=2 | ||||
| MESA_MINOR=5 | ||||
| MESA_TINY=0 | ||||
|  | ||||
| # external projects.  This should be useless now that we use libdrm. | ||||
| DRM_SOURCE_PATH=$(TOP)/../drm | ||||
|   | ||||
| @@ -9,9 +9,9 @@ CC = gcc | ||||
| CXX = g++ | ||||
| MAKE = gmake | ||||
|  | ||||
| CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 | ||||
| CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 \ | ||||
| 	$(ASM_FLAGS) | ||||
| CXXFLAGS = -O2 -fPIC -pedantic | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm | ||||
|  | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm | ||||
|   | ||||
| @@ -16,7 +16,7 @@ X11_INCLUDES = -I/usr/X11R6/include | ||||
| DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ | ||||
| 	-DGLX_DIRECT_RENDERING -DHAVE_ALIAS | ||||
| CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99  -Wundef -fPIC \ | ||||
| 	-ffast-math $(X11_INCLUDES) | ||||
| 	-ffast-math $(ASM_FLAGS) $(X11_INCLUDES) | ||||
| CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC | ||||
|  | ||||
| ASM_SOURCES =  | ||||
| @@ -24,14 +24,14 @@ ASM_SOURCES = | ||||
| # Library/program dependencies | ||||
| LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm | ||||
| DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB) | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread $(LIBDRM_LIB) | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lm -lpthread $(LIBDRM_LIB) | ||||
|  | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lXm -lX11 | ||||
|  | ||||
|  | ||||
| # Directories | ||||
| SRC_DIRS = mesa glu glut/glx glw glx/x11 | ||||
| SRC_DIRS = glx/x11 mesa glu glut/glx glw | ||||
| DRIVER_DIRS = dri | ||||
| PROGRAM_DIRS =  | ||||
| WINDOW_SYSTEM=dri | ||||
|   | ||||
| @@ -6,4 +6,5 @@ include $(TOP)/configs/freebsd-dri | ||||
| CONFIG_NAME = freebsd-dri-x86-64 | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_64_ASM | ||||
| ASM_SOURCES = $(X86-64_SOURCES) $(X86-64_API) | ||||
| ASM_SOURCES = $(X86-64_SOURCES) | ||||
| ASM_API = $(X86-64_API) | ||||
|   | ||||
| @@ -10,3 +10,4 @@ PIC_FLAGS = | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|   | ||||
| @@ -8,7 +8,6 @@ CONFIG_NAME = linux | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| WARN_FLAGS = -Wall | ||||
| OPT_FLAGS  = -O3 -g | ||||
| PIC_FLAGS  = -fPIC | ||||
|  | ||||
| @@ -22,10 +21,10 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ | ||||
|  | ||||
| X11_INCLUDES = -I/usr/X11R6/include | ||||
|  | ||||
| CFLAGS   = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
| 	$(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math  | ||||
| CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ | ||||
| 	$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math  | ||||
|  | ||||
| CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
| CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
| 	$(X11_INCLUDES)  | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|   | ||||
| @@ -5,4 +5,4 @@ include $(TOP)/configs/linux | ||||
| CONFIG_NAME = linux-debug | ||||
|  | ||||
| OPT_FLAGS = -g | ||||
| DEFINES += -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK | ||||
| DEFINES += -DDEBUG -DDEBUG_MATH | ||||
|   | ||||
| @@ -17,7 +17,8 @@ HAVE_X86 = $(shell uname -m | grep 'i[3-6]86' >/dev/null && echo yes) | ||||
| ifeq ($(HAVE_X86), yes) | ||||
|      CFLAGS   += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
|      CXXFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
|      ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
|      ASM_SOURCES = $(X86_SOURCES) | ||||
|      ASM_API = $(X86_API) | ||||
| endif | ||||
|  | ||||
| # Directories | ||||
|   | ||||
| @@ -9,12 +9,11 @@ CONFIG_NAME = linux-dri | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| MKDEP = /usr/X11R6/bin/makedepend | ||||
| #MKDEP = /usr/X11R6/bin/makedepend | ||||
| #MKDEP = gcc -M | ||||
| #MKDEP_OPTIONS = -MF depend | ||||
|  | ||||
| WARN_FLAGS = -Wall | ||||
| OPT_FLAGS  = -O -g | ||||
| OPT_FLAGS  = -g | ||||
| PIC_FLAGS  = -fPIC | ||||
|  | ||||
| # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. | ||||
| @@ -27,10 +26,10 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ | ||||
|  | ||||
| X11_INCLUDES = -I/usr/X11R6/include | ||||
|  | ||||
| CFLAGS   = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
| 	$(ASM_FLAGS) -std=c99 -ffast-math  | ||||
| CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ | ||||
| 	$(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math  | ||||
|  | ||||
| CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) | ||||
| CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) | ||||
|  | ||||
|  | ||||
| ASM_SOURCES =  | ||||
| @@ -64,5 +63,7 @@ WINDOW_SYSTEM=dri | ||||
|  | ||||
| # gamma are missing because they have not been converted to use the new | ||||
| # interface. | ||||
| DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon s3v \ | ||||
| DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \ | ||||
| 	savage sis tdfx trident unichrome ffb | ||||
|  | ||||
| DRI_DIRS = i915  | ||||
|   | ||||
| @@ -13,4 +13,5 @@ ARCH_FLAGS = -m32 | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,8 @@ CONFIG_NAME = linux-dri-x86-64 | ||||
| ARCH_FLAGS = -m64 | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_64_ASM | ||||
| ASM_SOURCES = $(X86-64_SOURCES) $(X86-64_API) | ||||
| ASM_SOURCES = $(X86-64_SOURCES) | ||||
| ASM_API = $(X86-64_API) | ||||
|  | ||||
| LIB_DIR = $(TOP)/lib64 | ||||
|  | ||||
|   | ||||
| @@ -16,6 +16,7 @@ GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm | ||||
|  | ||||
| ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -24,6 +24,7 @@ GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lX | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm | ||||
| MKLIB_OPTIONS = -arch icc | ||||
|  | ||||
| ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -8,9 +8,9 @@ CONFIG_NAME = linux-profile | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| CFLAGS = -pg -O -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG | ||||
| CFLAGS = -pg -O -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG | ||||
|  | ||||
| CXXFLAGS = -pg -O -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG | ||||
| CXXFLAGS = -pg -O -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|   | ||||
| @@ -10,3 +10,4 @@ PIC_FLAGS = | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|   | ||||
| @@ -1,22 +0,0 @@ | ||||
| # Configuration for debugging on Linux | ||||
|  | ||||
| include $(TOP)/configs/default | ||||
|  | ||||
| CONFIG_NAME = linux-tcc | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| TCC_DIR=/home/progs/tcc-0.9.20 | ||||
|  | ||||
| CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DUSE_TCC -I$(TCC_DIR) | ||||
|  | ||||
| CXXFLAGS = -g -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -L$(TCC_DIR) -ltcc -ldl | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lXt -L/usr/X11R6/lib -lX11 | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm | ||||
| @@ -5,4 +5,5 @@ include $(TOP)/configs/linux | ||||
| CONFIG_NAME = linux-x86 | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
| ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|   | ||||
| @@ -6,7 +6,8 @@ CONFIG_NAME = linux-x86-64 | ||||
|  | ||||
| ARCH_FLAGS = -m64 | ||||
|  | ||||
| ASM_SOURCES = $(X86-64_SOURCES) $(X86-64_API) | ||||
| ASM_SOURCES = $(X86-64_SOURCES) | ||||
| ASM_API = $(X86-64_API) | ||||
| ASM_FLAGS = -DUSE_X86_64_ASM | ||||
|  | ||||
| LIB_DIR = $(TOP)/lib64 | ||||
|   | ||||
| @@ -4,4 +4,4 @@ include $(TOP)/configs/linux-x86-64 | ||||
|  | ||||
| CONFIG_NAME = linux-x86-64-debug | ||||
|  | ||||
| DEFINES += -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK | ||||
| DEFINES += -DDEBUG -DDEBUG_MATH | ||||
|   | ||||
| @@ -6,4 +6,4 @@ include $(TOP)/configs/linux-x86 | ||||
| CONFIG_NAME = linux-x86-debug | ||||
|  | ||||
| OPT_FLAGS = -g | ||||
| DEFINES += -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK | ||||
| DEFINES += -DDEBUG -DDEBUG_MATH | ||||
|   | ||||
| @@ -15,7 +15,8 @@ CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199 | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|  | ||||
| ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|  | ||||
| # Library/program dependencies | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread | ||||
|   | ||||
| @@ -15,7 +15,8 @@ CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199 | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|  | ||||
| ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_API = $(X86_API) | ||||
|  | ||||
| # Library/program dependencies | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -lXCB | ||||
|   | ||||
| @@ -16,7 +16,8 @@ ARCH_FLAGS ?= | ||||
|  | ||||
| DEFINES = -D_REENTRANT -DUSE_XSHM | ||||
|  | ||||
| ASM_SOURCES = $(SPARC_SOURCES) $(SPARC_API) | ||||
| ASM_SOURCES = $(SPARC_SOURCES) | ||||
| ASM_API = $(SPARC_API) | ||||
| ASM_FLAGS = -DUSE_SPARC_ASM | ||||
|  | ||||
| CFLAGS   = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
|   | ||||
| @@ -26,3 +26,13 @@ On Alpha platforms at default a sharable images for the libraries are created. | ||||
| To get a static library make it by typing MMS/MACRO=(NOSHARE=1). | ||||
| On VAX platforms only static libraries can be build. | ||||
|  | ||||
| 23-sep-2005 | ||||
| changed default compilation to use /float=ieee/ieee=denorm. The reason for  | ||||
| this is that it makes Mesa on OpenVMS better compatible with other platforms | ||||
| and other packages for VMS that I maintain. | ||||
| For more information see | ||||
|       http://nchrem.tnw.tudelft.nl/openvms | ||||
|       https://bugs.freedesktop.org/show_bug.cgi?id=4270 | ||||
| You may want to compile Mesa to use VAX-floating point arithmetic, instead | ||||
| of IEEE floating point by removing the /float=IEEE/denorm flag from the | ||||
| compiler options in the descrip.mms files. | ||||
|   | ||||
							
								
								
									
										50
									
								
								docs/RELNOTES-6.4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								docs/RELNOTES-6.4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
|  | ||||
| 		        Mesa 6.4 Release Notes | ||||
|  | ||||
| 			   October 24, 2005 | ||||
|  | ||||
|  | ||||
|  | ||||
| Introduction | ||||
| ------------ | ||||
|  | ||||
| Mesa uses an even/odd version number scheme like the Linux kernel. | ||||
| Odd numbered versions (such as 6.3) designate new developmental releases. | ||||
| Even numbered versions (such as 6.4) designate stable releases. | ||||
|  | ||||
|  | ||||
| 6.4 is a bug-fix release.  See the VERSIONS file for details. | ||||
|  | ||||
|  | ||||
|  | ||||
| GLUT tarball | ||||
| ------------ | ||||
|  | ||||
| Starting with 6.4, the GLUT library sources are distributed in a separate | ||||
| tarball.  This was done at the request of Linux distro vendors who prefer | ||||
| to use freeglut. | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Driver			Status | ||||
| ----------------------	---------------------- | ||||
| DRI drivers		varies with the driver | ||||
| XMesa (Xlib)		implements OpenGL 1.5 | ||||
| OSMesa (off-screen)	implements OpenGL 1.5 | ||||
| Windows/Win32		implements OpenGL 1.5 | ||||
| Glide (3dfx Voodoo1/2)  requires updates	 | ||||
| SVGA			requires updates | ||||
| DJGPP			requires updates | ||||
| GGI			requires updates | ||||
| BeOS			requires updates | ||||
| Allegro			requires updates | ||||
| D3D			requires updates | ||||
|  | ||||
| The drivers which require updates mostly need to be updated to work | ||||
| with the new gl_renderbuffer / gl_framebuffer infrastructure introduced | ||||
| in Mesa 6.3. | ||||
|  | ||||
|  | ||||
| ---------------------------------------------------------------------- | ||||
| $Id: RELNOTES-6.4,v 3.1 2005/10/24 23:33:27 brianp Exp $ | ||||
							
								
								
									
										74
									
								
								docs/RELNOTES-6.5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								docs/RELNOTES-6.5
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
|  | ||||
|                        Mesa 6.5 Release Notes | ||||
|  | ||||
|                            month, day, 2005 | ||||
|  | ||||
|  | ||||
|  | ||||
| Introduction | ||||
| ------------ | ||||
|  | ||||
| Mesa uses an even/odd version number scheme like the Linux kernel. | ||||
| Odd numbered versions (such as 6.5) designate new developmental releases. | ||||
| Even numbered versions (such as 6.4) designate stable releases. | ||||
|  | ||||
|  | ||||
|  | ||||
| New Features | ||||
| ------------ | ||||
|  | ||||
| GL_EXT_timer_query  - used to get elapsed time information from the renderer. | ||||
|  | ||||
|  | ||||
|  | ||||
| Driver Interface Changes | ||||
| ------------------------ | ||||
|  | ||||
| Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by | ||||
| the two-sided versions: Driver.Stencil*Separate(). | ||||
|  | ||||
|  | ||||
|  | ||||
| To Do | ||||
| ----- | ||||
| Fix linux-glide target/driver. | ||||
| Fix lambda calculation for frag progs. | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Removed Extensions | ||||
| ------------------ | ||||
|  | ||||
| The following extensions have been removed: | ||||
|  | ||||
|   GL_HP_occlusion_test - this is superceded by GL_ARB_occlusion_query. | ||||
|  | ||||
|  | ||||
|  | ||||
| To Do (someday) items | ||||
| --------------------- | ||||
|  Switch to freeglut | ||||
|  Increase MAX_DRAWBUFFERS | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Driver			Status | ||||
| ----------------------	---------------------- | ||||
| DRI drivers		varies with the driver | ||||
| XMesa (Xlib)		implements OpenGL 1.5 | ||||
| OSMesa (off-screen)	implements OpenGL 1.5 | ||||
| Glide (3dfx Voodoo1/2)	implements OpenGL 1.3 | ||||
| SVGA			implements OpenGL 1.3 | ||||
| Wind River UGL		implements OpenGL 1.3 | ||||
| Windows/Win32		implements OpenGL 1.5 | ||||
| DJGPP			implements OpenGL 1.5 | ||||
| GGI			implements OpenGL 1.3 | ||||
| BeOS			implements OpenGL 1.5 | ||||
| Allegro			needs updating | ||||
| D3D			needs updating | ||||
|  | ||||
|  | ||||
| ---------------------------------------------------------------------- | ||||
| $Id: RELNOTES-6.5,v 3.1 2005/09/14 14:34:54 brianp Exp $ | ||||
| @@ -1372,3 +1372,56 @@ Mesa Version History | ||||
| 	- wglGetProcAddress() didn't handle wgl-functions | ||||
| 	- fixed glxext.h cross-compile issue (Colin Harrison) | ||||
| 	- assorted DRI driver fixes | ||||
|  | ||||
|  | ||||
| 6.4  October 24, 2005 | ||||
|     New: | ||||
| 	- Added a fast XOR line drawing function in Xlib driver | ||||
| 	- Added support for GL_ARB_texture_mirrored_repeat to savage | ||||
| 	  driver (supported only on Savage4 hardware). | ||||
|     Changes: | ||||
| 	- Mesa now packaged in three parts: Library, Demos and GLUT | ||||
|     Bug fixes: | ||||
| 	- GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig | ||||
| 	- Some files were present multiple times in the 6.3.2 tarballs | ||||
| 	- r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) | ||||
| 	- glxgears_fbconfig demo didn't work (bug 4237) | ||||
| 	- fixed bug when bilinear sampling 2d textures with borders | ||||
| 	- glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) | ||||
| 	- fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) | ||||
| 	- fixed a few problems with proxy color tables (bug 4270) | ||||
| 	- fixed precision problem in Z clearing (bug 4395) | ||||
| 	- glBitmap, glDraw/CopyPixels mistakenly generated selection hits | ||||
| 	- fixed potential segfault caused by reading pixels outside | ||||
| 	  of renderbuffer bounds | ||||
| 	- glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB | ||||
| 	- fixed memory corruption bug involving software alpha buffers | ||||
| 	- glReadPixels clipped by window bounds was sometimes broken | ||||
| 	- glDraw/CopyPixels of stencil data ignored the stencil write mask | ||||
| 	- glReadPixels from a texture bound to a framebuffer object didn't work | ||||
| 	- glIsRender/FramebufferEXT weren't totally correct | ||||
| 	- fixed a number of point size attenuation/fade bugs | ||||
| 	- fixed glFogCoord bug 4729 | ||||
| 	- GLX encoding for transpose matrix functions was broken | ||||
| 	- fixed broken fragment program KIL and SWZ instructions | ||||
| 	- fragment programs that wrote result.depth.z didn't work | ||||
|  | ||||
|  | ||||
| 6.5  month, day, 2005 | ||||
|     New: | ||||
| 	- GL_EXT_packed_depth_stencil extension | ||||
| 	- GL_EXT_timer_query extension | ||||
| 	- reflect demo improved to support multiple windows | ||||
| 	- singlebuffer demo (shows no/little-flicker single-buffered rendering) | ||||
| 	- r200: enable GL_ARB_texture_env_crossbar, separate the texture | ||||
| 	  sampling unit bits from the texture env combine enable bits | ||||
| 	- r200: add support for GL_ATI_fragment_shader | ||||
| 	- added fast XOR-mode line drawing optimization | ||||
| 	- radeon: add support for all 3 tmus, GL_ARB_texture_cube_map | ||||
| 	  and GL_EXT_fog_coord | ||||
| 	- MESA_GLX_ALPHA_BITS env var for xlib driver | ||||
|     Changes: | ||||
| 	- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead) | ||||
| 	- removed GL_SGIX/SGIS_pixel_texture extensions | ||||
|     Bug fixes: | ||||
|  | ||||
|   | ||||
| @@ -37,8 +37,6 @@ a:visited { | ||||
|  | ||||
| <b>Download / Install</b> | ||||
| <ul> | ||||
| <li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Stable Release (6.2.1)</a> | ||||
| <li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Devel Release (6.3.2)</a> | ||||
| <li><a href="download.html" target="MainFrame">Downloading/Unpacking</a> | ||||
| <li><a href="install.html" target="MainFrame">Compilation/Installation</a> | ||||
| <li><a href="glu.html" target="MainFrame">SGI's GLU</a> | ||||
| @@ -81,7 +79,7 @@ a:visited { | ||||
| <b>Links</b> | ||||
| <ul> | ||||
| <li><a href="http://www.opengl.org" target="_parent">OpenGL website</a> | ||||
| <li><a href="http://dri.sourceforge.net" target="_parent">DRI website</a> | ||||
| <li><a href="http://dri.freedesktop.org" target="_parent">DRI website</a> | ||||
| <li><a href="http://www.freedesktop.org" target="_parent">freedesktop.org</a> | ||||
| <li><a href="games.html" target="MainFrame">Games and Entertainment</a> | ||||
| <li><a href="libraries.html" target="MainFrame">Libraries and Toolkits</a> | ||||
| @@ -91,9 +89,13 @@ a:visited { | ||||
| <li><a href="demos.html" target="MainFrame">Demos / other</a> | ||||
| </ul> | ||||
|  | ||||
| <b>Hosted by:</b> | ||||
| <br> | ||||
| <blockquote> | ||||
| <A HREF="http://sourceforge.net" | ||||
| target="_parent"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=3&type=1" | ||||
| WIDTH="88" HEIGHT="31" ALIGN="BOTTOM" ALT="Sourceforge.net" BORDER="0"></A> | ||||
| </blockquote> | ||||
|  | ||||
| </body> | ||||
| </html> | ||||
| </html> | ||||
|   | ||||
| @@ -6,101 +6,129 @@ | ||||
|  | ||||
| <BODY> | ||||
|  | ||||
| <H1>Downloading / Unpacking</H1> | ||||
| <H1>Downloading</H1> | ||||
|  | ||||
| <p> | ||||
| Mesa can be downloaded from the | ||||
| <a href="http://www.sourceforge.net/projects/mesa3d" target="_parent"> | ||||
| SourceForge download area</A>. | ||||
| Last development release: <b>6.3.2</b> | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| Since version 2.3, Mesa is distributed in two pieces:  main library code | ||||
| and demos.  If you're upgrading from a previous version of Mesa or you're not | ||||
| interested in the demos you can just download the core Mesa archive file. | ||||
| Last stable release: <b>6.2.1</b> | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| Mesa is available in at least three archive formats: | ||||
| Primary download site: | ||||
| <a href="http://sourceforge.net/project/showfiles.php?group_id=3" | ||||
| target="_parent">SourceForge</a> | ||||
| </p> | ||||
|  | ||||
|  | ||||
| <p> | ||||
| Mesa is distributed in several parts: | ||||
| </p> | ||||
| <ul> | ||||
| <li><b>MesaLib-x.y.z</b> - the main Mesa library source code, drivers | ||||
|     and documentation. | ||||
| </li> | ||||
| <li><b>MesaDemos-x.y.z</b> - OpenGL demonstration and test programs. | ||||
|     Most of the programs require GLUT (either the | ||||
|     <a href="http://www.opengl.org/resources/libraries/glut.html" | ||||
|     target="_parent">original GLUT by Mark Kilgard</a> or | ||||
|     <a href="http://freeglut.sourceforge.net" target="_parent">freeglut</a> or | ||||
|     <a href="http://freeglut.sourceforge.net" target="_parent">OpenGLUT</a>). | ||||
| </li> | ||||
| <li><b>MesaGLUT-x.y.z</b> - Mark Kilgard's GLUT, easily compiled and used | ||||
|     with Mesa.  Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc. | ||||
| </li> | ||||
| </ul> | ||||
|  | ||||
| <p> | ||||
| If you're not interested in running the demos, you'll only need the first | ||||
| package. | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| The packages are available in .tar.gz, .tar.bz2 and .zip formats. | ||||
| Other organizations might offer additional package formats. | ||||
| </p> | ||||
|  | ||||
| <H1>Unpacking</H1> | ||||
|  | ||||
| <p> | ||||
| All the packages should be in the same directory prior to unpacking. | ||||
| </p> | ||||
|  | ||||
| <ul> | ||||
| <li>To unpack .tar.gz files: | ||||
| <pre> | ||||
| 1. GNU zip/tar | ||||
|  | ||||
| 	Download MesaLib-X.Y.tar.gz and optionally MesaDemos-X.Y.tar.gz | ||||
| 	Unpack with: | ||||
| 		gzcat MesaLib-X.Y.tar.gz | tar xf - | ||||
| 		gzcat MesaDemos-X.Y.tar.gz | tar xf - | ||||
| 	or | ||||
| 		gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar | ||||
| 		gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar | ||||
| 	or | ||||
| 		tar zxf MesaLib-X.Y.tar.gz | ||||
| 		tar zxf MesaDemos-X.Y.tar.gz | ||||
|  | ||||
| 	If you don't have gzcat try zcat instead. | ||||
|  | ||||
| 2. Unix compressed/tar | ||||
|  | ||||
| 	Download MesaLib-X.Y.tar.Z and optionally MesaDemos-X.Y.tar.Z | ||||
| 	Unpack with: | ||||
| 		zcat MesaLib-X.Y.tar.Z | tar xf - | ||||
| 		zcat MesaDemos-X.Y.tar.Z | tar xf - | ||||
|  | ||||
| 3. ZIP format | ||||
|  | ||||
| 	Download MesaLib-X.Y.zip and optionally MesaDemos-X.Y.zip | ||||
| 	Unpack with: | ||||
| 		unzip MesaLib-X.Y.zip | ||||
| 		unzip MesaDemos-X.Y.zip | ||||
| 	tar zxf MesaLib-X.Y.tar.gz | ||||
| 	tar zxf MesaDemos-X.Y.tar.gz | ||||
| 	tar zxf MesaGLUT-X.Y.tar.gz | ||||
| </pre> | ||||
| or | ||||
| <pre> | ||||
| 	gzcat MesaLib-X.Y.tar.gz | tar xf - | ||||
| 	gzcat MesaDemos-X.Y.tar.gz | tar xf - | ||||
| 	gzcat MesaGLUT-X.Y.tar.gz | tar xf - | ||||
| </pre> | ||||
| or | ||||
| <pre> | ||||
| 	gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar | ||||
| 	gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar | ||||
| 	gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar | ||||
| </pre> | ||||
| <li>To unpack .tar.bz2 files: | ||||
| <pre> | ||||
| 	bunzip2 -c MesaLib-X.Y.tar.gz | tar xf - | ||||
| 	bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf - | ||||
| 	bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf - | ||||
| </pre> | ||||
| <li>To unpack .zip files: | ||||
| <pre> | ||||
| 	unzip MesaLib-X.Y.zip | ||||
| 	unzip MesaDemos-X.Y.zip | ||||
| 	unzip MesaGLUT-X.Y.zip | ||||
| </pre> | ||||
| </ul> | ||||
|  | ||||
|  | ||||
| <h1>Contents</h1> | ||||
|  | ||||
| <p> | ||||
| After unpacking you'll have these directories (and more): | ||||
| After unpacking you'll have these directories: | ||||
| </p> | ||||
| <pre> | ||||
| Makefile.X11	- top-level Makefile for X11-based systems | ||||
| Make-config	- system configurations used by the Makefile.X11 | ||||
| Makefile	- top-level Makefile for most systems | ||||
| configs/	- makefile parameter files for various systems | ||||
| include/	- GL header (include) files | ||||
| bin/		- shell scripts for making shared libraries, etc | ||||
| lib/		- final client libraries, created during compilation | ||||
| docs/		- documentation | ||||
| src/		- source code for libraries | ||||
| src/mesa	- sources for the main Mesa library and device drivers | ||||
| src/glu		- libGLU source code | ||||
| src/glw		- Xt/Motif/OpenGL widget code | ||||
| </pre> | ||||
|  | ||||
| If you downloaded and unpacked the MesaDemos.X.Y package: | ||||
|  | ||||
| and if you downloaded and unpacked the MesaDemos.X.Y archive: | ||||
|  | ||||
| src/glut	- GLUT source code | ||||
| progs/		- OpenGL programs | ||||
| <pre> | ||||
| progs/demos	- original Mesa demos | ||||
| progs/xdemos	- GLX OpenGL/Mesa demos | ||||
| progs/redbook	- examples from the OpenGL Programming Guide | ||||
| progs/samples	- examples from SGI | ||||
| progs/images/	- image files | ||||
| </pre> | ||||
|  | ||||
| If you downloaded and unpacked the MesaGLUT.X.Y package: | ||||
| <pre> | ||||
| src/glut	- GLUT library source code | ||||
| </pre> | ||||
|  | ||||
| <p> | ||||
| Proceed to <a href="install.html">compilation and installation | ||||
| Proceed to the <a href="install.html">compilation and installation | ||||
| instructions</a>. | ||||
| </p> | ||||
|  | ||||
| <H1>GLUT</H1> | ||||
|  | ||||
| <p> | ||||
| Mesa 2.5 and later includes Mark Kilgard's GLUT library (GL Utility Toolkit). | ||||
| GLUT is built automatically on systems which support it. | ||||
| </p> | ||||
| <p> | ||||
| The GLUT tests, demos, examples, etc are not included, just the main library. | ||||
| To obtain the latest complete release of GLUT please visit the | ||||
| <a href="http://www.opengl.org/resources/libraries/glut.html" | ||||
| target ="_parent">GLUT page</a> on www.opengl.org. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| </BODY> | ||||
| </HTML> | ||||
|   | ||||
| @@ -37,6 +37,7 @@ software driver: | ||||
|   "window" to render into a window, or "disable" to disable the Glide driver. | ||||
| <li>MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel. | ||||
| <li>MESA_GLX_DEPTH_BITS - specifies default number of bits for depth buffer. | ||||
| <li>MESA_GLX_ALPHA_BITS - specifies default number of bits for alpha channel. | ||||
| </ul> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| <center> | ||||
| <h1>Mesa Frequently Asked Questions</h1> | ||||
| Last updated: 17 November 2004 | ||||
| Last updated: 21 October 2004 | ||||
| </center> | ||||
|  | ||||
| <br> | ||||
| @@ -39,14 +39,14 @@ See the </a><a href="http://www.opengl.org/">OpenGL website</a> for more | ||||
| information. | ||||
| </p> | ||||
| <p> | ||||
| Mesa 5.x supports the OpenGL 1.4 specification. | ||||
| Mesa 6.x supports the OpenGL 1.5 specification. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| <h2>1.2 Does Mesa support/use graphics hardware?</h2> | ||||
| <p> | ||||
| Yes.  Specifically, Mesa serves as the OpenGL core for the open-source | ||||
| XFree86/DRI OpenGL drivers.  See the <a href="http://dri.sf.net/">DRI | ||||
| Yes.  Specifically, Mesa serves as the OpenGL core for the open-source DRI | ||||
| drivers for XFree86/X.org.  See the <a href="http://dri.sf.net/">DRI | ||||
| website</a> for more information. | ||||
| </p> | ||||
| <p> | ||||
| @@ -62,7 +62,8 @@ operating systems today. | ||||
| Still, Mesa serves at least these purposes: | ||||
| </p> | ||||
| <ul> | ||||
| <li>Mesa is used as the core of the open-source XFree86/DRI hardware drivers. | ||||
| <li>Mesa is used as the core of the open-source XFree86/X.org DRI | ||||
|     hardware drivers. | ||||
| </li> | ||||
| <li>Mesa is quite portable and allows OpenGL to be used on systems | ||||
|     that have no other OpenGL solution. | ||||
| @@ -86,8 +87,8 @@ Still, Mesa serves at least these purposes: | ||||
| <h2>1.4 What's the difference between"Stand-Alone" Mesa and the DRI drivers?</h2> | ||||
| <p> | ||||
| <em>Stand-alone Mesa</em> is the original incarnation of Mesa. | ||||
| On systems running the X Window System, it does all its rendering through | ||||
| the Xlib API. | ||||
| On systems running the X Window System it does all its rendering through | ||||
| the Xlib API: | ||||
| <ul> | ||||
| <li>The GLX API is supported, but it's really just an emulation of the | ||||
|      real thing. | ||||
| @@ -116,21 +117,10 @@ within the DRI (Direct Rendering Infrastructure): | ||||
|  | ||||
| <h2>1.5 How do I upgrade my DRI installation to use a new Mesa release?</h2> | ||||
| <p> | ||||
| You don't!  A copy of the Mesa source code lives inside the XFree86/DRI source | ||||
| tree and gets compiled into the individual DRI driver modules. | ||||
| If you try to install Mesa over an XFree86/DRI installation, you'll lose | ||||
| hardware rendering (because stand-alone Mesa's libGL.so is different than | ||||
| the XFree86 libGL.so). | ||||
| </p> | ||||
| <p> | ||||
| The DRI developers will incorporate the latest release of Mesa into the | ||||
| DRI drivers when the time is right. | ||||
| </p> | ||||
| <p> | ||||
| To upgrade, either look for a new release of <a href="http://www.xfree86.org" | ||||
| target="_parent">XFree86</a> or visit the | ||||
| <a href="http://dri.sf.net" target="_parent">DRI website</a> to see | ||||
| if there's newer drivers. | ||||
| This wasn't easy in the past. | ||||
| Now, the DRI drivers are included in the Mesa tree and can be compiled | ||||
| separately from the X server. | ||||
| Just follow the Mesa <a href="install.html">compilation instructions</a>. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| @@ -201,7 +191,7 @@ Mesa no longer supports GNU autoconf/automake.  Why? | ||||
| </ul> | ||||
|  | ||||
| <p> | ||||
| Now, Mesa again uses a conventional Makefile system (as it did originally). | ||||
| Now Mesa again uses a conventional Makefile system (as it did originally). | ||||
| Basically, each Makefile in the tree includes one of the configuration | ||||
| files from the config/ directory. | ||||
| The config files specify all the variables for a variety of popular systems. | ||||
| @@ -219,9 +209,9 @@ Mesa's not the solution. | ||||
|  | ||||
| <h2><a name="part2">2.4 Where is the GLUT library?</a></h2> | ||||
| <p> | ||||
| <a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaDemos-x.y.z.tar.gz file. | ||||
| If you don't already have GLUT installed, you should grab the MesaDemos | ||||
| package and unpack it before compiling Mesa. | ||||
| <a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaGLUT-x.y.z.tar.gz file. | ||||
| If you don't already have GLUT installed, you should grab the MesaGLUT | ||||
| package and compile it with the rest of Mesa. | ||||
| </a></p> | ||||
|  | ||||
|  | ||||
| @@ -250,7 +240,7 @@ Mesa version number. | ||||
| version number. | ||||
| </li></ul> | ||||
| <p> | ||||
| After installing XFree86 and the DRI drivers, some of these files | ||||
| After installing XFree86/X.org and the DRI drivers, some of these files | ||||
| may be symlinks into the /usr/X11R6/ tree. | ||||
| </p> | ||||
| <p> | ||||
|   | ||||
| @@ -136,7 +136,7 @@ GL_ARB_fragment_program extensions. | ||||
| <p> | ||||
| Ongoing: Mesa is used as the core of many hardware OpenGL drivers for | ||||
| the XFree86 X.org X servers within the | ||||
| <A href="http://dri.sourceforge.net/" target="_parent">DRI project</A>. | ||||
| <A href="http://dri.freedesktop.org/" target="_parent">DRI project</A>. | ||||
| I continue to enhance Mesa with new extensions and features. | ||||
| </p> | ||||
|  | ||||
|   | ||||
| @@ -32,7 +32,7 @@ | ||||
| 	- VRML viewer | ||||
| 	</li><li><a href="http://aig.cs.man.ac.uk/systems/Maverik/" target="_parent">Maverik</a> | ||||
| 	- VR graphics and interaction system | ||||
| 	</li><li><a href="http://www.swissquake.ch/chumb.alum-soft" target="_parent">MD2 Viewer</a> | ||||
| 	</li><li><a href="http://www.swissquake.ch/chumbalum-soft/md2v" target="_parent">MD2 Viewer</a> | ||||
| 	- View .MD2 files | ||||
| 	</li><li><a href="http://www.megacads.dlr.de/" target="_parent">MegaCads</a> | ||||
| 	- Multiblock-Elliptic-Grid-Generation-And-CAD-System | ||||
| @@ -62,8 +62,6 @@ | ||||
| 	</li><li><a href="http://mesa3d.sourceforge.net/notfound.html">VRweb</a> - VRML browser | ||||
| 	</li><li><a href="http://www.csv.ica.uni-stuttgart.de/vrml/dune/" target="_parent">white_dune</a> | ||||
| 	- graphical VRML97 Editor and animation tool | ||||
| 	</li><li><a href="http://www.wings3d.org/" target="_parent">Wings 3D</a> - static 3D modeller | ||||
| 	with VRML export.  Uses SDL library. | ||||
| </li></ul> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -11,6 +11,57 @@ | ||||
| <H1>News</H1> | ||||
|  | ||||
|  | ||||
| <h2>October 24, 2005</h2> | ||||
| <p> | ||||
| Mesa 6.4 has been released.  This is a stable, bug-fix release. | ||||
| </p> | ||||
| <pre> | ||||
|     New: | ||||
| 	- Added a fast XOR line drawing function in Xlib driver | ||||
| 	- Added support for GL_ARB_texture_mirrored_repeat to savage | ||||
| 	  driver (supported only on Savage4 hardware). | ||||
|     Changes: | ||||
| 	- Mesa now packaged in three parts: Library, Demos and GLUT | ||||
|     Bug fixes: | ||||
| 	- GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig | ||||
| 	- Some files were present multiple times in the 6.3.2 tarballs | ||||
| 	- r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) | ||||
| 	- glxgears_fbconfig demo didn't work (bug 4237) | ||||
| 	- fixed bug when bilinear sampling 2d textures with borders | ||||
| 	- glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) | ||||
| 	- fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) | ||||
| 	- fixed a few problems with proxy color tables (bug 4270) | ||||
| 	- fixed precision problem in Z clearing (bug 4395) | ||||
| 	- glBitmap, glDraw/CopyPixels mistakenly generated selection hits | ||||
| 	- fixed potential segfault caused by reading pixels outside | ||||
| 	  of renderbuffer bounds | ||||
| 	- glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB | ||||
| 	- fixed memory corruption bug involving software alpha buffers | ||||
| 	- glReadPixels clipped by window bounds was sometimes broken | ||||
| 	- glDraw/CopyPixels of stencil data ignored the stencil write mask | ||||
| 	- glReadPixels from a texture bound to a framebuffer object didn't work | ||||
| 	- glIsRender/FramebufferEXT weren't totally correct | ||||
| 	- fixed a number of point size attenuation/fade bugs | ||||
| 	- fixed glFogCoord bug 4729 | ||||
| 	- GLX encoding for transpose matrix functions was broken | ||||
| 	- fixed broken fragment program KIL and SWZ instructions | ||||
| </pre> | ||||
| <p> | ||||
| The MD5 checksums are: | ||||
| </p> | ||||
| <pre> | ||||
| 1cce0c1eb4fd15e9dfe837a1ce0c9812  MesaLib-6.4.tar.gz | ||||
| 85a84e47a3f718f752f306b9e0954ef6  MesaLib-6.4.tar.bz2 | ||||
| b976fea4f3ee06354c53f91b6e3f2ffc  MesaLib-6.4.zip | ||||
| d8734f2c69bcf7ef9f5ae454a85743ba  MesaDemos-6.4.tar.gz | ||||
| 1a8c4d4fc699233f5fdb902b8753099e  MesaDemos-6.4.tar.bz2 | ||||
| 607ab7c7a7de0cc5febbdde2bfa03098  MesaDemos-6.4.zip | ||||
| 3260156f66174322a092be0767962d34  MesaGLUT-6.4.tar.gz | ||||
| 0465d053f83775f44a12dec4050dfd78  MesaGLUT-6.4.tar.bz2 | ||||
| 02abfcdcdf72ba938ae00f6e3b70fbe0  MesaGLUT-6.4.zip | ||||
| </pre> | ||||
|  | ||||
|  | ||||
| <h2>August 19, 2005</h2> | ||||
| <p> | ||||
| Mesa 6.3.2 has been released. | ||||
| @@ -1051,6 +1102,6 @@ source code</a>.</p> | ||||
|  | ||||
|  | ||||
| <hr> | ||||
| $Id: news.html,v 3.24 2005/08/19 23:42:29 brianp Exp $ | ||||
| $Id: news.html,v 3.25 2005/10/24 23:33:27 brianp Exp $ | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
| @@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release. | ||||
| </p> | ||||
|  | ||||
| <UL> | ||||
| <LI><A HREF="RELNOTES-6.4">RELNOTES-6.4</A> | ||||
| <LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A> | ||||
| <LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A> | ||||
| <LI><A HREF="RELNOTES-6.2.1">RELNOTES-6.2.1</A> | ||||
|   | ||||
| @@ -33,7 +33,7 @@ Be warned that some drivers may be out of date and no longer function. | ||||
|  | ||||
| <UL> | ||||
| <LI>Xlib driver for the X Window System <A HREF="README.X11">(README.X11)</A> | ||||
| <li><a href="http://dri.sourceforge.net/" target="_parent"> | ||||
| <li><a href="http://dri.freedesktop.org/" target="_parent"> | ||||
| DRI hardware drivers</a> for the X window system | ||||
| <LI>Microsoft Windows <A HREF="README.WIN32">(README.WIN32)</A> | ||||
| <LI>DEC VMS <A HREF="README.VMS">(README.VMS)</A> | ||||
| @@ -53,4 +53,4 @@ DRI hardware drivers</a> for the X window system | ||||
| </UL> | ||||
|  | ||||
| </body> | ||||
| </html> | ||||
| </html> | ||||
|   | ||||
| @@ -2231,6 +2231,46 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen | ||||
| #endif /* GL_ATI_blend_equation_separate */ | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifndef GL_EXT_timer_query | ||||
| #define GL_EXT_timer_query 1 | ||||
|  | ||||
| /* Define 64-bit types */ | ||||
| #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||||
|    typedef long long int GLint64EXT; | ||||
|    typedef unsigned long long int GLuint64EXT; | ||||
| #elif defined(_WIN32) | ||||
|    typedef __int64 GLint64EXT; | ||||
|    typedef unsigned __int64 GLuint64EXT; | ||||
| #else | ||||
|    /* this might actually be a 32-bit type */ | ||||
|    typedef long int GLint64EXT; | ||||
|    typedef unsigned long int GLuint64EXT; | ||||
| #endif | ||||
|  | ||||
| #define GL_TIME_ELAPSED_EXT  0x88BF | ||||
|  | ||||
| GLAPI void GLAPIENTRY glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params); | ||||
| GLAPI void GLAPIENTRY glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params); | ||||
|  | ||||
| typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); | ||||
| typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); | ||||
|  | ||||
| #endif /* GL_EXT_timer_query */ | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifndef GL_EXT_packed_depth_stencil | ||||
| #define GL_EXT_packed_depth_stencil 1 | ||||
|  | ||||
| #define GL_DEPTH_STENCIL_EXT          0x84F9 | ||||
| #define GL_UNSIGNED_INT_24_8_EXT      0x84FA | ||||
| #define GL_DEPTH24_STENCIL8_EXT       0x88F0 | ||||
| #define GL_TEXTURE_STENCIL_SIZE_EXT   0x88F1 | ||||
|  | ||||
| #endif /* GL_EXT_packed_depth_stencil */ | ||||
|  | ||||
|  | ||||
| /** | ||||
|  ** NOTE!!!!!  If you add new functions to this file, or update | ||||
|  ** glext.h be sure to regenerate the gl_mangle.h file.  See comments | ||||
|   | ||||
| @@ -520,8 +520,10 @@ | ||||
| #define glGetProgramStringNV		MANGLE(GetProgramStringNV) | ||||
| #define glGetQueryivARB		MANGLE(GetQueryivARB) | ||||
| #define glGetQueryiv		MANGLE(GetQueryiv) | ||||
| #define glGetQueryObjecti64vEXT		MANGLE(GetQueryObjecti64vEXT) | ||||
| #define glGetQueryObjectivARB		MANGLE(GetQueryObjectivARB) | ||||
| #define glGetQueryObjectiv		MANGLE(GetQueryObjectiv) | ||||
| #define glGetQueryObjectui64vEXT		MANGLE(GetQueryObjectui64vEXT) | ||||
| #define glGetQueryObjectuivARB		MANGLE(GetQueryObjectuivARB) | ||||
| #define glGetQueryObjectuiv		MANGLE(GetQueryObjectuiv) | ||||
| #define glGetRenderbufferParameterivEXT		MANGLE(GetRenderbufferParameterivEXT) | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /* | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  5.1 | ||||
|  * Version:  6.5 | ||||
|  * | ||||
|  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. | ||||
|  * Copyright (C) 1999-2005  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"), | ||||
| @@ -65,7 +65,7 @@ glFBDevGetString( int str ); | ||||
| typedef void (*GLFBDevProc)(); | ||||
|  | ||||
|  | ||||
| extern const GLFBDevProc | ||||
| extern GLFBDevProc | ||||
| glFBDevGetProcAddress( const char *procName ); | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										152
									
								
								include/GL/glx.h
									
									
									
									
									
								
							
							
						
						
									
										152
									
								
								include/GL/glx.h
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  6.3 | ||||
|  * Version:  6.5 | ||||
|  *  | ||||
|  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved. | ||||
|  *  | ||||
| @@ -302,138 +302,6 @@ extern void (*glXGetProcAddress(const GLubyte *procname))( void ); | ||||
| #else | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 28. GLX_EXT_visual_info extension | ||||
|  */ | ||||
| #ifndef GLX_EXT_visual_info | ||||
| #define GLX_EXT_visual_info		1 | ||||
|  | ||||
| #define GLX_X_VISUAL_TYPE_EXT		0x22 | ||||
| #define GLX_TRANSPARENT_TYPE_EXT	0x23 | ||||
| #define GLX_TRANSPARENT_INDEX_VALUE_EXT	0x24 | ||||
| #define GLX_TRANSPARENT_RED_VALUE_EXT	0x25 | ||||
| #define GLX_TRANSPARENT_GREEN_VALUE_EXT	0x26 | ||||
| #define GLX_TRANSPARENT_BLUE_VALUE_EXT	0x27 | ||||
| #define GLX_TRANSPARENT_ALPHA_VALUE_EXT	0x28 | ||||
| #define GLX_TRUE_COLOR_EXT		0x8002 | ||||
| #define GLX_DIRECT_COLOR_EXT		0x8003 | ||||
| #define GLX_PSEUDO_COLOR_EXT		0x8004 | ||||
| #define GLX_STATIC_COLOR_EXT		0x8005 | ||||
| #define GLX_GRAY_SCALE_EXT		0x8006 | ||||
| #define GLX_STATIC_GRAY_EXT		0x8007 | ||||
| #define GLX_NONE_EXT			0x8000 | ||||
| #define GLX_TRANSPARENT_RGB_EXT		0x8008 | ||||
| #define GLX_TRANSPARENT_INDEX_EXT	0x8009 | ||||
|  | ||||
| #endif /* 28. GLX_EXT_visual_info extension */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 41. GLX_SGI_video_sync | ||||
|  */ | ||||
| #ifndef GLX_SGI_video_sync | ||||
| #define GLX_SGI_video_sync 1 | ||||
|  | ||||
| extern int glXGetVideoSyncSGI(unsigned int *count); | ||||
| extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count); | ||||
|  | ||||
| #endif /* GLX_SGI_video_sync */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 42. GLX_EXT_visual_rating | ||||
|  */ | ||||
| #ifndef GLX_EXT_visual_rating | ||||
| #define GLX_EXT_visual_rating		1 | ||||
|  | ||||
| #define GLX_VISUAL_CAVEAT_EXT		0x20 | ||||
| /*#define GLX_NONE_EXT			0x8000*/ | ||||
| #define GLX_SLOW_VISUAL_EXT		0x8001 | ||||
| #define GLX_NON_CONFORMANT_VISUAL_EXT	0x800D | ||||
|  | ||||
| #endif /* GLX_EXT_visual_rating	*/ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 47. GLX_EXT_import_context | ||||
|  */ | ||||
| #ifndef GLX_EXT_import_context | ||||
| #define GLX_EXT_import_context 1 | ||||
|  | ||||
| #define GLX_SHARE_CONTEXT_EXT		0x800A | ||||
| #define GLX_VISUAL_ID_EXT		0x800B | ||||
| #define GLX_SCREEN_EXT			0x800C | ||||
|  | ||||
| extern void glXFreeContextEXT(Display *dpy, GLXContext context); | ||||
|  | ||||
| extern GLXContextID glXGetContextIDEXT(const GLXContext context); | ||||
|  | ||||
| extern Display *glXGetCurrentDisplayEXT(void); | ||||
|  | ||||
| extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); | ||||
|  | ||||
| extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context, | ||||
|                                   int attribute,int *value); | ||||
|  | ||||
| #endif /* GLX_EXT_import_context */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 215. GLX_MESA_copy_sub_buffer | ||||
|  */ | ||||
| #ifndef GLX_MESA_copy_sub_buffer | ||||
| #define GLX_MESA_copy_sub_buffer 1 | ||||
|  | ||||
| extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, | ||||
|                                   int x, int y, int width, int height ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 216. GLX_MESA_pixmap_colormap | ||||
|  */ | ||||
| #ifndef GLX_MESA_pixmap_colormap | ||||
| #define GLX_MESA_pixmap_colormap 1 | ||||
|  | ||||
| extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, | ||||
|                                          Pixmap pixmap, Colormap cmap ); | ||||
|  | ||||
| #endif /* GLX_MESA_pixmap_colormap */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 217. GLX_MESA_release_buffers | ||||
|  */ | ||||
| #ifndef GLX_MESA_release_buffers | ||||
| #define GLX_MESA_release_buffers 1 | ||||
|  | ||||
| extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); | ||||
|  | ||||
| #endif /* GLX_MESA_release_buffers */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * 218. GLX_MESA_set_3dfx_mode | ||||
|  */ | ||||
| #ifndef GLX_MESA_set_3dfx_mode | ||||
| #define GLX_MESA_set_3dfx_mode 1 | ||||
|  | ||||
| #define GLX_3DFX_WINDOW_MODE_MESA       0x1 | ||||
| #define GLX_3DFX_FULLSCREEN_MODE_MESA   0x2 | ||||
|  | ||||
| extern Bool glXSet3DfxModeMESA( int mode ); | ||||
|  | ||||
| #endif /* GLX_MESA_set_3dfx_mode */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * ARB 2. GLX_ARB_get_proc_address | ||||
| @@ -441,7 +309,8 @@ extern Bool glXSet3DfxModeMESA( int mode ); | ||||
| #ifndef GLX_ARB_get_proc_address | ||||
| #define GLX_ARB_get_proc_address 1 | ||||
|  | ||||
| extern void (*glXGetProcAddressARB(const GLubyte *procName))(); | ||||
| typedef void (*__GLXextFuncPtr)(void); | ||||
| extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); | ||||
|  | ||||
| #endif /* GLX_ARB_get_proc_address */ | ||||
|  | ||||
| @@ -469,19 +338,6 @@ typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); | ||||
| #endif /* GLX_NV_vertex_array_range */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * ???. GLX_MESA_agp_offset | ||||
|  */  | ||||
| #ifndef GLX_MESA_agp_offset | ||||
| #define GLX_MESA_agp_offset 1 | ||||
|  | ||||
| extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer); | ||||
| typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer); | ||||
|  | ||||
| #endif /* GLX_MESA_agp_offset */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * ???. GLX_MESA_allocate_memory | ||||
|  */  | ||||
| @@ -497,8 +353,10 @@ typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const | ||||
|  | ||||
| #endif /* GLX_MESA_allocate_memory */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * ARB ?. GLX_ARB_render_texture | ||||
|  * XXX This was never finalized! | ||||
|  */ | ||||
| #ifndef GLX_ARB_render_texture | ||||
| #define GLX_ARB_render_texture 1 | ||||
|   | ||||
| @@ -39,7 +39,6 @@ | ||||
| #define DRI_INTERFACE_H | ||||
|  | ||||
| #include <GL/internal/glcore.h> | ||||
| #include <xf86drm.h> | ||||
| #include <drm.h> | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /* | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  6.3 | ||||
|  * Version:  6.5 | ||||
|  *  | ||||
|  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. | ||||
|  * Copyright (C) 1999-2005  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"), | ||||
| @@ -61,7 +61,7 @@ extern "C" { | ||||
|  | ||||
|  | ||||
| #define OSMESA_MAJOR_VERSION 6 | ||||
| #define OSMESA_MINOR_VERSION 3 | ||||
| #define OSMESA_MINOR_VERSION 5 | ||||
| #define OSMESA_PATCH_VERSION 0 | ||||
|  | ||||
|  | ||||
| @@ -267,6 +267,15 @@ GLAPI OSMESAproc GLAPIENTRY | ||||
| OSMesaGetProcAddress( const char *funcName ); | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Enable/disable color clamping, off by default. | ||||
|  * New in Mesa 6.4.2 | ||||
|  */ | ||||
| GLAPI void GLAPIENTRY | ||||
| OSMesaColorClamp(GLboolean enable); | ||||
|  | ||||
|  | ||||
| #if defined(__BEOS__) || defined(__QUICKDRAW__) | ||||
| #pragma export off | ||||
| #endif | ||||
|   | ||||
| @@ -78,7 +78,7 @@ typedef struct wmesa_context *WMesaContext; | ||||
|  * appropriate colormap. | ||||
|  * | ||||
|  * Input: | ||||
|  *         hWnd - Window handle | ||||
|  *         hDC - Windows device or memory context | ||||
|  *         Pal  - Palette to use | ||||
|  *         rgb_flag - GL_TRUE = RGB mode, | ||||
|  *                    GL_FALSE = color index mode | ||||
| @@ -91,7 +91,7 @@ typedef struct wmesa_context *WMesaContext; | ||||
|  * | ||||
|  * Return:  a WMesa_context or NULL if error. | ||||
|  */ | ||||
| extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal, | ||||
| extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal, | ||||
|                                        GLboolean rgb_flag, | ||||
|                                        GLboolean db_flag, | ||||
|                                        GLboolean alpha_flag); | ||||
|   | ||||
| @@ -235,21 +235,23 @@ GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, Na | ||||
| #ifndef EGL_MESA_screen_surface | ||||
| #define EGL_MESA_screen_surface 1 | ||||
|  | ||||
| #define EGL_BAD_SCREEN_MESA        0x4000 | ||||
| #define EGL_BAD_MODE_MESA          0x4001 | ||||
| #define EGL_SCREEN_COUNT_MESA      0x4002 | ||||
| #define EGL_SCREEN_POSITION_MESA   0x4003 | ||||
| #define EGL_MODE_ID_MESA           0x4004 | ||||
| #define EGL_REFRESH_RATE_MESA      0x4005 | ||||
| #define EGL_OPTIMAL_MODE_MESA      0x4006 | ||||
| #define EGL_SCREEN_BIT_MESA        0x08 | ||||
| #define EGL_BAD_SCREEN_MESA                    0x4000 | ||||
| #define EGL_BAD_MODE_MESA                      0x4001 | ||||
| #define EGL_SCREEN_COUNT_MESA                  0x4002 | ||||
| #define EGL_SCREEN_POSITION_MESA               0x4003 | ||||
| #define EGL_SCREEN_POSITION_GRANULARITY_MESA   0x4004 | ||||
| #define EGL_MODE_ID_MESA                       0x4005 | ||||
| #define EGL_REFRESH_RATE_MESA                  0x4006 | ||||
| #define EGL_OPTIMAL_MESA                       0x4007 | ||||
| #define EGL_INTERLACED_MESA                    0x4008 | ||||
| #define EGL_SCREEN_BIT_MESA                    0x08 | ||||
|  | ||||
| GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); | ||||
| GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); | ||||
| GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); | ||||
| GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); | ||||
| GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
| GLAPI EGLBoolean APIENTRY eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode); | ||||
| GLAPI EGLBoolean APIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode); | ||||
| GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); | ||||
| GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); | ||||
| GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); | ||||
|   | ||||
| @@ -25,6 +25,7 @@ PROGS = \ | ||||
| 	fplight \ | ||||
| 	gamma \ | ||||
| 	gears \ | ||||
| 	gearbox \ | ||||
| 	geartrain \ | ||||
| 	glinfo \ | ||||
| 	gloss \ | ||||
| @@ -37,13 +38,13 @@ PROGS = \ | ||||
| 	multiarb \ | ||||
| 	occlude \ | ||||
| 	paltex \ | ||||
| 	pixeltex \ | ||||
| 	pointblast \ | ||||
| 	ray \ | ||||
| 	readpix \ | ||||
| 	reflect \ | ||||
| 	renormal \ | ||||
| 	shadowtex \ | ||||
| 	singlebuffer \ | ||||
| 	spectex \ | ||||
| 	spriteblast \ | ||||
| 	stex3d \ | ||||
| @@ -51,7 +52,7 @@ PROGS = \ | ||||
| 	terrain \ | ||||
| 	tessdemo \ | ||||
| 	texcyl \ | ||||
| 	texdown \ | ||||
| 	texdown-pool \ | ||||
| 	texenv \ | ||||
| 	texobj \ | ||||
| 	trispd \ | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| ##### MACROS ##### | ||||
|  | ||||
| INCDIR = ([--.include],[-.util]) | ||||
| CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short) | ||||
| CFLAGS =/include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm | ||||
|  | ||||
| .ifdef SHARE | ||||
| GL_LIBS = $(XLIBS) | ||||
|   | ||||
| @@ -71,7 +71,9 @@ static void Display( void ) | ||||
|    glDisable(GL_SCISSOR_TEST); | ||||
|    glDisable(GL_FOG); | ||||
|  | ||||
|    if (!DrawFront) | ||||
|    if (DrawFront) | ||||
|       glFinish(); | ||||
|    else | ||||
|       glutSwapBuffers(); | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										486
									
								
								progs/demos/gearbox.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										486
									
								
								progs/demos/gearbox.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,486 @@ | ||||
| /* | ||||
|  * Use glCopyTexSubImage2D to draw animated gears on the sides of a box. | ||||
|  * | ||||
|  * Brian Paul | ||||
|  * 27 January 2006 | ||||
|  */ | ||||
|  | ||||
| #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 WinWidth = 800, WinHeight = 500; | ||||
| static GLint TexWidth, TexHeight; | ||||
| static GLuint TexObj = 1; | ||||
| static GLenum IntFormat = GL_RGBA; | ||||
|  | ||||
| static GLboolean WireFrame = GL_FALSE; | ||||
|  | ||||
| static GLint T0 = 0; | ||||
| static GLint Frames = 0; | ||||
| static GLint Win = 0; | ||||
|  | ||||
| static GLfloat ViewRotX = 20.0, ViewRotY = 30.0, ViewRotZ = 0.0; | ||||
| static GLint Gear1, Gear2, Gear3; | ||||
| static GLfloat GearRot = 0.0; | ||||
| static GLfloat CubeRot = 0.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 void | ||||
| cleanup(void) | ||||
| { | ||||
|    glDeleteTextures(1, &TexObj); | ||||
|    glDeleteLists(Gear1, 1); | ||||
|    glDeleteLists(Gear2, 1); | ||||
|    glDeleteLists(Gear3, 1); | ||||
|    glutDestroyWindow(Win); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| DrawGears(void) | ||||
| { | ||||
|    if (WireFrame) { | ||||
|       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); | ||||
|    } | ||||
|  | ||||
|    glPushMatrix(); | ||||
|       glRotatef(20/*ViewRotX*/, 1.0, 0.0, 0.0); | ||||
|       glRotatef(ViewRotY, 0.0, 1.0, 0.0); | ||||
|       glRotatef(ViewRotZ, 0.0, 0.0, 1.0); | ||||
|  | ||||
|       glPushMatrix(); | ||||
|          glTranslatef(-3.0, -2.0, 0.0); | ||||
|          glRotatef(GearRot, 0.0, 0.0, 1.0); | ||||
|          glCallList(Gear1); | ||||
|       glPopMatrix(); | ||||
|  | ||||
|       glPushMatrix(); | ||||
|          glTranslatef(3.1, -2.0, 0.0); | ||||
|          glRotatef(-2.0 * GearRot - 9.0, 0.0, 0.0, 1.0); | ||||
|          glCallList(Gear2); | ||||
|       glPopMatrix(); | ||||
|  | ||||
|       glPushMatrix(); | ||||
|          glTranslatef(-3.1, 4.2, 0.0); | ||||
|          glRotatef(-2.0 * GearRot - 25.0, 0.0, 0.0, 1.0); | ||||
|          glCallList(Gear3); | ||||
|       glPopMatrix(); | ||||
|  | ||||
|   glPopMatrix(); | ||||
|  | ||||
|   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| DrawCube(void) | ||||
| { | ||||
|    static const GLfloat texcoords[4][2] = { | ||||
|       { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } | ||||
|    }; | ||||
|    static const GLfloat vertices[4][2] = { | ||||
|       { -1, -1 }, { 1, -1 }, { 1, 1 }, { -1, 1 } | ||||
|    }; | ||||
|    static const GLfloat xforms[6][4] = { | ||||
|       {   0, 0, 1, 0 }, | ||||
|       {  90, 0, 1, 0 }, | ||||
|       { 180, 0, 1, 0 }, | ||||
|       { 270, 0, 1, 0 }, | ||||
|       {  90, 1, 0, 0 }, | ||||
|       { -90, 1, 0, 0 } | ||||
|    }; | ||||
|    static const GLfloat mat[4] = { 1.0, 1.0, 0.5, 1.0 }; | ||||
|    GLint i, j; | ||||
|  | ||||
|    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat); | ||||
|    glEnable(GL_TEXTURE_2D); | ||||
|  | ||||
|    glPushMatrix(); | ||||
|       glRotatef(ViewRotX, 1.0, 0.0, 0.0); | ||||
|       glRotatef(15, 1, 0, 0); | ||||
|       glRotatef(CubeRot, 0, 1, 0); | ||||
|       glScalef(4, 4, 4); | ||||
|  | ||||
|       for (i = 0; i < 6; i++) { | ||||
|          glPushMatrix(); | ||||
|             glRotatef(xforms[i][0], xforms[i][1], xforms[i][2], xforms[i][3]); | ||||
|             glTranslatef(0, 0, 1.1); | ||||
|             glBegin(GL_POLYGON); | ||||
|                glNormal3f(0, 0, 1); | ||||
|                for (j = 0; j < 4; j++) { | ||||
|                   glTexCoord2fv(texcoords[j]); | ||||
|                   glVertex2fv(vertices[j]); | ||||
|                } | ||||
|             glEnd(); | ||||
|          glPopMatrix(); | ||||
|       } | ||||
|    glPopMatrix(); | ||||
|  | ||||
|    glDisable(GL_TEXTURE_2D); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| draw(void) | ||||
| { | ||||
|    float ar; | ||||
|  | ||||
|    glMatrixMode(GL_MODELVIEW); | ||||
|    glLoadIdentity(); | ||||
|    glTranslatef(0.0, 0.0, -40.0); | ||||
|  | ||||
|    glDisable(GL_SCISSOR_TEST); | ||||
|    glClear(GL_DEPTH_BUFFER_BIT); | ||||
|    glEnable(GL_SCISSOR_TEST); | ||||
|  | ||||
|    /* draw gears */ | ||||
|    glViewport(0, 0, TexWidth, TexHeight); | ||||
|    glScissor(0, 0, TexWidth, TexHeight); | ||||
|    glClearColor(0.5, 0.5, 0.8, 0.0); | ||||
|    glClearColor(1, 1, 1, 0); | ||||
|    glClear(GL_COLOR_BUFFER_BIT); | ||||
|  | ||||
|    glMatrixMode(GL_PROJECTION); | ||||
|    glLoadIdentity(); | ||||
|    glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 60.0); | ||||
|    glMatrixMode(GL_MODELVIEW); | ||||
|  | ||||
|    DrawGears(); | ||||
|  | ||||
|    glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight); | ||||
|     | ||||
|    /* draw textured cube */ | ||||
|    glViewport(TexWidth, 0, WinWidth - TexWidth, WinHeight); | ||||
|    glScissor(TexWidth, 0, WinWidth - TexWidth, WinHeight); | ||||
|    glClearColor(0.5, 0.5, 0.8, 0.0); | ||||
|    glClear(GL_COLOR_BUFFER_BIT); | ||||
|  | ||||
|    ar = (float) (WinWidth - TexWidth) / WinHeight; | ||||
|    glMatrixMode(GL_PROJECTION); | ||||
|    glLoadIdentity(); | ||||
|    glFrustum(-ar, ar, -1.0, 1.0, 5.0, 60.0); | ||||
|    glMatrixMode(GL_MODELVIEW); | ||||
|  | ||||
|    DrawCube(); | ||||
|  | ||||
|    /* finish up */ | ||||
|    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; | ||||
|       } | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| idle(void) | ||||
| { | ||||
|   static double t0 = -1.; | ||||
|   double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; | ||||
|   if (t0 < 0.0) | ||||
|     t0 = t; | ||||
|   dt = t - t0; | ||||
|   t0 = t; | ||||
|  | ||||
|   GearRot += 70.0 * dt;  /* 70 degrees per second */ | ||||
|   GearRot = fmod(GearRot, 360.0); /* prevents eventual overflow */ | ||||
|  | ||||
|   CubeRot += 15.0 * dt; | ||||
|  | ||||
|   glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| /* change view angle, exit upon ESC */ | ||||
| static void | ||||
| key(unsigned char k, int x, int y) | ||||
| { | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    switch (k) { | ||||
|    case 'w': | ||||
|       WireFrame = !WireFrame; | ||||
|       break; | ||||
|    case 'z': | ||||
|       ViewRotZ += 5.0; | ||||
|       break; | ||||
|    case 'Z': | ||||
|       ViewRotZ -= 5.0; | ||||
|       break; | ||||
|    case 27:  /* Escape */ | ||||
|       cleanup(); | ||||
|       exit(0); | ||||
|       break; | ||||
|    default: | ||||
|       return; | ||||
|    } | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| /* change view angle */ | ||||
| static void | ||||
| special(int k, int x, int y) | ||||
| { | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    switch (k) { | ||||
|    case GLUT_KEY_UP: | ||||
|       ViewRotX += 5.0; | ||||
|       break; | ||||
|    case GLUT_KEY_DOWN: | ||||
|       ViewRotX -= 5.0; | ||||
|       break; | ||||
|    case GLUT_KEY_LEFT: | ||||
|       ViewRotY += 5.0; | ||||
|       break; | ||||
|    case GLUT_KEY_RIGHT: | ||||
|       ViewRotY -= 5.0; | ||||
|       break; | ||||
|    default: | ||||
|       return; | ||||
|    } | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| /* new window size or exposure */ | ||||
| static void | ||||
| reshape(int width, int height) | ||||
| { | ||||
|   WinWidth = width; | ||||
|   WinHeight = height; | ||||
| } | ||||
|  | ||||
|  | ||||
| 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); | ||||
| #if 0 | ||||
|   glEnable(GL_CULL_FACE); | ||||
| #endif | ||||
|   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); | ||||
|  | ||||
|   /* xxx make size dynamic */ | ||||
|   TexWidth = 256; | ||||
|   TexHeight = 256; | ||||
|  | ||||
|    glBindTexture(GL_TEXTURE_2D, TexObj); | ||||
|    glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0, | ||||
|                 GL_RGBA, GL_UNSIGNED_BYTE, NULL); | ||||
|    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||||
|    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||||
|    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | ||||
|  | ||||
|   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)); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| 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); | ||||
|  | ||||
|    glutInitWindowSize(WinWidth, WinHeight); | ||||
|    Win = glutCreateWindow("gearbox"); | ||||
|    init(argc, argv); | ||||
|  | ||||
|    glutDisplayFunc(draw); | ||||
|    glutReshapeFunc(reshape); | ||||
|    glutKeyboardFunc(key); | ||||
|    glutSpecialFunc(special); | ||||
|    glutVisibilityFunc(visible); | ||||
|  | ||||
|    glutMainLoop(); | ||||
|    return 0;             /* ANSI C requires main to return int. */ | ||||
| } | ||||
| @@ -234,7 +234,9 @@ idle(void) | ||||
|   dt = t - t0; | ||||
|   t0 = t; | ||||
|  | ||||
|   angle += 70.0 * dt;  /* 90 degrees per second */ | ||||
|   angle += 70.0 * dt;  /* 70 degrees per second */ | ||||
|   angle = fmod(angle, 360.0); /* prevents eventual overflow */ | ||||
|  | ||||
|   glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -176,6 +176,7 @@ So the angle is: | ||||
|  | ||||
| static int       mono=0; | ||||
| static int       smooth=1; | ||||
| static int       anim=1; | ||||
| static GLint     WindH, WindW; | ||||
| static GLfloat   step=0; | ||||
| static GLfloat   seno; | ||||
| @@ -660,13 +661,6 @@ static void draw_ico( void ) | ||||
| } | ||||
|  | ||||
| static void draw ( void ) { | ||||
|   static double t0 = -1.; | ||||
|   double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; | ||||
|   if (t0 < 0.0) | ||||
|      t0 = t; | ||||
|   dt = t - t0; | ||||
|   t0 = t; | ||||
|  | ||||
|   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); | ||||
|  | ||||
|   glPushMatrix(); | ||||
| @@ -688,11 +682,19 @@ static void draw ( void ) { | ||||
|  | ||||
|   glutSwapBuffers(); | ||||
|  | ||||
|   step += dt; | ||||
| } | ||||
|  | ||||
| static void idle_( void ) | ||||
| { | ||||
|   static double t0 = -1.; | ||||
|   double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; | ||||
|   if (t0 < 0.0) | ||||
|      t0 = t; | ||||
|   dt = t - t0; | ||||
|   t0 = t; | ||||
|  | ||||
|   step += dt; | ||||
|  | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| @@ -718,11 +720,19 @@ static void key( unsigned char k, int x, int y ) | ||||
|     case '4': object=4; break; | ||||
|     case '5': object=5; break; | ||||
|     case ' ': mono^=1; break; | ||||
|     case 13: smooth^=1; break; | ||||
|     case 's': smooth^=1; break; | ||||
|     case 'a': | ||||
|        anim^=1; | ||||
|        if (anim) | ||||
|           glutIdleFunc( idle_ ); | ||||
|        else | ||||
|           glutIdleFunc(NULL); | ||||
|        break; | ||||
|     case 27: | ||||
|        exit(0); | ||||
|   } | ||||
|   pinit(); | ||||
|   glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void pinit(void) | ||||
|   | ||||
| @@ -1,210 +0,0 @@ | ||||
| /* | ||||
|  * 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 "readtex.h" | ||||
|  | ||||
| #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; | ||||
| } | ||||
| @@ -186,11 +186,12 @@ Display( void ) | ||||
|    else { | ||||
|       /* clear the temporary image to white (helpful for debugging */ | ||||
|       memset(TempImage, 255, ImgWidth * ImgHeight * 4); | ||||
| #if 0 | ||||
|       /* you might use this when debugging */ | ||||
| #if 1 | ||||
|       glReadPixels(APosX, APosY, ImgWidth, ImgHeight, | ||||
|                    ReadFormat, ReadType, TempImage); | ||||
|       (void) ComplexReadPixels; | ||||
| #else | ||||
|       /* you might use this when debugging */ | ||||
|       ComplexReadPixels(APosX, APosY, ImgWidth, ImgHeight, | ||||
|                         ReadFormat, ReadType, TempImage); | ||||
| #endif | ||||
|   | ||||
| @@ -1,4 +1,3 @@ | ||||
|  | ||||
| /* | ||||
|  * Demo of a reflective, texture-mapped surface with OpenGL. | ||||
|  * Brian Paul   August 14, 1995   This file is in the public domain. | ||||
| @@ -24,9 +23,11 @@ | ||||
|  *   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) | ||||
|  *   Brian Paul (August 2005 - added multi window feature) | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <math.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| @@ -36,40 +37,102 @@ | ||||
|  | ||||
|  | ||||
| #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 GLboolean Anim = GL_TRUE; | ||||
|  | ||||
| /* performance info */ | ||||
| static GLint T0 = 0; | ||||
| static GLint Frames = 0; | ||||
| #define INIT_WIDTH 400 | ||||
| #define INIT_HEIGHT 300 | ||||
|  | ||||
|  | ||||
| static void make_table( void ) | ||||
| struct window { | ||||
|    int id;               /* returned by glutCreateWindow() */ | ||||
|    int width, height; | ||||
|    GLboolean anim; | ||||
|    GLfloat xrot, yrot; | ||||
|    GLfloat spin; | ||||
|    GLenum showBuffer; | ||||
|    GLenum drawBuffer; | ||||
|    GLuint table_list; | ||||
|    GLuint objects_list[MAX_OBJECTS]; | ||||
|    double t0; | ||||
|    struct window *next; | ||||
| }; | ||||
|  | ||||
|  | ||||
| static struct window *FirstWindow = NULL; | ||||
|  | ||||
|  | ||||
| static void | ||||
| CreateWindow(void); | ||||
|  | ||||
|  | ||||
| static struct window * | ||||
| CurrentWindow(void) | ||||
| { | ||||
|    int id = glutGetWindow(); | ||||
|    struct window *w; | ||||
|    for (w = FirstWindow; w; w = w->next) { | ||||
|       if (w->id == id) | ||||
|          return w; | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| static GLboolean | ||||
| AnyAnimating(void) | ||||
| { | ||||
|    struct window *w; | ||||
|    for (w = FirstWindow; w; w = w->next) { | ||||
|       if (w->anim) | ||||
|          return 1; | ||||
|    } | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| KillWindow(struct window *w) | ||||
| { | ||||
|    struct window *win, *prev = NULL; | ||||
|    for (win = FirstWindow; win; win = win->next) { | ||||
|       if (win == w) { | ||||
|          if (prev) { | ||||
|             prev->next = win->next; | ||||
|          } | ||||
|          else { | ||||
|             FirstWindow = win->next; | ||||
|          } | ||||
|          glutDestroyWindow(win->id); | ||||
|          win->next = NULL; | ||||
|          free(win); | ||||
|          return; | ||||
|       } | ||||
|       prev = win; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| KillAllWindows(void) | ||||
| { | ||||
|    while (FirstWindow) | ||||
|       KillWindow(FirstWindow); | ||||
| } | ||||
|  | ||||
|  | ||||
| static GLuint | ||||
| MakeTable(void) | ||||
| { | ||||
|    static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 }; | ||||
|    static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 }; | ||||
|    GLuint table_list; | ||||
|  | ||||
|    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_EMISSION, gray );*/ | ||||
|    glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat ); | ||||
|    glMaterialfv( GL_FRONT, GL_AMBIENT, gray ); | ||||
|     | ||||
| @@ -88,10 +151,12 @@ static void make_table( void ) | ||||
|    glDisable( GL_TEXTURE_2D ); | ||||
|  | ||||
|    glEndList(); | ||||
|    return table_list; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void make_objects( void ) | ||||
| static void | ||||
| MakeObjects(GLuint *objects_list) | ||||
| { | ||||
|    GLUquadricObj *q; | ||||
|  | ||||
| @@ -116,32 +181,36 @@ static void make_objects( void ) | ||||
|    glMaterialfv( GL_FRONT, GL_EMISSION, black ); | ||||
|    gluCylinder( q, 1.5, 0.0,  2.5, 15, 1 ); | ||||
|    glEndList(); | ||||
|  | ||||
|    gluDeleteQuadric(q); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void init( void ) | ||||
| static void | ||||
| InitWindow(struct window *w) | ||||
| { | ||||
|    make_table(); | ||||
|    make_objects(); | ||||
|    GLint imgWidth, imgHeight; | ||||
|    GLenum imgFormat; | ||||
|    GLubyte *image = NULL; | ||||
|  | ||||
|    Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat ); | ||||
|    if (!Image) { | ||||
|    w->table_list = MakeTable(); | ||||
|    MakeObjects(w->objects_list); | ||||
|  | ||||
|    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); | ||||
|    gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imgWidth, imgHeight, | ||||
|                      imgFormat, GL_UNSIGNED_BYTE, image); | ||||
|    free(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 ); | ||||
| @@ -153,14 +222,15 @@ static void init( void ) | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static void reshape(int w, int h) | ||||
| static void | ||||
| Reshape(int width, int height) | ||||
| { | ||||
|    struct window *w = CurrentWindow(); | ||||
|    GLfloat yAspect = 2.5; | ||||
|    GLfloat xAspect = yAspect * (float) w / (float) h; | ||||
|    Width = w; | ||||
|    Height = h; | ||||
|    glViewport(0, 0, w, h); | ||||
|    GLfloat xAspect = yAspect * (float) width / (float) height; | ||||
|    w->width = width; | ||||
|    w->height = height; | ||||
|    glViewport(0, 0, width, height); | ||||
|    glMatrixMode(GL_PROJECTION); | ||||
|    glLoadIdentity(); | ||||
|    glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 ); | ||||
| @@ -169,8 +239,8 @@ static void reshape(int w, int h) | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez ) | ||||
| static void | ||||
| DrawObjects(struct window *w, GLfloat eyex, GLfloat eyey, GLfloat eyez) | ||||
| { | ||||
|    (void) eyex; | ||||
|    (void) eyey; | ||||
| @@ -178,62 +248,65 @@ static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat 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(); | ||||
|       glPushMatrix(); | ||||
|       glTranslatef( 1.0, 1.5, 0.0 ); | ||||
|       glRotatef( w->spin, 1.0, 0.5, 0.0 ); | ||||
|       glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 ); | ||||
|       glCallList( w->objects_list[0] ); | ||||
|       glPopMatrix(); | ||||
|        | ||||
|       glPushMatrix(); | ||||
|       glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*w->spin) ), 0.0 ); | ||||
|       glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 ); | ||||
|       glRotatef( w->spin, 1.0, 0.5, 0.0 ); | ||||
|       glScalef( 0.5, 0.5, 0.5 ); | ||||
|       glCallList( w->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, 0.85+3.0*fabs( cos(0.01*w->spin) ), 0.0 ); | ||||
|       glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 ); | ||||
|       glRotatef( w->spin, 1.0, 0.5, 0.0 ); | ||||
|       glScalef( 0.5, 0.5, 0.5 ); | ||||
|       glCallList( w->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(); | ||||
|       glPushMatrix(); | ||||
|       glTranslatef( 1.0, 1.5, 0.0 ); | ||||
|       glRotatef( w->spin, 1.0, 0.5, 0.0 ); | ||||
|       glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 ); | ||||
|       glCallList( w->objects_list[0] ); | ||||
|       glPopMatrix(); | ||||
|    } | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static void draw_table( void ) | ||||
| static void | ||||
| DrawTable(struct window *w) | ||||
| { | ||||
|    glCallList( table_list ); | ||||
|    glCallList(w->table_list); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static void draw_scene( void ) | ||||
| static void | ||||
| DrawWindow(void) | ||||
| { | ||||
|    struct window *w = CurrentWindow(); | ||||
|    static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 }; | ||||
|    GLfloat dist = 20.0; | ||||
|    GLfloat eyex, eyey, eyez; | ||||
|  | ||||
|    glDrawBuffer(w->drawBuffer); | ||||
|    glReadBuffer(w->drawBuffer); | ||||
|  | ||||
|    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); | ||||
|    eyex = dist  *  cos(w->yrot * DEG2RAD)  *  cos(w->xrot * DEG2RAD); | ||||
|    eyez = dist  *  sin(w->yrot * DEG2RAD)  *  cos(w->xrot * DEG2RAD); | ||||
|    eyey = dist  *  sin(w->xrot * DEG2RAD); | ||||
|  | ||||
|    /* view from top */ | ||||
|    glPushMatrix(); | ||||
| @@ -247,7 +320,7 @@ static void draw_scene( void ) | ||||
|    glStencilFunc( GL_ALWAYS, 1, 0xffffffff ); | ||||
|    glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE ); | ||||
|    glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); | ||||
|    draw_table(); | ||||
|    DrawTable(w); | ||||
|    glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); | ||||
|  | ||||
|    glEnable( GL_DEPTH_TEST ); | ||||
| @@ -264,7 +337,7 @@ static void draw_scene( void ) | ||||
|       /* Reposition light in reflected space. */ | ||||
|       glLightfv(GL_LIGHT0, GL_POSITION, light_pos); | ||||
|  | ||||
|       draw_objects(eyex, eyey, eyez); | ||||
|       DrawObjects(w, eyex, eyey, eyez); | ||||
|       glPopMatrix(); | ||||
|  | ||||
|       /* Restore light's original unreflected position. */ | ||||
| @@ -277,128 +350,224 @@ static void draw_scene( void ) | ||||
|    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); | ||||
|  | ||||
|    glEnable( GL_TEXTURE_2D ); | ||||
|    draw_table(); | ||||
|    DrawTable(w); | ||||
|    glDisable( GL_TEXTURE_2D ); | ||||
|    glDisable( GL_BLEND ); | ||||
|  | ||||
|    /* view from top */ | ||||
|    glPushMatrix(); | ||||
|  | ||||
|    draw_objects(eyex, eyey, eyez); | ||||
|    DrawObjects(w, eyex, eyey, eyez); | ||||
|  | ||||
|    glPopMatrix(); | ||||
|  | ||||
|    glPopMatrix(); | ||||
|  | ||||
|    if (ShowBuffer == GL_DEPTH) { | ||||
|       ShowDepthBuffer(Width, Height, 1.0, 0.0); | ||||
|    if (w->showBuffer == GL_DEPTH) { | ||||
|       ShowDepthBuffer(w->width, w->height, 1.0, 0.0); | ||||
|    } | ||||
|    else if (ShowBuffer == GL_STENCIL) { | ||||
|       ShowStencilBuffer(Width, Height, 255.0, 0.0); | ||||
|    else if (w->showBuffer == GL_STENCIL) { | ||||
|       ShowStencilBuffer(w->width, w->height, 255.0, 0.0); | ||||
|    } | ||||
|    else if (ShowBuffer == GL_ALPHA) { | ||||
|       ShowAlphaBuffer(Width, Height); | ||||
|    else if (w->showBuffer == GL_ALPHA) { | ||||
|       ShowAlphaBuffer(w->width, w->height); | ||||
|    } | ||||
|  | ||||
|    glutSwapBuffers(); | ||||
|    if (w->drawBuffer == GL_BACK) | ||||
|       glutSwapBuffers(); | ||||
|    else | ||||
|       glFinish(); | ||||
|  | ||||
|    /* calc/show frame rate */ | ||||
|    { | ||||
|       static GLint t0 = 0; | ||||
|       static GLint frames = 0; | ||||
|       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; | ||||
|       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 idle( void ) | ||||
| static void | ||||
| Idle(void) | ||||
| { | ||||
|    static double t0 = -1.; | ||||
|    double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; | ||||
|    if (t0 < 0.0) | ||||
|       t0 = t; | ||||
|    dt = t - t0; | ||||
|    t0 = t; | ||||
|    spin += 60.0 * dt; | ||||
|    yrot += 90.0 * dt; | ||||
|    glutPostRedisplay(); | ||||
|    double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; | ||||
|    struct window *w; | ||||
|    for (w = FirstWindow; w; w = w->next) { | ||||
|       if (w->anim) { | ||||
|          double dt; | ||||
|          if (w->t0 < 0.0) | ||||
|             w->t0 = t; | ||||
|          dt = t - w->t0; | ||||
|          w->t0 = t; | ||||
|          w->spin += 60.0 * dt; | ||||
|          w->yrot += 90.0 * dt; | ||||
|          assert(w->id); | ||||
|          glutSetWindow(w->id); | ||||
|          glutPostRedisplay(); | ||||
|       } | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void Key( unsigned char key, int x, int y ) | ||||
| static void | ||||
| UpdateIdleFunc(void) | ||||
| { | ||||
|    if (AnyAnimating()) | ||||
|       glutIdleFunc(Idle); | ||||
|    else | ||||
|       glutIdleFunc(NULL); | ||||
| } | ||||
|  | ||||
| static void | ||||
| Key(unsigned char key, int x, int y) | ||||
| { | ||||
|    struct window *w = CurrentWindow(); | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    if (key == 'd') { | ||||
|       ShowBuffer = GL_DEPTH; | ||||
|    } | ||||
|    else if (key == 's') { | ||||
|       ShowBuffer = GL_STENCIL; | ||||
|    } | ||||
|    else if (key == 'a') { | ||||
|       ShowBuffer = GL_ALPHA; | ||||
|    } | ||||
|    else if (key == ' ') { | ||||
|       Anim = !Anim; | ||||
|       if (Anim) | ||||
|          glutIdleFunc(idle); | ||||
|  | ||||
|    switch (key) { | ||||
|    case 'd': | ||||
|       w->showBuffer = GL_DEPTH; | ||||
|       glutPostRedisplay(); | ||||
|       break; | ||||
|    case 's': | ||||
|       w->showBuffer = GL_STENCIL; | ||||
|       glutPostRedisplay(); | ||||
|       break; | ||||
|    case 'a': | ||||
|       w->showBuffer = GL_ALPHA; | ||||
|       glutPostRedisplay(); | ||||
|       break; | ||||
|    case 'c': | ||||
|       w->showBuffer = GL_NONE; | ||||
|       glutPostRedisplay(); | ||||
|       break; | ||||
|    case 'f': | ||||
|       if (w->drawBuffer == GL_FRONT) | ||||
|          w->drawBuffer = GL_BACK; | ||||
|       else | ||||
|          glutIdleFunc(NULL); | ||||
|    } | ||||
|    else if (key==27) { | ||||
|          w->drawBuffer = GL_FRONT; | ||||
|       glutPostRedisplay(); | ||||
|       break; | ||||
|    case ' ': | ||||
|       w->anim = !w->anim; | ||||
|       w->t0 = -1; | ||||
|       UpdateIdleFunc(); | ||||
|       glutPostRedisplay(); | ||||
|       break; | ||||
|    case 'n': | ||||
|       CreateWindow(); | ||||
|       UpdateIdleFunc(); | ||||
|       break; | ||||
|    case 'k': | ||||
|       KillWindow(w); | ||||
|       if (FirstWindow == NULL) | ||||
|          exit(0); | ||||
|       break; | ||||
|    case 27: | ||||
|       KillAllWindows(); | ||||
|       exit(0); | ||||
|       break; | ||||
|    default: | ||||
|       ; | ||||
|    } | ||||
|    else { | ||||
|       ShowBuffer = GL_NONE; | ||||
|    } | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void SpecialKey( int key, int x, int y ) | ||||
| static void | ||||
| SpecialKey(int key, int x, int y) | ||||
| { | ||||
|    struct window *w = CurrentWindow(); | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    switch (key) { | ||||
|       case GLUT_KEY_UP: | ||||
|          xrot += 3.0; | ||||
|          if ( xrot > 85 ) | ||||
|             xrot = 85; | ||||
|          w->xrot += 3.0; | ||||
|          if (w->xrot > 85) | ||||
|             w->xrot = 85; | ||||
|          break; | ||||
|       case GLUT_KEY_DOWN: | ||||
|          xrot -= 3.0; | ||||
|          if ( xrot < 5 ) | ||||
|             xrot = 5; | ||||
|          w->xrot -= 3.0; | ||||
|          if (w->xrot < 5) | ||||
|             w->xrot = 5; | ||||
|          break; | ||||
|       case GLUT_KEY_LEFT: | ||||
|          yrot += 3.0; | ||||
|          w->yrot += 3.0; | ||||
|          break; | ||||
|       case GLUT_KEY_RIGHT: | ||||
|          yrot -= 3.0; | ||||
|          w->yrot -= 3.0; | ||||
|          break; | ||||
|    } | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| int main( int argc, char *argv[] ) | ||||
| static void | ||||
| CreateWindow(void) | ||||
| { | ||||
|    glutInit(&argc, argv); | ||||
|    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL | GLUT_ALPHA); | ||||
|    glutInitWindowPosition( 0, 0 ); | ||||
|    glutInitWindowSize( Width, Height ); | ||||
|    glutCreateWindow(argv[0]); | ||||
|    glutReshapeFunc(reshape); | ||||
|    glutDisplayFunc(draw_scene); | ||||
|    char title[1000]; | ||||
|    struct window *w = (struct window *) calloc(1, sizeof(struct window)); | ||||
|     | ||||
|    glutInitWindowSize(INIT_WIDTH, INIT_HEIGHT); | ||||
|    w->id = glutCreateWindow("foo"); | ||||
|    sprintf(title, "reflect window %d", w->id); | ||||
|    glutSetWindowTitle(title); | ||||
|    assert(w->id); | ||||
|    w->width = INIT_WIDTH; | ||||
|    w->height = INIT_HEIGHT; | ||||
|    w->anim = GL_TRUE; | ||||
|    w->xrot = 30.0; | ||||
|    w->yrot = 50.0; | ||||
|    w->spin = 0.0; | ||||
|    w->showBuffer = GL_NONE; | ||||
|    w->drawBuffer = GL_BACK; | ||||
|  | ||||
|    InitWindow(w); | ||||
|  | ||||
|    glutReshapeFunc(Reshape); | ||||
|    glutDisplayFunc(DrawWindow); | ||||
|    glutKeyboardFunc(Key); | ||||
|    glutSpecialFunc(SpecialKey); | ||||
|    glutIdleFunc(idle); | ||||
|    init(); | ||||
|  | ||||
|    /* insert at head of list */ | ||||
|    w->next = FirstWindow; | ||||
|    FirstWindow = w; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Usage(void) | ||||
| { | ||||
|    printf("Keys:\n"); | ||||
|    printf("  a      - show alpha buffer\n"); | ||||
|    printf("  d      - show depth buffer\n"); | ||||
|    printf("  s      - show stencil buffer\n"); | ||||
|    printf("  c      - show color buffer\n"); | ||||
|    printf("  f      - toggle rendering to front/back color buffer\n"); | ||||
|    printf("  n      - create new window\n"); | ||||
|    printf("  k      - kill window\n"); | ||||
|    printf("  SPACE  - toggle animation\n"); | ||||
|    printf("  ARROWS - rotate scene\n"); | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    glutInit(&argc, argv); | ||||
|    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | | ||||
|                        GLUT_STENCIL | GLUT_ALPHA); | ||||
|    CreateWindow(); | ||||
|    glutIdleFunc(Idle); | ||||
|    Usage(); | ||||
|    glutMainLoop(); | ||||
|    return 0; | ||||
| } | ||||
|   | ||||
							
								
								
									
										269
									
								
								progs/demos/singlebuffer.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										269
									
								
								progs/demos/singlebuffer.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,269 @@ | ||||
| /* | ||||
|  * Demo of (nearly) flicker-free drawing with a single color buffer. | ||||
|  * | ||||
|  * Basically, draw the scene into the Z buffer first, then draw the | ||||
|  * scene into the color buffer.  Finally, "clear" the background by | ||||
|  * setting the fragments we didn't hit earlier. | ||||
|  * | ||||
|  * This won't work if you need blending.  The technique works best | ||||
|  * when the scene is relatively simple and can be rendered quickly | ||||
|  * (i.e. with hardware), and when the objects don't move too much from | ||||
|  * one frame to the next. | ||||
|  * | ||||
|  * Brian Paul | ||||
|  * 25 August 2005 | ||||
|  * | ||||
|  * See Mesa license for terms. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
| #define FLICKER 0 | ||||
| #define NO_FLICKER 1 | ||||
|  | ||||
| static GLint Mode = NO_FLICKER; | ||||
| static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; | ||||
| static GLboolean Anim = GL_TRUE; | ||||
| static GLfloat ClearColor[4] = {0.2, 0.2, 0.9, 0.0}; | ||||
| static GLfloat NearClip = 5.0, FarClip = 25.0, ViewDist = 7.0; | ||||
| static double PrevTime = -1; | ||||
|  | ||||
| struct box { | ||||
|    float tx, ty, tz; | ||||
|    float rx, ry, rz, ra; | ||||
|    float sx, sy, sz; | ||||
|    float color[4]; | ||||
| }; | ||||
|  | ||||
| #define NUM_BOXES 25 | ||||
|  | ||||
| struct box Boxes[NUM_BOXES]; | ||||
|  | ||||
|  | ||||
| /* Return random float in [0,1] */ | ||||
| static float | ||||
| Random(void) | ||||
| { | ||||
|    int i = rand(); | ||||
|    return (float) (i % 1000) / 1000.0; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| MakeBoxes(void) | ||||
| { | ||||
|    int i; | ||||
|    for (i = 0; i < NUM_BOXES; i++) { | ||||
|       Boxes[i].tx = -1.0 + 2.0 * Random(); | ||||
|       Boxes[i].ty = -1.0 + 2.0 * Random(); | ||||
|       Boxes[i].tz = -1.0 + 2.0 * Random(); | ||||
|       Boxes[i].sx = 0.1 + Random() * 0.4; | ||||
|       Boxes[i].sy = 0.1 + Random() * 0.4; | ||||
|       Boxes[i].sz = 0.1 + Random() * 0.4; | ||||
|       Boxes[i].rx = Random(); | ||||
|       Boxes[i].ry = Random(); | ||||
|       Boxes[i].rz = Random(); | ||||
|       Boxes[i].ra = Random() * 360.0; | ||||
|       Boxes[i].color[0] = Random(); | ||||
|       Boxes[i].color[1] = Random(); | ||||
|       Boxes[i].color[2] = Random(); | ||||
|       Boxes[i].color[3] = 1.0; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| DrawBoxes(void) | ||||
| { | ||||
|    int i; | ||||
|    for (i = 0; i < NUM_BOXES; i++) { | ||||
|       glPushMatrix(); | ||||
|       glTranslatef(Boxes[i].tx, Boxes[i].ty, Boxes[i].tz); | ||||
|       glRotatef(Boxes[i].ra, Boxes[i].rx, Boxes[i].ry, Boxes[i].rz); | ||||
|       glScalef(Boxes[i].sx, Boxes[i].sy, Boxes[i].sz); | ||||
|       glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, Boxes[i].color); | ||||
|       glutSolidCube(1.0); | ||||
|       glPopMatrix(); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Idle(void) | ||||
| { | ||||
|    double dt, t = glutGet(GLUT_ELAPSED_TIME) * 0.001; | ||||
|    if (PrevTime < 0.0) | ||||
|       PrevTime = t; | ||||
|    dt = t - PrevTime; | ||||
|    PrevTime = t; | ||||
|    Xrot += 16.0 * dt; | ||||
|    Yrot += 12.0 * dt; | ||||
|    Zrot += 8.0 * dt; | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Draw(void) | ||||
| { | ||||
|    if (Mode == FLICKER) { | ||||
|       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||||
|    } | ||||
|    else { | ||||
|       /* don't clear color buffer */ | ||||
|       glClear(GL_DEPTH_BUFFER_BIT); | ||||
|       /* update Z buffer only */ | ||||
|       glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); | ||||
|    } | ||||
|  | ||||
|    glPushMatrix(); | ||||
|    glRotatef(Xrot, 1, 0, 0); | ||||
|    glRotatef(Yrot, 0, 1, 0); | ||||
|    glRotatef(Zrot, 0, 0, 1); | ||||
|  | ||||
|    DrawBoxes(); | ||||
|  | ||||
|    if (Mode == NO_FLICKER) { | ||||
|       /* update color buffer now */ | ||||
|       glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | ||||
|       glDepthFunc(GL_EQUAL); | ||||
|       DrawBoxes(); | ||||
|       glDepthFunc(GL_LESS); | ||||
|    } | ||||
|  | ||||
|    glPopMatrix(); | ||||
|  | ||||
|    if (Mode == NO_FLICKER) { | ||||
|       /* "clear" the untouched pixels now. | ||||
|        * Note: if you comment-out this code you'll see something interesting. | ||||
|        */ | ||||
|       GLfloat x = FarClip / NearClip; | ||||
|       GLfloat z = -(FarClip - ViewDist - 1.0); | ||||
|       glDisable(GL_LIGHTING); | ||||
|       glColor4fv(ClearColor); | ||||
|       glBegin(GL_POLYGON); | ||||
|       glVertex3f(-x, -x, z); | ||||
|       glVertex3f( x, -x, z); | ||||
|       glVertex3f( x,  x, z); | ||||
|       glVertex3f(-x,  x, z); | ||||
|       glEnd(); | ||||
|       glEnable(GL_LIGHTING); | ||||
|    } | ||||
|  | ||||
|    /* This is where you'd normally do SwapBuffers */ | ||||
|    glFinish(); | ||||
| } | ||||
|  | ||||
|  | ||||
| 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, NearClip, FarClip); | ||||
|    glMatrixMode(GL_MODELVIEW); | ||||
|    glLoadIdentity(); | ||||
|    glTranslatef(0.0, 0.0, -ViewDist); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Key(unsigned char key, int x, int y) | ||||
| { | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    switch (key) { | ||||
|       case 'a': | ||||
|          Anim = !Anim; | ||||
|          if (Anim) | ||||
|             glutIdleFunc(Idle); | ||||
|          else | ||||
|             glutIdleFunc(NULL); | ||||
|          PrevTime = -1; | ||||
|          break; | ||||
|       case 'm': | ||||
|          Mode = !Mode; | ||||
|          break; | ||||
|       case 'b': | ||||
|          MakeBoxes(); | ||||
|          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) | ||||
| { | ||||
|    glClearColor(ClearColor[0], ClearColor[1], ClearColor[2], ClearColor[3]); | ||||
|    glEnable(GL_DEPTH_TEST); | ||||
|    glEnable(GL_LIGHTING); | ||||
|    glEnable(GL_LIGHT0); | ||||
|    glEnable(GL_CULL_FACE); | ||||
|    glEnable(GL_NORMALIZE); | ||||
|    MakeBoxes(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Usage(void) | ||||
| { | ||||
|    printf("Keys:\n"); | ||||
|    printf("  m       - toggle drawing mode (flicker vs. no flicker)\n"); | ||||
|    printf("  a       - toggle animation\n"); | ||||
|    printf("  b       - generate new boxes\n"); | ||||
|    printf("  ARROWS  - rotate scene\n"); | ||||
|    printf("  ESC     - exit\n"); | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    glutInit(&argc, argv); | ||||
|    glutInitWindowSize(800, 800); | ||||
|    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH); | ||||
|    glutCreateWindow(argv[0]); | ||||
|    glutReshapeFunc(Reshape); | ||||
|    glutKeyboardFunc(Key); | ||||
|    glutSpecialFunc(SpecialKey); | ||||
|    glutDisplayFunc(Draw); | ||||
|    if (Anim) | ||||
|       glutIdleFunc(Idle); | ||||
|    Init(); | ||||
|    Usage(); | ||||
|    glutMainLoop(); | ||||
|    return 0; | ||||
| } | ||||
| @@ -38,8 +38,8 @@ | ||||
| #include <GL/glut.h> | ||||
| 
 | ||||
| 
 | ||||
| static GLsizei MaxSize = 1024; | ||||
| static GLsizei TexWidth = 256, TexHeight = 256, TexBorder = 0; | ||||
| static GLsizei MaxSize = 2048; | ||||
| static GLsizei TexWidth = 1024, TexHeight = 1024, TexBorder = 0; | ||||
| static GLboolean ScaleAndBias = GL_FALSE; | ||||
| static GLboolean SubImage = GL_FALSE; | ||||
| static GLdouble DownloadRate = 0.0;  /* texels/sec */ | ||||
| @@ -47,6 +47,32 @@ static GLdouble DownloadRate = 0.0;  /* texels/sec */ | ||||
| static GLuint Mode = 0; | ||||
| 
 | ||||
| 
 | ||||
| /* Try and avoid L2 cache effects by cycling through a small number of
 | ||||
|  * textures. | ||||
|  *  | ||||
|  * At the initial size of 1024x1024x4 == 4mbyte, say 8 textures will | ||||
|  * keep us out of most caches at 32mb total. | ||||
|  * | ||||
|  * This turns into a fairly interesting question of what exactly you | ||||
|  * expect to be in cache in normal usage, and what you think should be | ||||
|  * outside.  There's no rules for this, no reason to favour one usage | ||||
|  * over another except what the application you care about happens to | ||||
|  * resemble most closely. | ||||
|  * | ||||
|  * - Should the client texture image be in L2 cache?  Has it just been | ||||
|  *   generated or read from disk? | ||||
|  * - Does the application really use >1 texture, or is it constantly  | ||||
|  *   updating one image in-place? | ||||
|  * | ||||
|  * Different answers will favour different texture upload mechanisms. | ||||
|  * To upload an image that is purely outside of cache, a DMA-based | ||||
|  * upload will probably win, whereas for small, in-cache textures, | ||||
|  * copying looks good. | ||||
|  */ | ||||
| #define NR_TEXOBJ 4 | ||||
| static GLuint TexObj[NR_TEXOBJ]; | ||||
| 
 | ||||
| 
 | ||||
| struct FormatRec { | ||||
|    GLenum Format; | ||||
|    GLenum Type; | ||||
| @@ -116,25 +142,57 @@ TypeStr(GLenum type) | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| /* On x86, there is a performance cliff for memcpy to texture memory
 | ||||
|  * for sources below 64 byte alignment.  We do our best with this in | ||||
|  * the driver, but it is better if the images are correctly aligned to | ||||
|  * start with: | ||||
|  */ | ||||
| #define ALIGN (1<<12) | ||||
| 
 | ||||
| static unsigned align(unsigned value, unsigned a) | ||||
| { | ||||
|    return (value + a - 1) & ~(a-1); | ||||
| } | ||||
| 
 | ||||
| static int MIN2(int a, int b) | ||||
| { | ||||
|    return a < b ? a : b; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| MeasureDownloadRate(void) | ||||
| { | ||||
|    const int w = TexWidth + 2 * TexBorder; | ||||
|    const int h = TexHeight + 2 * TexBorder; | ||||
|    const int bytes = w * h * BytesPerTexel(Format); | ||||
|    const int image_bytes = align(w * h * BytesPerTexel(Format), ALIGN); | ||||
|    const int bytes = image_bytes * NR_TEXOBJ; | ||||
|    GLubyte *orig_texImage, *orig_getImage; | ||||
|    GLubyte *texImage, *getImage; | ||||
|    GLdouble t0, t1, time; | ||||
|    int count; | ||||
|    int i; | ||||
|    int offset = 0; | ||||
|    GLdouble total = 0;		/* ints will tend to overflow */ | ||||
| 
 | ||||
|    texImage = (GLubyte *) malloc(bytes); | ||||
|    getImage = (GLubyte *) malloc(bytes); | ||||
|    if (!texImage || !getImage) { | ||||
|    printf("allocating %d bytes for %d %dx%d images\n", | ||||
| 	  bytes, NR_TEXOBJ, w, h); | ||||
| 
 | ||||
|    orig_texImage = (GLubyte *) malloc(bytes + ALIGN); | ||||
|    orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN); | ||||
|    if (!orig_texImage || !orig_getImage) { | ||||
|       DownloadRate = 0.0; | ||||
|       return; | ||||
|    } | ||||
| 
 | ||||
|    printf("alloc %p %p\n", orig_texImage, orig_getImage); | ||||
| 
 | ||||
|    texImage = (GLubyte *)align((unsigned)orig_texImage, ALIGN); | ||||
|    getImage = (GLubyte *)align((unsigned)orig_getImage, ALIGN);    | ||||
| 
 | ||||
|    for (i = 1; !(((unsigned)texImage) & i); i<<=1) | ||||
|       ; | ||||
|    printf("texture image alignment: %d bytes (%p)\n", i, texImage); | ||||
|        | ||||
|    for (i = 0; i < bytes; i++) { | ||||
|       texImage[i] = i & 0xff; | ||||
|    } | ||||
| @@ -166,51 +224,80 @@ MeasureDownloadRate(void) | ||||
|    count = 0; | ||||
|    t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; | ||||
|    do { | ||||
|       int img = count%NR_TEXOBJ; | ||||
|       GLubyte *img_ptr = texImage + img * image_bytes; | ||||
| 
 | ||||
|       glBindTexture(GL_TEXTURE_2D, TexObj[img]); | ||||
| 
 | ||||
|       if (SubImage && count > 0) { | ||||
|          glTexSubImage2D(GL_TEXTURE_2D, 0, -TexBorder, -TexBorder, w, h, | ||||
| 	 /* Only update a portion of the image each iteration.  This
 | ||||
| 	  * is presumably why you'd want to use texsubimage, otherwise | ||||
| 	  * you may as well just call teximage again. | ||||
| 	  * | ||||
| 	  * A bigger question is whether to use a pointer that moves | ||||
| 	  * with each call, ie does the incoming data come from L2 | ||||
| 	  * cache under normal circumstances, or is it pulled from | ||||
| 	  * uncached memory?   | ||||
| 	  *  | ||||
| 	  * There's a good argument to say L2 cache, ie you'd expect | ||||
| 	  * the data to have been recently generated.  It's possible | ||||
| 	  * that it could have come from a file read, which may or may | ||||
| 	  * not have gone through the cpu. | ||||
| 	  */ | ||||
|          glTexSubImage2D(GL_TEXTURE_2D, 0,  | ||||
| 			 -TexBorder,  | ||||
| 			 -TexBorder + offset * h/8,  | ||||
| 			 w,  | ||||
| 			 h/8, | ||||
|                          FormatTable[Format].Format, | ||||
|                          FormatTable[Format].Type, texImage); | ||||
|                          FormatTable[Format].Type,  | ||||
| #if 1 | ||||
| 			 texImage /* likely in L2$ */ | ||||
| #else | ||||
| 			 img_ptr + offset * bytes/8 /* unlikely in L2$ */ | ||||
| #endif | ||||
| 	    ); | ||||
| 	 offset += 1; | ||||
| 	 offset %= 8; | ||||
| 	 total += w * h / 8; | ||||
|       } | ||||
|       else { | ||||
|          glTexImage2D(GL_TEXTURE_2D, 0, | ||||
|                       FormatTable[Format].IntFormat, w, h, TexBorder, | ||||
|                       FormatTable[Format].Format, | ||||
|                       FormatTable[Format].Type, texImage); | ||||
|                       FormatTable[Format].Type,  | ||||
| 		      img_ptr); | ||||
| 	 total += w*h; | ||||
|       } | ||||
| 
 | ||||
| #if 1 | ||||
|       /* Render a texture, but not necessarily the one just uploaded.  
 | ||||
|        */ | ||||
| /*       glBindTexture(GL_TEXTURE_2D, TexObj[(img + NR_TEXOBJ/2)%NR_TEXOBJ]); */ | ||||
| 
 | ||||
|       /* draw a tiny polygon to force texture into texram */ | ||||
|       glBegin(GL_TRIANGLES); | ||||
|       glTexCoord2f(0, 0);     glVertex2f(1, 1); | ||||
|       glTexCoord2f(1, 0);     glVertex2f(3, 1); | ||||
|       glTexCoord2f(0.5, 1);   glVertex2f(2, 3); | ||||
|       glEnd(); | ||||
| /*       glFinish(); */ | ||||
| #endif | ||||
| 
 | ||||
|       t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; | ||||
|       time = t1 - t0; | ||||
|       count++; | ||||
| /*       printf("total %f count %d\n", total, count); */ | ||||
|    } while (time < 3.0); | ||||
| 
 | ||||
|    glDisable(GL_TEXTURE_2D); | ||||
| 
 | ||||
|    printf("w*h=%d  count=%d  time=%f\n", w*h, count, time); | ||||
|    DownloadRate = w * h * count / time; | ||||
|    printf("total texels=%f  time=%f\n", total, time); | ||||
|    DownloadRate = total / 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); | ||||
|    free(orig_texImage);  | ||||
|    free(orig_getImage);  | ||||
| 
 | ||||
|    { | ||||
|       GLint err = glGetError(); | ||||
| @@ -92,7 +92,7 @@ static void idle( void ) | ||||
|    dt = t - t0; | ||||
|    t0 = t; | ||||
|    Angle += 120.0*dt; | ||||
|    glutPostRedisplay(); | ||||
| /*    glutPostRedisplay(); */ | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -152,7 +152,7 @@ main(int argc, char *argv[]) | ||||
|       return 0; | ||||
|    } | ||||
|     | ||||
|    eglShowSurfaceMESA(d, screen, screen_surf, mode); | ||||
|    eglShowScreenSurfaceMESA(d, screen, screen_surf, mode); | ||||
|  | ||||
|    b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); | ||||
|    if (!b) { | ||||
|   | ||||
| @@ -603,7 +603,7 @@ main(int argc, char *argv[]) | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    eglShowSurfaceMESA(d, screen, screen_surf, mode); | ||||
|    eglShowScreenSurfaceMESA(d, screen, screen_surf, mode); | ||||
|  | ||||
|    b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); | ||||
|    if (!b) { | ||||
|   | ||||
| @@ -35,6 +35,8 @@ | ||||
| #include <GLES/egl.h> | ||||
| #include <assert.h> | ||||
|  | ||||
| #define MAX_CONFIGS 10 | ||||
| #define MAX_MODES 100 | ||||
|  | ||||
| #define BENCHMARK | ||||
|  | ||||
| @@ -87,9 +89,11 @@ 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 GLfloat eyesep = 5.0;		/* Eye separation. */ | ||||
| //static GLfloat fix_point = 40.0;	/* Fixation point distance.  */ | ||||
| //static GLfloat left, right, asp;	/* Stereo frustum params.  */ | ||||
| #if 0 | ||||
| static GLfloat eyesep = 5.0;		/* Eye separation. */ | ||||
| static GLfloat fix_point = 40.0;	/* Fixation point distance.  */ | ||||
| static GLfloat left, right, asp;	/* Stereo frustum params.  */ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* | ||||
| @@ -339,7 +343,6 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr) | ||||
| 		 | ||||
| 		draw(); | ||||
| 		 | ||||
| 		// DBR : Swap the Buffers | ||||
| 		eglSwapBuffers(dpy, surf); | ||||
| 	 | ||||
| 		 | ||||
| @@ -359,21 +362,18 @@ main(int argc, char *argv[]) | ||||
| 	int maj, min; | ||||
| 	EGLContext ctx; | ||||
| 	EGLSurface screen_surf; | ||||
| 	EGLConfig configs[10]; | ||||
| 	EGLConfig configs[MAX_CONFIGS]; | ||||
| 	EGLint numConfigs, i; | ||||
| 	EGLBoolean b; | ||||
| 	 | ||||
| 	const EGLint screenAttribs[] = { | ||||
| 		EGL_WIDTH, 1024, | ||||
| 		EGL_HEIGHT, 768, | ||||
| 		EGL_NONE | ||||
| 	}; | ||||
| 	 | ||||
| 	EGLModeMESA mode; | ||||
| 	EGLDisplay d; | ||||
| 	EGLint screenAttribs[10]; | ||||
| 	EGLModeMESA mode[MAX_MODES]; | ||||
| 	EGLScreenMESA screen; | ||||
| 	EGLint count;	 | ||||
| 	EGLint count, chosenMode; | ||||
| 	GLboolean printInfo = GL_FALSE; | ||||
| 	EGLint width = 0, height = 0; | ||||
| 	 | ||||
|         /* parse cmd line args */ | ||||
| 	for (i = 1; i < argc; i++) | ||||
| 	{ | ||||
| 		if (strcmp(argv[i], "-info") == 0) | ||||
| @@ -384,42 +384,73 @@ main(int argc, char *argv[]) | ||||
| 			printf("Warning: unknown parameter: %s\n", argv[i]); | ||||
| 	} | ||||
| 	 | ||||
| 	// DBR : Create EGL context/surface etc | ||||
| 	EGLDisplay d = eglGetDisplay(":0"); | ||||
| 	/* DBR : Create EGL context/surface etc */ | ||||
|         d = eglGetDisplay(":0"); | ||||
| 	assert(d); | ||||
|  | ||||
| 	if (!eglInitialize(d, &maj, &min)) { | ||||
| 		printf("demo: eglInitialize failed\n"); | ||||
| 		printf("eglgears: eglInitialize failed\n"); | ||||
| 		exit(1); | ||||
| 	} | ||||
| 	 | ||||
| 	printf("EGL version = %d.%d\n", maj, min); | ||||
| 	printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); | ||||
| 	printf("eglgears: EGL version = %d.%d\n", maj, min); | ||||
| 	printf("eglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); | ||||
| 	 | ||||
| 	eglGetConfigs(d, configs, 10, &numConfigs); | ||||
|         /* XXX use ChooseConfig */ | ||||
| 	eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs); | ||||
| 	eglGetScreensMESA(d, &screen, 1, &count); | ||||
| 	eglGetModesMESA(d, screen, &mode, 1, &count); | ||||
|  | ||||
| 	if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) { | ||||
| 		printf("eglgears: eglGetModesMESA failed!\n"); | ||||
| 		return 0; | ||||
| 	} | ||||
|  | ||||
|         /* Print list of modes, and find the one to use */ | ||||
| 	printf("eglgears: Found %d modes:\n", count); | ||||
| 	for (i = 0; i < count; i++) { | ||||
| 		EGLint w, h; | ||||
| 		eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w); | ||||
| 		eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h); | ||||
| 		printf("%3d: %d x %d\n", i, w, h); | ||||
| 		if (w > width && h > height && w <= 1280 && h <= 1024) { | ||||
| 			width = w; | ||||
| 			height = h; | ||||
|                         chosenMode = i; | ||||
| 		} | ||||
| 	} | ||||
| 	printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height); | ||||
|  | ||||
| 	ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); | ||||
| 	if (ctx == EGL_NO_CONTEXT) { | ||||
| 		printf("failed to create context\n"); | ||||
| 		printf("eglgears: failed to create context\n"); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	 | ||||
| 	/* build up screenAttribs array */ | ||||
| 	i = 0; | ||||
| 	screenAttribs[i++] = EGL_WIDTH; | ||||
| 	screenAttribs[i++] = width; | ||||
| 	screenAttribs[i++] = EGL_HEIGHT; | ||||
| 	screenAttribs[i++] = height; | ||||
| 	screenAttribs[i++] = EGL_NONE; | ||||
|  | ||||
| 	screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs); | ||||
| 	if (screen_surf == EGL_NO_SURFACE) { | ||||
| 		printf("failed to create screen surface\n"); | ||||
| 		printf("eglgears: failed to create screen surface\n"); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	 | ||||
| 	eglShowSurfaceMESA(d, screen, screen_surf, mode); | ||||
| 	 | ||||
| 	b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]); | ||||
| 	if (!b) { | ||||
| 		printf("eglgears: show surface failed\n"); | ||||
| 		return 0; | ||||
| 	} | ||||
|  | ||||
| 	b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); | ||||
| 	if (!b) { | ||||
| 		printf("make current failed\n"); | ||||
| 		printf("eglgears: make current failed\n"); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	// DBR | ||||
| 	 | ||||
| 	if (printInfo) | ||||
| 	{ | ||||
| @@ -429,20 +460,16 @@ main(int argc, char *argv[]) | ||||
| 		printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); | ||||
| 	} | ||||
| 	 | ||||
| 	init();			// Initialise the GL visual | ||||
| 	reshape(1024,768); | ||||
| 	init(); | ||||
| 	reshape(width, height); | ||||
|  | ||||
|    glDrawBuffer( GL_BACK ); | ||||
|         glDrawBuffer( GL_BACK ); | ||||
|  | ||||
| 	// DBR : Run the simulation | ||||
| 	run_gears(d, screen_surf, 5.0); | ||||
| 	 | ||||
| 	 | ||||
| 	// DBR : Destroy EGL context/surface etc | ||||
| 	eglDestroySurface(d, screen_surf); | ||||
| 	eglDestroyContext(d, ctx); | ||||
| 	eglTerminate(d); | ||||
| 	// DBR | ||||
| 	 | ||||
| 	return 0; | ||||
| } | ||||
|   | ||||
| @@ -48,9 +48,9 @@ PrintConfigs(EGLDisplay d) | ||||
|    eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs); | ||||
|  | ||||
|    printf("Configurations:\n"); | ||||
|    printf("     bf lv d st colorbuffer dp st   supported \n"); | ||||
|    printf("     bf lv d st colorbuffer dp st   supported\n"); | ||||
|    printf("  id sz  l b ro  r  g  b  a th cl   surfaces  \n"); | ||||
|    printf("----------------------------------------------\n"); | ||||
|    printf("---------------------------------------------------\n"); | ||||
|    for (i = 0; i < numConfigs; i++) { | ||||
|       EGLint id, size, level; | ||||
|       EGLint red, green, blue, alpha; | ||||
| @@ -77,6 +77,10 @@ PrintConfigs(EGLDisplay d) | ||||
|          strcat(surfString, "pb,"); | ||||
|       if (surfaces & EGL_PIXMAP_BIT) | ||||
|          strcat(surfString, "pix,"); | ||||
| #ifdef EGL_MESA_screen_surface | ||||
|       if (surfaces & EGL_SCREEN_BIT_MESA) | ||||
|          strcat(surfString, "scrn,"); | ||||
| #endif | ||||
|       if (strlen(surfString) > 0) | ||||
|          surfString[strlen(surfString) - 1] = 0; | ||||
|  | ||||
| @@ -136,7 +140,7 @@ main(int argc, char *argv[]) | ||||
| { | ||||
|    int maj, min; | ||||
|    /*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/ | ||||
|    EGLDisplay d = eglGetDisplay("!r200_dri"); | ||||
|    EGLDisplay d = eglGetDisplay(":0"); | ||||
|  | ||||
|    if (!eglInitialize(d, &maj, &min)) { | ||||
|       printf("eglinfo: eglInitialize failed\n"); | ||||
|   | ||||
							
								
								
									
										127
									
								
								progs/fp/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								progs/fp/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,127 @@ | ||||
| # progs/tests/Makefile | ||||
|  | ||||
|  | ||||
| # These programs aren't intended to be included with the normal distro. | ||||
| # They're not too interesting but they're good for testing. | ||||
|  | ||||
| TOP = ../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
|  | ||||
| LIBS = $(APP_LIB_DEPS) | ||||
|  | ||||
| SOURCES = \ | ||||
| 	tri-abs.c \ | ||||
| 	tri-add.c \ | ||||
| 	tri-cmp.c \ | ||||
| 	tri-cos.c \ | ||||
| 	tri-dp3.c \ | ||||
| 	tri-dp4.c \ | ||||
| 	tri-dph.c \ | ||||
| 	tri-dst.c \ | ||||
| 	tri-ex2.c \ | ||||
| 	tri-flr.c \ | ||||
| 	tri-frc.c \ | ||||
| 	tri-kil.c \ | ||||
| 	tri-lg2.c \ | ||||
| 	tri-lit.c \ | ||||
| 	tri-lrp.c \ | ||||
| 	tri-mad.c \ | ||||
| 	tri-max.c \ | ||||
| 	tri-min.c \ | ||||
| 	tri-mov.c \ | ||||
| 	tri-mul.c \ | ||||
| 	tri-pow.c \ | ||||
| 	tri-param.c \ | ||||
| 	tri-rcp.c \ | ||||
| 	tri-rsq.c \ | ||||
| 	tri-scs.c \ | ||||
| 	tri-sge.c \ | ||||
| 	tri-sge2.c \ | ||||
| 	tri-sin.c \ | ||||
| 	tri-slt.c \ | ||||
| 	tri-sub.c \ | ||||
| 	tri-swz.c \ | ||||
| 	tri-swz2.c \ | ||||
| 	tri-tex.c \ | ||||
| 	tri-xpd.c \ | ||||
| 	tri-position.c \ | ||||
| 	tri-depth.c \ | ||||
| 	tri-depth2.c \ | ||||
| 	tri-depthwrite.c \ | ||||
| 	tri-depthwrite2.c \ | ||||
|  | ||||
| NOTDONE=\ | ||||
| 	tri-txb.c \ | ||||
| 	tri-txp.c \ | ||||
| 	tri-depthwrite.c \ | ||||
| 	tri-fogoption.c  | ||||
|  | ||||
|  | ||||
| PROGS = $(SOURCES:%.c=%) | ||||
|  | ||||
| INCLUDES = -I. -I$(TOP)/include -I../samples | ||||
|  | ||||
| UTIL_FILES = readtex.h readtex.c | ||||
|  | ||||
|  | ||||
| ##### RULES ##### | ||||
|  | ||||
| .SUFFIXES: | ||||
| .SUFFIXES: .c | ||||
|  | ||||
| .c: | ||||
| 	$(CC) $(INCLUDES) $(CFLAGS) $< $(LIBS) -o $@ | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ | ||||
|  | ||||
| .S.o: | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@ | ||||
|  | ||||
|  | ||||
| ##### TARGETS ##### | ||||
|  | ||||
| default: $(UTIL_FILES) $(PROGS) | ||||
|  | ||||
| clean: | ||||
| 	rm -f $(PROGS) | ||||
| 	rm -f *.o | ||||
| 	rm -f getproclist.h | ||||
|  | ||||
|  | ||||
| # auto code generation | ||||
| getprocaddress: getprocaddress.c getproclist.h | ||||
|  | ||||
| getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py | ||||
| 	python getprocaddress.py > getproclist.h | ||||
|  | ||||
|  | ||||
| texrect: texrect.o readtex.o | ||||
| 	$(CC) texrect.o readtex.o $(LIBS) -o $@ | ||||
|  | ||||
| texrect.o: texrect.c readtex.h | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ | ||||
|  | ||||
| invert: invert.o readtex.o | ||||
| 	$(CC) invert.o readtex.o $(LIBS) -o $@ | ||||
|  | ||||
| invert.o: invert.c readtex.h | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ | ||||
|  | ||||
| readtex.o: readtex.c | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ | ||||
|  | ||||
|  | ||||
| readtex.h: $(TOP)/progs/util/readtex.h | ||||
| 	ln -s $(TOP)/progs/util/readtex.h . | ||||
|  | ||||
| readtex.c: $(TOP)/progs/util/readtex.c | ||||
| 	ln -s $(TOP)/progs/util/readtex.c . | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| # Emacs tags | ||||
| tags: | ||||
| 	etags `find . -name \*.[ch]` `find ../include` | ||||
							
								
								
									
										107
									
								
								progs/fp/tri-abs.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								progs/fp/tri-abs.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "SUB R0, {0.5}.x, fragment.color; \n" | ||||
|       "ABS result.color, R0; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-add.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-add.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "ADD R0, fragment.color, fragment.color; \n" | ||||
|       "ADD result.color, R0, R0; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-cmp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-cmp.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "SUB R0, {0.5}.x, fragment.color; \n" | ||||
|       "CMP result.color, R0, fragment.color, {0.0}.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										113
									
								
								progs/fp/tri-cos.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								progs/fp/tri-cos.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,113 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0; \n" | ||||
|       "MUL R0, fragment.color, {3.14}.x; \n" | ||||
|       "COS result.color.x, R0.x; \n" | ||||
|       "COS result.color.y, R0.y; \n" | ||||
|       "COS result.color.z, R0.z; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										111
									
								
								progs/fp/tri-depth.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								progs/fp/tri-depth.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    /* scale of 10.0 gives me a visible result on nv hardware. | ||||
|     */ | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MUL result.color, fragment.position.z, {10.0}.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -40.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -40.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -25.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										116
									
								
								progs/fp/tri-depth2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								progs/fp/tri-depth2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,116 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    /* scale of 10.0 gives me a visible result on nv hardware. | ||||
|     */ | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "MUL R0, fragment.position.z, {10.0}.x;\n" | ||||
|       "MOV result.color, R0; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); | ||||
|    glEnable(GL_DEPTH_TEST); | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1); | ||||
| 	glVertex3f( 0.9, -0.9, -30.0); | ||||
| 	glVertex3f( 0.9,  0.9, -30.0); | ||||
| 	glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glColor3f(0,1,0); | ||||
| 	glVertex3f(-0.9, -0.9, -40.0); | ||||
| 	glVertex3f(-0.9,  0.9, -40.0); | ||||
| 	glVertex3f( 0.9,  0.0, -25.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB | GLUT_DEPTH; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										107
									
								
								progs/fp/tri-depthwrite.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								progs/fp/tri-depthwrite.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
| static void Init(void) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MUL result.depth.z, fragment.color.z, {.1}.x; \n" | ||||
|       "MOV result.color.xy, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|     glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); | ||||
| 	glEnable(GL_DEPTH_TEST); | ||||
|  | ||||
|  | ||||
|     glBegin(GL_TRIANGLES); | ||||
|     glColor4f(.8,0,.5,0); | ||||
| 	glVertex3f( 0.9, -0.9, -30.0); | ||||
| 	glVertex3f( 0.9,  0.9, -30.0); | ||||
| 	glVertex3f(-0.9,  0.0, -30.0); | ||||
|  | ||||
|     glColor4f(0,.8,.7,0); | ||||
| 	glVertex3f(-0.9, -0.9, -40.0); | ||||
|     glColor4f(0,.8,.7,0); | ||||
| 	glVertex3f(-0.9,  0.9, -40.0); | ||||
|     glColor4f(0,.8,.3,0); | ||||
| 	glVertex3f( 0.9,  0.0, -40.0); | ||||
|     glEnd(); | ||||
|  | ||||
|     glFlush(); | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); | ||||
|  | ||||
|     glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE); | ||||
|  | ||||
|     if (glutCreateWindow("Depth Test") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										107
									
								
								progs/fp/tri-depthwrite2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								progs/fp/tri-depthwrite2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
| static void Init(void) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MUL result.depth.z, fragment.color.z, {.1}.x; \n" | ||||
|       "MOV result.color, fragment.color.z; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|     glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); | ||||
| 	glEnable(GL_DEPTH_TEST); | ||||
|  | ||||
|  | ||||
|     glBegin(GL_TRIANGLES); | ||||
|     glColor4f(.8,0,.5,0); | ||||
| 	glVertex3f( 0.9, -0.9, -30.0); | ||||
| 	glVertex3f( 0.9,  0.9, -30.0); | ||||
| 	glVertex3f(-0.9,  0.0, -30.0); | ||||
|  | ||||
|     glColor4f(0,.8,.7,0); | ||||
| 	glVertex3f(-0.9, -0.9, -40.0); | ||||
|     glColor4f(0,.8,.7,0); | ||||
| 	glVertex3f(-0.9,  0.9, -40.0); | ||||
|     glColor4f(0,.8,.3,0); | ||||
| 	glVertex3f( 0.9,  0.0, -40.0); | ||||
|     glEnd(); | ||||
|  | ||||
|     glFlush(); | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); | ||||
|  | ||||
|     glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE); | ||||
|  | ||||
|     if (glutCreateWindow("Depth Test") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-dp3.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-dp3.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "DP3 result.color, fragment.color, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-dp4.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-dp4.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "DP4 result.color, fragment.color.xxxx, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-dph.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-dph.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "DPH result.color, fragment.color, fragment.color.xyzx; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-dst.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-dst.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "DST result.color, fragment.color, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-ex2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-ex2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "EX2 R0, fragment.color.x; \n" | ||||
|       "SUB result.color, R0, {1.0}.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-flr.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-flr.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "ADD R0, fragment.color, {0.5}.x; \n" | ||||
|       "FLR result.color,  R0; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-fp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-fp.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "SLT result.color, {0.5}.x, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										111
									
								
								progs/fp/tri-frc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								progs/fp/tri-frc.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0; \n" | ||||
|       "MUL R0, fragment.color, {3.0}.x; \n" | ||||
|       "FRC result.color, R0; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-inv.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-inv.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "INV result.color, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										111
									
								
								progs/fp/tri-kil.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								progs/fp/tri-kil.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "SUB R0, fragment.color, {0.5,0,0,0}; \n" | ||||
|       "KIL R0;" | ||||
|       "MOV result.color, R0;" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-lg2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-lg2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "MUL R0, fragment.color, {4.0}.x; \n" | ||||
|       "LG2 result.color, R0.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										111
									
								
								progs/fp/tri-lit.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								progs/fp/tri-lit.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "SUB R0, {0.5}.x, fragment.color; \n" | ||||
|       "LIT result.color, R0; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-lrp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-lrp.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0, R1;\n" | ||||
|       "LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-mad.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-mad.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0, R1;\n" | ||||
|       "MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-max.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-max.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MAX result.color, {0.5}.x, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-min.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-min.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MIN result.color, {0.5}.x, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										102
									
								
								progs/fp/tri-mov.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								progs/fp/tri-mov.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,102 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MOV result.color, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB | GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-mul.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-mul.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MUL result.color, fragment.color, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										114
									
								
								progs/fp/tri-param.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								progs/fp/tri-param.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,114 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MOV result.color, program.local[32]; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|    glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, .5, 0.25, 1); | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.0, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, 0, 0.25, 1); | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9,  0.0, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB | GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-position.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-position.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "MUL result.color, fragment.position, {.005}.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-pow.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-pow.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "POW result.color,  fragment.color.x, fragment.color.y; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-rcp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-rcp.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "ADD R0, fragment.color.x, fragment.color.x; \n" | ||||
|       "RCP result.color, R0.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										110
									
								
								progs/fp/tri-rsq.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								progs/fp/tri-rsq.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "MUL R0, fragment.color, {3.0}.x; \n" | ||||
|       "RSQ result.color, R0.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										111
									
								
								progs/fp/tri-scs.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								progs/fp/tri-scs.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0; \n" | ||||
|       "MUL R0, fragment.color, {3.14}.x; \n" | ||||
|       "SCS result.color, R0.x; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										109
									
								
								progs/fp/tri-sge.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								progs/fp/tri-sge.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "SGE result.color, {0.5}.x, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										114
									
								
								progs/fp/tri-sge2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								progs/fp/tri-sge2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,114 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include "GL/gl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| static void Init( void ) | ||||
| { | ||||
|    static const char *modulate2D = | ||||
|       "!!ARBfp1.0\n" | ||||
|       "TEMP R0;\n" | ||||
|       "TEMP R1;\n" | ||||
|       "SGE R0, fragment.color, fragment.color.yzxw; \n" | ||||
|       "SGE R1, fragment.color, fragment.color.zxyw; \n" | ||||
|       "MUL R0, R0, R1; \n" | ||||
|       "MUL result.color, R0, fragment.color; \n" | ||||
|       "END" | ||||
|       ; | ||||
|    GLuint modulateProg; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_ARB_fragment_program")) { | ||||
|       printf("Error: GL_ARB_fragment_program not supported!\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* Setup the fragment program */ | ||||
|    glGenProgramsARB(1, &modulateProg); | ||||
|    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); | ||||
|    glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, | ||||
|                         strlen(modulate2D), (const GLubyte *)modulate2D); | ||||
|  | ||||
|    printf("glGetError = 0x%x\n", (int) glGetError()); | ||||
|    printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", | ||||
|           (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); | ||||
|  | ||||
|    glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|  | ||||
|    glClearColor(.3, .3, .3, 0); | ||||
| } | ||||
|  | ||||
| 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); | ||||
|       default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
| static void Draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT);  | ||||
|  | ||||
|    glBegin(GL_TRIANGLES); | ||||
|    glColor3f(0,0,1);  | ||||
|    glVertex3f( 0.9, -0.9, -30.0); | ||||
|    glColor3f(1,0,0);  | ||||
|    glVertex3f( 0.9,  0.9, -30.0); | ||||
|    glColor3f(0,1,0);  | ||||
|    glVertex3f(-0.9,  0.0, -30.0); | ||||
|    glEnd(); | ||||
|  | ||||
|    glFlush(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|     GLenum type; | ||||
|  | ||||
|     glutInit(&argc, argv); | ||||
|  | ||||
|  | ||||
|  | ||||
|     glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); | ||||
|  | ||||
|     type = GLUT_RGB; | ||||
|     type |= GLUT_SINGLE; | ||||
|     glutInitDisplayMode(type); | ||||
|  | ||||
|     if (glutCreateWindow("First Tri") == GL_FALSE) { | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     Init(); | ||||
|  | ||||
|     glutReshapeFunc(Reshape); | ||||
|     glutKeyboardFunc(Key); | ||||
|     glutDisplayFunc(Draw); | ||||
|     glutMainLoop(); | ||||
| 	return 0; | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user