mirror of
https://github.com/glfw/glfw.git
synced 2026-09-24 01:28:58 +00:00
Compare commits
739 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29b40112c2 | |||
| 1d7898b5ea | |||
| 3d204b1afd | |||
| 821f3e674a | |||
| 1a004264f4 | |||
| 8f08661d9e | |||
| eb7688df8f | |||
| e8f8ec027d | |||
| d493a82f9e | |||
| a75e43ef22 | |||
| cb11b7ca6f | |||
| 75b7720d00 | |||
| 5bbc2b4949 | |||
| 76fff4d042 | |||
| c43f082993 | |||
| 6e20cda7fd | |||
| 4596663232 | |||
| d79beb9539 | |||
| 46888206be | |||
| c1dce0f617 | |||
| 6e9788a9e6 | |||
| d90f5e0429 | |||
| bbfdedff01 | |||
| 8d910d7950 | |||
| 48f4a591de | |||
| e8ce4ab8e8 | |||
| d586fe6737 | |||
| c5353646b6 | |||
| 1247fc030f | |||
| a8bc2af649 | |||
| 4d146cb39d | |||
| cf7dc1d737 | |||
| a343e9a475 | |||
| dc4f0f6c91 | |||
| 98e36753e6 | |||
| 85de0db05d | |||
| 11c22d6a17 | |||
| 75a6d87542 | |||
| 5f21e213df | |||
| f4c127f75a | |||
| 93855ae6ab | |||
| ac8dba2a80 | |||
| f5c9265d1b | |||
| 21280ca775 | |||
| ead8a1c333 | |||
| 4188c263e3 | |||
| 3efff4e8de | |||
| 479fa6408a | |||
| ce196232a7 | |||
| ce8f97c23c | |||
| 4e375d0e74 | |||
| 500f5ebf04 | |||
| 1591caa0e5 | |||
| bb338a2b9c | |||
| 4329a78011 | |||
| 023f337735 | |||
| d311e28038 | |||
| 6c7509c942 | |||
| 0e3cb945e8 | |||
| 40d1a491ca | |||
| dcc78017b0 | |||
| 9ec1a4361b | |||
| 40f7d4fce0 | |||
| ead3937394 | |||
| cbc18bf968 | |||
| 0fcbaeb596 | |||
| fe7a4eb4ff | |||
| 2b57d176df | |||
| bb3dd31dd7 | |||
| e132945f71 | |||
| 58e9d7a8ec | |||
| 439417a22c | |||
| 3c70155504 | |||
| 138feb8be6 | |||
| 2085876da6 | |||
| e64699bd54 | |||
| 5f6aa9c34c | |||
| 893e03e5d2 | |||
| 59afffb373 | |||
| 1634742177 | |||
| d459145d28 | |||
| 641761ddb0 | |||
| f9c1f85f02 | |||
| 3833a70b8d | |||
| 45eebb39fb | |||
| a6ded4d3fe | |||
| 287514e849 | |||
| aa7f827e72 | |||
| 2bed33ab15 | |||
| 54a1fad13b | |||
| e480c76a11 | |||
| e57da19d4a | |||
| 81bcefe86c | |||
| 4783b17fa3 | |||
| 56202ee7c6 | |||
| b19fb4c24d | |||
| 5964f74e3a | |||
| e0132c3099 | |||
| 01c0c3ca1f | |||
| 9aa15aa710 | |||
| a611144d0c | |||
| b2030f6d73 | |||
| 44372b89f6 | |||
| 2a1375e97c | |||
| 1495134398 | |||
| 2b62858770 | |||
| a6ba9d6bcd | |||
| 1dc84989bf | |||
| ce0e74f6a9 | |||
| 0c44a6be7f | |||
| e1ae9af5a0 | |||
| b81a19928d | |||
| 1021948313 | |||
| e778b83667 | |||
| a71a52ddd6 | |||
| d300aa3255 | |||
| f306ea2f5d | |||
| 0a5d57eade | |||
| a8b0d1c8e0 | |||
| cc10527706 | |||
| 5c003d3fbe | |||
| 916371e04c | |||
| e059f012d7 | |||
| 46c0dc4788 | |||
| 13ac6e9a82 | |||
| 10a74924e3 | |||
| 8d5043f409 | |||
| c03f273941 | |||
| 4674ed367d | |||
| f4f525549c | |||
| ac73c2bd6c | |||
| cb4ccc59c2 | |||
| d76d56ce74 | |||
| 50cf4cfda3 | |||
| 9bd0fae684 | |||
| 8712d84bcc | |||
| 49696d0134 | |||
| 4295b77582 | |||
| 46c9663ed7 | |||
| 10d1d278f3 | |||
| cfb7d2f036 | |||
| bc219056a6 | |||
| 899117e785 | |||
| 382133b384 | |||
| 8de5c4e3b8 | |||
| c112804539 | |||
| 70c349f36b | |||
| 34bf1b13e9 | |||
| 9f58d8d715 | |||
| 1285e07f1b | |||
| 49ec306a0a | |||
| 6743761c2c | |||
| da7fec86c4 | |||
| 3b9a14fc9c | |||
| 4c64e94d39 | |||
| b4c4ba0439 | |||
| f611ba8aa0 | |||
| 5052b2d7e0 | |||
| a21f2377bc | |||
| b140606a49 | |||
| 6a3779d635 | |||
| 2d13eb0920 | |||
| 496567d3f1 | |||
| 3afa831e28 | |||
| f4a467a864 | |||
| 5f13279557 | |||
| bb98eae131 | |||
| 8167e8897e | |||
| b2ddb85e62 | |||
| 653079b792 | |||
| a6c57dc6f1 | |||
| fb90d5b0ec | |||
| 45d528baed | |||
| 2a255e49e2 | |||
| 96d230becb | |||
| e0c26f0ec5 | |||
| 6be821c18b | |||
| 95654cfada | |||
| 4dd669661b | |||
| b1033a3443 | |||
| cd51d285e6 | |||
| 6e8e94837d | |||
| 468714cab9 | |||
| 4918514eaf | |||
| 2488c67798 | |||
| 4591ad2d64 | |||
| c769061a8a | |||
| cec63f3cb5 | |||
| 49579165a7 | |||
| e57b8212ce | |||
| 58c390991c | |||
| 4b27050afe | |||
| a0742e99e3 | |||
| 99cedceef5 | |||
| 1b6d8a6ed6 | |||
| 8fd69bc6c2 | |||
| 5bbb837635 | |||
| 5ca875a7ff | |||
| e9c7314d50 | |||
| 4ae6eae58d | |||
| 7dba90b7ca | |||
| 41d998eb3c | |||
| 25204b1ec7 | |||
| 8d170c7f47 | |||
| 66c3af7628 | |||
| 4aa9174e76 | |||
| 3fcc2a6cb2 | |||
| f8d80a936f | |||
| c85294e0b2 | |||
| 82dc6c8b8f | |||
| 2eb5ed33be | |||
| b1fd3c00d0 | |||
| c700978c45 | |||
| 5d525c4a5f | |||
| e5d890a1aa | |||
| 44c899ce70 | |||
| cfc47abf0d | |||
| 77d2a2131d | |||
| 9ccb966a3a | |||
| d5cf713c20 | |||
| 10ee8b4e27 | |||
| a5281df501 | |||
| 59d1aa52f2 | |||
| 626dbf6057 | |||
| 452e95d02a | |||
| 4ce884fa52 | |||
| 839721b926 | |||
| 8cd88ddf61 | |||
| 87fb437d76 | |||
| e74ebf0be3 | |||
| 26f86ac50a | |||
| b4d4fc8f79 | |||
| 3b7d34a1d5 | |||
| aa4ec94d71 | |||
| dd043d737f | |||
| 6e0ea02f17 | |||
| 87490316c8 | |||
| 036da0fb4e | |||
| a7c9ca3b43 | |||
| c39ebfe1b8 | |||
| 434d0947e5 | |||
| acf6bfb1f6 | |||
| 2c5c6a1ff5 | |||
| 08dccc390d | |||
| 70fd348432 | |||
| cd93df4fe0 | |||
| 0364457947 | |||
| 9c545d6a14 | |||
| c015852498 | |||
| 7135f203f5 | |||
| 5a48f3123f | |||
| ef60891c2c | |||
| 704dc3e34d | |||
| 3eae79f6e0 | |||
| 76f78cf123 | |||
| 2230a68e42 | |||
| 896d040c68 | |||
| 9ac854b7bb | |||
| 2f71bfc152 | |||
| 819e148510 | |||
| 7d373477ed | |||
| a75cf5a163 | |||
| 4c68049d86 | |||
| dea861abd8 | |||
| 51208601a4 | |||
| 2ea74e60f9 | |||
| db5b089cee | |||
| ce3ff08932 | |||
| 30eccfd454 | |||
| eb13951fb2 | |||
| 271d9fc76e | |||
| 55b5ca0bcc | |||
| 46a56ea742 | |||
| 96b12ee504 | |||
| 9b6c14b7ae | |||
| 215924f797 | |||
| e8e05d462c | |||
| a7b9deb2ca | |||
| 8ac54e8b14 | |||
| dcc3e72d39 | |||
| 0a4796b2a0 | |||
| 9e72bb1775 | |||
| f3b65445dc | |||
| 7cb217ed4a | |||
| cdd44849b8 | |||
| 35fd08f594 | |||
| 11587f1dde | |||
| 3ce7bfef07 | |||
| c9808586b3 | |||
| 281013002d | |||
| 25e7ff1196 | |||
| 4fb5da75dc | |||
| 5e008ad074 | |||
| 20792526c6 | |||
| 7123bcfc3e | |||
| 20b7ac0518 | |||
| 2f30d3e5a3 | |||
| cb9d194f86 | |||
| 7653f3af49 | |||
| ae469ee614 | |||
| 0493d717a4 | |||
| 093029c2f5 | |||
| c6e02c09ff | |||
| 8f2336f02c | |||
| 0ffe934a3e | |||
| aa5be2dbc3 | |||
| 04ea2112bd | |||
| 4923f1cf7e | |||
| 56f0bb8613 | |||
| b91116e2bc | |||
| dc5c264e26 | |||
| 22e1b525a5 | |||
| d95b1b33e5 | |||
| b889aa7841 | |||
| e02b278db1 | |||
| deed44a4af | |||
| aa6f8d40bd | |||
| 5ea485e197 | |||
| 60eeaeee69 | |||
| cda5b25cb2 | |||
| f91d1d967f | |||
| 42bf473b18 | |||
| f6f5b4ab0d | |||
| f1cb1f8420 | |||
| 9becd733af | |||
| 646c1cb8a8 | |||
| 1fed6f8abd | |||
| 1127c0e6e5 | |||
| 48619a385e | |||
| eaf3bd5ca4 | |||
| 12b28c4bb9 | |||
| 7c925353a5 | |||
| 8113c00712 | |||
| 17d9051b82 | |||
| 7a4623e034 | |||
| 115c6bc000 | |||
| fce0114174 | |||
| 0e4096e201 | |||
| d6243c63fe | |||
| 420f3f7840 | |||
| ede7a585bf | |||
| 5491bd4fd2 | |||
| 78fc96518f | |||
| 660034332d | |||
| 6acbfe863d | |||
| 22095d12f5 | |||
| b7fc8099f1 | |||
| f312b5e386 | |||
| 8e99996321 | |||
| 99c98407c9 | |||
| c1ed0b2d5b | |||
| 70c1aff94c | |||
| 9c0ec39770 | |||
| b29fbc82c2 | |||
| eaff0f73d1 | |||
| 7911c9300d | |||
| bbc12ade7f | |||
| df1c895076 | |||
| 4a8f6ba58c | |||
| b126939b5d | |||
| f5a996a5af | |||
| b54c76d6a3 | |||
| ebb7145ccc | |||
| 584879c759 | |||
| 1900d9a656 | |||
| 8061bb54fe | |||
| 78efc18079 | |||
| 2889f484f4 | |||
| 0c58df06d5 | |||
| d6e0e0de2b | |||
| 40f69d7abf | |||
| eb3f75e03e | |||
| d3ae574418 | |||
| d7882cb89b | |||
| 5c8121e7a8 | |||
| bf0adc2c70 | |||
| 2e8d17e7b7 | |||
| 5b5717e539 | |||
| 0e20577af4 | |||
| a9c7377e0a | |||
| 68d757113b | |||
| af61bd3137 | |||
| dc987edf34 | |||
| 9209d9b304 | |||
| 7ac3d85126 | |||
| 8fa9cc0de3 | |||
| 608de57358 | |||
| 40c04a7565 | |||
| 30f86286f5 | |||
| aaac715060 | |||
| 7ebd10a868 | |||
| 8ebd135536 | |||
| 6a03ed74fb | |||
| a7f93060dd | |||
| b2b3f170a9 | |||
| 22c5192b3d | |||
| d79be3f7fc | |||
| 2200f87492 | |||
| c84bd6d393 | |||
| 5c23071a81 | |||
| 43095307da | |||
| bebae14223 | |||
| d2cc815009 | |||
| a859c10fa1 | |||
| 4889b4ceee | |||
| d7c42c8132 | |||
| 78f1b8bd15 | |||
| 87dd7b89f5 | |||
| 41fd1655bd | |||
| 1ccc23268c | |||
| 9309f75704 | |||
| 98552f1d75 | |||
| 27c5760b0c | |||
| f2813633b0 | |||
| 6e990b77d1 | |||
| 596b1e69ce | |||
| d2205aa1a0 | |||
| 76eefcc08a | |||
| eb460c30ce | |||
| 6d8e78cc95 | |||
| 0701d4ce6e | |||
| d169557b00 | |||
| a89a02ff85 | |||
| ae8393c06e | |||
| e2d6f2761c | |||
| 6029585f19 | |||
| aaea58fa2e | |||
| 9ddaf76b68 | |||
| 04b4e605a0 | |||
| 754536404e | |||
| a75c457620 | |||
| bf389f7183 | |||
| 96433cdf19 | |||
| 128e678815 | |||
| 2ec0acc972 | |||
| 54fac457bf | |||
| 91e069f979 | |||
| b3c461bd7e | |||
| 135ee0d93f | |||
| 69e10b88b0 | |||
| 7f4e947447 | |||
| d0d2332193 | |||
| 9beba1ba31 | |||
| c1446618cf | |||
| 0cd31782d4 | |||
| cf177905e5 | |||
| 6fef0f1351 | |||
| 9cc8107c6b | |||
| 84377c6175 | |||
| b4c03b992c | |||
| a70bcb97bb | |||
| 5114339136 | |||
| 1d3f3e65a0 | |||
| 58db8622bd | |||
| 5ed23e593c | |||
| dd02b96c94 | |||
| 13156de8c3 | |||
| a4b8b0f114 | |||
| 611006af18 | |||
| 0163bc05d6 | |||
| 040552fcca | |||
| 2edc25b729 | |||
| b4001b78b9 | |||
| d73e15d08f | |||
| 0b8cd09435 | |||
| 313480a09c | |||
| 8f349e84ae | |||
| ed4c8b27f1 | |||
| cd54dc84c4 | |||
| 2b876da52d | |||
| ad9f880d61 | |||
| 8ae063bb1b | |||
| 89d0723ba3 | |||
| 0548c713e8 | |||
| beb7e5909f | |||
| 6eec7970c1 | |||
| 7bbd3943c9 | |||
| 18c635f474 | |||
| af78508488 | |||
| c789238741 | |||
| 83195f0745 | |||
| c64d2787f8 | |||
| 4658e72b84 | |||
| e0a26aa62f | |||
| 54b8d0d3c8 | |||
| 75f916db44 | |||
| 16eb97dbc3 | |||
| 2733cce8ff | |||
| fc92c5cc73 | |||
| 6e0015f022 | |||
| 0c21dd3924 | |||
| fe05515f43 | |||
| 89627e4cd0 | |||
| 457403586d | |||
| 3f9117ef85 | |||
| d9f53c78a0 | |||
| e38740d6ef | |||
| 7341f8b635 | |||
| 7e806a8567 | |||
| eab31f228f | |||
| d937b74b8f | |||
| 0e8dace18c | |||
| b17bed28c8 | |||
| 4eea3175f1 | |||
| cf458fa7a2 | |||
| 8ac7cab100 | |||
| 0108a6bdeb | |||
| 402189ba14 | |||
| 61ccb034d0 | |||
| 50c694fab4 | |||
| a18b187494 | |||
| 5668eb0732 | |||
| 56e600d7a1 | |||
| 2ae46fa90a | |||
| 0c0bb28d39 | |||
| ed98e06651 | |||
| 06289110e7 | |||
| 8443848637 | |||
| 823cc38ac1 | |||
| 5ef4f77fb5 | |||
| e0ee90d50c | |||
| 171538d01c | |||
| c21745c886 | |||
| 2db0401a57 | |||
| 9979da59e3 | |||
| 8b1b322771 | |||
| 0ccbddf767 | |||
| 23021422f3 | |||
| bb3f29d8bc | |||
| 87e6417353 | |||
| 95c7029e19 | |||
| 45368f410a | |||
| a79b93f5bc | |||
| 4fe88a52fa | |||
| a5b6a306ae | |||
| 109e3d13ed | |||
| 7af99bce88 | |||
| d82095d7ea | |||
| 76afd41727 | |||
| bc625b21b3 | |||
| adbd52ba27 | |||
| b9d4875f3e | |||
| a79c844c4d | |||
| b13c84f854 | |||
| b410cff68c | |||
| 4013f733fe | |||
| cc4c7167fd | |||
| 6c12ffc902 | |||
| a83d257ac6 | |||
| ec5cb9c6f7 | |||
| e7c7ebf665 | |||
| cc7f0bd532 | |||
| 97ae40496d | |||
| e4a87b8a1c | |||
| f18aef4aec | |||
| 1cbd06c8a2 | |||
| 785e68bb0d | |||
| 86e50b1044 | |||
| eabbb20d17 | |||
| 0153dab346 | |||
| 1a4ffa497a | |||
| 58045a5c07 | |||
| 7d1ae7aea7 | |||
| 174c72f2c0 | |||
| b9fb45f408 | |||
| 9c4b925a96 | |||
| 394c44ccf9 | |||
| baf100f78c | |||
| 5be45d214b | |||
| e309a784d1 | |||
| 99f40ede1b | |||
| db8e6bed7a | |||
| 6172e2cfcc | |||
| bc8ff545ca | |||
| e576bdc894 | |||
| d78510457c | |||
| dbdf01d4a0 | |||
| 7ef7beb9fb | |||
| 16e63adc40 | |||
| e85455719d | |||
| 23ff318f59 | |||
| 0041699048 | |||
| a5df39e14f | |||
| 4175c9edea | |||
| 1695fd08f0 | |||
| 2c920fbb8b | |||
| 7dd8770e6f | |||
| 9c15e2ff86 | |||
| 7775c87cd6 | |||
| 1047d5646d | |||
| fa765ee719 | |||
| 50850602b2 | |||
| 553cc8ac96 | |||
| f2a04a56a4 | |||
| a8ff81fd8a | |||
| aab08712dd | |||
| 99784fb8f0 | |||
| 0e7c6e1d82 | |||
| 4e3c990656 | |||
| e9694cca47 | |||
| 9e0c07b7ba | |||
| 209de7b56d | |||
| 16a8fafab2 | |||
| 6e68d89e0f | |||
| 9c5d9f8614 | |||
| 161065ac19 | |||
| 2053767709 | |||
| 55530dbd14 | |||
| 12f0d8d4ca | |||
| 34f1c298b6 | |||
| 8194f1e2ae | |||
| a7af3b2c8f | |||
| 6d9d85670f | |||
| 521fa7d005 | |||
| 5759d0fdf2 | |||
| 07db5daa61 | |||
| 201d0a78b1 | |||
| 1f6696d433 | |||
| 59422ec980 | |||
| fd3813f0d9 | |||
| 25eb8dc277 | |||
| ebe38eedd8 | |||
| 96c5aea3ba | |||
| cca61d752d | |||
| 6af51e049f | |||
| 3af1c411ca | |||
| d3f22b8a04 | |||
| fd4ea8bc25 | |||
| d3f3e2d6c5 | |||
| 546c794321 | |||
| d69796d9e0 | |||
| 4ff8095dee | |||
| 3415f3ccde | |||
| 6770ae0556 | |||
| bb5581690d | |||
| 57b8be1c24 | |||
| c93b120252 | |||
| 5cf8587269 | |||
| b998d4fe01 | |||
| d0a0e37b2b | |||
| 3f74712540 | |||
| 124bc392ab | |||
| 8c1588b14e | |||
| 58aef89521 | |||
| f54b4e174d | |||
| 83f57ff0ce | |||
| 71c07feffd | |||
| 9c20737b60 | |||
| 951f02acf3 | |||
| 735bc2d815 | |||
| a024e61bf8 | |||
| 082fc019c7 | |||
| ffb699fb06 | |||
| d318de7c00 | |||
| 68bd6687d6 | |||
| a3ca7ad93a | |||
| 261f290abf | |||
| 63a191eb8d | |||
| a6a5fa937c | |||
| 670070e61a | |||
| 3cfc400cf9 | |||
| 6e85924bd3 | |||
| f7282e86c0 | |||
| 9d0e102135 | |||
| 5b8ff4a2fc | |||
| c99b7fe7da | |||
| bd2d571c31 | |||
| bea59f64b2 | |||
| 00d004a528 | |||
| 53cf4a3b4d | |||
| 7e8c7843c5 | |||
| 5655e26315 | |||
| 0463e196b4 | |||
| b12c973922 | |||
| f1397843ee | |||
| 6632cc7c1d | |||
| 45653c5549 | |||
| f67c7b49ab | |||
| 50b2961d34 | |||
| d10eff4531 | |||
| e67ee935a2 | |||
| 41a1374744 | |||
| c8b01f61d6 | |||
| 3b4eb2f0a0 | |||
| d20aa0428a | |||
| 1c80e99008 | |||
| 0e12fb869c | |||
| a55c3f48eb | |||
| 4b7ae4918b | |||
| 763ec6cbcb | |||
| dcb4d8ee32 | |||
| 58c69a9ac4 | |||
| 7a03ca8dbc | |||
| d7512f529c | |||
| 209a470a5f | |||
| 1947557eb1 | |||
| 621753e8a8 | |||
| fca5a4687c | |||
| 5f37d36d4a | |||
| 2656bf8f9f | |||
| 194e22dbbe | |||
| 4883073b91 | |||
| a17dad4f44 | |||
| 2ce9e8e6b2 | |||
| b6b57b5249 | |||
| 659157928e | |||
| 933005a022 | |||
| 3be3f58a92 | |||
| e11a5e3973 | |||
| 96259004be | |||
| 5c54987285 | |||
| c10bf9ba9c | |||
| 5ae2e376a2 | |||
| f5f55e3ff8 | |||
| 10017b27bb | |||
| 1de60a4ff7 | |||
| 01ccc56423 | |||
| 305c66db31 | |||
| 22e1aa6cfc | |||
| 1c79d8a8e4 | |||
| d5cd6ec8eb | |||
| eba8168a03 | |||
| a7ff236b32 | |||
| d31322cdcd | |||
| 61f7de5a25 | |||
| e4d9e03efc | |||
| bff77eeed1 | |||
| e93bade240 | |||
| f1c88b41f2 | |||
| 77e4c61190 | |||
| 3a5fcfba06 | |||
| c9bd191edb | |||
| 77572bdf6e | |||
| ccb810bed9 | |||
| fdaebdd169 | |||
| 74d355fae4 | |||
| 2cc2e8acd7 | |||
| dbef5ea46b | |||
| c38f33adda |
+9
-4
@@ -21,10 +21,10 @@ cmake_uninstall.cmake
|
|||||||
docs/Doxyfile
|
docs/Doxyfile
|
||||||
docs/html
|
docs/html
|
||||||
docs/warnings.txt
|
docs/warnings.txt
|
||||||
src/config.h
|
src/glfw_config.h
|
||||||
src/glfw3.pc
|
src/glfw3.pc
|
||||||
src/glfwConfig.cmake
|
src/glfw3Config.cmake
|
||||||
src/glfwConfigVersion.cmake
|
src/glfw3ConfigVersion.cmake
|
||||||
|
|
||||||
# Compiled binaries
|
# Compiled binaries
|
||||||
src/libglfw.so
|
src/libglfw.so
|
||||||
@@ -38,11 +38,13 @@ src/libglfw3.a
|
|||||||
src/glfw3.lib
|
src/glfw3.lib
|
||||||
src/glfw3.dll
|
src/glfw3.dll
|
||||||
src/glfw3dll.lib
|
src/glfw3dll.lib
|
||||||
|
src/glfw3dll.a
|
||||||
examples/*.app
|
examples/*.app
|
||||||
examples/*.exe
|
examples/*.exe
|
||||||
examples/boing
|
examples/boing
|
||||||
examples/gears
|
examples/gears
|
||||||
examples/heightmap
|
examples/heightmap
|
||||||
|
examples/particles
|
||||||
examples/splitview
|
examples/splitview
|
||||||
examples/simple
|
examples/simple
|
||||||
examples/wave
|
examples/wave
|
||||||
@@ -50,14 +52,17 @@ tests/*.app
|
|||||||
tests/*.exe
|
tests/*.exe
|
||||||
tests/accuracy
|
tests/accuracy
|
||||||
tests/clipboard
|
tests/clipboard
|
||||||
|
tests/cursor
|
||||||
|
tests/cursoranim
|
||||||
tests/defaults
|
tests/defaults
|
||||||
|
tests/empty
|
||||||
tests/events
|
tests/events
|
||||||
tests/fsaa
|
tests/fsaa
|
||||||
tests/gamma
|
tests/gamma
|
||||||
tests/glfwinfo
|
tests/glfwinfo
|
||||||
tests/iconify
|
tests/iconify
|
||||||
tests/joysticks
|
tests/joysticks
|
||||||
tests/modes
|
tests/monitors
|
||||||
tests/peter
|
tests/peter
|
||||||
tests/reopen
|
tests/reopen
|
||||||
tests/sharing
|
tests/sharing
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${APPLE_GUI_EXECUTABLE}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${APPLE_GUI_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${APPLE_GUI_ICON}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${APPLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${APPLE_GUI_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${APPLE_GUI_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${APPLE_GUI_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${APPLE_GUI_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSRequiresCarbon</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${APPLE_GUI_COPYRIGHT}</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
This directory contains a collection of toolchain definitions for
|
|
||||||
cross-compiling for Windows using MinGW on various other systems.
|
|
||||||
|
|
||||||
To use these files you add a special parameter when configuring the source tree:
|
|
||||||
|
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
|
|
||||||
|
|
||||||
The exact file to use depends on the prefix used by the MinGW binaries on your
|
|
||||||
system. You can usually see this in the /usr directory, i.e. the Ubuntu
|
|
||||||
MinGW-w64 packages have /usr/x86_64-w64-mingw32 for the 64-bit compilers, so the
|
|
||||||
correct invocation would be:
|
|
||||||
|
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
|
|
||||||
|
|
||||||
For more details see this article:
|
|
||||||
|
|
||||||
http://www.paraview.org/Wiki/CMake_Cross_Compiling
|
|
||||||
|
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
# EGL_LIBRARY
|
# EGL_LIBRARY
|
||||||
# EGL_FOUND
|
# EGL_FOUND
|
||||||
|
|
||||||
find_path(EGL_INCLUDE_DIR NAMES EGL/egl.h)
|
find_path(EGL_INCLUDE_DIR NAMES EGL/egl.h PATHS /opt/vc/include)
|
||||||
|
|
||||||
set(EGL_NAMES ${EGL_NAMES} egl EGL)
|
set(EGL_NAMES ${EGL_NAMES} egl EGL)
|
||||||
find_library(EGL_LIBRARY NAMES ${EGL_NAMES})
|
find_library(EGL_LIBRARY NAMES ${EGL_NAMES} PATHS /opt/vc/lib)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
|
find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
# GLESv1_LIBRARY
|
# GLESv1_LIBRARY
|
||||||
# GLESv1_FOUND
|
# GLESv1_FOUND
|
||||||
|
|
||||||
find_path(GLESv1_INCLUDE_DIR NAMES GLES/gl.h)
|
find_path(GLESv1_INCLUDE_DIR NAMES GLES/gl.h PATHS /opt/vc/include)
|
||||||
|
|
||||||
set(GLESv1_NAMES ${GLESv1_NAMES} GLESv1_CM)
|
set(GLESv1_NAMES ${GLESv1_NAMES} GLESv1_CM)
|
||||||
find_library(GLESv1_LIBRARY NAMES ${GLESv1_NAMES})
|
find_library(GLESv1_LIBRARY NAMES ${GLESv1_NAMES} PATHS /opt/vc/lib)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(GLESv1 DEFAULT_MSG GLESv1_LIBRARY GLESv1_INCLUDE_DIR)
|
find_package_handle_standard_args(GLESv1 DEFAULT_MSG GLESv1_LIBRARY GLESv1_INCLUDE_DIR)
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
# GLESv2_LIBRARY
|
# GLESv2_LIBRARY
|
||||||
# GLESv2_FOUND
|
# GLESv2_FOUND
|
||||||
|
|
||||||
find_path(GLESv2_INCLUDE_DIR NAMES GLES2/gl2.h)
|
find_path(GLESv2_INCLUDE_DIR NAMES GLES2/gl2.h PATHS /opt/vc/include)
|
||||||
|
|
||||||
set(GLESv2_NAMES ${GLESv2_NAMES} GLESv2)
|
set(GLESv2_NAMES ${GLESv2_NAMES} GLESv2)
|
||||||
find_library(GLESv2_LIBRARY NAMES ${GLESv2_NAMES})
|
find_library(GLESv2_LIBRARY NAMES ${GLESv2_NAMES} PATHS /opt/vc/lib)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARY GLESv2_INCLUDE_DIR)
|
find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARY GLESv2_INCLUDE_DIR)
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Try to find Mir on a Unix system
|
||||||
|
#
|
||||||
|
# This will define:
|
||||||
|
#
|
||||||
|
# MIR_LIBRARIES - Link these to use Wayland
|
||||||
|
# MIR_INCLUDE_DIR - Include directory for Wayland
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
|
||||||
|
find_package (PkgConfig)
|
||||||
|
pkg_check_modules (PKG_MIR QUIET mirclient)
|
||||||
|
|
||||||
|
set (MIR_INCLUDE_DIR ${PKG_MIR_INCLUDE_DIRS})
|
||||||
|
set (MIR_LIBRARIES ${PKG_MIR_LIBRARIES})
|
||||||
|
|
||||||
|
endif ()
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# Try to find Wayland on a Unix system
|
||||||
|
#
|
||||||
|
# This will define:
|
||||||
|
#
|
||||||
|
# WAYLAND_FOUND - True if Wayland is found
|
||||||
|
# WAYLAND_LIBRARIES - Link these to use Wayland
|
||||||
|
# WAYLAND_INCLUDE_DIR - Include directory for Wayland
|
||||||
|
# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
|
||||||
|
#
|
||||||
|
# In addition the following more fine grained variables will be defined:
|
||||||
|
#
|
||||||
|
# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
|
||||||
|
# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
|
||||||
|
# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
IF (NOT WIN32)
|
||||||
|
IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
|
||||||
|
# In the cache already
|
||||||
|
SET(WAYLAND_FIND_QUIETLY TRUE)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
# Use pkg-config to get the directories and then use these values
|
||||||
|
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||||
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor)
|
||||||
|
|
||||||
|
SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
|
||||||
|
|
||||||
|
FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
|
||||||
|
FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
|
||||||
|
FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
|
||||||
|
FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
|
||||||
|
FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
|
||||||
|
FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
|
||||||
|
FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
|
||||||
|
|
||||||
|
set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES})
|
||||||
|
|
||||||
|
list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
|
||||||
|
WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
|
||||||
|
WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
|
||||||
|
WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
|
||||||
|
WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES
|
||||||
|
)
|
||||||
|
|
||||||
|
ENDIF ()
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# - Try to find XKBCommon
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# XKBCOMMON_FOUND - System has XKBCommon
|
||||||
|
# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories
|
||||||
|
# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon
|
||||||
|
# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon)
|
||||||
|
set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER})
|
||||||
|
|
||||||
|
find_path(XKBCOMMON_INCLUDE_DIR
|
||||||
|
NAMES xkbcommon/xkbcommon.h
|
||||||
|
HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(XKBCOMMON_LIBRARY
|
||||||
|
NAMES xkbcommon
|
||||||
|
HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
|
||||||
|
set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS})
|
||||||
|
set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(XKBCommon DEFAULT_MSG
|
||||||
|
XKBCOMMON_LIBRARY
|
||||||
|
XKBCOMMON_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR)
|
||||||
|
|
||||||
+310
-163
@@ -1,34 +1,63 @@
|
|||||||
project(GLFW C)
|
project(GLFW C)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8.9)
|
||||||
|
|
||||||
|
if (CMAKE_VERSION VERSION_EQUAL "3.0" OR CMAKE_VERSION VERSION_GREATER "3.0")
|
||||||
|
# Until all major package systems have moved to CMake 3,
|
||||||
|
# we stick with the older INSTALL_NAME_DIR mechanism
|
||||||
|
cmake_policy(SET CMP0042 OLD)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(GLFW_VERSION_MAJOR "3")
|
set(GLFW_VERSION_MAJOR "3")
|
||||||
set(GLFW_VERSION_MINOR "0")
|
set(GLFW_VERSION_MINOR "1")
|
||||||
set(GLFW_VERSION_PATCH "0")
|
set(GLFW_VERSION_PATCH "1")
|
||||||
set(GLFW_VERSION_EXTRA "")
|
set(GLFW_VERSION_EXTRA "")
|
||||||
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
||||||
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
||||||
set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib will be installed: lib or lib64")
|
set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib will be installed: lib or lib64")
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||||
|
option(GLFW_INSTALL "Generate installation target" ON)
|
||||||
set(DOXYGEN_SKIP_DOT TRUE)
|
|
||||||
find_package(Doxygen)
|
|
||||||
|
|
||||||
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
||||||
if (GLFW_DOCUMENT_INTERNALS)
|
|
||||||
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
if (WIN32)
|
||||||
|
option(GLFW_USE_DWM_SWAP_INTERVAL "Set swap interval even when DWM compositing is enabled" OFF)
|
||||||
|
option(GLFW_USE_OPTIMUS_HPG "Force use of high-performance GPU on Optimus systems" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||||
option(GLFW_USE_CHDIR "Make glfwInit chdir to Contents/Resources" ON)
|
option(GLFW_USE_CHDIR "Make glfwInit chdir to Contents/Resources" ON)
|
||||||
option(GLFW_USE_MENUBAR "Populate the menu bar on first window creation" ON)
|
option(GLFW_USE_MENUBAR "Populate the menu bar on first window creation" ON)
|
||||||
|
option(GLFW_USE_RETINA "Use the full resolution of Retina displays" ON)
|
||||||
else()
|
else()
|
||||||
option(GLFW_USE_EGL "Use EGL for context creation" OFF)
|
option(GLFW_USE_EGL "Use EGL for context creation" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
option(GLFW_USE_WAYLAND "Use Wayland for context creation (implies EGL as well)" OFF)
|
||||||
|
option(GLFW_USE_MIR "Use Mir for context creation (implies EGL as well)" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set(_GLFW_BUILD_DLL 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_USE_WAYLAND)
|
||||||
|
set(GLFW_USE_EGL ON)
|
||||||
|
elseif (GLFW_USE_MIR)
|
||||||
|
set(GLFW_USE_EGL ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (GLFW_USE_EGL)
|
if (GLFW_USE_EGL)
|
||||||
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
|
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
|
||||||
"The client library to use; one of opengl, glesv1 or glesv2")
|
"The client library to use; one of opengl, glesv1 or glesv2")
|
||||||
@@ -43,7 +72,7 @@ if (GLFW_USE_EGL)
|
|||||||
message(FATAL_ERROR "Unsupported client library")
|
message(FATAL_ERROR "Unsupported client library")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/modules)
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake/modules")
|
||||||
find_package(EGL REQUIRED)
|
find_package(EGL REQUIRED)
|
||||||
|
|
||||||
if (NOT _GLFW_USE_OPENGL)
|
if (NOT _GLFW_USE_OPENGL)
|
||||||
@@ -65,23 +94,74 @@ endif()
|
|||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
if (GLFW_BUILD_DOCS)
|
||||||
# Enable all warnings on GCC, regardless of OS
|
set(DOXYGEN_SKIP_DOT TRUE)
|
||||||
#--------------------------------------------------------------------
|
find_package(Doxygen)
|
||||||
if (CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
add_definitions(-Wall)
|
if (GLFW_DOCUMENT_INTERNALS)
|
||||||
|
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Export shared library / dynamic library / DLL build option
|
# Set compiler specific flags
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (BUILD_SHARED_LIBS)
|
if (UNIX)
|
||||||
set(_GLFW_BUILD_DLL 1)
|
add_definitions(-Wall)
|
||||||
if (UNIX)
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
add_definitions(-fvisibility=hidden)
|
add_definitions(-fvisibility=hidden)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
|
||||||
|
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||||
|
foreach (flag CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
|
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
|
||||||
|
if (${flag} MATCHES "/MD")
|
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
if (${flag} MATCHES "/MDd")
|
||||||
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
# Enable link-time exploit mitigation features enabled by default on MSVC
|
||||||
|
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
|
# Compatibility with data execution prevention (DEP)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
|
||||||
|
check_c_compiler_flag("" _GLFW_HAS_DEP)
|
||||||
|
if (_GLFW_HAS_DEP)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Compatibility with address space layout randomization (ASLR)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
|
||||||
|
check_c_compiler_flag("" _GLFW_HAS_ASLR)
|
||||||
|
if (_GLFW_HAS_ASLR)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Compatibility with 64-bit address space layout randomization (ASLR)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
|
||||||
|
check_c_compiler_flag("" _GLFW_HAS_64ASLR)
|
||||||
|
if (_GLFW_HAS_64ASLR)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Detect and select backend APIs
|
# Detect and select backend APIs
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -102,8 +182,16 @@ elseif (APPLE)
|
|||||||
set(_GLFW_NSGL 1)
|
set(_GLFW_NSGL 1)
|
||||||
message(STATUS "Using NSGL for context creation")
|
message(STATUS "Using NSGL for context creation")
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
|
if (GLFW_USE_WAYLAND)
|
||||||
|
set(_GLFW_WAYLAND 1)
|
||||||
|
message(STATUS "Using Wayland for window creation")
|
||||||
|
elseif (GLFW_USE_MIR)
|
||||||
|
set(_GLFW_MIR 1)
|
||||||
|
message(STATUS "Using Mir for window creation")
|
||||||
|
else()
|
||||||
set(_GLFW_X11 1)
|
set(_GLFW_X11 1)
|
||||||
message(STATUS "Using X11 for window creation")
|
message(STATUS "Using X11 for window creation")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (GLFW_USE_EGL)
|
if (GLFW_USE_EGL)
|
||||||
set(_GLFW_EGL 1)
|
set(_GLFW_EGL 1)
|
||||||
@@ -121,31 +209,21 @@ endif()
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (_GLFW_WIN32)
|
if (_GLFW_WIN32)
|
||||||
|
|
||||||
if (MSVC)
|
list(APPEND glfw_PKG_LIBS "-lgdi32")
|
||||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
|
||||||
|
|
||||||
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
if (GLFW_USE_DWM_SWAP_INTERVAL)
|
||||||
foreach (flag CMAKE_C_FLAGS
|
set(_GLFW_USE_DWM_SWAP_INTERVAL 1)
|
||||||
CMAKE_C_FLAGS_DEBUG
|
|
||||||
CMAKE_C_FLAGS_RELEASE
|
|
||||||
CMAKE_C_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
||||||
|
|
||||||
if (${flag} MATCHES "/MD")
|
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
|
||||||
endif()
|
endif()
|
||||||
if (${flag} MATCHES "/MDd")
|
if (GLFW_USE_OPTIMUS_HPG)
|
||||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
set(_GLFW_USE_OPTIMUS_HPG 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endforeach()
|
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
||||||
endif()
|
# the inclusion of stddef.h (by glfw3.h), which is itself included before
|
||||||
endif()
|
# win32_platform.h. We define them here until a saner solution can be found
|
||||||
|
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
||||||
set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS})
|
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
||||||
|
add_definitions(-DUNICODE -DWINVER=0x0501)
|
||||||
if (BUILD_SHARED_LIBS)
|
|
||||||
list(APPEND glfw_LIBRARIES winmm)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -153,8 +231,11 @@ endif()
|
|||||||
# Use WGL for context creation
|
# Use WGL for context creation
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (_GLFW_WGL)
|
if (_GLFW_WGL)
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
|
||||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
list(APPEND glfw_PKG_LIBS "-lopengl32")
|
||||||
|
|
||||||
|
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -164,13 +245,13 @@ if (_GLFW_X11)
|
|||||||
|
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} x11")
|
list(APPEND glfw_PKG_DEPS "x11")
|
||||||
|
|
||||||
# Set up library and include paths
|
# Set up library and include paths
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH})
|
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
|
||||||
list(APPEND glfw_LIBRARIES ${X11_X11_LIB} ${CMAKE_THREAD_LIBS_INIT})
|
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
list(APPEND glfw_LIBRARIES ${RT_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${RT_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check for XRandR (modern resolution switching and gamma control)
|
# Check for XRandR (modern resolution switching and gamma control)
|
||||||
@@ -178,33 +259,47 @@ if (_GLFW_X11)
|
|||||||
message(FATAL_ERROR "The RandR library and headers were not found")
|
message(FATAL_ERROR "The RandR library and headers were not found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH})
|
list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}")
|
||||||
list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB})
|
list(APPEND glfw_LIBRARIES "${X11_Xrandr_LIB}")
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr")
|
list(APPEND glfw_PKG_DEPS "xrandr")
|
||||||
|
|
||||||
|
# Check for Xinerama (legacy multi-monitor support)
|
||||||
|
if (NOT X11_Xinerama_FOUND)
|
||||||
|
message(FATAL_ERROR "The Xinerama library and headers were not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinerama_INCLUDE_PATH}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${X11_Xinerama_LIB}")
|
||||||
|
list(APPEND glfw_PKG_DEPS "xinerama")
|
||||||
|
|
||||||
# Check for XInput (high-resolution cursor motion)
|
# Check for XInput (high-resolution cursor motion)
|
||||||
if (NOT X11_Xinput_FOUND)
|
if (X11_Xinput_FOUND)
|
||||||
message(FATAL_ERROR "The XInput library and headers were not found")
|
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}")
|
||||||
|
list(APPEND glfw_PKG_DEPS "xi")
|
||||||
|
|
||||||
|
if (X11_Xinput_LIB)
|
||||||
|
list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}")
|
||||||
|
else()
|
||||||
|
# Backwards compatibility (bug in CMake 2.8.7)
|
||||||
|
list(APPEND glfw_LIBRARIES Xi)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH})
|
set(_GLFW_HAS_XINPUT TRUE)
|
||||||
list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
|
endif()
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi")
|
|
||||||
|
|
||||||
# Check for Xf86VidMode (fallback gamma control)
|
# Check for Xf86VidMode (fallback gamma control)
|
||||||
if (NOT X11_xf86vmode_FOUND)
|
if (X11_xf86vmode_FOUND)
|
||||||
message(FATAL_ERROR "The Xf86VidMode library and headers were not found")
|
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
|
||||||
|
list(APPEND glfw_PKG_DEPS "xxf86vm")
|
||||||
|
|
||||||
|
if (X11_Xxf86vm_LIB)
|
||||||
|
list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}")
|
||||||
|
else()
|
||||||
|
# Backwards compatibility (see CMake bug 0006976)
|
||||||
|
list(APPEND glfw_LIBRARIES Xxf86vm)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH})
|
set(_GLFW_HAS_XF86VM TRUE)
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm")
|
|
||||||
|
|
||||||
# NOTE: This is a workaround for CMake bug 0006976 (missing
|
|
||||||
# X11_xf86vmode_LIB variable)
|
|
||||||
if (X11_xf86vmode_LIB)
|
|
||||||
list(APPEND glfw_LIBRARIES ${X11_xf86vmode_LIB})
|
|
||||||
else()
|
|
||||||
list(APPEND glfw_LIBRARIES Xxf86vm)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check for Xkb (X keyboard extension)
|
# Check for Xkb (X keyboard extension)
|
||||||
@@ -212,22 +307,77 @@ if (_GLFW_X11)
|
|||||||
message(FATAL_ERROR "The X keyboard extension headers were not found")
|
message(FATAL_ERROR "The X keyboard extension headers were not found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
|
list(APPEND glfw_INCLUDE_DIR "${X11_Xkb_INCLUDE_PATH}")
|
||||||
|
|
||||||
find_library(RT_LIBRARY rt)
|
find_library(RT_LIBRARY rt)
|
||||||
mark_as_advanced(RT_LIBRARY)
|
mark_as_advanced(RT_LIBRARY)
|
||||||
if (RT_LIBRARY)
|
if (RT_LIBRARY)
|
||||||
list(APPEND glfw_LIBRARIES ${RT_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${RT_LIBRARY}")
|
||||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lrt")
|
list(APPEND glfw_PKG_LIBS "-lrt")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_library(MATH_LIBRARY m)
|
find_library(MATH_LIBRARY m)
|
||||||
mark_as_advanced(MATH_LIBRARY)
|
mark_as_advanced(MATH_LIBRARY)
|
||||||
if (MATH_LIBRARY)
|
if (MATH_LIBRARY)
|
||||||
list(APPEND glfw_LIBRARIES ${MATH_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
|
||||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm")
|
list(APPEND glfw_PKG_LIBS "-lm")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Check for Xcursor
|
||||||
|
if (NOT X11_Xcursor_FOUND)
|
||||||
|
message(FATAL_ERROR "The Xcursor libraries and headers were not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND glfw_INCLUDE_DIR "${X11_Xcursor_INCLUDE_PATH}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${X11_Xcursor_LIB}")
|
||||||
|
list(APPEND glfw_PKG_DEPS "xcursor")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Use Wayland for window creation
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (_GLFW_WAYLAND)
|
||||||
|
find_package(Wayland REQUIRED)
|
||||||
|
list(APPEND glfw_PKG_DEPS "wayland-egl")
|
||||||
|
|
||||||
|
list(APPEND glfw_INCLUDE_DIRS "${WAYLAND_INCLUDE_DIR}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${WAYLAND_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
|
|
||||||
|
find_package(XKBCommon REQUIRED)
|
||||||
|
list(APPEND glfw_PKG_DEPS "xkbcommon")
|
||||||
|
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
|
||||||
|
|
||||||
|
find_library(MATH_LIBRARY m)
|
||||||
|
mark_as_advanced(MATH_LIBRARY)
|
||||||
|
if (MATH_LIBRARY)
|
||||||
|
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
|
||||||
|
list(APPEND glfw_PKG_LIBS "-lm")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Use Mir for window creation
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (_GLFW_MIR)
|
||||||
|
find_package(Mir REQUIRED)
|
||||||
|
list(APPEND glfw_PKG_DEPS "mirclient")
|
||||||
|
|
||||||
|
list(APPEND glfw_INCLUDE_DIRS "${MIR_INCLUDE_DIR}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${MIR_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
|
|
||||||
|
find_package(XKBCommon REQUIRED)
|
||||||
|
list(APPEND glfw_PKG_DEPS "xkbcommon")
|
||||||
|
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
|
||||||
|
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
|
||||||
|
|
||||||
|
find_library(MATH_LIBRARY m)
|
||||||
|
mark_as_advanced(MATH_LIBRARY)
|
||||||
|
if (MATH_LIBRARY)
|
||||||
|
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
|
||||||
|
list(APPEND glfw_PKG_LIBS "-lm")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -235,24 +385,17 @@ endif()
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (_GLFW_GLX)
|
if (_GLFW_GLX)
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
|
||||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||||
|
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl")
|
list(APPEND glfw_PKG_DEPS "gl")
|
||||||
|
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY})
|
set(CMAKE_REQUIRED_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||||
|
|
||||||
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
|
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
|
||||||
|
|
||||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
|
|
||||||
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
|
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
|
|
||||||
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
|
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
|
||||||
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
|
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
|
||||||
@@ -261,23 +404,15 @@ if (_GLFW_GLX)
|
|||||||
|
|
||||||
# Check for dlopen support as a fallback
|
# Check for dlopen support as a fallback
|
||||||
|
|
||||||
find_library(DL_LIBRARY dl)
|
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||||
mark_as_advanced(DL_LIBRARY)
|
|
||||||
if (DL_LIBRARY)
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY})
|
|
||||||
else()
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_function_exists(dlopen _GLFW_HAS_DLOPEN)
|
check_function_exists(dlopen _GLFW_HAS_DLOPEN)
|
||||||
|
|
||||||
if (NOT _GLFW_HAS_DLOPEN)
|
if (NOT _GLFW_HAS_DLOPEN)
|
||||||
message(FATAL_ERROR "No entry point retrieval mechanism found")
|
message(FATAL_ERROR "No entry point retrieval mechanism found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DL_LIBRARY)
|
if (CMAKE_DL_LIBS)
|
||||||
list(APPEND glfw_LIBRARIES ${DL_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -ldl")
|
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -288,27 +423,23 @@ endif()
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (_GLFW_EGL)
|
if (_GLFW_EGL)
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
|
list(APPEND glfw_INCLUDE_DIRS "${EGL_INCLUDE_DIR}")
|
||||||
list(APPEND glfw_LIBRARIES ${EGL_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${EGL_LIBRARY}")
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${EGL_LIBRARY})
|
list(APPEND glfw_PKG_DEPS "egl")
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (_GLFW_USE_OPENGL)
|
if (_GLFW_USE_OPENGL)
|
||||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl")
|
list(APPEND glfw_PKG_DEPS "gl")
|
||||||
elseif (_GLFW_USE_GLESV1)
|
elseif (_GLFW_USE_GLESV1)
|
||||||
list(APPEND glfw_LIBRARIES ${GLESv1_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${GLESv1_LIBRARY}")
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${GLESv1_INCLUDE_DIR})
|
list(APPEND glfw_INCLUDE_DIRS "${GLESv1_INCLUDE_DIR}")
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv1_cm")
|
list(APPEND glfw_PKG_DEPS "glesv1_cm")
|
||||||
elseif (_GLFW_USE_GLESV2)
|
elseif (_GLFW_USE_GLESV2)
|
||||||
list(APPEND glfw_LIBRARIES ${GLESv2_LIBRARY})
|
list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}")
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${GLESv2_INCLUDE_DIR})
|
list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}")
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv2")
|
list(APPEND glfw_PKG_DEPS "glesv2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
@@ -318,8 +449,6 @@ endif()
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (_GLFW_COCOA AND _GLFW_NSGL)
|
if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||||
|
|
||||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
|
||||||
|
|
||||||
if (GLFW_USE_MENUBAR)
|
if (GLFW_USE_MENUBAR)
|
||||||
set(_GLFW_USE_MENUBAR 1)
|
set(_GLFW_USE_MENUBAR 1)
|
||||||
endif()
|
endif()
|
||||||
@@ -328,7 +457,10 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
|||||||
set(_GLFW_USE_CHDIR 1)
|
set(_GLFW_USE_CHDIR 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Universal build
|
if (GLFW_USE_RETINA)
|
||||||
|
set(_GLFW_USE_RETINA 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (GLFW_BUILD_UNIVERSAL)
|
if (GLFW_BUILD_UNIVERSAL)
|
||||||
message(STATUS "Building GLFW as Universal Binaries")
|
message(STATUS "Building GLFW as Universal Binaries")
|
||||||
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
||||||
@@ -340,19 +472,31 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
|||||||
find_library(COCOA_FRAMEWORK Cocoa)
|
find_library(COCOA_FRAMEWORK Cocoa)
|
||||||
find_library(IOKIT_FRAMEWORK IOKit)
|
find_library(IOKIT_FRAMEWORK IOKit)
|
||||||
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
|
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
|
||||||
list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK}
|
find_library(CORE_VIDEO_FRAMEWORK CoreVideo)
|
||||||
${OPENGL_gl_LIBRARY}
|
mark_as_advanced(COCOA_FRAMEWORK
|
||||||
${IOKIT_FRAMEWORK}
|
IOKIT_FRAMEWORK
|
||||||
${CORE_FOUNDATION_FRAMEWORK})
|
CORE_FOUNDATION_FRAMEWORK
|
||||||
|
CORE_VIDEO_FRAMEWORK)
|
||||||
|
list(APPEND glfw_LIBRARIES "${COCOA_FRAMEWORK}"
|
||||||
|
"${OPENGL_gl_LIBRARY}"
|
||||||
|
"${IOKIT_FRAMEWORK}"
|
||||||
|
"${CORE_FOUNDATION_FRAMEWORK}"
|
||||||
|
"${CORE_VIDEO_FRAMEWORK}")
|
||||||
|
|
||||||
set(GLFW_PKG_DEPS "")
|
set(glfw_PKG_DEPS "")
|
||||||
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation")
|
set(glfw_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Export GLFW library dependencies
|
# Export GLFW library dependencies
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW")
|
set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW")
|
||||||
|
foreach(arg ${glfw_PKG_DEPS})
|
||||||
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}")
|
||||||
|
endforeach()
|
||||||
|
foreach(arg ${glfw_PKG_LIBS})
|
||||||
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Choose library output name
|
# Choose library output name
|
||||||
@@ -364,6 +508,38 @@ else()
|
|||||||
set(GLFW_LIB_NAME glfw3)
|
set(GLFW_LIB_NAME glfw3)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Create generated files
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw3/")
|
||||||
|
else()
|
||||||
|
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_package_config_file("${GLFW_SOURCE_DIR}/src/glfw3Config.cmake.in"
|
||||||
|
"${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
|
||||||
|
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
|
||||||
|
PATH_VARS CMAKE_INSTALL_PREFIX
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||||
|
|
||||||
|
write_basic_package_version_file("${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
|
||||||
|
VERSION ${GLFW_VERSION_FULL}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
if (GLFW_BUILD_DOCS)
|
||||||
|
configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in"
|
||||||
|
"${GLFW_BINARY_DIR}/docs/Doxyfile" @ONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_file("${GLFW_SOURCE_DIR}/src/glfw_config.h.in"
|
||||||
|
"${GLFW_BINARY_DIR}/src/glfw_config.h" @ONLY)
|
||||||
|
|
||||||
|
configure_file("${GLFW_SOURCE_DIR}/src/glfw3.pc.in"
|
||||||
|
"${GLFW_BINARY_DIR}/src/glfw3.pc" @ONLY)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Add subdirectories
|
# Add subdirectories
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -377,63 +553,34 @@ if (GLFW_BUILD_TESTS)
|
|||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DOXYGEN_FOUND)
|
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
|
||||||
add_subdirectory(docs)
|
add_subdirectory(docs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Create generated files
|
# Install files other than the library
|
||||||
|
# The library is installed by src/CMakeLists.txt
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in
|
if (GLFW_INSTALL)
|
||||||
${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY)
|
install(DIRECTORY include/GLFW DESTINATION include
|
||||||
|
|
||||||
configure_file(${GLFW_SOURCE_DIR}/src/config.h.in
|
|
||||||
${GLFW_BINARY_DIR}/src/config.h @ONLY)
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
# Install the public headers
|
|
||||||
# The src directory's CMakeLists.txt file installs the library
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
install(DIRECTORY include/GLFW DESTINATION include
|
|
||||||
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
|
||||||
# Create and install glfwConfig.cmake and glfwConfigVersion files
|
"${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
|
||||||
#--------------------------------------------------------------------
|
|
||||||
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in
|
|
||||||
${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY)
|
|
||||||
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in
|
|
||||||
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake @ONLY)
|
|
||||||
|
|
||||||
install(FILES ${GLFW_BINARY_DIR}/src/glfwConfig.cmake
|
|
||||||
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake
|
|
||||||
DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||||
endif()
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
# Create and install pkg-config file on supported platforms
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
if (UNIX)
|
|
||||||
configure_file(${GLFW_SOURCE_DIR}/src/glfw3.pc.in
|
|
||||||
${GLFW_BINARY_DIR}/src/glfw3.pc @ONLY)
|
|
||||||
|
|
||||||
install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc
|
|
||||||
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
||||||
endif()
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
# Only generate this target if no higher-level project already has
|
||||||
# Uninstall operation
|
if (NOT TARGET uninstall)
|
||||||
# Don't generate this target if a higher-level project already has
|
configure_file("${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
#--------------------------------------------------------------------
|
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
||||||
if (NOT TARGET uninstall)
|
|
||||||
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
|
|
||||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
|
|
||||||
|
|
||||||
add_custom_target(uninstall
|
add_custom_target(uninstall
|
||||||
${CMAKE_COMMAND} -P
|
"${CMAKE_COMMAND}" -P
|
||||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake)
|
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -1,284 +1,88 @@
|
|||||||
# GLFW 3.0
|
# GLFW
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
GLFW is a free, Open Source, portable library for OpenGL and OpenGL ES
|
GLFW is a free, Open Source, multi-platform library for OpenGL and OpenGL ES
|
||||||
application development. It provides a simple, platform-independent API for
|
application development. It provides a simple, platform-independent API for
|
||||||
creating windows and contexts, reading input, handling events, etc.
|
creating windows and contexts, reading input, handling events, etc.
|
||||||
|
|
||||||
Version 3.0 brings a new API with many new features such as multiple windows
|
Version 3.1.1 adds fixes for a number of bugs that together affect all supported
|
||||||
and contexts, multi-monitor support, EGL and OpenGL ES support, clipboard text
|
platforms, most notably workarounds for bugs in some popular window managers.
|
||||||
support, an error description callback, gamma ramp control, layout-independent
|
|
||||||
keyboard input and UTF-8 for all strings.
|
|
||||||
|
|
||||||
GLFW is now hosted on [GitHub](https://github.com/glfw/glfw).
|
|
||||||
|
|
||||||
If you are new to GLFW, you may find the
|
If you are new to GLFW, you may find the
|
||||||
[introductory tutorial](http://www.glfw.org/docs/3.0/quick.html) for GLFW
|
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
|
||||||
3 useful. If
|
3 useful. If you have used GLFW 2 in the past, there is a
|
||||||
you have used GLFW 2 in the past, there is a
|
[transition guide](http://www.glfw.org/docs/latest/moving.html) for moving to
|
||||||
[transition guide](http://www.glfw.org/docs/3.0/moving.html) for moving to the
|
the GLFW 3 API.
|
||||||
GLFW 3 API.
|
|
||||||
|
Note that a number of source files have been added or renamed in 3.1, which may
|
||||||
|
require you to update any custom build files you have.
|
||||||
|
|
||||||
|
|
||||||
## Compiling GLFW
|
## Compiling GLFW
|
||||||
|
|
||||||
To compile GLFW and the accompanying example programs, you will need the
|
See the [Compiling GLFW](http://www.glfw.org/docs/latest/compile.html) guide in
|
||||||
[CMake](http://www.cmake.org/) build system.
|
the GLFW documentation.
|
||||||
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
#### X11 dependencies
|
|
||||||
|
|
||||||
To compile GLFW for X11 and GLX, you need to have the X and OpenGL header
|
|
||||||
packages installed. For example, on Ubuntu and other distributions based on
|
|
||||||
Debian GNU/Linux, you need to install the `xorg-dev` and `libglu1-mesa-dev`
|
|
||||||
packages. Note that using header files from Mesa *will not* tie your binary to
|
|
||||||
the Mesa implementation of OpenGL.
|
|
||||||
|
|
||||||
|
|
||||||
### CMake options
|
|
||||||
|
|
||||||
There are a number of CMake build options for GLFW, although not all are
|
|
||||||
available on all supported platforms. Some of these are de facto standards
|
|
||||||
among CMake users and so have no `GLFW_` prefix.
|
|
||||||
|
|
||||||
|
|
||||||
#### Shared options
|
|
||||||
|
|
||||||
`BUILD_SHARED_LIBS` determines whether GLFW is built as a static
|
|
||||||
library or as a DLL / shared library / dynamic library.
|
|
||||||
|
|
||||||
`LIB_SUFFIX` affects where the GLFW shared /dynamic library is
|
|
||||||
installed. If it is empty, it is installed to `$PREFIX/lib`. If it is set to
|
|
||||||
`64`, it is installed to `$PREFIX/lib64`.
|
|
||||||
|
|
||||||
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
|
|
||||||
along with the library.
|
|
||||||
|
|
||||||
`GLFW_BUILD_TESTS` determines whether the GLFW test programs are
|
|
||||||
built along with the library.
|
|
||||||
|
|
||||||
|
|
||||||
#### Mac OS X specific options
|
|
||||||
|
|
||||||
`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current
|
|
||||||
directory of bundled applications to the `Contents/Resources` directory.
|
|
||||||
|
|
||||||
`GLFW_USE_MENUBAR` determines whether the first call to
|
|
||||||
`glfwCreateWindow` sets up a minimal menu bar.
|
|
||||||
|
|
||||||
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
|
|
||||||
|
|
||||||
|
|
||||||
#### Windows specific options
|
|
||||||
|
|
||||||
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version of the
|
|
||||||
Visual C++ runtime library.
|
|
||||||
|
|
||||||
|
|
||||||
#### EGL specific options
|
|
||||||
|
|
||||||
`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific
|
|
||||||
context creation API. Note that EGL is not yet provided on all supported
|
|
||||||
platforms.
|
|
||||||
|
|
||||||
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
|
|
||||||
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
|
|
||||||
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
|
|
||||||
selected library and its header files must be present on the system for this to
|
|
||||||
work.
|
|
||||||
|
|
||||||
|
|
||||||
## Installing GLFW
|
|
||||||
|
|
||||||
A rudimentary installation target is provided for all supported platforms via
|
|
||||||
CMake.
|
|
||||||
|
|
||||||
|
|
||||||
## Using GLFW
|
## Using GLFW
|
||||||
|
|
||||||
See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/).
|
See the
|
||||||
|
[Building programs that use GLFW](http://www.glfw.org/docs/latest/build.html)
|
||||||
|
guide in the GLFW documentation.
|
||||||
|
|
||||||
|
|
||||||
## Changes for version 3.0
|
## Reporting bugs
|
||||||
|
|
||||||
- Added `GLFWmonitor` and updated monitor-related functions to take a monitor
|
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
||||||
handle
|
Please always include the name and version of the OS where the bug occurs and
|
||||||
- Added `glfwGetMonitors` and `glfwGetPrimaryMonitor` for enumerating available
|
the version of GLFW used. If you have cloned it, include the commit ID used.
|
||||||
monitors
|
|
||||||
- Added `glfwGetMonitorPos`, `glfwGetMonitorPhysicalSize` and
|
If it's a build issue, please also include the build log and the name and
|
||||||
`glfwGetMonitorName` for retrieving monitor properties
|
version of your development environment.
|
||||||
- Added `glfwSetMonitorCallback` and `GLFWmonitorfun` for notification of
|
|
||||||
changes in the set of available monitors
|
If it's a context creation issue, please also include the make and model of your
|
||||||
- Added `GLFWwindow` and updated window-related functions and callbacks to take
|
graphics card and the version of your driver.
|
||||||
a window handle
|
|
||||||
- Added `glfwSetWindowShouldClose` and `glfwWindowShouldClose` for setting and
|
This will help both us and other people experiencing the same bug.
|
||||||
retrieving the window close flag
|
|
||||||
- Added `glfwGetWindowPos` for retrieving the position of a window
|
|
||||||
- Added `glfwDefaultWindowHints` for resetting all window hints to their
|
## Dependencies
|
||||||
default values
|
|
||||||
- Added `glfwMakeContextCurrent` for making the context of the specified window
|
GLFW bundles a number of dependencies in the `deps/` directory.
|
||||||
current
|
|
||||||
- Added `glfwSetErrorCallback`, `GLFWerrorfun` and error type tokens for
|
- [Khronos extension headers](https://www.opengl.org/registry/) for API
|
||||||
receiving error notifications
|
extension symbols used by GLFW
|
||||||
- Added `glfwSetWindowUserPointer` and `glfwGetWindowUserPointer` for
|
- [getopt\_port](https://github.com/kimgr/getopt_port/) for examples
|
||||||
per-window user pointers
|
with command-line options
|
||||||
- Added `glfwGetVersionString` for determining which code paths were enabled at
|
- [TinyCThread](https://github.com/tinycthread/tinycthread) for threaded
|
||||||
compile time
|
examples
|
||||||
- Added `glfwGetWindowMonitor` for querying the monitor, if any, of the
|
- An OpenGL 3.2 core loader generated by
|
||||||
specified window
|
[glad](https://github.com/Dav1dde/glad) for examples using modern OpenGL
|
||||||
- Added `glfwGetFramebufferSize` and `glfwSetFramebufferSizeCallback` for
|
|
||||||
receiving the current size, in pixels, of the framebuffer
|
|
||||||
- Added `glfwSetWindowPosCallback` and `GLFWwindowposfun` for receiving window
|
## Changelog
|
||||||
position events
|
|
||||||
- Added `glfwSetWindowFocusCallback` and `GLFWwindowfocusfun` for receiving
|
- Made library compilation fail if any header option macros are defined
|
||||||
window focus events
|
- Removed support for LCC and Borland C++
|
||||||
- Added `glfwSetWindowIconifyCallback` and `GLFWwindowiconifyfun` for receiving
|
- Bugfix: `glfwSetTime` silently accepted invalid values
|
||||||
window iconification events
|
- [Cocoa] Bugfix: `NSHighResolutionCapable` was not enabled for test and
|
||||||
- Added `glfwGetClipboardString` and `glfwSetClipboardString` for interacting
|
example programs
|
||||||
with the system clipboard
|
- [Cocoa] Bugfix: Sleeping monitors were not included in the monitor list
|
||||||
- Added `glfwGetJoystickName` for retrieving the name of a joystick
|
- [Cocoa] Bugfix: `glfwSetWindowSize` did not change the video mode for full
|
||||||
- Added `glfwGetCurrentContext` for retrieving the window whose OpenGL context
|
screen windows
|
||||||
is current
|
- [X11] Added support for Cygwin-X
|
||||||
- Added `GLFW_SRGB_CAPABLE` for requesting sRGB capable framebuffers
|
- [X11] Made XInput2 optional at compile-time
|
||||||
- Added `GLFW_CLIENT_API` and its values `GLFW_OPENGL_API` and
|
- [X11] Made Xxf86vm optional at compile-time
|
||||||
`GLFW_OPENGL_ES_API` for selecting client API
|
- [X11] Bugfix: Moved `_NET_REQUEST_FRAME_EXTENTS` request to
|
||||||
- Added `GLFW_CONTEXT_ROBUSTNESS` and values `GLFW_NO_ROBUSTNESS`,
|
`glfwGetWindowFrameSize` and added protocol-breaking timeout
|
||||||
`GLFW_NO_RESET_NOTIFICATION` and `GLFW_LOSE_CONTEXT_ON_RESET` for
|
as a workaround for broken support in Unity, Fluxbox and Xfwm
|
||||||
`GL_ARB_robustness` support
|
- [X11] Bugfix: Mouse button `GLFW_MOUSE_BUTTON_4` was never used
|
||||||
- Added `GLFW_OPENGL_REVISION` to make up for removal of `glfwGetGLVersion`
|
- [X11] Bugfix: `glfwTerminate` could close an unrelated file descriptor
|
||||||
- Added `GLFW_INCLUDE_GLCOREARB` macro for including `GL/glcorearb.h` instead of
|
- [X11] Bugfix: Some WMs (KWM, Fluxbox) did not respect cursor redefinition
|
||||||
`GL/gl.h`
|
- [WGL] Bugfix: The context flags debug bit was not set for OpenGL ES
|
||||||
- Added `GLFW_INCLUDE_ES1` macro for telling the GLFW header to use `GLES/gl.h`
|
- [GLX] Bugfix: The context flags debug bit was not set for OpenGL ES
|
||||||
instead of `GL/gl.h`
|
- [EGL] Bugfix: The context flags debug bit was not set for OpenGL ES
|
||||||
- Added `GLFW_INCLUDE_ES2` macro for telling the GLFW header to use
|
|
||||||
`GLES2/gl2.h` instead of `GL/gl.h`
|
|
||||||
- Added `GLFW_INCLUDE_NONE` macro for telling the GLFW header to not include
|
|
||||||
any client API header
|
|
||||||
- Added `GLFW_VISIBLE` window hint and parameter for controlling and polling
|
|
||||||
window visibility
|
|
||||||
- Added `GLFW_REPEAT` key action for repeated keys
|
|
||||||
- Added scancode parameter to key callback
|
|
||||||
- Added `refreshRate` member to `GLFWvidmode` struct
|
|
||||||
- Added key modifier parameter to key and mouse button callbacks
|
|
||||||
- Added `windows` simple multi-window test program
|
|
||||||
- Added `sharing` simple OpenGL object sharing test program
|
|
||||||
- Added `modes` video mode enumeration and setting test program
|
|
||||||
- Added `threads` simple multi-threaded rendering test program
|
|
||||||
- Added `glfw3native.h` header and platform-specific functions for explicit
|
|
||||||
access to native display, window and context handles
|
|
||||||
- Added `glfwSetGamma`, `glfwSetGammaRamp` and `glfwGetGammaRamp` functions and
|
|
||||||
`GLFWgammaramp` type for monitor gamma ramp control
|
|
||||||
- Added window parameter to `glfwSwapBuffers`
|
|
||||||
- Changed buffer bit depth parameters of `glfwOpenWindow` to window hints
|
|
||||||
- Changed `glfwCreateWindow` and `glfwSetWindowTitle` to use UTF-8 encoded
|
|
||||||
strings
|
|
||||||
- Changed `glfwGetProcAddress` to return a (generic) function pointer
|
|
||||||
- Changed `glfwGetVideoModes` to return a dynamic, unlimited number of video
|
|
||||||
modes for the specified monitor
|
|
||||||
- Changed cursor position to double-precision floating-point
|
|
||||||
- Changed default cursor mode for fullscreen to normal
|
|
||||||
- Renamed header directory `GL` to `GLFW`
|
|
||||||
- Renamed `glfw.h` to `glfw3.h` to avoid conflicts with 2.x series
|
|
||||||
- Renamed `glfwOpenWindowHint` to `glfwWindowHint`
|
|
||||||
- Renamed `glfwGetWindowParam` to `glfwGetWindowAttrib`
|
|
||||||
- Renamed `GLFW_ACTIVE` to `GLFW_FOCUSED`
|
|
||||||
- Renamed `GLFW_FSAA_SAMPLES` to `GLFW_SAMPLES`
|
|
||||||
- Renamed `GLFW_WINDOW_NO_RESIZE` to `GLFW_RESIZABLE`
|
|
||||||
- Renamed `GLFW_BUILD_DLL` to `_GLFW_BUILD_DLL`
|
|
||||||
- Renamed `version` test to `glfwinfo`
|
|
||||||
- Renamed `GLFW_NO_GLU` to `GLFW_INCLUDE_GLU` and made it disabled by default
|
|
||||||
- Renamed `glfwGetJoystickPos` to `glfwGetJoystickAxes` to match
|
|
||||||
`glfwGetJoystickButtons`
|
|
||||||
- Renamed mouse position functions to cursor position equivalents
|
|
||||||
- Replaced `glfwOpenWindow` and `glfwCloseWindow` with `glfwCreateWindow` and
|
|
||||||
`glfwDestroyWindow`
|
|
||||||
- Replaced `glfwGetDesktopMode` width `glfwGetVideoMode`
|
|
||||||
- Replaced ad hoc build system with CMake
|
|
||||||
- Replaced layout-dependent key codes with single, platform-independent set
|
|
||||||
based on US layout
|
|
||||||
- Replaced mouse wheel interface with two-dimensional, floating point scrolling
|
|
||||||
interface
|
|
||||||
- Replaced `glfwEnable` and `glfwDisable` with `glfwGetInputMode` and
|
|
||||||
`glfwSetInputMode`
|
|
||||||
- Replaced `joystick` test with graphical version
|
|
||||||
- Replaced automatic closing of windows with the window close flag
|
|
||||||
- Removed the `GLFW_KEY_REPEAT` input option
|
|
||||||
- Removed event auto-polling and the `GLFW_AUTO_POLL_EVENTS` window enable
|
|
||||||
- Removed the Win32 port .def files
|
|
||||||
- Removed the entire threading API
|
|
||||||
- Removed the entire image loading API
|
|
||||||
- Removed deprecated Carbon port
|
|
||||||
- Removed registering `glfwTerminate` with `atexit`
|
|
||||||
- Removed `glfwSleep` function
|
|
||||||
- Removed `glfwGetNumberOfProcessors` function
|
|
||||||
- Removed `glfwGetGLVersion` function
|
|
||||||
- Removed `GLFW_OPENED` window parameter
|
|
||||||
- Removed `GLFW_WINDOW` and `GLFW_FULLSCREEN`
|
|
||||||
- Removed nonsensical key actions for Unicode character input
|
|
||||||
- Removed `GLFWCALL` and `GLFWAPIENTRY` macros for stdcall calling convention
|
|
||||||
- Removed `GLFW_ACCELERATED` window parameter
|
|
||||||
- Removed default framebuffer attributes from `glfwGetWindowParam`
|
|
||||||
- Bugfix: The default OpenGL version in the `glfwinfo` test was set to 1.1
|
|
||||||
- Bugfix: The OpenGL profile and forward-compatibility window parameters were
|
|
||||||
not saved after context creation
|
|
||||||
- Bugfix: The FSAA test did not check for the availability of
|
|
||||||
`GL_ARB_multisample`
|
|
||||||
- Bugfix: Cursor centering upon leaving captured cursor mode was reported
|
|
||||||
before the mode was changed to non-captured
|
|
||||||
- [Cocoa] Added support for OpenGL 3.2 core profile in 10.7 Lion and above
|
|
||||||
- [Cocoa] Added support for high-DPI (Retina) monitors
|
|
||||||
- [Cocoa] Added support for joysticks
|
|
||||||
- [Cocoa] Postponed menu creation to first window creation
|
|
||||||
- [Cocoa] Replaced `NSDate` time source with `mach_absolute_time`
|
|
||||||
- [Cocoa] Replaced all deprecated CoreGraphics calls with non-deprecated
|
|
||||||
counterparts
|
|
||||||
- [Cocoa] Bugfix: The `NSOpenGLPFAFullScreen` pixel format attribute caused
|
|
||||||
creation to fail on some machines
|
|
||||||
- [Cocoa] Bugfix: `glfwCreateWindow` did not properly enforce the
|
|
||||||
forward-compatible and context profile hints
|
|
||||||
- [Cocoa] Bugfix: The loop condition for saving video modes used the wrong
|
|
||||||
index variable
|
|
||||||
- [Cocoa] Bugfix: The OpenGL framework was not retrieved, making
|
|
||||||
`glfwGetProcAddress` crash
|
|
||||||
- [Cocoa] Bugfix: `glfwInit` changed the current directory for unbundled
|
|
||||||
executables
|
|
||||||
- [Cocoa] Bugfix: The `GLFW_WINDOW_NO_RESIZE` window parameter was always zero
|
|
||||||
- [Cocoa] Bugfix: The cursor position incorrectly rounded during conversion
|
|
||||||
- [Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen
|
|
||||||
windows
|
|
||||||
- [Cocoa] Bugfix: The GLFW window was flagged as restorable
|
|
||||||
- [X11] Added support for the `GLX_EXT_swap_control` and
|
|
||||||
`GLX_MESA_swap_control` extensions as alternatives to
|
|
||||||
`GLX_SGI_swap_control`
|
|
||||||
- [X11] Added the POSIX `CLOCK_MONOTONIC` time source as the preferred method
|
|
||||||
- [X11] Added dependency on libm, where present
|
|
||||||
- [X11] Added support for the `_NET_WM_NAME` and `_NET_WM_ICON_NAME` EWMH
|
|
||||||
window properties
|
|
||||||
- [X11] Made client-side RandR and Xf86VidMode extensions required
|
|
||||||
- [X11] Bugfix: Some window properties required by the ICCCM were not set
|
|
||||||
- [X11] Bugfix: Calling `glXCreateContextAttribsARB` with an unavailable OpenGL
|
|
||||||
version caused the application to terminate with a `BadMatch`
|
|
||||||
Xlib error
|
|
||||||
- [X11] Bugfix: A synchronization point necessary for jitter-free locked cursor
|
|
||||||
mode was incorrectly removed
|
|
||||||
- [X11] Bugfix: The window size hints were not updated when calling
|
|
||||||
`glfwSetWindowSize` on a non-resizable window
|
|
||||||
- [Win32] Added support for high-DPI monitors
|
|
||||||
- [Win32] Changed port to use Unicode mode only
|
|
||||||
- [Win32] Removed explicit support for versions of Windows older than Windows
|
|
||||||
XP
|
|
||||||
- [Win32] Bugfix: Window activation and iconification did not work as expected
|
|
||||||
- [Win32] Bugfix: Software rasterizer pixel formats were not discarded by the
|
|
||||||
`WGL_ARB_pixel_format` code path
|
|
||||||
- [Win32] Bugfix: The array for WGL context attributes was too small and could
|
|
||||||
overflow
|
|
||||||
- [Win32] Bugfix: Alt+F4 hot key was not translated into `WM_CLOSE`
|
|
||||||
- [Win32] Bugfix: The `GLFW_WINDOW_NO_RESIZE` window parameter was always zero
|
|
||||||
- [Win32] Bugfix: A test was missing for whether all available pixel formats
|
|
||||||
had been disqualified
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
@@ -292,11 +96,11 @@ If you have questions related to the use of GLFW, we have a
|
|||||||
channel `#glfw` on [Freenode](http://freenode.net/).
|
channel `#glfw` on [Freenode](http://freenode.net/).
|
||||||
|
|
||||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||||
request, please file it in one of the
|
request, please file it in the
|
||||||
[issue trackers](https://sourceforge.net/p/glfw/_list/tickets) on SF.net.
|
[issue tracker](https://github.com/glfw/glfw/issues) on GitHub.
|
||||||
|
|
||||||
Finally, if you're interested in helping out with the development of GLFW or
|
Finally, if you're interested in helping out with the development of GLFW or
|
||||||
porting it to your favorite platform, we have a
|
porting it to your favorite platform, we have an occasionally active
|
||||||
[developer's mailing list](https://lists.stacken.kth.se/mailman/listinfo/glfw-dev),
|
[developer's mailing list](https://lists.stacken.kth.se/mailman/listinfo/glfw-dev),
|
||||||
or you could join us on `#glfw`.
|
or you could join us on `#glfw`.
|
||||||
|
|
||||||
@@ -308,25 +112,38 @@ skills.
|
|||||||
|
|
||||||
- Bobyshev Alexander
|
- Bobyshev Alexander
|
||||||
- artblanc
|
- artblanc
|
||||||
|
- arturo
|
||||||
- Matt Arsenault
|
- Matt Arsenault
|
||||||
- Keith Bauer
|
- Keith Bauer
|
||||||
- John Bartholomew
|
- John Bartholomew
|
||||||
|
- Niklas Behrens
|
||||||
- Niklas Bergström
|
- Niklas Bergström
|
||||||
|
- Doug Binks
|
||||||
- blanco
|
- blanco
|
||||||
|
- Martin Capitanio
|
||||||
- Lambert Clara
|
- Lambert Clara
|
||||||
|
- Andrew Corrigan
|
||||||
- Noel Cower
|
- Noel Cower
|
||||||
- Jarrod Davis
|
- Jarrod Davis
|
||||||
- Olivier Delannoy
|
- Olivier Delannoy
|
||||||
- Paul R. Deppe
|
- Paul R. Deppe
|
||||||
|
- Michael Dickens
|
||||||
- Jonathan Dummer
|
- Jonathan Dummer
|
||||||
- Ralph Eastwood
|
- Ralph Eastwood
|
||||||
|
- Siavash Eliasi
|
||||||
|
- Michael Fogleman
|
||||||
- Gerald Franz
|
- Gerald Franz
|
||||||
- GeO4d
|
- GeO4d
|
||||||
- Marcus Geelnard
|
- Marcus Geelnard
|
||||||
|
- Eloi Marín Gratacós
|
||||||
- Stefan Gustavson
|
- Stefan Gustavson
|
||||||
- Sylvain Hellegouarch
|
- Sylvain Hellegouarch
|
||||||
|
- Matthew Henry
|
||||||
- heromyth
|
- heromyth
|
||||||
|
- Lucas Hinderberger
|
||||||
|
- Paul Holden
|
||||||
- Toni Jovanoski
|
- Toni Jovanoski
|
||||||
|
- Arseny Kapoulkine
|
||||||
- Osman Keskin
|
- Osman Keskin
|
||||||
- Cameron King
|
- Cameron King
|
||||||
- Peter Knut
|
- Peter Knut
|
||||||
@@ -337,40 +154,59 @@ skills.
|
|||||||
- Martins Mozeiko
|
- Martins Mozeiko
|
||||||
- Tristam MacDonald
|
- Tristam MacDonald
|
||||||
- Hans Mackowiak
|
- Hans Mackowiak
|
||||||
|
- Kyle McDonald
|
||||||
- David Medlock
|
- David Medlock
|
||||||
|
- Bryce Mehring
|
||||||
- Jonathan Mercier
|
- Jonathan Mercier
|
||||||
- Marcel Metz
|
- Marcel Metz
|
||||||
|
- Jonathan Miller
|
||||||
- Kenneth Miller
|
- Kenneth Miller
|
||||||
|
- Bruce Mitchener
|
||||||
|
- Jack Moffitt
|
||||||
- Jeff Molofee
|
- Jeff Molofee
|
||||||
- Jon Morton
|
- Jon Morton
|
||||||
|
- Pierre Moulon
|
||||||
- Julian Møller
|
- Julian Møller
|
||||||
- Ozzy at Orkysquad
|
- Kamil Nowakowski
|
||||||
|
- Ozzy
|
||||||
|
- Andri Pálsson
|
||||||
- Peoro
|
- Peoro
|
||||||
- Braden Pellett
|
- Braden Pellett
|
||||||
- Arturo J. Pérez
|
- Arturo J. Pérez
|
||||||
|
- Cyril Pichard
|
||||||
|
- Pieroman
|
||||||
- Jorge Rodriguez
|
- Jorge Rodriguez
|
||||||
- Ed Ropple
|
- Ed Ropple
|
||||||
|
- Aleksey Rybalkin
|
||||||
- Riku Salminen
|
- Riku Salminen
|
||||||
|
- Brandon Schaefer
|
||||||
- Sebastian Schuberth
|
- Sebastian Schuberth
|
||||||
- Matt Sealey
|
- Matt Sealey
|
||||||
- SephiRok
|
- SephiRok
|
||||||
- Steve Sexton
|
- Steve Sexton
|
||||||
|
- Systemcluster
|
||||||
- Dmitri Shuralyov
|
- Dmitri Shuralyov
|
||||||
- Daniel Skorupski
|
- Daniel Skorupski
|
||||||
- Bradley Smith
|
- Bradley Smith
|
||||||
- Julian Squires
|
- Julian Squires
|
||||||
- Johannes Stein
|
- Johannes Stein
|
||||||
|
- Justin Stoecker
|
||||||
- Nathan Sweet
|
- Nathan Sweet
|
||||||
- TTK-Bandit
|
- TTK-Bandit
|
||||||
- Sergey Tikhomirov
|
- Sergey Tikhomirov
|
||||||
|
- A. Tombs
|
||||||
- Samuli Tuomola
|
- Samuli Tuomola
|
||||||
|
- urraka
|
||||||
- Jari Vetoniemi
|
- Jari Vetoniemi
|
||||||
|
- Ricardo Vieira
|
||||||
- Simon Voordouw
|
- Simon Voordouw
|
||||||
- Torsten Walluhn
|
- Torsten Walluhn
|
||||||
|
- Patrick Walton
|
||||||
- Jay Weisskopf
|
- Jay Weisskopf
|
||||||
- Frank Wille
|
- Frank Wille
|
||||||
- yuriks
|
- yuriks
|
||||||
- Santi Zupancic
|
- Santi Zupancic
|
||||||
|
- Jonas Ådahl
|
||||||
- Lasse Öörni
|
- Lasse Öörni
|
||||||
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||||
reports, patches, feedback, testing and encouragement
|
reports, patches, feedback, testing and encouragement
|
||||||
|
|||||||
Vendored
+9761
-10875
File diff suppressed because it is too large
Load Diff
Vendored
+618
-721
File diff suppressed because it is too large
Load Diff
Vendored
+558
-661
File diff suppressed because it is too large
Load Diff
Vendored
+282
@@ -0,0 +1,282 @@
|
|||||||
|
#ifndef __khrplatform_h_
|
||||||
|
#define __khrplatform_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
** copy of this software and/or associated documentation files (the
|
||||||
|
** "Materials"), to deal in the Materials without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||||
|
** permit persons to whom the Materials are 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 Materials.
|
||||||
|
**
|
||||||
|
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 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
|
||||||
|
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Khronos platform-specific types and definitions.
|
||||||
|
*
|
||||||
|
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||||
|
*
|
||||||
|
* Adopters may modify this file to suit their platform. Adopters are
|
||||||
|
* encouraged to submit platform specific modifications to the Khronos
|
||||||
|
* group so that they can be included in future versions of this file.
|
||||||
|
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||||
|
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||||
|
* "Khronos (general)" component "Registry".
|
||||||
|
*
|
||||||
|
* A predefined template which fills in some of the bug fields can be
|
||||||
|
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||||
|
* must create a Bugzilla login first.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* See the Implementer's Guidelines for information about where this file
|
||||||
|
* should be located on your system and for more details of its use:
|
||||||
|
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||||
|
*
|
||||||
|
* This file should be included as
|
||||||
|
* #include <KHR/khrplatform.h>
|
||||||
|
* by Khronos client API header files that use its types and defines.
|
||||||
|
*
|
||||||
|
* The types in khrplatform.h should only be used to define API-specific types.
|
||||||
|
*
|
||||||
|
* Types defined in khrplatform.h:
|
||||||
|
* khronos_int8_t signed 8 bit
|
||||||
|
* khronos_uint8_t unsigned 8 bit
|
||||||
|
* khronos_int16_t signed 16 bit
|
||||||
|
* khronos_uint16_t unsigned 16 bit
|
||||||
|
* khronos_int32_t signed 32 bit
|
||||||
|
* khronos_uint32_t unsigned 32 bit
|
||||||
|
* khronos_int64_t signed 64 bit
|
||||||
|
* khronos_uint64_t unsigned 64 bit
|
||||||
|
* khronos_intptr_t signed same number of bits as a pointer
|
||||||
|
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||||
|
* khronos_ssize_t signed size
|
||||||
|
* khronos_usize_t unsigned size
|
||||||
|
* khronos_float_t signed 32 bit floating point
|
||||||
|
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||||
|
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||||
|
* nanoseconds
|
||||||
|
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||||
|
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||||
|
* only be used as a base type when a client API's boolean type is
|
||||||
|
* an enum. Client APIs which use an integer or other type for
|
||||||
|
* booleans cannot use this as the base type for their boolean.
|
||||||
|
*
|
||||||
|
* Tokens defined in khrplatform.h:
|
||||||
|
*
|
||||||
|
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||||
|
*
|
||||||
|
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||||
|
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||||
|
*
|
||||||
|
* Calling convention macros defined in this file:
|
||||||
|
* KHRONOS_APICALL
|
||||||
|
* KHRONOS_APIENTRY
|
||||||
|
* KHRONOS_APIATTRIBUTES
|
||||||
|
*
|
||||||
|
* These may be used in function prototypes as:
|
||||||
|
*
|
||||||
|
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||||
|
* int arg1,
|
||||||
|
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* Definition of KHRONOS_APICALL
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
* This precedes the return type of the function in the function prototype.
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||||
|
# define KHRONOS_APICALL __declspec(dllimport)
|
||||||
|
#elif defined (__SYMBIAN32__)
|
||||||
|
# define KHRONOS_APICALL IMPORT_C
|
||||||
|
#else
|
||||||
|
# define KHRONOS_APICALL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* Definition of KHRONOS_APIENTRY
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
* This follows the return type of the function and precedes the function
|
||||||
|
* name in the function prototype.
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||||
|
/* Win32 but not WinCE */
|
||||||
|
# define KHRONOS_APIENTRY __stdcall
|
||||||
|
#else
|
||||||
|
# define KHRONOS_APIENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* Definition of KHRONOS_APIATTRIBUTES
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
* This follows the closing parenthesis of the function prototype arguments.
|
||||||
|
*/
|
||||||
|
#if defined (__ARMCC_2__)
|
||||||
|
#define KHRONOS_APIATTRIBUTES __softfp
|
||||||
|
#else
|
||||||
|
#define KHRONOS_APIATTRIBUTES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* basic type definitions
|
||||||
|
*-----------------------------------------------------------------------*/
|
||||||
|
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using <stdint.h>
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef int32_t khronos_int32_t;
|
||||||
|
typedef uint32_t khronos_uint32_t;
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif defined(__VMS ) || defined(__sgi)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using <inttypes.h>
|
||||||
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
|
typedef int32_t khronos_int32_t;
|
||||||
|
typedef uint32_t khronos_uint32_t;
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Win32
|
||||||
|
*/
|
||||||
|
typedef __int32 khronos_int32_t;
|
||||||
|
typedef unsigned __int32 khronos_uint32_t;
|
||||||
|
typedef __int64 khronos_int64_t;
|
||||||
|
typedef unsigned __int64 khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif defined(__sun__) || defined(__digital__)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sun or Digital
|
||||||
|
*/
|
||||||
|
typedef int khronos_int32_t;
|
||||||
|
typedef unsigned int khronos_uint32_t;
|
||||||
|
#if defined(__arch64__) || defined(_LP64)
|
||||||
|
typedef long int khronos_int64_t;
|
||||||
|
typedef unsigned long int khronos_uint64_t;
|
||||||
|
#else
|
||||||
|
typedef long long int khronos_int64_t;
|
||||||
|
typedef unsigned long long int khronos_uint64_t;
|
||||||
|
#endif /* __arch64__ */
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hypothetical platform with no float or int64 support
|
||||||
|
*/
|
||||||
|
typedef int khronos_int32_t;
|
||||||
|
typedef unsigned int khronos_uint32_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 0
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 0
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic fallback
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef int32_t khronos_int32_t;
|
||||||
|
typedef uint32_t khronos_uint32_t;
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Types that are (so far) the same on all platforms
|
||||||
|
*/
|
||||||
|
typedef signed char khronos_int8_t;
|
||||||
|
typedef unsigned char khronos_uint8_t;
|
||||||
|
typedef signed short int khronos_int16_t;
|
||||||
|
typedef unsigned short int khronos_uint16_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||||
|
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||||
|
* to be the only LLP64 architecture in current use.
|
||||||
|
*/
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef signed long long int khronos_intptr_t;
|
||||||
|
typedef unsigned long long int khronos_uintptr_t;
|
||||||
|
typedef signed long long int khronos_ssize_t;
|
||||||
|
typedef unsigned long long int khronos_usize_t;
|
||||||
|
#else
|
||||||
|
typedef signed long int khronos_intptr_t;
|
||||||
|
typedef unsigned long int khronos_uintptr_t;
|
||||||
|
typedef signed long int khronos_ssize_t;
|
||||||
|
typedef unsigned long int khronos_usize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if KHRONOS_SUPPORT_FLOAT
|
||||||
|
/*
|
||||||
|
* Float type
|
||||||
|
*/
|
||||||
|
typedef float khronos_float_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if KHRONOS_SUPPORT_INT64
|
||||||
|
/* Time types
|
||||||
|
*
|
||||||
|
* These types can be used to represent a time interval in nanoseconds or
|
||||||
|
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||||
|
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||||
|
* time the system booted). The Unadjusted System Time is an unsigned
|
||||||
|
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||||
|
* may be either signed or unsigned.
|
||||||
|
*/
|
||||||
|
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||||
|
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy value used to pad enum types to 32 bits.
|
||||||
|
*/
|
||||||
|
#ifndef KHRONOS_MAX_ENUM
|
||||||
|
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enumerated boolean type
|
||||||
|
*
|
||||||
|
* Values other than zero should be considered to be true. Therefore
|
||||||
|
* comparisons should not be made against KHRONOS_TRUE.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
KHRONOS_FALSE = 0,
|
||||||
|
KHRONOS_TRUE = 1,
|
||||||
|
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||||
|
} khronos_boolean_enum_t;
|
||||||
|
|
||||||
|
#endif /* __khrplatform_h_ */
|
||||||
Vendored
+201
-238
@@ -1,267 +1,230 @@
|
|||||||
/*****************************************************************************
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
* getopt.c - competent and free getopt library.
|
* All rights reserved.
|
||||||
* $Header: /cvsroot/freegetopt/freegetopt/getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $
|
*
|
||||||
*
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* Copyright (c)2002-2003 Mark K. Kim
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* All rights reserved.
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
*
|
* this list of conditions and the following disclaimer.
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* modification, are permitted provided that the following conditions
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* are met:
|
* and/or other materials provided with the distribution.
|
||||||
*
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
* * Redistributions of source code must retain the above copyright
|
* to endorse or promote products derived from this software without specific
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* prior written permission.
|
||||||
*
|
*
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* the documentation and/or other materials provided with the
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* distribution.
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
*
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* * Neither the original author of this software nor the names of its
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* contributors may be used to endorse or promote products derived
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* from this software without specific prior written permission.
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
*
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
*/
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
||||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
* DAMAGE.
|
|
||||||
*/
|
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
/* 2013-01-06 Camilla Berglund <elmindreda@elmindreda.org>
|
#include <stddef.h>
|
||||||
*
|
#include <string.h>
|
||||||
* Only define _CRT_SECURE_NO_WARNINGS if not already defined.
|
|
||||||
*/
|
|
||||||
/* 2012-08-12 Lambert Clara <lambert.clara@yahoo.fr>
|
|
||||||
*
|
|
||||||
* Constify third argument of getopt.
|
|
||||||
*/
|
|
||||||
/* 2011-07-27 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
*
|
|
||||||
* Added _CRT_SECURE_NO_WARNINGS macro.
|
|
||||||
*/
|
|
||||||
/* 2009-10-12 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
*
|
|
||||||
* Removed unused global static variable 'ID'.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char* optarg = NULL;
|
const int no_argument = 0;
|
||||||
int optind = 0;
|
const int required_argument = 1;
|
||||||
int opterr = 1;
|
const int optional_argument = 2;
|
||||||
int optopt = '?';
|
|
||||||
|
|
||||||
|
char* optarg;
|
||||||
|
int optopt;
|
||||||
|
/* The variable optind [...] shall be initialized to 1 by the system. */
|
||||||
|
int optind = 1;
|
||||||
|
int opterr;
|
||||||
|
|
||||||
static char** prev_argv = NULL; /* Keep a copy of argv and argc to */
|
static char* optcursor = NULL;
|
||||||
static int prev_argc = 0; /* tell if getopt params change */
|
|
||||||
static int argv_index = 0; /* Option we're checking */
|
|
||||||
static int argv_index2 = 0; /* Option argument we're checking */
|
|
||||||
static int opt_offset = 0; /* Index into compounded "-option" */
|
|
||||||
static int dashdash = 0; /* True if "--" option reached */
|
|
||||||
static int nonopt = 0; /* How many nonopts we've found */
|
|
||||||
|
|
||||||
static void increment_index()
|
/* Implemented based on [1] and [2] for optional arguments.
|
||||||
{
|
optopt is handled FreeBSD-style, per [3].
|
||||||
/* Move onto the next option */
|
Other GNU and FreeBSD extensions are purely accidental.
|
||||||
if(argv_index < argv_index2)
|
|
||||||
{
|
|
||||||
while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-'
|
|
||||||
&& argv_index < argv_index2+1);
|
|
||||||
}
|
|
||||||
else argv_index++;
|
|
||||||
opt_offset = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html
|
||||||
/*
|
[2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
* Permutes argv[] so that the argument currently being processed is moved
|
[3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE
|
||||||
* to the end.
|
|
||||||
*/
|
*/
|
||||||
static int permute_argv_once()
|
int getopt(int argc, char* const argv[], const char* optstring) {
|
||||||
{
|
int optchar = -1;
|
||||||
/* Movability check */
|
const char* optdecl = NULL;
|
||||||
if(argv_index + nonopt >= prev_argc) return 1;
|
|
||||||
/* Move the current option to the end, bring the others to front */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char* tmp = prev_argv[argv_index];
|
|
||||||
|
|
||||||
/* Move the data */
|
|
||||||
memmove(&prev_argv[argv_index], &prev_argv[argv_index+1],
|
|
||||||
sizeof(char**) * (prev_argc - argv_index - 1));
|
|
||||||
prev_argv[prev_argc - 1] = tmp;
|
|
||||||
|
|
||||||
nonopt++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int getopt(int argc, char** argv, const char* optstr)
|
|
||||||
{
|
|
||||||
int c = 0;
|
|
||||||
|
|
||||||
/* If we have new argv, reinitialize */
|
|
||||||
if(prev_argv != argv || prev_argc != argc)
|
|
||||||
{
|
|
||||||
/* Initialize variables */
|
|
||||||
prev_argv = argv;
|
|
||||||
prev_argc = argc;
|
|
||||||
argv_index = 1;
|
|
||||||
argv_index2 = 1;
|
|
||||||
opt_offset = 1;
|
|
||||||
dashdash = 0;
|
|
||||||
nonopt = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Jump point in case we want to ignore the current argv_index */
|
|
||||||
getopt_top:
|
|
||||||
|
|
||||||
/* Misc. initializations */
|
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
|
opterr = 0;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
/* Dash-dash check */
|
/* Unspecified, but we need it to avoid overrunning the argv bounds. */
|
||||||
if(argv[argv_index] && !strcmp(argv[argv_index], "--"))
|
if (optind >= argc)
|
||||||
{
|
goto no_more_optchars;
|
||||||
dashdash = 1;
|
|
||||||
increment_index();
|
/* If, when getopt() is called argv[optind] is a null pointer, getopt()
|
||||||
|
shall return -1 without changing optind. */
|
||||||
|
if (argv[optind] == NULL)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called *argv[optind] is not the character '-',
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (*argv[optind] != '-')
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "-",
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (strcmp(argv[optind], "-") == 0)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "--",
|
||||||
|
getopt() shall return -1 after incrementing optind. */
|
||||||
|
if (strcmp(argv[optind], "--") == 0) {
|
||||||
|
++optind;
|
||||||
|
goto no_more_optchars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're at the end of argv, that's it. */
|
if (optcursor == NULL || *optcursor == '\0')
|
||||||
if(argv[argv_index] == NULL)
|
optcursor = argv[optind] + 1;
|
||||||
{
|
|
||||||
c = -1;
|
|
||||||
}
|
|
||||||
/* Are we looking at a string? Single dash is also a string */
|
|
||||||
else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-"))
|
|
||||||
{
|
|
||||||
/* If we want a string... */
|
|
||||||
if(optstr[0] == '-')
|
|
||||||
{
|
|
||||||
c = 1;
|
|
||||||
optarg = argv[argv_index];
|
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
/* If we really don't want it (we're in POSIX mode), we're done */
|
|
||||||
else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT"))
|
|
||||||
{
|
|
||||||
c = -1;
|
|
||||||
|
|
||||||
/* Everything else is a non-opt argument */
|
optchar = *optcursor;
|
||||||
nonopt = argc - argv_index;
|
|
||||||
}
|
|
||||||
/* If we mildly don't want it, then move it back */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!permute_argv_once()) goto getopt_top;
|
|
||||||
else c = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Otherwise we're looking at an option */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char* opt_ptr = NULL;
|
|
||||||
|
|
||||||
/* Grab the option */
|
/* FreeBSD: The variable optopt saves the last known option character
|
||||||
c = argv[argv_index][opt_offset++];
|
returned by getopt(). */
|
||||||
|
optopt = optchar;
|
||||||
|
|
||||||
/* Is the option in the optstr? */
|
/* The getopt() function shall return the next option character (if one is
|
||||||
if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c);
|
found) from argv that matches a character in optstring, if there is
|
||||||
else opt_ptr = strchr(optstr, c);
|
one that matches. */
|
||||||
/* Invalid argument */
|
optdecl = strchr(optstring, optchar);
|
||||||
if(!opt_ptr)
|
if (optdecl) {
|
||||||
{
|
/* [I]f a character is followed by a colon, the option takes an
|
||||||
if(opterr)
|
argument. */
|
||||||
{
|
if (optdecl[1] == ':') {
|
||||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
optarg = ++optcursor;
|
||||||
}
|
if (*optarg == '\0') {
|
||||||
|
/* GNU extension: Two colons mean an option takes an
|
||||||
|
optional arg; if there is text in the current argv-element
|
||||||
|
(i.e., in the same word as the option name itself, for example,
|
||||||
|
"-oarg"), then it is returned in optarg, otherwise optarg is set
|
||||||
|
to zero. */
|
||||||
|
if (optdecl[2] != ':') {
|
||||||
|
/* If the option was the last character in the string pointed to by
|
||||||
|
an element of argv, then optarg shall contain the next element
|
||||||
|
of argv, and optind shall be incremented by 2. If the resulting
|
||||||
|
value of optind is greater than argc, this indicates a missing
|
||||||
|
option-argument, and getopt() shall return an error indication.
|
||||||
|
|
||||||
optopt = c;
|
Otherwise, optarg shall point to the string following the
|
||||||
c = '?';
|
option character in that element of argv, and optind shall be
|
||||||
|
incremented by 1.
|
||||||
/* Move onto the next option */
|
*/
|
||||||
increment_index();
|
if (++optind < argc) {
|
||||||
}
|
optarg = argv[optind];
|
||||||
/* Option takes argument */
|
} else {
|
||||||
else if(opt_ptr[1] == ':')
|
/* If it detects a missing option-argument, it shall return the
|
||||||
{
|
colon character ( ':' ) if the first character of optstring
|
||||||
/* ie, -oARGUMENT, -xxxoARGUMENT, etc. */
|
was a colon, or a question-mark character ( '?' ) otherwise.
|
||||||
if(argv[argv_index][opt_offset] != '\0')
|
*/
|
||||||
{
|
optarg = NULL;
|
||||||
optarg = &argv[argv_index][opt_offset];
|
optchar = (optstring[0] == ':') ? ':' : '?';
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
/* ie, -o ARGUMENT (only if it's a required argument) */
|
|
||||||
else if(opt_ptr[2] != ':')
|
|
||||||
{
|
|
||||||
/* One of those "you're not expected to understand this" moment */
|
|
||||||
if(argv_index2 < argv_index) argv_index2 = argv_index;
|
|
||||||
while(argv[++argv_index2] && argv[argv_index2][0] == '-');
|
|
||||||
optarg = argv[argv_index2];
|
|
||||||
|
|
||||||
/* Don't cross into the non-option argument list */
|
|
||||||
if(argv_index2 + nonopt >= prev_argc) optarg = NULL;
|
|
||||||
|
|
||||||
/* Move onto the next option */
|
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Move onto the next option */
|
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* In case we got no argument for an option with required argument */
|
|
||||||
if(optarg == NULL && opt_ptr[2] != ':')
|
|
||||||
{
|
|
||||||
optopt = c;
|
|
||||||
c = '?';
|
|
||||||
|
|
||||||
if(opterr)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"%s: option requires an argument -- %c\n",
|
|
||||||
argv[0], optopt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Option does not take argument */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Next argv_index */
|
|
||||||
if(argv[argv_index][opt_offset] == '\0')
|
|
||||||
{
|
|
||||||
increment_index();
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
optarg = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate optind */
|
optcursor = NULL;
|
||||||
if(c == -1)
|
|
||||||
{
|
|
||||||
optind = argc - nonopt;
|
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
/* If getopt() encounters an option character that is not contained in
|
||||||
optind = argv_index;
|
optstring, it shall return the question-mark ( '?' ) character. */
|
||||||
|
optchar = '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
if (optcursor == NULL || *++optcursor == '\0')
|
||||||
|
++optind;
|
||||||
|
|
||||||
|
return optchar;
|
||||||
|
|
||||||
|
no_more_optchars:
|
||||||
|
optcursor = NULL;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implementation based on [1].
|
||||||
|
|
||||||
/* vim:ts=3
|
[1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
*/
|
*/
|
||||||
|
int getopt_long(int argc, char* const argv[], const char* optstring,
|
||||||
|
const struct option* longopts, int* longindex) {
|
||||||
|
const struct option* o = longopts;
|
||||||
|
const struct option* match = NULL;
|
||||||
|
int num_matches = 0;
|
||||||
|
size_t argument_name_length = 0;
|
||||||
|
const char* current_argument = NULL;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
|
if (optind >= argc)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (strlen(argv[optind]) < 3 || strncmp(argv[optind], "--", 2) != 0)
|
||||||
|
return getopt(argc, argv, optstring);
|
||||||
|
|
||||||
|
/* It's an option; starts with -- and is longer than two chars. */
|
||||||
|
current_argument = argv[optind] + 2;
|
||||||
|
argument_name_length = strcspn(current_argument, "=");
|
||||||
|
for (; o->name; ++o) {
|
||||||
|
if (strncmp(o->name, current_argument, argument_name_length) == 0) {
|
||||||
|
match = o;
|
||||||
|
++num_matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_matches == 1) {
|
||||||
|
/* If longindex is not NULL, it points to a variable which is set to the
|
||||||
|
index of the long option relative to longopts. */
|
||||||
|
if (longindex)
|
||||||
|
*longindex = (int) (match - longopts);
|
||||||
|
|
||||||
|
/* If flag is NULL, then getopt_long() shall return val.
|
||||||
|
Otherwise, getopt_long() returns 0, and flag shall point to a variable
|
||||||
|
which shall be set to val if the option is found, but left unchanged if
|
||||||
|
the option is not found. */
|
||||||
|
if (match->flag)
|
||||||
|
*(match->flag) = match->val;
|
||||||
|
|
||||||
|
retval = match->flag ? 0 : match->val;
|
||||||
|
|
||||||
|
if (match->has_arg != no_argument) {
|
||||||
|
optarg = strchr(argv[optind], '=');
|
||||||
|
if (optarg != NULL)
|
||||||
|
++optarg;
|
||||||
|
|
||||||
|
if (match->has_arg == required_argument) {
|
||||||
|
/* Only scan the next argv for required arguments. Behavior is not
|
||||||
|
specified, but has been observed with Ubuntu and Mac OSX. */
|
||||||
|
if (optarg == NULL && ++optind < argc) {
|
||||||
|
optarg = argv[optind];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optarg == NULL)
|
||||||
|
retval = ':';
|
||||||
|
}
|
||||||
|
} else if (strchr(argv[optind], '=')) {
|
||||||
|
/* An argument was provided to a non-argument option.
|
||||||
|
I haven't seen this specified explicitly, but both GNU and BSD-based
|
||||||
|
implementations show this behavior.
|
||||||
|
*/
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Unknown option or ambiguous match. */
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
++optind;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+44
-50
@@ -1,63 +1,57 @@
|
|||||||
/*****************************************************************************
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
* getopt.h - competent and free getopt library.
|
* All rights reserved.
|
||||||
* $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $
|
*
|
||||||
*
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* Copyright (c)2002-2003 Mark K. Kim
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* All rights reserved.
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
*
|
* this list of conditions and the following disclaimer.
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* modification, are permitted provided that the following conditions
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* are met:
|
* and/or other materials provided with the distribution.
|
||||||
*
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
* * Redistributions of source code must retain the above copyright
|
* to endorse or promote products derived from this software without specific
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* prior written permission.
|
||||||
*
|
*
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* the documentation and/or other materials provided with the
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* distribution.
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
*
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* * Neither the original author of this software nor the names of its
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* contributors may be used to endorse or promote products derived
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* from this software without specific prior written permission.
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
*
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
*/
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
||||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
* DAMAGE.
|
|
||||||
*/
|
|
||||||
#ifndef GETOPT_H_
|
|
||||||
#define GETOPT_H_
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GETOPT_PORT_H
|
||||||
|
#define INCLUDED_GETOPT_PORT_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern const int no_argument;
|
||||||
|
extern const int required_argument;
|
||||||
|
extern const int optional_argument;
|
||||||
|
|
||||||
extern char* optarg;
|
extern char* optarg;
|
||||||
extern int optind;
|
extern int optind, opterr, optopt;
|
||||||
extern int opterr;
|
|
||||||
extern int optopt;
|
|
||||||
|
|
||||||
int getopt(int argc, char** argv, const char* optstr);
|
struct option {
|
||||||
|
const char* name;
|
||||||
|
int has_arg;
|
||||||
|
int* flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
int getopt(int argc, char* const argv[], const char* optstring);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
int getopt_long(int argc, char* const argv[],
|
||||||
|
const char* optstring, const struct option* longopts, int* longindex);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // INCLUDED_GETOPT_PORT_H
|
||||||
#endif /* GETOPT_H_ */
|
|
||||||
|
|
||||||
|
|
||||||
/* vim:ts=3
|
|
||||||
*/
|
|
||||||
|
|||||||
Vendored
+753
@@ -0,0 +1,753 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
struct gladGLversionStruct GLVersion;
|
||||||
|
|
||||||
|
#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
|
||||||
|
#define _GLAD_IS_SOME_NEW_VERSION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int GLAD_GL_VERSION_1_0;
|
||||||
|
int GLAD_GL_VERSION_1_1;
|
||||||
|
int GLAD_GL_VERSION_1_2;
|
||||||
|
int GLAD_GL_VERSION_1_3;
|
||||||
|
int GLAD_GL_VERSION_1_4;
|
||||||
|
int GLAD_GL_VERSION_1_5;
|
||||||
|
int GLAD_GL_VERSION_2_0;
|
||||||
|
int GLAD_GL_VERSION_2_1;
|
||||||
|
int GLAD_GL_VERSION_3_0;
|
||||||
|
int GLAD_GL_VERSION_3_1;
|
||||||
|
int GLAD_GL_VERSION_3_2;
|
||||||
|
PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays;
|
||||||
|
PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;
|
||||||
|
PFNGLFLUSHPROC glad_glFlush;
|
||||||
|
PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D;
|
||||||
|
PFNGLCLEARCOLORPROC glad_glClearColor;
|
||||||
|
PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui;
|
||||||
|
PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex;
|
||||||
|
PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv;
|
||||||
|
PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv;
|
||||||
|
PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;
|
||||||
|
PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;
|
||||||
|
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;
|
||||||
|
PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation;
|
||||||
|
PFNGLLINKPROGRAMPROC glad_glLinkProgram;
|
||||||
|
PFNGLBINDTEXTUREPROC glad_glBindTexture;
|
||||||
|
PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName;
|
||||||
|
PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv;
|
||||||
|
PFNGLFENCESYNCPROC glad_glFenceSync;
|
||||||
|
PFNGLUNIFORM3UIPROC glad_glUniform3ui;
|
||||||
|
PFNGLUNIFORM2UIVPROC glad_glUniform2uiv;
|
||||||
|
PFNGLGETSTRINGPROC glad_glGetString;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D;
|
||||||
|
PFNGLDETACHSHADERPROC glad_glDetachShader;
|
||||||
|
PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv;
|
||||||
|
PFNGLGENBUFFERSPROC glad_glGenBuffers;
|
||||||
|
PFNGLENDQUERYPROC glad_glEndQuery;
|
||||||
|
PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv;
|
||||||
|
PFNGLLINEWIDTHPROC glad_glLineWidth;
|
||||||
|
PFNGLUNIFORM2FVPROC glad_glUniform2fv;
|
||||||
|
PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced;
|
||||||
|
PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v;
|
||||||
|
PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;
|
||||||
|
PFNGLCOMPILESHADERPROC glad_glCompileShader;
|
||||||
|
PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying;
|
||||||
|
PFNGLDELETETEXTURESPROC glad_glDeleteTextures;
|
||||||
|
PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;
|
||||||
|
PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;
|
||||||
|
PFNGLPOLYGONMODEPROC glad_glPolygonMode;
|
||||||
|
PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange;
|
||||||
|
PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;
|
||||||
|
PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;
|
||||||
|
PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d;
|
||||||
|
PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;
|
||||||
|
PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v;
|
||||||
|
PFNGLISSYNCPROC glad_glIsSync;
|
||||||
|
PFNGLCLAMPCOLORPROC glad_glClampColor;
|
||||||
|
PFNGLUNIFORM4IVPROC glad_glUniform4iv;
|
||||||
|
PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;
|
||||||
|
PFNGLCLEARSTENCILPROC glad_glClearStencil;
|
||||||
|
PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture;
|
||||||
|
PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv;
|
||||||
|
PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s;
|
||||||
|
PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex;
|
||||||
|
PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv;
|
||||||
|
PFNGLENABLEIPROC glad_glEnablei;
|
||||||
|
PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;
|
||||||
|
PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv;
|
||||||
|
PFNGLGENTEXTURESPROC glad_glGenTextures;
|
||||||
|
PFNGLDEPTHFUNCPROC glad_glDepthFunc;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;
|
||||||
|
PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;
|
||||||
|
PFNGLUNIFORM1FPROC glad_glUniform1f;
|
||||||
|
PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;
|
||||||
|
PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv;
|
||||||
|
PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv;
|
||||||
|
PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;
|
||||||
|
PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage;
|
||||||
|
PFNGLISVERTEXARRAYPROC glad_glIsVertexArray;
|
||||||
|
PFNGLCREATESHADERPROC glad_glCreateShader;
|
||||||
|
PFNGLISBUFFERPROC glad_glIsBuffer;
|
||||||
|
PFNGLUNIFORM1IPROC glad_glUniform1i;
|
||||||
|
PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s;
|
||||||
|
PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;
|
||||||
|
PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv;
|
||||||
|
PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;
|
||||||
|
PFNGLDISABLEPROC glad_glDisable;
|
||||||
|
PFNGLUNIFORM2IPROC glad_glUniform2i;
|
||||||
|
PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;
|
||||||
|
PFNGLLOGICOPPROC glad_glLogicOp;
|
||||||
|
PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv;
|
||||||
|
PFNGLGETPROGRAMIVPROC glad_glGetProgramiv;
|
||||||
|
PFNGLCOLORMASKPROC glad_glColorMask;
|
||||||
|
PFNGLHINTPROC glad_glHint;
|
||||||
|
PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer;
|
||||||
|
PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv;
|
||||||
|
PFNGLBLENDEQUATIONPROC glad_glBlendEquation;
|
||||||
|
PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;
|
||||||
|
PFNGLSAMPLEMASKIPROC glad_glSampleMaski;
|
||||||
|
PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;
|
||||||
|
PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;
|
||||||
|
PFNGLCULLFACEPROC glad_glCullFace;
|
||||||
|
PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv;
|
||||||
|
PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv;
|
||||||
|
PFNGLUNIFORM4FVPROC glad_glUniform4fv;
|
||||||
|
PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv;
|
||||||
|
PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;
|
||||||
|
PFNGLUNIFORM1UIVPROC glad_glUniform1uiv;
|
||||||
|
PFNGLPOINTSIZEPROC glad_glPointSize;
|
||||||
|
PFNGLGETSTRINGIPROC glad_glGetStringi;
|
||||||
|
PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv;
|
||||||
|
PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv;
|
||||||
|
PFNGLDELETEPROGRAMPROC glad_glDeleteProgram;
|
||||||
|
PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv;
|
||||||
|
PFNGLGENQUERIESPROC glad_glGenQueries;
|
||||||
|
PFNGLWAITSYNCPROC glad_glWaitSync;
|
||||||
|
PFNGLATTACHSHADERPROC glad_glAttachShader;
|
||||||
|
PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;
|
||||||
|
PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;
|
||||||
|
PFNGLUNIFORM3IPROC glad_glUniform3i;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D;
|
||||||
|
PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex;
|
||||||
|
PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;
|
||||||
|
PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D;
|
||||||
|
PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v;
|
||||||
|
PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex;
|
||||||
|
PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv;
|
||||||
|
PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;
|
||||||
|
PFNGLUNIFORM3FPROC glad_glUniform3f;
|
||||||
|
PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv;
|
||||||
|
PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;
|
||||||
|
PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv;
|
||||||
|
PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;
|
||||||
|
PFNGLDRAWELEMENTSPROC glad_glDrawElements;
|
||||||
|
PFNGLCOLORMASKIPROC glad_glColorMaski;
|
||||||
|
PFNGLISENABLEDIPROC glad_glIsEnabledi;
|
||||||
|
PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv;
|
||||||
|
PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements;
|
||||||
|
PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv;
|
||||||
|
PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays;
|
||||||
|
PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase;
|
||||||
|
PFNGLBUFFERSUBDATAPROC glad_glBufferSubData;
|
||||||
|
PFNGLUNIFORM1IVPROC glad_glUniform1iv;
|
||||||
|
PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv;
|
||||||
|
PFNGLUNIFORM4UIVPROC glad_glUniform4uiv;
|
||||||
|
PFNGLREADBUFFERPROC glad_glReadBuffer;
|
||||||
|
PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData;
|
||||||
|
PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray;
|
||||||
|
PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync;
|
||||||
|
PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;
|
||||||
|
PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv;
|
||||||
|
PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui;
|
||||||
|
PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;
|
||||||
|
PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D;
|
||||||
|
PFNGLGETSHADERIVPROC glad_glGetShaderiv;
|
||||||
|
PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv;
|
||||||
|
PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv;
|
||||||
|
PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;
|
||||||
|
PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv;
|
||||||
|
PFNGLPOINTPARAMETERIPROC glad_glPointParameteri;
|
||||||
|
PFNGLBLENDCOLORPROC glad_glBlendColor;
|
||||||
|
PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;
|
||||||
|
PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer;
|
||||||
|
PFNGLDEPTHMASKPROC glad_glDepthMask;
|
||||||
|
PFNGLPOINTPARAMETERFPROC glad_glPointParameterf;
|
||||||
|
PFNGLDISABLEIPROC glad_glDisablei;
|
||||||
|
PFNGLGETDOUBLEVPROC glad_glGetDoublev;
|
||||||
|
PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv;
|
||||||
|
PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv;
|
||||||
|
PFNGLSHADERSOURCEPROC glad_glShaderSource;
|
||||||
|
PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;
|
||||||
|
PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv;
|
||||||
|
PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv;
|
||||||
|
PFNGLDRAWARRAYSPROC glad_glDrawArrays;
|
||||||
|
PFNGLUNIFORM1UIPROC glad_glUniform1ui;
|
||||||
|
PFNGLISPROGRAMPROC glad_glIsProgram;
|
||||||
|
PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;
|
||||||
|
PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation;
|
||||||
|
PFNGLGETSYNCIVPROC glad_glGetSynciv;
|
||||||
|
PFNGLGETUNIFORMIVPROC glad_glGetUniformiv;
|
||||||
|
PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i;
|
||||||
|
PFNGLUNIFORM4IPROC glad_glUniform4i;
|
||||||
|
PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d;
|
||||||
|
PFNGLCLEARPROC glad_glClear;
|
||||||
|
PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;
|
||||||
|
PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName;
|
||||||
|
PFNGLUNIFORM2FPROC glad_glUniform2f;
|
||||||
|
PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample;
|
||||||
|
PFNGLACTIVETEXTUREPROC glad_glActiveTexture;
|
||||||
|
PFNGLBEGINQUERYPROC glad_glBeginQuery;
|
||||||
|
PFNGLUNIFORM2IVPROC glad_glUniform2iv;
|
||||||
|
PFNGLBINDBUFFERPROC glad_glBindBuffer;
|
||||||
|
PFNGLISENABLEDPROC glad_glIsEnabled;
|
||||||
|
PFNGLSTENCILOPPROC glad_glStencilOp;
|
||||||
|
PFNGLREADPIXELSPROC glad_glReadPixels;
|
||||||
|
PFNGLCLEARDEPTHPROC glad_glClearDepth;
|
||||||
|
PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv;
|
||||||
|
PFNGLUNIFORM4FPROC glad_glUniform4f;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;
|
||||||
|
PFNGLMAPBUFFERPROC glad_glMapBuffer;
|
||||||
|
PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d;
|
||||||
|
PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub;
|
||||||
|
PFNGLUNIFORM3FVPROC glad_glUniform3fv;
|
||||||
|
PFNGLGETUNIFORMFVPROC glad_glGetUniformfv;
|
||||||
|
PFNGLBUFFERDATAPROC glad_glBufferData;
|
||||||
|
PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D;
|
||||||
|
PFNGLTEXIMAGE1DPROC glad_glTexImage1D;
|
||||||
|
PFNGLDELETESYNCPROC glad_glDeleteSync;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D;
|
||||||
|
PFNGLGETERRORPROC glad_glGetError;
|
||||||
|
PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;
|
||||||
|
PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;
|
||||||
|
PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;
|
||||||
|
PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements;
|
||||||
|
PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;
|
||||||
|
PFNGLGETFLOATVPROC glad_glGetFloatv;
|
||||||
|
PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D;
|
||||||
|
PFNGLUNIFORM3IVPROC glad_glUniform3iv;
|
||||||
|
PFNGLGETTEXIMAGEPROC glad_glGetTexImage;
|
||||||
|
PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;
|
||||||
|
PFNGLUSEPROGRAMPROC glad_glUseProgram;
|
||||||
|
PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv;
|
||||||
|
PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;
|
||||||
|
PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i;
|
||||||
|
PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;
|
||||||
|
PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;
|
||||||
|
PFNGLDRAWBUFFERSPROC glad_glDrawBuffers;
|
||||||
|
PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv;
|
||||||
|
PFNGLSTENCILFUNCPROC glad_glStencilFunc;
|
||||||
|
PFNGLGETINTEGERVPROC glad_glGetIntegerv;
|
||||||
|
PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;
|
||||||
|
PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding;
|
||||||
|
PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;
|
||||||
|
PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv;
|
||||||
|
PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv;
|
||||||
|
PFNGLDRAWBUFFERPROC glad_glDrawBuffer;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D;
|
||||||
|
PFNGLUNIFORM1FVPROC glad_glUniform1fv;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample;
|
||||||
|
PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange;
|
||||||
|
PFNGLISQUERYPROC glad_glIsQuery;
|
||||||
|
PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv;
|
||||||
|
PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;
|
||||||
|
PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;
|
||||||
|
PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv;
|
||||||
|
PFNGLGETQUERYIVPROC glad_glGetQueryiv;
|
||||||
|
PFNGLTEXIMAGE2DPROC glad_glTexImage2D;
|
||||||
|
PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;
|
||||||
|
PFNGLSTENCILMASKPROC glad_glStencilMask;
|
||||||
|
PFNGLUNIFORM4UIPROC glad_glUniform4ui;
|
||||||
|
PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv;
|
||||||
|
PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;
|
||||||
|
PFNGLISTEXTUREPROC glad_glIsTexture;
|
||||||
|
PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices;
|
||||||
|
PFNGLISSHADERPROC glad_glIsShader;
|
||||||
|
PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;
|
||||||
|
PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv;
|
||||||
|
PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv;
|
||||||
|
PFNGLGETINTEGER64VPROC glad_glGetInteger64v;
|
||||||
|
PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;
|
||||||
|
PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;
|
||||||
|
PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData;
|
||||||
|
PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;
|
||||||
|
PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv;
|
||||||
|
PFNGLENABLEPROC glad_glEnable;
|
||||||
|
PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv;
|
||||||
|
PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced;
|
||||||
|
PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i;
|
||||||
|
PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;
|
||||||
|
PFNGLDELETEQUERIESPROC glad_glDeleteQueries;
|
||||||
|
PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv;
|
||||||
|
PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;
|
||||||
|
PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D;
|
||||||
|
PFNGLFINISHPROC glad_glFinish;
|
||||||
|
PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;
|
||||||
|
PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv;
|
||||||
|
PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv;
|
||||||
|
PFNGLDELETESHADERPROC glad_glDeleteShader;
|
||||||
|
PFNGLBLENDFUNCPROC glad_glBlendFunc;
|
||||||
|
PFNGLCREATEPROGRAMPROC glad_glCreateProgram;
|
||||||
|
PFNGLTEXIMAGE3DPROC glad_glTexImage3D;
|
||||||
|
PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv;
|
||||||
|
PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;
|
||||||
|
PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui;
|
||||||
|
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange;
|
||||||
|
PFNGLVIEWPORTPROC glad_glViewport;
|
||||||
|
PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv;
|
||||||
|
PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d;
|
||||||
|
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings;
|
||||||
|
PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;
|
||||||
|
PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv;
|
||||||
|
PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex;
|
||||||
|
PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex;
|
||||||
|
PFNGLUNIFORM2UIPROC glad_glUniform2ui;
|
||||||
|
PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;
|
||||||
|
PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv;
|
||||||
|
PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i;
|
||||||
|
PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s;
|
||||||
|
PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample;
|
||||||
|
PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;
|
||||||
|
PFNGLDEPTHRANGEPROC glad_glDepthRange;
|
||||||
|
PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;
|
||||||
|
PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv;
|
||||||
|
PFNGLTEXPARAMETERFPROC glad_glTexParameterf;
|
||||||
|
PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi;
|
||||||
|
PFNGLTEXPARAMETERIPROC glad_glTexParameteri;
|
||||||
|
PFNGLFRONTFACEPROC glad_glFrontFace;
|
||||||
|
PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;
|
||||||
|
PFNGLSCISSORPROC glad_glScissor;
|
||||||
|
PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex;
|
||||||
|
PFNGLGETBOOLEANVPROC glad_glGetBooleanv;
|
||||||
|
PFNGLTEXBUFFERPROC glad_glTexBuffer;
|
||||||
|
PFNGLPIXELSTOREIPROC glad_glPixelStorei;
|
||||||
|
PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;
|
||||||
|
PFNGLPIXELSTOREFPROC glad_glPixelStoref;
|
||||||
|
PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;
|
||||||
|
PFNGLUNIFORM3UIVPROC glad_glUniform3uiv;
|
||||||
|
PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;
|
||||||
|
PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer;
|
||||||
|
static void load_GL_VERSION_1_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_0) return;
|
||||||
|
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
|
||||||
|
glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace");
|
||||||
|
glad_glHint = (PFNGLHINTPROC)load("glHint");
|
||||||
|
glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth");
|
||||||
|
glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize");
|
||||||
|
glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode");
|
||||||
|
glad_glScissor = (PFNGLSCISSORPROC)load("glScissor");
|
||||||
|
glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf");
|
||||||
|
glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv");
|
||||||
|
glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri");
|
||||||
|
glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv");
|
||||||
|
glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D");
|
||||||
|
glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D");
|
||||||
|
glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer");
|
||||||
|
glad_glClear = (PFNGLCLEARPROC)load("glClear");
|
||||||
|
glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor");
|
||||||
|
glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil");
|
||||||
|
glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth");
|
||||||
|
glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask");
|
||||||
|
glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask");
|
||||||
|
glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask");
|
||||||
|
glad_glDisable = (PFNGLDISABLEPROC)load("glDisable");
|
||||||
|
glad_glEnable = (PFNGLENABLEPROC)load("glEnable");
|
||||||
|
glad_glFinish = (PFNGLFINISHPROC)load("glFinish");
|
||||||
|
glad_glFlush = (PFNGLFLUSHPROC)load("glFlush");
|
||||||
|
glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc");
|
||||||
|
glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp");
|
||||||
|
glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc");
|
||||||
|
glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp");
|
||||||
|
glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc");
|
||||||
|
glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref");
|
||||||
|
glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei");
|
||||||
|
glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer");
|
||||||
|
glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels");
|
||||||
|
glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv");
|
||||||
|
glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev");
|
||||||
|
glad_glGetError = (PFNGLGETERRORPROC)load("glGetError");
|
||||||
|
glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv");
|
||||||
|
glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv");
|
||||||
|
glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
|
||||||
|
glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage");
|
||||||
|
glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv");
|
||||||
|
glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv");
|
||||||
|
glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv");
|
||||||
|
glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv");
|
||||||
|
glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled");
|
||||||
|
glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange");
|
||||||
|
glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_1) return;
|
||||||
|
glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays");
|
||||||
|
glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements");
|
||||||
|
glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset");
|
||||||
|
glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D");
|
||||||
|
glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D");
|
||||||
|
glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D");
|
||||||
|
glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D");
|
||||||
|
glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D");
|
||||||
|
glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D");
|
||||||
|
glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture");
|
||||||
|
glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures");
|
||||||
|
glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures");
|
||||||
|
glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_2(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_2) return;
|
||||||
|
glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements");
|
||||||
|
glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D");
|
||||||
|
glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D");
|
||||||
|
glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_3(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_3) return;
|
||||||
|
glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture");
|
||||||
|
glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage");
|
||||||
|
glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D");
|
||||||
|
glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D");
|
||||||
|
glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D");
|
||||||
|
glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D");
|
||||||
|
glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D");
|
||||||
|
glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D");
|
||||||
|
glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_4(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_4) return;
|
||||||
|
glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate");
|
||||||
|
glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays");
|
||||||
|
glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements");
|
||||||
|
glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf");
|
||||||
|
glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv");
|
||||||
|
glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri");
|
||||||
|
glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv");
|
||||||
|
glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor");
|
||||||
|
glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_5(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_5) return;
|
||||||
|
glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries");
|
||||||
|
glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries");
|
||||||
|
glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery");
|
||||||
|
glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery");
|
||||||
|
glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery");
|
||||||
|
glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv");
|
||||||
|
glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv");
|
||||||
|
glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv");
|
||||||
|
glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer");
|
||||||
|
glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers");
|
||||||
|
glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers");
|
||||||
|
glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer");
|
||||||
|
glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData");
|
||||||
|
glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData");
|
||||||
|
glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData");
|
||||||
|
glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer");
|
||||||
|
glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer");
|
||||||
|
glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv");
|
||||||
|
glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_2_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_2_0) return;
|
||||||
|
glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate");
|
||||||
|
glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers");
|
||||||
|
glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate");
|
||||||
|
glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate");
|
||||||
|
glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate");
|
||||||
|
glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader");
|
||||||
|
glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation");
|
||||||
|
glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader");
|
||||||
|
glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram");
|
||||||
|
glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader");
|
||||||
|
glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram");
|
||||||
|
glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader");
|
||||||
|
glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader");
|
||||||
|
glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray");
|
||||||
|
glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray");
|
||||||
|
glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib");
|
||||||
|
glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform");
|
||||||
|
glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders");
|
||||||
|
glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation");
|
||||||
|
glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv");
|
||||||
|
glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog");
|
||||||
|
glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv");
|
||||||
|
glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog");
|
||||||
|
glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource");
|
||||||
|
glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation");
|
||||||
|
glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv");
|
||||||
|
glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv");
|
||||||
|
glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv");
|
||||||
|
glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv");
|
||||||
|
glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv");
|
||||||
|
glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv");
|
||||||
|
glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram");
|
||||||
|
glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader");
|
||||||
|
glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram");
|
||||||
|
glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource");
|
||||||
|
glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram");
|
||||||
|
glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f");
|
||||||
|
glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f");
|
||||||
|
glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f");
|
||||||
|
glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f");
|
||||||
|
glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i");
|
||||||
|
glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i");
|
||||||
|
glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i");
|
||||||
|
glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i");
|
||||||
|
glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv");
|
||||||
|
glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv");
|
||||||
|
glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv");
|
||||||
|
glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv");
|
||||||
|
glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv");
|
||||||
|
glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv");
|
||||||
|
glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv");
|
||||||
|
glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv");
|
||||||
|
glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv");
|
||||||
|
glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv");
|
||||||
|
glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv");
|
||||||
|
glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram");
|
||||||
|
glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d");
|
||||||
|
glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv");
|
||||||
|
glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f");
|
||||||
|
glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv");
|
||||||
|
glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s");
|
||||||
|
glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv");
|
||||||
|
glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d");
|
||||||
|
glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv");
|
||||||
|
glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f");
|
||||||
|
glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv");
|
||||||
|
glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s");
|
||||||
|
glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv");
|
||||||
|
glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d");
|
||||||
|
glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv");
|
||||||
|
glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f");
|
||||||
|
glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv");
|
||||||
|
glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s");
|
||||||
|
glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv");
|
||||||
|
glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv");
|
||||||
|
glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv");
|
||||||
|
glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv");
|
||||||
|
glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub");
|
||||||
|
glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv");
|
||||||
|
glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv");
|
||||||
|
glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv");
|
||||||
|
glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv");
|
||||||
|
glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d");
|
||||||
|
glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv");
|
||||||
|
glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f");
|
||||||
|
glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv");
|
||||||
|
glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv");
|
||||||
|
glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s");
|
||||||
|
glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv");
|
||||||
|
glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv");
|
||||||
|
glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv");
|
||||||
|
glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv");
|
||||||
|
glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_2_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_2_1) return;
|
||||||
|
glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv");
|
||||||
|
glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv");
|
||||||
|
glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv");
|
||||||
|
glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv");
|
||||||
|
glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv");
|
||||||
|
glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_0) return;
|
||||||
|
glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski");
|
||||||
|
glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v");
|
||||||
|
glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v");
|
||||||
|
glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei");
|
||||||
|
glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei");
|
||||||
|
glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi");
|
||||||
|
glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback");
|
||||||
|
glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback");
|
||||||
|
glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange");
|
||||||
|
glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase");
|
||||||
|
glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings");
|
||||||
|
glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying");
|
||||||
|
glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor");
|
||||||
|
glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender");
|
||||||
|
glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender");
|
||||||
|
glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer");
|
||||||
|
glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv");
|
||||||
|
glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv");
|
||||||
|
glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i");
|
||||||
|
glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i");
|
||||||
|
glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i");
|
||||||
|
glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i");
|
||||||
|
glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui");
|
||||||
|
glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui");
|
||||||
|
glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui");
|
||||||
|
glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui");
|
||||||
|
glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv");
|
||||||
|
glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv");
|
||||||
|
glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv");
|
||||||
|
glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv");
|
||||||
|
glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv");
|
||||||
|
glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv");
|
||||||
|
glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv");
|
||||||
|
glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv");
|
||||||
|
glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv");
|
||||||
|
glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv");
|
||||||
|
glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv");
|
||||||
|
glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv");
|
||||||
|
glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv");
|
||||||
|
glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation");
|
||||||
|
glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation");
|
||||||
|
glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui");
|
||||||
|
glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui");
|
||||||
|
glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui");
|
||||||
|
glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui");
|
||||||
|
glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv");
|
||||||
|
glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv");
|
||||||
|
glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv");
|
||||||
|
glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv");
|
||||||
|
glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv");
|
||||||
|
glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv");
|
||||||
|
glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv");
|
||||||
|
glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv");
|
||||||
|
glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv");
|
||||||
|
glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv");
|
||||||
|
glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv");
|
||||||
|
glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi");
|
||||||
|
glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi");
|
||||||
|
glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer");
|
||||||
|
glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer");
|
||||||
|
glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers");
|
||||||
|
glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers");
|
||||||
|
glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage");
|
||||||
|
glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv");
|
||||||
|
glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer");
|
||||||
|
glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer");
|
||||||
|
glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers");
|
||||||
|
glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers");
|
||||||
|
glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus");
|
||||||
|
glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D");
|
||||||
|
glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D");
|
||||||
|
glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D");
|
||||||
|
glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer");
|
||||||
|
glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv");
|
||||||
|
glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap");
|
||||||
|
glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer");
|
||||||
|
glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample");
|
||||||
|
glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer");
|
||||||
|
glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange");
|
||||||
|
glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange");
|
||||||
|
glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray");
|
||||||
|
glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays");
|
||||||
|
glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays");
|
||||||
|
glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_1) return;
|
||||||
|
glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced");
|
||||||
|
glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced");
|
||||||
|
glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer");
|
||||||
|
glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex");
|
||||||
|
glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData");
|
||||||
|
glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices");
|
||||||
|
glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv");
|
||||||
|
glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName");
|
||||||
|
glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex");
|
||||||
|
glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv");
|
||||||
|
glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName");
|
||||||
|
glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_2(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_2) return;
|
||||||
|
glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex");
|
||||||
|
glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex");
|
||||||
|
glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex");
|
||||||
|
glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex");
|
||||||
|
glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex");
|
||||||
|
glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync");
|
||||||
|
glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync");
|
||||||
|
glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync");
|
||||||
|
glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync");
|
||||||
|
glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync");
|
||||||
|
glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v");
|
||||||
|
glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv");
|
||||||
|
glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v");
|
||||||
|
glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v");
|
||||||
|
glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture");
|
||||||
|
glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample");
|
||||||
|
glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample");
|
||||||
|
glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv");
|
||||||
|
glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski");
|
||||||
|
}
|
||||||
|
static void find_extensionsGL(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void find_coreGL(void) {
|
||||||
|
|
||||||
|
/* Thank you @elmindreda
|
||||||
|
* https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176
|
||||||
|
* https://github.com/glfw/glfw/blob/master/src/context.c#L36
|
||||||
|
*/
|
||||||
|
int i, major, minor;
|
||||||
|
|
||||||
|
const char* version;
|
||||||
|
const char* prefixes[] = {
|
||||||
|
"OpenGL ES-CM ",
|
||||||
|
"OpenGL ES-CL ",
|
||||||
|
"OpenGL ES ",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
version = (const char*) glGetString(GL_VERSION);
|
||||||
|
if (!version) return;
|
||||||
|
|
||||||
|
for (i = 0; prefixes[i]; i++) {
|
||||||
|
const size_t length = strlen(prefixes[i]);
|
||||||
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
|
version += length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sscanf(version, "%d.%d", &major, &minor);
|
||||||
|
GLVersion.major = major; GLVersion.minor = minor;
|
||||||
|
GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
|
||||||
|
GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
|
||||||
|
GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2;
|
||||||
|
GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3;
|
||||||
|
GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3;
|
||||||
|
GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gladLoadGLLoader(GLADloadproc load) {
|
||||||
|
GLVersion.major = 0; GLVersion.minor = 0;
|
||||||
|
glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
|
||||||
|
if(glGetString == NULL) return 0;
|
||||||
|
if(glGetString(GL_VERSION) == NULL) return 0;
|
||||||
|
find_coreGL();
|
||||||
|
load_GL_VERSION_1_0(load);
|
||||||
|
load_GL_VERSION_1_1(load);
|
||||||
|
load_GL_VERSION_1_2(load);
|
||||||
|
load_GL_VERSION_1_3(load);
|
||||||
|
load_GL_VERSION_1_4(load);
|
||||||
|
load_GL_VERSION_1_5(load);
|
||||||
|
load_GL_VERSION_2_0(load);
|
||||||
|
load_GL_VERSION_2_1(load);
|
||||||
|
load_GL_VERSION_3_0(load);
|
||||||
|
load_GL_VERSION_3_1(load);
|
||||||
|
load_GL_VERSION_3_2(load);
|
||||||
|
|
||||||
|
find_extensionsGL();
|
||||||
|
return GLVersion.major != 0 || GLVersion.minor != 0;
|
||||||
|
}
|
||||||
|
|
||||||
Vendored
+1930
File diff suppressed because it is too large
Load Diff
Vendored
+1
@@ -122,6 +122,7 @@ typedef int _tthread_clockid_t;
|
|||||||
/* Emulate clock_gettime */
|
/* Emulate clock_gettime */
|
||||||
int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts);
|
int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts);
|
||||||
#define clock_gettime _tthread_clock_gettime
|
#define clock_gettime _tthread_clock_gettime
|
||||||
|
#define CLOCK_REALTIME 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-17
@@ -657,12 +657,16 @@ INPUT = @GLFW_INTERNAL_DOCS@ \
|
|||||||
@GLFW_SOURCE_DIR@/include/GLFW/glfw3native.h \
|
@GLFW_SOURCE_DIR@/include/GLFW/glfw3native.h \
|
||||||
@GLFW_SOURCE_DIR@/docs/main.dox \
|
@GLFW_SOURCE_DIR@/docs/main.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/news.dox \
|
@GLFW_SOURCE_DIR@/docs/news.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/quick.dox \
|
|
||||||
@GLFW_SOURCE_DIR@/docs/moving.dox \
|
@GLFW_SOURCE_DIR@/docs/moving.dox \
|
||||||
|
@GLFW_SOURCE_DIR@/docs/quick.dox \
|
||||||
|
@GLFW_SOURCE_DIR@/docs/compile.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/build.dox \
|
@GLFW_SOURCE_DIR@/docs/build.dox \
|
||||||
|
@GLFW_SOURCE_DIR@/docs/intro.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/context.dox \
|
@GLFW_SOURCE_DIR@/docs/context.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/monitor.dox \
|
@GLFW_SOURCE_DIR@/docs/monitor.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/window.dox \
|
@GLFW_SOURCE_DIR@/docs/window.dox \
|
||||||
|
@GLFW_SOURCE_DIR@/docs/input.dox \
|
||||||
|
@GLFW_SOURCE_DIR@/docs/rift.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/compat.dox
|
@GLFW_SOURCE_DIR@/docs/compat.dox
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
@@ -899,13 +903,13 @@ HTML_FILE_EXTENSION = .html
|
|||||||
# have to redo this when upgrading to a newer version of doxygen or when
|
# have to redo this when upgrading to a newer version of doxygen or when
|
||||||
# changing the value of configuration settings such as GENERATE_TREEVIEW!
|
# changing the value of configuration settings such as GENERATE_TREEVIEW!
|
||||||
|
|
||||||
HTML_HEADER =
|
HTML_HEADER = @GLFW_SOURCE_DIR@/docs/header.html
|
||||||
|
|
||||||
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
||||||
# each generated HTML page. If it is left blank doxygen will generate a
|
# each generated HTML page. If it is left blank doxygen will generate a
|
||||||
# standard footer.
|
# standard footer.
|
||||||
|
|
||||||
HTML_FOOTER =
|
HTML_FOOTER = @GLFW_SOURCE_DIR@/docs/footer.html
|
||||||
|
|
||||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||||
# style sheet that is used by each HTML page. It can be used to
|
# style sheet that is used by each HTML page. It can be used to
|
||||||
@@ -924,7 +928,7 @@ HTML_STYLESHEET =
|
|||||||
# robust against future updates. Doxygen will copy the style sheet file to
|
# robust against future updates. Doxygen will copy the style sheet file to
|
||||||
# the output directory.
|
# the output directory.
|
||||||
|
|
||||||
HTML_EXTRA_STYLESHEET =
|
HTML_EXTRA_STYLESHEET = @GLFW_SOURCE_DIR@/docs/extra.css
|
||||||
|
|
||||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||||
# other source files which should be copied to the HTML output directory. Note
|
# other source files which should be copied to the HTML output directory. Note
|
||||||
@@ -933,7 +937,7 @@ HTML_EXTRA_STYLESHEET =
|
|||||||
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
|
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
|
||||||
# the files will be copied as-is; there are no commands or markers available.
|
# the files will be copied as-is; there are no commands or markers available.
|
||||||
|
|
||||||
HTML_EXTRA_FILES =
|
HTML_EXTRA_FILES = @GLFW_SOURCE_DIR@/docs/spaces.svg
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
|
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
|
||||||
# Doxygen will adjust the colors in the style sheet and background images
|
# Doxygen will adjust the colors in the style sheet and background images
|
||||||
@@ -1466,18 +1470,6 @@ GENERATE_XML = NO
|
|||||||
|
|
||||||
XML_OUTPUT = xml
|
XML_OUTPUT = xml
|
||||||
|
|
||||||
# The XML_SCHEMA tag can be used to specify an XML schema,
|
|
||||||
# which can be used by a validating XML parser to check the
|
|
||||||
# syntax of the XML files.
|
|
||||||
|
|
||||||
XML_SCHEMA =
|
|
||||||
|
|
||||||
# The XML_DTD tag can be used to specify an XML DTD,
|
|
||||||
# which can be used by a validating XML parser to check the
|
|
||||||
# syntax of the XML files.
|
|
||||||
|
|
||||||
XML_DTD =
|
|
||||||
|
|
||||||
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
|
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
|
||||||
# dump the program listings (including syntax highlighting
|
# dump the program listings (including syntax highlighting
|
||||||
# and cross-referencing information) to the XML output. Note that
|
# and cross-referencing information) to the XML output. Note that
|
||||||
|
|||||||
@@ -0,0 +1,188 @@
|
|||||||
|
<doxygenlayout version="1.0">
|
||||||
|
<!-- Generated by doxygen 1.8.3.1 -->
|
||||||
|
<!-- Navigation index tabs for HTML output -->
|
||||||
|
<navindex>
|
||||||
|
<tab type="mainpage" visible="yes" title="Introduction"/>
|
||||||
|
<tab type="pages" visible="yes" title="Guides" intro=""/>
|
||||||
|
<tab type="modules" visible="yes" title="Reference" intro=""/>
|
||||||
|
<tab type="namespaces" visible="yes" title="">
|
||||||
|
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||||
|
</tab>
|
||||||
|
<tab type="classes" visible="no" title="">
|
||||||
|
<tab type="classlist" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||||
|
<tab type="hierarchy" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="classmembers" visible="yes" title="" intro=""/>
|
||||||
|
</tab>
|
||||||
|
<tab type="files" visible="yes" title="Header Files">
|
||||||
|
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="globals" visible="yes" title="" intro=""/>
|
||||||
|
</tab>
|
||||||
|
<tab type="examples" visible="yes" title="" intro=""/>
|
||||||
|
</navindex>
|
||||||
|
|
||||||
|
<!-- Layout definition for a class page -->
|
||||||
|
<class>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||||
|
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||||
|
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||||
|
<memberdecl>
|
||||||
|
<nestedclasses visible="yes" title=""/>
|
||||||
|
<publictypes title=""/>
|
||||||
|
<publicslots title=""/>
|
||||||
|
<signals title=""/>
|
||||||
|
<publicmethods title=""/>
|
||||||
|
<publicstaticmethods title=""/>
|
||||||
|
<publicattributes title=""/>
|
||||||
|
<publicstaticattributes title=""/>
|
||||||
|
<protectedtypes title=""/>
|
||||||
|
<protectedslots title=""/>
|
||||||
|
<protectedmethods title=""/>
|
||||||
|
<protectedstaticmethods title=""/>
|
||||||
|
<protectedattributes title=""/>
|
||||||
|
<protectedstaticattributes title=""/>
|
||||||
|
<packagetypes title=""/>
|
||||||
|
<packagemethods title=""/>
|
||||||
|
<packagestaticmethods title=""/>
|
||||||
|
<packageattributes title=""/>
|
||||||
|
<packagestaticattributes title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
<privatetypes title=""/>
|
||||||
|
<privateslots title=""/>
|
||||||
|
<privatemethods title=""/>
|
||||||
|
<privatestaticmethods title=""/>
|
||||||
|
<privateattributes title=""/>
|
||||||
|
<privatestaticattributes title=""/>
|
||||||
|
<friends title=""/>
|
||||||
|
<related title="" subtitle=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<constructors title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<related title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<allmemberslink visible="yes"/>
|
||||||
|
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||||
|
<authorsection visible="yes"/>
|
||||||
|
</class>
|
||||||
|
|
||||||
|
<!-- Layout definition for a namespace page -->
|
||||||
|
<namespace>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<nestednamespaces visible="yes" title=""/>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection visible="yes"/>
|
||||||
|
</namespace>
|
||||||
|
|
||||||
|
<!-- Layout definition for a file page -->
|
||||||
|
<file>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||||
|
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||||
|
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||||
|
<sourcelink visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<namespaces visible="yes" title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection/>
|
||||||
|
</file>
|
||||||
|
|
||||||
|
<!-- Layout definition for a group page -->
|
||||||
|
<group>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<detaileddescription title="Description"/>
|
||||||
|
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||||
|
<memberdecl>
|
||||||
|
<nestedgroups visible="yes" title=""/>
|
||||||
|
<dirs visible="yes" title=""/>
|
||||||
|
<files visible="yes" title=""/>
|
||||||
|
<namespaces visible="yes" title=""/>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<enumvalues title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<signals title=""/>
|
||||||
|
<publicslots title=""/>
|
||||||
|
<protectedslots title=""/>
|
||||||
|
<privateslots title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<friends title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<memberdef>
|
||||||
|
<pagedocs/>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<enumvalues title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<signals title=""/>
|
||||||
|
<publicslots title=""/>
|
||||||
|
<protectedslots title=""/>
|
||||||
|
<privateslots title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<friends title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection visible="yes"/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<!-- Layout definition for a directory page -->
|
||||||
|
<directory>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<directorygraph visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<dirs visible="yes"/>
|
||||||
|
<files visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
</directory>
|
||||||
|
</doxygenlayout>
|
||||||
+234
-87
@@ -1,161 +1,308 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
@page build Building programs using GLFW
|
@page build Building applications
|
||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
This is about compiling and linking programs that use GLFW. For information on
|
This is about compiling and linking applications that use GLFW. For information on
|
||||||
how to *write* such programs, start with the [introductory tutorial](@ref quick).
|
how to write such applications, start with the [introductory tutorial](@ref quick).
|
||||||
|
For information on how to compile the GLFW library itself, see the @ref compile
|
||||||
|
guide.
|
||||||
|
|
||||||
|
This is not a tutorial on compilation or linking. It assumes basic
|
||||||
|
understanding of how to compile and link a C program as well as how to use the
|
||||||
|
specific compiler of your chosen development environment. The compilation
|
||||||
|
and linking process should be explained in your C programming material and in
|
||||||
|
the documentation for your development environment.
|
||||||
|
|
||||||
@section build_include Including the GLFW header file
|
@section build_include Including the GLFW header file
|
||||||
|
|
||||||
In the files of your program where you use OpenGL or GLFW, you should include
|
In the source files of your application where you use OpenGL or GLFW, you should
|
||||||
the GLFW 3 header file, i.e.:
|
include the GLFW header file, i.e.:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This defines all the constants, types and function prototypes of the GLFW API.
|
The GLFW header declares the GLFW API and by default also includes the OpenGL
|
||||||
It also includes the chosen client API header files (by default OpenGL), and
|
header of your development environment, which in turn defines all the constants,
|
||||||
defines all the constants and types necessary for those headers to work on that
|
types and function prototypes of the OpenGL API.
|
||||||
platform.
|
|
||||||
|
|
||||||
For example, under Windows you are normally required to include `windows.h`
|
The GLFW header also defines everything necessary for your OpenGL header to
|
||||||
before including `GL/gl.h`. This would make your source file tied to Windows
|
function. For example, under Windows you are normally required to include
|
||||||
and pollute your code's namespace with the whole Win32 API.
|
`windows.h` before the OpenGL header, which would pollute your code namespace
|
||||||
|
with the entire Win32 API.
|
||||||
|
|
||||||
Instead, the GLFW header takes care of this for you, not by including
|
Instead, the GLFW header takes care of this for you, not by including
|
||||||
`windows.h`, but rather by itself duplicating only the necessary parts of it.
|
`windows.h`, but by duplicating only the very few necessary parts of it. It
|
||||||
It does this only where needed, so if `windows.h` *is* included, the GLFW header
|
does this only when needed, so if `windows.h` _is_ included, the GLFW header
|
||||||
does not try to redefine those symbols.
|
does not try to redefine those symbols. The reverse is not true, i.e.
|
||||||
|
`windows.h` cannot cope if any of its symbols have already been defined.
|
||||||
|
|
||||||
In other words:
|
In other words:
|
||||||
|
|
||||||
- Do *not* include the OpenGL headers yourself, as GLFW does this for you
|
- Do _not_ include the OpenGL headers yourself, as GLFW does this for you
|
||||||
- Do *not* include `windows.h` or other platform-specific headers unless you
|
- Do _not_ include `windows.h` or other platform-specific headers unless you
|
||||||
plan on using those APIs directly
|
plan on using those APIs directly
|
||||||
- If you *do* need to include such headers, do it *before* including
|
- If you _do_ need to include such headers, do it _before_ including
|
||||||
the GLFW one and it will detect this
|
the GLFW header and it will handle this
|
||||||
|
|
||||||
If you are using an OpenGL extension loading library such as
|
If you are using an OpenGL extension loading library such as
|
||||||
[GLEW](http://glew.sourceforge.net/), the GLEW header should also be included
|
[glad](https://github.com/Dav1dde/glad), the extension loader header should
|
||||||
*before* the GLFW one. The GLEW header defines macros that disable any OpenGL
|
either be included _before_ the GLFW one, or the `GLFW_INCLUDE_NONE` macro
|
||||||
header that the GLFW header includes and GLEW will work as expected.
|
(described below) should be defined.
|
||||||
|
|
||||||
|
|
||||||
@subsection build_macros GLFW header option macros
|
@subsection build_macros GLFW header option macros
|
||||||
|
|
||||||
These macros may be defined before the inclusion of the GLFW header and affect
|
These macros may be defined before the inclusion of the GLFW header and affect
|
||||||
how that header behaves.
|
its behavior.
|
||||||
|
|
||||||
`GLFW_INCLUDE_GLCOREARB` makes the header include the modern `GL/glcorearb.h`
|
`GLFW_DLL` is required on Windows when using the GLFW DLL, to tell the compiler
|
||||||
header (`OpenGL/gl3.h` on Mac OS X) instead of the regular OpenGL header.
|
that the GLFW functions are defined in a DLL.
|
||||||
|
|
||||||
`GLFW_INCLUDE_ES1` makes the header include the OpenGL ES 1.x `GLES/gl.h` header
|
The following macros control which OpenGL or OpenGL ES API header is included.
|
||||||
instead of the regular OpenGL header.
|
Only one of these may be defined at a time.
|
||||||
|
|
||||||
`GLFW_INCLUDE_ES2` makes the header include the OpenGL ES 2.0 `GLES2/gl2.h`
|
`GLFW_INCLUDE_GLCOREARB` makes the GLFW header include the modern
|
||||||
|
`GL/glcorearb.h` header (`OpenGL/gl3.h` on OS X) instead of the regular OpenGL
|
||||||
|
header.
|
||||||
|
|
||||||
|
`GLFW_INCLUDE_ES1` makes the GLFW header include the OpenGL ES 1.x `GLES/gl.h`
|
||||||
header instead of the regular OpenGL header.
|
header instead of the regular OpenGL header.
|
||||||
|
|
||||||
`GLFW_INCLUDE_ES3` makes the header include the OpenGL ES 3.0 `GLES3/gl3.h`
|
`GLFW_INCLUDE_ES2` makes the GLFW header include the OpenGL ES 2.0 `GLES2/gl2.h`
|
||||||
header instead of the regular OpenGL header.
|
header instead of the regular OpenGL header.
|
||||||
|
|
||||||
`GLFW_INCLUDE_NONE` makes the header not include any client API header.
|
`GLFW_INCLUDE_ES3` makes the GLFW header include the OpenGL ES 3.0 `GLES3/gl3.h`
|
||||||
|
header instead of the regular OpenGL header.
|
||||||
|
|
||||||
`GLFW_INCLUDE_GLU` makes the header include the GLU header. This only makes
|
`GLFW_INCLUDE_ES31` makes the GLFW header include the OpenGL ES 3.1 `GLES3/gl31.h`
|
||||||
sense if you are using OpenGL.
|
header instead of the regular OpenGL header.
|
||||||
|
|
||||||
`GLFW_DLL` is necessary when using the GLFW DLL on Windows, in order to explain
|
`GLFW_INCLUDE_NONE` makes the GLFW header not include any OpenGL or OpenGL ES API
|
||||||
to the compiler that the GLFW functions will be coming from another executable.
|
header. This is useful in combination with an extension loading library.
|
||||||
|
|
||||||
|
If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h`
|
||||||
|
header (`OpenGL/gl.h` on OS X) is included.
|
||||||
|
|
||||||
|
The following macros control the inclusion of additional API headers. Any
|
||||||
|
number of these may be defined simultaneously, and/or together with one of the
|
||||||
|
above macros.
|
||||||
|
|
||||||
|
`GLFW_INCLUDE_GLEXT` makes the GLFW header include the appropriate extension
|
||||||
|
header for the OpenGL or OpenGL ES header selected above after and in addition
|
||||||
|
to that header.
|
||||||
|
|
||||||
|
`GLFW_INCLUDE_GLU` makes the header include the GLU header in addition to the
|
||||||
|
header selected above. This should only be used with the standard OpenGL header
|
||||||
|
and only for legacy code. GLU has been deprecated and should not be used in new
|
||||||
|
code.
|
||||||
|
|
||||||
|
@note GLFW does not provide any of the API headers mentioned above. They must
|
||||||
|
be provided by your development environment or your OpenGL or OpenGL ES SDK.
|
||||||
|
|
||||||
|
@note None of these macros may be defined during the compilation of GLFW itself.
|
||||||
|
If your build includes GLFW and you define any these in your build files, make
|
||||||
|
sure they are not applied to the GLFW sources.
|
||||||
|
|
||||||
|
|
||||||
@section build_link Link with the right libraries
|
@section build_link Link with the right libraries
|
||||||
|
|
||||||
@subsection build_link_cmake Using GLFW from CMake
|
GLFW is essentially a wrapper of various platform-specific APIs and therefore
|
||||||
|
needs to link against many different system libraries. If you are using GLFW as
|
||||||
|
a shared library / dynamic library / DLL then it takes care of these links.
|
||||||
|
However, if you are using GLFW as a static library then your executable will
|
||||||
|
need to link against these libraries.
|
||||||
|
|
||||||
The `GLFW_LIBRARIES` cache variable contains all link-time dependencies of GLFW
|
On Windows and OS X, the list of system libraries is static and can be
|
||||||
as it is currently configured, so to link against GLFW simply do:
|
hard-coded into your build environment. See the section for your development
|
||||||
|
environment below. On Linux and other Unix-like operating systems, the list
|
||||||
|
varies but can be retrieved in various ways as described below.
|
||||||
|
|
||||||
target_link_libraries(myapp glfw ${GLFW_LIBRARIES})
|
A good general introduction to linking is
|
||||||
|
[Beginner's Guide to Linkers](http://www.lurklurk.org/linkers/linkers.html) by
|
||||||
Note that this does not include GLU, as GLFW does not use it. If your
|
David Drysdale.
|
||||||
application needs GLU, you can add it to the list of dependencies with the
|
|
||||||
`OPENGL_glu_LIBRARY` cache variable.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_win32 Windows
|
@subsection build_link_win32 With MinGW or Visual C++ on Windows
|
||||||
|
|
||||||
The static version of the GLFW library is named `glfw3`. When using this
|
The static version of the GLFW library is named `glfw3`. When using this
|
||||||
version, it is also necessary to link with some libraries that GLFW uses.
|
version, it is also necessary to link with some libraries that GLFW uses.
|
||||||
|
|
||||||
When linking a program under Windows that uses the static version of GLFW, you
|
When linking an application under Windows that uses the static version of GLFW,
|
||||||
must link with `opengl32`. If you are using GLU, you must also link with
|
you must link with `opengl32`. On some versions of MinGW, you must also
|
||||||
`glu32`.
|
explicitly link with `gdi32`, while other versions of MinGW include it in the
|
||||||
|
set of default libraries along with other dependencies like `user32` and
|
||||||
|
`kernel32`. If you are using GLU, you must also link with `glu32`.
|
||||||
|
|
||||||
The link library for the GLFW DLL is named `glfw3dll`. When compiling a program
|
The link library for the GLFW DLL is named `glfw3dll`. When compiling an
|
||||||
that uses the DLL version of GLFW, you need to define the `GLFW_DLL` macro
|
application that uses the DLL version of GLFW, you need to define the `GLFW_DLL`
|
||||||
*before* any inclusion of the GLFW header. This can be done either with
|
macro _before_ any inclusion of the GLFW header. This can be done either with
|
||||||
a compiler switch or by defining it in your source code.
|
a compiler switch or by defining it in your source code.
|
||||||
|
|
||||||
A program using the GLFW DLL does not need to link against any of its
|
An application using the GLFW DLL does not need to link against any of its
|
||||||
dependencies, but you still have to link against `opengl32` if your program uses
|
dependencies, but you still have to link against `opengl32` if your application
|
||||||
OpenGL and `glu32` if it uses GLU.
|
uses OpenGL and `glu32` if it uses GLU.
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_unix Unix with X11
|
@subsection build_link_cmake_source With CMake and GLFW source
|
||||||
|
|
||||||
|
With just a few changes to your `CMakeLists.txt` you can have the GLFW source
|
||||||
|
tree built along with your application.
|
||||||
|
|
||||||
|
Firstly, add the root directory of the GLFW source tree to your project. This
|
||||||
|
will add the `glfw` target and the necessary cache variables to your project.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
add_subdirectory(path/to/glfw)
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
To be able to include the GLFW header from your code, you need to tell the
|
||||||
|
compiler where to find it.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
include_directories(path/to/glfw/include)
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Once GLFW has been added to the project, the `GLFW_LIBRARIES` cache variable
|
||||||
|
contains all link-time dependencies of GLFW as it is currently configured. To
|
||||||
|
link against GLFW, link against them and the `glfw` target.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
target_link_libraries(myapp glfw ${GLFW_LIBRARIES})
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Note that `GLFW_LIBRARIES` does not include GLU, as GLFW does not use it. If
|
||||||
|
your application needs GLU, you can add it to the list of dependencies with the
|
||||||
|
`OPENGL_glu_LIBRARY` cache variable, which is implicitly created when the GLFW
|
||||||
|
CMake files look for OpenGL.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
target_link_libraries(myapp glfw ${OPENGL_glu_LIBRARY} ${GLFW_LIBRARIES})
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection build_link_cmake_pkgconfig With CMake on Unix and installed GLFW binaries
|
||||||
|
|
||||||
|
CMake can import settings from pkg-config, which GLFW supports. When you
|
||||||
|
installed GLFW, the pkg-config file `glfw3.pc` was installed along with it.
|
||||||
|
|
||||||
|
First you need to find the PkgConfig package. If this fails, you may need to
|
||||||
|
install the pkg-config package for your distribution.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This creates the CMake commands to find pkg-config packages. Then you need to
|
||||||
|
find the GLFW package.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
pkg_search_module(GLFW REQUIRED glfw3)
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This creates the CMake variables you need to use GLFW. To be able to include
|
||||||
|
the GLFW header, you need to tell your compiler where it is.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
include_directories(${GLFW_INCLUDE_DIRS})
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
You also need to link against the correct libraries. If you are using the
|
||||||
|
shared library version of GLFW, use the `GLFW_LIBRARIES` variable.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
target_link_libraries(simple ${GLFW_LIBRARIES})
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you are using the static library version of GLFW, use the
|
||||||
|
`GLFW_STATIC_LIBRARIES` variable instead.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
target_link_libraries(simple ${GLFW_STATIC_LIBRARIES})
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection build_link_pkgconfig With pkg-config on OS X or other Unix
|
||||||
|
|
||||||
GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/),
|
GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/),
|
||||||
and `glfw3.pc` file is generated when the library is built and installed along
|
and the `glfw3.pc` pkf-config file is generated when the GLFW library is built
|
||||||
with it. You can use it without installation using the `PKG_CONFIG_PATH`
|
and is installed along with it. A pkg-config file describes all necessary
|
||||||
environment variable. See the documentation for pkg-config for more details.
|
compile-time and link-time flags and dependencies needed to use a library. When
|
||||||
|
they are updated or if they differ between systems, you will get the correct
|
||||||
|
ones automatically.
|
||||||
|
|
||||||
A typical compile and link command-line when using the static may look like this:
|
A typical compile and link command-line when using the static version of the
|
||||||
|
GLFW library may look like this:
|
||||||
|
|
||||||
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3`
|
@code{.sh}
|
||||||
|
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3`
|
||||||
|
@endcode
|
||||||
|
|
||||||
If you are using the shared library, simply omit the `--static` flag.
|
If you are using the shared version of the GLFW library, simply omit the
|
||||||
|
`--static` flag.
|
||||||
|
|
||||||
If you are using GLU, you should also add `-lGLU` to your link flags.
|
@code{.sh}
|
||||||
|
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --libs glfw3`
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
You can also use the `glfw3.pc` file without installing it first, by using the
|
||||||
|
`PKG_CONFIG_PATH` environment variable.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
env PKG_CONFIG_PATH=path/to/glfw/src cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --libs glfw3`
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The dependencies do not include GLU, as GLFW does not need it. On OS X, GLU is
|
||||||
|
built into the OpenGL framework, so if you need GLU you don't need to do
|
||||||
|
anything extra. If you need GLU and are using Linux or BSD, you should add the
|
||||||
|
`glu` pkg-config module.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cc `pkg-config --cflags glfw3 glu` -o myprog myprog.c `pkg-config --libs glfw3 glu`
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you are using the static version of the GLFW library, make sure you don't link statically against GLU.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cc `pkg-config --cflags glfw3 glu` -o myprog myprog.c `pkg-config --static --libs glfw3` `pkg-config --libs glu`
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_osx Mac OS X
|
@subsection build_link_xcode With Xcode on OS X
|
||||||
|
|
||||||
GLFW on Mac OS X uses the Cocoa, OpenGL and IOKit frameworks.
|
If you are using the dynamic library version of GLFW, simply add it to the
|
||||||
|
project dependencies.
|
||||||
|
|
||||||
If you are using Xcode, you can simply add the GLFW library and these frameworks
|
If you are using the static library version of GLFW, add it and the Cocoa,
|
||||||
as dependencies.
|
OpenGL, IOKit and CoreVideo frameworks to the project as dependencies. They can
|
||||||
|
all be found in `/System/Library/Frameworks`.
|
||||||
|
|
||||||
If you are building from the
|
|
||||||
command-line, it is recommended that you use pkg-config
|
|
||||||
|
|
||||||
GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/),
|
@subsection build_link_osx With command-line on OS X
|
||||||
and `glfw3.pc` file is generated when the library is built and installed along
|
|
||||||
with it. You can use it without installation using the `PKG_CONFIG_PATH`
|
|
||||||
environment variable. See the documentation for pkg-config for more details.
|
|
||||||
|
|
||||||
You can find pkg-config in most package systems such as
|
It is recommended that you use [pkg-config](@ref build_link_pkgconfig) when
|
||||||
[Fink](http://www.finkproject.org/) and [MacPorts](http://www.macports.org/), so
|
building from the command line on OS X. That way you will get any new
|
||||||
if you have one of them installed, simply install pkg-config. Once you have
|
dependencies added automatically. If you still wish to build manually, you need
|
||||||
pkg-config available, the command-line for compiling and linking your
|
to add the required frameworks and libraries to your command-line yourself using
|
||||||
program is:
|
the `-l` and `-framework` switches.
|
||||||
|
|
||||||
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3`
|
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
||||||
|
|
||||||
If you do not wish to use pkg-config, you need to add the required frameworks
|
@code{.sh}
|
||||||
and libraries to your command-line using the `-l` and `-framework` switches,
|
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
|
||||||
i.e.:
|
@endcode
|
||||||
|
|
||||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
|
If you are using the static library, named `libglfw3.a`, substitute `-lglfw3`
|
||||||
|
for `-lglfw`.
|
||||||
|
|
||||||
Note that you do not add the `.framework` extension to a framework when adding
|
Note that you do not add the `.framework` extension to a framework when linking
|
||||||
it from the command-line.
|
against it from the command-line.
|
||||||
|
|
||||||
The OpenGL framework contains both the OpenGL and GLU APIs, so there is no need
|
The OpenGL framework contains both the OpenGL and GLU APIs, so there is nothing
|
||||||
to add additional libraries or frameworks when using GLU. Also note that even
|
special to do when using GLU. Also note that even though your machine may have
|
||||||
though your machine may have `libGL`-style OpenGL libraries, they are for use
|
`libGL`-style OpenGL libraries, they are for use with the X Window System and
|
||||||
with the X Window System and will *not* work with the Mac OS X native version of
|
will _not_ work with the OS X native version of GLFW.
|
||||||
GLFW.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
+85
-41
@@ -4,19 +4,20 @@
|
|||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
This chapter describes the various API extensions used by this version of GLFW.
|
This guide describes the various API extensions used by this version of GLFW.
|
||||||
It lists what are essentially implementation details, but which are nonetheless
|
It lists what are essentially implementation details, but which are nonetheless
|
||||||
vital knowledge for developers wishing to deploy their applications on machines
|
vital knowledge for developers intending to deploy their applications on a wide
|
||||||
with varied specifications.
|
range of machines.
|
||||||
|
|
||||||
Note that the information in this appendix is not a part of the API
|
The information in this guide is not a part of GLFW API, but merely
|
||||||
specification but merely list some of the preconditions for certain parts of the
|
preconditions for some parts of the library to function on a given machine. Any
|
||||||
API to function on a given machine. As such, any part of it may change in
|
part of this information may change in future versions of GLFW and that will not
|
||||||
future versions without this being considered a breaking API change.
|
be considered a breaking API change.
|
||||||
|
|
||||||
@section compat_wm ICCCM and EWMH conformance
|
|
||||||
|
|
||||||
As GLFW uses Xlib, directly, without any intervening toolkit
|
@section compat_x11 X11 extensions, protocols and IPC standards
|
||||||
|
|
||||||
|
As GLFW uses Xlib directly, without any intervening toolkit
|
||||||
library, it has sole responsibility for interacting well with the many and
|
library, it has sole responsibility for interacting well with the many and
|
||||||
varied window managers in use on Unix-like systems. In order for applications
|
varied window managers in use on Unix-like systems. In order for applications
|
||||||
and window managers to work well together, a number of standards and
|
and window managers to work well together, a number of standards and
|
||||||
@@ -27,6 +28,10 @@ X11 API; most importantly the
|
|||||||
[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
|
[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
|
||||||
(EWMH) standards.
|
(EWMH) standards.
|
||||||
|
|
||||||
|
GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows.
|
||||||
|
If the running window manager does not support this property, the
|
||||||
|
`GLFW_DECORATED` hint will have no effect.
|
||||||
|
|
||||||
GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
|
GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
|
||||||
attempting to close the GLFW window. If the running window manager does not
|
attempting to close the GLFW window. If the running window manager does not
|
||||||
support this protocol, the close callback will never be called.
|
support this protocol, the close callback will never be called.
|
||||||
@@ -36,11 +41,16 @@ the user when the application has stopped responding, i.e. when it has ceased to
|
|||||||
process events. If the running window manager does not support this protocol,
|
process events. If the running window manager does not support this protocol,
|
||||||
the user will not be notified if the application locks up.
|
the user will not be notified if the application locks up.
|
||||||
|
|
||||||
GLFW uses the EWMH `_NET_WM_STATE` protocol to tell the window manager to make
|
GLFW uses the EWMH `_NET_WM_STATE_FULLSCREEN` window state to tell the window
|
||||||
the GLFW window full screen. If the running window manager does not support this
|
manager to make the GLFW window full screen. If the running window manager does
|
||||||
protocol, full screen windows may not work properly. GLFW has a fallback code
|
not support this state, full screen windows may not work properly. GLFW has
|
||||||
path in case this protocol is unavailable, but every window manager behaves
|
a fallback code path in case this state is unavailable, but every window manager
|
||||||
slightly differently in this regard.
|
behaves slightly differently in this regard.
|
||||||
|
|
||||||
|
GLFW uses the EWMH `_NET_WM_BYPASS_COMPOSITOR` window property to tell a
|
||||||
|
compositing window manager to un-redirect full screen GLFW windows. If the
|
||||||
|
running window manager uses compositing but does not support this property then
|
||||||
|
additional copying may be performed for each buffer swap of full screen windows.
|
||||||
|
|
||||||
GLFW uses the
|
GLFW uses the
|
||||||
[clipboard manager protocol](http://www.freedesktop.org/wiki/ClipboardManager/)
|
[clipboard manager protocol](http://www.freedesktop.org/wiki/ClipboardManager/)
|
||||||
@@ -48,19 +58,40 @@ to push a clipboard string (i.e. selection) owned by a GLFW window about to be
|
|||||||
destroyed to the clipboard manager. If there is no running clipboard manager,
|
destroyed to the clipboard manager. If there is no running clipboard manager,
|
||||||
the clipboard string will be unavailable once the window has been destroyed.
|
the clipboard string will be unavailable once the window has been destroyed.
|
||||||
|
|
||||||
|
GLFW uses the
|
||||||
|
[X drag-and-drop protocol](http://www.freedesktop.org/wiki/Specifications/XDND/)
|
||||||
|
to provide file drop events. If the application originating the drag does not
|
||||||
|
support this protocol, drag and drop will not work.
|
||||||
|
|
||||||
|
GLFW uses the XInput 2 extension to provide sub-pixel cursor motion events. If
|
||||||
|
the running X server does not support this version of this extension, cursor
|
||||||
|
motion will be snapped to the pixel grid.
|
||||||
|
|
||||||
|
GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the
|
||||||
|
running X server does not support this version of this extension, multi-monitor
|
||||||
|
support will not function and only a single, desktop-spanning monitor will be
|
||||||
|
reported.
|
||||||
|
|
||||||
|
GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp
|
||||||
|
support. If the running X server does not support either or both of these
|
||||||
|
extensions, gamma ramp support will not function.
|
||||||
|
|
||||||
|
GLFW uses the Xkb extension and detectable auto-repeat to provide keyboard
|
||||||
|
input. If the running X server does not support this extension, a non-Xkb
|
||||||
|
fallback path is used.
|
||||||
|
|
||||||
|
|
||||||
@section compat_glx GLX extensions
|
@section compat_glx GLX extensions
|
||||||
|
|
||||||
The GLX API is the default API used to create OpenGL contexts on Unix-like
|
The GLX API is the default API used to create OpenGL contexts on Unix-like
|
||||||
systems using the X Window System.
|
systems using the X Window System.
|
||||||
|
|
||||||
GLFW uses the `GLXFBConfig` API to enumerate and select framebuffer pixel
|
GLFW uses the GLX 1.3 `GLXFBConfig` functions to enumerate and select framebuffer pixel
|
||||||
formats. This requires either GLX 1.3 or greater, or the `GLX_SGIX_fbconfig`
|
formats. If GLX 1.3 is not supported, @ref glfwInit will fail.
|
||||||
extension. Where both are available, the SGIX extension is preferred. If
|
|
||||||
neither is available, GLFW will be unable to create windows.
|
|
||||||
|
|
||||||
GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
|
GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
|
||||||
`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
|
`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
|
||||||
(or "vsync"), in that order of preference. Where none of these extension are
|
(or _vsync_), in that order of preference. Where none of these extension are
|
||||||
available, calling @ref glfwSwapInterval will have no effect.
|
available, calling @ref glfwSwapInterval will have no effect.
|
||||||
|
|
||||||
GLFW uses the `GLX_ARB_multisample` extension to create contexts with
|
GLFW uses the `GLX_ARB_multisample` extension to create contexts with
|
||||||
@@ -72,13 +103,19 @@ creating OpenGL contexts of version 2.1 and below. Where this extension is
|
|||||||
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
|
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
|
||||||
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
||||||
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
|
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
|
||||||
`GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value will cause @ref
|
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GL_TRUE` will cause @ref
|
||||||
glfwCreateWindow to fail.
|
glfwCreateWindow to fail.
|
||||||
|
|
||||||
GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
|
GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
|
||||||
context profiles. Where this extension is unavailable, setting the
|
context profiles. Where this extension is unavailable, setting the
|
||||||
`GLFW_OPENGL_PROFILE` hint to anything but zero, or setting `GLFW_CLIENT_API` to
|
`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE`, or setting
|
||||||
anything but `GLFW_OPENGL_API` will cause @ref glfwCreateWindow to fail.
|
`GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` will cause @ref
|
||||||
|
glfwCreateWindow to fail.
|
||||||
|
|
||||||
|
GLFW uses the `GLX_ARB_context_flush_control` extension to provide control over
|
||||||
|
whether a context is flushed when it is released (made non-current). Where this
|
||||||
|
extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
|
||||||
|
effect and the context will always be flushed when released.
|
||||||
|
|
||||||
@section compat_wgl WGL extensions
|
@section compat_wgl WGL extensions
|
||||||
|
|
||||||
@@ -92,7 +129,7 @@ neither is available, no other extensions are used and many GLFW features
|
|||||||
related to context creation will have no effect or cause errors when used.
|
related to context creation will have no effect or cause errors when used.
|
||||||
|
|
||||||
GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace
|
GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace
|
||||||
synchronization (or 'vsync'). Where this extension is unavailable, calling @ref
|
synchronization (or _vsync_). Where this extension is unavailable, calling @ref
|
||||||
glfwSwapInterval will have no effect.
|
glfwSwapInterval will have no effect.
|
||||||
|
|
||||||
GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to
|
GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to
|
||||||
@@ -104,32 +141,39 @@ creating OpenGL contexts of version 2.1 and below. Where this extension is
|
|||||||
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
|
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
|
||||||
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
||||||
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
|
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
|
||||||
`GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value will cause @ref
|
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GL_TRUE` will cause @ref
|
||||||
glfwCreateWindow to fail.
|
glfwCreateWindow to fail.
|
||||||
|
|
||||||
GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
|
GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
|
||||||
context profiles. Where this extension is unavailable, setting the
|
context profiles. Where this extension is unavailable, setting the
|
||||||
`GLFW_OPENGL_PROFILE` hint to anything but zero will cause @ref glfwCreateWindow
|
`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE` will cause
|
||||||
to fail.
|
@ref glfwCreateWindow to fail.
|
||||||
|
|
||||||
@section cmopat_osx OpenGL 3.2 on Mac OS X
|
GLFW uses the `WGL_ARB_context_flush_control` extension to provide control over
|
||||||
|
whether a context is flushed when it is released (made non-current). Where this
|
||||||
|
extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
|
||||||
|
effect and the context will always be flushed when released.
|
||||||
|
|
||||||
Support for OpenGL 3.0 and above was introduced with Mac OS X 10.7, and even
|
@section compat_osx OpenGL 3.2 and later on OS X
|
||||||
then only forward-compatible OpenGL 3.2 core profile contexts are supported.
|
|
||||||
There is also still no mechanism for requesting debug contexts. Versions of
|
|
||||||
Mac OS X earlier than 10.7 support at most OpenGL version 2.1.
|
|
||||||
|
|
||||||
Because of this, on Mac OS X 10.7, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then
|
||||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 3.2, the
|
only forward-compatible, core profile contexts are supported. Support for
|
||||||
`GLFW_OPENGL_FORWARD_COMPAT` is required for creating OpenGL 3.2 contexts, the
|
OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible,
|
||||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored and setting the
|
core profile contexts. There is also still no mechanism for requesting debug
|
||||||
`GLFW_OPENGL_PROFILE` hint to anything except `GLFW_OPENGL_CORE_PROFILE` will
|
contexts. Versions of Mac OS X earlier than 10.7 support at most OpenGL
|
||||||
cause @ref glfwCreateWindow to fail.
|
version 2.1.
|
||||||
|
|
||||||
|
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||||
|
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
|
||||||
|
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
|
||||||
|
`GL_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
|
||||||
|
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts and the
|
||||||
|
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
|
||||||
|
|
||||||
Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, the
|
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1,
|
||||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the
|
setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to
|
||||||
`GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value
|
a non-default value will cause @ref glfwCreateWindow to fail and the
|
||||||
will cause @ref glfwCreateWindow to fail.
|
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,324 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
@page compile Compiling GLFW
|
||||||
|
|
||||||
|
@tableofcontents
|
||||||
|
|
||||||
|
This is about compiling the GLFW library itself. For information on how to
|
||||||
|
build applications that use GLFW, see the @ref build guide.
|
||||||
|
|
||||||
|
|
||||||
|
@section compile_cmake Using CMake
|
||||||
|
|
||||||
|
GLFW uses [CMake](http://www.cmake.org/) to generate project files or makefiles
|
||||||
|
for a particular development environment. If you are on a Unix-like system such
|
||||||
|
as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or
|
||||||
|
Homebrew, you can simply install its CMake package. If not, you can download
|
||||||
|
installers for Windows and OS X from the [CMake website](http://www.cmake.org/).
|
||||||
|
|
||||||
|
@note CMake only generates project files or makefiles. It does not compile the
|
||||||
|
actual GLFW library. To compile GLFW, first generate these files and then use
|
||||||
|
them in your chosen development environment to compile the actual GLFW library.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compile_deps Dependencies
|
||||||
|
|
||||||
|
Once you have installed CMake, make sure that all other dependencies are
|
||||||
|
available. On some platforms, GLFW needs a few additional packages to be
|
||||||
|
installed. See the section for your chosen platform and development environment
|
||||||
|
below.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_deps_msvc Dependencies for Visual C++ on Windows
|
||||||
|
|
||||||
|
The Microsoft Platform SDK that is installed along with Visual C++ already
|
||||||
|
contains all the necessary headers, link libraries and tools except for CMake.
|
||||||
|
Move on to @ref compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_deps_mingw Dependencies for MinGW or MinGW-w64 on Windows
|
||||||
|
|
||||||
|
Both the MinGW and the MinGW-w64 packages already contain all the necessary
|
||||||
|
headers, link libraries and tools except for CMake. Move on to @ref
|
||||||
|
compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_deps_mingw_cross Dependencies for MinGW or MinGW-w64 cross-compilation
|
||||||
|
|
||||||
|
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
|
||||||
|
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
|
||||||
|
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
|
||||||
|
like Ubuntu have the `mingw-w64` package for both.
|
||||||
|
|
||||||
|
GLFW has CMake toolchain files in the `CMake/` directory that allow for easy
|
||||||
|
cross-compilation of Windows binaries. To use these files you need to add a
|
||||||
|
special parameter when generating the project files or makefiles:
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The exact toolchain file to use depends on the prefix used by the MinGW or
|
||||||
|
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
||||||
|
directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages
|
||||||
|
have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct
|
||||||
|
invocation would be:
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
For more details see the article
|
||||||
|
[CMake Cross Compiling](http://www.paraview.org/Wiki/CMake_Cross_Compiling) on
|
||||||
|
the CMake wiki.
|
||||||
|
|
||||||
|
Once you have this set up, move on to @ref compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_deps_xcode Dependencies for Xcode on OS X
|
||||||
|
|
||||||
|
Xcode comes with all necessary tools except for CMake. The required headers
|
||||||
|
and libraries are included in the core OS X frameworks. Xcode can be downloaded
|
||||||
|
from the Mac App Store or from the ADC Member Center.
|
||||||
|
|
||||||
|
Once you have Xcode installed, move on to @ref compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_deps_x11 Dependencies for Linux and X11
|
||||||
|
|
||||||
|
To compile GLFW for X11, you need to have the X11 and OpenGL header packages
|
||||||
|
installed, as well as the basic development tools like GCC and make. For
|
||||||
|
example, on Ubuntu and other distributions based on Debian GNU/Linux, you need
|
||||||
|
to install the `xorg-dev` and `libglu1-mesa-dev` packages. The former pulls in
|
||||||
|
all X.org header packages and the latter pulls in the Mesa OpenGL and GLU
|
||||||
|
packages. GLFW itself doesn't need or use GLU, but some of the examples do.
|
||||||
|
Note that using header files and libraries from Mesa during compilation
|
||||||
|
_will not_ tie your binaries to the Mesa implementation of OpenGL.
|
||||||
|
|
||||||
|
Once you have installed the necessary packages, move on to @ref
|
||||||
|
compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compile_generate Generating build files with CMake
|
||||||
|
|
||||||
|
Once you have all necessary dependencies it is time to generate the project
|
||||||
|
files or makefiles for your development environment. CMake needs to know two
|
||||||
|
paths for this: the path to the _root_ directory of the GLFW source tree (i.e.
|
||||||
|
_not_ the `src` subdirectory) and the target path for the generated files and
|
||||||
|
compiled binaries. If these are the same, it is called an in-tree build,
|
||||||
|
otherwise it is called an out-of-tree build.
|
||||||
|
|
||||||
|
One of several advantages of out-of-tree builds is that you can generate files
|
||||||
|
and compile for different development environments using a single source tree.
|
||||||
|
|
||||||
|
@note This section is about generating the project files or makefiles necessary
|
||||||
|
to compile the GLFW library, not about compiling the actual library.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_generate_cli Generating files with the CMake command-line tool
|
||||||
|
|
||||||
|
To make an in-tree build, enter the _root_ directory of the GLFW source tree
|
||||||
|
(i.e. _not_ the `src` subdirectory) and run CMake. The current directory is
|
||||||
|
used as target path, while the path provided as an argument is used to find the
|
||||||
|
source tree.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cd <glfw-root-dir>
|
||||||
|
cmake .
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
To make an out-of-tree build, make another directory, enter it and run CMake
|
||||||
|
with the (relative or absolute) path to the root of the source tree as an
|
||||||
|
argument.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cd <glfw-root-dir>
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Once you have generated the project files or makefiles for your chosen
|
||||||
|
development environment, move on to @ref compile_compile.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_generate_gui Generating files with the CMake GUI
|
||||||
|
|
||||||
|
If you are using the GUI version, choose the root of the GLFW source tree as
|
||||||
|
source location and the same directory or another, empty directory as the
|
||||||
|
destination for binaries. Choose _Configure_, change any options you wish to,
|
||||||
|
_Configure_ again to let the changes take effect and then _Generate_.
|
||||||
|
|
||||||
|
Once you have generated the project files or makefiles for your chosen
|
||||||
|
development environment, move on to @ref compile_compile.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compile_compile Compiling the library
|
||||||
|
|
||||||
|
You should now have all required dependencies and the project files or makefiles
|
||||||
|
necessary to compile GLFW. Go ahead and compile the actual GLFW library with
|
||||||
|
these files, as you would with any other project.
|
||||||
|
|
||||||
|
Once the GLFW library is compiled, you are ready to build your applications,
|
||||||
|
linking it to the GLFW library. See the @ref build guide for more information.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compile_options CMake options
|
||||||
|
|
||||||
|
The CMake files for GLFW provide a number of options, although not all are
|
||||||
|
available on all supported platforms. Some of these are de facto standards
|
||||||
|
among projects using CMake and so have no `GLFW_` prefix.
|
||||||
|
|
||||||
|
If you are using the GUI version of CMake, these are listed and can be changed
|
||||||
|
from there. If you are using the command-line version, use the `ccmake` tool.
|
||||||
|
Some package systems like Ubuntu and other distributions based on Debian
|
||||||
|
GNU/Linux have this tool in a separate `cmake-curses-gui` package.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_options_shared Shared CMake options
|
||||||
|
|
||||||
|
`BUILD_SHARED_LIBS` determines whether GLFW is built as a static
|
||||||
|
library or as a DLL / shared library / dynamic library.
|
||||||
|
|
||||||
|
`LIB_SUFFIX` affects where the GLFW shared /dynamic library is installed. If it
|
||||||
|
is empty, it is installed to `${CMAKE_INSTALL_PREFIX}/lib`. If it is set to
|
||||||
|
`64`, it is installed to `${CMAKE_INSTALL_PREFIX}/lib64`.
|
||||||
|
|
||||||
|
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
|
||||||
|
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
|
||||||
|
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
|
||||||
|
selected library and its header files must be present on the system for this to
|
||||||
|
work.
|
||||||
|
|
||||||
|
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
|
||||||
|
along with the library.
|
||||||
|
|
||||||
|
`GLFW_BUILD_TESTS` determines whether the GLFW test programs are
|
||||||
|
built along with the library.
|
||||||
|
|
||||||
|
`GLFW_BUILD_DOCS` determines whether the GLFW documentation is built along with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_options_osx OS X specific CMake options
|
||||||
|
|
||||||
|
`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current
|
||||||
|
directory of bundled applications to the `Contents/Resources` directory.
|
||||||
|
|
||||||
|
`GLFW_USE_MENUBAR` determines whether the first call to
|
||||||
|
`glfwCreateWindow` sets up a minimal menu bar.
|
||||||
|
|
||||||
|
`GLFW_USE_RETINA` determines whether windows will use the full resolution of
|
||||||
|
Retina displays.
|
||||||
|
|
||||||
|
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_options_win32 Windows specific CMake options
|
||||||
|
|
||||||
|
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the
|
||||||
|
static library version of the Visual C++ runtime library. If set to `ON`, the
|
||||||
|
DLL version of the Visual C++ library is used. It is recommended to set this to
|
||||||
|
`ON`, as this keeps the executable smaller and benefits from security and bug
|
||||||
|
fix updates of the Visual C++ runtime.
|
||||||
|
|
||||||
|
`GLFW_USE_DWM_SWAP_INTERVAL` determines whether the swap interval is set even
|
||||||
|
when DWM compositing is enabled. If this is `ON`, the swap interval is set even
|
||||||
|
if DWM is enabled. It is recommended to set this to `OFF`, as doing otherwise
|
||||||
|
can lead to severe jitter.
|
||||||
|
|
||||||
|
`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement`
|
||||||
|
symbol, which forces the use of the high-performance GPU on Nvidia Optimus
|
||||||
|
systems. This symbol needs to be exported by the EXE to be detected by the
|
||||||
|
driver, so the override will not work if GLFW is built as a DLL. See _Enabling
|
||||||
|
High Performance Graphics Rendering on Optimus Systems_ for more details.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_options_egl EGL specific CMake options
|
||||||
|
|
||||||
|
`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific
|
||||||
|
context creation API. Note that EGL is not yet provided on all supported
|
||||||
|
platforms.
|
||||||
|
|
||||||
|
|
||||||
|
@section compile_manual Compiling GLFW manually
|
||||||
|
|
||||||
|
If you wish to compile GLFW without its CMake build environment then you will
|
||||||
|
have to do at least some of the platform detection yourself. GLFW needs
|
||||||
|
a number of configuration macros to be defined in order to know what it's being
|
||||||
|
compiled for and has many optional, platform-specific ones for various features.
|
||||||
|
|
||||||
|
When building with CMake, the `glfw_config.h` configuration header is generated
|
||||||
|
based on the current platform and CMake options. The GLFW CMake environment
|
||||||
|
defines `_GLFW_USE_CONFIG_H`, which causes this header to be included by
|
||||||
|
`internal.h`. Without this macro, GLFW will expect the necessary configuration
|
||||||
|
macros to be defined on the command-line.
|
||||||
|
|
||||||
|
Three macros _must_ be defined when compiling GLFW: one selecting the window
|
||||||
|
creation API, one selecting the context creation API and one client library.
|
||||||
|
Exactly one of each kind must be defined for GLFW to compile and link.
|
||||||
|
|
||||||
|
The window creation API is used to create windows, handle input, monitors, gamma
|
||||||
|
ramps and clipboard. The options are:
|
||||||
|
|
||||||
|
- `_GLFW_COCOA` to use the Cocoa frameworks
|
||||||
|
- `_GLFW_WIN32` to use the Win32 API
|
||||||
|
- `_GLFW_X11` to use the X Window System
|
||||||
|
- `_GLFW_WAYLAND` to use the Wayland API (experimental and incomplete)
|
||||||
|
- `_GLFW_MIR` to use the Mir API (experimental and incomplete)
|
||||||
|
|
||||||
|
The context creation API is used to enumerate pixel formats / framebuffer
|
||||||
|
configurations and to create contexts. The options are:
|
||||||
|
|
||||||
|
- `_GLFW_NSGL` to use the Cocoa OpenGL framework
|
||||||
|
- `_GLFW_WGL` to use the Win32 WGL API
|
||||||
|
- `_GLFW_GLX` to use the X11 GLX API
|
||||||
|
- `_GLFW_EGL` to use the EGL API
|
||||||
|
|
||||||
|
Wayland and Mir both require the EGL backend.
|
||||||
|
|
||||||
|
The client library is the one providing the OpenGL or OpenGL ES API, which is
|
||||||
|
used by GLFW to probe the created context. This is not the same thing as the
|
||||||
|
client API, as many desktop OpenGL client libraries now expose the OpenGL ES API
|
||||||
|
through extensions. The options are:
|
||||||
|
|
||||||
|
- `_GLFW_USE_OPENGL` for the desktop OpenGL (opengl32.dll, libGL.so or
|
||||||
|
OpenGL.framework)
|
||||||
|
- `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental)
|
||||||
|
- `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental)
|
||||||
|
|
||||||
|
Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL,
|
||||||
|
as the other context creation APIs do not interface with OpenGL ES client
|
||||||
|
libraries.
|
||||||
|
|
||||||
|
If you are building GLFW as a shared library / dynamic library / DLL then you
|
||||||
|
must also define `_GLFW_BUILD_DLL`. Otherwise, you may not define it.
|
||||||
|
|
||||||
|
If you are using the X11 window creation API then you _must_ also select an entry
|
||||||
|
point retrieval mechanism.
|
||||||
|
|
||||||
|
- `_GLFW_HAS_GLXGETPROCADDRESS` to use `glXGetProcAddress` (recommended)
|
||||||
|
- `_GLFW_HAS_GLXGETPROCADDRESSARB` to use `glXGetProcAddressARB` (legacy)
|
||||||
|
- `_GLFW_HAS_GLXGETPROCADDRESSEXT` to use `glXGetProcAddressEXT` (legacy)
|
||||||
|
- `_GLFW_HAS_DLOPEN` to do manual retrieval with `dlopen` (fallback)
|
||||||
|
|
||||||
|
In addition, support for the following X11 extensions can be enabled:
|
||||||
|
|
||||||
|
- `_GLFW_HAS_XINPUT` to use XInput2 for high-resolution cursor motion
|
||||||
|
(recommended)
|
||||||
|
|
||||||
|
If you are using the Cocoa window creation API, the following options are
|
||||||
|
available:
|
||||||
|
|
||||||
|
- `_GLFW_USE_CHDIR` to `chdir` to the `Resources` subdirectory of the
|
||||||
|
application bundle during @ref glfwInit (recommended)
|
||||||
|
- `_GLFW_USE_MENUBAR` to create and populate the menu bar when the first window
|
||||||
|
is created (recommended)
|
||||||
|
- `_GLFW_USE_RETINA` to have windows use the full resolution of Retina displays
|
||||||
|
(recommended)
|
||||||
|
|
||||||
|
@note None of the @ref build_macros may be defined during the compilation of
|
||||||
|
GLFW. If you define any of these in your build files, make sure they are not
|
||||||
|
applied to the GLFW sources.
|
||||||
|
|
||||||
|
*/
|
||||||
+226
-62
@@ -1,62 +1,125 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
@page context Context handling guide
|
@page context Context guide
|
||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
The primary purpose of GLFW is to provide a simple interface to window
|
This guide introduces the OpenGL and OpenGL ES context related functions of
|
||||||
management and OpenGL and OpenGL ES context creation. GLFW supports
|
GLFW. There are also guides for the other areas of the GLFW API.
|
||||||
multiple windows, each of which has its own context.
|
|
||||||
|
- @ref intro
|
||||||
|
- @ref window
|
||||||
|
- @ref monitor
|
||||||
|
- @ref input
|
||||||
|
|
||||||
|
|
||||||
@section context_object Context handles
|
@section context_object Context objects
|
||||||
|
|
||||||
The @ref GLFWwindow object encapsulates both a window and a context. They are
|
A window object encapsulates both a top-level window and an OpenGL or OpenGL ES
|
||||||
created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow (or
|
context. It is created with @ref glfwCreateWindow and destroyed with @ref
|
||||||
@ref glfwTerminate, if any remain). As the window and context are inseparably
|
glfwDestroyWindow or @ref glfwTerminate. See @ref window_creation for more
|
||||||
linked, the object pointer is used as both a context and window handle.
|
information.
|
||||||
|
|
||||||
|
As the window and context are inseparably linked, the window object also serves
|
||||||
|
as the context handle.
|
||||||
|
|
||||||
|
To test the creation of various kinds of contexts and see their properties, run
|
||||||
|
the `glfwinfo` test program.
|
||||||
|
|
||||||
|
|
||||||
@section context_hints Context creation hints
|
@subsection context_hints Context creation hints
|
||||||
|
|
||||||
There are a number of hints, specified using @ref glfwWindowHint, related to
|
There are a number of hints, specified using @ref glfwWindowHint, related to
|
||||||
what kind of context is created. See
|
what kind of context is created. See
|
||||||
[context related hints](@ref window_hints_ctx) in the window handling guide.
|
[context related hints](@ref window_hints_ctx) in the window guide.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection context_sharing Context object sharing
|
||||||
|
|
||||||
|
When creating a window and its OpenGL or OpenGL ES context with @ref
|
||||||
|
glfwCreateWindow, you can specify another window whose context the new one
|
||||||
|
should share its objects (textures, vertex and element buffers, etc.) with.
|
||||||
|
|
||||||
|
@code
|
||||||
|
GLFWwindow* second_window = glfwCreateWindow(640, 480, "Second Window", NULL, first_window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Object sharing is implemented by the operating system and graphics driver. On
|
||||||
|
platforms where it is possible to choose which types of objects are shared, GLFW
|
||||||
|
requests that all types are shared.
|
||||||
|
|
||||||
|
See the relevant chapter of the [OpenGL](https://www.opengl.org/registry/) or
|
||||||
|
[OpenGL ES](http://www.khronos.org/opengles/) reference documents for more
|
||||||
|
information. The name and number of this chapter unfortunately varies between
|
||||||
|
versions and APIs, but has at times been named _Shared Objects and Multiple
|
||||||
|
Contexts_.
|
||||||
|
|
||||||
|
GLFW comes with a simple object sharing test program called `sharing`.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection context_offscreen Offscreen contexts
|
||||||
|
|
||||||
|
GLFW doesn't support creating contexts without an associated window. However,
|
||||||
|
contexts with hidden windows can be created with the
|
||||||
|
[GLFW_VISIBLE](@ref window_hints_wnd) window hint.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
||||||
|
|
||||||
|
GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The window never needs to be shown and its context can be used as a plain
|
||||||
|
offscreen context. Depending on the window manager, the size of a hidden
|
||||||
|
window's framebuffer may not be usable or modifiable, so framebuffer
|
||||||
|
objects are recommended for rendering with such contexts.
|
||||||
|
|
||||||
|
__OS X:__ The first time a window is created the menu bar is populated with
|
||||||
|
common commands like Hide, Quit and About. This is not desirable for example
|
||||||
|
when writing a command-line only application. The menu bar setup can be
|
||||||
|
disabled with a [compile-time option](@ref compile_options_osx).
|
||||||
|
|
||||||
|
|
||||||
@section context_current Current context
|
@section context_current Current context
|
||||||
|
|
||||||
Before you can use the OpenGL or OpenGL ES APIs, you need to have a current
|
Before you can make OpenGL or OpenGL ES calls, you need to have a current
|
||||||
context of the proper type. The context encapsulates all render state and all
|
context of the correct type. A context can only be current for a single thread
|
||||||
objects like textures and shaders.
|
at a time, and a thread can only have a single context current at a time.
|
||||||
|
|
||||||
Note that a context can only be current for a single thread at a time, and
|
The context of a window is made current with @ref glfwMakeContextCurrent.
|
||||||
a thread can only have a single context at a time.
|
|
||||||
|
|
||||||
A context is made current with @ref glfwMakeContextCurrent.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The current context is returned by @ref glfwGetCurrentContext.
|
The window of the current context is returned by @ref glfwGetCurrentContext.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
GLFWwindow* window = glfwGetCurrentContext();
|
GLFWwindow* window = glfwGetCurrentContext();
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The following GLFW functions require a context to be current. Calling any these
|
||||||
|
functions without a current context will generate a @ref GLFW_NO_CURRENT_CONTEXT
|
||||||
|
error.
|
||||||
|
|
||||||
@section context_swap Swapping buffers
|
- @ref glfwSwapInterval
|
||||||
|
- @ref glfwExtensionSupported
|
||||||
See [swapping buffers](@ref window_swap) in the window handling guide.
|
- @ref glfwGetProcAddress
|
||||||
|
|
||||||
|
|
||||||
@section context_glext OpenGL extension handling
|
@section context_swap Buffer swapping
|
||||||
|
|
||||||
One of the benefits of OpenGL is its extensibility. Independent hardware
|
Buffer swapping is part of the window and framebuffer, not the context. See
|
||||||
vendors (IHVs) may include functionality in their OpenGL implementations that
|
@ref buffer_swap.
|
||||||
expand upon the OpenGL standard before that functionality is included in a new
|
|
||||||
version of the OpenGL specification.
|
|
||||||
|
@section context_glext OpenGL and OpenGL ES extensions
|
||||||
|
|
||||||
|
One of the benefits of OpenGL and OpenGL ES are their extensibility.
|
||||||
|
Hardware vendors may include extensions in their implementations that extend the
|
||||||
|
API before that functionality is included in a new version of the OpenGL or
|
||||||
|
OpenGL ES specification, and some extensions are never included and remain
|
||||||
|
as extensions until they become obsolete.
|
||||||
|
|
||||||
An extension is defined by:
|
An extension is defined by:
|
||||||
|
|
||||||
@@ -65,43 +128,140 @@ An extension is defined by:
|
|||||||
- New OpenGL functions (e.g. `glGetDebugMessageLogARB`)
|
- New OpenGL functions (e.g. `glGetDebugMessageLogARB`)
|
||||||
|
|
||||||
Note the `ARB` affix, which stands for Architecture Review Board and is used
|
Note the `ARB` affix, which stands for Architecture Review Board and is used
|
||||||
for official extensions. There are many different affixes, depending on who
|
for official extensions. The extension above was created by the ARB, but there
|
||||||
wrote the extension. A list of extensions, together with their specifications,
|
are many different affixes, like `NV` for Nvidia and `AMD` for, well, AMD. Any
|
||||||
can be found at the [OpenGL Registry](http://www.opengl.org/registry/).
|
group may also use the generic `EXT` affix. Lists of extensions, together with
|
||||||
|
their specifications, can be found at the
|
||||||
|
[OpenGL Registry](http://www.opengl.org/registry/) and
|
||||||
|
[OpenGL ES Registry](https://www.khronos.org/registry/gles/).
|
||||||
|
|
||||||
|
|
||||||
|
@subsection context_glext_auto Loading extension with a loader library
|
||||||
|
|
||||||
|
An extension loader library is the easiest and best way to access both OpenGL and
|
||||||
|
OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs.
|
||||||
|
They will take care of all the details of declaring and loading everything you
|
||||||
|
need. One such library is [glad](https://github.com/Dav1dde/glad) and there are
|
||||||
|
several others.
|
||||||
|
|
||||||
|
The following example will use glad but all extension loader libraries work
|
||||||
|
similarly.
|
||||||
|
|
||||||
|
First you need to generate the source files using the glad Python script. This
|
||||||
|
example generates a loader for any version of OpenGL, which is the default for
|
||||||
|
both GLFW and glad, but loaders for OpenGL ES, as well as loaders for specific
|
||||||
|
API versions and extension sets can be generated. The generated files are
|
||||||
|
written to the `output` directory.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
python main.py --generator c --no-loader --out-path output
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The `--no-loader` option is added because GLFW already provides a function for
|
||||||
|
loading OpenGL and OpenGL ES function pointers and glad can call this instead of
|
||||||
|
having to implement its own. There are several other command-line options as
|
||||||
|
well. See the glad documentation for details.
|
||||||
|
|
||||||
|
Add the generated `output/src/glad.c`, `output/include/glad/glad.h` and
|
||||||
|
`output/include/KHR/khrplatform.h` files to your build. Then you need to
|
||||||
|
include the glad header file, which will replace the OpenGL header of your
|
||||||
|
development environment. By including the glad header before the GLFW header,
|
||||||
|
it suppresses the development environment's OpenGL or OpenGL ES header.
|
||||||
|
|
||||||
|
@code
|
||||||
|
#include <glad/glad.h>
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Finally you need to initialize glad once you have a suitable current context.
|
||||||
|
|
||||||
|
@code
|
||||||
|
window = glfwCreateWindow(640, 480, "My Window", NULL, NULL);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
|
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Once glad has been loaded, you have access to all OpenGL core and extension
|
||||||
|
functions supported by both the context you created and the glad loader you
|
||||||
|
generated and you are ready to start rendering.
|
||||||
|
|
||||||
|
You can specify a minimum required OpenGL or OpenGL ES version with
|
||||||
|
[context hints](@ref window_hints_ctx). If your needs are more complex, you can
|
||||||
|
check the actual OpenGL or OpenGL ES version with
|
||||||
|
[context attributes](@ref window_attribs_ctx), or you can check whether
|
||||||
|
a specific version is supported by the current context with the
|
||||||
|
`GLAD_GL_VERSION_x_x` booleans.
|
||||||
|
|
||||||
|
@code
|
||||||
|
if (GLAD_GL_VERSION_3_2)
|
||||||
|
{
|
||||||
|
// Call OpenGL 3.2+ specific code
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
To check whether a specific extension is supported, use the `GLAD_GL_xxx`
|
||||||
|
booleans.
|
||||||
|
|
||||||
|
@code
|
||||||
|
if (GLAD_GL_ARB_debug_output)
|
||||||
|
{
|
||||||
|
// Use GL_ARB_debug_output
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection context_glext_manual Loading extensions manually
|
||||||
|
|
||||||
|
__Do not use this technique__ unless it is absolutely necessary. An
|
||||||
|
[extension loader library](@ref context_glext_auto) will save you a ton of
|
||||||
|
tedious, repetitive, error prone work.
|
||||||
|
|
||||||
To use a certain extension, you must first check whether the context supports
|
To use a certain extension, you must first check whether the context supports
|
||||||
that extension and then, if it introduces new functions, retrieve the pointers
|
that extension and then, if it introduces new functions, retrieve the pointers
|
||||||
to those functions.
|
to those functions. GLFW provides @ref glfwExtensionSupported and @ref
|
||||||
|
glfwGetProcAddress for manual loading of extensions and new API functions.
|
||||||
|
|
||||||
This can be done with GLFW, as will be described in this section, but usually
|
This section will demonstrate manual loading of OpenGL extensions. The loading
|
||||||
you will instead want to use a dedicated extension loading library such as
|
of OpenGL ES extensions is identical except for the name of the extension header.
|
||||||
[GLEW](http://glew.sourceforge.net/). This kind of library greatly reduces the
|
|
||||||
amount of work necessary to use both OpenGL extensions and modern versions of
|
|
||||||
the OpenGL API. GLEW in particular has been extensively tested with and works
|
|
||||||
well with GLFW.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection context_glext_header The glext.h header
|
@subsubsection context_glext_header The glext.h header
|
||||||
|
|
||||||
The `glext.h` header is a continually updated file that defines the interfaces
|
The `glext.h` extension header is a continually updated file that defines the
|
||||||
for all OpenGL extensions. The latest version of this can always be found at
|
interfaces for all OpenGL extensions. The latest version of this can always be
|
||||||
the [OpenGL Registry](http://www.opengl.org/registry/). It it strongly
|
found at the [OpenGL Registry](http://www.opengl.org/registry/). There are also
|
||||||
recommended that you use your own copy, as the one shipped with your development
|
extension headers for the various versions of OpenGL ES at the
|
||||||
environment may be several years out of date and may not include the extensions
|
[OpenGL ES Registry](https://www.khronos.org/registry/gles/). It it strongly
|
||||||
you wish to use.
|
recommended that you use your own copy of the extension header, as the one
|
||||||
|
included in your development environment may be several years out of date and
|
||||||
|
may not include the extensions you wish to use.
|
||||||
|
|
||||||
The header defines function pointer types for all functions of all extensions it
|
The header defines function pointer types for all functions of all extensions it
|
||||||
supports. These have names like `PFNGLGETDEBUGMESSAGELOGARB` (for
|
supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for
|
||||||
`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` and `PROC`
|
`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer
|
||||||
are added to the ends.
|
to function) and `PROC` (procedure) are added to the ends.
|
||||||
|
|
||||||
|
To include the extension header, define [GLFW_INCLUDE_GLEXT](@ref build_macros)
|
||||||
|
before including the GLFW header.
|
||||||
|
|
||||||
|
@code
|
||||||
|
#define GLFW_INCLUDE_GLEXT
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection context_glext_string Checking for extensions
|
@subsubsection context_glext_string Checking for extensions
|
||||||
|
|
||||||
A given machine may not actually support the extension (it may have older
|
A given machine may not actually support the extension (it may have older
|
||||||
drivers or a graphics card that lacks the necessary hardware features), so it
|
drivers or a graphics card that lacks the necessary hardware features), so it
|
||||||
is necessary to check whether the context supports the extension. This is done
|
is necessary to check at run-time whether the context supports the extension.
|
||||||
with @ref glfwExtensionSupported.
|
This is done with @ref glfwExtensionSupported.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
||||||
@@ -111,19 +271,19 @@ if (glfwExtensionSupported("GL_ARB_debug_output"))
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The argument is a null terminated ASCII string with the extension name. If the
|
The argument is a null terminated ASCII string with the extension name. If the
|
||||||
extension is supported, @ref glfwExtensionSupported returns non-zero, otherwise
|
extension is supported, @ref glfwExtensionSupported returns `GL_TRUE`, otherwise
|
||||||
it returns zero.
|
it returns `GL_FALSE`.
|
||||||
|
|
||||||
|
|
||||||
@subsection context_glext_proc Fetching function pointers
|
@subsubsection context_glext_proc Fetching function pointers
|
||||||
|
|
||||||
Many extensions, though not all, require the use of new OpenGL functions.
|
Many extensions, though not all, require the use of new OpenGL functions.
|
||||||
These entry points are often not exposed by your link libraries, making
|
These functions often do not have entry points in the client API libraries of
|
||||||
it necessary to fetch them at run time. With @ref glfwGetProcAddress you can
|
your operating system, making it necessary to fetch them at run time. You can
|
||||||
retrieve the address of extension and non-extension OpenGL functions.
|
retrieve pointers to these functions with @ref glfwGetProcAddress.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
PFNGLGETDEBUGMESSAGELOGARB pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB");
|
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
In general, you should avoid giving the function pointer variables the (exact)
|
In general, you should avoid giving the function pointer variables the (exact)
|
||||||
@@ -134,31 +294,35 @@ Now that all the pieces have been introduced, here is what they might look like
|
|||||||
when used together.
|
when used together.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#include "glext.h"
|
#define GLFW_INCLUDE_GLEXT
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#define glGetDebugMessageLogARB pfnGetDebugMessageLog
|
#define glGetDebugMessageLogARB pfnGetDebugMessageLog
|
||||||
PFNGLGETDEBUGMESSAGELOGARB pfnGetDebugMessageLog;
|
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;
|
||||||
|
|
||||||
// Flag indicating whether the extension is supported
|
// Flag indicating whether the extension is supported
|
||||||
int has_debug_output = 0;
|
int has_ARB_debug_output = 0;
|
||||||
|
|
||||||
void load_extensions(void)
|
void load_extensions(void)
|
||||||
{
|
{
|
||||||
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
||||||
{
|
{
|
||||||
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARB) glfwGetProcAddress("glGetDebugMessageLogARB");
|
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC) glfwGetProcAddress("glGetDebugMessageLogARB");
|
||||||
if (pfnGetDebugMessageLog)
|
if (pfnGetDebugMessageLog)
|
||||||
{
|
{
|
||||||
// Both the extension name and the function pointer are present
|
// Both the extension name and the function pointer are present
|
||||||
has_debug_output = 1;
|
has_ARB_debug_output = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void some_function(void)
|
void some_function(void)
|
||||||
{
|
{
|
||||||
|
if (has_ARB_debug_output)
|
||||||
|
{
|
||||||
// Now the extension function can be called as usual
|
// Now the extension function can be called as usual
|
||||||
glGetDebugMessageLogARB(...);
|
glGetDebugMessageLogARB(...);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+370
@@ -0,0 +1,370 @@
|
|||||||
|
// NOTE: Please use this file to perform modifications on default style sheets.
|
||||||
|
//
|
||||||
|
// You need to install a few Ruby gems to generate extra.css from this file:
|
||||||
|
// gem install less therubyracer
|
||||||
|
//
|
||||||
|
// Run this command to regenerate extra.css after you're finished with changes:
|
||||||
|
// lessc --compress extra.less > extra.css
|
||||||
|
//
|
||||||
|
// Alternatively you can use online services to regenerate extra.css.
|
||||||
|
|
||||||
|
|
||||||
|
// Default text color for page contents
|
||||||
|
@default-text-color: hsl(0,0%,30%);
|
||||||
|
|
||||||
|
// Page header, footer, table rows, inline codes and definition lists
|
||||||
|
@header-footer-background-color: hsl(0,0%,95%);
|
||||||
|
|
||||||
|
// Page header, footer links and navigation bar background
|
||||||
|
@header-footer-link-color: hsl(0,0%,40%);
|
||||||
|
|
||||||
|
// Doxygen navigation bar links
|
||||||
|
@navbar-link-color: @header-footer-background-color;
|
||||||
|
|
||||||
|
// Page content background color
|
||||||
|
@content-background-color: hsl(0,0%,100%);
|
||||||
|
|
||||||
|
// Bold, italic, h1, h2, ... and table of contents
|
||||||
|
@heading-color: hsl(0,0%,10%);
|
||||||
|
|
||||||
|
// Function, enum and macro definition separator
|
||||||
|
@def-separator-color: @header-footer-background-color;
|
||||||
|
|
||||||
|
// Base color hue
|
||||||
|
@base-hue: 24;
|
||||||
|
|
||||||
|
// Default color used for links
|
||||||
|
@default-link-color: hsl(@base-hue,100%,50%);
|
||||||
|
|
||||||
|
// Doxygen navigation bar active tab
|
||||||
|
@tab-text-color: hsl(0,0%,100%);
|
||||||
|
@tab-background-color1: @default-link-color;
|
||||||
|
@tab-background-color2: lighten(spin(@tab-background-color1, 10), 10%);
|
||||||
|
|
||||||
|
// Table borders
|
||||||
|
@default-border-color: @default-link-color;
|
||||||
|
|
||||||
|
// Table header
|
||||||
|
@table-text-color: @tab-text-color;
|
||||||
|
@table-background-color1: @tab-background-color1;
|
||||||
|
@table-background-color2: @tab-background-color2;
|
||||||
|
|
||||||
|
// Table of contents, data structure index and prototypes
|
||||||
|
@toc-background-color1: hsl(0,0%,90%);
|
||||||
|
@toc-background-color2: lighten(@toc-background-color1, 5%);
|
||||||
|
|
||||||
|
// Function prototype parameters color
|
||||||
|
@prototype-param-color: darken(@default-link-color, 25%);
|
||||||
|
|
||||||
|
// Message box color: note, pre, post and invariant
|
||||||
|
@box-note-color: hsl(103,80%,85%);
|
||||||
|
|
||||||
|
// Message box color: warning and attention
|
||||||
|
@box-warning-color: hsl(34,80%,85%);
|
||||||
|
|
||||||
|
// Message box color: deprecated and bug
|
||||||
|
@box-bug-color: hsl(333,80%,85%);
|
||||||
|
|
||||||
|
// Message box color: todo and test
|
||||||
|
@box-todo-color: hsl(200,80%,85%);
|
||||||
|
|
||||||
|
// Message box helper function
|
||||||
|
.message-box(@base-color) {
|
||||||
|
background:linear-gradient(to bottom,lighten(@base-color, 5%) 0%,@base-color 100%);
|
||||||
|
box-shadow:inset 0 0 32px darken(@base-color, 5%);
|
||||||
|
color:darken(@base-color, 67%);
|
||||||
|
border:2px solid desaturate(darken(@base-color, 10%), 20%);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#navrow1,#navrow2,#navrow3,#navrow4,.tablist a,.tablist a:visited,.tablist a:hover,.tablist li,.tablist li.current a,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code {
|
||||||
|
background:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,hr,.memSeparator {
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tablist a,.tablist a:visited,.tablist a:hover,.tablist li,.tablist li.current a,.reflist dt a.el,.levels span,.directory .levels span {
|
||||||
|
text-shadow:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memdoc,dl.reflist dd {
|
||||||
|
box-shadow:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code {
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-path,.directory .levels,span.lineno {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code {
|
||||||
|
background:@header-footer-background-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
color:@default-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
|
||||||
|
color:@heading-color;
|
||||||
|
border-bottom:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
padding-top:0.5em;
|
||||||
|
font-size:180%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
padding-top:0.5em;
|
||||||
|
margin-bottom:0;
|
||||||
|
font-size:140%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
padding-top:0.5em;
|
||||||
|
margin-bottom:0;
|
||||||
|
font-size:110%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glfwheader {
|
||||||
|
font-size:16px;
|
||||||
|
height:64px;
|
||||||
|
max-width:920px;
|
||||||
|
min-width:800px;
|
||||||
|
padding:0 32px;
|
||||||
|
margin:0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#glfwhome {
|
||||||
|
line-height:64px;
|
||||||
|
padding-right:48px;
|
||||||
|
color:@header-footer-link-color;
|
||||||
|
font-size:2.5em;
|
||||||
|
background:url("http://www.glfw.org/css/arrow.png") no-repeat right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glfwnavbar {
|
||||||
|
list-style-type:none;
|
||||||
|
margin:0 auto;
|
||||||
|
float:right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#glfwhome,.glfwnavbar li {
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glfwnavbar a,.glfwnavbar a:visited {
|
||||||
|
line-height:64px;
|
||||||
|
margin-left:2em;
|
||||||
|
display:block;
|
||||||
|
color:@header-footer-link-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
#glfwhome,.glfwnavbar a,.glfwnavbar a:visited {
|
||||||
|
transition:.35s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#titlearea,.footer {
|
||||||
|
color:@header-footer-link-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
address.footer {
|
||||||
|
text-align:center;
|
||||||
|
padding:2em;
|
||||||
|
margin-top:3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#top {
|
||||||
|
background:@header-footer-link-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navrow1,#navrow2,#navrow3,#navrow4 {
|
||||||
|
max-width:920px;
|
||||||
|
min-width:800px;
|
||||||
|
margin:0 auto;
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tablist {
|
||||||
|
height:36px;
|
||||||
|
display:block;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tablist a,.tablist a:visited,.tablist a:hover,.tablist li,.tablist li.current a {
|
||||||
|
color:@navbar-link-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tablist li.current a {
|
||||||
|
background:linear-gradient(to bottom,@tab-background-color2 0%,@tab-background-color1 100%);
|
||||||
|
box-shadow:inset 0 0 32px @tab-background-color1;
|
||||||
|
text-shadow:0 -1px 1px darken(@tab-background-color1, 15%);
|
||||||
|
color:@tab-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contents {
|
||||||
|
min-height:590px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.contents,div.header {
|
||||||
|
max-width:920px;
|
||||||
|
margin:0 auto;
|
||||||
|
padding:0 32px;
|
||||||
|
background:@content-background-color none;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.doxtable th,dl.reflist dt {
|
||||||
|
background:linear-gradient(to bottom,@table-background-color2 0%,@table-background-color1 100%);
|
||||||
|
box-shadow:inset 0 0 32px @table-background-color1;
|
||||||
|
text-shadow:0 -1px 1px darken(@table-background-color1, 15%);
|
||||||
|
color:@table-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reflist dt a.el {
|
||||||
|
color:@default-link-color;
|
||||||
|
padding:.2em;
|
||||||
|
border-radius:4px;
|
||||||
|
background-color:lighten(@default-link-color, 40%);
|
||||||
|
}
|
||||||
|
|
||||||
|
div.toc {
|
||||||
|
float:none;
|
||||||
|
width:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.toc h3 {
|
||||||
|
font-size:1.17em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.toc ul {
|
||||||
|
padding-left:1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.toc li {
|
||||||
|
font-size:1em;
|
||||||
|
padding-left:0;
|
||||||
|
list-style-type:disc;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.toc,.memproto,div.qindex,div.ah {
|
||||||
|
background:linear-gradient(to bottom,@toc-background-color2 0%,@toc-background-color1 100%);
|
||||||
|
box-shadow:inset 0 0 32px @toc-background-color1;
|
||||||
|
text-shadow:0 1px 1px lighten(@toc-background-color2, 10%);
|
||||||
|
color:@heading-color;
|
||||||
|
border:2px solid @toc-background-color1;
|
||||||
|
border-radius:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paramname {
|
||||||
|
color:@prototype-param-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reflist dt {
|
||||||
|
border:2px solid @default-border-color;
|
||||||
|
border-top-left-radius:4px;
|
||||||
|
border-top-right-radius:4px;
|
||||||
|
border-bottom:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reflist dd {
|
||||||
|
border:2px solid @default-border-color;
|
||||||
|
border-bottom-right-radius:4px;
|
||||||
|
border-bottom-left-radius:4px;
|
||||||
|
border-top:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.doxtable {
|
||||||
|
border-collapse:inherit;
|
||||||
|
border-spacing:0;
|
||||||
|
border:2px solid @default-border-color;
|
||||||
|
border-radius:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,.tablist a:hover,span.lineno a:hover {
|
||||||
|
color:@default-link-color;
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.directory {
|
||||||
|
border-collapse:inherit;
|
||||||
|
border-spacing:0;
|
||||||
|
border:2px solid @default-border-color;
|
||||||
|
border-radius:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr,.memSeparator {
|
||||||
|
height:2px;
|
||||||
|
background:linear-gradient(to right,@def-separator-color 0%,darken(@def-separator-color, 10%) 50%,@def-separator-color 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.note,dl.pre,dl.post,dl.invariant {
|
||||||
|
.message-box(@box-note-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.warning,dl.attention {
|
||||||
|
.message-box(@box-warning-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.deprecated,dl.bug {
|
||||||
|
.message-box(@box-bug-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.todo,dl.test {
|
||||||
|
.message-box(@box-todo-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test {
|
||||||
|
border-radius:4px;
|
||||||
|
padding:1em;
|
||||||
|
text-shadow:0 1px 1px hsl(0,0%,100%);
|
||||||
|
margin:1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited {
|
||||||
|
color:inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.line {
|
||||||
|
line-height:inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.fragment,pre.fragment {
|
||||||
|
background:hsl(0,0%,95%);
|
||||||
|
border-radius:4px;
|
||||||
|
border:none;
|
||||||
|
padding:1em;
|
||||||
|
overflow:auto;
|
||||||
|
border-left:4px solid hsl(0,0%,80%);
|
||||||
|
margin:1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lineno a,.lineno a:visited,.line,pre.fragment {
|
||||||
|
color:@default-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.preprocessor,span.comment {
|
||||||
|
color:hsl(193,100%,30%);
|
||||||
|
}
|
||||||
|
|
||||||
|
a.code,a.code:visited {
|
||||||
|
color:hsl(18,100%,45%);
|
||||||
|
}
|
||||||
|
|
||||||
|
span.keyword,span.keywordtype,span.keywordflow {
|
||||||
|
color:darken(@default-text-color, 5%);
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.stringliteral {
|
||||||
|
color:hsl(261,100%,30%);
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
padding:.1em;
|
||||||
|
border-radius:4px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<address class="footer">
|
||||||
|
<p>
|
||||||
|
Last update on $date for $projectname $projectnumber
|
||||||
|
</p>
|
||||||
|
</address>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
|
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||||
|
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||||
|
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
|
$treeview
|
||||||
|
$search
|
||||||
|
$mathjax
|
||||||
|
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||||
|
$extrastylesheet
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||||
|
|
||||||
|
<!--BEGIN TITLEAREA-->
|
||||||
|
<div id="titlearea">
|
||||||
|
<div class="glfwheader">
|
||||||
|
<a href="http://www.glfw.org/" id="glfwhome">GLFW</a>
|
||||||
|
<ul class="glfwnavbar">
|
||||||
|
<li><a href="http://www.glfw.org/documentation.html">Documentation</a></li>
|
||||||
|
<li><a href="http://www.glfw.org/download.html">Download</a></li>
|
||||||
|
<li><a href="http://www.glfw.org/media.html">Media</a></li>
|
||||||
|
<li><a href="http://www.glfw.org/community.html">Community</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--END TITLEAREA-->
|
||||||
|
<!-- end header part -->
|
||||||
+588
@@ -0,0 +1,588 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
@page input Input guide
|
||||||
|
|
||||||
|
@tableofcontents
|
||||||
|
|
||||||
|
This guide introduces the input related functions of GLFW. There are also
|
||||||
|
guides for the other areas of GLFW.
|
||||||
|
|
||||||
|
- @ref intro
|
||||||
|
- @ref window
|
||||||
|
- @ref context
|
||||||
|
- @ref monitor
|
||||||
|
|
||||||
|
GLFW provides many kinds of input. While some can only be polled, like time, or
|
||||||
|
only received via callbacks, like scrolling, there are those that provide both
|
||||||
|
callbacks and polling. Where a callback is provided, that is the recommended
|
||||||
|
way to receive that kind of input. The more you can use callbacks the less time
|
||||||
|
your users' machines will need to spend polling.
|
||||||
|
|
||||||
|
All input callbacks receive a window handle. By using the
|
||||||
|
[window user pointer](@ref window_userptr), you can access non-global structures
|
||||||
|
or objects from your callbacks.
|
||||||
|
|
||||||
|
To get a better feel for how the various events callbacks behave, run the
|
||||||
|
`events` test program. It register every callback supported by GLFW and prints
|
||||||
|
out all arguments provided for every event, along with time and sequence
|
||||||
|
information.
|
||||||
|
|
||||||
|
|
||||||
|
@section events Event processing
|
||||||
|
|
||||||
|
GLFW needs to communicate regularly with the window system both in order to
|
||||||
|
receive events and to show that the application hasn't locked up. Event
|
||||||
|
processing must be done regularly while you have visible windows and is normally
|
||||||
|
done each frame after [buffer swapping](@ref buffer_swap).
|
||||||
|
|
||||||
|
There are two functions for processing pending events. @ref glfwPollEvents,
|
||||||
|
processes only those events that have already been received and then returns
|
||||||
|
immediately.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwPollEvents();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This is the best choice when rendering continually, like most games do.
|
||||||
|
|
||||||
|
If you only need to update the contents of the window when you receive new
|
||||||
|
input, @ref glfwWaitEvents is a better choice.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwWaitEvents();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
It puts the thread to sleep until at least one event has been received and then
|
||||||
|
processes all received events. This saves a great deal of CPU cycles and is
|
||||||
|
useful for, for example, editing tools. There must be at least one GLFW window
|
||||||
|
for this function to sleep.
|
||||||
|
|
||||||
|
If the main thread is sleeping in @ref glfwWaitEvents, you can wake it from
|
||||||
|
another thread by posting an empty event to the event queue with @ref
|
||||||
|
glfwPostEmptyEvent.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwPostEmptyEvent();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Do not assume that callbacks will _only_ be called through either of the above
|
||||||
|
functions. While it is necessary to process events in the event queue, some
|
||||||
|
window systems will send some events directly to the application, which in turn
|
||||||
|
causes callbacks to be called outside of regular event processing.
|
||||||
|
|
||||||
|
|
||||||
|
@section input_keyboard Keyboard input
|
||||||
|
|
||||||
|
GLFW divides keyboard input into two categories; key events and character
|
||||||
|
events. Key events relate to actual physical keyboard keys, whereas character
|
||||||
|
events relate to the Unicode code points generated by pressing some of them.
|
||||||
|
|
||||||
|
Keys and characters do not map 1:1. A single key press may produce several
|
||||||
|
characters, and a single character may require several keys to produce. This
|
||||||
|
may not be the case on your machine, but your users are likely not all using the
|
||||||
|
same keyboard layout, input method or even operating system as you.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection input_key Key input
|
||||||
|
|
||||||
|
If you wish to be notified when a physical key is pressed or released or when it
|
||||||
|
repeats, set a key callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetKeyCallback(window, key_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives the [keyboard key](@ref keys), platform-specific
|
||||||
|
scancode, key action and [modifier bits](@ref mods).
|
||||||
|
|
||||||
|
@code
|
||||||
|
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
|
{
|
||||||
|
if (key == GLFW_KEY_E && action == GLFW_PRESS)
|
||||||
|
activate_airship();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key
|
||||||
|
will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it. These keys still
|
||||||
|
have unique, if platform-specific scancodes.
|
||||||
|
|
||||||
|
The scancode is unique for every key but is platform-specific, so a scancode
|
||||||
|
will map to different keys on different platforms.
|
||||||
|
|
||||||
|
The key will be `GLFW_KEY_UNKNOWN` for special keys like _E-mail_ or _Play_ that
|
||||||
|
don't have a key token. Those keys will still have unique, if platform-specific
|
||||||
|
scancodes.
|
||||||
|
|
||||||
|
Key states for [named keys](@ref keys) are also saved in per-window state arrays
|
||||||
|
that can be polled with @ref glfwGetKey.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int state = glfwGetKey(window, GLFW_KEY_E);
|
||||||
|
if (state == GLFW_PRESS)
|
||||||
|
activate_airship();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
|
This function only returns cached key event state. It does not poll the
|
||||||
|
system for the current state of the key.
|
||||||
|
|
||||||
|
Whenever you poll state, you risk missing the state change you are looking for.
|
||||||
|
If a pressed key is released again before you poll its state, you will have
|
||||||
|
missed the key press. The recommended solution for this is to use a
|
||||||
|
key callback, but there is also the `GLFW_STICKY_KEYS` input mode.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetInputMode(window, GLFW_STICKY_KEYS, 1);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When sticky keys mode is enabled, the pollable state of a key will remain
|
||||||
|
`GLFW_PRESS` until the state of that key is polled with @ref glfwGetKey. Once
|
||||||
|
it has been polled, if a key release event had been processed in the meantime,
|
||||||
|
the state will reset to `GLFW_RELEASE`, otherwise it will remain `GLFW_PRESS`.
|
||||||
|
|
||||||
|
The `GLFW_KEY_LAST` constant holds the highest value of any
|
||||||
|
[named key](@ref keys).
|
||||||
|
|
||||||
|
|
||||||
|
@subsection input_char Text input
|
||||||
|
|
||||||
|
GLFW supports text input in the form of a stream of
|
||||||
|
[Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the
|
||||||
|
operating system text input system. Unlike key input, text input obeys keyboard
|
||||||
|
layouts and modifier keys and supports composing characters using
|
||||||
|
[dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can
|
||||||
|
encode the code points into
|
||||||
|
[UTF-8](https://en.wikipedia.org/wiki/UTF-8) or any other encoding you prefer.
|
||||||
|
|
||||||
|
Because an `unsigned int` is 32 bits long on all platforms supported by GLFW,
|
||||||
|
you can treat the code point argument as native endian
|
||||||
|
[UTF-32](https://en.wikipedia.org/wiki/UTF-32).
|
||||||
|
|
||||||
|
There are two callbacks for receiving Unicode code points. If you wish to
|
||||||
|
offer regular text input, set a character callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetCharCallback(window, character_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives Unicode code points for key events that would
|
||||||
|
have led to regular text input and generally behaves as a standard text field on
|
||||||
|
that platform.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void character_callback(GLFWwindow* window, unsigned int codepoint)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you wish to receive even those Unicode code points generated with modifier
|
||||||
|
key combinations that a plain text field would ignore, or just want to know
|
||||||
|
exactly what modifier keys were used, set a character with modifiers callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetCharModsCallback(window, charmods_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives Unicode code points and
|
||||||
|
[modifier bits](@ref mods).
|
||||||
|
|
||||||
|
@code
|
||||||
|
void charmods_callback(GLFWwindow* window, unsigned int codepoint, int mods)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section input_mouse Mouse input
|
||||||
|
|
||||||
|
Mouse input comes in many forms, including cursor motion, button presses and
|
||||||
|
scrolling offsets. The cursor appearance can also be changed, either to
|
||||||
|
a custom image or a standard cursor shape from the system theme.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection cursor_pos Cursor position
|
||||||
|
|
||||||
|
If you wish to be notified when the cursor moves over the window, set a cursor
|
||||||
|
position callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetCursorPosCallback(window, cursor_pos_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback functions receives the cursor position. On platforms that provide
|
||||||
|
it, the full sub-pixel cursor position is passed on.
|
||||||
|
|
||||||
|
@code
|
||||||
|
static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The cursor position is also saved per-window and can be polled with @ref
|
||||||
|
glfwGetCursorPos.
|
||||||
|
|
||||||
|
@code
|
||||||
|
double xpos, ypos;
|
||||||
|
glfwGetCursorPos(window, &xpos, &ypos);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection cursor_mode Cursor modes
|
||||||
|
|
||||||
|
The `GLFW_CURSOR` input mode provides several cursor modes for special forms of
|
||||||
|
mouse motion input. By default, the cursor mode is `GLFW_CURSOR_NORMAL`,
|
||||||
|
meaning the regular arrow cursor (or another cursor set with @ref glfwSetCursor)
|
||||||
|
is used and cursor motion is not limited.
|
||||||
|
|
||||||
|
If you wish to implement mouse motion based camera controls or other input
|
||||||
|
schemes that require unlimited mouse movement, set the cursor mode to
|
||||||
|
`GLFW_CURSOR_DISABLED`.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This will hide the cursor and lock it to the specified window. GLFW will then
|
||||||
|
take care of all the details of cursor re-centering and offset calculation and
|
||||||
|
providing the application with a virtual cursor position. This virtual position
|
||||||
|
is provided normally via both the cursor position callback and through polling.
|
||||||
|
|
||||||
|
@note You should not implement your own version of this functionality using
|
||||||
|
other features of GLFW. It is not supported and will not work as robustly as
|
||||||
|
`GLFW_CURSOR_DISABLED`.
|
||||||
|
|
||||||
|
If you just wish the cursor to become hidden when it is over a window, set
|
||||||
|
the cursor mode to `GLFW_CURSOR_HIDDEN`.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This mode puts no limit on the motion of the cursor.
|
||||||
|
|
||||||
|
To exit out of either of these special modes, restore the `GLFW_CURSOR_NORMAL`
|
||||||
|
cursor mode.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection cursor_object Cursor objects
|
||||||
|
|
||||||
|
GLFW supports creating both custom and system theme cursor images, encapsulated
|
||||||
|
as @ref GLFWcursor objects. They are created with @ref glfwCreateCursor or @ref
|
||||||
|
glfwCreateStandardCursor and destroyed with @ref glfwDestroyCursor, or @ref
|
||||||
|
glfwTerminate, if any remain.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection cursor_custom Custom cursor creation
|
||||||
|
|
||||||
|
A custom cursor is created with @ref glfwCreateCursor, which returns a handle to
|
||||||
|
the created cursor object. For example, this creates a 16x16 white square
|
||||||
|
cursor with the hot-spot in the upper-left corner:
|
||||||
|
|
||||||
|
@code
|
||||||
|
unsigned char pixels[16 * 16 * 4];
|
||||||
|
memset(pixels, 0xff, sizeof(pixels));
|
||||||
|
|
||||||
|
GLFWimage image;
|
||||||
|
image.width = 16;
|
||||||
|
image.height = 16;
|
||||||
|
image.pixels = pixels;
|
||||||
|
|
||||||
|
GLFWcursor* cursor = glfwCreateCursor(&image, 0, 0);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If cursor creation fails, `NULL` will be returned, so it is necessary to check
|
||||||
|
the return value.
|
||||||
|
|
||||||
|
The image data is 32-bit RGBA, i.e. eight bits per channel. The pixels are
|
||||||
|
arranged canonically as sequential rows, starting from the top-left corner.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection cursor_standard Standard cursor creation
|
||||||
|
|
||||||
|
A cursor with a [standard shape](@ref shapes) from the current system cursor
|
||||||
|
theme can be can be created with @ref glfwCreateStandardCursor.
|
||||||
|
|
||||||
|
@code
|
||||||
|
GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
These cursor objects behave in the exact same way as those created with @ref
|
||||||
|
glfwCreateCursor except that the system cursor theme provides the actual image.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection cursor_destruction Cursor destruction
|
||||||
|
|
||||||
|
When a cursor is no longer needed, destroy it with @ref glfwDestroyCursor.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwDestroyCursor(cursor);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Cursor destruction always succeeds. All cursors remaining when @ref
|
||||||
|
glfwTerminate is called are destroyed as well.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection cursor_set Cursor setting
|
||||||
|
|
||||||
|
A cursor can be set as current for a window with @ref glfwSetCursor.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetCursor(window, cursor);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Once set, the cursor image will be used as long as the system cursor is over the
|
||||||
|
client area of the window and the [cursor mode](@ref cursor_mode) is set
|
||||||
|
to `GLFW_CURSOR_NORMAL`.
|
||||||
|
|
||||||
|
A single cursor may be set for any number of windows.
|
||||||
|
|
||||||
|
To remove a cursor from a window, set the cursor of that window to `NULL`.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetCursor(window, NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When a cursor is destroyed, it is removed from any window where it is set. This
|
||||||
|
does not affect the cursor modes of those windows.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection cursor_enter Cursor enter/leave events
|
||||||
|
|
||||||
|
If you wish to be notified when the cursor enters or leaves the client area of
|
||||||
|
a window, set a cursor enter/leave callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetCursorEnterCallback(window, cursor_enter_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives the new classification of the cursor.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void cursor_enter_callback(GLFWwindow* window, int entered)
|
||||||
|
{
|
||||||
|
if (entered)
|
||||||
|
{
|
||||||
|
// The cursor entered the client area of the window
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The cursor left the client area of the window
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection input_mouse_button Mouse button input
|
||||||
|
|
||||||
|
If you wish to be notified when a mouse button is pressed or released, set
|
||||||
|
a mouse button callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives the [mouse button](@ref buttons), button action
|
||||||
|
and [modifier bits](@ref mods).
|
||||||
|
|
||||||
|
@code
|
||||||
|
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
||||||
|
{
|
||||||
|
if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS)
|
||||||
|
popup_menu();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
|
Mouse button states for [named buttons](@ref buttons) are also saved in
|
||||||
|
per-window state arrays that can be polled with @ref glfwGetMouseButton.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
|
||||||
|
if (state == GLFW_PRESS)
|
||||||
|
upgrade_cow();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
|
This function only returns cached mouse button event state. It does not poll
|
||||||
|
the system for the current state of the mouse button.
|
||||||
|
|
||||||
|
Whenever you poll state, you risk missing the state change you are looking for.
|
||||||
|
If a pressed mouse button is released again before you poll its state, you will have
|
||||||
|
missed the button press. The recommended solution for this is to use a
|
||||||
|
mouse button callback, but there is also the `GLFW_STICKY_MOUSE_BUTTONS`
|
||||||
|
input mode.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, 1);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When sticky mouse buttons mode is enabled, the pollable state of a mouse button
|
||||||
|
will remain `GLFW_PRESS` until the state of that button is polled with @ref
|
||||||
|
glfwGetMouseButton. Once it has been polled, if a mouse button release event
|
||||||
|
had been processed in the meantime, the state will reset to `GLFW_RELEASE`,
|
||||||
|
otherwise it will remain `GLFW_PRESS`.
|
||||||
|
|
||||||
|
The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any
|
||||||
|
[named button](@ref buttons).
|
||||||
|
|
||||||
|
|
||||||
|
@subsection scrolling Scroll input
|
||||||
|
|
||||||
|
If you wish to be notified when the user scrolls, whether with a mouse wheel or
|
||||||
|
touchpad gesture, set a scroll callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetScrollCallback(window, scroll_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives two-dimensional scroll offsets.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
A simple mouse wheel, being vertical, provides offsets along the Y-axis.
|
||||||
|
|
||||||
|
|
||||||
|
@section joystick Joystick input
|
||||||
|
|
||||||
|
The joystick functions expose connected joysticks and controllers, with both
|
||||||
|
referred to as joysticks. It supports up to sixteen joysticks, ranging from
|
||||||
|
`GLFW_JOYSTICK_1`, `GLFW_JOYSTICK_2` up to `GLFW_JOYSTICK_LAST`. You can test
|
||||||
|
whether a [joystick](@ref joysticks) is present with @ref glfwJoystickPresent.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When GLFW is initialized, detected joysticks are added to to the beginning of
|
||||||
|
the array, starting with `GLFW_JOYSTICK_1`. Once a joystick is detected, it
|
||||||
|
keeps its assigned index until it is disconnected, so as joysticks are connected
|
||||||
|
and disconnected, they will become spread out.
|
||||||
|
|
||||||
|
Joystick state is updated as needed when a joystick function is called and does
|
||||||
|
not require a window to be created or @ref glfwPollEvents or @ref glfwWaitEvents
|
||||||
|
to be called.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection joystick_axis Joystick axis states
|
||||||
|
|
||||||
|
The positions of all axes of a joystick are returned by @ref
|
||||||
|
glfwGetJoystickAxes. See the reference documentation for the lifetime of the
|
||||||
|
returned array.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int count;
|
||||||
|
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &count);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Each element in the returned array is a value between -1.0 and 1.0.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection joystick_button Joystick button states
|
||||||
|
|
||||||
|
The states of all buttons of a joystick are returned by @ref
|
||||||
|
glfwGetJoystickButtons. See the reference documentation for the lifetime of the
|
||||||
|
returned array.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int count;
|
||||||
|
const unsigned char* axes = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &count);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Each element in the returned array is either `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection joystick_name Joystick name
|
||||||
|
|
||||||
|
The human-readable, UTF-8 encoded name of a joystick is returned by @ref
|
||||||
|
glfwGetJoystickName. See the reference documentation for the lifetime of the
|
||||||
|
returned string.
|
||||||
|
|
||||||
|
@code
|
||||||
|
const char* name = glfwGetJoystickName(GLFW_JOYSTICK_1);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Joystick names are not guaranteed to be unique. Two joysticks of the same model
|
||||||
|
and make may have the same name. Only the [joystick token](@ref joysticks) is
|
||||||
|
guaranteed to be unique, and only until that joystick is disconnected.
|
||||||
|
|
||||||
|
|
||||||
|
@section time Time input
|
||||||
|
|
||||||
|
GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
|
||||||
|
|
||||||
|
@code
|
||||||
|
double seconds = glfwGetTime();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
It returns the number of seconds since the timer was started when the library
|
||||||
|
was initialized with @ref glfwInit. The platform-specific time sources used
|
||||||
|
usually have micro- or nanosecond resolution.
|
||||||
|
|
||||||
|
You can modify the reference time with @ref glfwSetTime.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetTime(4.0);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This sets the timer to the specified time, in seconds.
|
||||||
|
|
||||||
|
|
||||||
|
@section clipboard Clipboard input and output
|
||||||
|
|
||||||
|
If the system clipboard contains a UTF-8 encoded string or if it can be
|
||||||
|
converted to one, you can retrieve it with @ref glfwGetClipboardString. See the
|
||||||
|
reference documentation for the lifetime of the returned string.
|
||||||
|
|
||||||
|
@code
|
||||||
|
const char* clipboard = glfwGetClipboardString(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The contents of the system clipboard can be set to a UTF-8 encoded string with
|
||||||
|
@ref glfwSetClipboardString.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetClipboardString(window, "A string with words in it");
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The clipboard functions take a window handle argument because some window
|
||||||
|
systems require a window to communicate with the system clipboard. Any valid
|
||||||
|
window may be used.
|
||||||
|
|
||||||
|
|
||||||
|
@section path_drop Path drop input
|
||||||
|
|
||||||
|
If you wish to receive the paths of files and/or directories dropped on
|
||||||
|
a window, set a file drop callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetDropCallback(window, drop_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives an array of paths encoded as UTF-8.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void drop_callback(GLFWwindow* window, int count, const char** paths)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
handle_dropped_file(paths[i]);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The path array and its strings are only valid until the file drop callback
|
||||||
|
returns, as they may have been generated specifically for that event. You need
|
||||||
|
to make a deep copy of the array if you want to keep the paths.
|
||||||
|
|
||||||
|
*/
|
||||||
+8
-8
@@ -57,10 +57,10 @@ Examples: @ref _glfwIsValidContextConfig, @ref _GLFWwindow, `_glfw.currentRamp`
|
|||||||
|
|
||||||
The platform interface implements all platform-specific operations as a service
|
The platform interface implements all platform-specific operations as a service
|
||||||
to the public interface. This includes event processing. The platform
|
to the public interface. This includes event processing. The platform
|
||||||
interface is never directly called by users of GLFW and never directly calls the
|
interface is never directly called by application code and never directly calls
|
||||||
user's code. It is also prohibited from modifying the platform-independent part
|
application-provided callbacks. It is also prohibited from modifying the
|
||||||
of the internal structs. Instead, it calls the event interface when events
|
platform-independent part of the internal structs. Instead, it calls the event
|
||||||
interesting to GLFW are received.
|
interface when events interesting to GLFW are received.
|
||||||
|
|
||||||
The platform interface mirrors those parts of the public interface that needs to
|
The platform interface mirrors those parts of the public interface that needs to
|
||||||
perform platform-specific operations on some or all platforms. The are also
|
perform platform-specific operations on some or all platforms. The are also
|
||||||
@@ -85,8 +85,8 @@ Examples: `window.win32.handle`, `_glfw.x11.display`
|
|||||||
@section internals_event Event interface
|
@section internals_event Event interface
|
||||||
|
|
||||||
The event interface is implemented in the same shared source files as the public
|
The event interface is implemented in the same shared source files as the public
|
||||||
interface and is responsible for delivering the events it receives to the user,
|
interface and is responsible for delivering the events it receives to the
|
||||||
either via callbacks, via window state changes or both.
|
application, either via callbacks, via window state changes or both.
|
||||||
|
|
||||||
The function names of the event interface use a `_glfwInput` prefix and the
|
The function names of the event interface use a `_glfwInput` prefix and the
|
||||||
ObjectEvent pattern.
|
ObjectEvent pattern.
|
||||||
@@ -105,8 +105,8 @@ Examples: `clearScrollOffsets`
|
|||||||
@section internals_config Configuration macros
|
@section internals_config Configuration macros
|
||||||
|
|
||||||
GLFW uses a number of configuration macros to select at compile time which
|
GLFW uses a number of configuration macros to select at compile time which
|
||||||
interfaces and code paths to use. They are defined in the config.h header file,
|
interfaces and code paths to use. They are defined in the glfw_config.h header file,
|
||||||
which is generated from the `config.h.in` file by CMake.
|
which is generated from the `glfw_config.h.in` file by CMake.
|
||||||
|
|
||||||
Configuration macros the same style as tokens in the public interface, except
|
Configuration macros the same style as tokens in the public interface, except
|
||||||
with a leading underscore.
|
with a leading underscore.
|
||||||
|
|||||||
+351
@@ -0,0 +1,351 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
@page intro Introduction to the API
|
||||||
|
|
||||||
|
@tableofcontents
|
||||||
|
|
||||||
|
This guide introduces the basic concepts of GLFW and describes initialization,
|
||||||
|
error handling and API guarantees and limitations. For a broad but shallow
|
||||||
|
tutorial, see @ref quick instead. There are also guides for the other areas of
|
||||||
|
GLFW.
|
||||||
|
|
||||||
|
- @ref window
|
||||||
|
- @ref context
|
||||||
|
- @ref monitor
|
||||||
|
- @ref input
|
||||||
|
|
||||||
|
|
||||||
|
@section intro_init Initialization and termination
|
||||||
|
|
||||||
|
Before most GLFW functions may be called, the library must be initialized.
|
||||||
|
This initialization checks what features are available on the machine,
|
||||||
|
enumerates monitors and joysticks, initializes the timer and performs any
|
||||||
|
required platform-specific initialization.
|
||||||
|
|
||||||
|
Only the following functions may be called before the library has been
|
||||||
|
successfully initialized, and only from the main thread.
|
||||||
|
|
||||||
|
- @ref glfwGetVersion
|
||||||
|
- @ref glfwGetVersionString
|
||||||
|
- @ref glfwSetErrorCallback
|
||||||
|
- @ref glfwInit
|
||||||
|
- @ref glfwTerminate
|
||||||
|
|
||||||
|
Calling any other function before that time will cause a @ref
|
||||||
|
GLFW_NOT_INITIALIZED error.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection intro_init_init Initializing GLFW
|
||||||
|
|
||||||
|
The library is initialized with @ref glfwInit, which returns `GL_FALSE` if an
|
||||||
|
error occurred.
|
||||||
|
|
||||||
|
@code
|
||||||
|
if (!glfwInit())
|
||||||
|
{
|
||||||
|
// Handle initialization failure
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If any part of initialization fails, all remaining bits are terminated as if
|
||||||
|
@ref glfwTerminate was called. The library only needs to be initialized once
|
||||||
|
and additional calls to an already initialized library will simply return
|
||||||
|
`GL_TRUE` immediately.
|
||||||
|
|
||||||
|
Once the library has been successfully initialized, it should be terminated
|
||||||
|
before the application exits.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection intro_init_terminate Terminating GLFW
|
||||||
|
|
||||||
|
Before your application exits, you should terminate the GLFW library if it has
|
||||||
|
been initialized. This is done with @ref glfwTerminate.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwTerminate();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This will destroy any remaining window, monitor and cursor objects, restore any
|
||||||
|
modified gamma ramps, re-enable the screensaver if it had been disabled and free
|
||||||
|
any resources allocated by GLFW.
|
||||||
|
|
||||||
|
Once the library is terminated, it is as if it had never been initialized and
|
||||||
|
you will need to initialize it again before being able to use GLFW. If the
|
||||||
|
library was not initialized or had already been terminated, it return
|
||||||
|
immediately.
|
||||||
|
|
||||||
|
|
||||||
|
@section error_handling Error handling
|
||||||
|
|
||||||
|
Some GLFW functions have return values that indicate an error, but this is often
|
||||||
|
not very helpful when trying to figure out _why_ the error occurred. Some
|
||||||
|
functions also return otherwise valid values on error. Finally, far from all
|
||||||
|
GLFW functions have return values.
|
||||||
|
|
||||||
|
This is where the error callback comes in. This callback is called whenever an
|
||||||
|
error occurs. It is set with @ref glfwSetErrorCallback, a function that may be
|
||||||
|
called regardless of whether GLFW is initialized.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetErrorCallback(error_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The error callback receives a human-readable description of the error and (when
|
||||||
|
possible) its cause. The description encoded as UTF-8. The callback is also
|
||||||
|
provided with an [error code](@ref errors).
|
||||||
|
|
||||||
|
@code
|
||||||
|
void error_callback(int error, const char* description)
|
||||||
|
{
|
||||||
|
puts(description);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The error code indicates the general category of the error. Some error codes,
|
||||||
|
such as @ref GLFW_NOT_INITIALIZED has only a single meaning, whereas others like
|
||||||
|
@ref GLFW_PLATFORM_ERROR are used for many different errors.
|
||||||
|
|
||||||
|
The description string is only valid until the error callback returns, as it may
|
||||||
|
have been generated specifically for that error. This lets GLFW provide much
|
||||||
|
more specific error descriptions but means you must make a copy if you want to
|
||||||
|
keep the description string.
|
||||||
|
|
||||||
|
@note Relying on erroneous behavior is not forward compatible. In other words,
|
||||||
|
do not rely on a currently invalid call to generate a specific error, as that
|
||||||
|
same call may in future versions generate a different error or become valid.
|
||||||
|
|
||||||
|
|
||||||
|
@section coordinate_systems Coordinate systems
|
||||||
|
|
||||||
|
GLFW has two primary coordinate systems: the _virtual screen_ and the window
|
||||||
|
_client area_ or _content area_. Both use the same unit: _virtual screen
|
||||||
|
coordinates_, or just _screen coordinates_, which don't necessarily correspond
|
||||||
|
to pixels.
|
||||||
|
|
||||||
|
<img src="spaces.svg" width="90%" />
|
||||||
|
|
||||||
|
Both the virtual screen and the client area coordinate systems have the X-axis
|
||||||
|
pointing to the right and the Y-axis pointing down.
|
||||||
|
|
||||||
|
Window and monitor positions are specified as the position of the upper-left
|
||||||
|
corners of their content areas relative to the virtual screen, while cursor
|
||||||
|
positions are specified relative to a window's client area.
|
||||||
|
|
||||||
|
Because the origin of the window's client area coordinate system is also the
|
||||||
|
point from which the window position is specified, you can translate client area
|
||||||
|
coordinates to the virtual screen by adding the window position. The window
|
||||||
|
frame, when present, extends out from the client area but does not affect the
|
||||||
|
window position.
|
||||||
|
|
||||||
|
Almost all positions and sizes in GLFW are measured in screen coordinates
|
||||||
|
relative to one of the two origins above. This includes cursor positions,
|
||||||
|
window positions and sizes, window frame sizes, monitor positions and video mode
|
||||||
|
resolutions.
|
||||||
|
|
||||||
|
Two exceptions are the [monitor physical size](@ref monitor_size), which is
|
||||||
|
measured in millimetres, and [framebuffer size](@ref window_fbsize), which is
|
||||||
|
measured in pixels.
|
||||||
|
|
||||||
|
Pixels and screen coordinates may map 1:1 on your machine, but they won't on
|
||||||
|
every other machine, for example on a Mac with a Retina display. The ratio
|
||||||
|
between screen coordinates and pixels may also change at run-time depending on
|
||||||
|
which monitor the window is currently considered to be on.
|
||||||
|
|
||||||
|
|
||||||
|
@section guarantees_limitations Guarantees and limitations
|
||||||
|
|
||||||
|
This section describes the conditions under which GLFW can be expected to
|
||||||
|
function, barring bugs in the operating system or drivers. Use of GLFW outside
|
||||||
|
of these limits may work on some platforms, or on some machines, or some of the
|
||||||
|
time, or on some versions of GLFW, but it may break at any time and this will
|
||||||
|
not be considered a bug.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection lifetime Pointer lifetimes
|
||||||
|
|
||||||
|
GLFW will never free any pointer you provide to it and you must never free any
|
||||||
|
pointer it provides to you.
|
||||||
|
|
||||||
|
Many GLFW functions return pointers to dynamically allocated structures, strings
|
||||||
|
or arrays, and some callbacks are provided with strings or arrays. These are
|
||||||
|
always managed by GLFW and should never be freed by the application. The
|
||||||
|
lifetime of these pointers is documented for each GLFW function and callback.
|
||||||
|
If you need to keep this data, you must copy it before its lifetime expires.
|
||||||
|
|
||||||
|
Many GLFW functions accept pointers to structures or strings allocated by the
|
||||||
|
application. These are never freed by GLFW and are always the responsibility of
|
||||||
|
the application. If GLFW needs to keep the data in these structures or strings,
|
||||||
|
it is copied before the function returns.
|
||||||
|
|
||||||
|
Pointer lifetimes are guaranteed not to be shortened in future minor or patch
|
||||||
|
releases.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection reentrancy Reentrancy
|
||||||
|
|
||||||
|
GLFW event processing and object creation and destruction are not reentrant.
|
||||||
|
This means that the following functions may not be called from any callback
|
||||||
|
function:
|
||||||
|
|
||||||
|
- @ref glfwCreateWindow
|
||||||
|
- @ref glfwDestroyWindow
|
||||||
|
- @ref glfwCreateCursor
|
||||||
|
- @ref glfwCreateStandardCursor
|
||||||
|
- @ref glfwDestroyCursor
|
||||||
|
- @ref glfwPollEvents
|
||||||
|
- @ref glfwWaitEvents
|
||||||
|
- @ref glfwTerminate
|
||||||
|
|
||||||
|
These functions may be made reentrant in future minor or patch releases, but
|
||||||
|
functions not on this list will not be made non-reentrant.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection thread_safety Thread safety
|
||||||
|
|
||||||
|
Most GLFW functions may only be called from the main thread, but some may be
|
||||||
|
called from any thread. However, no GLFW function may be called from any other
|
||||||
|
thread until GLFW has been successfully initialized on the main thread,
|
||||||
|
including functions that may called before initialization.
|
||||||
|
|
||||||
|
The reference documentation for every GLFW function states whether it is limited
|
||||||
|
to the main thread.
|
||||||
|
|
||||||
|
The following categories of functions are and will remain limited to the main
|
||||||
|
thread due to the limitations of one or several platforms:
|
||||||
|
|
||||||
|
- Initialization and termination
|
||||||
|
- Event processing
|
||||||
|
- Creation and destruction of window, context and cursor objects
|
||||||
|
|
||||||
|
Because event processing must be performed on the main thread, all callbacks
|
||||||
|
except for the error callback will only be called on that thread. The error
|
||||||
|
callback may be called on any thread, as any GLFW function may generate errors.
|
||||||
|
|
||||||
|
The posting of empty events may be done from any thread. The window user
|
||||||
|
pointer and close flag may also be accessed and modified from any thread, but
|
||||||
|
this is not synchronized by GLFW. The following window related functions may
|
||||||
|
be called from any thread:
|
||||||
|
|
||||||
|
- @ref glfwPostEmptyEvent
|
||||||
|
- @ref glfwGetWindowUserPointer
|
||||||
|
- @ref glfwSetWindowUserPointer
|
||||||
|
- @ref glfwWindowShouldClose
|
||||||
|
- @ref glfwSetWindowShouldClose
|
||||||
|
|
||||||
|
Rendering may be done on any thread. The following context related functions
|
||||||
|
may be called from any thread:
|
||||||
|
|
||||||
|
- @ref glfwMakeContextCurrent
|
||||||
|
- @ref glfwGetCurrentContext
|
||||||
|
- @ref glfwSwapBuffers
|
||||||
|
- @ref glfwSwapInterval
|
||||||
|
- @ref glfwExtensionSupported
|
||||||
|
- @ref glfwGetProcAddress
|
||||||
|
|
||||||
|
The timer may be accessed from any thread, but this is not synchronized by GLFW.
|
||||||
|
The following timer related functions may be called from any thread:
|
||||||
|
|
||||||
|
- @ref glfwGetTime
|
||||||
|
|
||||||
|
Library version information may be queried from any thread. The following
|
||||||
|
version related functions may be called from any thread:
|
||||||
|
|
||||||
|
- @ref glfwGetVersion
|
||||||
|
- @ref glfwGetVersionString
|
||||||
|
|
||||||
|
GLFW uses no synchronization objects internally except for thread-local storage
|
||||||
|
to keep track of the current context for each thread. Synchronization is left
|
||||||
|
to the application.
|
||||||
|
|
||||||
|
Functions that may currently be called from any thread will always remain so,
|
||||||
|
but functions that are currently limited to the main may be updated to allow
|
||||||
|
calls from any thread in future releases.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compatibility Version compatibility
|
||||||
|
|
||||||
|
GLFW guarantees binary backward compatibility with earlier minor versions of the
|
||||||
|
API. This means that you can drop in a newer version of the GLFW DLL / shared
|
||||||
|
library / dynamic library and existing applications will continue to run.
|
||||||
|
|
||||||
|
Once a function or constant has been added, the signature of that function or
|
||||||
|
value of that constant will remain unchanged until the next major version of
|
||||||
|
GLFW. No compatibility of any kind is guaranteed between major versions.
|
||||||
|
|
||||||
|
Undocumented behavior, i.e. behavior that is not described in the documentation,
|
||||||
|
may change at any time until it is documented.
|
||||||
|
|
||||||
|
If the reference documentation and the implementation differ, the reference
|
||||||
|
documentation is correct and the implementation will be fixed in the next
|
||||||
|
release.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection event_order Event order
|
||||||
|
|
||||||
|
The order of arrival of related events is not guaranteed to be consistent
|
||||||
|
across platforms. The exception is synthetic key and mouse button release
|
||||||
|
events, which are always delivered after the window defocus event.
|
||||||
|
|
||||||
|
|
||||||
|
@section intro_version Version management
|
||||||
|
|
||||||
|
GLFW provides mechanisms for identifying what version of GLFW your application
|
||||||
|
was compiled against as well as what version it is currently running against.
|
||||||
|
If you are loading GLFW dynamically (not just linking dynamically), you can use
|
||||||
|
this to verify that the library binary is compatible with your application.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection intro_version_compile Compile-time version
|
||||||
|
|
||||||
|
The compile-time version of GLFW is provided by the GLFW header with the
|
||||||
|
`GLFW_VERSION_MAJOR`, `GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` macros.
|
||||||
|
|
||||||
|
@code
|
||||||
|
printf("Compiled against GLFW %i.%i.%i\n",
|
||||||
|
GLFW_VERSION_MAJOR,
|
||||||
|
GLFW_VERSION_MINOR,
|
||||||
|
GLFW_VERSION_REVISION);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection intro_version_runtime Run-time version
|
||||||
|
|
||||||
|
The run-time version can be retrieved with @ref glfwGetVersion, a function that
|
||||||
|
may be called regardless of whether GLFW is initialized.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int major, minor, revision;
|
||||||
|
glfwGetVersion(&major, &minor, &revision);
|
||||||
|
|
||||||
|
printf("Running against GLFW %i.%i.%i\n", major, minor, revision);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection intro_version_string Version string
|
||||||
|
|
||||||
|
GLFW 3 also provides a compile-time generated version string that describes the
|
||||||
|
version, platform, compiler and any platform-specific compile-time options.
|
||||||
|
This is primarily intended for submitting bug reports, to allow developers to
|
||||||
|
see which code paths are enabled in a binary.
|
||||||
|
|
||||||
|
The version string is returned by @ref glfwGetVersionString, a function that may
|
||||||
|
be called regardless of whether GLFW is initialized.
|
||||||
|
|
||||||
|
__Do not use the version string__ to parse the GLFW library version. The @ref
|
||||||
|
glfwGetVersion function already provides the version of the running library
|
||||||
|
binary.
|
||||||
|
|
||||||
|
The format of the string is as follows:
|
||||||
|
- The version of GLFW
|
||||||
|
- The name of the window system API
|
||||||
|
- The name of the context creation API
|
||||||
|
- Any additional options or APIs
|
||||||
|
|
||||||
|
For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL
|
||||||
|
back ends, the version string may look something like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
3.0.0 Win32 WGL MinGW
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
*/
|
||||||
+35
-10
@@ -4,19 +4,44 @@
|
|||||||
|
|
||||||
@section main_intro Introduction
|
@section main_intro Introduction
|
||||||
|
|
||||||
GLFW is a free, Open Source, multi-platform library for opening a window,
|
__GLFW__ is a free, Open Source, multi-platform library for creating windows
|
||||||
creating an OpenGL context and managing input. It is easy to integrate into
|
with OpenGL or OpenGL ES contexts and receiving many kinds of input. It is easy
|
||||||
existing applications and does not lay claim to the main loop.
|
to integrate into existing applications and does not lay claim to the main loop.
|
||||||
|
|
||||||
This is the documentation for version 3.0, which has [many new features](@ref news).
|
See @ref news_31 for release highlights or the
|
||||||
|
[version history](http://www.glfw.org/changelog.html) for details.
|
||||||
|
|
||||||
There is a [quick tutorial](@ref quick) for people new to GLFW, which shows how
|
@ref quick is a guide for those new to GLFW. It takes you through how to write
|
||||||
to write a small but complete program.
|
a small but complete program. For people coming from GLFW 2, the @ref moving
|
||||||
|
guide explains what has changed and how to update existing code to use the new
|
||||||
|
API.
|
||||||
|
|
||||||
If you have used GLFW 2.x in the past, there is a
|
There are guides for each of the various areas of the API.
|
||||||
[transition guide](@ref moving) that explains what has changed and how to update
|
|
||||||
existing code to use the new API.
|
|
||||||
|
|
||||||
As this is still unfinished software, there are still [a number of bugs](@ref bug).
|
- @ref intro – initialization, error handling and high-level design
|
||||||
|
- @ref window – creating and working with windows and framebuffers
|
||||||
|
- @ref context – working with OpenGL and OpenGL ES contexts
|
||||||
|
- @ref monitor – enumerating and working with monitors and video modes
|
||||||
|
- @ref input – receiving events, polling and processing input
|
||||||
|
|
||||||
|
Once you have written a program, see the @ref compile and @ref build guides.
|
||||||
|
|
||||||
|
The [reference documentation](modules.html) provides more detailed information
|
||||||
|
about specific functions.
|
||||||
|
|
||||||
|
There is a section on @ref guarantees_limitations for pointer lifetimes,
|
||||||
|
reentrancy, thread safety, event order and backward and forward compatibility.
|
||||||
|
|
||||||
|
The @ref rift fills in the gaps for how to use LibOVR with GLFW.
|
||||||
|
|
||||||
|
The [FAQ](http://www.glfw.org/faq.html) answers many common questions about the
|
||||||
|
design, implementation and use of GLFW.
|
||||||
|
|
||||||
|
Finally, the @ref compat guide explains what APIs, standards and protocols GLFW
|
||||||
|
uses and what happens when they are not present on a given machine.
|
||||||
|
|
||||||
|
This documentation was generated with Doxygen. The sources for it are available
|
||||||
|
in both the [source distribution](http://www.glfw.org/download.html) and
|
||||||
|
[GitHub repository](https://github.com/glfw/glfw).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
+131
-23
@@ -1,16 +1,43 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
@page monitor Multi-monitor guide
|
@page monitor Monitor guide
|
||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
|
This guide introduces the monitor related functions of GLFW. There are also
|
||||||
|
guides for the other areas of GLFW.
|
||||||
|
|
||||||
@section monitor_objects Monitor objects
|
- @ref intro
|
||||||
|
- @ref window
|
||||||
|
- @ref context
|
||||||
|
- @ref input
|
||||||
|
|
||||||
The @ref GLFWmonitor object represents a currently connected monitor.
|
|
||||||
|
|
||||||
The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is usually
|
@section monitor_object Monitor objects
|
||||||
the user's preferred monitor and the one with global UI elements like task bar
|
|
||||||
|
A monitor object represents a currently connected monitor and is represented as
|
||||||
|
a pointer to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type
|
||||||
|
@ref GLFWmonitor. Monitor objects cannot be created or destroyed by the
|
||||||
|
application and retain their addresses until the monitors they represent are
|
||||||
|
disconnected or until the library is [terminated](@ref intro_init_terminate).
|
||||||
|
|
||||||
|
Each monitor has a current video mode, a list of supported video modes,
|
||||||
|
a virtual position, a human-readable name, an estimated physical size and
|
||||||
|
a gamma ramp. One of the monitors is the primary monitor.
|
||||||
|
|
||||||
|
The virtual position of a monitor is in
|
||||||
|
[screen coordinates](@ref coordinate_systems) and, together with the current
|
||||||
|
video mode, describes the viewports that the connected monitors provide into the
|
||||||
|
virtual desktop that spans them.
|
||||||
|
|
||||||
|
To see how GLFW views your monitor setup and its available video modes, run the
|
||||||
|
`monitors` test program.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection monitor_monitors Retrieving monitors
|
||||||
|
|
||||||
|
The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is the user's
|
||||||
|
preferred monitor and is usually the one with global UI elements like task bar
|
||||||
or menu bar.
|
or menu bar.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
@@ -18,68 +45,149 @@ GLFWmonitor* primary = glfwGetPrimaryMonitor();
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
You can retrieve all currently connected monitors with @ref glfwGetMonitors.
|
You can retrieve all currently connected monitors with @ref glfwGetMonitors.
|
||||||
|
See the reference documentation for the lifetime of the returned array.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int count;
|
int count;
|
||||||
GLFWmonitor** monitors = glfwGetMonitors(&count);
|
GLFWmonitor** monitors = glfwGetMonitors(&count);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The primary monitor is always the first monitor in the returned array, but other
|
||||||
|
monitors may be moved to a different index when a monitor is connected or
|
||||||
|
disconnected.
|
||||||
|
|
||||||
@section monitor_modes Querying video modes
|
|
||||||
|
|
||||||
Although GLFW generally does a good job at selecting a suitable video
|
@subsection monitor_event Monitor configuration changes
|
||||||
mode for you when you open a full screen window, it is sometimes useful to
|
|
||||||
know exactly which modes are available on a certain system. For example,
|
If you wish to be notified when a monitor is connected or disconnected, set
|
||||||
you may want to present the user with a list of video modes to select
|
a monitor callback.
|
||||||
from. To get a list of available video modes, you can use the function
|
|
||||||
@ref glfwGetVideoModes.
|
@code
|
||||||
|
glfwSetMonitorCallback(monitor_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives the handle for the monitor that has been
|
||||||
|
connected or disconnected and a monitor action.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The action is one of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
|
||||||
|
|
||||||
|
|
||||||
|
@section monitor_properties Monitor properties
|
||||||
|
|
||||||
|
Each monitor has a current video mode, a list of supported video modes,
|
||||||
|
a virtual position, a human-readable name, an estimated physical size and
|
||||||
|
a gamma ramp.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection monitor_modes Video modes
|
||||||
|
|
||||||
|
GLFW generally does a good job selecting a suitable video mode when you create
|
||||||
|
a full screen window, but it is sometimes useful to know exactly which video
|
||||||
|
modes are supported.
|
||||||
|
|
||||||
|
Video modes are represented as @ref GLFWvidmode structures. You can get an
|
||||||
|
array of the video modes supported by a monitor with @ref glfwGetVideoModes.
|
||||||
|
See the reference documentation for the lifetime of the returned array.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int count;
|
int count;
|
||||||
GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
To get the current video mode of a monitor call @ref glfwGetVideoMode.
|
To get the current video mode of a monitor call @ref glfwGetVideoMode. See the
|
||||||
|
reference documentation for the lifetime of the returned pointer.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The resolution of a video mode is specified in
|
||||||
|
[screen coordinates](@ref coordinate_systems), not pixels.
|
||||||
|
|
||||||
@section monitor_size Monitor physical size
|
|
||||||
|
|
||||||
The physical size in millimetres of a monitor, or an approximation of it, can be
|
@subsection monitor_size Physical size
|
||||||
retrieved with @ref glfwGetMonitorPhysicalSize. This can, for example, be used
|
|
||||||
together with the current video mode to calculate DPI.
|
The physical size of a monitor in millimetres, or an estimation of it, can be
|
||||||
|
retrieved with @ref glfwGetMonitorPhysicalSize. This has no relation to its
|
||||||
|
current _resolution_, i.e. the width and height of its current
|
||||||
|
[video mode](@ref monitor_modes).
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int widthMM, heightMM;
|
int widthMM, heightMM;
|
||||||
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
This can, for example, be used together with the current video mode to calculate
|
||||||
|
the DPI of a monitor.
|
||||||
|
|
||||||
@section monitor_name Monitor name
|
@code
|
||||||
|
const double dpi = mode->width / (widthMM / 25.4);
|
||||||
|
@endcode
|
||||||
|
|
||||||
The name of a monitor is returned by @ref glfwGetMonitorName.
|
|
||||||
|
@subsection monitor_pos Virtual position
|
||||||
|
|
||||||
|
The position of the monitor on the virtual desktop, in
|
||||||
|
[screen coordinates](@ref coordinate_systems), can be retrieved with @ref
|
||||||
|
glfwGetMonitorPos.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int xpos, ypos;
|
||||||
|
glfwGetMonitorPos(monitor, &xpos, &ypos);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection monitor_name Human-readable name
|
||||||
|
|
||||||
|
The human-readable, UTF-8 encoded name of a monitor is returned by @ref
|
||||||
|
glfwGetMonitorName. See the reference documentation for the lifetime of the
|
||||||
|
returned string.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
const char* name = glfwGetMonitorName(monitor);
|
const char* name = glfwGetMonitorName(monitor);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The monitor name is a regular C string using the UTF-8 encoding. Note that
|
Monitor names are not guaranteed to be unique. Two monitors of the same model
|
||||||
monitor names are not guaranteed to be unique.
|
and make may have the same name. Only the monitor handle is guaranteed to be
|
||||||
|
unique, and only until that monitor is disconnected.
|
||||||
|
|
||||||
|
|
||||||
@section monitor_gamma Monitor gamma ramp
|
@subsection monitor_gamma Gamma ramp
|
||||||
|
|
||||||
The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts
|
The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts
|
||||||
a monitor handle and a pointer to a @ref GLFWgammaramp structure.
|
a monitor handle and a pointer to a @ref GLFWgammaramp structure.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
GLFWgammaramp ramp;
|
||||||
|
unsigned short red[256], green[256], blue[256];
|
||||||
|
|
||||||
|
ramp.size = 256;
|
||||||
|
ramp.red = red;
|
||||||
|
ramp.green = green;
|
||||||
|
ramp.blue = blue;
|
||||||
|
|
||||||
|
for (i = 0; i < ramp.size; i++)
|
||||||
|
{
|
||||||
|
// Fill out gamma ramp arrays as desired
|
||||||
|
}
|
||||||
|
|
||||||
glfwSetGammaRamp(monitor, &ramp);
|
glfwSetGammaRamp(monitor, &ramp);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp.
|
The gamma ramp data is copied before the function returns, so there is no need
|
||||||
|
to keep it around once the ramp has been set.
|
||||||
|
|
||||||
|
@note It is recommended to use gamma ramps of size 256, as that is the size
|
||||||
|
supported by all graphics cards on all platforms.
|
||||||
|
|
||||||
|
The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp. See
|
||||||
|
the reference documentation for the lifetime of the returned structure.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
|
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
|
||||||
|
|||||||
+355
-169
@@ -5,55 +5,279 @@
|
|||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
This is a transition guide for moving from GLFW 2 to 3. It describes what has
|
This is a transition guide for moving from GLFW 2 to 3. It describes what has
|
||||||
changed or been removed, but does *not* include
|
changed or been removed, but does _not_ include
|
||||||
[new features](@ref news) unless they are required when moving an existing code
|
[new features](@ref news) unless they are required when moving an existing code
|
||||||
base onto the new API. For example, use of the new multi-monitor functions are
|
base onto the new API. For example, the new multi-monitor functions are
|
||||||
required to create full screen windows with GLFW 3.
|
required to create full screen windows with GLFW 3.
|
||||||
|
|
||||||
|
|
||||||
@section moving_removed Removed features
|
@section moving_removed Changed and removed features
|
||||||
|
|
||||||
@subsection moving_threads Threading functions
|
@subsection moving_renamed_files Renamed library and header file
|
||||||
|
|
||||||
The threading functions have been removed, including the sleep function. They
|
The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to
|
||||||
were fairly primitive, under-used, poorly integrated and took time away from the
|
avoid collisions with the headers of other major versions. Similarly, the GLFW
|
||||||
focus of GLFW (i.e. context, input and window). There are better threading
|
3 library is named `glfw3,` except when it's installed as a shared library on
|
||||||
libraries available and native threading support is available in both C++11 and
|
Unix-like systems, where it uses the
|
||||||
C11, both of which are gaining traction.
|
[soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`.
|
||||||
|
|
||||||
|
@par Old syntax
|
||||||
|
@code
|
||||||
|
#include <GL/glfw.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_threads Removal of threading functions
|
||||||
|
|
||||||
|
The threading functions have been removed, including the per-thread sleep
|
||||||
|
function. They were fairly primitive, under-used, poorly integrated and took
|
||||||
|
time away from the focus of GLFW (i.e. context, input and window). There are
|
||||||
|
better threading libraries available and native threading support is available
|
||||||
|
in both [C++11](http://en.cppreference.com/w/cpp/thread) and
|
||||||
|
[C11](http://en.cppreference.com/w/c/thread), both of which are gaining
|
||||||
|
traction.
|
||||||
|
|
||||||
If you wish to use the C++11 or C11 facilities but your compiler doesn't yet
|
If you wish to use the C++11 or C11 facilities but your compiler doesn't yet
|
||||||
support them, see the
|
support them, see the
|
||||||
[TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and
|
[TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and
|
||||||
[TinyCThread](https://gitorious.org/tinythread/tinycthread) projects created by
|
[TinyCThread](https://github.com/tinycthread/tinycthread) projects created by
|
||||||
the original author of GLFW. These libraries implement a usable subset of the
|
the original author of GLFW. These libraries implement a usable subset of the
|
||||||
threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use
|
threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use
|
||||||
TinyCThread.
|
TinyCThread.
|
||||||
|
|
||||||
However, GLFW 3 has better support for *use from multiple threads* than GLFW
|
However, GLFW 3 has better support for _use from multiple threads_ than GLFW
|
||||||
2 had. Contexts can be made current on and rendered with from secondary
|
2 had. Contexts can be made current on any thread, although only a single
|
||||||
threads, and the documentation explicitly states which functions may be used
|
thread at a time, and the documentation explicitly states which functions may be
|
||||||
from secondary threads and which may only be used from the main thread, i.e. the
|
used from any thread and which may only be used from the main thread.
|
||||||
thread that calls main.
|
|
||||||
|
@par Removed functions
|
||||||
|
`glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`,
|
||||||
|
`glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`,
|
||||||
|
`glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`,
|
||||||
|
`glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_image Image and texture loading
|
@subsection moving_image Removal of image and texture loading
|
||||||
|
|
||||||
The image and texture loading functions have been removed. They only supported
|
The image and texture loading functions have been removed. They only supported
|
||||||
the Targa image format, making them mostly useful for beginner level examples.
|
the Targa image format, making them mostly useful for beginner level examples.
|
||||||
To become of sufficiently high quality to warrant keeping them in GLFW 3, they
|
To become of sufficiently high quality to warrant keeping them in GLFW 3, they
|
||||||
would need not only to support other formats, but also modern extensions to the
|
would need not only to support other formats, but also modern extensions to
|
||||||
OpenGL texturing facilities. This would either add a number of external
|
OpenGL texturing. This would either add a number of external
|
||||||
dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions
|
dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions
|
||||||
of these libraries.
|
of these libraries.
|
||||||
|
|
||||||
As there already are libraries doing this, it seems unnecessary both to
|
As there already are libraries doing this, it is unnecessary both to duplicate
|
||||||
duplicate this work and to tie this duplicate to GLFW. Projects similar to
|
the work and to tie the duplicate to GLFW. The resulting library would also be
|
||||||
GLFW, such as freeglut, could also gain from such a library. Also, would be no
|
platform-independent, as both OpenGL and stdio are available wherever GLFW is.
|
||||||
platform-specific part of such a library, as both OpenGL and stdio are available
|
|
||||||
wherever GLFW is.
|
@par Removed functions
|
||||||
|
`glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`,
|
||||||
|
`glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_char_up Character actions
|
@subsection moving_stdcall Removal of GLFWCALL macro
|
||||||
|
|
||||||
|
The `GLFWCALL` macro, which made callback functions use
|
||||||
|
[__stdcall](http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows,
|
||||||
|
has been removed. GLFW is written in C, not Pascal. Removing this macro means
|
||||||
|
there's one less thing for application programmers to remember, i.e. the
|
||||||
|
requirement to mark all callback functions with `GLFWCALL`. It also simplifies
|
||||||
|
the creation of DLLs and DLL link libraries, as there's no need to explicitly
|
||||||
|
disable `@n` entry point suffixes.
|
||||||
|
|
||||||
|
@par Old syntax
|
||||||
|
@code
|
||||||
|
void GLFWCALL callback_function(...);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
void callback_function(...);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_window_handles Window handle parameters
|
||||||
|
|
||||||
|
Because GLFW 3 supports multiple windows, window handle parameters have been
|
||||||
|
added to all window-related GLFW functions and callbacks. The handle of
|
||||||
|
a newly created window is returned by @ref glfwCreateWindow (formerly
|
||||||
|
`glfwOpenWindow`). Window handles are pointers to the
|
||||||
|
[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWwindow.
|
||||||
|
|
||||||
|
@par Old syntax
|
||||||
|
@code
|
||||||
|
glfwSetWindowTitle("New Window Title");
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
glfwSetWindowTitle(window, "New Window Title");
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_monitor Explicit monitor selection
|
||||||
|
|
||||||
|
GLFW 3 provides support for multiple monitors. To request a full screen mode window,
|
||||||
|
instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the
|
||||||
|
window to use. The @ref glfwGetPrimaryMonitor function returns the monitor that
|
||||||
|
GLFW 2 would have selected, but there are many other
|
||||||
|
[monitor functions](@ref monitor). Monitor handles are pointers to the
|
||||||
|
[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWmonitor.
|
||||||
|
|
||||||
|
@par Old basic full screen
|
||||||
|
@code
|
||||||
|
glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_FULLSCREEN);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New basic full screen
|
||||||
|
@code
|
||||||
|
window = glfwCreateWindow(640, 480, "My Window", glfwGetPrimaryMonitor(), NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@note The framebuffer bit depth parameters of `glfwOpenWindow` have been turned
|
||||||
|
into [window hints](@ref window_hints), but as they have been given
|
||||||
|
[sane defaults](@ref window_hints_values) you rarely need to set these hints.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_autopoll Removal of automatic event polling
|
||||||
|
|
||||||
|
GLFW 3 does not automatically poll for events in @ref glfwSwapBuffers, meaning
|
||||||
|
you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself. Unlike
|
||||||
|
buffer swap, which acts on a single window, the event processing functions act
|
||||||
|
on all windows at once.
|
||||||
|
|
||||||
|
@par Old basic main loop
|
||||||
|
@code
|
||||||
|
while (...)
|
||||||
|
{
|
||||||
|
// Process input
|
||||||
|
// Render output
|
||||||
|
glfwSwapBuffers();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New basic main loop
|
||||||
|
@code
|
||||||
|
while (...)
|
||||||
|
{
|
||||||
|
// Process input
|
||||||
|
// Render output
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
glfwPollEvents();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_context Explicit context management
|
||||||
|
|
||||||
|
Each GLFW 3 window has its own OpenGL context and only you, the application
|
||||||
|
programmer, can know which context should be current on which thread at any
|
||||||
|
given time. Therefore, GLFW 3 leaves that decision to you.
|
||||||
|
|
||||||
|
This means that you need to call @ref glfwMakeContextCurrent after creating
|
||||||
|
a window before you can call any OpenGL functions.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_hidpi Separation of window and framebuffer sizes
|
||||||
|
|
||||||
|
Window positions and sizes now use screen coordinates, which may not be the same
|
||||||
|
as pixels on machines with high-DPI monitors. This is important as OpenGL uses
|
||||||
|
pixels, not screen coordinates. For example, the rectangle specified with
|
||||||
|
`glViewport` needs to use pixels. Therefore, framebuffer size functions have
|
||||||
|
been added. You can retrieve the size of the framebuffer of a window with @ref
|
||||||
|
glfwGetFramebufferSize function. A framebuffer size callback has also been
|
||||||
|
added, which can be set with @ref glfwSetFramebufferSizeCallback.
|
||||||
|
|
||||||
|
@par Old basic viewport setup
|
||||||
|
@code
|
||||||
|
glfwGetWindowSize(&width, &height);
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New basic viewport setup
|
||||||
|
@code
|
||||||
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_window_close Window closing changes
|
||||||
|
|
||||||
|
The `GLFW_OPENED` window parameter has been removed. As long as the window has
|
||||||
|
not been destroyed, whether through @ref glfwDestroyWindow or @ref
|
||||||
|
glfwTerminate, the window is "open".
|
||||||
|
|
||||||
|
A user attempting to close a window is now just an event like any other. Unlike
|
||||||
|
GLFW 2, windows and contexts created with GLFW 3 will never be destroyed unless
|
||||||
|
you choose them to be. Each window now has a close flag that is set to
|
||||||
|
`GL_TRUE` when the user attempts to close that window. By default, nothing else
|
||||||
|
happens and the window stays visible. It is then up to you to either destroy
|
||||||
|
the window, take some other action or simply ignore the request.
|
||||||
|
|
||||||
|
You can query the close flag at any time with @ref glfwWindowShouldClose and set
|
||||||
|
it at any time with @ref glfwSetWindowShouldClose.
|
||||||
|
|
||||||
|
@par Old basic main loop
|
||||||
|
@code
|
||||||
|
while (glfwGetWindowParam(GLFW_OPENED))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New basic main loop
|
||||||
|
@code
|
||||||
|
while (!glfwWindowShouldClose(window))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The close callback no longer returns a value. Instead, it is called after the
|
||||||
|
close flag has been set so it can override its value, if it chooses to, before
|
||||||
|
event processing completes. You may however not call @ref glfwDestroyWindow
|
||||||
|
from the close callback (or any other window related callback).
|
||||||
|
|
||||||
|
@par Old syntax
|
||||||
|
@code
|
||||||
|
int GLFWCALL window_close_callback(void);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
void window_close_callback(GLFWwindow* window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@note GLFW never clears the close flag to `GL_FALSE`, meaning you can use it
|
||||||
|
for other reasons to close the window as well, for example the user choosing
|
||||||
|
Quit from an in-game menu.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_hints Persistent window hints
|
||||||
|
|
||||||
|
The `glfwOpenWindowHint` function has been renamed to @ref glfwWindowHint.
|
||||||
|
|
||||||
|
Window hints are no longer reset to their default values on window creation, but
|
||||||
|
instead retain their values until modified by @ref glfwWindowHint or @ref
|
||||||
|
glfwDefaultWindowHints, or until the library is terminated and re-initialized.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_video_modes Video mode enumeration
|
||||||
|
|
||||||
|
Video mode enumeration is now per-monitor. The @ref glfwGetVideoModes function
|
||||||
|
now returns all available modes for a specific monitor instead of requiring you
|
||||||
|
to guess how large an array you need. The `glfwGetDesktopMode` function, which
|
||||||
|
had poorly defined behavior, has been replaced by @ref glfwGetVideoMode, which
|
||||||
|
returns the current mode of a monitor.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_char_up Removal of character actions
|
||||||
|
|
||||||
The action parameter of the [character callback](@ref GLFWcharfun) has been
|
The action parameter of the [character callback](@ref GLFWcharfun) has been
|
||||||
removed. This was an artefact of the origin of GLFW, i.e. being developed in
|
removed. This was an artefact of the origin of GLFW, i.e. being developed in
|
||||||
@@ -61,134 +285,56 @@ English by a Swede. However, many keyboard layouts require more than one key to
|
|||||||
produce characters with diacritical marks. Even the Swedish keyboard layout
|
produce characters with diacritical marks. Even the Swedish keyboard layout
|
||||||
requires this for uncommon cases like ü.
|
requires this for uncommon cases like ü.
|
||||||
|
|
||||||
Note that this is only the removal of the *action parameter* of the character
|
@par Old syntax
|
||||||
callback, *not* the removal of the character callback itself.
|
@code
|
||||||
|
void GLFWCALL character_callback(int character, int action);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
void character_callback(GLFWwindow* window, int character);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_wheel Mouse wheel position
|
@subsection moving_cursorpos Cursor position changes
|
||||||
|
|
||||||
The `glfwGetMouseWheel` function has been removed. Scroll events do not
|
The `glfwGetMousePos` function has been renamed to @ref glfwGetCursorPos,
|
||||||
represent an absolute state, but is instead an interpretation of a relative
|
`glfwSetMousePos` to @ref glfwSetCursorPos and `glfwSetMousePosCallback` to @ref
|
||||||
change in state, like character input. So, like character input, there is no
|
glfwSetCursorPosCallback.
|
||||||
sane 'current state' to return. The mouse wheel callback has been replaced by
|
|
||||||
a [scroll callback](@ref GLFWscrollfun) that receives two-dimensional scroll
|
The cursor position is now `double` instead of `int`, both for the direct
|
||||||
offsets.
|
functions and for the callback. Some platforms can provide sub-pixel cursor
|
||||||
|
movement and this data is now passed on to the application where available. On
|
||||||
|
platforms where this is not provided, the decimal part is zero.
|
||||||
|
|
||||||
|
GLFW 3 only allows you to position the cursor within a window using @ref
|
||||||
|
glfwSetCursorPos (formerly `glfwSetMousePos`) when that window is active.
|
||||||
|
Unless the window is active, the function fails silently.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_stdcall GLFWCALL macro
|
@subsection moving_wheel Wheel position replaced by scroll offsets
|
||||||
|
|
||||||
The `GLFWCALL` macro, which made callback functions use
|
The `glfwGetMouseWheel` function has been removed. Scrolling is the input of
|
||||||
[__stdcall](http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows,
|
offsets and has no absolute position. The mouse wheel callback has been
|
||||||
has been removed. GLFW is written in C, not Pascal. Removing this macro means
|
replaced by a [scroll callback](@ref GLFWscrollfun) that receives
|
||||||
there's one less thing for users of GLFW to remember, i.e. the requirement to
|
two-dimensional floating point scroll offsets. This allows you to receive
|
||||||
mark all callback functions with `GLFWCALL`. It also simplifies the creation of
|
precise scroll data from for example modern touchpads.
|
||||||
DLLs and DLL link libraries, as there's no need to explicitly disable `@n` entry
|
|
||||||
point suffixes.
|
@par Old syntax
|
||||||
|
@code
|
||||||
|
void GLFWCALL mouse_wheel_callback(int position);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par Removed functions
|
||||||
|
`glfwGetMouseWheel`
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_mbcs Win32 MBCS support
|
@subsection moving_repeat Key repeat action
|
||||||
|
|
||||||
The Win32 port of GLFW 3 will not compile in
|
|
||||||
[MBCS mode](http://msdn.microsoft.com/en-us/library/5z097dxa.aspx).
|
|
||||||
However, because the use of the Unicode version of the Win32 API doesn't affect
|
|
||||||
the process as a whole, but only those windows created using it, it's perfectly
|
|
||||||
possible to call MBCS functions from other parts of the same application.
|
|
||||||
Therefore, even if an application using GLFW has MBCS mode code, there's no need
|
|
||||||
for GLFW itself to support it.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_windows Support for versions of Windows older than XP
|
|
||||||
|
|
||||||
All explicit support for version of Windows older than XP has been removed.
|
|
||||||
There is no code that actively prevents GLFW 3 from running on these earlier
|
|
||||||
versions, but it uses Win32 functions that those versions lack.
|
|
||||||
|
|
||||||
Windows XP was released in 2001, and by now (2013) it has not only
|
|
||||||
replaced almost all earlier versions of Windows, but is itself rapidly being
|
|
||||||
replaced by Windows 7 and 8. The MSDN library doesn't even provide
|
|
||||||
documentation for version older than Windows 2000, making it difficult to
|
|
||||||
maintain compatibility with these versions even if it was deemed worth the
|
|
||||||
effort.
|
|
||||||
|
|
||||||
The Win32 API has also not stood still, and GLFW 3 uses many functions only
|
|
||||||
present on Windows XP or later. Even supporting an OS as new as XP (new
|
|
||||||
from the perspective of GLFW 2, which still supports Windows 95) requires
|
|
||||||
runtime checking for a number of functions that are present only on modern
|
|
||||||
version of Windows.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_syskeys Capture of system-wide hotkeys
|
|
||||||
|
|
||||||
The ability to disable and capture system-wide hotkeys like Alt+Tab has been
|
|
||||||
removed. Modern applications, whether they're games, scientific visualisations
|
|
||||||
or something else, are nowadays expected to be good desktop citizens and allow
|
|
||||||
these hotkeys to function even when running in full screen mode.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_autopoll Automatic polling of events
|
|
||||||
|
|
||||||
GLFW 3 does not automatically poll for events on @ref glfwSwapBuffers, which
|
|
||||||
means you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself.
|
|
||||||
Unlike buffer swap, the event processing functions act on all windows at once.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_terminate Automatic termination
|
|
||||||
|
|
||||||
GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization. To
|
|
||||||
properly release all resources allocated by GLFW, you should therefore call @ref
|
|
||||||
glfwTerminate yourself before exiting.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_glu GLU header inclusion
|
|
||||||
|
|
||||||
GLFW 3 does not include the GLU header by default and GLU itself has been
|
|
||||||
deprecated, but you can request that the GLFW 3 header includes it by defining
|
|
||||||
`GLFW_INCLUDE_GLU` before the inclusion of the GLFW 3 header.
|
|
||||||
|
|
||||||
|
|
||||||
@section moving_changed Changes to existing features
|
|
||||||
|
|
||||||
@subsection moving_window_handles Window handles
|
|
||||||
|
|
||||||
Because GLFW 3 supports multiple windows, window handle parameters have been
|
|
||||||
added to all window-related GLFW functions and callbacks. The handle of
|
|
||||||
a newly created window is returned by @ref glfwCreateWindow (formerly
|
|
||||||
`glfwOpenWindow`). Window handles are of the `GLFWwindow*` type, i.e. a pointer
|
|
||||||
to an opaque struct.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_monitor Multi-monitor support
|
|
||||||
|
|
||||||
GLFW 3 provides support for multiple monitors, adding the `GLFWmonitor*` handle
|
|
||||||
type and a set of related functions. To request a full screen mode window,
|
|
||||||
instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the
|
|
||||||
window to use. There is @ref glfwGetPrimaryMonitor that provides behaviour
|
|
||||||
similar to that of GLFW 2.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_window_close Window closing
|
|
||||||
|
|
||||||
Window closing is now just an event like any other. GLFW 3 windows won't
|
|
||||||
disappear from underfoot even when no close callback is set; instead the
|
|
||||||
window's close flag is set. You can query this flag using @ref
|
|
||||||
glfwWindowShouldClose, or capture close events by setting a close callback. The
|
|
||||||
close flag can be modified from any point in your program using @ref
|
|
||||||
glfwSetWindowShouldClose.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_context Explicit context management
|
|
||||||
|
|
||||||
Each GLFW 3 window has its own OpenGL context and only you, the user, can know
|
|
||||||
which context should be current on which thread at any given time. Therefore,
|
|
||||||
GLFW 3 makes no assumptions about when you want a certain context to be current,
|
|
||||||
leaving that decision to you.
|
|
||||||
|
|
||||||
This means, among other things, that you need to call @ref
|
|
||||||
glfwMakeContextCurrent after creating a window before you can call any OpenGL
|
|
||||||
functions.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_repeat Key repeat
|
|
||||||
|
|
||||||
The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled
|
The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled
|
||||||
for both keys and characters. A new key action, `GLFW_REPEAT`, has been added
|
for both keys and characters. A new key action, `GLFW_REPEAT`, has been added
|
||||||
@@ -217,7 +363,7 @@ having to remember whether to check for `'a'` or `'A'`, you now check for
|
|||||||
`GLFW_KEY_A`.
|
`GLFW_KEY_A`.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_joystick Joystick input
|
@subsection moving_joystick Joystick function changes
|
||||||
|
|
||||||
The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes.
|
The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes.
|
||||||
|
|
||||||
@@ -227,42 +373,82 @@ function as well as axis and button counts returned by the @ref
|
|||||||
glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions.
|
glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_video_modes Video mode enumeration
|
@subsection moving_mbcs Win32 MBCS support
|
||||||
|
|
||||||
Video mode enumeration is now per-monitor. The @ref glfwGetVideoModes function
|
The Win32 port of GLFW 3 will not compile in
|
||||||
now returns all available modes for a specific monitor instead of requiring you
|
[MBCS mode](http://msdn.microsoft.com/en-us/library/5z097dxa.aspx).
|
||||||
to guess how large an array you need. The `glfwGetDesktopMode` function, which
|
However, because the use of the Unicode version of the Win32 API doesn't affect
|
||||||
had poorly defined behavior, has been replaced by @ref glfwGetVideoMode, which
|
the process as a whole, but only those windows created using it, it's perfectly
|
||||||
returns the current mode of a monitor.
|
possible to call MBCS functions from other parts of the same application.
|
||||||
|
Therefore, even if an application using GLFW has MBCS mode code, there's no need
|
||||||
|
for GLFW itself to support it.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_cursor Cursor positioning
|
@subsection moving_windows Support for versions of Windows older than XP
|
||||||
|
|
||||||
GLFW 3 only allows you to position the cursor within a window using @ref
|
All explicit support for version of Windows older than XP has been removed.
|
||||||
glfwSetCursorPos (formerly `glfwSetMousePos`) when that window is active.
|
There is no code that actively prevents GLFW 3 from running on these earlier
|
||||||
Unless the window is active, the function fails silently.
|
versions, but it uses Win32 functions that those versions lack.
|
||||||
|
|
||||||
|
Windows XP was released in 2001, and by now (January 2015) it has not only
|
||||||
|
replaced almost all earlier versions of Windows, but is itself rapidly being
|
||||||
|
replaced by Windows 7 and 8. The MSDN library doesn't even provide
|
||||||
|
documentation for version older than Windows 2000, making it difficult to
|
||||||
|
maintain compatibility with these versions even if it was deemed worth the
|
||||||
|
effort.
|
||||||
|
|
||||||
|
The Win32 API has also not stood still, and GLFW 3 uses many functions only
|
||||||
|
present on Windows XP or later. Even supporting an OS as new as XP (new
|
||||||
|
from the perspective of GLFW 2, which still supports Windows 95) requires
|
||||||
|
runtime checking for a number of functions that are present only on modern
|
||||||
|
version of Windows.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_hints Persistent window hints
|
@subsection moving_syskeys Capture of system-wide hotkeys
|
||||||
|
|
||||||
Window hints are no longer reset to their default values on window creation, but
|
The ability to disable and capture system-wide hotkeys like Alt+Tab has been
|
||||||
instead retain their values until modified by @ref glfwWindowHint (formerly
|
removed. Modern applications, whether they're games, scientific visualisations
|
||||||
`glfwOpenWindowHint`) or @ref glfwDefaultWindowHints, or until the library is
|
or something else, are nowadays expected to be good desktop citizens and allow
|
||||||
terminated and re-initialized.
|
these hotkeys to function even when running in full screen mode.
|
||||||
|
|
||||||
|
|
||||||
@section moving_renamed Name changes
|
@subsection moving_terminate Automatic termination
|
||||||
|
|
||||||
@subsection moving_renamed_files Library and header file
|
GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization,
|
||||||
|
because `exit` calls registered functions from the calling thread and while it
|
||||||
|
is permitted to call `exit` from any thread, @ref glfwTerminate may only be
|
||||||
|
called from the main thread.
|
||||||
|
|
||||||
The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to
|
To release all resources allocated by GLFW, you should call @ref glfwTerminate
|
||||||
avoid collisions with the headers of other major versions. Similarly, the GLFW
|
yourself, from the main thread, before the program terminates. Note that this
|
||||||
3 library is named `glfw3,` except when it's installed as a shared library on
|
destroys all windows not already destroyed with @ref glfwDestroyWindow,
|
||||||
Unix-like systems, where it uses the
|
invalidating any window handles you may still have.
|
||||||
[soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_renamed_functions Functions
|
@subsection moving_glu GLU header inclusion
|
||||||
|
|
||||||
|
GLFW 3 does not by default include the GLU header and GLU itself has been
|
||||||
|
deprecated by [Khronos](https://en.wikipedia.org/wiki/Khronos_Group). __New
|
||||||
|
projects should avoid using GLU__, but if you need to compile legacy code that
|
||||||
|
has been moved to GLFW 3, you can request that the GLFW header includes it by
|
||||||
|
defining `GLFW_INCLUDE_GLU` before the inclusion of the GLFW header.
|
||||||
|
|
||||||
|
@par Old syntax
|
||||||
|
@code
|
||||||
|
#include <GL/glfw.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@par New syntax
|
||||||
|
@code
|
||||||
|
#define GLFW_INCLUDE_GLU
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section moving_tables Name change tables
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_renamed_functions Renamed functions
|
||||||
|
|
||||||
| GLFW 2 | GLFW 3 | Notes |
|
| GLFW 2 | GLFW 3 | Notes |
|
||||||
| --------------------------- | ----------------------------- | ----- |
|
| --------------------------- | ----------------------------- | ----- |
|
||||||
@@ -281,7 +467,7 @@ Unix-like systems, where it uses the
|
|||||||
| `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor |
|
| `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor |
|
||||||
| `glfwGetJoystickParam` | @ref glfwJoystickPresent | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons |
|
| `glfwGetJoystickParam` | @ref glfwJoystickPresent | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons |
|
||||||
|
|
||||||
@subsection moving_renamed_tokens Tokens
|
@subsection moving_renamed_tokens Renamed tokens
|
||||||
|
|
||||||
| GLFW 2 | GLFW 3 | Notes |
|
| GLFW 2 | GLFW 3 | Notes |
|
||||||
| --------------------------- | ---------------------------- | ----- |
|
| --------------------------- | ---------------------------- | ----- |
|
||||||
|
|||||||
+146
-18
@@ -2,10 +2,129 @@
|
|||||||
|
|
||||||
@page news New features
|
@page news New features
|
||||||
|
|
||||||
@tableofcontents
|
@section news_31 New features in 3.1
|
||||||
|
|
||||||
|
These are the release highlights. For a full list of changes see the
|
||||||
|
[version history](http://www.glfw.org/changelog.html).
|
||||||
|
|
||||||
|
|
||||||
@section news_30 New features in version 3.0
|
@subsection news_31_cursor Custom mouse cursor images
|
||||||
|
|
||||||
|
GLFW now supports creating and setting both custom cursor images and standard
|
||||||
|
cursor shapes. They are created with @ref glfwCreateCursor or @ref
|
||||||
|
glfwCreateStandardCursor, set with @ref glfwSetCursor and destroyed with @ref
|
||||||
|
glfwDestroyCursor.
|
||||||
|
|
||||||
|
@see @ref cursor_object
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_drop Path drop event
|
||||||
|
|
||||||
|
GLFW now provides a callback for receiving the paths of files and directories
|
||||||
|
dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback.
|
||||||
|
|
||||||
|
@see @ref path_drop
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_emptyevent Main thread wake-up
|
||||||
|
|
||||||
|
GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty
|
||||||
|
event from another thread to the main thread event queue, causing @ref
|
||||||
|
glfwWaitEvents to return.
|
||||||
|
|
||||||
|
@see @ref events
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_framesize Window frame size query
|
||||||
|
|
||||||
|
GLFW now supports querying the size, on each side, of the frame around the
|
||||||
|
client area of a window, with @ref glfwGetWindowFrameSize.
|
||||||
|
|
||||||
|
@see [Window size](@ref window_size)
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_autoiconify Simultaneous multi-monitor rendering
|
||||||
|
|
||||||
|
GLFW now supports disabling auto-iconification of full screen windows with
|
||||||
|
the [GLFW_AUTO_ICONIFY](@ref window_hints_wnd) window hint. This is intended
|
||||||
|
for people building multi-monitor installations, where you need windows to stay
|
||||||
|
in full screen despite losing input focus.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_floating Floating windows
|
||||||
|
|
||||||
|
GLFW now supports floating windows, also called topmost or always on top, for
|
||||||
|
easier debugging with the [GLFW_FLOATING](@ref window_hints_wnd) window hint.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_focused Initially unfocused windows
|
||||||
|
|
||||||
|
GLFW now supports preventing a windowed mode window from gaining input focus on
|
||||||
|
creation, with the [GLFW_FOCUSED](@ref window_hints_wnd) window hint.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_direct Direct access for window attributes and cursor position
|
||||||
|
|
||||||
|
GLFW now queries the window input focus, visibility and iconification attributes
|
||||||
|
and the cursor position directly instead of returning cached data.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_libovr Better interoperability with Oculus Rift
|
||||||
|
|
||||||
|
GLFW now provides native access functions for the OS level handles corresponding
|
||||||
|
to monitor objects, as well as a [brief guide](@ref rift). It is also regularly
|
||||||
|
tested for compatibility with the latest version of LibOVR (0.4.4 on release).
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_charmods Character with modifiers callback
|
||||||
|
|
||||||
|
GLFW now provides a callback for character events with modifier key bits. The
|
||||||
|
callback is set with @ref glfwSetCharModsCallback. Unlike the regular character
|
||||||
|
callback, this will report character events that will not result in a character
|
||||||
|
being input, for example if the Control key is held down.
|
||||||
|
|
||||||
|
@see @ref input_char
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_single Single buffered framebuffers
|
||||||
|
|
||||||
|
GLFW now supports the creation of single buffered windows, with the
|
||||||
|
[GLFW_DOUBLEBUFFER](@ref window_hints_fb) window hint.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_glext Macro for including extension header
|
||||||
|
|
||||||
|
GLFW now includes the extension header appropriate for the chosen OpenGL or
|
||||||
|
OpenGL ES header when [GLFW_INCLUDE_GLEXT](@ref build_macros) is defined. GLFW
|
||||||
|
does not provide these headers. They must be provided by your development
|
||||||
|
environment or your OpenGL or OpenGL ES SDK.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_release Context release behaviors
|
||||||
|
|
||||||
|
GLFW now supports controlling whether the pipeline is flushed when a context is
|
||||||
|
made non-current, with the
|
||||||
|
[GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint, provided the
|
||||||
|
machine supports the `GL_KHR_context_flush_control` extension.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_wayland (Experimental) Wayland support
|
||||||
|
|
||||||
|
GLFW now has an _experimental_ Wayland display protocol backend that can be
|
||||||
|
selected on Linux with a CMake option.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_mir (Experimental) Mir support
|
||||||
|
|
||||||
|
GLFW now has an _experimental_ Mir display server backend that can be selected
|
||||||
|
on Linux with a CMake option.
|
||||||
|
|
||||||
|
|
||||||
|
@section news_30 New features in 3.0
|
||||||
|
|
||||||
|
These are the release highlights. For a full list of changes see the
|
||||||
|
[version history](http://www.glfw.org/changelog.html).
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_cmake CMake build system
|
@subsection news_30_cmake CMake build system
|
||||||
|
|
||||||
@@ -18,7 +137,7 @@ For more information on how to use CMake, see the
|
|||||||
[CMake manual](http://cmake.org/cmake/help/documentation.html).
|
[CMake manual](http://cmake.org/cmake/help/documentation.html).
|
||||||
|
|
||||||
|
|
||||||
@subsection new_30_multiwnd Multi-window support
|
@subsection news_30_multiwnd Multi-window support
|
||||||
|
|
||||||
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
||||||
or OpenGL ES context, and all window functions now take a window handle. Event
|
or OpenGL ES context, and all window functions now take a window handle. Event
|
||||||
@@ -38,10 +157,10 @@ that specific monitor.
|
|||||||
|
|
||||||
@subsection news_30_unicode Unicode support
|
@subsection news_30_unicode Unicode support
|
||||||
|
|
||||||
All string arguments to GLFW functions and all strings returned by GLFW use the
|
All string arguments to GLFW functions and all strings returned by GLFW now use
|
||||||
UTF-8 encoding. This includes the window title, error string, clipboard text,
|
the UTF-8 encoding. This includes the window title, error string, clipboard
|
||||||
monitor and joystick names as well as the extension function arguments (as ASCII
|
text, monitor and joystick names as well as the extension function arguments (as
|
||||||
is a subset of UTF-8).
|
ASCII is a subset of UTF-8).
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_clipboard Clipboard text I/O
|
@subsection news_30_clipboard Clipboard text I/O
|
||||||
@@ -58,17 +177,20 @@ GLFW now supports setting and reading back the gamma ramp of monitors, with the
|
|||||||
glfwSetGamma, which generates a ramp from a gamma value and then sets it.
|
glfwSetGamma, which generates a ramp from a gamma value and then sets it.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_gles OpenGL ES and EGL support
|
@subsection news_30_gles OpenGL ES support
|
||||||
|
|
||||||
GLFW now supports the creation of OpenGL ES contexts, by setting the
|
GLFW now supports the creation of OpenGL ES contexts, by setting the
|
||||||
`GLFW_CLIENT_API` window hint to `GLFW_OPENGL_ES_API`, where creation of such
|
`GLFW_CLIENT_API` window hint to `GLFW_OPENGL_ES_API`, where creation of such
|
||||||
contexts are supported. Note that GLFW *does not implement* OpenGL ES, so your
|
contexts are supported. Note that GLFW _does not implement_ OpenGL ES, so your
|
||||||
driver must provide support in a way usable by GLFW. Modern nVidia and Intel
|
driver must provide support in a way usable by GLFW. Modern Nvidia and Intel
|
||||||
drivers support creation of OpenGL ES context using the GLX and WGL APIs, while
|
drivers support creation of OpenGL ES context using the GLX and WGL APIs, while
|
||||||
AMD provides an EGL implementation instead.
|
AMD provides an EGL implementation instead.
|
||||||
|
|
||||||
GLFW now has an (experimental) EGL context creation back end, which can be
|
|
||||||
selected through CMake options.
|
@subsection news_30_egl (Experimental) EGL support
|
||||||
|
|
||||||
|
GLFW now has an experimental EGL context creation back end that can be selected
|
||||||
|
through CMake options.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_hidpi High-DPI support
|
@subsection news_30_hidpi High-DPI support
|
||||||
@@ -76,8 +198,8 @@ selected through CMake options.
|
|||||||
GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full
|
GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full
|
||||||
resolution framebuffers where other UI elements are scaled up. To achieve this,
|
resolution framebuffers where other UI elements are scaled up. To achieve this,
|
||||||
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
|
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
|
||||||
added. These work with pixels, while the rest of the GLFW API work with screen
|
added. These work with pixels, while the rest of the GLFW API works with screen
|
||||||
coordinates.
|
coordinates. This is important as OpenGL uses pixels, not screen coordinates.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_error Error callback
|
@subsection news_30_error Error callback
|
||||||
@@ -89,20 +211,20 @@ an error code and a description string.
|
|||||||
|
|
||||||
@subsection news_30_wndptr Per-window user pointer
|
@subsection news_30_wndptr Per-window user pointer
|
||||||
|
|
||||||
Each window object has a user-defined pointer, retrieved with @ref
|
Each window now has a user-defined pointer, retrieved with @ref
|
||||||
glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
|
glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
|
||||||
easier to integrate GLFW into C++ code.
|
easier to integrate GLFW into C++ code.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_iconifyfun Window iconification callback
|
@subsection news_30_iconifyfun Window iconification callback
|
||||||
|
|
||||||
Each window object has a callback for iconification and restoration events,
|
Each window now has a callback for iconification and restoration events,
|
||||||
which is set with @ref glfwSetWindowIconifyCallback.
|
which is set with @ref glfwSetWindowIconifyCallback.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_wndposfun Window position callback
|
@subsection news_30_wndposfun Window position callback
|
||||||
|
|
||||||
Each window object has a callback for position events, which is set with @ref
|
Each window now has a callback for position events, which is set with @ref
|
||||||
glfwSetWindowPosCallback.
|
glfwSetWindowPosCallback.
|
||||||
|
|
||||||
|
|
||||||
@@ -113,10 +235,16 @@ The position of a window can now be retrieved using @ref glfwGetWindowPos.
|
|||||||
|
|
||||||
@subsection news_30_focusfun Window focus callback
|
@subsection news_30_focusfun Window focus callback
|
||||||
|
|
||||||
Windows now have a callback for focus events, which is set with @ref
|
Each windows now has a callback for focus events, which is set with @ref
|
||||||
glfwSetWindowFocusCallback.
|
glfwSetWindowFocusCallback.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_30_enterleave Cursor enter/leave callback
|
||||||
|
|
||||||
|
Each window now has a callback for when the mouse cursor enters or leaves its
|
||||||
|
client area, which is set with @ref glfwSetCursorEnterCallback.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_wndtitle Initial window title
|
@subsection news_30_wndtitle Initial window title
|
||||||
|
|
||||||
The title of a window is now specified at creation time, as one of the arguments
|
The title of a window is now specified at creation time, as one of the arguments
|
||||||
|
|||||||
+135
-112
@@ -4,20 +4,22 @@
|
|||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
This guide will show how to write simple OpenGL applications using GLFW 3. It
|
This guide takes you through writing a simple application using GLFW 3. The
|
||||||
will introduce a few of the most commonly used functions, but there are many
|
application will create a window and OpenGL context, render a rotating triangle
|
||||||
others. To see detailed documentation on any GLFW function, just click on its
|
and exit when the user closes the window or presses Escape. This guide will
|
||||||
name.
|
introduce a few of the most commonly used functions, but there are many more.
|
||||||
|
|
||||||
This guide assumes no experience with earlier versions of GLFW. If you
|
This guide assumes no experience with earlier versions of GLFW. If you
|
||||||
have used GLFW 2.x in the past, you should also read the
|
have used GLFW 2 in the past, read the @ref moving guide, as some functions
|
||||||
[transition guide](@ref moving).
|
behave differently in GLFW 3.
|
||||||
|
|
||||||
|
|
||||||
@section quick_include Including the GLFW header
|
@section quick_steps Step by step
|
||||||
|
|
||||||
In the files of your program where you use OpenGL or GLFW, you need to include
|
@subsection quick_include Including the GLFW header
|
||||||
the GLFW 3 header file.
|
|
||||||
|
In the source files of your application where you use OpenGL or GLFW, you need
|
||||||
|
to include the GLFW 3 header file.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@@ -33,15 +35,15 @@ and pollute your code's namespace with the whole Win32 API.
|
|||||||
|
|
||||||
Instead, the GLFW header takes care of this for you, not by including
|
Instead, the GLFW header takes care of this for you, not by including
|
||||||
`windows.h`, but rather by itself duplicating only the necessary parts of it.
|
`windows.h`, but rather by itself duplicating only the necessary parts of it.
|
||||||
It does this only where needed, so if `windows.h` *is* included, the GLFW header
|
It does this only where needed, so if `windows.h` _is_ included, the GLFW header
|
||||||
does not try to redefine those symbols.
|
does not try to redefine those symbols.
|
||||||
|
|
||||||
In other words:
|
In other words:
|
||||||
|
|
||||||
- Do *not* include the OpenGL headers yourself, as GLFW does this for you
|
- Do _not_ include the OpenGL headers yourself, as GLFW does this for you
|
||||||
- Do *not* include `windows.h` or other platform-specific headers unless
|
- Do _not_ include `windows.h` or other platform-specific headers unless
|
||||||
you plan on using those APIs directly
|
you plan on using those APIs directly
|
||||||
- If you *do* need to include such headers, do it *before* including the
|
- If you _do_ need to include such headers, do it _before_ including the
|
||||||
GLFW one and it will detect this
|
GLFW one and it will detect this
|
||||||
|
|
||||||
Starting with version 3.0, the GLU header `glu.h` is no longer included by
|
Starting with version 3.0, the GLU header `glu.h` is no longer included by
|
||||||
@@ -54,40 +56,39 @@ inclusion of the GLFW header.
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section quick_init_term Initializing and terminating GLFW
|
@subsection quick_init_term Initializing and terminating GLFW
|
||||||
|
|
||||||
Before you can use most GLFW functions, the library must be initialized. This
|
Before you can use most GLFW functions, the library must be initialized. On
|
||||||
is done with @ref glfwInit, which returns non-zero if successful, or zero if an
|
successful initialization, `GL_TRUE` is returned. If an error occurred,
|
||||||
error occurred.
|
`GL_FALSE` is returned.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
When you are done using GLFW, typically at the very end of the program, you need
|
When you are done using GLFW, typically just before the application exits, you
|
||||||
to call @ref glfwTerminate.
|
need to terminate GLFW.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This destroys any remaining windows and releases any other resources allocated by
|
This destroys any remaining windows and releases any other resources allocated by
|
||||||
GLFW. After this call, you must call @ref glfwInit again before using any GLFW
|
GLFW. After this call, you must initialize GLFW again before using any GLFW
|
||||||
functions that require it.
|
functions that require it.
|
||||||
|
|
||||||
|
|
||||||
@section quick_capture_error Setting an error callback
|
@subsection quick_capture_error Setting an error callback
|
||||||
|
|
||||||
Most events are reported through callbacks, whether it's a key being pressed,
|
Most events are reported through callbacks, whether it's a key being pressed,
|
||||||
a GLFW window being moved, or an error occurring. Callbacks are simply
|
a GLFW window being moved, or an error occurring. Callbacks are simply
|
||||||
C functions (or C++ static methods) that are called by GLFW with arguments
|
C functions (or C++ static methods) that are called by GLFW with arguments
|
||||||
describing the event.
|
describing the event.
|
||||||
|
|
||||||
In case @ref glfwInit or any other GLFW function fails, an error is reported to
|
In case a GLFW function fails, an error is reported to the GLFW error callback.
|
||||||
the GLFW error callback. You can receive these reports by setting the error
|
You can receive these reports with an error callback. This function must have
|
||||||
callback. The callback function itself should match the signature of @ref
|
the signature below. This simple error callback just prints the error
|
||||||
GLFWerrorfun. Here is a simple error callback that just prints the error
|
|
||||||
description to `stderr`.
|
description to `stderr`.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
@@ -97,28 +98,28 @@ void error_callback(int error, const char* description)
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Setting the callback, so GLFW knows to call it, is done with @ref
|
Callback functions must be set, so GLFW knows to call them. The function to set
|
||||||
glfwSetErrorCallback. This is one of the few GLFW functions that may be called
|
the error callback is one of the few GLFW functions that may be called before
|
||||||
before @ref glfwInit, which lets you be notified of errors during
|
initialization, which lets you be notified of errors both during and after
|
||||||
initialization, so you should set it before you do anything else with GLFW.
|
initialization.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section quick_create_window Creating a window and context
|
@subsection quick_create_window Creating a window and context
|
||||||
|
|
||||||
The window (and its context) is created with @ref glfwCreateWindow, which
|
The window and its OpenGL context are created with a single call, which returns
|
||||||
returns a handle to the created window. For example, this creates a 640 by 480
|
a handle to the created combined window and context object. For example, this
|
||||||
windowed mode window:
|
creates a 640 by 480 windowed mode window with an OpenGL context:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
If window creation fails, `NULL` will be returned, so you need to check whether
|
If window or context creation fails, `NULL` will be returned, so it is necessary
|
||||||
it did.
|
to check the return value.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (!window)
|
if (!window)
|
||||||
@@ -128,24 +129,11 @@ if (!window)
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This handle is then passed to all window related functions, and is provided to
|
The window handle is passed to all window related functions and is provided to
|
||||||
you along with input events, so you know which window received the input.
|
along to all window related callbacks, so they can tell which window received
|
||||||
|
the event.
|
||||||
|
|
||||||
To create a full screen window, you need to specify which monitor the window
|
When a window is no longer needed, destroy it.
|
||||||
should use. In most cases, the user's primary monitor is a good choice. You
|
|
||||||
can get this with @ref glfwGetPrimaryMonitor. To make the above window
|
|
||||||
full screen, just pass along the monitor handle:
|
|
||||||
|
|
||||||
@code
|
|
||||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
Full screen windows cover the entire screen, have no border or decorations, and
|
|
||||||
change the monitor's resolution to the one most closely matching the requested
|
|
||||||
window size.
|
|
||||||
|
|
||||||
When you are done with the window, destroy it with the @ref glfwDestroyWindow
|
|
||||||
function.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwDestroyWindow(window);
|
glfwDestroyWindow(window);
|
||||||
@@ -155,26 +143,25 @@ Once this function is called, no more events will be delivered for that window
|
|||||||
and its handle becomes invalid.
|
and its handle becomes invalid.
|
||||||
|
|
||||||
|
|
||||||
@section quick_context_current Making the OpenGL context current
|
@subsection quick_context_current Making the OpenGL context current
|
||||||
|
|
||||||
Before you can use the OpenGL API, it must have a current OpenGL context. You
|
Before you can use the OpenGL API, you must have a current OpenGL context.
|
||||||
make a window's context current with @ref glfwMakeContextCurrent. It will then
|
|
||||||
remain as the current context until you make another context current or until
|
|
||||||
the window owning it is destroyed.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The context will remain current until you make another context current or until
|
||||||
|
the window owning the current context is destroyed.
|
||||||
|
|
||||||
@section quick_window_close Checking the window close flag
|
|
||||||
|
|
||||||
Each window has a flag indicating whether the window should be closed. This can
|
@subsection quick_window_close Checking the window close flag
|
||||||
be checked with @ref glfwWindowShouldClose.
|
|
||||||
|
Each window has a flag indicating whether the window should be closed.
|
||||||
|
|
||||||
When the user attempts to close the window, either by pressing the close widget
|
When the user attempts to close the window, either by pressing the close widget
|
||||||
in the title bar or using a key combination like Alt+F4, this flag is set to 1.
|
in the title bar or using a key combination like Alt+F4, this flag is set to 1.
|
||||||
Note that **the window isn't actually closed**, so you are expected to monitor
|
Note that __the window isn't actually closed__, so you are expected to monitor
|
||||||
this flag and either destroy the window or give some kind of feedback to the
|
this flag and either destroy the window or give some kind of feedback to the
|
||||||
user.
|
user.
|
||||||
|
|
||||||
@@ -185,7 +172,7 @@ while (!glfwWindowShouldClose(window))
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
You can be notified when user is attempting to close the window by setting
|
You can be notified when the user is attempting to close the window by setting
|
||||||
a close callback with @ref glfwSetWindowCloseCallback. The callback will be
|
a close callback with @ref glfwSetWindowCloseCallback. The callback will be
|
||||||
called immediately after the close flag has been set.
|
called immediately after the close flag has been set.
|
||||||
|
|
||||||
@@ -194,11 +181,11 @@ useful if you want to interpret other kinds of input as closing the window, like
|
|||||||
for example pressing the escape key.
|
for example pressing the escape key.
|
||||||
|
|
||||||
|
|
||||||
@section quick_key_input Receiving input events
|
@subsection quick_key_input Receiving input events
|
||||||
|
|
||||||
Each window has a large number of callbacks that can be set to receive all the
|
Each window has a large number of callbacks that can be set to receive all the
|
||||||
various kinds of events. To receive key press and release events, a
|
various kinds of events. To receive key press and release events, create a key
|
||||||
[key callback](@ref GLFWkeyfun) is set using @ref glfwSetKeyCallback.
|
callback function.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
@@ -208,16 +195,21 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
For event callbacks to actually be called when an event occurs, you need to
|
The key callback, like other window related callbacks, are set per-window.
|
||||||
process events as described below.
|
|
||||||
|
@code
|
||||||
|
glfwSetKeyCallback(window, key_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
In order for event callbacks to be called when events occur, you need to process
|
||||||
|
events as described below.
|
||||||
|
|
||||||
|
|
||||||
@section quick_render Rendering with OpenGL
|
@subsection quick_render Rendering with OpenGL
|
||||||
|
|
||||||
Once you have a current OpenGL context, you can use OpenGL normally. In this
|
Once you have a current OpenGL context, you can use OpenGL normally. In this
|
||||||
tutorial, a multi-colored rotating triangle will be rendered. The framebuffer
|
tutorial, a multi-colored rotating triangle will be rendered. The framebuffer
|
||||||
size, needed by this example for `glViewport` and `glOrtho`, is retrieved with
|
size needs to be retrieved for `glViewport`.
|
||||||
@ref glfwGetFramebufferSize.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -225,81 +217,112 @@ glfwGetFramebufferSize(window, &width, &height);
|
|||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
However, you can also set a framebuffer size callback using @ref
|
You can also set a framebuffer size callback using @ref
|
||||||
glfwSetFramebufferSizeCallback and call `glViewport` from there.
|
glfwSetFramebufferSizeCallback and call `glViewport` from there.
|
||||||
|
|
||||||
@code
|
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
|
||||||
{
|
|
||||||
glViewport(0, 0, width, height);
|
|
||||||
}
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
|
@subsection quick_timer Reading the timer
|
||||||
|
|
||||||
@section quick_timer Reading the timer
|
To create smooth animation, a time source is needed. GLFW provides a timer that
|
||||||
|
returns the number of seconds since initialization. The time source used is the
|
||||||
For the triangle to rotate properly, a time source is needed. GLFW provides
|
most accurate on each platform and generally has micro- or nanosecond
|
||||||
@ref glfwGetTime, which returns the number of seconds since @ref glfwInit as
|
resolution.
|
||||||
a `double`. The time source used is the most accurate on each platform and
|
|
||||||
generally has micro- or nanosecond resolution.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
double time = glfwGetTime();
|
double time = glfwGetTime();
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section quick_swap_buffers Swapping buffers
|
@subsection quick_swap_buffers Swapping buffers
|
||||||
|
|
||||||
GLFW windows always use double-buffering. That means that you have two
|
GLFW windows by default use double buffering. That means that each window has
|
||||||
rendering buffers; a front buffer and a back buffer. The front buffer is the
|
two rendering buffers; a front buffer and a back buffer. The front buffer is
|
||||||
one being displayed and the back buffer the one you render to.
|
the one being displayed and the back buffer the one you render to.
|
||||||
|
|
||||||
When the entire frame has been rendered, it is time to swap the back and the
|
When the entire frame has been rendered, the buffers need to be swapped with one
|
||||||
front buffers in order to display the rendered frame, and begin rendering a new
|
another, so the back buffer becomes the front buffer and vice versa.
|
||||||
frame. This is done with @ref glfwSwapBuffers.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The swap interval indicates how many frames to wait until swapping the buffers,
|
||||||
|
commonly known as _vsync_. By default, the swap interval is zero, meaning
|
||||||
|
buffer swapping will occur immediately. On fast machines, many of those frames
|
||||||
|
will never be seen, as the screen is still only updated typically 60-75 times
|
||||||
|
per second, so this wastes a lot of CPU and GPU cycles.
|
||||||
|
|
||||||
@section quick_process_events Processing events
|
Also, because the buffers will be swapped in the middle the screen update,
|
||||||
|
leading to [screen tearing](https://en.wikipedia.org/wiki/Screen_tearing).
|
||||||
|
|
||||||
|
For these reasons, applications will typically want to set the swap interval to
|
||||||
|
one. It can be set to higher values, but this is usually not recommended,
|
||||||
|
because of the input latency it leads to.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSwapInterval(1);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This function acts on the current context and will fail unless a context is
|
||||||
|
current.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection quick_process_events Processing events
|
||||||
|
|
||||||
GLFW needs to communicate regularly with the window system both in order to
|
GLFW needs to communicate regularly with the window system both in order to
|
||||||
receive events and to show that it hasn't locked up. Event processing must be
|
receive events and to show that the application hasn't locked up. Event
|
||||||
done regularly and is normally done each frame before rendering but after buffer
|
processing must be done regularly while you have visible windows and is normally
|
||||||
swap.
|
done each frame after buffer swapping.
|
||||||
|
|
||||||
There are two ways to process pending events. @ref glfwPollEvents processes
|
There are two methods for processing pending events; polling and waiting. This
|
||||||
only those events that have already been received and then returns immediately.
|
example will use event polling, which processes only those events that have
|
||||||
This is the best choice when rendering continually, like most games do.
|
already been received and then returns immediately.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
If instead you only need to update your rendering once you have received new
|
This is the best choice when rendering continually, like most games do. If
|
||||||
input, @ref glfwWaitEvents is a better choice. It waits until at least one
|
instead you only need to update your rendering once you have received new input,
|
||||||
event has been received, putting the thread to sleep in the meantime, and then
|
@ref glfwWaitEvents is a better choice. It waits until at least one event has
|
||||||
processes all received events just like @ref glfwPollEvents does. This saves
|
been received, putting the thread to sleep in the meantime, and then processes
|
||||||
a great deal of CPU cycles and is useful for, for example, many kinds of editing
|
all received events. This saves a great deal of CPU cycles and is useful for,
|
||||||
tools.
|
for example, many kinds of editing tools.
|
||||||
|
|
||||||
@code
|
|
||||||
glfwWaitEvents();
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
|
|
||||||
@section quick_example Putting it together: A small GLFW application
|
@section quick_example Putting it together
|
||||||
|
|
||||||
Now that you know how to initialize GLFW, create a window and poll for
|
Now that you know how to initialize GLFW, create a window and poll for
|
||||||
keyboard input, it's possible to create a simple program.
|
keyboard input, it's possible to create a simple program.
|
||||||
|
|
||||||
@snippet simple.c code
|
@snippet simple.c code
|
||||||
|
|
||||||
This program creates a 640 by 480 windowed mode window and runs a loop clearing
|
This program creates a 640 by 480 windowed mode window and starts a loop that
|
||||||
the screen, rendering a triangle and processing events until the user closes the
|
clears the screen, renders a triangle and processes events until the user either
|
||||||
window. It can be found in the source distribution as `examples/simple.c`, and
|
presses Escape or closes the window.
|
||||||
is by default compiled along with all other examples when you build GLFW.
|
|
||||||
|
This program uses only a few of the many functions GLFW provides. There are
|
||||||
|
guides for each of the areas covered by GLFW. Each guide will introduce all the
|
||||||
|
functions for that category.
|
||||||
|
|
||||||
|
- @ref intro
|
||||||
|
- @ref window
|
||||||
|
- @ref context
|
||||||
|
- @ref monitor
|
||||||
|
- @ref input
|
||||||
|
|
||||||
|
|
||||||
|
@section quick_build Compiling and linking the program
|
||||||
|
|
||||||
|
The complete program above can be found in the source distribution as
|
||||||
|
`examples/simple.c` and is compiled along with all other examples when you
|
||||||
|
build GLFW. That is, if you have compiled GLFW then you have already built this
|
||||||
|
as `simple.exe` on Windows, `simple` on Linux or `simple.app` on OS X.
|
||||||
|
|
||||||
|
This tutorial ends here. Once you have written a program that uses GLFW, you
|
||||||
|
will need to compile and link it. How to do that depends on the development
|
||||||
|
environment you are using and is best explained by the documentation for that
|
||||||
|
environment. To learn about the details that are specific to GLFW, see
|
||||||
|
@ref build.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
+199
@@ -0,0 +1,199 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
@page rift Oculus Rift guide
|
||||||
|
|
||||||
|
@tableofcontents
|
||||||
|
|
||||||
|
This guide is intended to fill in the gaps between the
|
||||||
|
[Oculus PC SDK documentation](https://developer.oculus.com/documentation/) and
|
||||||
|
the rest of the GLFW documentation and is not a replacement for either. It
|
||||||
|
requires you to use [native access](@ref native) and assumes a certain level of
|
||||||
|
proficiency with LibOVR, platform specific APIs and your chosen development
|
||||||
|
environment.
|
||||||
|
|
||||||
|
While GLFW has no explicit support for LibOVR, it is tested with and tries to
|
||||||
|
interoperate well with it.
|
||||||
|
|
||||||
|
@note Because of the speed of development of the Oculus SDK, this guide may
|
||||||
|
become outdated before the next release. If this is a local copy of the
|
||||||
|
documentation, you may want to check the GLFW website for updates. This
|
||||||
|
revision of the guide is written against version 0.4.4 of the SDK.
|
||||||
|
|
||||||
|
|
||||||
|
@section rift_include Including the LibOVR and GLFW header files
|
||||||
|
|
||||||
|
Both the OpenGL LibOVR header and the GLFW native header need macros telling
|
||||||
|
them what OS you are building for. Because LibOVR only supports three major
|
||||||
|
desktop platforms, this can be solved with canonical predefined macros.
|
||||||
|
|
||||||
|
@code
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||||
|
#define GLFW_EXPOSE_NATIVE_WGL
|
||||||
|
#define OVR_OS_WIN32
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||||
|
#define GLFW_EXPOSE_NATIVE_NSGL
|
||||||
|
#define OVR_OS_MAC
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#define GLFW_EXPOSE_NATIVE_X11
|
||||||
|
#define GLFW_EXPOSE_NATIVE_GLX
|
||||||
|
#define OVR_OS_LINUX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <GLFW/glfw3native.h>
|
||||||
|
|
||||||
|
#include <OVR_CAPI_GL.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Both the GLFW and LibOVR headers by default attempt to include the standard
|
||||||
|
OpenGL `GL/gl.h` header (`OpenGL/gl.h` on OS X). If you wish to use a different
|
||||||
|
standard header or an [extension loading library](@ref context_glext_auto),
|
||||||
|
include that header before these.
|
||||||
|
|
||||||
|
|
||||||
|
@section rift_init Initializing LibOVR and GLFW
|
||||||
|
|
||||||
|
LibOVR needs to be initialized before GLFW. This means calling at least
|
||||||
|
`ovr_Initialize`, `ovrHmd_Create` and `ovrHmd_ConfigureTracking` before @ref
|
||||||
|
glfwInit. Similarly, LibOVR must be shut down after GLFW. This means calling
|
||||||
|
`ovrHmd_Destroy` and `ovr_Shutdown` after @ref glfwTerminate.
|
||||||
|
|
||||||
|
|
||||||
|
@section rift_direct Direct HMD mode
|
||||||
|
|
||||||
|
Direct HMD mode is the recommended display mode for new applications, but the
|
||||||
|
Oculus Rift runtime currently (January 2015) only supports this mode on Windows.
|
||||||
|
In direct mode the HMD is not detectable as a GLFW monitor.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection rift_direct_create Creating a window and context
|
||||||
|
|
||||||
|
If the HMD is in direct mode you can use either a full screen or a windowed mode
|
||||||
|
window, but full screen is only recommended if there is a monitor that supports
|
||||||
|
the resolution of the HMD. Due to limitations in LibOVR, the size of the client
|
||||||
|
area of the window must equal the resolution of the HMD.
|
||||||
|
|
||||||
|
If the resolution of the HMD is much larger than the regular monitor, the window
|
||||||
|
may be resized by the window manager on creation. One way to avoid this is to
|
||||||
|
make it undecorated with the [GLFW_DECORATED](@ref window_hints_wnd) window
|
||||||
|
hint.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection rift_direct_attach Attaching the window to the HMD
|
||||||
|
|
||||||
|
Once you have created the window and context, you need to attach the native
|
||||||
|
handle of the GLFW window to the HMD.
|
||||||
|
|
||||||
|
@code
|
||||||
|
ovrHmd_AttachToWindow(hmd, glfwGetWin32Window(window), NULL, NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section rift_extend Extend Desktop mode
|
||||||
|
|
||||||
|
Extend desktop mode is a legacy display mode, but is still (January 2015) the
|
||||||
|
only available mode on OS X and Linux, as well as on Windows machines that for
|
||||||
|
technical reasons do not yet support direct HMD mode.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection rift_extend_detect Detecting a HMD with GLFW
|
||||||
|
|
||||||
|
If the HMD is in extend desktop mode you can deduce which GLFW monitor it
|
||||||
|
corresponds to and create a full screen window on that monitor.
|
||||||
|
|
||||||
|
On Windows, the native display device name of a GLFW monitor corresponds to the
|
||||||
|
display device name of the detected HMD as stored, in the `DisplayDeviceName`
|
||||||
|
member of `ovrHmdDesc`.
|
||||||
|
|
||||||
|
On OS X, the native display ID of a GLFW monitor corresponds to the display ID
|
||||||
|
of the detected HMD, as stored in the `DisplayId` member of `ovrHmdDesc`.
|
||||||
|
|
||||||
|
At the time of writing (January 2015), the Oculus SDK does not support detecting
|
||||||
|
which monitor corresponds to the HMD in any sane fashion, but as long as the HMD
|
||||||
|
is set up and rotated properly it can be found via the screen position and
|
||||||
|
resolution provided by LibOVR. This method may instead find another monitor
|
||||||
|
that is mirroring the HMD, but this only matters if you intend to change its
|
||||||
|
video mode.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int i, count;
|
||||||
|
GLFWmonitor** monitors = glfwGetMonitors(&count);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
if (strcmp(glfwGetWin32Monitor(monitors[i]), hmd->DisplayDeviceName) == 0)
|
||||||
|
return monitors[i];
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
if (glfwGetCocoaMonitor(monitors[i]) == hmd->DisplayId)
|
||||||
|
return monitors[i];
|
||||||
|
#elif defined(__linux__)
|
||||||
|
int xpos, ypos;
|
||||||
|
const GLFWvidmode* mode = glfwGetVideoMode(monitors[i]);
|
||||||
|
glfwGetMonitorPos(monitors[i], &xpos, &ypos);
|
||||||
|
|
||||||
|
if (hmd->WindowsPos.x == xpos &&
|
||||||
|
hmd->WindowsPos.y == ypos &&
|
||||||
|
hmd->Resolution.w == mode->width &&
|
||||||
|
hmd->Resolution.h == mode->height)
|
||||||
|
{
|
||||||
|
return monitors[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection rift_extend_create Creating a window and context
|
||||||
|
|
||||||
|
The window is created as a regular full screen window on the found monitor. It
|
||||||
|
is usually a good idea to create a
|
||||||
|
[windowed full screen](@ref window_windowed_full_screen) window, as the HMD will
|
||||||
|
very likely already be set to the correct video mode. However, in extend
|
||||||
|
desktop mode it behaves like a regular monitor and any supported video mode can
|
||||||
|
be requested.
|
||||||
|
|
||||||
|
If other monitors are mirroring the HMD and you request a different video mode,
|
||||||
|
all monitors in the mirroring set will get the new video mode.
|
||||||
|
|
||||||
|
|
||||||
|
@section rift_render Rendering to the HMD
|
||||||
|
|
||||||
|
@subsection rift_render_sdk SDK distortion rendering
|
||||||
|
|
||||||
|
If you wish to use SDK distortion rendering you will need some information from
|
||||||
|
GLFW to configure the renderer. Below are the parts of the `ovrGLConfig` union
|
||||||
|
that need to be filled with from GLFW. Note that there are other fields that
|
||||||
|
also need to be filled for `ovrHmd_ConfigureRendering` to succeed.
|
||||||
|
|
||||||
|
Before configuring SDK distortion rendering you should make your context
|
||||||
|
current.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int width, height;
|
||||||
|
union ovrGLConfig config;
|
||||||
|
|
||||||
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
|
|
||||||
|
config.OGL.Header.BackBufferSize.w = width;
|
||||||
|
config.OGL.Header.BackBufferSize.h = height;
|
||||||
|
#if defined(_WIN32)
|
||||||
|
config.OGL.Window = glfwGetWin32Window(window);
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#elif defined(__linux__)
|
||||||
|
config.OGL.Disp = glfwGetX11Display();
|
||||||
|
#endif
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When using SDK distortion rendering you should not swap the buffers yourself, as
|
||||||
|
the HMD is updated by `ovrHmd_EndFrame`.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection rift_render_custom Client distortion rendering
|
||||||
|
|
||||||
|
With client distortion rendering you are in full control of the contents of the
|
||||||
|
HMD and should render and swap the buffers normally.
|
||||||
|
|
||||||
|
*/
|
||||||
+872
@@ -0,0 +1,872 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="688.48718"
|
||||||
|
height="327.98221"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.4 r9939"
|
||||||
|
sodipodi:docname="spaces.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<marker
|
||||||
|
inkscape:stockid="Arrow2Lend"
|
||||||
|
orient="auto"
|
||||||
|
refY="0.0"
|
||||||
|
refX="0.0"
|
||||||
|
id="Arrow2Lend"
|
||||||
|
style="overflow:visible;">
|
||||||
|
<path
|
||||||
|
id="path3888"
|
||||||
|
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
||||||
|
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
||||||
|
transform="scale(1.1) rotate(180) translate(1,0)" />
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="2.5611424"
|
||||||
|
inkscape:cx="344.24359"
|
||||||
|
inkscape:cy="163.9911"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1021"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="30"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
units="px"
|
||||||
|
showborder="false"
|
||||||
|
inkscape:showpageshadow="false" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-12.627039,-339.86462)">
|
||||||
|
<rect
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke:#0000ff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:3,3;stroke-dashoffset:0"
|
||||||
|
id="rect2985"
|
||||||
|
width="687.36469"
|
||||||
|
height="326.85971"
|
||||||
|
x="13.188287"
|
||||||
|
y="340.42587"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<rect
|
||||||
|
style="fill:#f3fff3;fill-opacity:1;stroke:#00b800;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="rect3757"
|
||||||
|
width="318.05698"
|
||||||
|
height="277.04684"
|
||||||
|
x="38.315689"
|
||||||
|
y="366.05841"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<rect
|
||||||
|
style="fill:#f3fff3;fill-opacity:1;stroke:#00b800;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="rect3767"
|
||||||
|
width="319.01456"
|
||||||
|
height="198.09369"
|
||||||
|
x="356.36722"
|
||||||
|
y="366.01291"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3769">
|
||||||
|
<path
|
||||||
|
d="m 365.3732,374.63632 0,2.73926 1.24023,0 c 0.45898,0 0.8138,-0.11881 1.06446,-0.35645 0.25064,-0.23762 0.37597,-0.57616 0.37597,-1.01562 0,-0.43619 -0.12533,-0.77311 -0.37597,-1.01074 -0.25066,-0.23763 -0.60548,-0.35644 -1.06446,-0.35645 l -1.24023,0 m -0.98633,-0.81054 2.22656,0 c 0.81706,0 1.43392,0.18555 1.85059,0.55664 0.41992,0.36784 0.62988,0.9082 0.62988,1.62109 0,0.7194 -0.20996,1.26302 -0.62988,1.63086 -0.41667,0.36784 -1.03353,0.55176 -1.85059,0.55176 l -1.24023,0 0,2.92968 -0.98633,0 0,-7.29003"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3281" />
|
||||||
|
<path
|
||||||
|
d="m 373.37613,376.48691 c -0.10092,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49805 -0.27019,0.32878 -0.40528,0.80241 -0.40528,1.42089 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0147 0.0749,0.007 0.15788,0.0179 0.24903,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3283" />
|
||||||
|
<path
|
||||||
|
d="m 374.32828,375.64706 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3285" />
|
||||||
|
<path
|
||||||
|
d="m 381.35953,376.69687 c 0.2246,-0.40364 0.49316,-0.70149 0.80566,-0.89356 0.3125,-0.19205 0.68033,-0.28808 1.10352,-0.28808 0.56965,0 1.0091,0.2002 1.31836,0.60058 0.30923,0.39714 0.46385,0.96355 0.46386,1.69922 l 0,3.30078 -0.90332,0 0,-3.27148 c 0,-0.52408 -0.0928,-0.91308 -0.27832,-1.16699 -0.18555,-0.2539 -0.46875,-0.38086 -0.84961,-0.38086 -0.4655,0 -0.83334,0.15463 -1.10351,0.46387 -0.27019,0.30924 -0.40528,0.73079 -0.40528,1.26464 l 0,3.09082 -0.90332,0 0,-3.27148 c 0,-0.52734 -0.0928,-0.91634 -0.27832,-1.16699 -0.18555,-0.2539 -0.472,-0.38086 -0.85937,-0.38086 -0.45899,0 -0.82357,0.15625 -1.09375,0.46875 -0.27019,0.30925 -0.40528,0.72917 -0.40527,1.25976 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.20507,-0.33528 0.45084,-0.58267 0.7373,-0.74218 0.28646,-0.1595 0.62662,-0.23926 1.02051,-0.23926 0.39713,0 0.73404,0.10092 1.01074,0.30273 0.27994,0.20183 0.48665,0.4948 0.62012,0.87891"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3287" />
|
||||||
|
<path
|
||||||
|
d="m 389.33316,378.36679 c -0.72591,0 -1.22884,0.083 -1.50879,0.24902 -0.27995,0.16602 -0.41992,0.44923 -0.41992,0.84961 0,0.31902 0.10416,0.57292 0.3125,0.76172 0.21159,0.18555 0.49804,0.27832 0.85937,0.27832 0.49805,0 0.89681,-0.17578 1.19629,-0.52734 0.30273,-0.35482 0.4541,-0.82519 0.45411,-1.41113 l 0,-0.2002 -0.89356,0 m 1.79199,-0.37109 0,3.12011 -0.89843,0 0,-0.83007 c -0.20509,0.33203 -0.46062,0.5778 -0.76661,0.7373 -0.30599,0.15625 -0.68034,0.23438 -1.12304,0.23438 -0.5599,0 -1.00586,-0.15625 -1.33789,-0.46875 -0.32878,-0.31576 -0.49317,-0.73731 -0.49317,-1.26465 0,-0.61523 0.20508,-1.0791 0.61524,-1.3916 0.41341,-0.3125 1.02864,-0.46875 1.8457,-0.46875 l 1.25977,0 0,-0.0879 c -10e-6,-0.41341 -0.13673,-0.73242 -0.41016,-0.95704 -0.27019,-0.22786 -0.65105,-0.34179 -1.14258,-0.34179 -0.3125,0 -0.61686,0.0374 -0.91309,0.1123 -0.29622,0.0749 -0.58105,0.18718 -0.85449,0.33692 l 0,-0.83008 c 0.32878,-0.12695 0.64779,-0.22135 0.95703,-0.28321 0.30925,-0.0651 0.61035,-0.0977 0.90332,-0.0977 0.79102,0 1.38184,0.20508 1.77247,0.61523 0.39062,0.41016 0.58593,1.03191 0.58593,1.86524"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3289" />
|
||||||
|
<path
|
||||||
|
d="m 396.14957,376.48691 c -0.10092,-0.0586 -0.2116,-0.10091 -0.33203,-0.12696 -0.1172,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49805 -0.27019,0.32878 -0.40528,0.80241 -0.40528,1.42089 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0147 0.0749,0.007 0.15787,0.0179 0.24902,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3291" />
|
||||||
|
<path
|
||||||
|
d="m 399.37711,381.62363 c -0.25391,0.65104 -0.50131,1.07584 -0.74219,1.27441 -0.24089,0.19857 -0.56315,0.29785 -0.9668,0.29785 l -0.71777,0 0,-0.75195 0.52734,0 c 0.2474,0 0.43945,-0.0586 0.57617,-0.17578 0.13672,-0.11719 0.28809,-0.39388 0.45411,-0.83008 l 0.16113,-0.41016 -2.21192,-5.38086 0.95215,0 1.70899,4.27735 1.70898,-4.27735 0.95215,0 -2.40234,5.97657"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3293" />
|
||||||
|
<path
|
||||||
|
d="m 410.46109,376.69687 c 0.2246,-0.40364 0.49316,-0.70149 0.80566,-0.89356 0.3125,-0.19205 0.68034,-0.28808 1.10352,-0.28808 0.56965,0 1.00911,0.2002 1.31836,0.60058 0.30924,0.39714 0.46386,0.96355 0.46387,1.69922 l 0,3.30078 -0.90332,0 0,-3.27148 c -1e-5,-0.52408 -0.0928,-0.91308 -0.27832,-1.16699 -0.18556,-0.2539 -0.46876,-0.38086 -0.84961,-0.38086 -0.4655,0 -0.83334,0.15463 -1.10352,0.46387 -0.27019,0.30924 -0.40528,0.73079 -0.40527,1.26464 l 0,3.09082 -0.90332,0 0,-3.27148 c -10e-6,-0.52734 -0.0928,-0.91634 -0.27832,-1.16699 -0.18555,-0.2539 -0.47201,-0.38086 -0.85938,-0.38086 -0.45899,0 -0.82357,0.15625 -1.09375,0.46875 -0.27018,0.30925 -0.40527,0.72917 -0.40527,1.25976 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.20507,-0.33528 0.45084,-0.58267 0.7373,-0.74218 0.28646,-0.1595 0.62663,-0.23926 1.02051,-0.23926 0.39713,0 0.73405,0.10092 1.01074,0.30273 0.27995,0.20183 0.48665,0.4948 0.62012,0.87891"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3295" />
|
||||||
|
<path
|
||||||
|
d="m 418.06851,376.27695 c -0.48177,0 -0.86263,0.1888 -1.14258,0.5664 -0.27995,0.37436 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56153 0.47851,0 0.85775,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41991,-0.89192 0.41992,-1.54297 -10e-6,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27995,-0.38086 -0.65919,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39485,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -1e-5,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44597,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66406,-1.21419 -0.66406,-2.10938 0,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44596,-0.50781 1.06119,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3297" />
|
||||||
|
<path
|
||||||
|
d="m 426.60855,377.81503 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51757 -0.10091,-0.90494 -0.30273,-1.16211 -0.20183,-0.25716 -0.50456,-0.38574 -0.9082,-0.38574 -0.48503,0 -0.86752,0.15463 -1.14746,0.46387 -0.27995,0.30924 -0.41993,0.73079 -0.41993,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29297,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19532 1.42578,0.58594 0.32226,0.38737 0.4834,0.95866 0.4834,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3299" />
|
||||||
|
<path
|
||||||
|
d="m 428.41031,375.64706 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3301" />
|
||||||
|
<path
|
||||||
|
d="m 432.07242,374.09433 0,1.55273 1.85058,0 0,0.69825 -1.85058,0 0,2.96875 c 0,0.44596 0.0602,0.73242 0.18066,0.85937 0.1237,0.12696 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17187,-0.12858 -1.43554,-0.38574 -0.26368,-0.26041 -0.39551,-0.73242 -0.39551,-1.41601 l 0,-2.96875 -0.65918,0 0,-0.69825 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3303" />
|
||||||
|
<path
|
||||||
|
d="m 437.22867,376.27695 c -0.48178,0 -0.86263,0.1888 -1.14258,0.5664 -0.27995,0.37436 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13834,1.17025 0.41504,1.54785 0.27994,0.37435 0.66243,0.56153 1.14746,0.56153 0.47851,0 0.85774,-0.1888 1.13769,-0.56641 0.27995,-0.3776 0.41992,-0.89192 0.41993,-1.54297 -1e-5,-0.64778 -0.13998,-1.16048 -0.41993,-1.53808 -0.27995,-0.38086 -0.65918,-0.57129 -1.13769,-0.57129 m 0,-0.76172 c 0.78124,0 1.39485,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66894,2.10937 0,0.89519 -0.22298,1.59831 -0.66894,2.10938 -0.44597,0.50781 -1.05958,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66407,-1.21419 -0.66407,-2.10938 0,-0.89843 0.22136,-1.60156 0.66407,-2.10937 0.44596,-0.50781 1.06119,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3305" />
|
||||||
|
<path
|
||||||
|
d="m 444.39175,376.48691 c -0.10091,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39062,-0.0439 -0.50782,0 -0.89844,0.16602 -1.17188,0.49805 -0.27018,0.32878 -0.40527,0.80241 -0.40527,1.42089 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.7373,-0.7373 0.30274,-0.16276 0.67057,-0.24414 1.10352,-0.24414 0.0618,0 0.1302,0.005 0.20508,0.0147 0.0749,0.007 0.15787,0.0179 0.24902,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3307" />
|
||||||
|
<path
|
||||||
|
d="m 449.39664,380.2955 0,2.90039 -0.90332,0 0,-7.54883 0.90332,0 0,0.83008 c 0.1888,-0.32551 0.42643,-0.5664 0.71289,-0.72265 0.28971,-0.1595 0.63476,-0.23926 1.03515,-0.23926 0.66406,0 1.2028,0.26368 1.61621,0.79101 0.41667,0.52735 0.625,1.22071 0.625,2.08008 0,0.85938 -0.20833,1.55274 -0.625,2.08008 -0.41341,0.52734 -0.95215,0.79102 -1.61621,0.79102 -0.40039,0 -0.74544,-0.0781 -1.03515,-0.23438 -0.28646,-0.1595 -0.52409,-0.40202 -0.71289,-0.72754 m 3.05664,-1.90918 c -1e-5,-0.6608 -0.13673,-1.17838 -0.41016,-1.55273 -0.27019,-0.3776 -0.64291,-0.5664 -1.11816,-0.56641 -0.47527,1e-5 -0.84961,0.18881 -1.12305,0.56641 -0.27018,0.37435 -0.40527,0.89193 -0.40527,1.55273 0,0.66081 0.13509,1.18002 0.40527,1.55762 0.27344,0.37435 0.64778,0.56152 1.12305,0.56152 0.47525,0 0.84797,-0.18717 1.11816,-0.56152 0.27343,-0.3776 0.41015,-0.89681 0.41016,-1.55762"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3309" />
|
||||||
|
<path
|
||||||
|
d="m 456.99429,376.27695 c -0.48177,0 -0.86263,0.1888 -1.14257,0.5664 -0.27995,0.37436 -0.41993,0.88868 -0.41993,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56153 0.47852,0 0.85775,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41992,-0.89192 0.41992,-1.54297 0,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27995,-0.38086 -0.65918,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39486,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -10e-6,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44596,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.7845,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66406,-1.21419 -0.66406,-2.10938 0,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44596,-0.50781 1.0612,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3311" />
|
||||||
|
<path
|
||||||
|
d="m 464.47476,375.8082 0,0.84961 c -0.25391,-0.13021 -0.51758,-0.22786 -0.79101,-0.29297 -0.27344,-0.0651 -0.55665,-0.0976 -0.84961,-0.0977 -0.44597,1e-5 -0.78126,0.0684 -1.00586,0.20508 -0.22136,0.13672 -0.33204,0.3418 -0.33203,0.61523 -10e-6,0.20834 0.0798,0.37273 0.23925,0.49317 0.15951,0.11719 0.48015,0.22949 0.96192,0.33691 l 0.30762,0.0684 c 0.63801,0.13672 1.09049,0.33041 1.35742,0.58106 0.27017,0.24739 0.40527,0.59407 0.40527,1.04004 0,0.50781 -0.20183,0.90983 -0.60547,1.20605 -0.40039,0.29622 -0.95215,0.44434 -1.65527,0.44434 -0.29297,0 -0.59896,-0.0293 -0.91797,-0.0879 -0.31576,-0.0553 -0.64942,-0.13998 -1.00098,-0.25391 l 0,-0.92774 c 0.33203,0.17253 0.65918,0.30274 0.98145,0.39063 0.32226,0.0846 0.64127,0.12695 0.95703,0.12695 0.42317,0 0.74869,-0.0716 0.97656,-0.21484 0.22786,-0.14648 0.3418,-0.35156 0.3418,-0.61524 0,-0.24413 -0.083,-0.43131 -0.24902,-0.56152 -0.16277,-0.13021 -0.52247,-0.25553 -1.07911,-0.37598 l -0.3125,-0.0732 c -0.55664,-0.11718 -0.95866,-0.29622 -1.20605,-0.53711 -0.2474,-0.24413 -0.37109,-0.57779 -0.37109,-1.00097 0,-0.51432 0.18229,-0.91146 0.54687,-1.19141 0.36458,-0.27994 0.88216,-0.41992 1.55274,-0.41992 0.33202,0 0.64452,0.0244 0.9375,0.0732 0.29296,0.0488 0.56314,0.12208 0.81054,0.21973"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3313" />
|
||||||
|
<path
|
||||||
|
d="m 466.20328,375.64706 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3315" />
|
||||||
|
<path
|
||||||
|
d="m 469.86539,374.09433 0,1.55273 1.85058,0 0,0.69825 -1.85058,0 0,2.96875 c 0,0.44596 0.0602,0.73242 0.18066,0.85937 0.1237,0.12696 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26041 -0.3955,-0.73242 -0.3955,-1.41601 l 0,-2.96875 -0.65918,0 0,-0.69825 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3317" />
|
||||||
|
<path
|
||||||
|
d="m 472.9025,375.64706 0.89843,0 0,5.46875 -0.89843,0 0,-5.46875 m 0,-2.1289 0.89843,0 0,1.13769 -0.89843,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3319" />
|
||||||
|
<path
|
||||||
|
d="m 477.79507,376.27695 c -0.48177,0 -0.86263,0.1888 -1.14257,0.5664 -0.27995,0.37436 -0.41993,0.88868 -0.41993,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66244,0.56153 1.14746,0.56153 0.47852,0 0.85775,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41992,-0.89192 0.41992,-1.54297 0,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27995,-0.38086 -0.65918,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39486,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -1e-5,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44596,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.7845,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66406,-1.21419 -0.66406,-2.10938 0,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44596,-0.50781 1.0612,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3321" />
|
||||||
|
<path
|
||||||
|
d="m 486.33511,377.81503 0,3.30078 -0.89843,0 0,-3.27148 c -1e-5,-0.51757 -0.10092,-0.90494 -0.30274,-1.16211 -0.20183,-0.25716 -0.50456,-0.38574 -0.9082,-0.38574 -0.48503,0 -0.86752,0.15463 -1.14746,0.46387 -0.27995,0.30924 -0.41993,0.73079 -0.41992,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75683,-0.7373 0.29297,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19532 1.42579,0.58594 0.32226,0.38737 0.48339,0.95866 0.48339,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3323" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#00b800;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3773">
|
||||||
|
<path
|
||||||
|
d="m 242.85294,625.22699 0,1.1543 c -0.44923,-0.21484 -0.87306,-0.375 -1.27149,-0.48047 -0.39844,-0.10546 -0.78321,-0.1582 -1.1543,-0.15821 -0.64453,10e-6 -1.14258,0.12501 -1.49414,0.375 -0.34765,0.25001 -0.52148,0.60548 -0.52148,1.06641 0,0.38673 0.11523,0.67969 0.3457,0.87891 0.23438,0.19532 0.67578,0.35352 1.32422,0.47461 l 0.71485,0.14648 c 0.8828,0.16797 1.53319,0.46485 1.95117,0.89063 0.42187,0.42187 0.6328,0.98828 0.63281,1.69921 -1e-5,0.84766 -0.28516,1.49024 -0.85547,1.92774 -0.56641,0.4375 -1.39844,0.65625 -2.49609,0.65625 -0.41407,0 -0.85547,-0.0469 -1.32422,-0.14063 -0.46485,-0.0937 -0.94727,-0.23242 -1.44727,-0.41601 l 0,-1.21875 c 0.48047,0.26953 0.95117,0.47266 1.41211,0.60937 0.46094,0.13672 0.91406,0.20508 1.35938,0.20508 0.67577,0 1.19726,-0.13281 1.56445,-0.39844 0.36718,-0.26562 0.55078,-0.64453 0.55078,-1.13671 0,-0.42969 -0.13282,-0.76563 -0.39844,-1.00782 -0.26172,-0.24218 -0.69336,-0.42382 -1.29492,-0.54492 l -0.7207,-0.14062 c -0.88282,-0.17578 -1.52149,-0.45117 -1.91602,-0.82618 -0.39453,-0.37499 -0.59179,-0.89647 -0.59179,-1.56445 0,-0.77343 0.27148,-1.3828 0.81445,-1.82812 0.54687,-0.44531 1.29882,-0.66796 2.25586,-0.66797 0.41015,10e-6 0.82812,0.0371 1.25391,0.11133 0.42577,0.0742 0.86132,0.18555 1.30664,0.33398"
|
||||||
|
style=""
|
||||||
|
id="path3355" />
|
||||||
|
<path
|
||||||
|
d="m 250.79239,630.13715 0,0.52734 -4.95703,0 c 0.0469,0.74219 0.26953,1.3086 0.66797,1.69922 0.40234,0.38672 0.96093,0.58008 1.67578,0.58008 0.41406,0 0.81445,-0.0508 1.20117,-0.15235 0.39062,-0.10156 0.77734,-0.2539 1.16016,-0.45703 l 0,1.01953 c -0.38673,0.16407 -0.78321,0.28907 -1.18946,0.375 -0.40625,0.0859 -0.81836,0.12891 -1.23633,0.12891 -1.04687,0 -1.87695,-0.30469 -2.49023,-0.91406 -0.60938,-0.60938 -0.91406,-1.43359 -0.91406,-2.47266 0,-1.07421 0.28906,-1.92578 0.86719,-2.55469 0.58202,-0.6328 1.36523,-0.94921 2.3496,-0.94922 0.88281,10e-6 1.58008,0.28517 2.0918,0.85547 0.51562,0.56641 0.77343,1.3379 0.77344,2.31446 m -1.07813,-0.31641 c -0.008,-0.58984 -0.17383,-1.06054 -0.49804,-1.41211 -0.32032,-0.35156 -0.7461,-0.52734 -1.27735,-0.52734 -0.60156,0 -1.08398,0.16992 -1.44726,0.50976 -0.35938,0.33985 -0.56641,0.81837 -0.6211,1.43555 l 3.84375,-0.006"
|
||||||
|
style=""
|
||||||
|
id="path3357" />
|
||||||
|
<path
|
||||||
|
d="m 257.28458,627.37738 0,1.00781 c -0.3047,-0.16796 -0.61134,-0.29296 -0.91993,-0.375 -0.30469,-0.0859 -0.61328,-0.1289 -0.92578,-0.1289 -0.69922,0 -1.24219,0.22266 -1.6289,0.66797 -0.38672,0.44141 -0.58008,1.0625 -0.58008,1.86328 0,0.80078 0.19336,1.42383 0.58008,1.86914 0.38671,0.4414 0.92968,0.66211 1.6289,0.66211 0.3125,0 0.62109,-0.041 0.92578,-0.12305 0.30859,-0.0859 0.61523,-0.21289 0.91993,-0.38086 l 0,0.99609 c -0.30079,0.14063 -0.61329,0.2461 -0.9375,0.31641 -0.32032,0.0703 -0.66212,0.10547 -1.02539,0.10547 -0.98829,0 -1.77344,-0.31055 -2.35547,-0.93164 -0.58204,-0.62109 -0.87305,-1.45898 -0.87305,-2.51367 0,-1.07031 0.29297,-1.91211 0.87891,-2.52539 0.58984,-0.61328 1.39648,-0.91992 2.41992,-0.91993 0.33203,10e-6 0.65624,0.0352 0.97265,0.10547 0.31641,0.0664 0.62305,0.16798 0.91993,0.30469"
|
||||||
|
style=""
|
||||||
|
id="path3359" />
|
||||||
|
<path
|
||||||
|
d="m 261.71426,627.88129 c -0.57812,0 -1.03515,0.22656 -1.37109,0.67968 -0.33594,0.44923 -0.50391,1.06641 -0.50391,1.85157 0,0.78516 0.16602,1.4043 0.49805,1.85742 0.33594,0.44922 0.79492,0.67383 1.37695,0.67383 0.57422,0 1.0293,-0.22656 1.36524,-0.67969 0.33593,-0.45312 0.5039,-1.07031 0.5039,-1.85156 0,-0.77734 -0.16797,-1.39258 -0.5039,-1.84571 -0.33594,-0.45702 -0.79102,-0.68554 -1.36524,-0.68554 m 0,-0.91407 c 0.9375,10e-6 1.67383,0.3047 2.20899,0.91407 0.53515,0.60938 0.80273,1.45313 0.80273,2.53125 0,1.07422 -0.26758,1.91797 -0.80273,2.53125 -0.53516,0.60937 -1.27149,0.91406 -2.20899,0.91406 -0.94141,0 -1.67969,-0.30469 -2.21484,-0.91406 -0.53125,-0.61328 -0.79688,-1.45703 -0.79687,-2.53125 -10e-6,-1.07812 0.26562,-1.92187 0.79687,-2.53125 0.53515,-0.60937 1.27343,-0.91406 2.21484,-0.91407"
|
||||||
|
style=""
|
||||||
|
id="path3361" />
|
||||||
|
<path
|
||||||
|
d="m 271.96231,629.72699 0,3.96094 -1.07812,0 0,-3.92578 c -10e-6,-0.62109 -0.1211,-1.08594 -0.36329,-1.39454 -0.24219,-0.30858 -0.60547,-0.46288 -1.08984,-0.46289 -0.58203,10e-6 -1.04102,0.18556 -1.37695,0.55664 -0.33594,0.3711 -0.50391,0.87696 -0.50391,1.51758 l 0,3.70899 -1.08398,0 0,-6.5625 1.08398,0 0,1.01953 c 0.25781,-0.39453 0.56055,-0.68945 0.9082,-0.88477 0.35156,-0.1953 0.75586,-0.29296 1.2129,-0.29297 0.7539,10e-6 1.32421,0.23439 1.71093,0.70313 0.38672,0.46485 0.58007,1.15039 0.58008,2.05664"
|
||||||
|
style=""
|
||||||
|
id="path3363" />
|
||||||
|
<path
|
||||||
|
d="m 278.44278,628.12152 0,-3.55078 1.07812,0 0,9.11719 -1.07812,0 0,-0.98438 c -0.22657,0.39063 -0.51368,0.68164 -0.86133,0.87305 -0.34375,0.1875 -0.75781,0.28125 -1.24219,0.28125 -0.79297,0 -1.43945,-0.31641 -1.93945,-0.94922 -0.49609,-0.63281 -0.74414,-1.46484 -0.74414,-2.49609 0,-1.03125 0.24805,-1.86328 0.74414,-2.4961 0.5,-0.6328 1.14648,-0.94921 1.93945,-0.94922 0.48438,10e-6 0.89844,0.0957 1.24219,0.28711 0.34765,0.18751 0.63476,0.47657 0.86133,0.86719 m -3.67383,2.29102 c 0,0.79297 0.16211,1.41601 0.48633,1.86914 0.32812,0.44922 0.77734,0.67383 1.34766,0.67383 0.5703,0 1.01952,-0.22461 1.34765,-0.67383 0.32812,-0.45313 0.49218,-1.07617 0.49219,-1.86914 -1e-5,-0.79297 -0.16407,-1.41406 -0.49219,-1.86328 -0.32813,-0.45312 -0.77735,-0.67969 -1.34765,-0.67969 -0.57032,0 -1.01954,0.22657 -1.34766,0.67969 -0.32422,0.44922 -0.48633,1.07031 -0.48633,1.86328"
|
||||||
|
style=""
|
||||||
|
id="path3365" />
|
||||||
|
<path
|
||||||
|
d="m 284.72403,630.3891 c -0.8711,0 -1.47461,0.0996 -1.81055,0.29883 -0.33594,0.19922 -0.50391,0.53906 -0.5039,1.01953 -1e-5,0.38281 0.12499,0.6875 0.375,0.91406 0.2539,0.22266 0.59765,0.33399 1.03125,0.33399 0.59765,0 1.07616,-0.21094 1.43554,-0.63282 0.36328,-0.42578 0.54492,-0.99023 0.54493,-1.69336 l 0,-0.24023 -1.07227,0 m 2.15039,-0.44531 0,3.74414 -1.07812,0 0,-0.9961 c -0.2461,0.39844 -0.55274,0.69336 -0.91993,0.88477 -0.36719,0.1875 -0.81641,0.28125 -1.34765,0.28125 -0.67188,0 -1.20704,-0.1875 -1.60547,-0.5625 -0.39453,-0.37891 -0.5918,-0.88477 -0.5918,-1.51758 0,-0.73828 0.24609,-1.29492 0.73828,-1.66992 0.49609,-0.375 1.23437,-0.5625 2.21485,-0.5625 l 1.51172,0 0,-0.10547 c -10e-6,-0.49609 -0.16407,-0.8789 -0.49219,-1.14844 -0.32423,-0.27343 -0.78126,-0.41015 -1.3711,-0.41015 -0.375,0 -0.74023,0.0449 -1.0957,0.13476 -0.35547,0.0899 -0.69727,0.22462 -1.02539,0.4043 l 0,-0.99609 c 0.39453,-0.15234 0.77734,-0.26562 1.14844,-0.33985 0.37109,-0.0781 0.73242,-0.11718 1.08398,-0.11719 0.94922,10e-6 1.6582,0.2461 2.12696,0.73829 0.46874,0.49219 0.70311,1.23828 0.70312,2.23828"
|
||||||
|
style=""
|
||||||
|
id="path3367" />
|
||||||
|
<path
|
||||||
|
d="m 292.90372,628.13324 c -0.1211,-0.0703 -0.25391,-0.12109 -0.39844,-0.15234 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,10e-6 -1.07813,0.19923 -1.40625,0.59766 -0.32422,0.39453 -0.48633,0.96289 -0.48633,1.70508 l 0,3.45703 -1.08398,0 0,-6.5625 1.08398,0 0,1.01953 c 0.22656,-0.39843 0.52148,-0.69335 0.88477,-0.88477 0.36327,-0.1953 0.80468,-0.29296 1.32422,-0.29297 0.0742,10e-6 0.15624,0.006 0.24609,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10742"
|
||||||
|
style=""
|
||||||
|
id="path3369" />
|
||||||
|
<path
|
||||||
|
d="m 296.77676,634.2973 c -0.30469,0.78125 -0.60156,1.29102 -0.89062,1.5293 -0.28907,0.23828 -0.67578,0.35742 -1.16016,0.35742 l -0.86133,0 0,-0.90234 0.63282,0 c 0.29687,0 0.52734,-0.0703 0.6914,-0.21094 0.16406,-0.14063 0.3457,-0.47266 0.54493,-0.99609 l 0.19335,-0.49219 -2.65429,-6.45703 1.14258,0 2.05078,5.13281 2.05078,-5.13281 1.14258,0 -2.88282,7.17187"
|
||||||
|
style=""
|
||||||
|
id="path3371" />
|
||||||
|
<path
|
||||||
|
d="m 305.01505,624.93988 1.76367,0 2.23242,5.95313 2.24414,-5.95313 1.76367,0 0,8.74805 -1.1543,0 0,-7.68164 -2.25585,6 -1.18946,0 -2.25586,-6 0,7.68164 -1.14843,0 0,-8.74805"
|
||||||
|
style=""
|
||||||
|
id="path3373" />
|
||||||
|
<path
|
||||||
|
d="m 317.87051,627.88129 c -0.57812,0 -1.03515,0.22656 -1.37109,0.67968 -0.33594,0.44923 -0.50391,1.06641 -0.50391,1.85157 0,0.78516 0.16602,1.4043 0.49805,1.85742 0.33594,0.44922 0.79492,0.67383 1.37695,0.67383 0.57422,0 1.0293,-0.22656 1.36524,-0.67969 0.33593,-0.45312 0.5039,-1.07031 0.5039,-1.85156 0,-0.77734 -0.16797,-1.39258 -0.5039,-1.84571 -0.33594,-0.45702 -0.79102,-0.68554 -1.36524,-0.68554 m 0,-0.91407 c 0.9375,10e-6 1.67383,0.3047 2.20899,0.91407 0.53515,0.60938 0.80273,1.45313 0.80273,2.53125 0,1.07422 -0.26758,1.91797 -0.80273,2.53125 -0.53516,0.60937 -1.27149,0.91406 -2.20899,0.91406 -0.94141,0 -1.67969,-0.30469 -2.21484,-0.91406 -0.53125,-0.61328 -0.79688,-1.45703 -0.79687,-2.53125 -10e-6,-1.07812 0.26562,-1.92187 0.79687,-2.53125 0.53515,-0.60937 1.27343,-0.91406 2.21484,-0.91407"
|
||||||
|
style=""
|
||||||
|
id="path3375" />
|
||||||
|
<path
|
||||||
|
d="m 328.11856,629.72699 0,3.96094 -1.07812,0 0,-3.92578 c -10e-6,-0.62109 -0.1211,-1.08594 -0.36329,-1.39454 -0.24219,-0.30858 -0.60547,-0.46288 -1.08984,-0.46289 -0.58203,10e-6 -1.04102,0.18556 -1.37695,0.55664 -0.33594,0.3711 -0.50391,0.87696 -0.50391,1.51758 l 0,3.70899 -1.08398,0 0,-6.5625 1.08398,0 0,1.01953 c 0.25781,-0.39453 0.56055,-0.68945 0.9082,-0.88477 0.35156,-0.1953 0.75586,-0.29296 1.2129,-0.29297 0.7539,10e-6 1.32421,0.23439 1.71093,0.70313 0.38672,0.46485 0.58007,1.15039 0.58008,2.05664"
|
||||||
|
style=""
|
||||||
|
id="path3377" />
|
||||||
|
<path
|
||||||
|
d="m 330.28067,627.12543 1.07813,0 0,6.5625 -1.07813,0 0,-6.5625 m 0,-2.55469 1.07813,0 0,1.36523 -1.07813,0 0,-1.36523"
|
||||||
|
style=""
|
||||||
|
id="path3379" />
|
||||||
|
<path
|
||||||
|
d="m 334.6752,625.26215 0,1.86328 2.2207,0 0,0.83789 -2.2207,0 0,3.5625 c 0,0.53516 0.0723,0.87891 0.2168,1.03125 0.14843,0.15234 0.44726,0.22851 0.89648,0.22851 l 1.10742,0 0,0.90235 -1.10742,0 c -0.83203,0 -1.40625,-0.1543 -1.72265,-0.46289 -0.31641,-0.3125 -0.47461,-0.87891 -0.47461,-1.69922 l 0,-3.5625 -0.79102,0 0,-0.83789 0.79102,0 0,-1.86328 1.08398,0"
|
||||||
|
style=""
|
||||||
|
id="path3381" />
|
||||||
|
<path
|
||||||
|
d="m 340.8627,627.88129 c -0.57813,0 -1.03516,0.22656 -1.37109,0.67968 -0.33594,0.44923 -0.50391,1.06641 -0.50391,1.85157 0,0.78516 0.16602,1.4043 0.49805,1.85742 0.33593,0.44922 0.79492,0.67383 1.37695,0.67383 0.57422,0 1.02929,-0.22656 1.36524,-0.67969 0.33593,-0.45312 0.5039,-1.07031 0.5039,-1.85156 0,-0.77734 -0.16797,-1.39258 -0.5039,-1.84571 -0.33595,-0.45702 -0.79102,-0.68554 -1.36524,-0.68554 m 0,-0.91407 c 0.9375,10e-6 1.67382,0.3047 2.20899,0.91407 0.53515,0.60938 0.80272,1.45313 0.80273,2.53125 -10e-6,1.07422 -0.26758,1.91797 -0.80273,2.53125 -0.53517,0.60937 -1.27149,0.91406 -2.20899,0.91406 -0.94141,0 -1.67969,-0.30469 -2.21484,-0.91406 -0.53125,-0.61328 -0.79688,-1.45703 -0.79688,-2.53125 0,-1.07812 0.26563,-1.92187 0.79688,-2.53125 0.53515,-0.60937 1.27343,-0.91406 2.21484,-0.91407"
|
||||||
|
style=""
|
||||||
|
id="path3383" />
|
||||||
|
<path
|
||||||
|
d="m 349.4584,628.13324 c -0.12109,-0.0703 -0.25391,-0.12109 -0.39843,-0.15234 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,10e-6 -1.07813,0.19923 -1.40625,0.59766 -0.32422,0.39453 -0.48633,0.96289 -0.48633,1.70508 l 0,3.45703 -1.08399,0 0,-6.5625 1.08399,0 0,1.01953 c 0.22656,-0.39843 0.52148,-0.69335 0.88476,-0.88477 0.36328,-0.1953 0.80469,-0.29296 1.32422,-0.29297 0.0742,10e-6 0.15625,0.006 0.2461,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10742"
|
||||||
|
style=""
|
||||||
|
id="path3385" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#00b800;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3777">
|
||||||
|
<path
|
||||||
|
d="m 575.27002,547.52673 0,3.28711 1.48828,0 c 0.55078,10e-6 0.97656,-0.14257 1.27734,-0.42773 0.30078,-0.28515 0.45117,-0.6914 0.45118,-1.21875 -10e-6,-0.52343 -0.1504,-0.92773 -0.45118,-1.21289 -0.30078,-0.28515 -0.72656,-0.42773 -1.27734,-0.42774 l -1.48828,0 m -1.18359,-0.97265 2.67187,0 c 0.98046,10e-6 1.7207,0.22266 2.2207,0.66797 0.5039,0.44141 0.75586,1.08985 0.75586,1.94531 0,0.86328 -0.25196,1.51563 -0.75586,1.95703 -0.5,0.44141 -1.24024,0.66211 -2.2207,0.66211 l -1.48828,0 0,3.51562 -1.18359,0 0,-8.74804"
|
||||||
|
style=""
|
||||||
|
id="path3326" />
|
||||||
|
<path
|
||||||
|
d="m 584.87354,549.74744 c -0.1211,-0.0703 -0.25392,-0.12109 -0.39844,-0.15235 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,0 -1.07813,0.19922 -1.40625,0.59765 -0.32422,0.39454 -0.48633,0.9629 -0.48633,1.70508 l 0,3.45703 -1.08398,0 0,-6.5625 1.08398,0 0,1.01954 c 0.22656,-0.39844 0.52148,-0.69336 0.88477,-0.88477 0.36327,-0.19531 0.80468,-0.29296 1.32421,-0.29297 0.0742,10e-6 0.15625,0.006 0.2461,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10743"
|
||||||
|
style=""
|
||||||
|
id="path3328" />
|
||||||
|
<path
|
||||||
|
d="m 586.01611,548.73962 1.07813,0 0,6.5625 -1.07813,0 0,-6.5625 m 0,-2.55468 1.07813,0 0,1.36523 -1.07813,0 0,-1.36523"
|
||||||
|
style=""
|
||||||
|
id="path3330" />
|
||||||
|
<path
|
||||||
|
d="m 594.45361,549.99939 c 0.26953,-0.48437 0.59179,-0.84179 0.9668,-1.07227 0.37499,-0.23046 0.8164,-0.34569 1.32422,-0.3457 0.68358,10e-6 1.21093,0.24024 1.58203,0.7207 0.37108,0.47657 0.55663,1.15626 0.55664,2.03907 l 0,3.96093 -1.08398,0 0,-3.92578 c -10e-6,-0.6289 -0.11134,-1.0957 -0.33399,-1.40039 -0.22266,-0.30468 -0.56251,-0.45702 -1.01953,-0.45703 -0.5586,10e-6 -1.00001,0.18555 -1.32422,0.55664 -0.32422,0.3711 -0.48633,0.87696 -0.48633,1.51758 l 0,3.70898 -1.08398,0 0,-3.92578 c -1e-5,-0.63281 -0.11133,-1.0996 -0.33398,-1.40039 -0.22267,-0.30468 -0.56642,-0.45702 -1.03125,-0.45703 -0.55079,10e-6 -0.98829,0.18751 -1.3125,0.5625 -0.32423,0.3711 -0.48634,0.87501 -0.48633,1.51172 l 0,3.70898 -1.08399,0 0,-6.5625 1.08399,0 0,1.01954 c 0.24609,-0.40234 0.54101,-0.69922 0.88476,-0.89063 0.34375,-0.1914 0.75195,-0.2871 1.22461,-0.28711 0.47656,10e-6 0.88086,0.1211 1.21289,0.36328 0.33593,0.2422 0.58398,0.59376 0.74414,1.05469"
|
||||||
|
style=""
|
||||||
|
id="path3332" />
|
||||||
|
<path
|
||||||
|
d="m 604.02197,552.0033 c -0.87109,0 -1.47461,0.0996 -1.81054,0.29882 -0.33594,0.19923 -0.50391,0.53907 -0.50391,1.01954 0,0.38281 0.125,0.6875 0.375,0.91406 0.2539,0.22265 0.59765,0.33398 1.03125,0.33398 0.59765,0 1.07617,-0.21093 1.43555,-0.63281 0.36327,-0.42578 0.54491,-0.99023 0.54492,-1.69336 l 0,-0.24023 -1.07227,0 m 2.15039,-0.44532 0,3.74414 -1.07812,0 0,-0.99609 c -0.2461,0.39844 -0.55274,0.69336 -0.91992,0.88477 -0.36719,0.1875 -0.81641,0.28125 -1.34766,0.28125 -0.67188,0 -1.20703,-0.1875 -1.60547,-0.5625 -0.39453,-0.37891 -0.5918,-0.88477 -0.5918,-1.51758 0,-0.73828 0.2461,-1.29492 0.73829,-1.66992 0.49609,-0.375 1.23437,-0.5625 2.21484,-0.5625 l 1.51172,0 0,-0.10547 c -10e-6,-0.49609 -0.16407,-0.8789 -0.49219,-1.14844 -0.32422,-0.27343 -0.78125,-0.41015 -1.37109,-0.41016 -0.37501,10e-6 -0.74024,0.0449 -1.09571,0.13477 -0.35547,0.0898 -0.69726,0.22461 -1.02539,0.4043 l 0,-0.9961 c 0.39453,-0.15234 0.77735,-0.26562 1.14844,-0.33984 0.37109,-0.0781 0.73242,-0.11718 1.08399,-0.11719 0.94921,10e-6 1.65819,0.2461 2.12695,0.73828 0.46874,0.4922 0.70312,1.23829 0.70312,2.23828"
|
||||||
|
style=""
|
||||||
|
id="path3334" />
|
||||||
|
<path
|
||||||
|
d="m 612.20166,549.74744 c -0.1211,-0.0703 -0.25391,-0.12109 -0.39844,-0.15235 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,0 -1.07813,0.19922 -1.40625,0.59765 -0.32422,0.39454 -0.48633,0.9629 -0.48633,1.70508 l 0,3.45703 -1.08398,0 0,-6.5625 1.08398,0 0,1.01954 c 0.22656,-0.39844 0.52149,-0.69336 0.88477,-0.88477 0.36328,-0.19531 0.80468,-0.29296 1.32422,-0.29297 0.0742,10e-6 0.15624,0.006 0.24609,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10743"
|
||||||
|
style=""
|
||||||
|
id="path3336" />
|
||||||
|
<path
|
||||||
|
d="m 616.07471,555.9115 c -0.30469,0.78125 -0.60157,1.29101 -0.89063,1.5293 -0.28906,0.23827 -0.67578,0.35742 -1.16015,0.35742 l -0.86133,0 0,-0.90235 0.63281,0 c 0.29687,0 0.52734,-0.0703 0.69141,-0.21093 0.16406,-0.14063 0.3457,-0.47266 0.54492,-0.9961 l 0.19336,-0.49218 -2.6543,-6.45704 1.14258,0 2.05078,5.13282 2.05078,-5.13282 1.14258,0 -2.88281,7.17188"
|
||||||
|
style=""
|
||||||
|
id="path3338" />
|
||||||
|
<path
|
||||||
|
d="m 624.31299,546.55408 1.76367,0 2.23242,5.95312 2.24414,-5.95312 1.76367,0 0,8.74804 -1.15429,0 0,-7.68164 -2.25586,6 -1.18945,0 -2.25586,-6 0,7.68164 -1.14844,0 0,-8.74804"
|
||||||
|
style=""
|
||||||
|
id="path3340" />
|
||||||
|
<path
|
||||||
|
d="m 637.16846,549.49548 c -0.57813,10e-6 -1.03516,0.22657 -1.3711,0.67969 -0.33594,0.44922 -0.5039,1.06641 -0.5039,1.85156 0,0.78516 0.16601,1.4043 0.49804,1.85743 0.33594,0.44921 0.79492,0.67382 1.37696,0.67382 0.57421,0 1.02929,-0.22656 1.36523,-0.67968 0.33593,-0.45313 0.5039,-1.07031 0.50391,-1.85157 -10e-6,-0.77734 -0.16798,-1.39257 -0.50391,-1.8457 -0.33594,-0.45703 -0.79102,-0.68554 -1.36523,-0.68555 m 0,-0.91406 c 0.93749,10e-6 1.67382,0.30469 2.20898,0.91406 0.53515,0.60938 0.80273,1.45313 0.80274,2.53125 -10e-6,1.07422 -0.26759,1.91797 -0.80274,2.53125 -0.53516,0.60938 -1.27149,0.91407 -2.20898,0.91407 -0.94141,0 -1.67969,-0.30469 -2.21485,-0.91407 -0.53125,-0.61328 -0.79687,-1.45703 -0.79687,-2.53125 0,-1.07812 0.26562,-1.92187 0.79687,-2.53125 0.53516,-0.60937 1.27344,-0.91405 2.21485,-0.91406"
|
||||||
|
style=""
|
||||||
|
id="path3342" />
|
||||||
|
<path
|
||||||
|
d="m 647.4165,551.34119 0,3.96093 -1.07812,0 0,-3.92578 c -10e-6,-0.62109 -0.1211,-1.08593 -0.36328,-1.39453 -0.24219,-0.30859 -0.60548,-0.46288 -1.08985,-0.46289 -0.58203,10e-6 -1.04101,0.18555 -1.37695,0.55664 -0.33594,0.3711 -0.50391,0.87696 -0.50391,1.51758 l 0,3.70898 -1.08398,0 0,-6.5625 1.08398,0 0,1.01954 c 0.25781,-0.39453 0.56055,-0.68945 0.90821,-0.88477 0.35156,-0.19531 0.75585,-0.29296 1.21289,-0.29297 0.7539,10e-6 1.32421,0.23438 1.71094,0.70313 0.38671,0.46485 0.58007,1.15039 0.58007,2.05664"
|
||||||
|
style=""
|
||||||
|
id="path3344" />
|
||||||
|
<path
|
||||||
|
d="m 649.57861,548.73962 1.07813,0 0,6.5625 -1.07813,0 0,-6.5625 m 0,-2.55468 1.07813,0 0,1.36523 -1.07813,0 0,-1.36523"
|
||||||
|
style=""
|
||||||
|
id="path3346" />
|
||||||
|
<path
|
||||||
|
d="m 653.97314,546.87634 0,1.86328 2.22071,0 0,0.83789 -2.22071,0 0,3.5625 c 0,0.53516 0.0723,0.87891 0.2168,1.03125 0.14844,0.15235 0.44726,0.22852 0.89649,0.22852 l 1.10742,0 0,0.90234 -1.10742,0 c -0.83204,0 -1.40626,-0.15429 -1.72266,-0.46289 -0.31641,-0.3125 -0.47461,-0.8789 -0.47461,-1.69922 l 0,-3.5625 -0.79102,0 0,-0.83789 0.79102,0 0,-1.86328 1.08398,0"
|
||||||
|
style=""
|
||||||
|
id="path3348" />
|
||||||
|
<path
|
||||||
|
d="m 660.16064,549.49548 c -0.57812,10e-6 -1.03515,0.22657 -1.37109,0.67969 -0.33594,0.44922 -0.50391,1.06641 -0.50391,1.85156 0,0.78516 0.16602,1.4043 0.49805,1.85743 0.33594,0.44921 0.79492,0.67382 1.37695,0.67382 0.57422,0 1.0293,-0.22656 1.36524,-0.67968 0.33593,-0.45313 0.5039,-1.07031 0.50391,-1.85157 -1e-5,-0.77734 -0.16798,-1.39257 -0.50391,-1.8457 -0.33594,-0.45703 -0.79102,-0.68554 -1.36524,-0.68555 m 0,-0.91406 c 0.9375,10e-6 1.67383,0.30469 2.20899,0.91406 0.53515,0.60938 0.80273,1.45313 0.80273,2.53125 0,1.07422 -0.26758,1.91797 -0.80273,2.53125 -0.53516,0.60938 -1.27149,0.91407 -2.20899,0.91407 -0.9414,0 -1.67968,-0.30469 -2.21484,-0.91407 -0.53125,-0.61328 -0.79687,-1.45703 -0.79687,-2.53125 0,-1.07812 0.26562,-1.92187 0.79687,-2.53125 0.53516,-0.60937 1.27344,-0.91405 2.21484,-0.91406"
|
||||||
|
style=""
|
||||||
|
id="path3350" />
|
||||||
|
<path
|
||||||
|
d="m 668.75635,549.74744 c -0.1211,-0.0703 -0.25391,-0.12109 -0.39844,-0.15235 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,0 -1.07813,0.19922 -1.40625,0.59765 -0.32422,0.39454 -0.48633,0.9629 -0.48633,1.70508 l 0,3.45703 -1.08398,0 0,-6.5625 1.08398,0 0,1.01954 c 0.22656,-0.39844 0.52148,-0.69336 0.88477,-0.88477 0.36328,-0.19531 0.80468,-0.29296 1.32422,-0.29297 0.0742,10e-6 0.15624,0.006 0.24609,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10743"
|
||||||
|
style=""
|
||||||
|
id="path3352" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3781">
|
||||||
|
<path
|
||||||
|
d="m 612.64136,657.77118 -3.33985,-8.74805 1.23633,0 2.77149,7.36524 2.77734,-7.36524 1.23047,0 -3.33399,8.74805 -1.34179,0"
|
||||||
|
style=""
|
||||||
|
id="path3401" />
|
||||||
|
<path
|
||||||
|
d="m 618.28394,651.20868 1.07812,0 0,6.5625 -1.07812,0 0,-6.5625 m 0,-2.55469 1.07812,0 0,1.36524 -1.07812,0 0,-1.36524"
|
||||||
|
style=""
|
||||||
|
id="path3403" />
|
||||||
|
<path
|
||||||
|
d="m 625.41479,652.21649 c -0.12109,-0.0703 -0.25391,-0.12109 -0.39843,-0.15234 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,1e-5 -1.07813,0.19923 -1.40625,0.59766 -0.32422,0.39454 -0.48633,0.96289 -0.48633,1.70508 l 0,3.45703 -1.08399,0 0,-6.5625 1.08399,0 0,1.01953 c 0.22656,-0.39843 0.52148,-0.69335 0.88476,-0.88477 0.36328,-0.1953 0.80469,-0.29296 1.32422,-0.29296 0.0742,0 0.15625,0.006 0.2461,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10742"
|
||||||
|
style=""
|
||||||
|
id="path3405" />
|
||||||
|
<path
|
||||||
|
d="m 627.62378,649.3454 0,1.86328 2.2207,0 0,0.83789 -2.2207,0 0,3.5625 c 0,0.53516 0.0723,0.87891 0.2168,1.03125 0.14843,0.15234 0.44726,0.22852 0.89648,0.22852 l 1.10742,0 0,0.90234 -1.10742,0 c -0.83203,0 -1.40625,-0.1543 -1.72266,-0.46289 -0.3164,-0.3125 -0.47461,-0.87891 -0.47461,-1.69922 l 0,-3.5625 -0.79101,0 0,-0.83789 0.79101,0 0,-1.86328 1.08399,0"
|
||||||
|
style=""
|
||||||
|
id="path3407" />
|
||||||
|
<path
|
||||||
|
d="m 631.15698,655.18134 0,-3.97266 1.07813,0 0,3.93164 c 0,0.6211 0.12109,1.08789 0.36328,1.40039 0.24218,0.3086 0.60546,0.46289 1.08984,0.46289 0.58203,0 1.04101,-0.18554 1.37696,-0.55664 0.33983,-0.37109 0.50976,-0.87695 0.50976,-1.51758 l 0,-3.7207 1.07813,0 0,6.5625 -1.07813,0 0,-1.00781 c -0.26172,0.39843 -0.56641,0.69531 -0.91406,0.89062 -0.34376,0.19141 -0.74415,0.28711 -1.20117,0.28711 -0.75391,0 -1.32618,-0.23437 -1.7168,-0.70312 -0.39063,-0.46875 -0.58594,-1.1543 -0.58594,-2.05664 m 2.71289,-4.13086 0,0"
|
||||||
|
style=""
|
||||||
|
id="path3409" />
|
||||||
|
<path
|
||||||
|
d="m 641.86792,654.47235 c -0.8711,0 -1.47461,0.0996 -1.81055,0.29883 -0.33594,0.19922 -0.50391,0.53906 -0.5039,1.01953 -10e-6,0.38281 0.12499,0.6875 0.375,0.91406 0.2539,0.22266 0.59765,0.33399 1.03125,0.33399 0.59765,0 1.07616,-0.21094 1.43554,-0.63282 0.36328,-0.42577 0.54492,-0.99023 0.54493,-1.69335 l 0,-0.24024 -1.07227,0 m 2.15039,-0.44531 0,3.74414 -1.07812,0 0,-0.99609 c -0.2461,0.39843 -0.55274,0.69336 -0.91993,0.88476 -0.36719,0.1875 -0.81641,0.28125 -1.34765,0.28125 -0.67188,0 -1.20704,-0.1875 -1.60547,-0.5625 -0.39453,-0.3789 -0.5918,-0.88476 -0.5918,-1.51758 0,-0.73828 0.24609,-1.29492 0.73828,-1.66992 0.49609,-0.37499 1.23438,-0.56249 2.21485,-0.5625 l 1.51172,0 0,-0.10547 c -10e-6,-0.49609 -0.16407,-0.8789 -0.49219,-1.14844 -0.32423,-0.27343 -0.78126,-0.41015 -1.3711,-0.41015 -0.375,0 -0.74023,0.0449 -1.0957,0.13476 -0.35547,0.0899 -0.69727,0.22462 -1.02539,0.4043 l 0,-0.99609 c 0.39453,-0.15234 0.77734,-0.26562 1.14844,-0.33985 0.37109,-0.0781 0.73242,-0.11718 1.08398,-0.11718 0.94922,0 1.6582,0.2461 2.12696,0.73828 0.46874,0.49219 0.70311,1.23828 0.70312,2.23828"
|
||||||
|
style=""
|
||||||
|
id="path3411" />
|
||||||
|
<path
|
||||||
|
d="m 646.24487,648.65399 1.07813,0 0,9.11719 -1.07813,0 0,-9.11719"
|
||||||
|
style=""
|
||||||
|
id="path3413" />
|
||||||
|
<path
|
||||||
|
d="m 658.68433,649.31024 0,1.1543 c -0.44923,-0.21484 -0.87306,-0.37499 -1.27149,-0.48047 -0.39844,-0.10546 -0.78321,-0.1582 -1.1543,-0.1582 -0.64453,0 -1.14258,0.125 -1.49414,0.375 -0.34765,0.25 -0.52148,0.60547 -0.52148,1.0664 0,0.38673 0.11523,0.6797 0.3457,0.87891 0.23438,0.19532 0.67578,0.35352 1.32422,0.47461 l 0.71485,0.14648 c 0.8828,0.16798 1.53319,0.46485 1.95117,0.89063 0.42187,0.42188 0.6328,0.98828 0.63281,1.69922 -10e-6,0.84765 -0.28516,1.49023 -0.85547,1.92773 -0.56641,0.4375 -1.39844,0.65625 -2.49609,0.65625 -0.41407,0 -0.85547,-0.0469 -1.32422,-0.14062 -0.46485,-0.0937 -0.94727,-0.23243 -1.44727,-0.41602 l 0,-1.21875 c 0.48047,0.26953 0.95117,0.47266 1.41211,0.60938 0.46094,0.13672 0.91406,0.20507 1.35938,0.20507 0.67577,0 1.19726,-0.13281 1.56445,-0.39843 0.36718,-0.26563 0.55078,-0.64453 0.55078,-1.13672 0,-0.42969 -0.13282,-0.76562 -0.39844,-1.00782 -0.26172,-0.24218 -0.69336,-0.42382 -1.29492,-0.54492 l -0.7207,-0.14062 c -0.88282,-0.17578 -1.52149,-0.45117 -1.91602,-0.82617 -0.39453,-0.375 -0.59179,-0.89648 -0.59179,-1.56446 0,-0.77343 0.27148,-1.3828 0.81445,-1.82812 0.54687,-0.44531 1.29883,-0.66796 2.25586,-0.66797 0.41015,1e-5 0.82812,0.0371 1.25391,0.11133 0.42577,0.0742 0.86132,0.18555 1.30664,0.33398"
|
||||||
|
style=""
|
||||||
|
id="path3415" />
|
||||||
|
<path
|
||||||
|
d="m 665.73315,651.46063 0,1.00781 c -0.30469,-0.16796 -0.61133,-0.29296 -0.91992,-0.375 -0.30469,-0.0859 -0.61328,-0.1289 -0.92578,-0.1289 -0.69922,0 -1.24219,0.22266 -1.62891,0.66797 -0.38672,0.44141 -0.58008,1.0625 -0.58007,1.86328 -10e-6,0.80078 0.19335,1.42383 0.58007,1.86914 0.38672,0.44141 0.92969,0.66211 1.62891,0.66211 0.3125,0 0.62109,-0.041 0.92578,-0.12305 0.30859,-0.0859 0.61523,-0.21289 0.91992,-0.38086 l 0,0.9961 c -0.30078,0.14062 -0.61328,0.24609 -0.9375,0.3164 -0.32031,0.0703 -0.66211,0.10547 -1.02539,0.10547 -0.98828,0 -1.77344,-0.31055 -2.35547,-0.93164 -0.58203,-0.62109 -0.87304,-1.45898 -0.87304,-2.51367 0,-1.07031 0.29297,-1.91211 0.8789,-2.52539 0.58985,-0.61328 1.39649,-0.91992 2.41993,-0.91992 0.33202,0 0.65624,0.0352 0.97265,0.10546 0.3164,0.0664 0.62304,0.16798 0.91992,0.30469"
|
||||||
|
style=""
|
||||||
|
id="path3417" />
|
||||||
|
<path
|
||||||
|
d="m 671.42261,652.21649 c -0.1211,-0.0703 -0.25391,-0.12109 -0.39844,-0.15234 -0.14063,-0.0352 -0.29688,-0.0527 -0.46875,-0.0527 -0.60938,1e-5 -1.07813,0.19923 -1.40625,0.59766 -0.32422,0.39454 -0.48633,0.96289 -0.48633,1.70508 l 0,3.45703 -1.08398,0 0,-6.5625 1.08398,0 0,1.01953 c 0.22656,-0.39843 0.52148,-0.69335 0.88477,-0.88477 0.36328,-0.1953 0.80468,-0.29296 1.32422,-0.29296 0.0742,0 0.15624,0.006 0.24609,0.0176 0.0898,0.008 0.18945,0.0215 0.29883,0.041 l 0.006,1.10742"
|
||||||
|
style=""
|
||||||
|
id="path3419" />
|
||||||
|
<path
|
||||||
|
d="m 677.92065,654.2204 0,0.52734 -4.95703,0 c 0.0469,0.74219 0.26953,1.3086 0.66797,1.69922 0.40234,0.38672 0.96094,0.58008 1.67578,0.58008 0.41406,0 0.81445,-0.0508 1.20117,-0.15235 0.39062,-0.10156 0.77734,-0.2539 1.16016,-0.45703 l 0,1.01953 c -0.38672,0.16407 -0.78321,0.28907 -1.18945,0.375 -0.40626,0.0859 -0.81837,0.12891 -1.23633,0.12891 -1.04688,0 -1.87696,-0.30469 -2.49023,-0.91406 -0.60938,-0.60938 -0.91407,-1.43359 -0.91407,-2.47266 0,-1.07421 0.28906,-1.92577 0.86719,-2.55469 0.58203,-0.6328 1.36523,-0.94921 2.34961,-0.94921 0.88281,0 1.58007,0.28516 2.0918,0.85546 0.51562,0.56642 0.77343,1.3379 0.77343,2.31446 m -1.07812,-0.31641 c -0.008,-0.58984 -0.17383,-1.06054 -0.49805,-1.41211 -0.32031,-0.35155 -0.7461,-0.52734 -1.27734,-0.52734 -0.60157,0 -1.08399,0.16993 -1.44727,0.50976 -0.35937,0.33985 -0.56641,0.81837 -0.62109,1.43555 l 3.84375,-0.006"
|
||||||
|
style=""
|
||||||
|
id="path3421" />
|
||||||
|
<path
|
||||||
|
d="m 685.30347,654.2204 0,0.52734 -4.95703,0 c 0.0469,0.74219 0.26952,1.3086 0.66796,1.69922 0.40235,0.38672 0.96094,0.58008 1.67579,0.58008 0.41405,0 0.81444,-0.0508 1.20117,-0.15235 0.39062,-0.10156 0.77734,-0.2539 1.16015,-0.45703 l 0,1.01953 c -0.38672,0.16407 -0.78321,0.28907 -1.18945,0.375 -0.40625,0.0859 -0.81836,0.12891 -1.23633,0.12891 -1.04688,0 -1.87695,-0.30469 -2.49023,-0.91406 -0.60938,-0.60938 -0.91407,-1.43359 -0.91406,-2.47266 -10e-6,-1.07421 0.28906,-1.92577 0.86718,-2.55469 0.58203,-0.6328 1.36523,-0.94921 2.34961,-0.94921 0.88281,0 1.58008,0.28516 2.0918,0.85546 0.51562,0.56642 0.77343,1.3379 0.77344,2.31446 m -1.07813,-0.31641 c -0.008,-0.58984 -0.17383,-1.06054 -0.49805,-1.41211 -0.32031,-0.35155 -0.74609,-0.52734 -1.27734,-0.52734 -0.60156,0 -1.08399,0.16993 -1.44726,0.50976 -0.35938,0.33985 -0.56641,0.81837 -0.6211,1.43555 l 3.84375,-0.006"
|
||||||
|
style=""
|
||||||
|
id="path3423" />
|
||||||
|
<path
|
||||||
|
d="m 692.52808,653.81024 0,3.96094 -1.07813,0 0,-3.92578 c 0,-0.62109 -0.1211,-1.08593 -0.36328,-1.39453 -0.24219,-0.30859 -0.60547,-0.46289 -1.08984,-0.46289 -0.58204,0 -1.04102,0.18555 -1.37696,0.55664 -0.33594,0.3711 -0.50391,0.87695 -0.5039,1.51757 l 0,3.70899 -1.08399,0 0,-6.5625 1.08399,0 0,1.01953 c 0.25781,-0.39452 0.56054,-0.68945 0.9082,-0.88477 0.35156,-0.1953 0.75586,-0.29296 1.21289,-0.29296 0.7539,0 1.32421,0.23438 1.71094,0.70312 0.38671,0.46485 0.58007,1.1504 0.58008,2.05664"
|
||||||
|
style=""
|
||||||
|
id="path3425" />
|
||||||
|
</g>
|
||||||
|
<rect
|
||||||
|
style="fill:#b8b8b8;fill-opacity:1;stroke:#b8b8b8;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||||
|
id="rect5577"
|
||||||
|
width="173.25098"
|
||||||
|
height="141.43118"
|
||||||
|
x="157.75581"
|
||||||
|
y="436.97159" />
|
||||||
|
<rect
|
||||||
|
style="fill:#ededed;fill-opacity:1;stroke:#ededed;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="rect3789"
|
||||||
|
width="168.99611"
|
||||||
|
height="136.87178"
|
||||||
|
x="159.87543"
|
||||||
|
y="439.39697"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#454545;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3791">
|
||||||
|
<path
|
||||||
|
d="m 274.28683,558.98682 1.19532,0 1.83984,7.39453 1.83399,-7.39453 1.33007,0 1.83985,7.39453 1.83398,-7.39453 1.20117,0 -2.19726,8.74804 -1.48828,0 -1.84571,-7.59375 -1.86328,7.59375 -1.48828,0 -2.19141,-8.74804"
|
||||||
|
style=""
|
||||||
|
id="path3388" />
|
||||||
|
<path
|
||||||
|
d="m 286.62082,561.17236 1.07812,0 0,6.5625 -1.07812,0 0,-6.5625 m 0,-2.55468 1.07812,0 0,1.36523 -1.07812,0 0,-1.36523"
|
||||||
|
style=""
|
||||||
|
id="path3390" />
|
||||||
|
<path
|
||||||
|
d="m 295.40402,563.77393 0,3.96093 -1.07812,0 0,-3.92578 c -10e-6,-0.62109 -0.1211,-1.08593 -0.36328,-1.39453 -0.2422,-0.30859 -0.60548,-0.46288 -1.08985,-0.46289 -0.58203,1e-5 -1.04102,0.18555 -1.37695,0.55664 -0.33594,0.3711 -0.50391,0.87696 -0.50391,1.51758 l 0,3.70898 -1.08398,0 0,-6.5625 1.08398,0 0,1.01953 c 0.25781,-0.39452 0.56055,-0.68944 0.90821,-0.88476 0.35156,-0.19531 0.75585,-0.29296 1.21289,-0.29297 0.7539,1e-5 1.32421,0.23438 1.71093,0.70313 0.38672,0.46484 0.58008,1.15039 0.58008,2.05664"
|
||||||
|
style=""
|
||||||
|
id="path3392" />
|
||||||
|
<path
|
||||||
|
d="m 301.88449,562.16846 0,-3.55078 1.07813,0 0,9.11718 -1.07813,0 0,-0.98437 c -0.22657,0.39062 -0.51368,0.68164 -0.86133,0.87305 -0.34375,0.1875 -0.75781,0.28124 -1.24218,0.28125 -0.79298,-1e-5 -1.43946,-0.31641 -1.93946,-0.94922 -0.49609,-0.63281 -0.74414,-1.46485 -0.74414,-2.4961 0,-1.03124 0.24805,-1.86327 0.74414,-2.49609 0.5,-0.63281 1.14648,-0.94921 1.93946,-0.94922 0.48437,1e-5 0.89843,0.0957 1.24218,0.28711 0.34765,0.18751 0.63476,0.47657 0.86133,0.86719 m -3.67383,2.29101 c 0,0.79297 0.16211,1.41602 0.48633,1.86914 0.32812,0.44922 0.77734,0.67383 1.34766,0.67383 0.57031,0 1.01952,-0.22461 1.34765,-0.67383 0.32812,-0.45312 0.49219,-1.07617 0.49219,-1.86914 0,-0.79296 -0.16407,-1.41406 -0.49219,-1.86328 -0.32813,-0.45312 -0.77734,-0.67968 -1.34765,-0.67969 -0.57032,10e-6 -1.01954,0.22657 -1.34766,0.67969 -0.32422,0.44922 -0.48633,1.07032 -0.48633,1.86328"
|
||||||
|
style=""
|
||||||
|
id="path3394" />
|
||||||
|
<path
|
||||||
|
d="m 307.72629,561.92822 c -0.57813,10e-6 -1.03516,0.22657 -1.3711,0.67969 -0.33594,0.44922 -0.5039,1.06641 -0.5039,1.85156 0,0.78516 0.16601,1.4043 0.49804,1.85742 0.33594,0.44922 0.79492,0.67383 1.37696,0.67383 0.57421,0 1.02929,-0.22656 1.36523,-0.67968 0.33593,-0.45313 0.5039,-1.07031 0.50391,-1.85157 -1e-5,-0.77734 -0.16798,-1.39257 -0.50391,-1.8457 -0.33594,-0.45703 -0.79102,-0.68554 -1.36523,-0.68555 m 0,-0.91406 c 0.93749,1e-5 1.67382,0.30469 2.20898,0.91406 0.53515,0.60938 0.80273,1.45313 0.80274,2.53125 -10e-6,1.07422 -0.26759,1.91797 -0.80274,2.53125 -0.53516,0.60938 -1.27149,0.91406 -2.20898,0.91407 -0.94141,-1e-5 -1.67969,-0.30469 -2.21485,-0.91407 -0.53125,-0.61328 -0.79687,-1.45703 -0.79687,-2.53125 0,-1.07812 0.26562,-1.92187 0.79687,-2.53125 0.53516,-0.60937 1.27344,-0.91405 2.21485,-0.91406"
|
||||||
|
style=""
|
||||||
|
id="path3396" />
|
||||||
|
<path
|
||||||
|
d="m 311.8923,561.17236 1.07813,0 1.34765,5.1211 1.3418,-5.1211 1.27149,0 1.34765,5.1211 1.3418,-5.1211 1.07812,0 -1.71679,6.5625 -1.27149,0 -1.41211,-5.3789 -1.41797,5.3789 -1.27148,0 -1.7168,-6.5625"
|
||||||
|
style=""
|
||||||
|
id="path3398" />
|
||||||
|
</g>
|
||||||
|
<rect
|
||||||
|
y="439.39581"
|
||||||
|
x="159.87428"
|
||||||
|
height="8.8251209"
|
||||||
|
width="168.99841"
|
||||||
|
id="rect3795"
|
||||||
|
style="fill:#7b7bff;fill-opacity:1;stroke:#7b7bff;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<path
|
||||||
|
sodipodi:type="arc"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none"
|
||||||
|
id="path3797"
|
||||||
|
sodipodi:cx="352.54324"
|
||||||
|
sodipodi:cy="373.03461"
|
||||||
|
sodipodi:rx="2.5253813"
|
||||||
|
sodipodi:ry="2.5253813"
|
||||||
|
d="m 355.06862,373.03461 c 0,1.39473 -1.13065,2.52538 -2.52538,2.52538 -1.39473,0 -2.52538,-1.13065 -2.52538,-2.52538 0,-1.39473 1.13065,-2.52538 2.52538,-2.52538 1.39473,0 2.52538,1.13065 2.52538,2.52538 z"
|
||||||
|
transform="matrix(0.66107369,0,0,0.66107369,123.32145,119.41326)"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<path
|
||||||
|
transform="matrix(0.66107369,0,0,0.66107369,-194.73594,119.44704)"
|
||||||
|
d="m 355.06862,373.03461 c 0,1.39473 -1.13065,2.52538 -2.52538,2.52538 -1.39473,0 -2.52538,-1.13065 -2.52538,-2.52538 0,-1.39473 1.13065,-2.52538 2.52538,-2.52538 1.39473,0 2.52538,1.13065 2.52538,2.52538 z"
|
||||||
|
sodipodi:ry="2.5253813"
|
||||||
|
sodipodi:rx="2.5253813"
|
||||||
|
sodipodi:cy="373.03461"
|
||||||
|
sodipodi:cx="352.54324"
|
||||||
|
id="path3799"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none"
|
||||||
|
sodipodi:type="arc"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<path
|
||||||
|
sodipodi:type="arc"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none"
|
||||||
|
id="path3801"
|
||||||
|
sodipodi:cx="352.54324"
|
||||||
|
sodipodi:cy="373.03461"
|
||||||
|
sodipodi:rx="2.5253813"
|
||||||
|
sodipodi:ry="2.5253813"
|
||||||
|
d="m 355.06862,373.03461 c 0,1.39473 -1.13065,2.52538 -2.52538,2.52538 -1.39473,0 -2.52538,-1.13065 -2.52538,-2.52538 0,-1.39473 1.13065,-2.52538 2.52538,-2.52538 1.39473,0 2.52538,1.13065 2.52538,2.52538 z"
|
||||||
|
transform="matrix(0.66107369,0,0,0.66107369,-73.218648,201.61091)"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
x="21.213203"
|
||||||
|
y="340.20465"
|
||||||
|
id="text3803"
|
||||||
|
sodipodi:linespacing="125%"
|
||||||
|
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
|
||||||
|
inkscape:export-xdpi="109.89113"
|
||||||
|
inkscape:export-ydpi="109.89113"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan3805"
|
||||||
|
x="21.213203"
|
||||||
|
y="340.20465" /></text>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3807">
|
||||||
|
<path
|
||||||
|
d="m 71.179893,455.55557 0.996094,0 1.533203,6.16211 1.528321,-6.16211 1.108398,0 1.533203,6.16211 1.528321,-6.16211 1.000976,0 -1.831055,7.29004 -1.240234,0 -1.538086,-6.32812 -1.552734,6.32812 -1.240235,0 -1.826172,-7.29004"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3164" />
|
||||||
|
<path
|
||||||
|
d="m 81.458214,457.37686 0.898437,0 0,5.46875 -0.898437,0 0,-5.46875 m 0,-2.1289 0.898437,0 0,1.13769 -0.898437,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3166" />
|
||||||
|
<path
|
||||||
|
d="m 88.77755,459.54483 0,3.30078 -0.898438,0 0,-3.27148 c -4e-6,-0.51758 -0.100916,-0.90495 -0.302734,-1.16211 -0.201827,-0.25716 -0.504561,-0.38574 -0.908203,-0.38574 -0.485029,0 -0.867516,0.15462 -1.147461,0.46386 -0.27995,0.30925 -0.419924,0.7308 -0.419922,1.26465 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.214842,-0.32877 0.46712,-0.57454 0.756836,-0.7373 0.292966,-0.16276 0.629879,-0.24414 1.010742,-0.24414 0.628251,0 1.103511,0.19531 1.425781,0.58593 0.322261,0.38738 0.483393,0.95867 0.483399,1.71387"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3168" />
|
||||||
|
<path
|
||||||
|
d="m 94.17794,458.20694 0,-2.95898 0.898438,0 0,7.59765 -0.898438,0 0,-0.82031 c -0.188806,0.32552 -0.428064,0.56803 -0.717773,0.72754 -0.286462,0.15625 -0.631514,0.23437 -1.035156,0.23437 -0.66081,0 -1.199546,-0.26367 -1.616211,-0.79101 -0.413412,-0.52735 -0.620118,-1.2207 -0.620117,-2.08008 -10e-7,-0.85937 0.206705,-1.55273 0.620117,-2.08008 0.416665,-0.52734 0.955401,-0.79101 1.616211,-0.79101 0.403642,0 0.748694,0.0797 1.035156,0.23925 0.289709,0.15626 0.528967,0.39714 0.717773,0.72266 m -3.061523,1.90918 c -2e-6,0.66081 0.135089,1.18001 0.405273,1.55762 0.273436,0.37435 0.647784,0.56152 1.123047,0.56152 0.475257,0 0.849606,-0.18717 1.123047,-0.56152 0.273433,-0.37761 0.410152,-0.89681 0.410156,-1.55762 -4e-6,-0.6608 -0.136723,-1.17838 -0.410156,-1.55273 -0.273441,-0.3776 -0.64779,-0.56641 -1.123047,-0.56641 -0.475263,0 -0.849611,0.18881 -1.123047,0.56641 -0.270184,0.37435 -0.405275,0.89193 -0.405273,1.55273"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3170" />
|
||||||
|
<path
|
||||||
|
d="m 99.046104,458.00674 c -0.481773,1e-5 -0.862632,0.18881 -1.142578,0.56641 -0.279949,0.37435 -0.419923,0.88868 -0.419922,1.54297 -10e-7,0.6543 0.138345,1.17025 0.415039,1.54785 0.279946,0.37435 0.662433,0.56153 1.147461,0.56152 0.478513,1e-5 0.857744,-0.1888 1.137696,-0.5664 0.27994,-0.3776 0.41992,-0.89193 0.41992,-1.54297 0,-0.64778 -0.13998,-1.16048 -0.41992,-1.53809 -0.279952,-0.38085 -0.659183,-0.57128 -1.137696,-0.57129 m 0,-0.76171 c 0.781247,0 1.394856,0.25391 1.840816,0.76171 0.44596,0.50782 0.66894,1.21095 0.66895,2.10938 -1e-5,0.89518 -0.22299,1.59831 -0.66895,2.10937 -0.44596,0.50782 -1.059569,0.76172 -1.840816,0.76172 -0.784507,0 -1.399741,-0.2539 -1.845703,-0.76172 -0.442709,-0.51106 -0.664063,-1.21419 -0.664062,-2.10937 -10e-7,-0.89843 0.221353,-1.60156 0.664062,-2.10938 0.445962,-0.5078 1.061196,-0.76171 1.845703,-0.76171"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3172" />
|
||||||
|
<path
|
||||||
|
d="m 102.51778,457.37686 0.89844,0 1.12305,4.26758 1.11816,-4.26758 1.05957,0 1.12305,4.26758 1.11816,-4.26758 0.89844,0 -1.43066,5.46875 -1.05957,0 -1.17676,-4.48242 -1.18164,4.48242 -1.05957,0 -1.43067,-5.46875"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3174" />
|
||||||
|
<path
|
||||||
|
d="m 115.27657,462.0253 0,2.90039 -0.90332,0 0,-7.54883 0.90332,0 0,0.83008 c 0.1888,-0.32552 0.42643,-0.5664 0.71289,-0.72266 0.28971,-0.1595 0.63477,-0.23925 1.03516,-0.23925 0.66406,0 1.20279,0.26367 1.61621,0.79101 0.41666,0.52735 0.625,1.22071 0.625,2.08008 0,0.85938 -0.20834,1.55273 -0.625,2.08008 -0.41342,0.52734 -0.95215,0.79101 -1.61621,0.79101 -0.40039,0 -0.74545,-0.0781 -1.03516,-0.23437 -0.28646,-0.15951 -0.52409,-0.40202 -0.71289,-0.72754 m 3.05664,-1.90918 c 0,-0.6608 -0.13672,-1.17838 -0.41015,-1.55273 -0.27019,-0.3776 -0.64291,-0.56641 -1.11817,-0.56641 -0.47526,0 -0.84961,0.18881 -1.12304,0.56641 -0.27019,0.37435 -0.40528,0.89193 -0.40528,1.55273 0,0.66081 0.13509,1.18001 0.40528,1.55762 0.27343,0.37435 0.64778,0.56152 1.12304,0.56152 0.47526,0 0.84798,-0.18717 1.11817,-0.56152 0.27343,-0.37761 0.41015,-0.89681 0.41015,-1.55762"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3176" />
|
||||||
|
<path
|
||||||
|
d="m 122.87423,458.00674 c -0.48177,1e-5 -0.86263,0.18881 -1.14258,0.56641 -0.27995,0.37435 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13834,1.17025 0.41504,1.54785 0.27994,0.37435 0.66243,0.56153 1.14746,0.56152 0.47851,1e-5 0.85774,-0.1888 1.13769,-0.5664 0.27995,-0.3776 0.41992,-0.89193 0.41993,-1.54297 -1e-5,-0.64778 -0.13998,-1.16048 -0.41993,-1.53809 -0.27995,-0.38085 -0.65918,-0.57128 -1.13769,-0.57129 m 0,-0.76171 c 0.78125,0 1.39485,0.25391 1.84082,0.76171 0.44596,0.50782 0.66894,1.21095 0.66895,2.10938 -1e-5,0.89518 -0.22299,1.59831 -0.66895,2.10937 -0.44597,0.50782 -1.05957,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.2539 -1.8457,-0.76172 -0.44271,-0.51106 -0.66407,-1.21419 -0.66407,-2.10937 0,-0.89843 0.22136,-1.60156 0.66407,-2.10938 0.44596,-0.5078 1.06119,-0.76171 1.8457,-0.76171"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3178" />
|
||||||
|
<path
|
||||||
|
d="m 130.3547,457.53799 0,0.84961 c -0.25391,-0.1302 -0.51758,-0.22786 -0.79102,-0.29296 -0.27344,-0.0651 -0.55664,-0.0977 -0.84961,-0.0977 -0.44596,0 -0.78125,0.0684 -1.00586,0.20508 -0.22135,0.13672 -0.33203,0.3418 -0.33203,0.61523 0,0.20834 0.0797,0.37273 0.23926,0.49317 0.1595,0.11719 0.48014,0.22949 0.96191,0.33691 l 0.30762,0.0684 c 0.63802,0.13672 1.09049,0.33041 1.35742,0.58105 0.27018,0.2474 0.40527,0.59408 0.40528,1.04004 -1e-5,0.50782 -0.20183,0.90983 -0.60547,1.20606 -0.4004,0.29622 -0.95215,0.44433 -1.65528,0.44433 -0.29297,0 -0.59896,-0.0293 -0.91796,-0.0879 -0.31576,-0.0553 -0.64942,-0.13997 -1.00098,-0.2539 l 0,-0.92774 c 0.33203,0.17253 0.65918,0.30274 0.98144,0.39063 0.32227,0.0846 0.64128,0.12695 0.95704,0.12695 0.42317,0 0.74869,-0.0716 0.97656,-0.21484 0.22786,-0.14649 0.34179,-0.35157 0.3418,-0.61524 -1e-5,-0.24414 -0.083,-0.43131 -0.24903,-0.56152 -0.16276,-0.13021 -0.52246,-0.25553 -1.0791,-0.37598 l -0.3125,-0.0732 c -0.55664,-0.11719 -0.95866,-0.29622 -1.20605,-0.53711 -0.2474,-0.24414 -0.3711,-0.5778 -0.3711,-1.00098 0,-0.51431 0.18229,-0.91145 0.54688,-1.1914 0.36458,-0.27994 0.88216,-0.41992 1.55273,-0.41992 0.33203,0 0.64453,0.0244 0.9375,0.0732 0.29297,0.0488 0.56315,0.12207 0.81055,0.21972"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3180" />
|
||||||
|
<path
|
||||||
|
d="m 132.08321,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3182" />
|
||||||
|
<path
|
||||||
|
d="m 135.74532,455.82413 0,1.55273 1.85059,0 0,0.69824 -1.85059,0 0,2.96875 c 0,0.44597 0.0602,0.73243 0.18067,0.85938 0.12369,0.12695 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26042 -0.39551,-0.73242 -0.39551,-1.41602 l 0,-2.96875 -0.65918,0 0,-0.69824 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3184" />
|
||||||
|
<path
|
||||||
|
d="m 138.78243,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3186" />
|
||||||
|
<path
|
||||||
|
d="m 143.67501,458.00674 c -0.48177,1e-5 -0.86263,0.18881 -1.14258,0.56641 -0.27995,0.37435 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56152 0.47851,1e-5 0.85774,-0.1888 1.1377,-0.5664 0.27994,-0.3776 0.41991,-0.89193 0.41992,-1.54297 -1e-5,-0.64778 -0.13998,-1.16048 -0.41992,-1.53809 -0.27996,-0.38085 -0.65919,-0.57128 -1.1377,-0.57129 m 0,-0.76171 c 0.78125,0 1.39485,0.25391 1.84082,0.76171 0.44596,0.50782 0.66894,1.21095 0.66895,2.10938 -1e-5,0.89518 -0.22299,1.59831 -0.66895,2.10937 -0.44597,0.50782 -1.05957,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.2539 -1.8457,-0.76172 -0.44271,-0.51106 -0.66407,-1.21419 -0.66406,-2.10937 -10e-6,-0.89843 0.22135,-1.60156 0.66406,-2.10938 0.44596,-0.5078 1.06119,-0.76171 1.8457,-0.76171"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3188" />
|
||||||
|
<path
|
||||||
|
d="m 152.21505,459.54483 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51758 -0.10091,-0.90495 -0.30273,-1.16211 -0.20183,-0.25716 -0.50456,-0.38574 -0.90821,-0.38574 -0.48502,0 -0.86751,0.15462 -1.14746,0.46386 -0.27995,0.30925 -0.41992,0.7308 -0.41992,1.26465 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19531 1.42578,0.58593 0.32226,0.38738 0.48339,0.95867 0.4834,1.71387"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3190" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3817">
|
||||||
|
<path
|
||||||
|
d="m 49.798271,374.06503 0,0.96192 c -0.374354,-0.17903 -0.727544,-0.3125 -1.05957,-0.40039 -0.332035,-0.0879 -0.652673,-0.13183 -0.961914,-0.13184 -0.537112,1e-5 -0.952151,0.10417 -1.245117,0.3125 -0.289716,0.20834 -0.434572,0.50456 -0.434571,0.88867 -10e-7,0.32227 0.09603,0.56641 0.288086,0.73242 0.195311,0.16277 0.563149,0.2946 1.103516,0.39551 l 0.595703,0.12207 c 0.735673,0.13998 1.277664,0.38738 1.625977,0.74219 0.351556,0.35157 0.527338,0.82357 0.527343,1.41602 -5e-6,0.70638 -0.237635,1.24186 -0.71289,1.60644 -0.47201,0.36458 -1.165369,0.54688 -2.080078,0.54688 -0.345055,0 -0.712893,-0.0391 -1.103516,-0.11719 -0.387371,-0.0781 -0.789389,-0.19369 -1.206055,-0.34668 l 0,-1.01563 c 0.40039,0.22461 0.792642,0.39388 1.176758,0.50782 0.384112,0.11393 0.761716,0.1709 1.132813,0.17089 0.563147,10e-6 0.997717,-0.11067 1.30371,-0.33203 0.305985,-0.22135 0.45898,-0.5371 0.458985,-0.94726 -5e-6,-0.35807 -0.110682,-0.63802 -0.332031,-0.83985 -0.218104,-0.20182 -0.577804,-0.35318 -1.079102,-0.4541 l -0.600586,-0.11719 c -0.735679,-0.14648 -1.267905,-0.37597 -1.59668,-0.68847 -0.328776,-0.3125 -0.493164,-0.74707 -0.493164,-1.30371 0,-0.64453 0.226236,-1.15234 0.678711,-1.52344 0.455728,-0.37109 1.082355,-0.55663 1.879883,-0.55664 0.341793,10e-6 0.6901,0.0309 1.044922,0.0928 0.354813,0.0619 0.717768,0.15463 1.088867,0.27832"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3193" />
|
||||||
|
<path
|
||||||
|
d="m 56.414482,378.15683 0,0.43945 -4.130859,0 c 0.03906,0.61849 0.224607,1.0905 0.55664,1.41602 0.335284,0.32226 0.800779,0.4834 1.396485,0.4834 0.345048,0 0.678707,-0.0423 1.000976,-0.12696 0.325516,-0.0846 0.647782,-0.21158 0.966797,-0.38086 l 0,0.84961 c -0.322271,0.13672 -0.652674,0.24089 -0.991211,0.3125 -0.338546,0.0716 -0.68197,0.10743 -1.030273,0.10743 -0.872399,0 -1.56413,-0.25391 -2.075196,-0.76172 -0.507813,-0.50781 -0.761719,-1.19466 -0.761718,-2.06055 -10e-7,-0.89518 0.240884,-1.60481 0.722656,-2.12891 0.485024,-0.52733 1.137693,-0.79101 1.958008,-0.79101 0.735673,0 1.316727,0.23763 1.743164,0.71289 0.429682,0.47201 0.644525,1.11491 0.644531,1.92871 m -0.898437,-0.26367 c -0.0065,-0.49153 -0.144862,-0.88379 -0.415039,-1.17676 -0.266932,-0.29296 -0.621749,-0.43945 -1.064454,-0.43945 -0.501304,0 -0.903322,0.1416 -1.206054,0.4248 -0.299481,0.28321 -0.472007,0.68197 -0.517578,1.19629 l 3.203125,-0.005"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3195" />
|
||||||
|
<path
|
||||||
|
d="m 61.824638,375.85703 0,0.83984 c -0.253911,-0.13997 -0.509444,-0.24414 -0.766601,-0.3125 -0.25391,-0.0716 -0.511072,-0.10742 -0.771485,-0.10742 -0.582685,0 -1.035158,0.18555 -1.357421,0.55664 -0.322268,0.36784 -0.4834,0.88542 -0.483399,1.55273 -10e-7,0.66732 0.161131,1.18653 0.483399,1.55762 0.322263,0.36784 0.774736,0.55176 1.357421,0.55176 0.260413,0 0.517575,-0.0342 0.771485,-0.10254 0.257157,-0.0716 0.51269,-0.17741 0.766601,-0.31738 l 0,0.83007 c -0.250655,0.11719 -0.511072,0.20508 -0.78125,0.26368 -0.266931,0.0586 -0.551761,0.0879 -0.854492,0.0879 -0.82357,0 -1.477866,-0.25879 -1.96289,-0.77637 -0.485027,-0.51758 -0.72754,-1.21582 -0.72754,-2.09473 0,-0.89192 0.24414,-1.59342 0.732422,-2.10449 0.491535,-0.51106 1.163735,-0.7666 2.016602,-0.7666 0.276689,0 0.546871,0.0293 0.810547,0.0879 0.263667,0.0553 0.519201,0.13998 0.766601,0.25391"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3197" />
|
||||||
|
<path
|
||||||
|
d="m 65.516045,376.27695 c -0.481774,0 -0.862633,0.1888 -1.142579,0.5664 -0.279949,0.37436 -0.419923,0.88868 -0.419921,1.54297 -2e-6,0.6543 0.138344,1.17025 0.415039,1.54785 0.279945,0.37435 0.662432,0.56153 1.147461,0.56153 0.478512,0 0.857743,-0.1888 1.137695,-0.56641 0.279943,-0.3776 0.419917,-0.89192 0.419922,-1.54297 -5e-6,-0.64778 -0.139979,-1.16048 -0.419922,-1.53808 -0.279952,-0.38086 -0.659183,-0.57129 -1.137695,-0.57129 m 0,-0.76172 c 0.781246,0 1.394852,0.25391 1.84082,0.76172 0.445958,0.50781 0.66894,1.21094 0.668945,2.10937 -5e-6,0.89519 -0.222987,1.59831 -0.668945,2.10938 -0.445968,0.50781 -1.059574,0.76172 -1.84082,0.76172 -0.784508,0 -1.399742,-0.25391 -1.845704,-0.76172 -0.442709,-0.51107 -0.664063,-1.21419 -0.664062,-2.10938 -10e-7,-0.89843 0.221353,-1.60156 0.664062,-2.10937 0.445962,-0.50781 1.061196,-0.76172 1.845704,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3199" />
|
||||||
|
<path
|
||||||
|
d="m 74.056084,377.81503 0,3.30078 -0.898438,0 0,-3.27148 c -4e-6,-0.51757 -0.100916,-0.90494 -0.302734,-1.16211 -0.201827,-0.25716 -0.504561,-0.38574 -0.908203,-0.38574 -0.485029,0 -0.867516,0.15463 -1.147461,0.46387 -0.27995,0.30924 -0.419924,0.73079 -0.419922,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.214842,-0.32877 0.46712,-0.57454 0.756836,-0.7373 0.292966,-0.16276 0.629879,-0.24414 1.010742,-0.24414 0.628251,0 1.103511,0.19532 1.425781,0.58594 0.322261,0.38737 0.483393,0.95866 0.483399,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3201" />
|
||||||
|
<path
|
||||||
|
d="m 79.456474,376.47714 0,-2.95898 0.898438,0 0,7.59765 -0.898438,0 0,-0.82031 c -0.188806,0.32552 -0.428064,0.56804 -0.717773,0.72754 -0.286462,0.15625 -0.631514,0.23438 -1.035156,0.23438 -0.66081,0 -1.199546,-0.26368 -1.616211,-0.79102 -0.413413,-0.52734 -0.620118,-1.2207 -0.620118,-2.08008 0,-0.85937 0.206705,-1.55273 0.620118,-2.08008 0.416665,-0.52733 0.955401,-0.79101 1.616211,-0.79101 0.403642,0 0.748694,0.0798 1.035156,0.23926 0.289709,0.15625 0.528967,0.39714 0.717773,0.72265 m -3.061523,1.90918 c -2e-6,0.66081 0.135089,1.18002 0.405273,1.55762 0.273436,0.37435 0.647784,0.56152 1.123047,0.56152 0.475257,0 0.849606,-0.18717 1.123047,-0.56152 0.273433,-0.3776 0.410152,-0.89681 0.410156,-1.55762 -4e-6,-0.6608 -0.136723,-1.17838 -0.410156,-1.55273 -0.273441,-0.3776 -0.64779,-0.5664 -1.123047,-0.56641 -0.475263,1e-5 -0.849611,0.18881 -1.123047,0.56641 -0.270184,0.37435 -0.405275,0.89193 -0.405273,1.55273"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3203" />
|
||||||
|
<path
|
||||||
|
d="m 84.690849,378.36679 c -0.725914,0 -1.228843,0.083 -1.508789,0.24902 -0.279949,0.16602 -0.419923,0.44923 -0.419922,0.84961 -10e-7,0.31902 0.104165,0.57292 0.3125,0.76172 0.211587,0.18555 0.498045,0.27832 0.859375,0.27832 0.498044,0 0.896807,-0.17578 1.196289,-0.52734 0.302731,-0.35482 0.454098,-0.82519 0.454102,-1.41113 l 0,-0.2002 -0.893555,0 m 1.791992,-0.37109 0,3.12011 -0.898437,0 0,-0.83007 c -0.205082,0.33203 -0.460616,0.5778 -0.766602,0.7373 -0.305992,0.15625 -0.680341,0.23438 -1.123046,0.23438 -0.559898,0 -1.005861,-0.15625 -1.337891,-0.46875 -0.328777,-0.31576 -0.493165,-0.73731 -0.493164,-1.26465 -1e-6,-0.61523 0.205077,-1.0791 0.615234,-1.3916 0.41341,-0.3125 1.028644,-0.46875 1.845703,-0.46875 l 1.259766,0 0,-0.0879 c -4e-6,-0.41341 -0.136723,-0.73242 -0.410156,-0.95704 -0.270186,-0.22786 -0.651045,-0.34179 -1.142578,-0.34179 -0.312503,0 -0.616865,0.0374 -0.913086,0.1123 -0.296226,0.0749 -0.581056,0.18718 -0.854493,0.33692 l 0,-0.83008 c 0.328775,-0.12695 0.647785,-0.22135 0.957032,-0.28321 0.309242,-0.0651 0.610349,-0.0977 0.90332,-0.0977 0.791012,0 1.381832,0.20508 1.772461,0.61523 0.39062,0.41016 0.585932,1.03191 0.585937,1.86524"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3205" />
|
||||||
|
<path
|
||||||
|
d="m 91.507256,376.48691 c -0.100916,-0.0586 -0.211593,-0.10091 -0.332032,-0.12696 -0.117191,-0.0293 -0.247399,-0.0439 -0.390625,-0.0439 -0.507815,0 -0.89844,0.16602 -1.171875,0.49805 -0.270184,0.32878 -0.405275,0.80241 -0.405273,1.42089 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.434568,-0.57779 0.737305,-0.7373 0.302731,-0.16276 0.670569,-0.24414 1.103515,-0.24414 0.06185,0 0.130205,0.005 0.205078,0.0147 0.07487,0.007 0.157874,0.0179 0.249024,0.0342 l 0.0049,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3207" />
|
||||||
|
<path
|
||||||
|
d="m 94.734795,381.62363 c -0.25391,0.65104 -0.501305,1.07584 -0.742188,1.27441 -0.240888,0.19857 -0.563153,0.29785 -0.966797,0.29785 l -0.717773,0 0,-0.75195 0.527344,0 c 0.247394,0 0.439451,-0.0586 0.576171,-0.17578 0.136717,-0.11719 0.288084,-0.39388 0.454102,-0.83008 l 0.161133,-0.41016 -2.211914,-5.38086 0.952148,0 1.708985,4.27735 1.708984,-4.27735 0.952148,0 -2.402343,5.97657"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3209" />
|
||||||
|
<path
|
||||||
|
d="m 105.81878,376.69687 c 0.2246,-0.40364 0.49316,-0.70149 0.80566,-0.89356 0.3125,-0.19205 0.68033,-0.28808 1.10352,-0.28808 0.56965,0 1.00911,0.2002 1.31836,0.60058 0.30923,0.39714 0.46386,0.96355 0.46387,1.69922 l 0,3.30078 -0.90333,0 0,-3.27148 c 0,-0.52408 -0.0928,-0.91308 -0.27832,-1.16699 -0.18555,-0.2539 -0.46875,-0.38086 -0.8496,-0.38086 -0.46551,0 -0.83334,0.15463 -1.10352,0.46387 -0.27019,0.30924 -0.40528,0.73079 -0.40527,1.26464 l 0,3.09082 -0.90332,0 0,-3.27148 c -10e-6,-0.52734 -0.0928,-0.91634 -0.27832,-1.16699 -0.18556,-0.2539 -0.47201,-0.38086 -0.85938,-0.38086 -0.45899,0 -0.82357,0.15625 -1.09375,0.46875 -0.27018,0.30925 -0.40527,0.72917 -0.40527,1.25976 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.20507,-0.33528 0.45084,-0.58267 0.7373,-0.74218 0.28646,-0.1595 0.62663,-0.23926 1.02051,-0.23926 0.39713,0 0.73404,0.10092 1.01074,0.30273 0.27994,0.20183 0.48665,0.4948 0.62012,0.87891"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3211" />
|
||||||
|
<path
|
||||||
|
d="m 113.4262,376.27695 c -0.48177,0 -0.86263,0.1888 -1.14258,0.5664 -0.27995,0.37436 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56153 0.47851,0 0.85774,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41991,-0.89192 0.41992,-1.54297 -10e-6,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27996,-0.38086 -0.65919,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39485,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -1e-5,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44597,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66407,-1.21419 -0.66406,-2.10938 -10e-6,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44596,-0.50781 1.06119,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3213" />
|
||||||
|
<path
|
||||||
|
d="m 121.96624,377.81503 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51757 -0.10091,-0.90494 -0.30273,-1.16211 -0.20183,-0.25716 -0.50456,-0.38574 -0.90821,-0.38574 -0.48502,0 -0.86751,0.15463 -1.14746,0.46387 -0.27995,0.30924 -0.41992,0.73079 -0.41992,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19532 1.42578,0.58594 0.32226,0.38737 0.48339,0.95866 0.4834,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3215" />
|
||||||
|
<path
|
||||||
|
d="m 123.768,375.64706 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3217" />
|
||||||
|
<path
|
||||||
|
d="m 127.43011,374.09433 0,1.55273 1.85058,0 0,0.69825 -1.85058,0 0,2.96875 c 0,0.44596 0.0602,0.73242 0.18066,0.85937 0.1237,0.12696 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26041 -0.3955,-0.73242 -0.3955,-1.41601 l 0,-2.96875 -0.65918,0 0,-0.69825 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3219" />
|
||||||
|
<path
|
||||||
|
d="m 132.58636,376.27695 c -0.48178,0 -0.86264,0.1888 -1.14258,0.5664 -0.27995,0.37436 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13834,1.17025 0.41504,1.54785 0.27994,0.37435 0.66243,0.56153 1.14746,0.56153 0.47851,0 0.85774,-0.1888 1.13769,-0.56641 0.27995,-0.3776 0.41992,-0.89192 0.41992,-1.54297 0,-0.64778 -0.13997,-1.16048 -0.41992,-1.53808 -0.27995,-0.38086 -0.65918,-0.57129 -1.13769,-0.57129 m 0,-0.76172 c 0.78124,0 1.39485,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66894,2.10937 0,0.89519 -0.22298,1.59831 -0.66894,2.10938 -0.44597,0.50781 -1.05958,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.25391 -1.84571,-0.76172 -0.44271,-0.51107 -0.66406,-1.21419 -0.66406,-2.10938 0,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44597,-0.50781 1.0612,-0.76172 1.84571,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3221" />
|
||||||
|
<path
|
||||||
|
d="m 139.74944,376.48691 c -0.10091,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39062,-0.0439 -0.50782,0 -0.89844,0.16602 -1.17188,0.49805 -0.27018,0.32878 -0.40527,0.80241 -0.40527,1.42089 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.7373,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10352,-0.24414 0.0618,0 0.1302,0.005 0.20508,0.0147 0.0749,0.007 0.15787,0.0179 0.24902,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3223" />
|
||||||
|
<path
|
||||||
|
d="m 144.75433,380.2955 0,2.90039 -0.90332,0 0,-7.54883 0.90332,0 0,0.83008 c 0.1888,-0.32551 0.42643,-0.5664 0.71289,-0.72265 0.28971,-0.1595 0.63476,-0.23926 1.03515,-0.23926 0.66406,0 1.2028,0.26368 1.61621,0.79101 0.41666,0.52735 0.625,1.22071 0.625,2.08008 0,0.85938 -0.20834,1.55274 -0.625,2.08008 -0.41341,0.52734 -0.95215,0.79102 -1.61621,0.79102 -0.40039,0 -0.74544,-0.0781 -1.03515,-0.23438 -0.28646,-0.1595 -0.52409,-0.40202 -0.71289,-0.72754 m 3.05664,-1.90918 c -1e-5,-0.6608 -0.13673,-1.17838 -0.41016,-1.55273 -0.27019,-0.3776 -0.64291,-0.5664 -1.11816,-0.56641 -0.47527,1e-5 -0.84962,0.18881 -1.12305,0.56641 -0.27018,0.37435 -0.40528,0.89193 -0.40527,1.55273 -1e-5,0.66081 0.13509,1.18002 0.40527,1.55762 0.27343,0.37435 0.64778,0.56152 1.12305,0.56152 0.47525,0 0.84797,-0.18717 1.11816,-0.56152 0.27343,-0.3776 0.41015,-0.89681 0.41016,-1.55762"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3225" />
|
||||||
|
<path
|
||||||
|
d="m 152.35198,376.27695 c -0.48177,0 -0.86263,0.1888 -1.14258,0.5664 -0.27995,0.37436 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56153 0.47851,0 0.85775,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41991,-0.89192 0.41992,-1.54297 -1e-5,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27995,-0.38086 -0.65919,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39485,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -1e-5,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44597,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66406,-1.21419 -0.66406,-2.10938 0,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44596,-0.50781 1.06119,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3227" />
|
||||||
|
<path
|
||||||
|
d="m 159.83245,375.8082 0,0.84961 c -0.25391,-0.13021 -0.51758,-0.22786 -0.79101,-0.29297 -0.27345,-0.0651 -0.55665,-0.0976 -0.84961,-0.0977 -0.44597,1e-5 -0.78126,0.0684 -1.00586,0.20508 -0.22136,0.13672 -0.33204,0.3418 -0.33203,0.61523 -1e-5,0.20834 0.0798,0.37273 0.23925,0.49317 0.15951,0.11719 0.48014,0.22949 0.96192,0.33691 l 0.30761,0.0684 c 0.63802,0.13672 1.0905,0.33041 1.35743,0.58106 0.27017,0.24739 0.40526,0.59407 0.40527,1.04004 -1e-5,0.50781 -0.20183,0.90983 -0.60547,1.20605 -0.40039,0.29622 -0.95215,0.44434 -1.65527,0.44434 -0.29297,0 -0.59896,-0.0293 -0.91797,-0.0879 -0.31576,-0.0553 -0.64942,-0.13998 -1.00098,-0.25391 l 0,-0.92774 c 0.33203,0.17253 0.65918,0.30274 0.98145,0.39063 0.32226,0.0846 0.64127,0.12695 0.95703,0.12695 0.42317,0 0.74869,-0.0716 0.97656,-0.21484 0.22786,-0.14648 0.34179,-0.35156 0.3418,-0.61524 -1e-5,-0.24413 -0.083,-0.43131 -0.24903,-0.56152 -0.16276,-0.13021 -0.52246,-0.25553 -1.0791,-0.37598 l -0.3125,-0.0732 c -0.55664,-0.11718 -0.95866,-0.29622 -1.20605,-0.53711 -0.2474,-0.24413 -0.3711,-0.57779 -0.3711,-1.00097 0,-0.51432 0.1823,-0.91146 0.54688,-1.19141 0.36458,-0.27994 0.88216,-0.41992 1.55273,-0.41992 0.33203,0 0.64453,0.0244 0.9375,0.0732 0.29297,0.0488 0.56315,0.12208 0.81055,0.21973"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3229" />
|
||||||
|
<path
|
||||||
|
d="m 161.56097,375.64706 0.89843,0 0,5.46875 -0.89843,0 0,-5.46875 m 0,-2.1289 0.89843,0 0,1.13769 -0.89843,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3231" />
|
||||||
|
<path
|
||||||
|
d="m 165.22308,374.09433 0,1.55273 1.85058,0 0,0.69825 -1.85058,0 0,2.96875 c -1e-5,0.44596 0.0602,0.73242 0.18066,0.85937 0.1237,0.12696 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26041 -0.39551,-0.73242 -0.3955,-1.41601 l 0,-2.96875 -0.65918,0 0,-0.69825 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3233" />
|
||||||
|
<path
|
||||||
|
d="m 168.26019,375.64706 0.89843,0 0,5.46875 -0.89843,0 0,-5.46875 m 0,-2.1289 0.89843,0 0,1.13769 -0.89843,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3235" />
|
||||||
|
<path
|
||||||
|
d="m 173.15276,376.27695 c -0.48177,0 -0.86263,0.1888 -1.14257,0.5664 -0.27995,0.37436 -0.41993,0.88868 -0.41993,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56153 0.47852,0 0.85775,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41992,-0.89192 0.41992,-1.54297 0,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27995,-0.38086 -0.65918,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39486,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -1e-5,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44596,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.7845,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66406,-1.21419 -0.66406,-2.10938 0,-0.89843 0.22135,-1.60156 0.66406,-2.10937 0.44596,-0.50781 1.0612,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3237" />
|
||||||
|
<path
|
||||||
|
d="m 181.6928,377.81503 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51757 -0.10091,-0.90494 -0.30273,-1.16211 -0.20183,-0.25716 -0.50456,-0.38574 -0.9082,-0.38574 -0.48503,0 -0.86752,0.15463 -1.14746,0.46387 -0.27995,0.30924 -0.41993,0.73079 -0.41993,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21485,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29297,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19532 1.42578,0.58594 0.32226,0.38737 0.4834,0.95866 0.4834,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3239" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3826">
|
||||||
|
<path
|
||||||
|
d="m 172.22728,456.1171 0,1.04004 c -0.33204,-0.30924 -0.68686,-0.54036 -1.06445,-0.69336 -0.37436,-0.15299 -0.77312,-0.22949 -1.19629,-0.2295 -0.83334,10e-6 -1.47136,0.25554 -1.91407,0.76661 -0.44271,0.50781 -0.66406,1.24349 -0.66406,2.20703 0,0.96029 0.22135,1.69596 0.66406,2.20703 0.44271,0.50781 1.08073,0.76172 1.91407,0.76172 0.42317,0 0.82193,-0.0765 1.19629,-0.2295 0.37759,-0.15299 0.73241,-0.38411 1.06445,-0.69336 l 0,1.03028 c -0.34506,0.23437 -0.71127,0.41015 -1.09863,0.52734 -0.38412,0.11719 -0.79102,0.17578 -1.22071,0.17578 -1.10351,0 -1.97265,-0.33691 -2.60742,-1.01074 -0.63476,-0.67708 -0.95215,-1.59993 -0.95215,-2.76855 0,-1.17187 0.31739,-2.09472 0.95215,-2.76856 0.63477,-0.67707 1.50391,-1.01562 2.60742,-1.01562 0.4362,0 0.84635,0.0586 1.23047,0.17578 0.38737,0.11394 0.75032,0.28646 1.08887,0.51758"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3108" />
|
||||||
|
<path
|
||||||
|
d="m 173.72142,455.24796 0.89844,0 0,7.59765 -0.89844,0 0,-7.59765"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3110" />
|
||||||
|
<path
|
||||||
|
d="m 176.49486,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3112" />
|
||||||
|
<path
|
||||||
|
d="m 183.94603,459.88663 0,0.43945 -4.13086,0 c 0.0391,0.61849 0.22461,1.0905 0.55664,1.41602 0.33528,0.32226 0.80078,0.4834 1.39649,0.48339 0.34504,1e-5 0.6787,-0.0423 1.00097,-0.12695 0.32552,-0.0846 0.64778,-0.21159 0.9668,-0.38086 l 0,0.84961 c -0.32227,0.13672 -0.65268,0.24089 -0.99121,0.3125 -0.33855,0.0716 -0.68197,0.10742 -1.03028,0.10742 -0.87239,0 -1.56413,-0.2539 -2.07519,-0.76172 -0.50781,-0.50781 -0.76172,-1.19466 -0.76172,-2.06054 0,-0.89518 0.24088,-1.60482 0.72266,-2.12891 0.48502,-0.52734 1.13769,-0.79101 1.958,-0.79101 0.73568,0 1.31673,0.23763 1.74317,0.71289 0.42968,0.47201 0.64452,1.11491 0.64453,1.92871 m -0.89844,-0.26367 c -0.007,-0.49154 -0.14486,-0.88379 -0.41504,-1.17676 -0.26693,-0.29297 -0.62175,-0.43945 -1.06445,-0.43946 -0.5013,1e-5 -0.90332,0.14161 -1.20605,0.42481 -0.29949,0.28321 -0.47201,0.68197 -0.51758,1.19629 l 3.20312,-0.005"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3114" />
|
||||||
|
<path
|
||||||
|
d="m 189.96654,459.54483 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51758 -0.10092,-0.90495 -0.30273,-1.16211 -0.20183,-0.25716 -0.50457,-0.38574 -0.90821,-0.38574 -0.48503,0 -0.86751,0.15462 -1.14746,0.46386 -0.27995,0.30925 -0.41992,0.7308 -0.41992,1.26465 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19531 1.42578,0.58593 0.32226,0.38738 0.48339,0.95867 0.4834,1.71387"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3116" />
|
||||||
|
<path
|
||||||
|
d="m 192.65697,455.82413 0,1.55273 1.85058,0 0,0.69824 -1.85058,0 0,2.96875 c 0,0.44597 0.0602,0.73243 0.18066,0.85938 0.1237,0.12695 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26042 -0.3955,-0.73242 -0.3955,-1.41602 l 0,-2.96875 -0.65918,0 0,-0.69824 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3118" />
|
||||||
|
<path
|
||||||
|
d="m 201.36302,460.09659 c -0.72591,0 -1.22884,0.083 -1.50879,0.24902 -0.27995,0.16602 -0.41992,0.44922 -0.41992,0.84961 0,0.31901 0.10417,0.57292 0.3125,0.76172 0.21159,0.18555 0.49805,0.27832 0.85938,0.27832 0.49804,0 0.8968,-0.17578 1.19628,-0.52734 0.30274,-0.35482 0.4541,-0.8252 0.45411,-1.41114 l 0,-0.20019 -0.89356,0 m 1.79199,-0.3711 0,3.12012 -0.89843,0 0,-0.83008 c -0.20509,0.33204 -0.46062,0.5778 -0.76661,0.73731 -0.30599,0.15625 -0.68034,0.23437 -1.12304,0.23437 -0.5599,0 -1.00586,-0.15625 -1.33789,-0.46875 -0.32878,-0.31575 -0.49317,-0.7373 -0.49317,-1.26465 0,-0.61523 0.20508,-1.07909 0.61524,-1.3916 0.41341,-0.31249 1.02864,-0.46874 1.8457,-0.46875 l 1.25977,0 0,-0.0879 c -1e-5,-0.4134 -0.13673,-0.73242 -0.41016,-0.95703 -0.27019,-0.22786 -0.65104,-0.34179 -1.14258,-0.3418 -0.3125,1e-5 -0.61686,0.0374 -0.91308,0.11231 -0.29623,0.0749 -0.58106,0.18718 -0.8545,0.33691 l 0,-0.83007 c 0.32878,-0.12695 0.64779,-0.22135 0.95704,-0.28321 0.30924,-0.0651 0.61034,-0.0976 0.90332,-0.0976 0.79101,0 1.38183,0.20508 1.77246,0.61523 0.39062,0.41016 0.58593,1.03191 0.58593,1.86523"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3120" />
|
||||||
|
<path
|
||||||
|
d="m 208.17943,458.21671 c -0.10092,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49804 -0.27019,0.32878 -0.40528,0.80242 -0.40528,1.4209 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33203 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15788,0.0179 0.24903,0.0342 l 0.005,0.92286"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3122" />
|
||||||
|
<path
|
||||||
|
d="m 213.59447,459.88663 0,0.43945 -4.13086,0 c 0.0391,0.61849 0.22461,1.0905 0.55664,1.41602 0.33528,0.32226 0.80078,0.4834 1.39648,0.48339 0.34505,1e-5 0.67871,-0.0423 1.00098,-0.12695 0.32552,-0.0846 0.64778,-0.21159 0.9668,-0.38086 l 0,0.84961 c -0.32227,0.13672 -0.65268,0.24089 -0.99121,0.3125 -0.33855,0.0716 -0.68197,0.10742 -1.03028,0.10742 -0.8724,0 -1.56413,-0.2539 -2.07519,-0.76172 -0.50782,-0.50781 -0.76172,-1.19466 -0.76172,-2.06054 0,-0.89518 0.24088,-1.60482 0.72265,-2.12891 0.48503,-0.52734 1.1377,-0.79101 1.95801,-0.79101 0.73567,0 1.31673,0.23763 1.74317,0.71289 0.42968,0.47201 0.64452,1.11491 0.64453,1.92871 m -0.89844,-0.26367 c -0.007,-0.49154 -0.14486,-0.88379 -0.41504,-1.17676 -0.26693,-0.29297 -0.62175,-0.43945 -1.06445,-0.43946 -0.50131,1e-5 -0.90333,0.14161 -1.20606,0.42481 -0.29948,0.28321 -0.472,0.68197 -0.51758,1.19629 l 3.20313,-0.005"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3124" />
|
||||||
|
<path
|
||||||
|
d="m 217.55443,460.09659 c -0.72592,0 -1.22885,0.083 -1.50879,0.24902 -0.27995,0.16602 -0.41992,0.44922 -0.41992,0.84961 0,0.31901 0.10416,0.57292 0.3125,0.76172 0.21158,0.18555 0.49804,0.27832 0.85937,0.27832 0.49805,0 0.89681,-0.17578 1.19629,-0.52734 0.30273,-0.35482 0.4541,-0.8252 0.4541,-1.41114 l 0,-0.20019 -0.89355,0 m 1.79199,-0.3711 0,3.12012 -0.89844,0 0,-0.83008 c -0.20508,0.33204 -0.46061,0.5778 -0.7666,0.73731 -0.30599,0.15625 -0.68034,0.23437 -1.12305,0.23437 -0.55989,0 -1.00586,-0.15625 -1.33789,-0.46875 -0.32877,-0.31575 -0.49316,-0.7373 -0.49316,-1.26465 0,-0.61523 0.20508,-1.07909 0.61523,-1.3916 0.41341,-0.31249 1.02865,-0.46874 1.84571,-0.46875 l 1.25976,0 0,-0.0879 c 0,-0.4134 -0.13672,-0.73242 -0.41015,-0.95703 -0.27019,-0.22786 -0.65105,-0.34179 -1.14258,-0.3418 -0.3125,1e-5 -0.61687,0.0374 -0.91309,0.11231 -0.29622,0.0749 -0.58105,0.18718 -0.85449,0.33691 l 0,-0.83007 c 0.32877,-0.12695 0.64779,-0.22135 0.95703,-0.28321 0.30924,-0.0651 0.61035,-0.0976 0.90332,-0.0976 0.79101,0 1.38183,0.20508 1.77246,0.61523 0.39062,0.41016 0.58594,1.03191 0.58594,1.86523"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3126" />
|
||||||
|
<path
|
||||||
|
d="m 226.50462,458.00674 c -0.48177,1e-5 -0.86263,0.18881 -1.14257,0.56641 -0.27995,0.37435 -0.41993,0.88868 -0.41993,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56152 0.47852,1e-5 0.85775,-0.1888 1.1377,-0.5664 0.27994,-0.3776 0.41992,-0.89193 0.41992,-1.54297 0,-0.64778 -0.13998,-1.16048 -0.41992,-1.53809 -0.27995,-0.38085 -0.65918,-0.57128 -1.1377,-0.57129 m 0,-0.76171 c 0.78125,0 1.39486,0.25391 1.84082,0.76171 0.44596,0.50782 0.66894,1.21095 0.66895,2.10938 -1e-5,0.89518 -0.22299,1.59831 -0.66895,2.10937 -0.44596,0.50782 -1.05957,0.76172 -1.84082,0.76172 -0.7845,0 -1.39974,-0.2539 -1.8457,-0.76172 -0.44271,-0.51106 -0.66406,-1.21419 -0.66406,-2.10937 0,-0.89843 0.22135,-1.60156 0.66406,-2.10938 0.44596,-0.5078 1.0612,-0.76171 1.8457,-0.76171"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3128" />
|
||||||
|
<path
|
||||||
|
d="m 233.66771,458.21671 c -0.10092,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49804 -0.27019,0.32878 -0.40528,0.80242 -0.40528,1.4209 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33203 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15788,0.0179 0.24903,0.0342 l 0.005,0.92286"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3130" />
|
||||||
|
<path
|
||||||
|
d="m 234.61986,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3132" />
|
||||||
|
<path
|
||||||
|
d="m 240.99193,460.04776 c -1e-5,-0.65104 -0.1351,-1.15559 -0.40528,-1.51367 -0.26693,-0.35807 -0.6429,-0.53711 -1.12793,-0.53711 -0.48177,0 -0.85774,0.17904 -1.12792,0.53711 -0.26693,0.35808 -0.4004,0.86263 -0.4004,1.51367 0,0.64779 0.13347,1.15072 0.4004,1.50879 0.27018,0.35807 0.64615,0.53711 1.12792,0.53711 0.48503,0 0.861,-0.17904 1.12793,-0.53711 0.27018,-0.35807 0.40527,-0.861 0.40528,-1.50879 m 0.89844,2.11914 c -1e-5,0.93099 -0.20672,1.62272 -0.62012,2.0752 -0.41342,0.45572 -1.04655,0.68359 -1.89942,0.68359 -0.31575,0 -0.6136,-0.0244 -0.89355,-0.0732 -0.27995,-0.0456 -0.55176,-0.11719 -0.81543,-0.21485 l 0,-0.87402 c 0.26367,0.14323 0.52409,0.24902 0.78125,0.31738 0.25716,0.0684 0.5192,0.10254 0.78613,0.10254 0.58919,0 1.03027,-0.15462 1.32324,-0.46386 0.29297,-0.306 0.43945,-0.76986 0.43946,-1.39161 l 0,-0.44433 c -0.18555,0.32226 -0.42318,0.56315 -0.71289,0.72265 -0.28972,0.15951 -0.6364,0.23926 -1.04004,0.23926 -0.67058,0 -1.21094,-0.25553 -1.6211,-0.7666 -0.41015,-0.51107 -0.61523,-1.18815 -0.61523,-2.03125 0,-0.84635 0.20508,-1.52506 0.61523,-2.03613 0.41016,-0.51107 0.95052,-0.7666 1.6211,-0.7666 0.40364,0 0.75032,0.0797 1.04004,0.23925 0.28971,0.15951 0.52734,0.4004 0.71289,0.72266 l 0,-0.83008 0.89844,0 0,4.79004"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3134" />
|
||||||
|
<path
|
||||||
|
d="m 243.74095,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3136" />
|
||||||
|
<path
|
||||||
|
d="m 251.06029,459.54483 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51758 -0.10092,-0.90495 -0.30273,-1.16211 -0.20183,-0.25716 -0.50457,-0.38574 -0.90821,-0.38574 -0.48503,0 -0.86751,0.15462 -1.14746,0.46386 -0.27995,0.30925 -0.41992,0.7308 -0.41992,1.26465 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19531 1.42578,0.58593 0.32226,0.38738 0.48339,0.95867 0.4834,1.71387"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3138" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text3017">
|
||||||
|
<path
|
||||||
|
d="m 367.17007,356.71783 -2.7832,-7.29003 1.03027,0 2.30958,6.13769 2.31445,-6.13769 1.02539,0 -2.77832,7.29003 -1.11817,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3242" />
|
||||||
|
<path
|
||||||
|
d="m 371.87222,351.24908 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3244" />
|
||||||
|
<path
|
||||||
|
d="m 377.81461,352.08893 c -0.10092,-0.0586 -0.2116,-0.10091 -0.33204,-0.12695 -0.11719,-0.0293 -0.24739,-0.0439 -0.39062,-0.0439 -0.50782,0 -0.89844,0.16602 -1.17188,0.49805 -0.27018,0.32878 -0.40527,0.80241 -0.40527,1.4209 l 0,2.88085 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15787,0.0179 0.24902,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3246" />
|
||||||
|
<path
|
||||||
|
d="m 379.65543,349.69635 0,1.55273 1.85058,0 0,0.69825 -1.85058,0 0,2.96875 c -1e-5,0.44596 0.0602,0.73242 0.18066,0.85937 0.1237,0.12696 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26041 -0.39551,-0.73242 -0.3955,-1.41601 l 0,-2.96875 -0.65918,0 0,-0.69825 0.65918,0 0,-1.55273 0.90332,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3248" />
|
||||||
|
<path
|
||||||
|
d="m 382.59976,354.55963 0,-3.31055 0.89844,0 0,3.27637 c 0,0.51758 0.10091,0.90658 0.30273,1.16699 0.20182,0.25717 0.50456,0.38575 0.90821,0.38575 0.48502,0 0.86751,-0.15463 1.14746,-0.46387 0.2832,-0.30924 0.4248,-0.73079 0.4248,-1.26465 l 0,-3.10059 0.89844,0 0,5.46875 -0.89844,0 0,-0.83984 c -0.2181,0.33203 -0.47201,0.57943 -0.76172,0.74219 -0.28646,0.1595 -0.62012,0.23926 -1.00097,0.23926 -0.62826,0 -1.10515,-0.19532 -1.43067,-0.58594 -0.32552,-0.39063 -0.48828,-0.96191 -0.48828,-1.71387 m 2.26074,-3.44238 0,0"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3250" />
|
||||||
|
<path
|
||||||
|
d="m 391.52554,353.96881 c -0.72591,0 -1.22884,0.083 -1.50879,0.24902 -0.27995,0.16602 -0.41992,0.44923 -0.41992,0.84961 0,0.31902 0.10417,0.57292 0.3125,0.76172 0.21159,0.18555 0.49805,0.27832 0.85938,0.27832 0.49804,0 0.8968,-0.17578 1.19629,-0.52734 0.30273,-0.35482 0.45409,-0.82519 0.4541,-1.41113 l 0,-0.2002 -0.89356,0 m 1.792,-0.37109 0,3.12011 -0.89844,0 0,-0.83007 c -0.20508,0.33203 -0.46062,0.5778 -0.7666,0.7373 -0.306,0.15625 -0.68035,0.23438 -1.12305,0.23438 -0.5599,0 -1.00586,-0.15625 -1.33789,-0.46875 -0.32878,-0.31576 -0.49317,-0.73731 -0.49317,-1.26465 0,-0.61523 0.20508,-1.0791 0.61524,-1.3916 0.41341,-0.3125 1.02864,-0.46875 1.8457,-0.46875 l 1.25977,0 0,-0.0879 c -1e-5,-0.41341 -0.13673,-0.73242 -0.41016,-0.95704 -0.27018,-0.22786 -0.65104,-0.34179 -1.14258,-0.34179 -0.3125,0 -0.61686,0.0374 -0.91308,0.1123 -0.29623,0.0749 -0.58106,0.18718 -0.85449,0.33692 l 0,-0.83008 c 0.32877,-0.12695 0.64778,-0.22135 0.95703,-0.28321 0.30924,-0.0651 0.61035,-0.0976 0.90332,-0.0976 0.79101,0 1.38183,0.20508 1.77246,0.61523 0.39062,0.41016 0.58593,1.03191 0.58594,1.86524"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3252" />
|
||||||
|
<path
|
||||||
|
d="m 395.173,349.12018 0.89844,0 0,7.59765 -0.89844,0 0,-7.59765"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3254" />
|
||||||
|
<path
|
||||||
|
d="m 404.61636,351.41022 0,0.84961 c -0.25391,-0.13021 -0.51758,-0.22786 -0.79101,-0.29297 -0.27344,-0.0651 -0.55665,-0.0976 -0.84961,-0.0977 -0.44597,1e-5 -0.78125,0.0684 -1.00586,0.20508 -0.22136,0.13672 -0.33203,0.3418 -0.33203,0.61523 0,0.20834 0.0797,0.37273 0.23926,0.49317 0.1595,0.11719 0.48014,0.22949 0.96191,0.33691 l 0.30762,0.0684 c 0.63801,0.13672 1.09049,0.33041 1.35742,0.58106 0.27018,0.24739 0.40527,0.59407 0.40527,1.04004 0,0.50781 -0.20183,0.90983 -0.60547,1.20605 -0.40039,0.29622 -0.95215,0.44434 -1.65527,0.44434 -0.29297,0 -0.59896,-0.0293 -0.91797,-0.0879 -0.31576,-0.0553 -0.64941,-0.13998 -1.00098,-0.25391 l 0,-0.92774 c 0.33204,0.17253 0.65918,0.30274 0.98145,0.39063 0.32226,0.0846 0.64127,0.12695 0.95703,0.12695 0.42318,0 0.7487,-0.0716 0.97656,-0.21484 0.22786,-0.14648 0.3418,-0.35156 0.3418,-0.61524 0,-0.24413 -0.083,-0.43131 -0.24902,-0.56152 -0.16277,-0.1302 -0.52247,-0.25553 -1.0791,-0.37598 l -0.3125,-0.0732 c -0.55665,-0.11718 -0.95866,-0.29622 -1.20606,-0.53711 -0.2474,-0.24413 -0.37109,-0.57779 -0.37109,-1.00097 0,-0.51432 0.18229,-0.91146 0.54687,-1.19141 0.36458,-0.27994 0.88216,-0.41992 1.55274,-0.41992 0.33202,0 0.64452,0.0244 0.9375,0.0732 0.29296,0.0488 0.56314,0.12208 0.81054,0.21973"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3256" />
|
||||||
|
<path
|
||||||
|
d="m 410.28043,351.45905 0,0.83984 c -0.25391,-0.13997 -0.50945,-0.24414 -0.76661,-0.3125 -0.25391,-0.0716 -0.51107,-0.10742 -0.77148,-0.10742 -0.58268,0 -1.03516,0.18555 -1.35742,0.55664 -0.32227,0.36784 -0.4834,0.88542 -0.4834,1.55273 0,0.66732 0.16113,1.18653 0.4834,1.55762 0.32226,0.36784 0.77474,0.55176 1.35742,0.55176 0.26041,0 0.51757,-0.0342 0.77148,-0.10254 0.25716,-0.0716 0.5127,-0.17741 0.76661,-0.31738 l 0,0.83007 c -0.25066,0.11719 -0.51108,0.20508 -0.78125,0.26368 -0.26693,0.0586 -0.55177,0.0879 -0.8545,0.0879 -0.82357,0 -1.47786,-0.25879 -1.96289,-0.77637 -0.48502,-0.51758 -0.72754,-1.21582 -0.72754,-2.09473 0,-0.89192 0.24414,-1.59342 0.73243,-2.10449 0.49153,-0.51106 1.16373,-0.7666 2.0166,-0.7666 0.27669,0 0.54687,0.0293 0.81054,0.0879 0.26367,0.0553 0.51921,0.13998 0.76661,0.25391"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3258" />
|
||||||
|
<path
|
||||||
|
d="m 415.02164,352.08893 c -0.10092,-0.0586 -0.2116,-0.10091 -0.33203,-0.12695 -0.1172,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49805 -0.27019,0.32878 -0.40528,0.80241 -0.40528,1.4209 l 0,2.88085 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15787,0.0179 0.24902,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3260" />
|
||||||
|
<path
|
||||||
|
d="m 420.43668,353.75885 0,0.43945 -4.13086,0 c 0.0391,0.61849 0.2246,1.0905 0.55664,1.41602 0.33528,0.32227 0.80078,0.4834 1.39648,0.4834 0.34505,0 0.67871,-0.0423 1.00098,-0.12696 0.32551,-0.0846 0.64778,-0.21158 0.9668,-0.38086 l 0,0.84961 c -0.32228,0.13672 -0.65268,0.24089 -0.99122,0.3125 -0.33854,0.0716 -0.68197,0.10743 -1.03027,0.10743 -0.8724,0 -1.56413,-0.25391 -2.07519,-0.76172 -0.50782,-0.50781 -0.76172,-1.19466 -0.76172,-2.06055 0,-0.89518 0.24088,-1.60481 0.72265,-2.12891 0.48503,-0.52733 1.1377,-0.79101 1.95801,-0.79101 0.73567,0 1.31673,0.23763 1.74316,0.71289 0.42969,0.47201 0.64453,1.11491 0.64454,1.92871 m -0.89844,-0.26367 c -0.007,-0.49153 -0.14486,-0.88379 -0.41504,-1.17676 -0.26693,-0.29296 -0.62175,-0.43945 -1.06445,-0.43945 -0.50131,0 -0.90333,0.1416 -1.20606,0.4248 -0.29948,0.28321 -0.47201,0.68197 -0.51758,1.19629 l 3.20313,-0.005"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3262" />
|
||||||
|
<path
|
||||||
|
d="m 426.58902,353.75885 0,0.43945 -4.13086,0 c 0.0391,0.61849 0.22461,1.0905 0.55664,1.41602 0.33529,0.32227 0.80078,0.4834 1.39649,0.4834 0.34504,0 0.6787,-0.0423 1.00097,-0.12696 0.32552,-0.0846 0.64778,-0.21158 0.9668,-0.38086 l 0,0.84961 c -0.32227,0.13672 -0.65268,0.24089 -0.99121,0.3125 -0.33855,0.0716 -0.68197,0.10743 -1.03028,0.10743 -0.87239,0 -1.56412,-0.25391 -2.07519,-0.76172 -0.50781,-0.50781 -0.76172,-1.19466 -0.76172,-2.06055 0,-0.89518 0.24089,-1.60481 0.72266,-2.12891 0.48502,-0.52733 1.13769,-0.79101 1.958,-0.79101 0.73568,0 1.31673,0.23763 1.74317,0.71289 0.42968,0.47201 0.64452,1.11491 0.64453,1.92871 m -0.89844,-0.26367 c -0.007,-0.49153 -0.14486,-0.88379 -0.41504,-1.17676 -0.26693,-0.29296 -0.62175,-0.43945 -1.06445,-0.43945 -0.5013,0 -0.90332,0.1416 -1.20605,0.4248 -0.29949,0.28321 -0.47201,0.68197 -0.51758,1.19629 l 3.20312,-0.005"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3264" />
|
||||||
|
<path
|
||||||
|
d="m 432.60953,353.41705 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51757 -0.10092,-0.90494 -0.30273,-1.16211 -0.20183,-0.25716 -0.50457,-0.38574 -0.90821,-0.38574 -0.48503,0 -0.86751,0.15463 -1.14746,0.46387 -0.27995,0.30924 -0.41992,0.73079 -0.41992,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19532 1.42578,0.58594 0.32226,0.38737 0.48339,0.95866 0.4834,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3266" />
|
||||||
|
<path
|
||||||
|
d="m 439.71402,351.87897 c -0.48177,0 -0.86263,0.1888 -1.14258,0.5664 -0.27995,0.37436 -0.41992,0.88868 -0.41992,1.54297 0,0.6543 0.13834,1.17025 0.41504,1.54785 0.27994,0.37435 0.66243,0.56153 1.14746,0.56153 0.47851,0 0.85774,-0.1888 1.1377,-0.56641 0.27994,-0.3776 0.41991,-0.89192 0.41992,-1.54297 -10e-6,-0.64778 -0.13998,-1.16048 -0.41992,-1.53808 -0.27996,-0.38086 -0.65919,-0.57129 -1.1377,-0.57129 m 0,-0.76172 c 0.78125,0 1.39485,0.25391 1.84082,0.76172 0.44596,0.50781 0.66894,1.21094 0.66895,2.10937 -1e-5,0.89519 -0.22299,1.59831 -0.66895,2.10938 -0.44597,0.50781 -1.05957,0.76172 -1.84082,0.76172 -0.78451,0 -1.39974,-0.25391 -1.8457,-0.76172 -0.44271,-0.51107 -0.66407,-1.21419 -0.66407,-2.10938 0,-0.89843 0.22136,-1.60156 0.66407,-2.10937 0.44596,-0.50781 1.06119,-0.76172 1.8457,-0.76172"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3268" />
|
||||||
|
<path
|
||||||
|
d="m 446.87711,352.08893 c -0.10092,-0.0586 -0.2116,-0.10091 -0.33204,-0.12695 -0.11719,-0.0293 -0.24739,-0.0439 -0.39062,-0.0439 -0.50782,0 -0.89844,0.16602 -1.17188,0.49805 -0.27018,0.32878 -0.40527,0.80241 -0.40527,1.4209 l 0,2.88085 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33202 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15787,0.0179 0.24902,0.0342 l 0.005,0.92285"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3270" />
|
||||||
|
<path
|
||||||
|
d="m 447.82925,351.24908 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3272" />
|
||||||
|
<path
|
||||||
|
d="m 454.20132,353.91998 c 0,-0.65104 -0.13509,-1.15559 -0.40527,-1.51367 -0.26693,-0.35807 -0.64291,-0.5371 -1.12793,-0.53711 -0.48177,1e-5 -0.85775,0.17904 -1.12793,0.53711 -0.26693,0.35808 -0.40039,0.86263 -0.40039,1.51367 0,0.64779 0.13346,1.15072 0.40039,1.50879 0.27018,0.35808 0.64616,0.53711 1.12793,0.53711 0.48502,0 0.861,-0.17903 1.12793,-0.53711 0.27018,-0.35807 0.40527,-0.861 0.40527,-1.50879 m 0.89844,2.11914 c 0,0.93099 -0.20671,1.62272 -0.62012,2.0752 -0.41341,0.45573 -1.04655,0.68359 -1.89941,0.68359 -0.31576,0 -0.61361,-0.0244 -0.89355,-0.0732 -0.27995,-0.0456 -0.55176,-0.11719 -0.81543,-0.21484 l 0,-0.87403 c 0.26367,0.14323 0.52408,0.24903 0.78125,0.31739 0.25716,0.0684 0.5192,0.10253 0.78613,0.10254 0.58919,-10e-6 1.03027,-0.15463 1.32324,-0.46387 0.29297,-0.30599 0.43945,-0.76986 0.43945,-1.3916 l 0,-0.44434 c -0.18555,0.32227 -0.42318,0.56315 -0.71289,0.72266 -0.28971,0.1595 -0.63639,0.23925 -1.04004,0.23925 -0.67057,0 -1.21093,-0.25553 -1.62109,-0.7666 -0.41016,-0.51106 -0.61523,-1.18815 -0.61523,-2.03125 0,-0.84635 0.20507,-1.52506 0.61523,-2.03613 0.41016,-0.51106 0.95052,-0.7666 1.62109,-0.7666 0.40365,0 0.75033,0.0798 1.04004,0.23926 0.28971,0.15951 0.52734,0.40039 0.71289,0.72265 l 0,-0.83008 0.89844,0 0,4.79004"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3274" />
|
||||||
|
<path
|
||||||
|
d="m 456.95035,351.24908 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3276" />
|
||||||
|
<path
|
||||||
|
d="m 464.26968,353.41705 0,3.30078 -0.89843,0 0,-3.27148 c -10e-6,-0.51757 -0.10092,-0.90494 -0.30274,-1.16211 -0.20183,-0.25716 -0.50456,-0.38574 -0.9082,-0.38574 -0.48503,0 -0.86752,0.15463 -1.14746,0.46387 -0.27995,0.30924 -0.41993,0.73079 -0.41992,1.26464 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75683,-0.7373 0.29297,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62826,0 1.10352,0.19532 1.42579,0.58594 0.32226,0.38737 0.48339,0.95866 0.48339,1.71386"
|
||||||
|
style="font-size:10px"
|
||||||
|
id="path3278" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
|
||||||
|
d="m 343.73692,26.224389 0.01,294.941191"
|
||||||
|
id="path3861"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cc"
|
||||||
|
transform="translate(12.627039,339.86462)" />
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="cc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path4307"
|
||||||
|
d="m 356.48533,366.00457 336.31202,-0.0196"
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend);stroke-miterlimit:4;stroke-dasharray:none" />
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="cc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path4309"
|
||||||
|
d="m 159.89916,447.6257 -0.0625,145.00422"
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
|
||||||
|
d="m 160.03997,448.23877 184.95568,-0.0159"
|
||||||
|
id="path4493"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
<g
|
||||||
|
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||||
|
id="text4495">
|
||||||
|
<path
|
||||||
|
d="m 228.57881,442.02737 0.49805,0 0.7666,3.08106 0.76416,-3.08106 0.5542,0 0.7666,3.08106 0.76416,-3.08106 0.50049,0 -0.91553,3.64502 -0.62012,0 -0.76904,-3.16406 -0.77637,3.16406 -0.62011,0 -0.91309,-3.64502"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3141" />
|
||||||
|
<path
|
||||||
|
d="m 233.71797,442.93802 0.44922,0 0,2.73437 -0.44922,0 0,-2.73437 m 0,-1.06445 0.44922,0 0,0.56884 -0.44922,0 0,-0.56884"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3143" />
|
||||||
|
<path
|
||||||
|
d="m 237.37764,444.022 0,1.65039 -0.44922,0 0,-1.63574 c 0,-0.25879 -0.0505,-0.45247 -0.15137,-0.58105 -0.10091,-0.12858 -0.25228,-0.19287 -0.4541,-0.19287 -0.24251,0 -0.43376,0.0773 -0.57373,0.23193 -0.13997,0.15462 -0.20996,0.3654 -0.20996,0.63232 l 0,1.54541 -0.45166,0 0,-2.73437 0.45166,0 0,0.4248 c 0.10742,-0.16438 0.23356,-0.28727 0.37842,-0.36865 0.14648,-0.0814 0.31494,-0.12207 0.50537,-0.12207 0.31413,0 0.55176,0.0977 0.71289,0.29297 0.16113,0.19369 0.2417,0.47933 0.2417,0.85693"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3145" />
|
||||||
|
<path
|
||||||
|
d="m 240.07784,443.35306 0,-1.47949 0.44921,0 0,3.79882 -0.44921,0 0,-0.41015 c -0.0944,0.16276 -0.21404,0.28401 -0.35889,0.36377 -0.14323,0.0781 -0.31576,0.11718 -0.51758,0.11718 -0.3304,0 -0.59977,-0.13183 -0.80811,-0.3955 -0.2067,-0.26367 -0.31005,-0.61035 -0.31005,-1.04004 0,-0.42969 0.10335,-0.77637 0.31005,-1.04004 0.20834,-0.26367 0.47771,-0.39551 0.80811,-0.39551 0.20182,0 0.37435,0.0399 0.51758,0.11963 0.14485,0.0781 0.26448,0.19857 0.35889,0.36133 m -1.53077,0.95459 c 0,0.3304 0.0676,0.59 0.20264,0.77881 0.13672,0.18717 0.32389,0.28076 0.56152,0.28076 0.23763,0 0.42481,-0.0936 0.56153,-0.28076 0.13671,-0.18881 0.20507,-0.44841 0.20508,-0.77881 -1e-5,-0.3304 -0.0684,-0.58919 -0.20508,-0.77637 -0.13672,-0.1888 -0.3239,-0.2832 -0.56153,-0.2832 -0.23763,0 -0.4248,0.0944 -0.56152,0.2832 -0.13509,0.18718 -0.20264,0.44597 -0.20264,0.77637"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3147" />
|
||||||
|
<path
|
||||||
|
d="m 242.51192,443.25296 c -0.24089,0 -0.43132,0.0944 -0.57129,0.2832 -0.13998,0.18718 -0.20996,0.44434 -0.20996,0.77149 0,0.32715 0.0692,0.58512 0.20752,0.77392 0.13997,0.18718 0.33121,0.28077 0.57373,0.28077 0.23925,0 0.42887,-0.0944 0.56884,-0.28321 0.13998,-0.1888 0.20996,-0.44596 0.20997,-0.77148 -1e-5,-0.32389 -0.07,-0.58024 -0.20997,-0.76905 -0.13997,-0.19042 -0.32959,-0.28564 -0.56884,-0.28564 m 0,-0.38086 c 0.39062,0 0.69742,0.12696 0.92041,0.38086 0.22298,0.25391 0.33447,0.60547 0.33447,1.05469 0,0.44759 -0.11149,0.79915 -0.33447,1.05469 -0.22299,0.2539 -0.52979,0.38085 -0.92041,0.38085 -0.39226,0 -0.69987,-0.12695 -0.92285,-0.38085 -0.22136,-0.25554 -0.33204,-0.6071 -0.33204,-1.05469 0,-0.44922 0.11068,-0.80078 0.33204,-1.05469 0.22298,-0.2539 0.53059,-0.38086 0.92285,-0.38086"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3149" />
|
||||||
|
<path
|
||||||
|
d="m 244.24776,442.93802 0.44922,0 0.56152,2.13379 0.55908,-2.13379 0.52979,0 0.56152,2.13379 0.55908,-2.13379 0.44922,0 -0.71533,2.73437 -0.52979,0 -0.58838,-2.24121 -0.59082,2.24121 -0.52978,0 -0.71533,-2.73437"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3151" />
|
||||||
|
<path
|
||||||
|
d="m 249.70674,442.02737 3.0835,0 0,0.41504 -1.29395,0 0,3.22998 -0.4956,0 0,-3.22998 -1.29395,0 0,-0.41504"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3153" />
|
||||||
|
<path
|
||||||
|
d="m 253.09297,442.93802 0.44922,0 0,2.73437 -0.44922,0 0,-2.73437 m 0,-1.06445 0.44922,0 0,0.56884 -0.44922,0 0,-0.56884"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3155" />
|
||||||
|
<path
|
||||||
|
d="m 254.92403,442.16165 0,0.77637 0.92529,0 0,0.34912 -0.92529,0 0,1.48437 c 0,0.22299 0.0301,0.36622 0.0903,0.42969 0.0618,0.0635 0.18636,0.0952 0.37353,0.0952 l 0.46143,0 0,0.37597 -0.46143,0 c -0.34668,0 -0.58593,-0.0643 -0.71777,-0.19287 -0.13184,-0.13021 -0.19775,-0.36621 -0.19775,-0.70801 l 0,-1.48437 -0.32959,0 0,-0.34912 0.32959,0 0,-0.77637 0.45166,0"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3157" />
|
||||||
|
<path
|
||||||
|
d="m 256.44258,441.87357 0.44922,0 0,3.79882 -0.44922,0 0,-3.79882"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3159" />
|
||||||
|
<path
|
||||||
|
d="m 260.16817,444.1929 0,0.21973 -2.06543,0 c 0.0195,0.30924 0.1123,0.54525 0.27832,0.70801 0.16764,0.16113 0.40039,0.2417 0.69824,0.2417 0.17252,0 0.33935,-0.0212 0.50049,-0.0635 0.16276,-0.0423 0.32389,-0.1058 0.4834,-0.19043 l 0,0.4248 c -0.16114,0.0684 -0.32634,0.12045 -0.49561,0.15625 -0.16927,0.0358 -0.34098,0.0537 -0.51514,0.0537 -0.43619,0 -0.78206,-0.12695 -1.03759,-0.38085 -0.25391,-0.25391 -0.38086,-0.59733 -0.38086,-1.03028 0,-0.44759 0.12044,-0.8024 0.36133,-1.06445 0.24251,-0.26367 0.56884,-0.39551 0.979,-0.39551 0.36784,0 0.65836,0.11882 0.87158,0.35645 0.21484,0.236 0.32226,0.55745 0.32227,0.96435 m -0.44922,-0.13183 c -0.003,-0.24577 -0.0724,-0.4419 -0.20752,-0.58838 -0.13347,-0.14649 -0.31088,-0.21973 -0.53223,-0.21973 -0.25065,0 -0.45166,0.0708 -0.60303,0.2124 -0.14974,0.14161 -0.236,0.34099 -0.25878,0.59815 l 1.60156,-0.002"
|
||||||
|
style="font-size:5px"
|
||||||
|
id="path3161" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 109 KiB |
+582
-180
@@ -1,23 +1,123 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
@page window Window handling guide
|
@page window Window guide
|
||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
The primary purpose of GLFW is to provide a simple interface to window
|
This guide introduces the window related functions of GLFW. There are also
|
||||||
management and OpenGL and OpenGL ES context creation. GLFW supports multiple
|
guides for the other areas of GLFW.
|
||||||
windows, which can be either a normal desktop window or a fullscreen window.
|
|
||||||
|
- @ref intro
|
||||||
|
- @ref context
|
||||||
|
- @ref monitor
|
||||||
|
- @ref input
|
||||||
|
|
||||||
|
|
||||||
@section window_object Window handles
|
@section window_object Window objects
|
||||||
|
|
||||||
The @ref GLFWwindow object encapsulates both a window and a context. They are
|
The @ref GLFWwindow object encapsulates both a window and a context. They are
|
||||||
created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow (or
|
created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow, or
|
||||||
@ref glfwTerminate, if any remain). As the window and context are inseparably
|
@ref glfwTerminate, if any remain. As the window and context are inseparably
|
||||||
linked, the object pointer is used as both a context and window handle.
|
linked, the object pointer is used as both a context and window handle.
|
||||||
|
|
||||||
|
To see the event stream provided to the various window related callbacks, run
|
||||||
|
the `events` test program.
|
||||||
|
|
||||||
@section window_hints Window creation hints
|
|
||||||
|
@subsection window_creation Window creation
|
||||||
|
|
||||||
|
A window and its OpenGL or OpenGL ES context are created with @ref
|
||||||
|
glfwCreateWindow, which returns a handle to the created window object. For
|
||||||
|
example, this creates a 640 by 480 windowed mode window:
|
||||||
|
|
||||||
|
@code
|
||||||
|
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If window creation fails, `NULL` will be returned, so it is necessary to check
|
||||||
|
the return value.
|
||||||
|
|
||||||
|
The window handle is passed to all window related functions and is provided to
|
||||||
|
along with all input events, so event handlers can tell which window received
|
||||||
|
the event.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection window_full_screen Full screen windows
|
||||||
|
|
||||||
|
To create a full screen window, you need to specify which monitor the window
|
||||||
|
should use. In most cases, the user's primary monitor is a good choice.
|
||||||
|
For more information about retrieving monitors, see @ref monitor_monitors.
|
||||||
|
|
||||||
|
@code
|
||||||
|
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Full screen windows cover the entire display area of a monitor, have no border
|
||||||
|
or decorations.
|
||||||
|
|
||||||
|
Each field of the @ref GLFWvidmode structure corresponds to a function parameter
|
||||||
|
or window hint and combine to form the _desired video mode_ for that window.
|
||||||
|
The supported video mode most closely matching the desired video mode will be
|
||||||
|
set for the chosen monitor as long as the window has input focus. For more
|
||||||
|
information about retrieving video modes, see @ref monitor_modes.
|
||||||
|
|
||||||
|
Video mode field | Corresponds to
|
||||||
|
----------------------- | ------------------------
|
||||||
|
GLFWvidmode.width | `width` parameter
|
||||||
|
GLFWvidmode.height | `height` parameter
|
||||||
|
GLFWvidmode.redBits | `GLFW_RED_BITS` hint
|
||||||
|
GLFWvidmode.greenBits | `GLFW_GREEN_BITS` hint
|
||||||
|
GLFWvidmode.blueBits | `GLFW_BLUE_BITS` hint
|
||||||
|
GLFWvidmode.refreshRate | `GLFW_REFRESH_RATE` hint
|
||||||
|
|
||||||
|
Once you have a full screen window, you can change its resolution with @ref
|
||||||
|
glfwSetWindowSize. The new video mode will be selected and set the same way as
|
||||||
|
the video mode chosen by @ref glfwCreateWindow.
|
||||||
|
|
||||||
|
By default, the original video mode of the monitor will be restored and the
|
||||||
|
window iconified if it loses input focus, to allow the user to switch back to
|
||||||
|
the desktop. This behavior can be disabled with the `GLFW_AUTO_ICONIFY` window
|
||||||
|
hint, for example if you wish to simultaneously cover multiple windows with full
|
||||||
|
screen windows.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection window_windowed_full_screen "Windowed full screen" windows
|
||||||
|
|
||||||
|
If the closest match for the desired video mode is the current one, the video
|
||||||
|
mode will not be changed, making window creation faster and application
|
||||||
|
switching much smoother. This is sometimes called _windowed full screen_ or
|
||||||
|
_borderless full screen_ window and counts as a full screen window. To create
|
||||||
|
such a window, simply request the current video mode.
|
||||||
|
|
||||||
|
@code
|
||||||
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_RED_BITS, mode->redBits);
|
||||||
|
glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
|
||||||
|
glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
|
||||||
|
glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
|
||||||
|
|
||||||
|
GLFWwindow* window = glfwCreateWindow(mode->width, mode->height, "My Title", monitor, NULL);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_destruction Window destruction
|
||||||
|
|
||||||
|
When a window is no longer needed, destroy it with @ref glfwDestroyWindow.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwDestroyWindow(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Window destruction always succeeds. Before the actual destruction, all
|
||||||
|
callbacks are removed so no further events will be delivered for the window.
|
||||||
|
All windows remaining when @ref glfwTerminate is called are destroyed as well.
|
||||||
|
|
||||||
|
When a full screen window is destroyed, the original video mode of its monitor
|
||||||
|
is restored, but the gamma ramp is left untouched.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_hints Window creation hints
|
||||||
|
|
||||||
There are a number of hints that can be set before the creation of a window and
|
There are a number of hints that can be set before the creation of a window and
|
||||||
context. Some affect the window itself, others affect the framebuffer or
|
context. Some affect the window itself, others affect the framebuffer or
|
||||||
@@ -25,152 +125,232 @@ context. These hints are set to their default values each time the library is
|
|||||||
initialized with @ref glfwInit, can be set individually with @ref glfwWindowHint
|
initialized with @ref glfwInit, can be set individually with @ref glfwWindowHint
|
||||||
and reset all at once to their defaults with @ref glfwDefaultWindowHints.
|
and reset all at once to their defaults with @ref glfwDefaultWindowHints.
|
||||||
|
|
||||||
Note that hints need to be set *before* the creation of the window and context
|
Note that hints need to be set _before_ the creation of the window and context
|
||||||
you wish to have the specified attributes.
|
you wish to have the specified attributes.
|
||||||
|
|
||||||
|
|
||||||
@subsection window_hints_hard Hard and soft constraints
|
@subsubsection window_hints_hard Hard and soft constraints
|
||||||
|
|
||||||
Some window hints are hard constraints. These must match the available
|
Some window hints are hard constraints. These must match the available
|
||||||
capabilities *exactly* for window and context creation to succeed. Hints
|
capabilities _exactly_ for window and context creation to succeed. Hints
|
||||||
that are not hard constraints are matched as closely as possible, but the
|
that are not hard constraints are matched as closely as possible, but the
|
||||||
resulting window and context may differ from what these hints requested. To
|
resulting window and context may differ from what these hints requested. To
|
||||||
find out the actual attributes of the created window and context, use the
|
find out the actual attributes of the created window and context, use the
|
||||||
@ref glfwGetWindowAttrib function.
|
@ref glfwGetWindowAttrib function.
|
||||||
|
|
||||||
The following hints are hard constraints:
|
The following hints are always hard constraints:
|
||||||
- `GLFW_STEREO`
|
- `GLFW_STEREO`
|
||||||
|
- `GLFW_DOUBLEBUFFER`
|
||||||
- `GLFW_CLIENT_API`
|
- `GLFW_CLIENT_API`
|
||||||
|
|
||||||
The following additional hints are hard constraints if requesting an OpenGL
|
The following additional hints are hard constraints when requesting an OpenGL
|
||||||
context:
|
context, but are ignored when requesting an OpenGL ES context:
|
||||||
- `GLFW_OPENGL_FORWARD_COMPAT`
|
- `GLFW_OPENGL_FORWARD_COMPAT`
|
||||||
- `GLFW_OPENGL_PROFILE`
|
- `GLFW_OPENGL_PROFILE`
|
||||||
|
|
||||||
Hints that do not apply to a given type of window or context are ignored.
|
|
||||||
|
|
||||||
|
@subsubsection window_hints_wnd Window related hints
|
||||||
|
|
||||||
@subsection window_hints_wnd Window related hints
|
`GLFW_RESIZABLE` specifies whether the (windowed mode) window will be resizable
|
||||||
|
_by the user_. The window will still be resizable using the @ref
|
||||||
|
glfwSetWindowSize function. This hint is ignored for full screen windows.
|
||||||
|
|
||||||
The `GLFW_RESIZABLE` hint specifies whether the window will be resizable *by the
|
`GLFW_VISIBLE` specifies whether the (windowed mode) window will be initially
|
||||||
user*. The window will still be resizable using the @ref glfwSetWindowSize
|
visible. This hint is ignored for full screen windows.
|
||||||
function. This hint is ignored for fullscreen windows.
|
|
||||||
|
|
||||||
The `GLFW_VISIBLE` hint specifies whether the window will be initially
|
`GLFW_DECORATED` specifies whether the (windowed mode) window will have window
|
||||||
visible. This hint is ignored for fullscreen windows.
|
|
||||||
|
|
||||||
The `GLFW_DECORATED` hint specifies whether the window will have window
|
|
||||||
decorations such as a border, a close widget, etc. This hint is ignored for
|
decorations such as a border, a close widget, etc. This hint is ignored for
|
||||||
fullscreen windows. Note that even though a window may lack a close widget, it
|
full screen windows. Note that even though a window may lack a close widget, it
|
||||||
is usually still possible for the user to generate close events.
|
is usually still possible for the user to generate close events.
|
||||||
|
|
||||||
|
`GLFW_FOCUSED` specifies whether the (windowed mode) window will be given input
|
||||||
|
focus when created. This hint is ignored for full screen and initially hidden
|
||||||
|
windows.
|
||||||
|
|
||||||
@subsection window_hints_fb Framebuffer related hints
|
`GLFW_AUTO_ICONIFY` specifies whether the (full screen) window will
|
||||||
|
automatically iconify and restore the previous video mode on input focus loss.
|
||||||
|
This hint is ignored for windowed mode windows.
|
||||||
|
|
||||||
The `GLFW_RED_BITS`, `GLFW_GREEN_BITS`, `GLFW_BLUE_BITS`, `GLFW_ALPHA_BITS`,
|
`GLFW_FLOATING` specifies whether the window will be floating above other
|
||||||
`GLFW_DEPTH_BITS` and `GLFW_STENCIL_BITS` hints specify the desired bit
|
regular windows, also called topmost or always-on-top. This is intended
|
||||||
depths of the various components of the default framebuffer.
|
primarily for debugging purposes and cannot be used to implement proper full
|
||||||
|
screen windows. This hint is ignored for full screen windows.
|
||||||
The `GLFW_ACCUM_RED_BITS`, `GLFW_ACCUM_GREEN_BITS`, `GLFW_ACCUM_BLUE_BITS`
|
|
||||||
and `GLFW_ACCUM_ALPHA_BITS` hints specify the desired bit depths of the
|
|
||||||
various components of the accumulation buffer.
|
|
||||||
|
|
||||||
The `GLFW_AUX_BUFFERS` hint specifies the desired number of auxiliary
|
|
||||||
buffers.
|
|
||||||
|
|
||||||
The `GLFW_STEREO` hint specifies whether to use stereoscopic rendering.
|
|
||||||
|
|
||||||
The `GLFW_SAMPLES` hint specifies the desired number of samples to use for
|
|
||||||
multisampling. Zero disables multisampling.
|
|
||||||
|
|
||||||
The `GLFW_SRGB_CAPABLE` hint specifies whether the framebuffer should be
|
|
||||||
sRGB capable.
|
|
||||||
|
|
||||||
The `GLFW_REFRESH_RATE` hint specifies the desired refresh rate for full screen
|
|
||||||
windows. If set to zero, the highest available refresh rate will be used. This
|
|
||||||
hint is ignored for windowed mode windows.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection window_hints_ctx Context related hints
|
@subsubsection window_hints_fb Framebuffer related hints
|
||||||
|
|
||||||
The `GLFW_CLIENT_API` hint specifies which client API to create the context
|
`GLFW_RED_BITS`, `GLFW_GREEN_BITS`, `GLFW_BLUE_BITS`, `GLFW_ALPHA_BITS`,
|
||||||
for. Possible values are `GLFW_OPENGL_API` and `GLFW_OPENGL_ES_API`.
|
`GLFW_DEPTH_BITS` and `GLFW_STENCIL_BITS` specify the desired bit depths of the
|
||||||
|
various components of the default framebuffer. `GLFW_DONT_CARE` means the
|
||||||
|
application has no preference.
|
||||||
|
|
||||||
The `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints
|
`GLFW_ACCUM_RED_BITS`, `GLFW_ACCUM_GREEN_BITS`, `GLFW_ACCUM_BLUE_BITS` and
|
||||||
specify the client API version that the created context must be compatible
|
`GLFW_ACCUM_ALPHA_BITS` specify the desired bit depths of the various components
|
||||||
with.
|
of the accumulation buffer. `GLFW_DONT_CARE` means the application has no
|
||||||
|
preference.
|
||||||
|
|
||||||
For OpenGL, these hints are *not* hard constraints, as they don't have to
|
@par
|
||||||
match exactly, but @ref glfwCreateWindow will still fail if the resulting
|
Accumulation buffers are a legacy OpenGL feature and should not be used in new
|
||||||
OpenGL version is less than the one requested. It is therefore perfectly
|
code.
|
||||||
safe to use the default of version 1.0 for legacy code and you may still
|
|
||||||
get backwards-compatible contexts of version 3.0 and above when available.
|
|
||||||
|
|
||||||
|
`GLFW_AUX_BUFFERS` specifies the desired number of auxiliary buffers.
|
||||||
|
`GLFW_DONT_CARE` means the application has no preference.
|
||||||
|
|
||||||
|
@par
|
||||||
|
Auxiliary buffers are a legacy OpenGL feature and should not be used in new
|
||||||
|
code.
|
||||||
|
|
||||||
|
`GLFW_STEREO` specifies whether to use stereoscopic rendering. This is a hard
|
||||||
|
constraint.
|
||||||
|
|
||||||
|
`GLFW_SAMPLES` specifies the desired number of samples to use for multisampling.
|
||||||
|
Zero disables multisampling. `GLFW_DONT_CARE` means the application has no
|
||||||
|
preference.
|
||||||
|
|
||||||
|
`GLFW_SRGB_CAPABLE` specifies whether the framebuffer should be sRGB capable.
|
||||||
|
|
||||||
|
`GLFW_DOUBLEBUFFER` specifies whether the framebuffer should be double buffered.
|
||||||
|
You nearly always want to use double buffering. This is a hard constraint.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection window_hints_mtr Monitor related hints
|
||||||
|
|
||||||
|
`GLFW_REFRESH_RATE` specifies the desired refresh rate for full screen windows.
|
||||||
|
If set to `GLFW_DONT_CARE`, the highest available refresh rate will be used.
|
||||||
|
This hint is ignored for windowed mode windows.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection window_hints_ctx Context related hints
|
||||||
|
|
||||||
|
`GLFW_CLIENT_API` specifies which client API to create the context for.
|
||||||
|
Possible values are `GLFW_OPENGL_API` and `GLFW_OPENGL_ES_API`. This is a hard
|
||||||
|
constraint.
|
||||||
|
|
||||||
|
`GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` specify the client
|
||||||
|
API version that the created context must be compatible with. The exact
|
||||||
|
behavior of these hints depend on the requested client API.
|
||||||
|
|
||||||
|
@par
|
||||||
|
__OpenGL:__ `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` are not hard
|
||||||
|
constraints, but creation will fail if the OpenGL version of the created context
|
||||||
|
is less than the one requested. It is therefore perfectly safe to use the
|
||||||
|
default of version 1.0 for legacy code and you may still get
|
||||||
|
backwards-compatible contexts of version 3.0 and above when available.
|
||||||
|
|
||||||
|
@par
|
||||||
While there is no way to ask the driver for a context of the highest supported
|
While there is no way to ask the driver for a context of the highest supported
|
||||||
version, most drivers provide this when you ask GLFW for a version
|
version, GLFW will attempt to provide this when you ask for a version 1.0
|
||||||
1.0 context.
|
context, which is the default for these hints.
|
||||||
|
|
||||||
For OpenGL ES, these hints are hard constraints.
|
@par
|
||||||
|
__OpenGL ES:__ `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` are not hard
|
||||||
|
constraints, but creation will fail if the OpenGL ES version of the created
|
||||||
|
context is less than the one requested. Additionally, OpenGL ES 1.x cannot be
|
||||||
|
returned if 2.0 or later was requested, and vice versa. This is because OpenGL
|
||||||
|
ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward
|
||||||
|
compatible with 1.x.
|
||||||
|
|
||||||
If an OpenGL context is requested, the `GLFW_OPENGL_FORWARD_COMPAT` hint
|
`GLFW_OPENGL_FORWARD_COMPAT` specifies whether the OpenGL context should be
|
||||||
specifies whether the OpenGL context should be forward-compatible, i.e. one
|
forward-compatible, i.e. one where all functionality deprecated in the requested
|
||||||
where all functionality deprecated in the requested version of OpenGL is
|
version of OpenGL is removed. This may only be used if the requested OpenGL
|
||||||
removed. This may only be used if the requested OpenGL version is 3.0 or
|
version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.
|
||||||
above. If another client API is requested, this hint is ignored.
|
|
||||||
|
|
||||||
If an OpenGL context is requested, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
@par
|
||||||
specifies whether to create a debug OpenGL context, which may have
|
Forward-compatibility is described in detail in the
|
||||||
additional error and performance issue reporting functionality. If another
|
[OpenGL Reference Manual](https://www.opengl.org/registry/).
|
||||||
client API is requested, this hint is ignored.
|
|
||||||
|
|
||||||
If an OpenGL context is requested, the `GLFW_OPENGL_PROFILE` hint specifies
|
`GLFW_OPENGL_DEBUG_CONTEXT` specifies whether to create a debug OpenGL context,
|
||||||
which OpenGL profile to create the context for. Possible values are one of
|
which may have additional error and performance issue reporting functionality.
|
||||||
`GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`, or
|
If OpenGL ES is requested, this hint is ignored.
|
||||||
`GLFW_OPENGL_ANY_PROFILE` to not request a specific profile. If requesting
|
|
||||||
an OpenGL version below 3.2, `GLFW_OPENGL_ANY_PROFILE` must be used. If
|
|
||||||
another client API is requested, this hint is ignored.
|
|
||||||
|
|
||||||
The `GLFW_CONTEXT_ROBUSTNESS` hint specifies the robustness strategy to be
|
`GLFW_OPENGL_PROFILE` specifies which OpenGL profile to create the context for.
|
||||||
used by the context. This can be one of `GLFW_NO_RESET_NOTIFICATION` or
|
Possible values are one of `GLFW_OPENGL_CORE_PROFILE` or
|
||||||
|
`GLFW_OPENGL_COMPAT_PROFILE`, or `GLFW_OPENGL_ANY_PROFILE` to not request
|
||||||
|
a specific profile. If requesting an OpenGL version below 3.2,
|
||||||
|
`GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested,
|
||||||
|
this hint is ignored.
|
||||||
|
|
||||||
|
@par
|
||||||
|
OpenGL profiles are described in detail in the
|
||||||
|
[OpenGL Reference Manual](https://www.opengl.org/registry/).
|
||||||
|
|
||||||
|
`GLFW_CONTEXT_ROBUSTNESS` specifies the robustness strategy to be used by the
|
||||||
|
context. This can be one of `GLFW_NO_RESET_NOTIFICATION` or
|
||||||
`GLFW_LOSE_CONTEXT_ON_RESET`, or `GLFW_NO_ROBUSTNESS` to not request
|
`GLFW_LOSE_CONTEXT_ON_RESET`, or `GLFW_NO_ROBUSTNESS` to not request
|
||||||
a robustness strategy.
|
a robustness strategy.
|
||||||
|
|
||||||
|
`GLFW_CONTEXT_RELEASE_BEHAVIOR` specifies the release behavior to be
|
||||||
|
used by the context. Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`,
|
||||||
|
`GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the
|
||||||
|
behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context
|
||||||
|
creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`,
|
||||||
|
the pipeline will be flushed whenever the context is released from being the
|
||||||
|
current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will
|
||||||
|
not be flushed on release.
|
||||||
|
|
||||||
@subsection window_hints_values Supported and default values
|
@par
|
||||||
|
Context release behaviors are described in detail by the
|
||||||
| Name | Default value | Supported values |
|
[GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt)
|
||||||
| ---------------------------- | ------------------------- | ----------------------- |
|
extension.
|
||||||
| `GLFW_RESIZABLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_VISIBLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_DECORATED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_RED_BITS` | 8 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_ALPHA_BITS` | 8 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_DEPTH_BITS` | 24 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_STENCIL_BITS` | 8 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_ACCUM_RED_BITS` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_ACCUM_GREEN_BITS` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_ACCUM_BLUE_BITS` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_ACCUM_ALPHA_BITS` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_AUX_BUFFERS` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_SAMPLES` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_REFRESH_RATE` | 0 | 0 to `INT_MAX` |
|
|
||||||
| `GLFW_STEREO` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_SRGB_CAPABLE` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_CLIENT_API` | `GLFW_OPENGL_API` | `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API` |
|
|
||||||
| `GLFW_CONTEXT_VERSION_MAJOR` | 1 | Any valid major version number of the chosen client API |
|
|
||||||
| `GLFW_CONTEXT_VERSION_MINOR` | 0 | Any valid minor version number of the chosen client API |
|
|
||||||
| `GLFW_CONTEXT_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET` |
|
|
||||||
| `GLFW_OPENGL_FORWARD_COMPAT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_OPENGL_DEBUG_CONTEXT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE` |
|
|
||||||
| `GLFW_OPENGL_PROFILE` | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE` |
|
|
||||||
|
|
||||||
|
|
||||||
@section window_close Window close flag
|
@subsubsection window_hints_values Supported and default values
|
||||||
|
|
||||||
|
Window hint | Default value | Supported values
|
||||||
|
------------------------------- | --------------------------- | ----------------
|
||||||
|
`GLFW_RESIZABLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_VISIBLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_DECORATED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_FOCUSED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_AUTO_ICONIFY` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_FLOATING` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_RED_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_ALPHA_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_DEPTH_BITS` | 24 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_STENCIL_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_ACCUM_RED_BITS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_ACCUM_GREEN_BITS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_ACCUM_BLUE_BITS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_ACCUM_ALPHA_BITS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_AUX_BUFFERS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_SAMPLES` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_REFRESH_RATE` | `GLFW_DONT_CARE` | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
|
`GLFW_STEREO` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_SRGB_CAPABLE` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_DOUBLEBUFFER` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_CLIENT_API` | `GLFW_OPENGL_API` | `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`
|
||||||
|
`GLFW_CONTEXT_VERSION_MAJOR` | 1 | Any valid major version number of the chosen client API
|
||||||
|
`GLFW_CONTEXT_VERSION_MINOR` | 0 | Any valid minor version number of the chosen client API
|
||||||
|
`GLFW_CONTEXT_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET`
|
||||||
|
`GLFW_CONTEXT_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`
|
||||||
|
`GLFW_OPENGL_FORWARD_COMPAT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_OPENGL_DEBUG_CONTEXT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
|
||||||
|
`GLFW_OPENGL_PROFILE` | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
|
||||||
|
|
||||||
|
|
||||||
|
@section window_events Window event processing
|
||||||
|
|
||||||
|
See @ref events.
|
||||||
|
|
||||||
|
|
||||||
|
@section window_properties Window properties and events
|
||||||
|
|
||||||
|
@subsection window_userptr User pointer
|
||||||
|
|
||||||
|
Each window has a user pointer that can be set with @ref
|
||||||
|
glfwSetWindowUserPointer and fetched with @ref glfwGetWindowUserPointer. This
|
||||||
|
can be used for any purpose you need and will not be modified by GLFW throughout
|
||||||
|
the life-time of the window.
|
||||||
|
|
||||||
|
The initial value of the pointer is `NULL`.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_close Window closing and close flag
|
||||||
|
|
||||||
When the user attempts to close the window, for example by clicking the close
|
When the user attempts to close the window, for example by clicking the close
|
||||||
widget or using a key chord like Alt+F4, the *close flag* of the window is set.
|
widget or using a key chord like Alt+F4, the _close flag_ of the window is set.
|
||||||
The window is however not actually destroyed and, unless you watch for this
|
The window is however not actually destroyed and, unless you watch for this
|
||||||
state change, nothing further happens.
|
state change, nothing further happens.
|
||||||
|
|
||||||
@@ -188,16 +368,16 @@ while (!glfwWindowShouldClose(window))
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
If you wish to be notified when the user attempts to close a window, you can set
|
If you wish to be notified when the user attempts to close a window, set a close
|
||||||
the close callback with @ref glfwSetWindowCloseCallback. This callback is
|
callback.
|
||||||
called directly *after* the close flag has been set.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetWindowCloseCallback(window, window_close_callback);
|
glfwSetWindowCloseCallback(window, window_close_callback);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The callback function can be used for example to filter close requests and clear
|
The callback function is called directly _after_ the close flag has been set.
|
||||||
the close flag again unless certain conditions are met.
|
It can be used for example to filter close requests and clear the close flag
|
||||||
|
again unless certain conditions are met.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
void window_close_callback(GLFWwindow* window)
|
void window_close_callback(GLFWwindow* window)
|
||||||
@@ -208,32 +388,35 @@ void window_close_callback(GLFWwindow* window)
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section window_size Window size
|
@subsection window_size Window size
|
||||||
|
|
||||||
The size of a window can be changed with @ref glfwSetWindowSize. For windowed
|
The size of a window can be changed with @ref glfwSetWindowSize. For windowed
|
||||||
mode windows, this resizes the specified window so that its *client area* has
|
mode windows, this sets the size, in
|
||||||
the specified size. Note that the window system may put limitations on size.
|
[screen coordinates](@ref coordinate_systems) of the _client area_ or _content
|
||||||
For full screen windows, it selects and sets the video mode most closely
|
area_ of the window. The window system may impose limits on window size.
|
||||||
matching the specified size.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
void glfwSetWindowSize(window, 640, 480);
|
glfwSetWindowSize(window, 640, 480);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
For full screen windows, the specified size becomes the new resolution of the
|
||||||
|
window's *desired video mode*. The video mode most closely matching the new
|
||||||
|
desired video mode is set immediately. The window is resized to fit the
|
||||||
|
resolution of the set video mode.
|
||||||
|
|
||||||
If you wish to be notified when a window is resized, whether by the user or
|
If you wish to be notified when a window is resized, whether by the user or
|
||||||
the system, you can set the size callback with @ref glfwSetWindowSizeCallback.
|
the system, set a size callback.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetWindowSizeCallback(window, window_size_callback);
|
glfwSetWindowSizeCallback(window, window_size_callback);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The callback function receives the new size of the client area of the window,
|
The callback function receives the new size, in screen coordinates, of the
|
||||||
which can for example be used to update the viewport.
|
client area of the window when it is resized.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
void window_size_callback(GLFWwindow* window, int width, int height)
|
void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@@ -243,33 +426,88 @@ a window.
|
|||||||
@code
|
@code
|
||||||
int width, height;
|
int width, height;
|
||||||
glfwGetWindowSize(window, &width, &height);
|
glfwGetWindowSize(window, &width, &height);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@note Do not pass the window size to `glViewport` or other pixel-based OpenGL
|
||||||
|
calls. The window size is in screen coordinates, not pixels. Use the
|
||||||
|
[framebuffer size](@ref window_fbsize), which is in pixels, for pixel-based
|
||||||
|
calls.
|
||||||
|
|
||||||
|
The above functions work with the size of the client area, but decorated windows
|
||||||
|
typically have title bars and window frames around this rectangle. You can
|
||||||
|
retrieve the extents of these with @ref glfwGetWindowFrameSize.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int left, top, right, bottom;
|
||||||
|
glfwGetWindowFrameSize(window, &left, &top, &right, &bottom);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The returned values are the distances, in screen coordinates, from the edges of
|
||||||
|
the client area to the corresponding edges of the full window. As they are
|
||||||
|
distances and not coordinates, they are always zero or positive.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_fbsize Framebuffer size
|
||||||
|
|
||||||
|
While the size of a window is measured in screen coordinates, OpenGL works with
|
||||||
|
pixels. The size you pass into `glViewport`, for example, should be in pixels.
|
||||||
|
On some machines screen coordinates and pixels are the same, but on others they
|
||||||
|
will not be. There is a second set of functions to retrieve the size, in
|
||||||
|
pixels, of the framebuffer of a window.
|
||||||
|
|
||||||
|
If you wish to be notified when the framebuffer of a window is resized, whether
|
||||||
|
by the user or the system, set a size callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives the new size of the framebuffer when it is
|
||||||
|
resized, which can for example be used to update the OpenGL viewport.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||||
|
{
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
There is also @ref glfwGetFramebufferSize for directly retrieving the current
|
||||||
|
size of the framebuffer of a window.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int width, height;
|
||||||
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The size of a framebuffer may change independently of the size of a window, for
|
||||||
|
example if the window is dragged between a regular monitor and a high-DPI one.
|
||||||
|
|
||||||
@section window_pos Window position
|
|
||||||
|
@subsection window_pos Window position
|
||||||
|
|
||||||
The position of a windowed-mode window can be changed with @ref
|
The position of a windowed-mode window can be changed with @ref
|
||||||
glfwSetWindowPos. This moves the window so that the upper-left corner of its
|
glfwSetWindowPos. This moves the window so that the upper-left corner of its
|
||||||
client area has the specified screen coordinates. Note that the window system
|
client area has the specified [screen coordinates](@ref coordinate_systems).
|
||||||
may put limitations on placement.
|
The window system may put limitations on window placement.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetWindowPos(window, 100, 100);
|
glfwSetWindowPos(window, 100, 100);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
If you wish to be notified when a window is moved, whether by the user or
|
If you wish to be notified when a window is moved, whether by the user, system
|
||||||
the system, you can set the position callback with @ref glfwSetWindowPosCallback.
|
or your own code, set a position callback.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetWindowPosCallback(window, window_pos_callback);
|
glfwSetWindowPosCallback(window, window_pos_callback);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The callback function receives the new position of the upper-left corner of its
|
The callback function receives the new position of the upper-left corner of the
|
||||||
client area.
|
client area when the window is moved.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
void window_size_callback(GLFWwindow* window, int xpos, int ypos)
|
void window_pos_callback(GLFWwindow* window, int xpos, int ypos)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
@@ -283,31 +521,187 @@ glfwGetWindowPos(window, &xpos, &ypos);
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section window_title Window title
|
@subsection window_title Window title
|
||||||
|
|
||||||
All GLFW windows have a title, although undecorated or full screen windows may
|
All GLFW windows have a title, although undecorated or full screen windows may
|
||||||
not display it or only display it in a task bar or similar interface. To change
|
not display it or only display it in a task bar or similar interface. You can
|
||||||
the title of a window, use @ref glfwSetWindowTitle.
|
set a UTF-8 encoded window title with @ref glfwSetWindowTitle.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetWindowTitle(window, "My Window");
|
glfwSetWindowTitle(window, "My Window");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The window title is a regular C string using the UTF-8 encoding. This means
|
The specified string is copied before the function returns, so there is no need
|
||||||
for example that, as long as your source file is encoded as UTF-8, you can use
|
to keep it around.
|
||||||
any Unicode characters.
|
|
||||||
|
As long as your source file is encoded as UTF-8, you can use any Unicode
|
||||||
|
characters directly in the source.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetWindowTitle(window, "さよなら絶望先生");
|
glfwSetWindowTitle(window, "おもひでぽろぽろ");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section window_attribs Window attributes
|
@subsection window_monitor Window monitor
|
||||||
|
|
||||||
|
Full screen windows are associated with a specific monitor. You can get the
|
||||||
|
handle for this monitor with @ref glfwGetWindowMonitor.
|
||||||
|
|
||||||
|
@code
|
||||||
|
GLFWmonitor* monitor = glfwGetWindowMonitor(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This monitor handle is one of those returned by @ref glfwGetMonitors.
|
||||||
|
|
||||||
|
For windowed mode windows, this function returns `NULL`. This is the
|
||||||
|
recommended way to tell full screen windows from windowed mode windows.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_iconify Window iconification
|
||||||
|
|
||||||
|
Windows can be iconified (i.e. minimized) with @ref glfwIconifyWindow.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwIconifyWindow(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When a full screen window is iconified, the original video mode of its monitor
|
||||||
|
is restored until the user or application restores the window.
|
||||||
|
|
||||||
|
Iconified windows can be restored with @ref glfwRestoreWindow.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwRestoreWindow(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When a full screen window is restored, the desired video mode is restored to its
|
||||||
|
monitor as well.
|
||||||
|
|
||||||
|
If you wish to be notified when a window is iconified or restored, whether by
|
||||||
|
the user, system or your own code, set a iconify callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetWindowIconifyCallback(window, window_iconify_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives changes in the iconification state of the window.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void window_iconify_callback(GLFWwindow* window, int iconified)
|
||||||
|
{
|
||||||
|
if (iconified)
|
||||||
|
{
|
||||||
|
// The window was iconified
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The window was restored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
You can also get the current iconification state with @ref glfwGetWindowAttrib.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_hide Window visibility
|
||||||
|
|
||||||
|
Windowed mode windows can be hidden with @ref glfwHideWindow.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwHideWindow(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This makes the window completely invisible to the user, including removing it
|
||||||
|
from the task bar, dock or window list. Full screen windows cannot be hidden
|
||||||
|
and calling @ref glfwHideWindow on a full screen window does nothing.
|
||||||
|
|
||||||
|
Hidden windows can be shown with @ref glfwShowWindow.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwShowWindow(window);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Windowed mode windows can be created initially hidden with the `GLFW_VISIBLE`
|
||||||
|
[window hint](@ref window_hints_wnd). Windows created hidden are completely
|
||||||
|
invisible to the user until shown. This can be useful if you need to set up
|
||||||
|
your window further before showing it, for example moving it to a specific
|
||||||
|
location.
|
||||||
|
|
||||||
|
You can also get the current visibility state with @ref glfwGetWindowAttrib.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int visible = glfwGetWindowAttrib(window, GLFW_VISIBLE);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_focus Window input focus
|
||||||
|
|
||||||
|
If you wish to be notified when a window gains or loses input focus, whether by
|
||||||
|
the user, system or your own code, set a focus callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetWindowFocusCallback(window, window_focus_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function receives changes in the input focus state of the window.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void window_focus_callback(GLFWwindow* window, int focused)
|
||||||
|
{
|
||||||
|
if (focused)
|
||||||
|
{
|
||||||
|
// The window gained input focus
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The window lost input focus
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
You can also get the current input focus state with @ref glfwGetWindowAttrib.
|
||||||
|
|
||||||
|
@code
|
||||||
|
int focused = glfwGetWindowAttrib(window, GLFW_FOCUSED);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_refresh Window damage and refresh
|
||||||
|
|
||||||
|
If you wish to be notified when the contents of a window is damaged and needs
|
||||||
|
to be refreshed, set a window refresh callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetWindowRefreshCallback(m_handle, window_refresh_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback function is called when the contents of the window needs to be
|
||||||
|
refreshed.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void window_refresh_callback(GLFWwindow* window)
|
||||||
|
{
|
||||||
|
draw_editor_ui(window);
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@note On compositing window systems such as Aero, Compiz or Aqua, where the
|
||||||
|
window contents are saved off-screen, this callback might only be called when
|
||||||
|
the window or framebuffer is resized.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection window_attribs Window attributes
|
||||||
|
|
||||||
Windows have a number of attributes that can be returned using @ref
|
Windows have a number of attributes that can be returned using @ref
|
||||||
glfwGetWindowAttrib. Some reflect state that may change during the lifetime of
|
glfwGetWindowAttrib. Some reflect state that may change during the lifetime of
|
||||||
the window, while others reflect the corresponding hints and are fixed at the
|
the window, while others reflect the corresponding hints and are fixed at the
|
||||||
time of creation.
|
time of creation. Some are related to the actual window and others to its
|
||||||
|
context.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (glfwGetWindowAttrib(window, GLFW_FOCUSED))
|
if (glfwGetWindowAttrib(window, GLFW_FOCUSED))
|
||||||
@@ -317,57 +711,62 @@ if (glfwGetWindowAttrib(window, GLFW_FOCUSED))
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection window_attribs_window Window attributes
|
@subsubsection window_attribs_wnd Window related attributes
|
||||||
|
|
||||||
The `GLFW_FOCUSED` attribute indicates whether the specified window currently
|
`GLFW_FOCUSED` indicates whether the specified window has input focus. Initial
|
||||||
has input focus.
|
input focus is controlled by the [window hint](@ref window_hints_wnd) with the
|
||||||
|
same name.
|
||||||
|
|
||||||
The `GLFW_ICONIFIED` attribute indicates whether the specified window is
|
`GLFW_ICONIFIED` indicates whether the specified window is iconified, whether by
|
||||||
currently iconified, whether by the user or with @ref glfwIconifyWindow.
|
the user or with @ref glfwIconifyWindow.
|
||||||
|
|
||||||
The `GLFW_VISIBLE` attribute indicates whether the specified window is currently
|
`GLFW_VISIBLE` indicates whether the specified window is visible. Window
|
||||||
visible. Window visibility can be controlled with @ref glfwShowWindow and @ref
|
visibility can be controlled with @ref glfwShowWindow and @ref glfwHideWindow
|
||||||
glfwHideWindow and initial visibility is controlled by the
|
and initial visibility is controlled by the [window hint](@ref window_hints_wnd)
|
||||||
[window hint](@ref window_hints) with the same name.
|
with the same name.
|
||||||
|
|
||||||
The `GLFW_RESIZABLE` attribute indicates whether the specified window is
|
`GLFW_RESIZABLE` indicates whether the specified window is resizable _by the
|
||||||
resizable *by the user*. This is controlled by the
|
user_. This is set on creation with the [window hint](@ref window_hints_wnd)
|
||||||
[window hint](@ref window_hints) with the same name.
|
with the same name.
|
||||||
|
|
||||||
The `GLFW_DECORATED` attribute indicates whether the specified window has
|
`GLFW_DECORATED` indicates whether the specified window has decorations such as
|
||||||
decorations such as a border, a close widget, etc. This is controlled by the
|
a border, a close widget, etc. This is set on creation with the
|
||||||
[window hint](@ref window_hints) with the same name.
|
[window hint](@ref window_hints_wnd) with the same name.
|
||||||
|
|
||||||
|
`GLFW_FLOATING` indicates whether the specified window is floating, also called
|
||||||
|
topmost or always-on-top. This is controlled by the
|
||||||
|
[window hint](@ref window_hints_wnd) with the same name.
|
||||||
|
|
||||||
|
|
||||||
@subsection window_attribs_context Context attributes
|
@subsubsection window_attribs_ctx Context related attributes
|
||||||
|
|
||||||
The `GLFW_CLIENT_API` attribute indicates the client API provided by the
|
`GLFW_CLIENT_API` indicates the client API provided by the window's context;
|
||||||
window's context; either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`.
|
either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`.
|
||||||
|
|
||||||
The `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and
|
`GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and
|
||||||
`GLFW_CONTEXT_REVISION` attributes indicate the client API version of the
|
`GLFW_CONTEXT_REVISION` indicate the client API version of the window's context.
|
||||||
window's context.
|
|
||||||
|
|
||||||
The `GLFW_OPENGL_FORWARD_COMPAT` attribute is `GL_TRUE` if the window's
|
`GLFW_OPENGL_FORWARD_COMPAT` is `GL_TRUE` if the window's context is an OpenGL
|
||||||
context is an OpenGL forward-compatible one, or `GL_FALSE` otherwise.
|
forward-compatible one, or `GL_FALSE` otherwise.
|
||||||
|
|
||||||
The `GLFW_OPENGL_DEBUG_CONTEXT` attribute is `GL_TRUE` if the window's
|
`GLFW_OPENGL_DEBUG_CONTEXT` is `GL_TRUE` if the window's context is an OpenGL
|
||||||
context is an OpenGL debug context, or `GL_FALSE` otherwise.
|
debug context, or `GL_FALSE` otherwise.
|
||||||
|
|
||||||
The `GLFW_OPENGL_PROFILE` attribute indicates the OpenGL profile used by the
|
`GLFW_OPENGL_PROFILE` indicates the OpenGL profile used by the context. This is
|
||||||
context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`
|
`GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` if the context uses
|
||||||
if the context uses a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the
|
a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the OpenGL profile is unknown
|
||||||
OpenGL profile is unknown or the context is for another client API.
|
or the context is an OpenGL ES context. Note that the returned profile may not
|
||||||
|
match the profile bits of the context flags, as GLFW will try other means of
|
||||||
|
detecting the profile when no bits are set.
|
||||||
|
|
||||||
The `GLFW_CONTEXT_ROBUSTNESS` attribute indicates the robustness strategy
|
`GLFW_CONTEXT_ROBUSTNESS` indicates the robustness strategy used by the context.
|
||||||
used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or
|
This is `GLFW_LOSE_CONTEXT_ON_RESET` or `GLFW_NO_RESET_NOTIFICATION` if the
|
||||||
`GLFW_NO_RESET_NOTIFICATION` if the window's context supports robustness, or
|
window's context supports robustness, or `GLFW_NO_ROBUSTNESS` otherwise.
|
||||||
`GLFW_NO_ROBUSTNESS` otherwise.
|
|
||||||
|
|
||||||
|
|
||||||
@section window_swap Swapping buffers
|
@section buffer_swap Buffer swapping
|
||||||
|
|
||||||
GLFW windows are always double buffered. That means that you have two
|
GLFW windows are by default double buffered. That means that you have two
|
||||||
rendering buffers; a front buffer and a back buffer. The front buffer is
|
rendering buffers; a front buffer and a back buffer. The front buffer is
|
||||||
the one being displayed and the back buffer the one you render to.
|
the one being displayed and the back buffer the one you render to.
|
||||||
|
|
||||||
@@ -381,7 +780,8 @@ glfwSwapBuffers(window);
|
|||||||
|
|
||||||
Sometimes it can be useful to select when the buffer swap will occur. With the
|
Sometimes it can be useful to select when the buffer swap will occur. With the
|
||||||
function @ref glfwSwapInterval it is possible to select the minimum number of
|
function @ref glfwSwapInterval it is possible to select the minimum number of
|
||||||
monitor refreshes the driver should wait before swapping the buffers:
|
monitor refreshes the driver wait should from the time @ref glfwSwapBuffers was
|
||||||
|
called before swapping the buffers:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
@@ -394,8 +794,10 @@ zero can be useful for benchmarking purposes, when it is not desirable to
|
|||||||
measure the time it takes to wait for the vertical retrace. However, a swap
|
measure the time it takes to wait for the vertical retrace. However, a swap
|
||||||
interval of one lets you avoid tearing.
|
interval of one lets you avoid tearing.
|
||||||
|
|
||||||
Note that not all OpenGL implementations properly implement this function, in
|
Note that this may not work on all machines, as some drivers have
|
||||||
which case @ref glfwSwapInterval will have no effect. Some drivers also have
|
user-controlled settings that override any swap interval the application
|
||||||
user settings that override requests by GLFW.
|
requests. It is also by default disabled on Windows Vista and later when using
|
||||||
|
DWM (Aero), as using it there sometimes leads to severe jitter. You can
|
||||||
|
forcibly enable it for machines using DWM using @ref compile_options_win32.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
+36
-18
@@ -1,53 +1,71 @@
|
|||||||
|
|
||||||
link_libraries(glfw ${OPENGL_glu_LIBRARY})
|
link_libraries(glfw "${OPENGL_glu_LIBRARY}")
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
add_definitions(-DGLFW_DLL)
|
add_definitions(-DGLFW_DLL)
|
||||||
link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY})
|
link_libraries("${OPENGL_gl_LIBRARY}" "${MATH_LIBRARY}")
|
||||||
else()
|
else()
|
||||||
link_libraries(${glfw_LIBRARIES})
|
link_libraries(${glfw_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(${GLFW_SOURCE_DIR}/include
|
include_directories("${GLFW_SOURCE_DIR}/include"
|
||||||
${GLFW_SOURCE_DIR}/deps)
|
"${GLFW_SOURCE_DIR}/deps")
|
||||||
|
|
||||||
if (MSVC)
|
if ("${OPENGL_INCLUDE_DIR}")
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
include_directories("${OPENGL_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT APPLE)
|
set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
|
||||||
# HACK: This is NOTFOUND on OS X 10.8
|
"${GLFW_SOURCE_DIR}/deps/glad.c")
|
||||||
include_directories(${OPENGL_INCLUDE_DIR})
|
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
||||||
endif()
|
"${GLFW_SOURCE_DIR}/deps/getopt.c")
|
||||||
|
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
||||||
set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h
|
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
||||||
${GLFW_SOURCE_DIR}/deps/getopt.c)
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# Set fancy names for bundles
|
# Set fancy names for bundles
|
||||||
add_executable(Boing MACOSX_BUNDLE boing.c)
|
add_executable(Boing MACOSX_BUNDLE boing.c)
|
||||||
add_executable(Gears MACOSX_BUNDLE gears.c)
|
add_executable(Gears MACOSX_BUNDLE gears.c)
|
||||||
|
add_executable(Heightmap MACOSX_BUNDLE heightmap.c ${GLAD})
|
||||||
|
add_executable(Particles MACOSX_BUNDLE particles.c ${TINYCTHREAD})
|
||||||
add_executable(Simple MACOSX_BUNDLE simple.c)
|
add_executable(Simple MACOSX_BUNDLE simple.c)
|
||||||
add_executable("Split View" MACOSX_BUNDLE splitview.c)
|
add_executable(SplitView MACOSX_BUNDLE splitview.c)
|
||||||
add_executable(Wave MACOSX_BUNDLE wave.c)
|
add_executable(Wave MACOSX_BUNDLE wave.c)
|
||||||
|
|
||||||
set_target_properties(Boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
|
set_target_properties(Boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
|
||||||
set_target_properties(Gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
|
set_target_properties(Gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
|
||||||
|
set_target_properties(Heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
|
||||||
|
set_target_properties(Particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
|
||||||
set_target_properties(Simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
|
set_target_properties(Simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
|
||||||
set_target_properties("Split View" PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View")
|
set_target_properties(SplitView PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View")
|
||||||
set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
||||||
|
|
||||||
|
set_target_properties(Boing Gears Heightmap Particles Simple SplitView Wave PROPERTIES
|
||||||
|
FOLDER "GLFW3/Examples"
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/AppleInfo.plist")
|
||||||
|
|
||||||
else()
|
else()
|
||||||
# Set boring names for executables
|
# Set boring names for executables
|
||||||
add_executable(boing WIN32 boing.c)
|
add_executable(boing WIN32 boing.c)
|
||||||
add_executable(gears WIN32 gears.c)
|
add_executable(gears WIN32 gears.c)
|
||||||
add_executable(heightmap WIN32 heightmap.c ${GETOPT})
|
add_executable(heightmap WIN32 heightmap.c ${GLAD})
|
||||||
|
add_executable(particles WIN32 particles.c ${TINYCTHREAD} ${GETOPT})
|
||||||
add_executable(simple WIN32 simple.c)
|
add_executable(simple WIN32 simple.c)
|
||||||
add_executable(splitview WIN32 splitview.c)
|
add_executable(splitview WIN32 splitview.c)
|
||||||
add_executable(wave WIN32 wave.c)
|
add_executable(wave WIN32 wave.c)
|
||||||
|
|
||||||
|
set_target_properties(boing gears heightmap particles simple splitview wave PROPERTIES
|
||||||
|
FOLDER "GLFW3/Examples")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(Particles "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
|
elseif (UNIX)
|
||||||
|
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(WINDOWS_BINARIES boing gears heightmap simple splitview wave)
|
set(WINDOWS_BINARIES boing gears heightmap particles simple splitview wave)
|
||||||
|
|
||||||
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
||||||
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
|
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
|
||||||
@@ -55,7 +73,7 @@ if (MSVC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(BUNDLE_BINARIES Boing Gears Simple "Split View" Wave)
|
set(BUNDLE_BINARIES Boing Gears Heightmap Particles Simple SplitView Wave)
|
||||||
|
|
||||||
set_target_properties(${BUNDLE_BINARIES} PROPERTIES
|
set_target_properties(${BUNDLE_BINARIES} PROPERTIES
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
||||||
|
|||||||
+42
-1
@@ -44,6 +44,8 @@ void init( void );
|
|||||||
void display( void );
|
void display( void );
|
||||||
void reshape( GLFWwindow* window, int w, int h );
|
void reshape( GLFWwindow* window, int w, int h );
|
||||||
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
|
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
|
||||||
|
void mouse_button_callback( GLFWwindow* window, int button, int action, int mods );
|
||||||
|
void cursor_position_callback( GLFWwindow* window, double x, double y );
|
||||||
void DrawBoingBall( void );
|
void DrawBoingBall( void );
|
||||||
void BounceBall( double dt );
|
void BounceBall( double dt );
|
||||||
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
|
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
|
||||||
@@ -80,8 +82,12 @@ typedef enum { DRAW_BALL, DRAW_BALL_SHADOW } DRAW_BALL_ENUM;
|
|||||||
typedef struct {float x; float y; float z;} vertex_t;
|
typedef struct {float x; float y; float z;} vertex_t;
|
||||||
|
|
||||||
/* Global vars */
|
/* Global vars */
|
||||||
|
int width, height;
|
||||||
GLfloat deg_rot_y = 0.f;
|
GLfloat deg_rot_y = 0.f;
|
||||||
GLfloat deg_rot_y_inc = 2.f;
|
GLfloat deg_rot_y_inc = 2.f;
|
||||||
|
GLboolean override_pos = GL_FALSE;
|
||||||
|
GLfloat cursor_x = 0.f;
|
||||||
|
GLfloat cursor_y = 0.f;
|
||||||
GLfloat ball_x = -RADIUS;
|
GLfloat ball_x = -RADIUS;
|
||||||
GLfloat ball_y = -RADIUS;
|
GLfloat ball_y = -RADIUS;
|
||||||
GLfloat ball_x_inc = 1.f;
|
GLfloat ball_x_inc = 1.f;
|
||||||
@@ -251,6 +257,37 @@ void key_callback( GLFWwindow* window, int key, int scancode, int action, int mo
|
|||||||
glfwSetWindowShouldClose(window, GL_TRUE);
|
glfwSetWindowShouldClose(window, GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_ball_pos ( GLfloat x, GLfloat y )
|
||||||
|
{
|
||||||
|
ball_x = (width / 2) - x;
|
||||||
|
ball_y = y - (height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouse_button_callback( GLFWwindow* window, int button, int action, int mods )
|
||||||
|
{
|
||||||
|
if (button != GLFW_MOUSE_BUTTON_LEFT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (action == GLFW_PRESS)
|
||||||
|
{
|
||||||
|
override_pos = GL_TRUE;
|
||||||
|
set_ball_pos(cursor_x, cursor_y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
override_pos = GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cursor_position_callback( GLFWwindow* window, double x, double y )
|
||||||
|
{
|
||||||
|
cursor_x = (float) x;
|
||||||
|
cursor_y = (float) y;
|
||||||
|
|
||||||
|
if ( override_pos )
|
||||||
|
set_ball_pos(cursor_x, cursor_y);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Draw the Boing ball.
|
* Draw the Boing ball.
|
||||||
*
|
*
|
||||||
@@ -341,6 +378,9 @@ void BounceBall( double delta_t )
|
|||||||
GLfloat sign;
|
GLfloat sign;
|
||||||
GLfloat deg;
|
GLfloat deg;
|
||||||
|
|
||||||
|
if ( override_pos )
|
||||||
|
return;
|
||||||
|
|
||||||
/* Bounce on walls */
|
/* Bounce on walls */
|
||||||
if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) )
|
if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) )
|
||||||
{
|
{
|
||||||
@@ -574,7 +614,6 @@ void DrawGrid( void )
|
|||||||
int main( void )
|
int main( void )
|
||||||
{
|
{
|
||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
int width, height;
|
|
||||||
|
|
||||||
/* Init GLFW */
|
/* Init GLFW */
|
||||||
if( !glfwInit() )
|
if( !glfwInit() )
|
||||||
@@ -591,6 +630,8 @@ int main( void )
|
|||||||
|
|
||||||
glfwSetFramebufferSizeCallback(window, reshape);
|
glfwSetFramebufferSizeCallback(window, reshape);
|
||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
|
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||||
|
glfwSetCursorPosCallback(window, cursor_position_callback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval( 1 );
|
glfwSwapInterval( 1 );
|
||||||
|
|||||||
+59
-228
@@ -28,37 +28,9 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "getopt.h"
|
|
||||||
|
|
||||||
|
#include <glad/glad.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <GL/glext.h>
|
|
||||||
|
|
||||||
/* OpenGL function pointers */
|
|
||||||
static PFNGLGENBUFFERSPROC pglGenBuffers = NULL;
|
|
||||||
static PFNGLGENVERTEXARRAYSPROC pglGenVertexArrays = NULL;
|
|
||||||
static PFNGLDELETEVERTEXARRAYSPROC pglDeleteVertexArrays = NULL;
|
|
||||||
static PFNGLCREATESHADERPROC pglCreateShader = NULL;
|
|
||||||
static PFNGLSHADERSOURCEPROC pglShaderSource = NULL;
|
|
||||||
static PFNGLCOMPILESHADERPROC pglCompileShader = NULL;
|
|
||||||
static PFNGLGETSHADERIVPROC pglGetShaderiv = NULL;
|
|
||||||
static PFNGLGETSHADERINFOLOGPROC pglGetShaderInfoLog = NULL;
|
|
||||||
static PFNGLDELETESHADERPROC pglDeleteShader = NULL;
|
|
||||||
static PFNGLCREATEPROGRAMPROC pglCreateProgram = NULL;
|
|
||||||
static PFNGLATTACHSHADERPROC pglAttachShader = NULL;
|
|
||||||
static PFNGLLINKPROGRAMPROC pglLinkProgram = NULL;
|
|
||||||
static PFNGLUSEPROGRAMPROC pglUseProgram = NULL;
|
|
||||||
static PFNGLGETPROGRAMIVPROC pglGetProgramiv = NULL;
|
|
||||||
static PFNGLGETPROGRAMINFOLOGPROC pglGetProgramInfoLog = NULL;
|
|
||||||
static PFNGLDELETEPROGRAMPROC pglDeleteProgram = NULL;
|
|
||||||
static PFNGLGETUNIFORMLOCATIONPROC pglGetUniformLocation = NULL;
|
|
||||||
static PFNGLUNIFORMMATRIX4FVPROC pglUniformMatrix4fv = NULL;
|
|
||||||
static PFNGLGETATTRIBLOCATIONPROC pglGetAttribLocation = NULL;
|
|
||||||
static PFNGLBINDVERTEXARRAYPROC pglBindVertexArray = NULL;
|
|
||||||
static PFNGLBUFFERDATAPROC pglBufferData = NULL;
|
|
||||||
static PFNGLBINDBUFFERPROC pglBindBuffer = NULL;
|
|
||||||
static PFNGLBUFFERSUBDATAPROC pglBufferSubData = NULL;
|
|
||||||
static PFNGLENABLEVERTEXATTRIBARRAYPROC pglEnableVertexAttribArray = NULL;
|
|
||||||
static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL;
|
|
||||||
|
|
||||||
/* Map height updates */
|
/* Map height updates */
|
||||||
#define MAX_CIRCLE_SIZE (5.0f)
|
#define MAX_CIRCLE_SIZE (5.0f)
|
||||||
@@ -75,54 +47,11 @@ static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL;
|
|||||||
2 * (MAP_NUM_VERTICES - 1))
|
2 * (MAP_NUM_VERTICES - 1))
|
||||||
|
|
||||||
|
|
||||||
/* OpenGL function pointers */
|
|
||||||
|
|
||||||
#define RESOLVE_GL_FCN(type, var, name) \
|
|
||||||
if (status == GL_TRUE) \
|
|
||||||
{\
|
|
||||||
var = (type) glfwGetProcAddress((name));\
|
|
||||||
if ((var) == NULL)\
|
|
||||||
{\
|
|
||||||
status = GL_FALSE;\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static GLboolean init_opengl(void)
|
|
||||||
{
|
|
||||||
GLboolean status = GL_TRUE;
|
|
||||||
RESOLVE_GL_FCN(PFNGLCREATESHADERPROC, pglCreateShader, "glCreateShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLSHADERSOURCEPROC, pglShaderSource, "glShaderSource");
|
|
||||||
RESOLVE_GL_FCN(PFNGLCOMPILESHADERPROC, pglCompileShader, "glCompileShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETSHADERIVPROC, pglGetShaderiv, "glGetShaderiv");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETSHADERINFOLOGPROC, pglGetShaderInfoLog, "glGetShaderInfoLog");
|
|
||||||
RESOLVE_GL_FCN(PFNGLDELETESHADERPROC, pglDeleteShader, "glDeleteShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLCREATEPROGRAMPROC, pglCreateProgram, "glCreateProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLATTACHSHADERPROC, pglAttachShader, "glAttachShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLLINKPROGRAMPROC, pglLinkProgram, "glLinkProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLUSEPROGRAMPROC, pglUseProgram, "glUseProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETPROGRAMIVPROC, pglGetProgramiv, "glGetProgramiv");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETPROGRAMINFOLOGPROC, pglGetProgramInfoLog, "glGetProgramInfoLog");
|
|
||||||
RESOLVE_GL_FCN(PFNGLDELETEPROGRAMPROC, pglDeleteProgram, "glDeleteProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETUNIFORMLOCATIONPROC, pglGetUniformLocation, "glGetUniformLocation");
|
|
||||||
RESOLVE_GL_FCN(PFNGLUNIFORMMATRIX4FVPROC, pglUniformMatrix4fv, "glUniformMatrix4fv");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETATTRIBLOCATIONPROC, pglGetAttribLocation, "glGetAttribLocation");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGENVERTEXARRAYSPROC, pglGenVertexArrays, "glGenVertexArrays");
|
|
||||||
RESOLVE_GL_FCN(PFNGLDELETEVERTEXARRAYSPROC, pglDeleteVertexArrays, "glDeleteVertexArrays");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBINDVERTEXARRAYPROC, pglBindVertexArray, "glBindVertexArray");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGENBUFFERSPROC, pglGenBuffers, "glGenBuffers");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBINDBUFFERPROC, pglBindBuffer, "glBindBuffer");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBUFFERDATAPROC, pglBufferData, "glBufferData");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBUFFERSUBDATAPROC, pglBufferSubData, "glBufferSubData");
|
|
||||||
RESOLVE_GL_FCN(PFNGLENABLEVERTEXATTRIBARRAYPROC, pglEnableVertexAttribArray, "glEnableVertexAttribArray");
|
|
||||||
RESOLVE_GL_FCN(PFNGLVERTEXATTRIBPOINTERPROC, pglVertexAttribPointer, "glVertexAttribPointer");
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Default shader programs
|
* Default shader programs
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
static const char* default_vertex_shader =
|
static const char* vertex_shader_text =
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
"uniform mat4 project;\n"
|
"uniform mat4 project;\n"
|
||||||
"uniform mat4 modelview;\n"
|
"uniform mat4 modelview;\n"
|
||||||
@@ -135,12 +64,12 @@ static const char* default_vertex_shader =
|
|||||||
" gl_Position = project * modelview * vec4(x, y, z, 1.0);\n"
|
" gl_Position = project * modelview * vec4(x, y, z, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static const char* default_fragment_shader =
|
static const char* fragment_shader_text =
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
"out vec4 gl_FragColor;\n"
|
"out vec4 color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = vec4(0.2, 1.0, 0.2, 1.0); \n"
|
" color = vec4(0.2, 1.0, 0.2, 1.0); \n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
@@ -188,53 +117,27 @@ static GLuint mesh_vbo[4];
|
|||||||
* OpenGL helper functions
|
* OpenGL helper functions
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
/* Load a (text) file into memory and return its contents
|
|
||||||
*/
|
|
||||||
static char* read_file_content(const char* filename)
|
|
||||||
{
|
|
||||||
FILE* fd;
|
|
||||||
size_t size = 0;
|
|
||||||
char* result = NULL;
|
|
||||||
|
|
||||||
fd = fopen(filename, "r");
|
|
||||||
if (fd != NULL)
|
|
||||||
{
|
|
||||||
size = fseek(fd, 0, SEEK_END);
|
|
||||||
(void) fseek(fd, 0, SEEK_SET);
|
|
||||||
|
|
||||||
result = malloc(size + 1);
|
|
||||||
result[size] = '\0';
|
|
||||||
if (fread(result, size, 1, fd) != 1)
|
|
||||||
{
|
|
||||||
free(result);
|
|
||||||
result = NULL;
|
|
||||||
}
|
|
||||||
(void) fclose(fd);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Creates a shader object of the specified type using the specified text
|
/* Creates a shader object of the specified type using the specified text
|
||||||
*/
|
*/
|
||||||
static GLuint make_shader(GLenum type, const char* shader_src)
|
static GLuint make_shader(GLenum type, const char* text)
|
||||||
{
|
{
|
||||||
GLuint shader;
|
GLuint shader;
|
||||||
GLint shader_ok;
|
GLint shader_ok;
|
||||||
GLsizei log_length;
|
GLsizei log_length;
|
||||||
char info_log[8192];
|
char info_log[8192];
|
||||||
|
|
||||||
shader = pglCreateShader(type);
|
shader = glCreateShader(type);
|
||||||
if (shader != 0)
|
if (shader != 0)
|
||||||
{
|
{
|
||||||
pglShaderSource(shader, 1, (const GLchar**)&shader_src, NULL);
|
glShaderSource(shader, 1, (const GLchar**)&text, NULL);
|
||||||
pglCompileShader(shader);
|
glCompileShader(shader);
|
||||||
pglGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok);
|
glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok);
|
||||||
if (shader_ok != GL_TRUE)
|
if (shader_ok != GL_TRUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" );
|
fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" );
|
||||||
pglGetShaderInfoLog(shader, 8192, &log_length,info_log);
|
glGetShaderInfoLog(shader, 8192, &log_length,info_log);
|
||||||
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
||||||
pglDeleteShader(shader);
|
glDeleteShader(shader);
|
||||||
shader = 0;
|
shader = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +146,7 @@ static GLuint make_shader(GLenum type, const char* shader_src)
|
|||||||
|
|
||||||
/* Creates a program object using the specified vertex and fragment text
|
/* Creates a program object using the specified vertex and fragment text
|
||||||
*/
|
*/
|
||||||
static GLuint make_shader_program(const char* vertex_shader_src, const char* fragment_shader_src)
|
static GLuint make_shader_program(const char* vs_text, const char* fs_text)
|
||||||
{
|
{
|
||||||
GLuint program = 0u;
|
GLuint program = 0u;
|
||||||
GLint program_ok;
|
GLint program_ok;
|
||||||
@@ -252,30 +155,30 @@ static GLuint make_shader_program(const char* vertex_shader_src, const char* fra
|
|||||||
GLsizei log_length;
|
GLsizei log_length;
|
||||||
char info_log[8192];
|
char info_log[8192];
|
||||||
|
|
||||||
vertex_shader = make_shader(GL_VERTEX_SHADER, (vertex_shader_src == NULL) ? default_vertex_shader : vertex_shader_src);
|
vertex_shader = make_shader(GL_VERTEX_SHADER, vs_text);
|
||||||
if (vertex_shader != 0u)
|
if (vertex_shader != 0u)
|
||||||
{
|
{
|
||||||
fragment_shader = make_shader(GL_FRAGMENT_SHADER, (fragment_shader_src == NULL) ? default_fragment_shader : fragment_shader_src);
|
fragment_shader = make_shader(GL_FRAGMENT_SHADER, fs_text);
|
||||||
if (fragment_shader != 0u)
|
if (fragment_shader != 0u)
|
||||||
{
|
{
|
||||||
/* make the program that connect the two shader and link it */
|
/* make the program that connect the two shader and link it */
|
||||||
program = pglCreateProgram();
|
program = glCreateProgram();
|
||||||
if (program != 0u)
|
if (program != 0u)
|
||||||
{
|
{
|
||||||
/* attach both shader and link */
|
/* attach both shader and link */
|
||||||
pglAttachShader(program, vertex_shader);
|
glAttachShader(program, vertex_shader);
|
||||||
pglAttachShader(program, fragment_shader);
|
glAttachShader(program, fragment_shader);
|
||||||
pglLinkProgram(program);
|
glLinkProgram(program);
|
||||||
pglGetProgramiv(program, GL_LINK_STATUS, &program_ok);
|
glGetProgramiv(program, GL_LINK_STATUS, &program_ok);
|
||||||
|
|
||||||
if (program_ok != GL_TRUE)
|
if (program_ok != GL_TRUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR, failed to link shader program\n");
|
fprintf(stderr, "ERROR, failed to link shader program\n");
|
||||||
pglGetProgramInfoLog(program, 8192, &log_length, info_log);
|
glGetProgramInfoLog(program, 8192, &log_length, info_log);
|
||||||
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
||||||
pglDeleteProgram(program);
|
glDeleteProgram(program);
|
||||||
pglDeleteShader(fragment_shader);
|
glDeleteShader(fragment_shader);
|
||||||
pglDeleteShader(vertex_shader);
|
glDeleteShader(vertex_shader);
|
||||||
program = 0u;
|
program = 0u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,7 +186,7 @@ static GLuint make_shader_program(const char* vertex_shader_src, const char* fra
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Unable to load fragment shader\n");
|
fprintf(stderr, "ERROR: Unable to load fragment shader\n");
|
||||||
pglDeleteShader(vertex_shader);
|
glDeleteShader(vertex_shader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -439,38 +342,38 @@ static void make_mesh(GLuint program)
|
|||||||
{
|
{
|
||||||
GLuint attrloc;
|
GLuint attrloc;
|
||||||
|
|
||||||
pglGenVertexArrays(1, &mesh);
|
glGenVertexArrays(1, &mesh);
|
||||||
pglGenBuffers(4, mesh_vbo);
|
glGenBuffers(4, mesh_vbo);
|
||||||
pglBindVertexArray(mesh);
|
glBindVertexArray(mesh);
|
||||||
/* Prepare the data for drawing through a buffer inidices */
|
/* Prepare the data for drawing through a buffer inidices */
|
||||||
pglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]);
|
||||||
pglBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW);
|
||||||
|
|
||||||
/* Prepare the attributes for rendering */
|
/* Prepare the attributes for rendering */
|
||||||
attrloc = pglGetAttribLocation(program, "x");
|
attrloc = glGetAttribLocation(program, "x");
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW);
|
||||||
pglEnableVertexAttribArray(attrloc);
|
glEnableVertexAttribArray(attrloc);
|
||||||
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
|
||||||
attrloc = pglGetAttribLocation(program, "z");
|
attrloc = glGetAttribLocation(program, "z");
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW);
|
||||||
pglEnableVertexAttribArray(attrloc);
|
glEnableVertexAttribArray(attrloc);
|
||||||
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
|
||||||
attrloc = pglGetAttribLocation(program, "y");
|
attrloc = glGetAttribLocation(program, "y");
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW);
|
||||||
pglEnableVertexAttribArray(attrloc);
|
glEnableVertexAttribArray(attrloc);
|
||||||
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update VBO vertices from source data
|
/* Update VBO vertices from source data
|
||||||
*/
|
*/
|
||||||
static void update_mesh(void)
|
static void update_mesh(void)
|
||||||
{
|
{
|
||||||
pglBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]);
|
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
@@ -488,17 +391,15 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print usage information */
|
static void error_callback(int error, const char* description)
|
||||||
static void usage(void)
|
|
||||||
{
|
{
|
||||||
printf("Usage: heightmap [-v <vertex_shader_path>] [-f <fragment_shader_path>]\n");
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
printf(" heightmap [-h]\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
int ch, iter;
|
int iter;
|
||||||
double dt;
|
double dt;
|
||||||
double last_update_time;
|
double last_update_time;
|
||||||
int frame;
|
int frame;
|
||||||
@@ -506,80 +407,22 @@ int main(int argc, char** argv)
|
|||||||
GLint uloc_modelview;
|
GLint uloc_modelview;
|
||||||
GLint uloc_project;
|
GLint uloc_project;
|
||||||
|
|
||||||
char* vertex_shader_path = NULL;
|
|
||||||
char* fragment_shader_path = NULL;
|
|
||||||
char* vertex_shader_src = NULL;
|
|
||||||
char* fragment_shader_src = NULL;
|
|
||||||
GLuint shader_program;
|
GLuint shader_program;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "f:v:h")) != -1)
|
glfwSetErrorCallback(error_callback);
|
||||||
{
|
|
||||||
switch (ch)
|
|
||||||
{
|
|
||||||
case 'f':
|
|
||||||
fragment_shader_path = optarg;
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
vertex_shader_path = optarg;
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
usage();
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fragment_shader_path)
|
|
||||||
{
|
|
||||||
vertex_shader_src = read_file_content(fragment_shader_path);
|
|
||||||
if (!fragment_shader_src)
|
|
||||||
{
|
|
||||||
fprintf(stderr,
|
|
||||||
"ERROR: unable to load fragment shader from '%s'\n",
|
|
||||||
fragment_shader_path);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vertex_shader_path)
|
|
||||||
{
|
|
||||||
vertex_shader_src = read_file_content(vertex_shader_path);
|
|
||||||
if (!vertex_shader_src)
|
|
||||||
{
|
|
||||||
fprintf(stderr,
|
|
||||||
"ERROR: unable to load vertex shader from '%s'\n",
|
|
||||||
fragment_shader_path);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: Unable to initialize GLFW\n");
|
|
||||||
usage();
|
|
||||||
|
|
||||||
free(vertex_shader_src);
|
|
||||||
free(fragment_shader_src);
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
|
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
|
|
||||||
window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL);
|
window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL);
|
||||||
if (! window )
|
if (! window )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Unable to create the OpenGL context and associated window\n");
|
|
||||||
usage();
|
|
||||||
|
|
||||||
free(vertex_shader_src);
|
|
||||||
free(fragment_shader_src);
|
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -588,32 +431,20 @@ int main(int argc, char** argv)
|
|||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
if (GL_TRUE != init_opengl())
|
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: unable to resolve OpenGL function pointers\n");
|
|
||||||
free(vertex_shader_src);
|
|
||||||
free(fragment_shader_src);
|
|
||||||
|
|
||||||
glfwTerminate();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
/* Prepare opengl resources for rendering */
|
/* Prepare opengl resources for rendering */
|
||||||
shader_program = make_shader_program(vertex_shader_src , fragment_shader_src);
|
shader_program = make_shader_program(vertex_shader_text, fragment_shader_text);
|
||||||
free(vertex_shader_src);
|
|
||||||
free(fragment_shader_src);
|
|
||||||
|
|
||||||
if (shader_program == 0u)
|
if (shader_program == 0u)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: during creation of the shader program\n");
|
|
||||||
usage();
|
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pglUseProgram(shader_program);
|
glUseProgram(shader_program);
|
||||||
uloc_project = pglGetUniformLocation(shader_program, "project");
|
uloc_project = glGetUniformLocation(shader_program, "project");
|
||||||
uloc_modelview = pglGetUniformLocation(shader_program, "modelview");
|
uloc_modelview = glGetUniformLocation(shader_program, "modelview");
|
||||||
|
|
||||||
/* Compute the projection matrix */
|
/* Compute the projection matrix */
|
||||||
f = 1.0f / tanf(view_angle / 2.0f);
|
f = 1.0f / tanf(view_angle / 2.0f);
|
||||||
@@ -622,13 +453,13 @@ int main(int argc, char** argv)
|
|||||||
projection_matrix[10] = (z_far + z_near)/ (z_near - z_far);
|
projection_matrix[10] = (z_far + z_near)/ (z_near - z_far);
|
||||||
projection_matrix[11] = -1.0f;
|
projection_matrix[11] = -1.0f;
|
||||||
projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far);
|
projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far);
|
||||||
pglUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix);
|
glUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix);
|
||||||
|
|
||||||
/* Set the camera position */
|
/* Set the camera position */
|
||||||
modelview_matrix[12] = -5.0f;
|
modelview_matrix[12] = -5.0f;
|
||||||
modelview_matrix[13] = -5.0f;
|
modelview_matrix[13] = -5.0f;
|
||||||
modelview_matrix[14] = -20.0f;
|
modelview_matrix[14] = -20.0f;
|
||||||
pglUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix);
|
glUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix);
|
||||||
|
|
||||||
/* Create mesh data */
|
/* Create mesh data */
|
||||||
init_map();
|
init_map();
|
||||||
@@ -644,7 +475,7 @@ int main(int argc, char** argv)
|
|||||||
/* main loop */
|
/* main loop */
|
||||||
frame = 0;
|
frame = 0;
|
||||||
iter = 0;
|
iter = 0;
|
||||||
dt = last_update_time = glfwGetTime();
|
last_update_time = glfwGetTime();
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -57,6 +57,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
|
|
||||||
|
|||||||
+4
-10
@@ -371,7 +371,9 @@ static void framebufferSizeFun(GLFWwindow* window, int w, int h)
|
|||||||
|
|
||||||
static void windowRefreshFun(GLFWwindow* window)
|
static void windowRefreshFun(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
do_redraw = 1;
|
drawAllViews();
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
do_redraw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -485,15 +487,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Only redraw if we need to
|
// Only redraw if we need to
|
||||||
if (do_redraw)
|
if (do_redraw)
|
||||||
{
|
windowRefreshFun(window);
|
||||||
// Draw all views
|
|
||||||
drawAllViews();
|
|
||||||
|
|
||||||
// Swap buffers
|
|
||||||
glfwSwapBuffers(window);
|
|
||||||
|
|
||||||
do_redraw = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for new events
|
// Wait for new events
|
||||||
glfwWaitEvents();
|
glfwWaitEvents();
|
||||||
|
|||||||
+7
-12
@@ -28,10 +28,8 @@
|
|||||||
GLfloat alpha = 210.f, beta = -70.f;
|
GLfloat alpha = 210.f, beta = -70.f;
|
||||||
GLfloat zoom = 2.f;
|
GLfloat zoom = 2.f;
|
||||||
|
|
||||||
GLboolean locked = GL_FALSE;
|
double cursorX;
|
||||||
|
double cursorY;
|
||||||
int cursorX;
|
|
||||||
int cursorY;
|
|
||||||
|
|
||||||
struct Vertex
|
struct Vertex
|
||||||
{
|
{
|
||||||
@@ -321,13 +319,10 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|||||||
if (action == GLFW_PRESS)
|
if (action == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
locked = GL_TRUE;
|
glfwGetCursorPos(window, &cursorX, &cursorY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
locked = GL_FALSE;
|
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -337,14 +332,14 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|||||||
|
|
||||||
void cursor_position_callback(GLFWwindow* window, double x, double y)
|
void cursor_position_callback(GLFWwindow* window, double x, double y)
|
||||||
{
|
{
|
||||||
if (locked)
|
if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
alpha += (GLfloat) (x - cursorX) / 10.f;
|
alpha += (GLfloat) (x - cursorX) / 10.f;
|
||||||
beta += (GLfloat) (y - cursorY) / 10.f;
|
beta += (GLfloat) (y - cursorY) / 10.f;
|
||||||
}
|
|
||||||
|
|
||||||
cursorX = (int) x;
|
cursorX = x;
|
||||||
cursorY = (int) y;
|
cursorY = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1550
-479
File diff suppressed because it is too large
Load Diff
+197
-22
@@ -1,7 +1,6 @@
|
|||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW - An OpenGL library
|
* GLFW 3.1 - www.glfw.org
|
||||||
* API version: 3.0
|
* A library for OpenGL, window and input
|
||||||
* WWW: http://www.glfw.org/
|
|
||||||
*------------------------------------------------------------------------
|
*------------------------------------------------------------------------
|
||||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -41,13 +40,13 @@ extern "C" {
|
|||||||
|
|
||||||
/*! @defgroup native Native access
|
/*! @defgroup native Native access
|
||||||
*
|
*
|
||||||
* **By using the native API, you assert that you know what you are doing and
|
* **By using the native access functions you assert that you know what you're
|
||||||
* how to fix problems caused by using it. If you don't, you shouldn't be
|
* doing and how to fix problems caused by using them. If you don't, you
|
||||||
* using it.**
|
* shouldn't be using them.**
|
||||||
*
|
*
|
||||||
* Before the inclusion of @ref glfw3native.h, you must define exactly one
|
* Before the inclusion of @ref glfw3native.h, you must define exactly one
|
||||||
* window API macro and exactly one context API macro. Failure to do this
|
* window system API macro and exactly one context creation API macro. Failure
|
||||||
* will cause a compile-time error.
|
* to do this will cause a compile-time error.
|
||||||
*
|
*
|
||||||
* The available window API macros are:
|
* The available window API macros are:
|
||||||
* * `GLFW_EXPOSE_NATIVE_WIN32`
|
* * `GLFW_EXPOSE_NATIVE_WIN32`
|
||||||
@@ -60,8 +59,8 @@ extern "C" {
|
|||||||
* * `GLFW_EXPOSE_NATIVE_GLX`
|
* * `GLFW_EXPOSE_NATIVE_GLX`
|
||||||
* * `GLFW_EXPOSE_NATIVE_EGL`
|
* * `GLFW_EXPOSE_NATIVE_EGL`
|
||||||
*
|
*
|
||||||
* These macros select which of the native access functions are declared and
|
* These macros select which of the native access functions that are declared
|
||||||
* which platform-specific headers to include. It is then up your (by
|
* and which platform-specific headers to include. It is then up your (by
|
||||||
* definition platform-specific) code to handle which of these should be
|
* definition platform-specific) code to handle which of these should be
|
||||||
* defined.
|
* defined.
|
||||||
*/
|
*/
|
||||||
@@ -72,8 +71,13 @@ extern "C" {
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
||||||
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
|
// example to allow applications to correctly declare a GL_ARB_debug_output
|
||||||
|
// callback) but windows.h assumes no one will define APIENTRY before it does
|
||||||
|
#undef APIENTRY
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
|
#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#if defined(__OBJC__)
|
#if defined(__OBJC__)
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#else
|
#else
|
||||||
@@ -81,8 +85,9 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_X11)
|
#elif defined(GLFW_EXPOSE_NATIVE_X11)
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
#else
|
#else
|
||||||
#error "No window API specified"
|
#error "No window API selected"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
@@ -94,7 +99,7 @@ extern "C" {
|
|||||||
#elif defined(GLFW_EXPOSE_NATIVE_EGL)
|
#elif defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#else
|
#else
|
||||||
#error "No context API specified"
|
#error "No context API selected"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -103,8 +108,49 @@ extern "C" {
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
||||||
|
/*! @brief Returns the adapter device name of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
|
||||||
|
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
|
||||||
|
* occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the display device name of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The UTF-8 encoded display device name (for example
|
||||||
|
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `HWND` of the specified window.
|
/*! @brief Returns the `HWND` of the specified window.
|
||||||
* @return The `HWND` of the specified window.
|
*
|
||||||
|
* @return The `HWND` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||||
@@ -112,15 +158,48 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
/*! @brief Returns the `HGLRC` of the specified window.
|
/*! @brief Returns the `HGLRC` of the specified window.
|
||||||
* @return The `HGLRC` of the specified window.
|
*
|
||||||
|
* @return The `HGLRC` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
||||||
|
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `CGDirectDisplayID` of the specified monitor, or
|
||||||
|
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `NSWindow` of the specified window.
|
/*! @brief Returns the `NSWindow` of the specified window.
|
||||||
* @return The `NSWindow` of the specified window.
|
*
|
||||||
|
* @return The `NSWindow` of the specified window, or `nil` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||||
@@ -128,7 +207,16 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
/*! @brief Returns the `NSOpenGLContext` of the specified window.
|
/*! @brief Returns the `NSOpenGLContext` of the specified window.
|
||||||
* @return The `NSOpenGLContext` of the specified window.
|
*
|
||||||
|
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||||
@@ -136,12 +224,61 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_X11)
|
#if defined(GLFW_EXPOSE_NATIVE_X11)
|
||||||
/*! @brief Returns the `Display` used by GLFW.
|
/*! @brief Returns the `Display` used by GLFW.
|
||||||
* @return The `Display` used by GLFW.
|
*
|
||||||
|
* @return The `Display` used by GLFW, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI Display* glfwGetX11Display(void);
|
GLFWAPI Display* glfwGetX11Display(void);
|
||||||
|
|
||||||
|
/*! @brief Returns the `RRCrtc` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `RRCrtc` of the specified monitor, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the `RROutput` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `RROutput` of the specified monitor, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `Window` of the specified window.
|
/*! @brief Returns the `Window` of the specified window.
|
||||||
* @return The `Window` of the specified window.
|
*
|
||||||
|
* @return The `Window` of the specified window, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
|
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
|
||||||
@@ -149,7 +286,16 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
/*! @brief Returns the `GLXContext` of the specified window.
|
/*! @brief Returns the `GLXContext` of the specified window.
|
||||||
* @return The `GLXContext` of the specified window.
|
*
|
||||||
|
* @return The `GLXContext` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||||
@@ -157,17 +303,46 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||||
/*! @brief Returns the `EGLDisplay` used by GLFW.
|
/*! @brief Returns the `EGLDisplay` used by GLFW.
|
||||||
* @return The `EGLDisplay` used by GLFW.
|
*
|
||||||
|
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
||||||
|
|
||||||
/*! @brief Returns the `EGLContext` of the specified window.
|
/*! @brief Returns the `EGLContext` of the specified window.
|
||||||
* @return The `EGLContext` of the specified window.
|
*
|
||||||
|
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Returns the `EGLSurface` of the specified window.
|
/*! @brief Returns the `EGLSurface` of the specified window.
|
||||||
* @return The `EGLSurface` of the specified window.
|
*
|
||||||
|
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may be called from any thread. Access is not synchronized.
|
||||||
|
*
|
||||||
|
* @par History
|
||||||
|
* Added in GLFW 3.0.
|
||||||
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||||
|
|||||||
+45
-36
@@ -1,44 +1,54 @@
|
|||||||
|
|
||||||
include_directories(${GLFW_SOURCE_DIR}/src
|
include_directories("${GLFW_SOURCE_DIR}/src"
|
||||||
${GLFW_BINARY_DIR}/src
|
"${GLFW_BINARY_DIR}/src"
|
||||||
${glfw_INCLUDE_DIRS})
|
${glfw_INCLUDE_DIRS})
|
||||||
|
|
||||||
if (MSVC)
|
add_definitions(-D_GLFW_USE_CONFIG_H)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(common_HEADERS ${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h internal.h)
|
set(common_HEADERS internal.h
|
||||||
set(common_SOURCES clipboard.c context.c gamma.c init.c input.c joystick.c
|
"${GLFW_BINARY_DIR}/src/glfw_config.h"
|
||||||
monitor.c time.c window.c)
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
||||||
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
|
||||||
|
set(common_SOURCES context.c init.c input.c monitor.c window.c)
|
||||||
|
|
||||||
if (_GLFW_COCOA)
|
if (_GLFW_COCOA)
|
||||||
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h)
|
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h iokit_joystick.h
|
||||||
set(glfw_SOURCES ${common_SOURCES} cocoa_clipboard.m cocoa_gamma.c
|
posix_tls.h)
|
||||||
cocoa_init.m cocoa_joystick.m cocoa_monitor.m cocoa_time.c
|
set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_monitor.m
|
||||||
cocoa_window.m)
|
cocoa_window.m iokit_joystick.m mach_time.c posix_tls.c)
|
||||||
elseif (_GLFW_WIN32)
|
elseif (_GLFW_WIN32)
|
||||||
set(glfw_HEADERS ${common_HEADERS} win32_platform.h)
|
set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_tls.h
|
||||||
set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_gamma.c
|
winmm_joystick.h)
|
||||||
win32_init.c win32_joystick.c win32_monitor.c win32_time.c
|
set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_monitor.c win32_time.c
|
||||||
win32_window.c)
|
win32_tls.c win32_window.c winmm_joystick.c)
|
||||||
elseif (_GLFW_X11)
|
elseif (_GLFW_X11)
|
||||||
set(glfw_HEADERS ${common_HEADERS} x11_platform.h)
|
set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h
|
||||||
set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_gamma.c x11_init.c
|
linux_joystick.h posix_time.h posix_tls.h)
|
||||||
x11_joystick.c x11_monitor.c x11_time.c x11_window.c
|
set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c
|
||||||
x11_unicode.c)
|
xkb_unicode.c linux_joystick.c posix_time.c posix_tls.c)
|
||||||
|
elseif (_GLFW_WAYLAND)
|
||||||
|
set(glfw_HEADERS ${common_HEADERS} wl_platform.h linux_joystick.h
|
||||||
|
posix_time.h posix_tls.h xkb_unicode.h)
|
||||||
|
set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c
|
||||||
|
linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c)
|
||||||
|
elseif (_GLFW_MIR)
|
||||||
|
set(glfw_HEADERS ${common_HEADERS} mir_platform.h linux_joystick.h
|
||||||
|
posix_time.h posix_tls.h xkb_unicode.h)
|
||||||
|
set(glfw_SOURCES ${common_SOURCES} mir_init.c mir_monitor.c mir_window.c
|
||||||
|
linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (_GLFW_EGL)
|
if (_GLFW_EGL)
|
||||||
list(APPEND glfw_HEADERS ${common_HEADERS} egl_platform.h)
|
list(APPEND glfw_HEADERS ${common_HEADERS} egl_context.h)
|
||||||
list(APPEND glfw_SOURCES ${common_SOURCES} egl_context.c)
|
list(APPEND glfw_SOURCES ${common_SOURCES} egl_context.c)
|
||||||
elseif (_GLFW_NSGL)
|
elseif (_GLFW_NSGL)
|
||||||
list(APPEND glfw_HEADERS ${common_HEADERS} nsgl_platform.h)
|
list(APPEND glfw_HEADERS ${common_HEADERS} nsgl_context.h)
|
||||||
list(APPEND glfw_SOURCES ${common_SOURCES} nsgl_context.m)
|
list(APPEND glfw_SOURCES ${common_SOURCES} nsgl_context.m)
|
||||||
elseif (_GLFW_WGL)
|
elseif (_GLFW_WGL)
|
||||||
list(APPEND glfw_HEADERS ${common_HEADERS} wgl_platform.h)
|
list(APPEND glfw_HEADERS ${common_HEADERS} wgl_context.h)
|
||||||
list(APPEND glfw_SOURCES ${common_SOURCES} wgl_context.c)
|
list(APPEND glfw_SOURCES ${common_SOURCES} wgl_context.c)
|
||||||
elseif (_GLFW_X11)
|
elseif (_GLFW_X11)
|
||||||
list(APPEND glfw_HEADERS ${common_HEADERS} glx_platform.h)
|
list(APPEND glfw_HEADERS ${common_HEADERS} glx_context.h)
|
||||||
list(APPEND glfw_SOURCES ${common_SOURCES} glx_context.c)
|
list(APPEND glfw_SOURCES ${common_SOURCES} glx_context.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -48,15 +58,14 @@ if (APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
|
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
|
||||||
set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}")
|
set_target_properties(glfw PROPERTIES
|
||||||
|
OUTPUT_NAME "${GLFW_LIB_NAME}"
|
||||||
|
VERSION ${GLFW_VERSION}
|
||||||
|
SOVERSION ${GLFW_VERSION_MAJOR}
|
||||||
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
FOLDER "GLFW3")
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
# Include version information in the output
|
|
||||||
set_target_properties(glfw PROPERTIES VERSION ${GLFW_VERSION})
|
|
||||||
if (UNIX)
|
|
||||||
set_target_properties(glfw PROPERTIES SOVERSION ${GLFW_VERSION_MAJOR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# The GLFW DLL needs a special compile-time macro and import library name
|
# The GLFW DLL needs a special compile-time macro and import library name
|
||||||
set_target_properties(glfw PROPERTIES PREFIX "" IMPORT_PREFIX "")
|
set_target_properties(glfw PROPERTIES PREFIX "" IMPORT_PREFIX "")
|
||||||
@@ -74,14 +83,14 @@ if (BUILD_SHARED_LIBS)
|
|||||||
set(glfw_CFLAGS "")
|
set(glfw_CFLAGS "")
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(glfw PROPERTIES
|
set_target_properties(glfw PROPERTIES
|
||||||
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common")
|
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common"
|
||||||
|
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(glfw ${glfw_LIBRARIES})
|
target_link_libraries(glfw ${glfw_LIBRARIES})
|
||||||
target_link_libraries(glfw LINK_INTERFACE_LIBRARIES)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS glfw
|
if (GLFW_INSTALL)
|
||||||
EXPORT glfwTargets
|
install(TARGETS glfw EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX})
|
||||||
DESTINATION lib${LIB_SUFFIX} )
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
//========================================================================
|
|
||||||
// GLFW - An OpenGL library
|
|
||||||
// Platform: Cocoa
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW platform API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|
||||||
{
|
|
||||||
NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil];
|
|
||||||
|
|
||||||
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
|
||||||
[pasteboard declareTypes:types owner:nil];
|
|
||||||
[pasteboard setString:[NSString stringWithUTF8String:string]
|
|
||||||
forType:NSStringPboardType];
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
|
||||||
|
|
||||||
if (![[pasteboard types] containsObject:NSStringPboardType])
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString* object = [pasteboard stringForType:NSStringPboardType];
|
|
||||||
if (!object)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Cocoa: Failed to retrieve object from pasteboard");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(_glfw.ns.clipboardString);
|
|
||||||
_glfw.ns.clipboardString = strdup([object UTF8String]);
|
|
||||||
|
|
||||||
return _glfw.ns.clipboardString;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
//========================================================================
|
|
||||||
// GLFW - An OpenGL library
|
|
||||||
// Platform: Cocoa
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW platform API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|
||||||
{
|
|
||||||
uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
|
||||||
CGGammaValue* values = (CGGammaValue*) malloc(size * 3 * sizeof(CGGammaValue));
|
|
||||||
|
|
||||||
CGGetDisplayTransferByTable(monitor->ns.displayID,
|
|
||||||
size,
|
|
||||||
values,
|
|
||||||
values + size,
|
|
||||||
values + size * 2,
|
|
||||||
&size);
|
|
||||||
|
|
||||||
_glfwAllocGammaRamp(ramp, size);
|
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
ramp->red[i] = (unsigned short) (values[i] * 65535);
|
|
||||||
ramp->green[i] = (unsigned short) (values[i + size] * 65535);
|
|
||||||
ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(values);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
CGGammaValue* values = (CGGammaValue*) malloc(ramp->size * 3 * sizeof(CGGammaValue));
|
|
||||||
|
|
||||||
for (i = 0; i < ramp->size; i++)
|
|
||||||
{
|
|
||||||
values[i] = ramp->red[i] / 65535.f;
|
|
||||||
values[i + ramp->size] = ramp->green[i] / 65535.f;
|
|
||||||
values[i + ramp->size * 2] = ramp->blue[i] / 65535.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGSetDisplayTransferByTable(monitor->ns.displayID,
|
|
||||||
ramp->size,
|
|
||||||
values,
|
|
||||||
values + ramp->size,
|
|
||||||
values + ramp->size * 2);
|
|
||||||
|
|
||||||
free(values);
|
|
||||||
}
|
|
||||||
|
|
||||||
+139
-12
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
// Platform: Cocoa/NSOpenGL
|
|
||||||
// API Version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@@ -71,6 +68,128 @@ static void changeToResourcesDirectory(void)
|
|||||||
|
|
||||||
#endif /* _GLFW_USE_CHDIR */
|
#endif /* _GLFW_USE_CHDIR */
|
||||||
|
|
||||||
|
// Create key code translation tables
|
||||||
|
//
|
||||||
|
static void createKeyTables(void)
|
||||||
|
{
|
||||||
|
memset(_glfw.ns.publicKeys, -1, sizeof(_glfw.ns.publicKeys));
|
||||||
|
|
||||||
|
_glfw.ns.publicKeys[0x1D] = GLFW_KEY_0;
|
||||||
|
_glfw.ns.publicKeys[0x12] = GLFW_KEY_1;
|
||||||
|
_glfw.ns.publicKeys[0x13] = GLFW_KEY_2;
|
||||||
|
_glfw.ns.publicKeys[0x14] = GLFW_KEY_3;
|
||||||
|
_glfw.ns.publicKeys[0x15] = GLFW_KEY_4;
|
||||||
|
_glfw.ns.publicKeys[0x17] = GLFW_KEY_5;
|
||||||
|
_glfw.ns.publicKeys[0x16] = GLFW_KEY_6;
|
||||||
|
_glfw.ns.publicKeys[0x1A] = GLFW_KEY_7;
|
||||||
|
_glfw.ns.publicKeys[0x1C] = GLFW_KEY_8;
|
||||||
|
_glfw.ns.publicKeys[0x19] = GLFW_KEY_9;
|
||||||
|
_glfw.ns.publicKeys[0x00] = GLFW_KEY_A;
|
||||||
|
_glfw.ns.publicKeys[0x0B] = GLFW_KEY_B;
|
||||||
|
_glfw.ns.publicKeys[0x08] = GLFW_KEY_C;
|
||||||
|
_glfw.ns.publicKeys[0x02] = GLFW_KEY_D;
|
||||||
|
_glfw.ns.publicKeys[0x0E] = GLFW_KEY_E;
|
||||||
|
_glfw.ns.publicKeys[0x03] = GLFW_KEY_F;
|
||||||
|
_glfw.ns.publicKeys[0x05] = GLFW_KEY_G;
|
||||||
|
_glfw.ns.publicKeys[0x04] = GLFW_KEY_H;
|
||||||
|
_glfw.ns.publicKeys[0x22] = GLFW_KEY_I;
|
||||||
|
_glfw.ns.publicKeys[0x26] = GLFW_KEY_J;
|
||||||
|
_glfw.ns.publicKeys[0x28] = GLFW_KEY_K;
|
||||||
|
_glfw.ns.publicKeys[0x25] = GLFW_KEY_L;
|
||||||
|
_glfw.ns.publicKeys[0x2E] = GLFW_KEY_M;
|
||||||
|
_glfw.ns.publicKeys[0x2D] = GLFW_KEY_N;
|
||||||
|
_glfw.ns.publicKeys[0x1F] = GLFW_KEY_O;
|
||||||
|
_glfw.ns.publicKeys[0x23] = GLFW_KEY_P;
|
||||||
|
_glfw.ns.publicKeys[0x0C] = GLFW_KEY_Q;
|
||||||
|
_glfw.ns.publicKeys[0x0F] = GLFW_KEY_R;
|
||||||
|
_glfw.ns.publicKeys[0x01] = GLFW_KEY_S;
|
||||||
|
_glfw.ns.publicKeys[0x11] = GLFW_KEY_T;
|
||||||
|
_glfw.ns.publicKeys[0x20] = GLFW_KEY_U;
|
||||||
|
_glfw.ns.publicKeys[0x09] = GLFW_KEY_V;
|
||||||
|
_glfw.ns.publicKeys[0x0D] = GLFW_KEY_W;
|
||||||
|
_glfw.ns.publicKeys[0x07] = GLFW_KEY_X;
|
||||||
|
_glfw.ns.publicKeys[0x10] = GLFW_KEY_Y;
|
||||||
|
_glfw.ns.publicKeys[0x06] = GLFW_KEY_Z;
|
||||||
|
|
||||||
|
_glfw.ns.publicKeys[0x27] = GLFW_KEY_APOSTROPHE;
|
||||||
|
_glfw.ns.publicKeys[0x2A] = GLFW_KEY_BACKSLASH;
|
||||||
|
_glfw.ns.publicKeys[0x2B] = GLFW_KEY_COMMA;
|
||||||
|
_glfw.ns.publicKeys[0x18] = GLFW_KEY_EQUAL;
|
||||||
|
_glfw.ns.publicKeys[0x32] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
|
_glfw.ns.publicKeys[0x21] = GLFW_KEY_LEFT_BRACKET;
|
||||||
|
_glfw.ns.publicKeys[0x1B] = GLFW_KEY_MINUS;
|
||||||
|
_glfw.ns.publicKeys[0x2F] = GLFW_KEY_PERIOD;
|
||||||
|
_glfw.ns.publicKeys[0x1E] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
|
_glfw.ns.publicKeys[0x29] = GLFW_KEY_SEMICOLON;
|
||||||
|
_glfw.ns.publicKeys[0x2C] = GLFW_KEY_SLASH;
|
||||||
|
_glfw.ns.publicKeys[0x0A] = GLFW_KEY_WORLD_1;
|
||||||
|
|
||||||
|
_glfw.ns.publicKeys[0x33] = GLFW_KEY_BACKSPACE;
|
||||||
|
_glfw.ns.publicKeys[0x39] = GLFW_KEY_CAPS_LOCK;
|
||||||
|
_glfw.ns.publicKeys[0x75] = GLFW_KEY_DELETE;
|
||||||
|
_glfw.ns.publicKeys[0x7D] = GLFW_KEY_DOWN;
|
||||||
|
_glfw.ns.publicKeys[0x77] = GLFW_KEY_END;
|
||||||
|
_glfw.ns.publicKeys[0x24] = GLFW_KEY_ENTER;
|
||||||
|
_glfw.ns.publicKeys[0x35] = GLFW_KEY_ESCAPE;
|
||||||
|
_glfw.ns.publicKeys[0x7A] = GLFW_KEY_F1;
|
||||||
|
_glfw.ns.publicKeys[0x78] = GLFW_KEY_F2;
|
||||||
|
_glfw.ns.publicKeys[0x63] = GLFW_KEY_F3;
|
||||||
|
_glfw.ns.publicKeys[0x76] = GLFW_KEY_F4;
|
||||||
|
_glfw.ns.publicKeys[0x60] = GLFW_KEY_F5;
|
||||||
|
_glfw.ns.publicKeys[0x61] = GLFW_KEY_F6;
|
||||||
|
_glfw.ns.publicKeys[0x62] = GLFW_KEY_F7;
|
||||||
|
_glfw.ns.publicKeys[0x64] = GLFW_KEY_F8;
|
||||||
|
_glfw.ns.publicKeys[0x65] = GLFW_KEY_F9;
|
||||||
|
_glfw.ns.publicKeys[0x6D] = GLFW_KEY_F10;
|
||||||
|
_glfw.ns.publicKeys[0x67] = GLFW_KEY_F11;
|
||||||
|
_glfw.ns.publicKeys[0x6F] = GLFW_KEY_F12;
|
||||||
|
_glfw.ns.publicKeys[0x69] = GLFW_KEY_F13;
|
||||||
|
_glfw.ns.publicKeys[0x6B] = GLFW_KEY_F14;
|
||||||
|
_glfw.ns.publicKeys[0x71] = GLFW_KEY_F15;
|
||||||
|
_glfw.ns.publicKeys[0x6A] = GLFW_KEY_F16;
|
||||||
|
_glfw.ns.publicKeys[0x40] = GLFW_KEY_F17;
|
||||||
|
_glfw.ns.publicKeys[0x4F] = GLFW_KEY_F18;
|
||||||
|
_glfw.ns.publicKeys[0x50] = GLFW_KEY_F19;
|
||||||
|
_glfw.ns.publicKeys[0x5A] = GLFW_KEY_F20;
|
||||||
|
_glfw.ns.publicKeys[0x73] = GLFW_KEY_HOME;
|
||||||
|
_glfw.ns.publicKeys[0x72] = GLFW_KEY_INSERT;
|
||||||
|
_glfw.ns.publicKeys[0x7B] = GLFW_KEY_LEFT;
|
||||||
|
_glfw.ns.publicKeys[0x3A] = GLFW_KEY_LEFT_ALT;
|
||||||
|
_glfw.ns.publicKeys[0x3B] = GLFW_KEY_LEFT_CONTROL;
|
||||||
|
_glfw.ns.publicKeys[0x38] = GLFW_KEY_LEFT_SHIFT;
|
||||||
|
_glfw.ns.publicKeys[0x37] = GLFW_KEY_LEFT_SUPER;
|
||||||
|
_glfw.ns.publicKeys[0x6E] = GLFW_KEY_MENU;
|
||||||
|
_glfw.ns.publicKeys[0x47] = GLFW_KEY_NUM_LOCK;
|
||||||
|
_glfw.ns.publicKeys[0x79] = GLFW_KEY_PAGE_DOWN;
|
||||||
|
_glfw.ns.publicKeys[0x74] = GLFW_KEY_PAGE_UP;
|
||||||
|
_glfw.ns.publicKeys[0x7C] = GLFW_KEY_RIGHT;
|
||||||
|
_glfw.ns.publicKeys[0x3D] = GLFW_KEY_RIGHT_ALT;
|
||||||
|
_glfw.ns.publicKeys[0x3E] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
|
_glfw.ns.publicKeys[0x3C] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
|
_glfw.ns.publicKeys[0x36] = GLFW_KEY_RIGHT_SUPER;
|
||||||
|
_glfw.ns.publicKeys[0x31] = GLFW_KEY_SPACE;
|
||||||
|
_glfw.ns.publicKeys[0x30] = GLFW_KEY_TAB;
|
||||||
|
_glfw.ns.publicKeys[0x7E] = GLFW_KEY_UP;
|
||||||
|
|
||||||
|
_glfw.ns.publicKeys[0x52] = GLFW_KEY_KP_0;
|
||||||
|
_glfw.ns.publicKeys[0x53] = GLFW_KEY_KP_1;
|
||||||
|
_glfw.ns.publicKeys[0x54] = GLFW_KEY_KP_2;
|
||||||
|
_glfw.ns.publicKeys[0x55] = GLFW_KEY_KP_3;
|
||||||
|
_glfw.ns.publicKeys[0x56] = GLFW_KEY_KP_4;
|
||||||
|
_glfw.ns.publicKeys[0x57] = GLFW_KEY_KP_5;
|
||||||
|
_glfw.ns.publicKeys[0x58] = GLFW_KEY_KP_6;
|
||||||
|
_glfw.ns.publicKeys[0x59] = GLFW_KEY_KP_7;
|
||||||
|
_glfw.ns.publicKeys[0x5B] = GLFW_KEY_KP_8;
|
||||||
|
_glfw.ns.publicKeys[0x5C] = GLFW_KEY_KP_9;
|
||||||
|
_glfw.ns.publicKeys[0x45] = GLFW_KEY_KP_ADD;
|
||||||
|
_glfw.ns.publicKeys[0x41] = GLFW_KEY_KP_DECIMAL;
|
||||||
|
_glfw.ns.publicKeys[0x4B] = GLFW_KEY_KP_DIVIDE;
|
||||||
|
_glfw.ns.publicKeys[0x4C] = GLFW_KEY_KP_ENTER;
|
||||||
|
_glfw.ns.publicKeys[0x51] = GLFW_KEY_KP_EQUAL;
|
||||||
|
_glfw.ns.publicKeys[0x43] = GLFW_KEY_KP_MULTIPLY;
|
||||||
|
_glfw.ns.publicKeys[0x4E] = GLFW_KEY_KP_SUBTRACT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
@@ -84,12 +203,7 @@ int _glfwPlatformInit(void)
|
|||||||
changeToResourcesDirectory();
|
changeToResourcesDirectory();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_glfwInitTimer();
|
createKeyTables();
|
||||||
|
|
||||||
_glfwInitJoysticks();
|
|
||||||
|
|
||||||
if (!_glfwInitContextAPI())
|
|
||||||
return GL_FALSE;
|
|
||||||
|
|
||||||
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
if (!_glfw.ns.eventSource)
|
if (!_glfw.ns.eventSource)
|
||||||
@@ -97,6 +211,12 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
|
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
|
||||||
|
|
||||||
|
if (!_glfwInitContextAPI())
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
_glfwInitTimer();
|
||||||
|
_glfwInitJoysticks();
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,9 +228,12 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfw.ns.eventSource = NULL;
|
_glfw.ns.eventSource = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.ns.delegate)
|
||||||
|
{
|
||||||
[NSApp setDelegate:nil];
|
[NSApp setDelegate:nil];
|
||||||
[_glfw.ns.delegate release];
|
[_glfw.ns.delegate release];
|
||||||
_glfw.ns.delegate = nil;
|
_glfw.ns.delegate = nil;
|
||||||
|
}
|
||||||
|
|
||||||
[_glfw.ns.autoreleasePool release];
|
[_glfw.ns.autoreleasePool release];
|
||||||
_glfw.ns.autoreleasePool = nil;
|
_glfw.ns.autoreleasePool = nil;
|
||||||
@@ -118,14 +241,15 @@ void _glfwPlatformTerminate(void)
|
|||||||
[_glfw.ns.cursor release];
|
[_glfw.ns.cursor release];
|
||||||
_glfw.ns.cursor = nil;
|
_glfw.ns.cursor = nil;
|
||||||
|
|
||||||
_glfwTerminateJoysticks();
|
free(_glfw.ns.clipboardString);
|
||||||
|
|
||||||
|
_glfwTerminateJoysticks();
|
||||||
_glfwTerminateContextAPI();
|
_glfwTerminateContextAPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
{
|
{
|
||||||
const char* version = _GLFW_VERSION_FULL " Cocoa"
|
const char* version = _GLFW_VERSION_NUMBER " Cocoa"
|
||||||
#if defined(_GLFW_NSGL)
|
#if defined(_GLFW_NSGL)
|
||||||
" NSGL"
|
" NSGL"
|
||||||
#endif
|
#endif
|
||||||
@@ -135,6 +259,9 @@ const char* _glfwPlatformGetVersionString(void)
|
|||||||
#if defined(_GLFW_USE_MENUBAR)
|
#if defined(_GLFW_USE_MENUBAR)
|
||||||
" menubar"
|
" menubar"
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(_GLFW_USE_RETINA)
|
||||||
|
" retina"
|
||||||
|
#endif
|
||||||
#if defined(_GLFW_BUILD_DLL)
|
#if defined(_GLFW_BUILD_DLL)
|
||||||
" dynamic"
|
" dynamic"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+180
-114
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
// Platform: Cocoa
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -30,35 +27,46 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||||
|
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||||
|
#include <CoreVideo/CVBase.h>
|
||||||
|
#include <CoreVideo/CVDisplayLink.h>
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
|
|
||||||
// Get the name of the specified display
|
// Get the name of the specified display
|
||||||
//
|
//
|
||||||
static const char* getDisplayName(CGDirectDisplayID displayID)
|
static char* getDisplayName(CGDirectDisplayID displayID)
|
||||||
{
|
{
|
||||||
char* name;
|
char* name;
|
||||||
CFDictionaryRef info, names;
|
CFDictionaryRef info, names;
|
||||||
CFStringRef value;
|
CFStringRef value;
|
||||||
CFIndex size;
|
CFIndex size;
|
||||||
|
|
||||||
|
// NOTE: This uses a deprecated function because Apple has
|
||||||
|
// (as of January 2015) not provided any alternative
|
||||||
info = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID),
|
info = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID),
|
||||||
kIODisplayOnlyPreferredName);
|
kIODisplayOnlyPreferredName);
|
||||||
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
||||||
|
|
||||||
if (!CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
||||||
(const void**) &value))
|
(const void**) &value))
|
||||||
{
|
{
|
||||||
|
// This may happen if a desktop Mac is running headless
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to retrieve display name");
|
||||||
|
|
||||||
CFRelease(info);
|
CFRelease(info);
|
||||||
return strdup("Unknown");
|
return strdup("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(value),
|
size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(value),
|
||||||
kCFStringEncodingUTF8);
|
kCFStringEncodingUTF8);
|
||||||
name = (char*) malloc(size + 1);
|
name = calloc(size + 1, sizeof(char));
|
||||||
CFStringGetCString(value, name, size, kCFStringEncodingUTF8);
|
CFStringGetCString(value, name, size, kCFStringEncodingUTF8);
|
||||||
|
|
||||||
CFRelease(info);
|
CFRelease(info);
|
||||||
@@ -77,9 +85,6 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
|
|||||||
if (flags & kDisplayModeInterlacedFlag)
|
if (flags & kDisplayModeInterlacedFlag)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
if (flags & kDisplayModeTelevisionFlag)
|
|
||||||
return GL_FALSE;
|
|
||||||
|
|
||||||
if (flags & kDisplayModeStretchedFlag)
|
if (flags & kDisplayModeStretchedFlag)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
@@ -97,13 +102,21 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
|
|||||||
|
|
||||||
// Convert Core Graphics display mode to GLFW video mode
|
// Convert Core Graphics display mode to GLFW video mode
|
||||||
//
|
//
|
||||||
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
|
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
||||||
|
CVDisplayLinkRef link)
|
||||||
{
|
{
|
||||||
GLFWvidmode result;
|
GLFWvidmode result;
|
||||||
result.width = CGDisplayModeGetWidth(mode);
|
result.width = (int) CGDisplayModeGetWidth(mode);
|
||||||
result.height = CGDisplayModeGetHeight(mode);
|
result.height = (int) CGDisplayModeGetHeight(mode);
|
||||||
result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode);
|
result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode);
|
||||||
|
|
||||||
|
if (result.refreshRate == 0)
|
||||||
|
{
|
||||||
|
const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
|
||||||
|
if (!(time.flags & kCVTimeIsIndefinite))
|
||||||
|
result.refreshRate = (int) (time.timeScale / (double) time.timeValue);
|
||||||
|
}
|
||||||
|
|
||||||
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
||||||
|
|
||||||
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
|
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
|
||||||
@@ -155,74 +168,57 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
|
|||||||
//
|
//
|
||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef bestMode = NULL;
|
|
||||||
CFArrayRef modes;
|
CFArrayRef modes;
|
||||||
CFIndex count, i;
|
CFIndex count, i;
|
||||||
unsigned int sizeDiff, leastSizeDiff = UINT_MAX;
|
CVDisplayLinkRef link;
|
||||||
unsigned int rateDiff, leastRateDiff = UINT_MAX;
|
CGDisplayModeRef native = NULL;
|
||||||
const int bpp = desired->redBits - desired->greenBits - desired->blueBits;
|
GLFWvidmode current;
|
||||||
|
const GLFWvidmode* best;
|
||||||
|
|
||||||
|
best = _glfwChooseVideoMode(monitor, desired);
|
||||||
|
_glfwPlatformGetVideoMode(monitor, ¤t);
|
||||||
|
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||||
|
|
||||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||||
count = CFArrayGetCount(modes);
|
count = CFArrayGetCount(modes);
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||||
if (!modeIsGood(mode))
|
if (!modeIsGood(dm))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int modeBPP;
|
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||||
|
if (_glfwCompareVideoModes(best, &mode) == 0)
|
||||||
// Identify display mode pixel encoding
|
|
||||||
{
|
{
|
||||||
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
native = dm;
|
||||||
|
break;
|
||||||
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
|
}
|
||||||
modeBPP = 16;
|
|
||||||
else
|
|
||||||
modeBPP = 32;
|
|
||||||
|
|
||||||
CFRelease(format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const int modeWidth = (int) CGDisplayModeGetWidth(mode);
|
if (native)
|
||||||
const int modeHeight = (int) CGDisplayModeGetHeight(mode);
|
|
||||||
const int modeRate = (int) CGDisplayModeGetRefreshRate(mode);
|
|
||||||
|
|
||||||
sizeDiff = (abs(modeBPP - bpp) << 25) |
|
|
||||||
((modeWidth - desired->width) * (modeWidth - desired->width) +
|
|
||||||
(modeHeight - desired->height) * (modeHeight - desired->height));
|
|
||||||
|
|
||||||
if (desired->refreshRate)
|
|
||||||
rateDiff = abs(modeRate - desired->refreshRate);
|
|
||||||
else
|
|
||||||
rateDiff = UINT_MAX - modeRate;
|
|
||||||
|
|
||||||
if ((sizeDiff < leastSizeDiff) ||
|
|
||||||
(sizeDiff == leastSizeDiff && rateDiff < leastRateDiff))
|
|
||||||
{
|
{
|
||||||
bestMode = mode;
|
if (monitor->ns.previousMode == NULL)
|
||||||
leastSizeDiff = sizeDiff;
|
|
||||||
leastRateDiff = rateDiff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bestMode)
|
|
||||||
{
|
|
||||||
CFRelease(modes);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||||
|
|
||||||
CGDisplayFadeReservationToken token = beginFadeReservation();
|
CGDisplayFadeReservationToken token = beginFadeReservation();
|
||||||
|
CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL);
|
||||||
CGDisplayCapture(monitor->ns.displayID);
|
|
||||||
CGDisplaySetDisplayMode(monitor->ns.displayID, bestMode, NULL);
|
|
||||||
|
|
||||||
endFadeReservation(token);
|
endFadeReservation(token);
|
||||||
|
}
|
||||||
|
|
||||||
CFRelease(modes);
|
CFRelease(modes);
|
||||||
|
CVDisplayLinkRelease(link);
|
||||||
|
|
||||||
|
if (!native)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Monitor mode list changed");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,12 +226,16 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
//
|
//
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
|
if (monitor->ns.previousMode)
|
||||||
|
{
|
||||||
CGDisplayFadeReservationToken token = beginFadeReservation();
|
CGDisplayFadeReservationToken token = beginFadeReservation();
|
||||||
|
CGDisplaySetDisplayMode(monitor->ns.displayID,
|
||||||
CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL);
|
monitor->ns.previousMode, NULL);
|
||||||
CGDisplayRelease(monitor->ns.displayID);
|
|
||||||
|
|
||||||
endFadeReservation(token);
|
endFadeReservation(token);
|
||||||
|
|
||||||
|
CGDisplayModeRelease(monitor->ns.previousMode);
|
||||||
|
monitor->ns.previousMode = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -245,75 +245,62 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
|||||||
|
|
||||||
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||||
{
|
{
|
||||||
uint32_t i, found = 0, monitorCount;
|
uint32_t i, found = 0, displayCount;
|
||||||
_GLFWmonitor** monitors;
|
_GLFWmonitor** monitors;
|
||||||
CGDirectDisplayID* displays;
|
CGDirectDisplayID* displays;
|
||||||
|
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
CGGetActiveDisplayList(0, NULL, &monitorCount);
|
CGGetOnlineDisplayList(0, NULL, &displayCount);
|
||||||
|
|
||||||
displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID));
|
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||||
monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*));
|
monitors = calloc(displayCount, sizeof(_GLFWmonitor*));
|
||||||
|
|
||||||
CGGetActiveDisplayList(monitorCount, displays, &monitorCount);
|
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
||||||
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
|
||||||
{
|
|
||||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
|
||||||
|
|
||||||
monitors[found] = _glfwCreateMonitor(getDisplayName(displays[i]),
|
|
||||||
size.width, size.height);
|
|
||||||
|
|
||||||
monitors[found]->ns.displayID = displays[i];
|
|
||||||
found++;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(displays);
|
|
||||||
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
|
||||||
{
|
|
||||||
if (CGDisplayIsMain(monitors[i]->ns.displayID))
|
|
||||||
{
|
|
||||||
_GLFWmonitor* temp = monitors[0];
|
|
||||||
monitors[0] = monitors[i];
|
|
||||||
monitors[i] = temp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSArray* screens = [NSScreen screens];
|
NSArray* screens = [NSScreen screens];
|
||||||
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
for (i = 0; i < displayCount; i++)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
CGDirectDisplayID screenDisplayID = CGDisplayMirrorsDisplay(displays[i]);
|
||||||
|
if (screenDisplayID == kCGNullDirectDisplay)
|
||||||
|
screenDisplayID = displays[i];
|
||||||
|
|
||||||
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
|
char* name = getDisplayName(displays[i]);
|
||||||
|
|
||||||
|
monitors[found] = _glfwAllocMonitor(name, size.width, size.height);
|
||||||
|
monitors[found]->ns.displayID = displays[i];
|
||||||
|
|
||||||
|
free(name);
|
||||||
|
|
||||||
for (j = 0; j < [screens count]; j++)
|
for (j = 0; j < [screens count]; j++)
|
||||||
{
|
{
|
||||||
NSScreen* screen = [screens objectAtIndex:j];
|
NSScreen* screen = [screens objectAtIndex:j];
|
||||||
NSDictionary* dictionary = [screen deviceDescription];
|
NSDictionary* dictionary = [screen deviceDescription];
|
||||||
NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
|
NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
|
||||||
|
|
||||||
if (monitors[i]->ns.displayID == [number unsignedIntegerValue])
|
if ([number unsignedIntegerValue] == screenDisplayID)
|
||||||
{
|
{
|
||||||
monitors[i]->ns.screen = screen;
|
monitors[found]->ns.screen = screen;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitors[i]->ns.screen == nil)
|
if (monitors[found]->ns.screen)
|
||||||
|
found++;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_glfwDestroyMonitors(monitors, monitorCount);
|
_glfwFreeMonitor(monitors[found]);
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
monitors[found] = NULL;
|
||||||
"Cocoa: Failed to find NSScreen for CGDisplay %s",
|
|
||||||
monitors[i]->name);
|
|
||||||
|
|
||||||
free(monitors);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*count = monitorCount;
|
free(displays);
|
||||||
|
|
||||||
|
*count = found;
|
||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,37 +322,116 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
|||||||
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||||
{
|
{
|
||||||
CFArrayRef modes;
|
CFArrayRef modes;
|
||||||
CFIndex count, i;
|
CFIndex count, i, j;
|
||||||
GLFWvidmode* result;
|
GLFWvidmode* result;
|
||||||
|
CVDisplayLinkRef link;
|
||||||
|
|
||||||
|
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||||
|
|
||||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||||
count = CFArrayGetCount(modes);
|
count = CFArrayGetCount(modes);
|
||||||
|
|
||||||
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * count);
|
result = calloc(count, sizeof(GLFWvidmode));
|
||||||
*found = 0;
|
*found = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef mode;
|
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||||
|
if (!modeIsGood(dm))
|
||||||
|
continue;
|
||||||
|
|
||||||
mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||||
if (modeIsGood(mode))
|
|
||||||
|
for (j = 0; j < *found; j++)
|
||||||
{
|
{
|
||||||
result[*found] = vidmodeFromCGDisplayMode(mode);
|
if (_glfwCompareVideoModes(result + j, &mode) == 0)
|
||||||
(*found)++;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i < *found)
|
||||||
|
{
|
||||||
|
// This is a duplicate, so skip it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result[*found] = mode;
|
||||||
|
(*found)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(modes);
|
CFRelease(modes);
|
||||||
|
|
||||||
|
CVDisplayLinkRelease(link);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef displayMode;
|
CGDisplayModeRef displayMode;
|
||||||
|
CVDisplayLinkRef link;
|
||||||
|
|
||||||
|
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||||
|
|
||||||
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||||
*mode = vidmodeFromCGDisplayMode(displayMode);
|
*mode = vidmodeFromCGDisplayMode(displayMode, link);
|
||||||
CGDisplayModeRelease(displayMode);
|
CGDisplayModeRelease(displayMode);
|
||||||
|
|
||||||
|
CVDisplayLinkRelease(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||||
|
CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
|
||||||
|
|
||||||
|
CGGetDisplayTransferByTable(monitor->ns.displayID,
|
||||||
|
size,
|
||||||
|
values,
|
||||||
|
values + size,
|
||||||
|
values + size * 2,
|
||||||
|
&size);
|
||||||
|
|
||||||
|
_glfwAllocGammaArrays(ramp, size);
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
ramp->red[i] = (unsigned short) (values[i] * 65535);
|
||||||
|
ramp->green[i] = (unsigned short) (values[i + size] * 65535);
|
||||||
|
ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
|
||||||
|
|
||||||
|
for (i = 0; i < ramp->size; i++)
|
||||||
|
{
|
||||||
|
values[i] = ramp->red[i] / 65535.f;
|
||||||
|
values[i + ramp->size] = ramp->green[i] / 65535.f;
|
||||||
|
values[i + ramp->size * 2] = ramp->blue[i] / 65535.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGSetDisplayTransferByTable(monitor->ns.displayID,
|
||||||
|
ramp->size,
|
||||||
|
values,
|
||||||
|
values + ramp->size,
|
||||||
|
values + ramp->size * 2);
|
||||||
|
|
||||||
|
free(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
|
||||||
|
return monitor->ns.displayID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+38
-68
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
// Platform: Cocoa
|
|
||||||
// API Version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@@ -40,85 +37,57 @@
|
|||||||
typedef void* id;
|
typedef void* id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "posix_tls.h"
|
||||||
|
|
||||||
#if defined(_GLFW_NSGL)
|
#if defined(_GLFW_NSGL)
|
||||||
#include "nsgl_platform.h"
|
#include "nsgl_context.h"
|
||||||
#else
|
#else
|
||||||
#error "No supported context creation API selected"
|
#error "No supported context creation API selected"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <IOKit/IOKitLib.h>
|
#include "iokit_joystick.h"
|
||||||
#include <IOKit/IOCFPlugIn.h>
|
|
||||||
#include <IOKit/hid/IOHIDLib.h>
|
|
||||||
#include <IOKit/hid/IOHIDKeys.h>
|
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns
|
||||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimeNS ns_time
|
||||||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNS ns
|
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNS ns
|
||||||
|
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// Cocoa-specific per-window data
|
||||||
// GLFW platform specific types
|
//
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific window structure
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWwindowNS
|
typedef struct _GLFWwindowNS
|
||||||
{
|
{
|
||||||
id object;
|
id object;
|
||||||
id delegate;
|
id delegate;
|
||||||
id view;
|
id view;
|
||||||
unsigned int modifierFlags;
|
unsigned int modifierFlags;
|
||||||
|
|
||||||
|
// The total sum of the distances the cursor has been warped
|
||||||
|
// since the last cursor motion event was processed
|
||||||
|
// This is kept to counteract Cocoa doing the same internally
|
||||||
|
double warpDeltaX, warpDeltaY;
|
||||||
|
|
||||||
} _GLFWwindowNS;
|
} _GLFWwindowNS;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// Cocoa-specific global data
|
||||||
// Joystick information & state
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int present;
|
|
||||||
char name[256];
|
|
||||||
|
|
||||||
IOHIDDeviceInterface** interface;
|
|
||||||
|
|
||||||
CFMutableArrayRef axisElements;
|
|
||||||
CFMutableArrayRef buttonElements;
|
|
||||||
CFMutableArrayRef hatElements;
|
|
||||||
|
|
||||||
float* axes;
|
|
||||||
unsigned char* buttons;
|
|
||||||
|
|
||||||
} _GLFWjoy;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific library global data for Cocoa
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWlibraryNS
|
typedef struct _GLFWlibraryNS
|
||||||
{
|
{
|
||||||
struct {
|
|
||||||
double base;
|
|
||||||
double resolution;
|
|
||||||
} timer;
|
|
||||||
|
|
||||||
CGEventSourceRef eventSource;
|
CGEventSourceRef eventSource;
|
||||||
id delegate;
|
id delegate;
|
||||||
id autoreleasePool;
|
id autoreleasePool;
|
||||||
id cursor;
|
id cursor;
|
||||||
|
|
||||||
GLboolean cursorHidden;
|
short int publicKeys[256];
|
||||||
|
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
|
||||||
_GLFWjoy joysticks[GLFW_JOYSTICK_LAST + 1];
|
|
||||||
} _GLFWlibraryNS;
|
} _GLFWlibraryNS;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// Cocoa-specific per-monitor data
|
||||||
// Platform-specific monitor structure
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWmonitorNS
|
typedef struct _GLFWmonitorNS
|
||||||
{
|
{
|
||||||
CGDirectDisplayID displayID;
|
CGDirectDisplayID displayID;
|
||||||
@@ -128,27 +97,28 @@ typedef struct _GLFWmonitorNS
|
|||||||
} _GLFWmonitorNS;
|
} _GLFWmonitorNS;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// Cocoa-specific per-cursor data
|
||||||
// Prototypes for platform specific internal functions
|
//
|
||||||
//========================================================================
|
typedef struct _GLFWcursorNS
|
||||||
|
{
|
||||||
|
id object;
|
||||||
|
|
||||||
|
} _GLFWcursorNS;
|
||||||
|
|
||||||
|
|
||||||
|
// Cocoa-specific global timer data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWtimeNS
|
||||||
|
{
|
||||||
|
double base;
|
||||||
|
double resolution;
|
||||||
|
|
||||||
|
} _GLFWtimeNS;
|
||||||
|
|
||||||
|
|
||||||
// Time
|
|
||||||
void _glfwInitTimer(void);
|
void _glfwInitTimer(void);
|
||||||
|
|
||||||
// Joystick input
|
|
||||||
void _glfwInitJoysticks(void);
|
|
||||||
void _glfwTerminateJoysticks(void);
|
|
||||||
|
|
||||||
// Fullscreen
|
|
||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
// OpenGL support
|
|
||||||
int _glfwInitContextAPI(void);
|
|
||||||
void _glfwTerminateContextAPI(void);
|
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window);
|
|
||||||
|
|
||||||
#endif // _cocoa_platform_h_
|
#endif // _cocoa_platform_h_
|
||||||
|
|||||||
+529
-309
File diff suppressed because it is too large
Load Diff
+143
-128
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -38,9 +35,9 @@
|
|||||||
|
|
||||||
// Parses the client API version string and extracts the version number
|
// Parses the client API version string and extracts the version number
|
||||||
//
|
//
|
||||||
static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
static GLboolean parseVersionString(int* api, int* major, int* minor, int* rev)
|
||||||
{
|
{
|
||||||
int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0;
|
int i;
|
||||||
const char* version;
|
const char* version;
|
||||||
const char* prefixes[] =
|
const char* prefixes[] =
|
||||||
{
|
{
|
||||||
@@ -50,6 +47,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*api = GLFW_OPENGL_API;
|
||||||
|
|
||||||
version = (const char*) glGetString(GL_VERSION);
|
version = (const char*) glGetString(GL_VERSION);
|
||||||
if (!version)
|
if (!version)
|
||||||
{
|
{
|
||||||
@@ -65,23 +64,18 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
|||||||
if (strncmp(version, prefixes[i], length) == 0)
|
if (strncmp(version, prefixes[i], length) == 0)
|
||||||
{
|
{
|
||||||
version += length;
|
version += length;
|
||||||
_api = GLFW_OPENGL_ES_API;
|
*api = GLFW_OPENGL_ES_API;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev))
|
if (!sscanf(version, "%d.%d.%d", major, minor, rev))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"No version found in context version string");
|
"No version found in context version string");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*api = _api;
|
|
||||||
*major = _major;
|
|
||||||
*minor = _minor;
|
|
||||||
*rev = _rev;
|
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,113 +84,100 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
||||||
{
|
{
|
||||||
if (wndconfig->clientAPI != GLFW_OPENGL_API &&
|
if (ctxconfig->api != GLFW_OPENGL_API &&
|
||||||
wndconfig->clientAPI != GLFW_OPENGL_ES_API)
|
ctxconfig->api != GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API requested");
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
if (ctxconfig->api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0 ||
|
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
|
||||||
(wndconfig->glMajor == 1 && wndconfig->glMinor > 5) ||
|
(ctxconfig->major == 1 && ctxconfig->minor > 5) ||
|
||||||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 1) ||
|
(ctxconfig->major == 2 && ctxconfig->minor > 1) ||
|
||||||
(wndconfig->glMajor == 3 && wndconfig->glMinor > 3))
|
(ctxconfig->major == 3 && ctxconfig->minor > 3))
|
||||||
{
|
{
|
||||||
// OpenGL 1.0 is the smallest valid version
|
// OpenGL 1.0 is the smallest valid version
|
||||||
// OpenGL 1.x series ended with version 1.5
|
// OpenGL 1.x series ended with version 1.5
|
||||||
// OpenGL 2.x series ended with version 2.1
|
// OpenGL 2.x series ended with version 2.1
|
||||||
// OpenGL 3.x series ended with version 3.3
|
// OpenGL 3.x series ended with version 3.3
|
||||||
|
// For now, let everything else through
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Invalid OpenGL version %i.%i requested",
|
"Invalid OpenGL version %i.%i",
|
||||||
wndconfig->glMajor, wndconfig->glMinor);
|
ctxconfig->major, ctxconfig->minor);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// For now, let everything else through
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wndconfig->glProfile)
|
if (ctxconfig->profile)
|
||||||
{
|
{
|
||||||
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE &&
|
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE &&
|
||||||
wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE)
|
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"Invalid OpenGL profile requested");
|
"Invalid OpenGL profile");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glMajor < 3 ||
|
if (ctxconfig->major < 3 ||
|
||||||
(wndconfig->glMajor == 3 && wndconfig->glMinor < 2))
|
(ctxconfig->major == 3 && ctxconfig->minor < 2))
|
||||||
{
|
{
|
||||||
// Desktop OpenGL context profiles are only defined for version 3.2
|
// Desktop OpenGL context profiles are only defined for version 3.2
|
||||||
// and above
|
// and above
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Context profiles only exist for "
|
"Context profiles are only defined for OpenGL version 3.2 and above");
|
||||||
"OpenGL version 3.2 and above");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glForward && wndconfig->glMajor < 3)
|
if (ctxconfig->forward && ctxconfig->major < 3)
|
||||||
{
|
{
|
||||||
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
|
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Forward compatibility only exist for OpenGL "
|
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
|
||||||
"version 3.0 and above");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
else if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0 ||
|
if (ctxconfig->major < 1 || ctxconfig->minor < 0 ||
|
||||||
(wndconfig->glMajor == 1 && wndconfig->glMinor > 1) ||
|
(ctxconfig->major == 1 && ctxconfig->minor > 1) ||
|
||||||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 0))
|
(ctxconfig->major == 2 && ctxconfig->minor > 0))
|
||||||
{
|
{
|
||||||
// OpenGL ES 1.0 is the smallest valid version
|
// OpenGL ES 1.0 is the smallest valid version
|
||||||
// OpenGL ES 1.x series ended with version 1.1
|
// OpenGL ES 1.x series ended with version 1.1
|
||||||
// OpenGL ES 2.x series ended with version 2.0
|
// OpenGL ES 2.x series ended with version 2.0
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
|
||||||
"Invalid OpenGL ES version %i.%i requested",
|
|
||||||
wndconfig->glMajor, wndconfig->glMinor);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// For now, let everything else through
|
// For now, let everything else through
|
||||||
}
|
|
||||||
|
|
||||||
if (wndconfig->glProfile)
|
|
||||||
{
|
|
||||||
// OpenGL ES does not support profiles
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Context profiles are not supported by OpenGL ES");
|
"Invalid OpenGL ES version %i.%i",
|
||||||
return GL_FALSE;
|
ctxconfig->major, ctxconfig->minor);
|
||||||
}
|
|
||||||
|
|
||||||
if (wndconfig->glForward)
|
|
||||||
{
|
|
||||||
// OpenGL ES does not support forward-compatibility
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
|
||||||
"Forward compatibility is not supported by OpenGL ES");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glRobustness)
|
if (ctxconfig->robustness)
|
||||||
{
|
{
|
||||||
if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION &&
|
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
|
||||||
wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"Invalid context robustness mode requested");
|
"Invalid context robustness mode");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->release)
|
||||||
|
{
|
||||||
|
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
|
||||||
|
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid context release behavior");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,6 +206,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (desired->doublebuffer != current->doublebuffer)
|
||||||
|
{
|
||||||
|
// Double buffering is a hard constraint
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Count number of missing buffers
|
// Count number of missing buffers
|
||||||
{
|
{
|
||||||
missing = 0;
|
missing = 0;
|
||||||
@@ -238,8 +225,11 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
if (desired->stencilBits > 0 && current->stencilBits == 0)
|
if (desired->stencilBits > 0 && current->stencilBits == 0)
|
||||||
missing++;
|
missing++;
|
||||||
|
|
||||||
if (desired->auxBuffers > 0 && current->auxBuffers < desired->auxBuffers)
|
if (desired->auxBuffers > 0 &&
|
||||||
|
current->auxBuffers < desired->auxBuffers)
|
||||||
|
{
|
||||||
missing += desired->auxBuffers - current->auxBuffers;
|
missing += desired->auxBuffers - current->auxBuffers;
|
||||||
|
}
|
||||||
|
|
||||||
if (desired->samples > 0 && current->samples == 0)
|
if (desired->samples > 0 && current->samples == 0)
|
||||||
{
|
{
|
||||||
@@ -257,19 +247,19 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
{
|
{
|
||||||
colorDiff = 0;
|
colorDiff = 0;
|
||||||
|
|
||||||
if (desired->redBits > 0)
|
if (desired->redBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
colorDiff += (desired->redBits - current->redBits) *
|
colorDiff += (desired->redBits - current->redBits) *
|
||||||
(desired->redBits - current->redBits);
|
(desired->redBits - current->redBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->greenBits > 0)
|
if (desired->greenBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
colorDiff += (desired->greenBits - current->greenBits) *
|
colorDiff += (desired->greenBits - current->greenBits) *
|
||||||
(desired->greenBits - current->greenBits);
|
(desired->greenBits - current->greenBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->blueBits > 0)
|
if (desired->blueBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
colorDiff += (desired->blueBits - current->blueBits) *
|
colorDiff += (desired->blueBits - current->blueBits) *
|
||||||
(desired->blueBits - current->blueBits);
|
(desired->blueBits - current->blueBits);
|
||||||
@@ -280,60 +270,57 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
{
|
{
|
||||||
extraDiff = 0;
|
extraDiff = 0;
|
||||||
|
|
||||||
if (desired->alphaBits > 0)
|
if (desired->alphaBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->alphaBits - current->alphaBits) *
|
extraDiff += (desired->alphaBits - current->alphaBits) *
|
||||||
(desired->alphaBits - current->alphaBits);
|
(desired->alphaBits - current->alphaBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->depthBits > 0)
|
if (desired->depthBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->depthBits - current->depthBits) *
|
extraDiff += (desired->depthBits - current->depthBits) *
|
||||||
(desired->depthBits - current->depthBits);
|
(desired->depthBits - current->depthBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->stencilBits > 0)
|
if (desired->stencilBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->stencilBits - current->stencilBits) *
|
extraDiff += (desired->stencilBits - current->stencilBits) *
|
||||||
(desired->stencilBits - current->stencilBits);
|
(desired->stencilBits - current->stencilBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->accumRedBits > 0)
|
if (desired->accumRedBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->accumRedBits - current->accumRedBits) *
|
extraDiff += (desired->accumRedBits - current->accumRedBits) *
|
||||||
(desired->accumRedBits - current->accumRedBits);
|
(desired->accumRedBits - current->accumRedBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->accumGreenBits > 0)
|
if (desired->accumGreenBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->accumGreenBits - current->accumGreenBits) *
|
extraDiff += (desired->accumGreenBits - current->accumGreenBits) *
|
||||||
(desired->accumGreenBits - current->accumGreenBits);
|
(desired->accumGreenBits - current->accumGreenBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->accumBlueBits > 0)
|
if (desired->accumBlueBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->accumBlueBits - current->accumBlueBits) *
|
extraDiff += (desired->accumBlueBits - current->accumBlueBits) *
|
||||||
(desired->accumBlueBits - current->accumBlueBits);
|
(desired->accumBlueBits - current->accumBlueBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->accumAlphaBits > 0)
|
if (desired->accumAlphaBits != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) *
|
extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) *
|
||||||
(desired->accumAlphaBits - current->accumAlphaBits);
|
(desired->accumAlphaBits - current->accumAlphaBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->samples > 0)
|
if (desired->samples != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
extraDiff += (desired->samples - current->samples) *
|
extraDiff += (desired->samples - current->samples) *
|
||||||
(desired->samples - current->samples);
|
(desired->samples - current->samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->sRGB)
|
if (desired->sRGB && !current->sRGB)
|
||||||
{
|
|
||||||
if (!current->sRGB)
|
|
||||||
extraDiff++;
|
extraDiff++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out if the current one is better than the best one found so far
|
// Figure out if the current one is better than the best one found so far
|
||||||
// Least number of missing buffers is the most important heuristic,
|
// Least number of missing buffers is the most important heuristic,
|
||||||
@@ -361,20 +348,20 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
return closest;
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean _glfwRefreshContextAttribs(void)
|
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
if (!parseGLVersion(&window->clientAPI,
|
if (!parseVersionString(&window->context.api,
|
||||||
&window->glMajor,
|
&window->context.major,
|
||||||
&window->glMinor,
|
&window->context.minor,
|
||||||
&window->glRevision))
|
&window->context.revision))
|
||||||
{
|
{
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
if (window->glMajor > 2)
|
if (window->context.major > 2)
|
||||||
{
|
{
|
||||||
// OpenGL 3.0+ uses a different function for extension string retrieval
|
// OpenGL 3.0+ uses a different function for extension string retrieval
|
||||||
// We cache it here instead of in glfwExtensionSupported mostly to alert
|
// We cache it here instead of in glfwExtensionSupported mostly to alert
|
||||||
@@ -389,39 +376,48 @@ GLboolean _glfwRefreshContextAttribs(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->clientAPI == GLFW_OPENGL_API)
|
if (window->context.api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
// Read back context flags (OpenGL 3.0 and above)
|
// Read back context flags (OpenGL 3.0 and above)
|
||||||
if (window->glMajor >= 3)
|
if (window->context.major >= 3)
|
||||||
{
|
{
|
||||||
GLint flags;
|
GLint flags;
|
||||||
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
||||||
|
|
||||||
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
|
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
|
||||||
window->glForward = GL_TRUE;
|
window->context.forward = GL_TRUE;
|
||||||
|
|
||||||
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
|
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
|
||||||
window->glDebug = GL_TRUE;
|
window->context.debug = GL_TRUE;
|
||||||
else if (glfwExtensionSupported("GL_ARB_debug_output"))
|
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
|
||||||
|
ctxconfig->debug)
|
||||||
{
|
{
|
||||||
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
||||||
// not setting the debug bit in the context flags for debug
|
// not setting the debug bit in the context flags for
|
||||||
// contexts
|
// debug contexts
|
||||||
window->glDebug = GL_TRUE;
|
window->context.debug = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read back OpenGL context profile (OpenGL 3.2 and above)
|
// Read back OpenGL context profile (OpenGL 3.2 and above)
|
||||||
if (window->glMajor > 3 ||
|
if (window->context.major > 3 ||
|
||||||
(window->glMajor == 3 && window->glMinor >= 2))
|
(window->context.major == 3 && window->context.minor >= 2))
|
||||||
{
|
{
|
||||||
GLint mask;
|
GLint mask;
|
||||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
||||||
|
|
||||||
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
||||||
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
|
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||||
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
||||||
window->glProfile = GLFW_OPENGL_CORE_PROFILE;
|
window->context.profile = GLFW_OPENGL_CORE_PROFILE;
|
||||||
|
else if (glfwExtensionSupported("GL_ARB_compatibility"))
|
||||||
|
{
|
||||||
|
// HACK: This is a workaround for the compatibility profile bit
|
||||||
|
// not being set in the context flags if an OpenGL 3.2+
|
||||||
|
// context was created without having requested a specific
|
||||||
|
// version
|
||||||
|
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read back robustness strategy
|
// Read back robustness strategy
|
||||||
@@ -434,9 +430,9 @@ GLboolean _glfwRefreshContextAttribs(void)
|
|||||||
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
||||||
|
|
||||||
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
||||||
window->glRobustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
||||||
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
||||||
window->glRobustness = GLFW_NO_RESET_NOTIFICATION;
|
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -451,23 +447,34 @@ GLboolean _glfwRefreshContextAttribs(void)
|
|||||||
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
||||||
|
|
||||||
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
||||||
window->glRobustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
||||||
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
||||||
window->glRobustness = GLFW_NO_RESET_NOTIFICATION;
|
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (glfwExtensionSupported("GL_KHR_context_flush_control"))
|
||||||
|
{
|
||||||
|
GLint behavior;
|
||||||
|
glGetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
|
||||||
|
|
||||||
|
if (behavior == GL_NONE)
|
||||||
|
window->context.release = GLFW_RELEASE_BEHAVIOR_NONE;
|
||||||
|
else if (behavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH;
|
||||||
|
}
|
||||||
#endif // _GLFW_USE_OPENGL
|
#endif // _GLFW_USE_OPENGL
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
|
GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
if (window->glMajor < wndconfig->glMajor ||
|
if (window->context.major < ctxconfig->major ||
|
||||||
(window->glMajor == wndconfig->glMajor &&
|
(window->context.major == ctxconfig->major &&
|
||||||
window->glMinor < wndconfig->glMinor))
|
window->context.minor < ctxconfig->minor))
|
||||||
{
|
{
|
||||||
// The desired OpenGL version is greater than the actual version
|
// The desired OpenGL version is greater than the actual version
|
||||||
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context
|
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context
|
||||||
@@ -557,7 +564,6 @@ GLFWAPI void glfwSwapInterval(int interval)
|
|||||||
|
|
||||||
GLFWAPI int glfwExtensionSupported(const char* extension)
|
GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||||
{
|
{
|
||||||
const GLubyte* extensions;
|
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GL_FALSE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GL_FALSE);
|
||||||
@@ -569,25 +575,14 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension == NULL || *extension == '\0')
|
if (*extension == '\0')
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->glMajor < 3)
|
|
||||||
{
|
|
||||||
// Check if extension is in the old style OpenGL extensions string
|
|
||||||
|
|
||||||
extensions = glGetString(GL_EXTENSIONS);
|
|
||||||
if (extensions != NULL)
|
|
||||||
{
|
|
||||||
if (_glfwStringInExtensionString(extension, extensions))
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
else
|
if (window->context.major >= 3)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GLint count;
|
GLint count;
|
||||||
@@ -598,14 +593,34 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (strcmp((const char*) window->GetStringi(GL_EXTENSIONS, i),
|
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
|
||||||
extension) == 0)
|
if (!en)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Failed to retrieve extension string %i", i);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(en, extension) == 0)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
#endif // _GLFW_USE_OPENGL
|
#endif // _GLFW_USE_OPENGL
|
||||||
|
{
|
||||||
|
// Check if extension is in the old style OpenGL extensions string
|
||||||
|
|
||||||
|
const GLubyte* extensions = glGetString(GL_EXTENSIONS);
|
||||||
|
if (!extensions)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Failed to retrieve extension string");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if extension is in the platform-specific string
|
// Check if extension is in the platform-specific string
|
||||||
return _glfwPlatformExtensionSupported(extension);
|
return _glfwPlatformExtensionSupported(extension);
|
||||||
|
|||||||
+58
-82
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 EGL - www.glfw.org
|
||||||
// Platform: EGL
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -35,22 +32,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
// Thread local storage attribute macro
|
|
||||||
//
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define _GLFW_TLS __declspec(thread)
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#define _GLFW_TLS __thread
|
|
||||||
#else
|
|
||||||
#define _GLFW_TLS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// The per-thread current context/window pointer
|
|
||||||
//
|
|
||||||
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
// Return a description of the specified EGL error
|
// Return a description of the specified EGL error
|
||||||
//
|
//
|
||||||
static const char* getErrorString(EGLint error)
|
static const char* getErrorString(EGLint error)
|
||||||
@@ -66,33 +47,25 @@ static const char* getErrorString(EGLint error)
|
|||||||
case EGL_BAD_ALLOC:
|
case EGL_BAD_ALLOC:
|
||||||
return "EGL failed to allocate resources for the requested operation";
|
return "EGL failed to allocate resources for the requested operation";
|
||||||
case EGL_BAD_ATTRIBUTE:
|
case EGL_BAD_ATTRIBUTE:
|
||||||
return "An unrecognized attribute or attribute value was passed "
|
return "An unrecognized attribute or attribute value was passed in the attribute list";
|
||||||
"in the attribute list";
|
|
||||||
case EGL_BAD_CONTEXT:
|
case EGL_BAD_CONTEXT:
|
||||||
return "An EGLContext argument does not name a valid EGL "
|
return "An EGLContext argument does not name a valid EGL rendering context";
|
||||||
"rendering context";
|
|
||||||
case EGL_BAD_CONFIG:
|
case EGL_BAD_CONFIG:
|
||||||
return "An EGLConfig argument does not name a valid EGL frame "
|
return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
|
||||||
"buffer configuration";
|
|
||||||
case EGL_BAD_CURRENT_SURFACE:
|
case EGL_BAD_CURRENT_SURFACE:
|
||||||
return "The current surface of the calling thread is a window, pixel "
|
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
|
||||||
"buffer or pixmap that is no longer valid";
|
|
||||||
case EGL_BAD_DISPLAY:
|
case EGL_BAD_DISPLAY:
|
||||||
return "An EGLDisplay argument does not name a valid EGL display "
|
return "An EGLDisplay argument does not name a valid EGL display connection";
|
||||||
"connection";
|
|
||||||
case EGL_BAD_SURFACE:
|
case EGL_BAD_SURFACE:
|
||||||
return "An EGLSurface argument does not name a valid surface "
|
return "An EGLSurface argument does not name a valid surface configured for GL rendering";
|
||||||
"configured for GL rendering";
|
|
||||||
case EGL_BAD_MATCH:
|
case EGL_BAD_MATCH:
|
||||||
return "Arguments are inconsistent";
|
return "Arguments are inconsistent";
|
||||||
case EGL_BAD_PARAMETER:
|
case EGL_BAD_PARAMETER:
|
||||||
return "One or more argument values are invalid";
|
return "One or more argument values are invalid";
|
||||||
case EGL_BAD_NATIVE_PIXMAP:
|
case EGL_BAD_NATIVE_PIXMAP:
|
||||||
return "A NativePixmapType argument does not refer to a valid "
|
return "A NativePixmapType argument does not refer to a valid native pixmap";
|
||||||
"native pixmap";
|
|
||||||
case EGL_BAD_NATIVE_WINDOW:
|
case EGL_BAD_NATIVE_WINDOW:
|
||||||
return "A NativeWindowType argument does not refer to a valid "
|
return "A NativeWindowType argument does not refer to a valid native window";
|
||||||
"native window";
|
|
||||||
case EGL_CONTEXT_LOST:
|
case EGL_CONTEXT_LOST:
|
||||||
return "The application must destroy all contexts and reinitialise";
|
return "The application must destroy all contexts and reinitialise";
|
||||||
}
|
}
|
||||||
@@ -111,7 +84,7 @@ static int getConfigAttrib(EGLConfig config, int attrib)
|
|||||||
|
|
||||||
// Return a list of available and usable framebuffer configs
|
// Return a list of available and usable framebuffer configs
|
||||||
//
|
//
|
||||||
static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* desired,
|
const _GLFWfbconfig* desired,
|
||||||
EGLConfig* result)
|
EGLConfig* result)
|
||||||
{
|
{
|
||||||
@@ -127,10 +100,10 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeConfigs = (EGLConfig*) calloc(nativeCount, sizeof(EGLConfig));
|
nativeConfigs = calloc(nativeCount, sizeof(EGLConfig));
|
||||||
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
|
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
|
||||||
|
|
||||||
usableConfigs = (_GLFWfbconfig*) calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
usableCount = 0;
|
usableCount = 0;
|
||||||
|
|
||||||
for (i = 0; i < nativeCount; i++)
|
for (i = 0; i < nativeCount; i++)
|
||||||
@@ -158,9 +131,9 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glMajor == 1)
|
if (ctxconfig->major == 1)
|
||||||
{
|
{
|
||||||
if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT))
|
if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT))
|
||||||
continue;
|
continue;
|
||||||
@@ -171,7 +144,7 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
else if (ctxconfig->api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT))
|
if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT))
|
||||||
continue;
|
continue;
|
||||||
@@ -186,6 +159,7 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
|||||||
u->stencilBits = getConfigAttrib(n, EGL_STENCIL_SIZE);
|
u->stencilBits = getConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||||
|
|
||||||
u->samples = getConfigAttrib(n, EGL_SAMPLES);
|
u->samples = getConfigAttrib(n, EGL_SAMPLES);
|
||||||
|
u->doublebuffer = GL_TRUE;
|
||||||
|
|
||||||
u->egl = n;
|
u->egl = n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
@@ -210,7 +184,10 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
|||||||
//
|
//
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
_glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
|
if (!_glfwInitTLS())
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
_glfw.egl.display = eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY);
|
||||||
if (_glfw.egl.display == EGL_NO_DISPLAY)
|
if (_glfw.egl.display == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
@@ -240,30 +217,31 @@ int _glfwInitContextAPI(void)
|
|||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
eglTerminate(_glfw.egl.display);
|
eglTerminate(_glfw.egl.display);
|
||||||
|
|
||||||
|
_glfwTerminateTLS();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define setEGLattrib(attribName, attribValue) \
|
#define setEGLattrib(attribName, attribValue) \
|
||||||
{ \
|
{ \
|
||||||
attribs[index++] = attribName; \
|
attribs[index++] = attribName; \
|
||||||
attribs[index++] = attribValue; \
|
attribs[index++] = attribValue; \
|
||||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare for creation of the OpenGL context
|
// Create the OpenGL or OpenGL ES context
|
||||||
//
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
int attribs[40];
|
int attribs[40];
|
||||||
EGLint count = 0;
|
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLContext share = NULL;
|
EGLContext share = NULL;
|
||||||
|
|
||||||
if (wndconfig->share)
|
if (ctxconfig->share)
|
||||||
share = wndconfig->share->egl.context;
|
share = ctxconfig->share->egl.context;
|
||||||
|
|
||||||
if (!chooseFBConfigs(wndconfig, fbconfig, &config))
|
if (!chooseFBConfigs(ctxconfig, fbconfig, &config))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to find a suitable EGLConfig");
|
"EGL: Failed to find a suitable EGLConfig");
|
||||||
@@ -273,6 +251,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
#if defined(_GLFW_X11)
|
#if defined(_GLFW_X11)
|
||||||
// Retrieve the visual corresponding to the chosen EGL config
|
// Retrieve the visual corresponding to the chosen EGL config
|
||||||
{
|
{
|
||||||
|
EGLint count = 0;
|
||||||
int mask;
|
int mask;
|
||||||
EGLint redBits, greenBits, blueBits, alphaBits, visualID = 0;
|
EGLint redBits, greenBits, blueBits, alphaBits, visualID = 0;
|
||||||
XVisualInfo info;
|
XVisualInfo info;
|
||||||
@@ -309,8 +288,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
window->egl.visual = XGetVisualInfo(_glfw.x11.display,
|
window->egl.visual = XGetVisualInfo(_glfw.x11.display,
|
||||||
mask, &info, &count);
|
mask, &info, &count);
|
||||||
|
if (!window->egl.visual)
|
||||||
if (window->egl.visual == NULL)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to retrieve visual for EGLConfig");
|
"EGL: Failed to retrieve visual for EGLConfig");
|
||||||
@@ -319,11 +297,11 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
#endif // _GLFW_X11
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"EGL: Failed to bind OpenGL ES: %s",
|
"EGL: Failed to bind OpenGL ES: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@@ -333,7 +311,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!eglBindAPI(EGL_OPENGL_API))
|
if (!eglBindAPI(EGL_OPENGL_API))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"EGL: Failed to bind OpenGL: %s",
|
"EGL: Failed to bind OpenGL: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@@ -344,34 +322,34 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
int index = 0, mask = 0, flags = 0, strategy = 0;
|
int index = 0, mask = 0, flags = 0, strategy = 0;
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
if (ctxconfig->api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE)
|
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
|
||||||
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||||
else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE)
|
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
|
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
|
||||||
|
|
||||||
if (wndconfig->glForward)
|
if (ctxconfig->forward)
|
||||||
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||||
|
|
||||||
if (wndconfig->glDebug)
|
|
||||||
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS)
|
if (ctxconfig->debug)
|
||||||
|
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||||
|
|
||||||
|
if (ctxconfig->robustness)
|
||||||
{
|
{
|
||||||
if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION)
|
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
|
||||||
strategy = EGL_NO_RESET_NOTIFICATION_KHR;
|
strategy = EGL_NO_RESET_NOTIFICATION_KHR;
|
||||||
else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR;
|
strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR;
|
||||||
|
|
||||||
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
|
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
{
|
{
|
||||||
setEGLattrib(EGL_CONTEXT_MAJOR_VERSION_KHR, wndconfig->glMajor);
|
setEGLattrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
|
||||||
setEGLattrib(EGL_CONTEXT_MINOR_VERSION_KHR, wndconfig->glMinor);
|
setEGLattrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
@@ -389,18 +367,21 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, wndconfig->glMajor);
|
setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major);
|
||||||
|
|
||||||
setEGLattrib(EGL_NONE, EGL_NONE);
|
setEGLattrib(EGL_NONE, EGL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Context release behaviors (GL_KHR_context_flush_control) are not yet
|
||||||
|
// supported on EGL but are not a hard constraint, so ignore and continue
|
||||||
|
|
||||||
window->egl.context = eglCreateContext(_glfw.egl.display,
|
window->egl.context = eglCreateContext(_glfw.egl.display,
|
||||||
config, share, attribs);
|
config, share, attribs);
|
||||||
|
|
||||||
if (window->egl.context == EGL_NO_CONTEXT)
|
if (window->egl.context == EGL_NO_CONTEXT)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"EGL: Failed to create context: %s",
|
"EGL: Failed to create context: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@@ -441,7 +422,7 @@ void _glfwDestroyContext(_GLFWwindow* window)
|
|||||||
// Analyzes the specified context for possible recreation
|
// Analyzes the specified context for possible recreation
|
||||||
//
|
//
|
||||||
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
#if defined(_GLFW_WIN32)
|
#if defined(_GLFW_WIN32)
|
||||||
@@ -464,7 +445,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
window->egl.surface = eglCreateWindowSurface(_glfw.egl.display,
|
window->egl.surface = eglCreateWindowSurface(_glfw.egl.display,
|
||||||
window->egl.config,
|
window->egl.config,
|
||||||
_GLFW_EGL_NATIVE_WINDOW,
|
(EGLNativeWindowType)_GLFW_EGL_NATIVE_WINDOW,
|
||||||
NULL);
|
NULL);
|
||||||
if (window->egl.surface == EGL_NO_SURFACE)
|
if (window->egl.surface == EGL_NO_SURFACE)
|
||||||
{
|
{
|
||||||
@@ -485,12 +466,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|||||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwCurrentWindow = window;
|
_glfwSetCurrentContext(window);
|
||||||
}
|
|
||||||
|
|
||||||
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
|
||||||
{
|
|
||||||
return _glfwCurrentWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
||||||
@@ -529,21 +505,21 @@ GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
|
|||||||
|
|
||||||
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
|
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
|
||||||
{
|
{
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_DISPLAY);
|
||||||
return _glfw.egl.display;
|
return _glfw.egl.display;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
|
||||||
return window->egl.context;
|
return window->egl.context;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
|
||||||
return window->egl.surface;
|
return window->egl.surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 EGL - www.glfw.org
|
||||||
// Platform: EGL
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -28,8 +25,8 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#ifndef _egl_platform_h_
|
#ifndef _egl_context_h_
|
||||||
#define _egl_platform_h_
|
#define _egl_context_h_
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
|
||||||
@@ -45,16 +42,11 @@
|
|||||||
|
|
||||||
#define _GLFW_PLATFORM_FBCONFIG EGLConfig egl
|
#define _GLFW_PLATFORM_FBCONFIG EGLConfig egl
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextEGL egl
|
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextEGL egl
|
||||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryEGL egl
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryEGL egl
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// EGL-specific per-context data
|
||||||
// GLFW platform specific types
|
//
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific OpenGL context structure
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWcontextEGL
|
typedef struct _GLFWcontextEGL
|
||||||
{
|
{
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
@@ -64,12 +56,12 @@ typedef struct _GLFWcontextEGL
|
|||||||
#if defined(_GLFW_X11)
|
#if defined(_GLFW_X11)
|
||||||
XVisualInfo* visual;
|
XVisualInfo* visual;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} _GLFWcontextEGL;
|
} _GLFWcontextEGL;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// EGL-specific global data
|
||||||
// Platform-specific library global data for EGL
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWlibraryEGL
|
typedef struct _GLFWlibraryEGL
|
||||||
{
|
{
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
@@ -80,4 +72,14 @@ typedef struct _GLFWlibraryEGL
|
|||||||
} _GLFWlibraryEGL;
|
} _GLFWlibraryEGL;
|
||||||
|
|
||||||
|
|
||||||
#endif // _egl_platform_h_
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
|
||||||
|
#endif // _egl_context_h_
|
||||||
-131
@@ -1,131 +0,0 @@
|
|||||||
//========================================================================
|
|
||||||
// GLFW - An OpenGL library
|
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW internal API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void _glfwAllocGammaRamp(GLFWgammaramp* ramp, unsigned int size)
|
|
||||||
{
|
|
||||||
ramp->red = (unsigned short*) malloc(size * sizeof(unsigned short));
|
|
||||||
ramp->green = (unsigned short*) malloc(size * sizeof(unsigned short));
|
|
||||||
ramp->blue = (unsigned short*) malloc(size * sizeof(unsigned short));
|
|
||||||
ramp->size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwFreeGammaRamp(GLFWgammaramp* ramp)
|
|
||||||
{
|
|
||||||
free(ramp->red);
|
|
||||||
free(ramp->green);
|
|
||||||
free(ramp->blue);
|
|
||||||
|
|
||||||
memset(ramp, 0, sizeof(GLFWgammaramp));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW public API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned short values[256];
|
|
||||||
GLFWgammaramp ramp;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
|
||||||
|
|
||||||
if (gamma <= 0.f)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
|
||||||
"Gamma value must be greater than zero");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
float value;
|
|
||||||
|
|
||||||
// Calculate intensity
|
|
||||||
value = i / 255.f;
|
|
||||||
// Apply gamma curve
|
|
||||||
value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f;
|
|
||||||
|
|
||||||
// Clamp to value range
|
|
||||||
if (value < 0.f)
|
|
||||||
value = 0.f;
|
|
||||||
else if (value > 65535.f)
|
|
||||||
value = 65535.f;
|
|
||||||
|
|
||||||
values[i] = (unsigned short) value;
|
|
||||||
}
|
|
||||||
|
|
||||||
ramp.red = values;
|
|
||||||
ramp.green = values;
|
|
||||||
ramp.blue = values;
|
|
||||||
ramp.size = 256;
|
|
||||||
|
|
||||||
glfwSetGammaRamp(handle, &ramp);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
|
||||||
{
|
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
|
||||||
|
|
||||||
_glfwFreeGammaRamp(&monitor->currentRamp);
|
|
||||||
_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp);
|
|
||||||
|
|
||||||
return &monitor->currentRamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
|
||||||
{
|
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
|
||||||
|
|
||||||
if (!monitor->originalRamp.size)
|
|
||||||
_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp);
|
|
||||||
|
|
||||||
_glfwPlatformSetGammaRamp(monitor, ramp);
|
|
||||||
}
|
|
||||||
|
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
includedir=${prefix}/include
|
includedir=${prefix}/include
|
||||||
libdir=${exec_prefix}/lib
|
libdir=${exec_prefix}/lib@LIB_SUFFIX@
|
||||||
|
|
||||||
Name: GLFW
|
Name: GLFW
|
||||||
Description: A portable library for OpenGL, window and input
|
Description: A multi-platform library for OpenGL, window and input
|
||||||
Version: @GLFW_VERSION_FULL@
|
Version: @GLFW_VERSION_FULL@
|
||||||
URL: http://www.glfw.org/
|
URL: http://www.glfw.org/
|
||||||
Requires.private: @GLFW_PKG_DEPS@
|
Requires.private: @GLFW_PKG_DEPS@
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# - Config file for the glfw3 package
|
||||||
|
# It defines the following variables
|
||||||
|
# GLFW3_INCLUDE_DIR, the path where GLFW headers are located
|
||||||
|
# GLFW3_LIBRARY_DIR, folder in which the GLFW library is located
|
||||||
|
# GLFW3_LIBRARY, library to link against to use GLFW
|
||||||
|
|
||||||
|
set(GLFW3_VERSION "@GLFW_VERSION_FULL@")
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
set_and_check(GLFW3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/include")
|
||||||
|
set_and_check(GLFW3_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@")
|
||||||
|
|
||||||
|
find_library(GLFW3_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW3_LIBRARY_DIR})
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# - Config file for the glfw package
|
|
||||||
# It defines the following variables
|
|
||||||
# GLFW_INCLUDE_DIR, the path where GLFW headers are located
|
|
||||||
# GLFW_LIBRARY_DIR, folder in which the GLFW library is located
|
|
||||||
# GLFW_LIBRARY, library to link against to use GLFW
|
|
||||||
|
|
||||||
set(GLFW_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
|
|
||||||
set(GLFW_LIBRARY_DIR "@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@")
|
|
||||||
|
|
||||||
find_library(GLFW_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW_LIBRARY_DIR})
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
set(PACKAGE_VERSION "@GLFW_VERSION_FULL@")
|
|
||||||
|
|
||||||
if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@GLFW_VERSION_MAJOR@")
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
||||||
if ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @GLFW_VERSION_MINOR@)
|
|
||||||
set(PACKAGE_VERSION_EXACT TRUE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@@ -26,13 +23,15 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// As config.h.in, this file is used by CMake to produce the config.h shared
|
// As glfw_config.h.in, this file is used by CMake to produce the
|
||||||
// configuration header file. If you are adding a feature requiring
|
// glfw_config.h configuration header file. If you are adding a feature
|
||||||
// conditional compilation, this is the proper place to add the macros.
|
// requiring conditional compilation, this is where to add the macro.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// As config.h, this file defines compile-time build options and macros for
|
// As glfw_config.h, this file defines compile-time option macros for a
|
||||||
// all platforms supported by GLFW. As this is a generated file, don't modify
|
// specific platform and development environment. If you are using the
|
||||||
// it. Instead, you should modify the config.h.in file.
|
// GLFW CMake files, modify glfw_config.h.in instead of this file. If you
|
||||||
|
// are using your own build system, make this file define the appropriate
|
||||||
|
// macros in whatever way is suitable.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
// Define this to 1 if building GLFW for X11
|
// Define this to 1 if building GLFW for X11
|
||||||
@@ -41,6 +40,10 @@
|
|||||||
#cmakedefine _GLFW_WIN32
|
#cmakedefine _GLFW_WIN32
|
||||||
// Define this to 1 if building GLFW for Cocoa
|
// Define this to 1 if building GLFW for Cocoa
|
||||||
#cmakedefine _GLFW_COCOA
|
#cmakedefine _GLFW_COCOA
|
||||||
|
// Define this to 1 if building GLFW for Wayland
|
||||||
|
#cmakedefine _GLFW_WAYLAND
|
||||||
|
// Define this to 1 if building GLFW for Mir
|
||||||
|
#cmakedefine _GLFW_MIR
|
||||||
|
|
||||||
// Define this to 1 if building GLFW for EGL
|
// Define this to 1 if building GLFW for EGL
|
||||||
#cmakedefine _GLFW_EGL
|
#cmakedefine _GLFW_EGL
|
||||||
@@ -54,9 +57,15 @@
|
|||||||
// Define this to 1 if building as a shared library / dynamic library / DLL
|
// Define this to 1 if building as a shared library / dynamic library / DLL
|
||||||
#cmakedefine _GLFW_BUILD_DLL
|
#cmakedefine _GLFW_BUILD_DLL
|
||||||
|
|
||||||
// Define this to 1 to disable dynamic loading of winmm
|
// Define this to 1 if glfwSwapInterval should ignore DWM compositing status
|
||||||
#cmakedefine _GLFW_NO_DLOAD_WINMM
|
#cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL
|
||||||
|
// Define this to 1 to force use of high-performance GPU on Optimus systems
|
||||||
|
#cmakedefine _GLFW_USE_OPTIMUS_HPG
|
||||||
|
|
||||||
|
// Define this to 1 if the XInput X11 extension is available
|
||||||
|
#cmakedefine _GLFW_HAS_XINPUT
|
||||||
|
// Define this to 1 if the Xxf86vm X11 extension is available
|
||||||
|
#cmakedefine _GLFW_HAS_XF86VM
|
||||||
// Define this to 1 if glXGetProcAddress is available
|
// Define this to 1 if glXGetProcAddress is available
|
||||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
|
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
|
||||||
// Define this to 1 if glXGetProcAddressARB is available
|
// Define this to 1 if glXGetProcAddressARB is available
|
||||||
@@ -70,6 +79,8 @@
|
|||||||
#cmakedefine _GLFW_USE_CHDIR
|
#cmakedefine _GLFW_USE_CHDIR
|
||||||
// Define this to 1 if glfwCreateWindow should populate the menu bar
|
// Define this to 1 if glfwCreateWindow should populate the menu bar
|
||||||
#cmakedefine _GLFW_USE_MENUBAR
|
#cmakedefine _GLFW_USE_MENUBAR
|
||||||
|
// Define this to 1 if windows should use full resolution on Retina displays
|
||||||
|
#cmakedefine _GLFW_USE_RETINA
|
||||||
|
|
||||||
// Define this to 1 if using OpenGL as the client library
|
// Define this to 1 if using OpenGL as the client library
|
||||||
#cmakedefine _GLFW_USE_OPENGL
|
#cmakedefine _GLFW_USE_OPENGL
|
||||||
@@ -78,6 +89,3 @@
|
|||||||
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
||||||
#cmakedefine _GLFW_USE_GLESV2
|
#cmakedefine _GLFW_USE_GLESV2
|
||||||
|
|
||||||
// The GLFW version as used by glfwGetVersionString
|
|
||||||
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"
|
|
||||||
|
|
||||||
+87
-166
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 GLX - www.glfw.org
|
||||||
// Platform: X11/GLX
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -33,7 +30,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
|
|
||||||
// This is the only glXGetProcAddress variant not declared by glxext.h
|
// This is the only glXGetProcAddress variant not declared by glxext.h
|
||||||
@@ -45,29 +41,12 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Error handler used when creating a context
|
|
||||||
//
|
|
||||||
static int errorHandler(Display *display, XErrorEvent* event)
|
|
||||||
{
|
|
||||||
_glfw.glx.errorCode = event->error_code;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the specified attribute of the specified GLXFBConfig
|
// Returns the specified attribute of the specified GLXFBConfig
|
||||||
// NOTE: Do not call this unless we have found GLX 1.3+ or GLX_SGIX_fbconfig
|
|
||||||
//
|
//
|
||||||
static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
|
static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (_glfw.glx.SGIX_fbconfig)
|
|
||||||
{
|
|
||||||
_glfw.glx.GetFBConfigAttribSGIX(_glfw.x11.display,
|
|
||||||
fbconfig, attrib, &value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
|
glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,28 +69,15 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
|||||||
trustWindowBit = GL_FALSE;
|
trustWindowBit = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.glx.SGIX_fbconfig)
|
nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen,
|
||||||
{
|
|
||||||
nativeConfigs = _glfw.glx.ChooseFBConfigSGIX(_glfw.x11.display,
|
|
||||||
_glfw.x11.screen,
|
|
||||||
NULL,
|
|
||||||
&nativeCount);
|
&nativeCount);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nativeConfigs = glXGetFBConfigs(_glfw.x11.display,
|
|
||||||
_glfw.x11.screen,
|
|
||||||
&nativeCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!nativeCount)
|
if (!nativeCount)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
|
||||||
"GLX: No GLXFBConfigs returned");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
usableConfigs = (_GLFWfbconfig*) calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
usableCount = 0;
|
usableCount = 0;
|
||||||
|
|
||||||
for (i = 0; i < nativeCount; i++)
|
for (i = 0; i < nativeCount; i++)
|
||||||
@@ -119,10 +85,9 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
|||||||
const GLXFBConfig n = nativeConfigs[i];
|
const GLXFBConfig n = nativeConfigs[i];
|
||||||
_GLFWfbconfig* u = usableConfigs + usableCount;
|
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||||
|
|
||||||
if (!getFBConfigAttrib(n, GLX_DOUBLEBUFFER) ||
|
if (!getFBConfigAttrib(n, GLX_VISUAL_ID))
|
||||||
!getFBConfigAttrib(n, GLX_VISUAL_ID))
|
|
||||||
{
|
{
|
||||||
// Only consider double-buffered GLXFBConfigs with associated visuals
|
// Only consider GLXFBConfigs with associated visuals
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +120,11 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
|||||||
u->accumAlphaBits = getFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
|
u->accumAlphaBits = getFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
|
||||||
|
|
||||||
u->auxBuffers = getFBConfigAttrib(n, GLX_AUX_BUFFERS);
|
u->auxBuffers = getFBConfigAttrib(n, GLX_AUX_BUFFERS);
|
||||||
u->stereo = getFBConfigAttrib(n, GLX_STEREO);
|
|
||||||
|
if (getFBConfigAttrib(n, GLX_STEREO))
|
||||||
|
u->stereo = GL_TRUE;
|
||||||
|
if (getFBConfigAttrib(n, GLX_DOUBLEBUFFER))
|
||||||
|
u->doublebuffer = GL_TRUE;
|
||||||
|
|
||||||
if (_glfw.glx.ARB_multisample)
|
if (_glfw.glx.ARB_multisample)
|
||||||
u->samples = getFBConfigAttrib(n, GLX_SAMPLES);
|
u->samples = getFBConfigAttrib(n, GLX_SAMPLES);
|
||||||
@@ -183,22 +152,11 @@ static GLXContext createLegacyContext(_GLFWwindow* window,
|
|||||||
GLXFBConfig fbconfig,
|
GLXFBConfig fbconfig,
|
||||||
GLXContext share)
|
GLXContext share)
|
||||||
{
|
{
|
||||||
if (_glfw.glx.SGIX_fbconfig)
|
|
||||||
{
|
|
||||||
return _glfw.glx.CreateContextWithConfigSGIX(_glfw.x11.display,
|
|
||||||
fbconfig,
|
|
||||||
GLX_RGBA_TYPE,
|
|
||||||
share,
|
|
||||||
True);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return glXCreateNewContext(_glfw.x11.display,
|
return glXCreateNewContext(_glfw.x11.display,
|
||||||
fbconfig,
|
fbconfig,
|
||||||
GLX_RGBA_TYPE,
|
GLX_RGBA_TYPE,
|
||||||
share,
|
share,
|
||||||
True);
|
True);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -210,44 +168,23 @@ static GLXContext createLegacyContext(_GLFWwindow* window,
|
|||||||
//
|
//
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
|
if (!_glfwInitTLS())
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
#ifdef _GLFW_DLOPEN_LIBGL
|
#ifdef _GLFW_DLOPEN_LIBGL
|
||||||
int i;
|
_glfw.glx.libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
||||||
char* libGL_names[ ] =
|
|
||||||
{
|
|
||||||
"libGL.so",
|
|
||||||
"libGL.so.1",
|
|
||||||
"/usr/lib/libGL.so",
|
|
||||||
"/usr/lib/libGL.so.1",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
for (i = 0; libGL_names[i] != NULL; i++)
|
|
||||||
{
|
|
||||||
_glfw.glx.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
|
|
||||||
if (_glfw.glx.libGL)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_glfw.glx.libGL)
|
if (!_glfw.glx.libGL)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to find libGL");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pthread_key_create(&_glfw.glx.current, NULL) != 0)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"GLX: Failed to create context TLS");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if GLX is supported on this display
|
|
||||||
if (!glXQueryExtension(_glfw.x11.display,
|
if (!glXQueryExtension(_glfw.x11.display,
|
||||||
&_glfw.glx.errorBase,
|
&_glfw.glx.errorBase,
|
||||||
&_glfw.glx.eventBase))
|
&_glfw.glx.eventBase))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +197,13 @@ int _glfwInitContextAPI(void)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.glx.versionMajor == 1 && _glfw.glx.versionMinor < 3)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"GLX: GLX version 1.3 is required");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_EXT_swap_control"))
|
if (_glfwPlatformExtensionSupported("GLX_EXT_swap_control"))
|
||||||
{
|
{
|
||||||
_glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
|
_glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
|
||||||
@@ -287,26 +231,6 @@ int _glfwInitContextAPI(void)
|
|||||||
_glfw.glx.MESA_swap_control = GL_TRUE;
|
_glfw.glx.MESA_swap_control = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
|
|
||||||
{
|
|
||||||
_glfw.glx.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)
|
|
||||||
_glfwPlatformGetProcAddress("glXGetFBConfigAttribSGIX");
|
|
||||||
_glfw.glx.ChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)
|
|
||||||
_glfwPlatformGetProcAddress("glXChooseFBConfigSGIX");
|
|
||||||
_glfw.glx.CreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)
|
|
||||||
_glfwPlatformGetProcAddress("glXCreateContextWithConfigSGIX");
|
|
||||||
_glfw.glx.GetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)
|
|
||||||
_glfwPlatformGetProcAddress("glXGetVisualFromFBConfigSGIX");
|
|
||||||
|
|
||||||
if (_glfw.glx.GetFBConfigAttribSGIX &&
|
|
||||||
_glfw.glx.ChooseFBConfigSGIX &&
|
|
||||||
_glfw.glx.CreateContextWithConfigSGIX &&
|
|
||||||
_glfw.glx.GetVisualFromFBConfigSGIX)
|
|
||||||
{
|
|
||||||
_glfw.glx.SGIX_fbconfig = GL_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
||||||
_glfw.glx.ARB_multisample = GL_TRUE;
|
_glfw.glx.ARB_multisample = GL_TRUE;
|
||||||
|
|
||||||
@@ -331,6 +255,9 @@ int _glfwInitContextAPI(void)
|
|||||||
if (_glfwPlatformExtensionSupported("GLX_EXT_create_context_es2_profile"))
|
if (_glfwPlatformExtensionSupported("GLX_EXT_create_context_es2_profile"))
|
||||||
_glfw.glx.EXT_create_context_es2_profile = GL_TRUE;
|
_glfw.glx.EXT_create_context_es2_profile = GL_TRUE;
|
||||||
|
|
||||||
|
if (_glfwPlatformExtensionSupported("GLX_ARB_context_flush_control"))
|
||||||
|
_glfw.glx.ARB_context_flush_control = GL_TRUE;
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,28 +274,28 @@ void _glfwTerminateContextAPI(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pthread_key_delete(_glfw.glx.current);
|
_glfwTerminateTLS();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define setGLXattrib(attribName, attribValue) \
|
#define setGLXattrib(attribName, attribValue) \
|
||||||
{ \
|
{ \
|
||||||
attribs[index++] = attribName; \
|
attribs[index++] = attribName; \
|
||||||
attribs[index++] = attribValue; \
|
attribs[index++] = attribValue; \
|
||||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare for creation of the OpenGL context
|
// Create the OpenGL or OpenGL ES context
|
||||||
//
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
int attribs[40];
|
int attribs[40];
|
||||||
GLXFBConfig native;
|
GLXFBConfig native;
|
||||||
GLXContext share = NULL;
|
GLXContext share = NULL;
|
||||||
|
|
||||||
if (wndconfig->share)
|
if (ctxconfig->share)
|
||||||
share = wndconfig->share->glx.context;
|
share = ctxconfig->share->glx.context;
|
||||||
|
|
||||||
if (!chooseFBConfig(fbconfig, &native))
|
if (!chooseFBConfig(fbconfig, &native))
|
||||||
{
|
{
|
||||||
@@ -378,104 +305,110 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the corresponding visual
|
// Retrieve the corresponding visual
|
||||||
if (_glfw.glx.SGIX_fbconfig)
|
|
||||||
{
|
|
||||||
window->glx.visual =
|
|
||||||
_glfw.glx.GetVisualFromFBConfigSGIX(_glfw.x11.display, native);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native);
|
window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native);
|
||||||
|
if (!window->glx.visual)
|
||||||
if (window->glx.visual == NULL)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"GLX: Failed to retrieve visual for GLXFBConfig");
|
"GLX: Failed to retrieve visual for GLXFBConfig");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
if (!_glfw.glx.ARB_create_context ||
|
if (!_glfw.glx.ARB_create_context ||
|
||||||
!_glfw.glx.ARB_create_context_profile ||
|
!_glfw.glx.ARB_create_context_profile ||
|
||||||
!_glfw.glx.EXT_create_context_es2_profile)
|
!_glfw.glx.EXT_create_context_es2_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"GLX: OpenGL ES requested but "
|
"GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable");
|
||||||
"GLX_EXT_create_context_es2_profile is unavailable");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glForward)
|
if (ctxconfig->forward)
|
||||||
{
|
{
|
||||||
if (!_glfw.glx.ARB_create_context)
|
if (!_glfw.glx.ARB_create_context)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"GLX: Forward compatibility requested but "
|
"GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable");
|
||||||
"GLX_ARB_create_context_profile is unavailable");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glProfile)
|
if (ctxconfig->profile)
|
||||||
{
|
{
|
||||||
if (!_glfw.glx.ARB_create_context ||
|
if (!_glfw.glx.ARB_create_context ||
|
||||||
!_glfw.glx.ARB_create_context_profile)
|
!_glfw.glx.ARB_create_context_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"GLX: An OpenGL profile requested but "
|
"GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable");
|
||||||
"GLX_ARB_create_context_profile is unavailable");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfw.glx.errorCode = Success;
|
_glfwGrabXErrorHandler();
|
||||||
XSetErrorHandler(errorHandler);
|
|
||||||
|
|
||||||
if (_glfw.glx.ARB_create_context)
|
if (_glfw.glx.ARB_create_context)
|
||||||
{
|
{
|
||||||
int index = 0, mask = 0, flags = 0, strategy = 0;
|
int index = 0, mask = 0, flags = 0, strategy = 0;
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
if (ctxconfig->api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glForward)
|
if (ctxconfig->forward)
|
||||||
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||||
|
|
||||||
if (wndconfig->glDebug)
|
if (ctxconfig->profile)
|
||||||
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
|
||||||
|
|
||||||
if (wndconfig->glProfile)
|
|
||||||
{
|
{
|
||||||
if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE)
|
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
|
||||||
mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE)
|
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||||
|
|
||||||
if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS)
|
if (ctxconfig->debug)
|
||||||
|
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||||
|
|
||||||
|
if (ctxconfig->robustness)
|
||||||
{
|
{
|
||||||
if (_glfw.glx.ARB_create_context_robustness)
|
if (_glfw.glx.ARB_create_context_robustness)
|
||||||
{
|
{
|
||||||
if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION)
|
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
|
||||||
strategy = GLX_NO_RESET_NOTIFICATION_ARB;
|
strategy = GLX_NO_RESET_NOTIFICATION_ARB;
|
||||||
else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB;
|
strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB;
|
||||||
|
|
||||||
flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
|
flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
if (ctxconfig->release)
|
||||||
|
{
|
||||||
|
if (_glfw.glx.ARB_context_flush_control)
|
||||||
|
{
|
||||||
|
if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
|
||||||
|
{
|
||||||
|
setGLXattrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
|
||||||
|
GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
|
||||||
|
}
|
||||||
|
else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
{
|
||||||
|
setGLXattrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
|
||||||
|
GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
{
|
{
|
||||||
// NOTE: Only request an explicitly versioned context when
|
// NOTE: Only request an explicitly versioned context when
|
||||||
// necessary, as explicitly requesting version 1.0 does not always
|
// necessary, as explicitly requesting version 1.0 does not
|
||||||
// return the highest available version
|
// always return the highest available version
|
||||||
|
|
||||||
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
|
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
|
||||||
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
|
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
@@ -496,15 +429,16 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
True,
|
True,
|
||||||
attribs);
|
attribs);
|
||||||
|
|
||||||
if (window->glx.context == NULL)
|
if (!window->glx.context)
|
||||||
{
|
{
|
||||||
// HACK: This is a fallback for the broken Mesa implementation of
|
// HACK: This is a fallback for the broken Mesa implementation of
|
||||||
// GLX_ARB_create_context_profile, which fails default 1.0 context
|
// GLX_ARB_create_context_profile, which fails default 1.0
|
||||||
// creation with a GLXBadProfileARB error in violation of the spec
|
// context creation with a GLXBadProfileARB error in violation
|
||||||
if (_glfw.glx.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
// of the extension spec
|
||||||
wndconfig->clientAPI == GLFW_OPENGL_API &&
|
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
||||||
wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE &&
|
ctxconfig->api == GLFW_OPENGL_API &&
|
||||||
wndconfig->glForward == GL_FALSE)
|
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
|
||||||
|
ctxconfig->forward == GL_FALSE)
|
||||||
{
|
{
|
||||||
window->glx.context = createLegacyContext(window, native, share);
|
window->glx.context = createLegacyContext(window, native, share);
|
||||||
}
|
}
|
||||||
@@ -513,19 +447,11 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
else
|
else
|
||||||
window->glx.context = createLegacyContext(window, native, share);
|
window->glx.context = createLegacyContext(window, native, share);
|
||||||
|
|
||||||
XSetErrorHandler(NULL);
|
_glfwReleaseXErrorHandler();
|
||||||
|
|
||||||
if (window->glx.context == NULL)
|
if (!window->glx.context)
|
||||||
{
|
{
|
||||||
char buffer[8192];
|
_glfwInputXError(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context");
|
||||||
XGetErrorText(_glfw.x11.display,
|
|
||||||
_glfw.glx.errorCode,
|
|
||||||
buffer, sizeof(buffer));
|
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"GLX: Failed to create context: %s",
|
|
||||||
buffer);
|
|
||||||
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,12 +493,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|||||||
else
|
else
|
||||||
glXMakeCurrent(_glfw.x11.display, None, NULL);
|
glXMakeCurrent(_glfw.x11.display, None, NULL);
|
||||||
|
|
||||||
pthread_setspecific(_glfw.glx.current, window);
|
_glfwSetCurrentContext(window);
|
||||||
}
|
|
||||||
|
|
||||||
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
|
||||||
{
|
|
||||||
return (_GLFWwindow*) pthread_getspecific(_glfw.glx.current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 GLX - www.glfw.org
|
||||||
// Platform: X11/GLX
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -28,8 +25,8 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#ifndef _glx_platform_h_
|
#ifndef _glx_context_h_
|
||||||
#define _glx_platform_h_
|
#define _glx_context_h_
|
||||||
|
|
||||||
#define GLX_GLXEXT_LEGACY
|
#define GLX_GLXEXT_LEGACY
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
@@ -62,54 +59,38 @@
|
|||||||
|
|
||||||
#define _GLFW_PLATFORM_FBCONFIG GLXFBConfig glx
|
#define _GLFW_PLATFORM_FBCONFIG GLXFBConfig glx
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX glx
|
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX glx
|
||||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryGLX glx
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx
|
||||||
|
|
||||||
#ifndef GLX_MESA_swap_control
|
#ifndef GLX_MESA_swap_control
|
||||||
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
|
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// GLX-specific per-context data
|
||||||
// GLFW platform specific types
|
//
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific OpenGL context structure
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWcontextGLX
|
typedef struct _GLFWcontextGLX
|
||||||
{
|
{
|
||||||
GLXContext context; // OpenGL rendering context
|
// Rendering context
|
||||||
XVisualInfo* visual; // Visual for selected GLXFBConfig
|
GLXContext context;
|
||||||
|
// Visual of selected GLXFBConfig
|
||||||
|
XVisualInfo* visual;
|
||||||
|
|
||||||
} _GLFWcontextGLX;
|
} _GLFWcontextGLX;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// GLX-specific global data
|
||||||
// Platform-specific library global data for GLX
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWlibraryGLX
|
typedef struct _GLFWlibraryGLX
|
||||||
{
|
{
|
||||||
// Server-side GLX version
|
|
||||||
int versionMajor, versionMinor;
|
int versionMajor, versionMinor;
|
||||||
int eventBase;
|
int eventBase;
|
||||||
int errorBase;
|
int errorBase;
|
||||||
|
|
||||||
// TLS key for per-thread current context/window
|
|
||||||
pthread_key_t current;
|
|
||||||
|
|
||||||
// GLX error code received by Xlib error callback
|
|
||||||
int errorCode;
|
|
||||||
|
|
||||||
// GLX extensions
|
// GLX extensions
|
||||||
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
|
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
|
||||||
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
|
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
|
||||||
PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
|
PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
|
||||||
PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX;
|
|
||||||
PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX;
|
|
||||||
PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
|
|
||||||
PFNGLXGETVISUALFROMFBCONFIGSGIXPROC GetVisualFromFBConfigSGIX;
|
|
||||||
PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
|
PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
|
||||||
GLboolean SGIX_fbconfig;
|
|
||||||
GLboolean SGI_swap_control;
|
GLboolean SGI_swap_control;
|
||||||
GLboolean EXT_swap_control;
|
GLboolean EXT_swap_control;
|
||||||
GLboolean MESA_swap_control;
|
GLboolean MESA_swap_control;
|
||||||
@@ -119,11 +100,21 @@ typedef struct _GLFWlibraryGLX
|
|||||||
GLboolean ARB_create_context_profile;
|
GLboolean ARB_create_context_profile;
|
||||||
GLboolean ARB_create_context_robustness;
|
GLboolean ARB_create_context_robustness;
|
||||||
GLboolean EXT_create_context_es2_profile;
|
GLboolean EXT_create_context_es2_profile;
|
||||||
|
GLboolean ARB_context_flush_control;
|
||||||
|
|
||||||
#if defined(_GLFW_DLOPEN_LIBGL)
|
#if defined(_GLFW_DLOPEN_LIBGL)
|
||||||
void* libGL; // dlopen handle for libGL.so
|
// dlopen handle for libGL.so (for glfwGetProcAddress)
|
||||||
|
void* libGL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} _GLFWlibraryGLX;
|
} _GLFWlibraryGLX;
|
||||||
|
|
||||||
|
|
||||||
#endif // _glx_platform_h_
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
|
||||||
|
#endif // _glx_context_h_
|
||||||
+15
-13
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -36,14 +33,15 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
|
||||||
|
// The three global variables below comprise all global data in GLFW, except for
|
||||||
|
// various static const translation tables. Any other global variable is a bug.
|
||||||
|
|
||||||
// Global state shared between compilation units of GLFW
|
// Global state shared between compilation units of GLFW
|
||||||
// These are documented in internal.h
|
// These are documented in internal.h
|
||||||
//
|
//
|
||||||
GLboolean _glfwInitialized = GL_FALSE;
|
GLboolean _glfwInitialized = GL_FALSE;
|
||||||
_GLFWlibrary _glfw;
|
_GLFWlibrary _glfw;
|
||||||
|
|
||||||
|
|
||||||
// The current error callback
|
|
||||||
// This is outside of _glfw so it can be initialized and usable before
|
// This is outside of _glfw so it can be initialized and usable before
|
||||||
// glfwInit is called, which lets that function report errors
|
// glfwInit is called, which lets that function report errors
|
||||||
//
|
//
|
||||||
@@ -131,9 +129,9 @@ GLFWAPI int glfwInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount);
|
_glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount);
|
||||||
if (_glfw.monitors == NULL)
|
if (!_glfw.monitorCount)
|
||||||
{
|
{
|
||||||
_glfwErrorCallback(GLFW_PLATFORM_ERROR, "No monitors found");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "No monitors found");
|
||||||
_glfwPlatformTerminate();
|
_glfwPlatformTerminate();
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -153,10 +151,14 @@ GLFWAPI void glfwTerminate(void)
|
|||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Close all remaining windows
|
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
|
||||||
|
|
||||||
while (_glfw.windowListHead)
|
while (_glfw.windowListHead)
|
||||||
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
|
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
|
||||||
|
|
||||||
|
while (_glfw.cursorListHead)
|
||||||
|
glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead);
|
||||||
|
|
||||||
for (i = 0; i < _glfw.monitorCount; i++)
|
for (i = 0; i < _glfw.monitorCount; i++)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = _glfw.monitors[i];
|
_GLFWmonitor* monitor = _glfw.monitors[i];
|
||||||
@@ -164,12 +166,13 @@ GLFWAPI void glfwTerminate(void)
|
|||||||
_glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
|
_glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwDestroyMonitors(_glfw.monitors, _glfw.monitorCount);
|
_glfwFreeMonitors(_glfw.monitors, _glfw.monitorCount);
|
||||||
_glfw.monitors = NULL;
|
_glfw.monitors = NULL;
|
||||||
_glfw.monitorCount = 0;
|
_glfw.monitorCount = 0;
|
||||||
|
|
||||||
_glfwPlatformTerminate();
|
_glfwPlatformTerminate();
|
||||||
|
|
||||||
|
memset(&_glfw, 0, sizeof(_glfw));
|
||||||
_glfwInitialized = GL_FALSE;
|
_glfwInitialized = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +195,7 @@ GLFWAPI const char* glfwGetVersionString(void)
|
|||||||
|
|
||||||
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
|
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
|
||||||
{
|
{
|
||||||
GLFWerrorfun previous = _glfwErrorCallback;
|
_GLFW_SWAP_POINTERS(_glfwErrorCallback, cbfun);
|
||||||
_glfwErrorCallback = cbfun;
|
return cbfun;
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+292
-100
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -30,6 +27,11 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Internal key state used for sticky keys
|
// Internal key state used for sticky keys
|
||||||
#define _GLFW_STICK 3
|
#define _GLFW_STICK 3
|
||||||
|
|
||||||
@@ -38,39 +40,46 @@
|
|||||||
//
|
//
|
||||||
static void setCursorMode(_GLFWwindow* window, int newMode)
|
static void setCursorMode(_GLFWwindow* window, int newMode)
|
||||||
{
|
{
|
||||||
int oldMode;
|
const int oldMode = window->cursorMode;
|
||||||
|
|
||||||
if (newMode != GLFW_CURSOR_NORMAL &&
|
if (newMode != GLFW_CURSOR_NORMAL &&
|
||||||
newMode != GLFW_CURSOR_HIDDEN &&
|
newMode != GLFW_CURSOR_HIDDEN &&
|
||||||
newMode != GLFW_CURSOR_DISABLED)
|
newMode != GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid cursor mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldMode = window->cursorMode;
|
|
||||||
if (oldMode == newMode)
|
if (oldMode == newMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (window == _glfw.focusedWindow)
|
window->cursorMode = newMode;
|
||||||
|
|
||||||
|
if (_glfw.focusedWindow == window)
|
||||||
{
|
{
|
||||||
if (oldMode == GLFW_CURSOR_DISABLED)
|
if (oldMode == GLFW_CURSOR_DISABLED)
|
||||||
_glfwPlatformSetCursorPos(window, _glfw.cursorPosX, _glfw.cursorPosY);
|
{
|
||||||
|
_glfwPlatformSetCursorPos(window,
|
||||||
|
_glfw.cursorPosX,
|
||||||
|
_glfw.cursorPosY);
|
||||||
|
}
|
||||||
else if (newMode == GLFW_CURSOR_DISABLED)
|
else if (newMode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
_glfw.cursorPosX = window->cursorPosX;
|
_glfwPlatformGetCursorPos(window,
|
||||||
_glfw.cursorPosY = window->cursorPosY;
|
&_glfw.cursorPosX,
|
||||||
|
&_glfw.cursorPosY);
|
||||||
|
|
||||||
|
window->cursorPosX = _glfw.cursorPosX;
|
||||||
|
window->cursorPosY = _glfw.cursorPosY;
|
||||||
|
|
||||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||||
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
_glfwPlatformSetCursorPos(window, width / 2, height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformSetCursorMode(window, newMode);
|
_glfwPlatformApplyCursorMode(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->cursorMode = newMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sticky keys mode for the specified window
|
// Set sticky keys mode for the specified window
|
||||||
@@ -87,8 +96,8 @@ static void setStickyKeys(_GLFWwindow* window, int enabled)
|
|||||||
// Release all sticky keys
|
// Release all sticky keys
|
||||||
for (i = 0; i <= GLFW_KEY_LAST; i++)
|
for (i = 0; i <= GLFW_KEY_LAST; i++)
|
||||||
{
|
{
|
||||||
if (window->key[i] == _GLFW_STICK)
|
if (window->keys[i] == _GLFW_STICK)
|
||||||
window->key[i] = GLFW_RELEASE;
|
window->keys[i] = GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,8 +118,8 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
|
|||||||
// Release all sticky mouse buttons
|
// Release all sticky mouse buttons
|
||||||
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
|
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
|
||||||
{
|
{
|
||||||
if (window->mouseButton[i] == _GLFW_STICK)
|
if (window->mouseButtons[i] == _GLFW_STICK)
|
||||||
window->mouseButton[i] = GLFW_RELEASE;
|
window->mouseButtons[i] = GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,39 +133,42 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
|
|||||||
|
|
||||||
void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
|
void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
GLboolean repeated = GL_FALSE;
|
|
||||||
|
|
||||||
if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (key >= 0 && key <= GLFW_KEY_LAST)
|
if (key >= 0 && key <= GLFW_KEY_LAST)
|
||||||
{
|
{
|
||||||
if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS)
|
GLboolean repeated = GL_FALSE;
|
||||||
|
|
||||||
|
if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS)
|
||||||
repeated = GL_TRUE;
|
repeated = GL_TRUE;
|
||||||
|
|
||||||
if (action == GLFW_RELEASE && window->stickyKeys)
|
if (action == GLFW_RELEASE && window->stickyKeys)
|
||||||
window->key[key] = _GLFW_STICK;
|
window->keys[key] = _GLFW_STICK;
|
||||||
else
|
else
|
||||||
window->key[key] = (char) action;
|
window->keys[key] = (char) action;
|
||||||
}
|
|
||||||
|
|
||||||
if (repeated)
|
if (repeated)
|
||||||
action = GLFW_REPEAT;
|
action = GLFW_REPEAT;
|
||||||
|
}
|
||||||
|
|
||||||
if (window->callbacks.key)
|
if (window->callbacks.key)
|
||||||
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
|
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwInputChar(_GLFWwindow* window, unsigned int character)
|
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain)
|
||||||
{
|
{
|
||||||
if (character == -1)
|
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (character < 32 || (character > 126 && character < 160))
|
if (window->callbacks.charmods)
|
||||||
return;
|
window->callbacks.charmods((GLFWwindow*) window, codepoint, mods);
|
||||||
|
|
||||||
|
if (plain)
|
||||||
|
{
|
||||||
if (window->callbacks.character)
|
if (window->callbacks.character)
|
||||||
window->callbacks.character((GLFWwindow*) window, character);
|
window->callbacks.character((GLFWwindow*) window, codepoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
||||||
@@ -172,9 +184,9 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
|||||||
|
|
||||||
// Register mouse button action
|
// Register mouse button action
|
||||||
if (action == GLFW_RELEASE && window->stickyMouseButtons)
|
if (action == GLFW_RELEASE && window->stickyMouseButtons)
|
||||||
window->mouseButton[button] = _GLFW_STICK;
|
window->mouseButtons[button] = _GLFW_STICK;
|
||||||
else
|
else
|
||||||
window->mouseButton[button] = (char) action;
|
window->mouseButtons[button] = (char) action;
|
||||||
|
|
||||||
if (window->callbacks.mouseButton)
|
if (window->callbacks.mouseButton)
|
||||||
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
|
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
|
||||||
@@ -189,22 +201,13 @@ void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y)
|
|||||||
|
|
||||||
window->cursorPosX += x;
|
window->cursorPosX += x;
|
||||||
window->cursorPosY += y;
|
window->cursorPosY += y;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (window->cursorPosX == x && window->cursorPosY == y)
|
|
||||||
return;
|
|
||||||
|
|
||||||
window->cursorPosX = x;
|
x = window->cursorPosX;
|
||||||
window->cursorPosY = y;
|
y = window->cursorPosY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->callbacks.cursorPos)
|
if (window->callbacks.cursorPos)
|
||||||
{
|
window->callbacks.cursorPos((GLFWwindow*) window, x, y);
|
||||||
window->callbacks.cursorPos((GLFWwindow*) window,
|
|
||||||
window->cursorPosX,
|
|
||||||
window->cursorPosY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
||||||
@@ -213,6 +216,12 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
|||||||
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
|
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
|
||||||
|
{
|
||||||
|
if (window->callbacks.drop)
|
||||||
|
window->callbacks.drop((GLFWwindow*) window, count, paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW public API //////
|
////// GLFW public API //////
|
||||||
@@ -233,7 +242,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
|||||||
case GLFW_STICKY_MOUSE_BUTTONS:
|
case GLFW_STICKY_MOUSE_BUTTONS:
|
||||||
return window->stickyMouseButtons;
|
return window->stickyMouseButtons;
|
||||||
default:
|
default:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,7 +265,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
|||||||
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
|
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,18 +278,18 @@ GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
|||||||
|
|
||||||
if (key < 0 || key > GLFW_KEY_LAST)
|
if (key < 0 || key > GLFW_KEY_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "The specified key is invalid");
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key");
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->key[key] == _GLFW_STICK)
|
if (window->keys[key] == _GLFW_STICK)
|
||||||
{
|
{
|
||||||
// Sticky mode: release key now
|
// Sticky mode: release key now
|
||||||
window->key[key] = GLFW_RELEASE;
|
window->keys[key] = GLFW_RELEASE;
|
||||||
return GLFW_PRESS;
|
return GLFW_PRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) window->key[key];
|
return (int) window->keys[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
||||||
@@ -292,31 +301,40 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
|||||||
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
|
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"The specified mouse button is invalid");
|
"Invalid mouse button");
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mouseButton[button] == _GLFW_STICK)
|
if (window->mouseButtons[button] == _GLFW_STICK)
|
||||||
{
|
{
|
||||||
// Sticky mode: release mouse button now
|
// Sticky mode: release mouse button now
|
||||||
window->mouseButton[button] = GLFW_RELEASE;
|
window->mouseButtons[button] = GLFW_RELEASE;
|
||||||
return GLFW_PRESS;
|
return GLFW_PRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) window->mouseButton[button];
|
return (int) window->mouseButtons[button];
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
|
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = 0;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
|
{
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = window->cursorPosX;
|
*xpos = window->cursorPosX;
|
||||||
|
|
||||||
if (ypos)
|
if (ypos)
|
||||||
*ypos = window->cursorPosY;
|
*ypos = window->cursorPosY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_glfwPlatformGetCursorPos(window, xpos, ypos);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
||||||
@@ -328,95 +346,269 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
|||||||
if (_glfw.focusedWindow != window)
|
if (_glfw.focusedWindow != window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't do anything if the cursor position did not change
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
if (xpos == window->cursorPosX && ypos == window->cursorPosY)
|
{
|
||||||
return;
|
// Only update the accumulated position if the cursor is disabled
|
||||||
|
|
||||||
// Set GLFW cursor position
|
|
||||||
window->cursorPosX = xpos;
|
window->cursorPosX = xpos;
|
||||||
window->cursorPosY = ypos;
|
window->cursorPosY = ypos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Update system cursor position
|
||||||
|
_glfwPlatformSetCursorPos(window, xpos, ypos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Do not move physical cursor if it is disabled
|
GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
{
|
||||||
|
_GLFWcursor* cursor;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
cursor = calloc(1, sizeof(_GLFWcursor));
|
||||||
|
cursor->next = _glfw.cursorListHead;
|
||||||
|
_glfw.cursorListHead = cursor;
|
||||||
|
|
||||||
|
if (!_glfwPlatformCreateCursor(cursor, image, xhot, yhot))
|
||||||
|
{
|
||||||
|
glfwDestroyCursor((GLFWcursor*) cursor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GLFWcursor*) cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
|
||||||
|
{
|
||||||
|
_GLFWcursor* cursor;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (shape != GLFW_ARROW_CURSOR &&
|
||||||
|
shape != GLFW_IBEAM_CURSOR &&
|
||||||
|
shape != GLFW_CROSSHAIR_CURSOR &&
|
||||||
|
shape != GLFW_HAND_CURSOR &&
|
||||||
|
shape != GLFW_HRESIZE_CURSOR &&
|
||||||
|
shape != GLFW_VRESIZE_CURSOR)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor = calloc(1, sizeof(_GLFWcursor));
|
||||||
|
cursor->next = _glfw.cursorListHead;
|
||||||
|
_glfw.cursorListHead = cursor;
|
||||||
|
|
||||||
|
if (!_glfwPlatformCreateStandardCursor(cursor, shape))
|
||||||
|
{
|
||||||
|
glfwDestroyCursor((GLFWcursor*) cursor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GLFWcursor*) cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwDestroyCursor(GLFWcursor* handle)
|
||||||
|
{
|
||||||
|
_GLFWcursor* cursor = (_GLFWcursor*) handle;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (cursor == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update physical cursor position
|
// Make sure the cursor is not being used by any window
|
||||||
_glfwPlatformSetCursorPos(window, xpos, ypos);
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
|
||||||
|
for (window = _glfw.windowListHead; window; window = window->next)
|
||||||
|
{
|
||||||
|
if (window->cursor == cursor)
|
||||||
|
glfwSetCursor((GLFWwindow*) window, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformDestroyCursor(cursor);
|
||||||
|
|
||||||
|
// Unlink cursor from global linked list
|
||||||
|
{
|
||||||
|
_GLFWcursor** prev = &_glfw.cursorListHead;
|
||||||
|
|
||||||
|
while (*prev != cursor)
|
||||||
|
prev = &((*prev)->next);
|
||||||
|
|
||||||
|
*prev = cursor->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) windowHandle;
|
||||||
|
_GLFWcursor* cursor = (_GLFWcursor*) cursorHandle;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
_glfwPlatformSetCursor(window, cursor);
|
||||||
|
|
||||||
|
window->cursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWkeyfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
|
||||||
previous = window->callbacks.key;
|
return cbfun;
|
||||||
window->callbacks.key = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWcharfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
previous = window->callbacks.character;
|
GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* handle, GLFWcharmodsfun cbfun)
|
||||||
window->callbacks.character = cbfun;
|
{
|
||||||
return previous;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun);
|
||||||
|
return cbfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
|
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
|
||||||
GLFWmousebuttonfun cbfun)
|
GLFWmousebuttonfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWmousebuttonfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
|
||||||
previous = window->callbacks.mouseButton;
|
return cbfun;
|
||||||
window->callbacks.mouseButton = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
|
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
|
||||||
GLFWcursorposfun cbfun)
|
GLFWcursorposfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWcursorposfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
|
||||||
previous = window->callbacks.cursorPos;
|
return cbfun;
|
||||||
window->callbacks.cursorPos = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
|
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
|
||||||
GLFWcursorenterfun cbfun)
|
GLFWcursorenterfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWcursorenterfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
|
||||||
previous = window->callbacks.cursorEnter;
|
return cbfun;
|
||||||
window->callbacks.cursorEnter = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
||||||
GLFWscrollfun cbfun)
|
GLFWscrollfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWscrollfun previous;
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwJoystickPresent(int joy)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
|
|
||||||
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfwPlatformJoystickPresent(joy);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
|
||||||
|
{
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
previous = window->callbacks.scroll;
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
window->callbacks.scroll = cbfun;
|
{
|
||||||
return previous;
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfwPlatformGetJoystickAxes(joy, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
|
||||||
|
{
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfwPlatformGetJoystickButtons(joy, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetJoystickName(int joy)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfwPlatformGetJoystickName(joy);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
_glfwPlatformSetClipboardString(window, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return _glfwPlatformGetClipboardString(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI double glfwGetTime(void)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(0.0);
|
||||||
|
return _glfwPlatformGetTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetTime(double time)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (time != time || time < 0.0 || time > 18446744073.0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid time");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformSetTime(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+220
-79
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -32,7 +29,22 @@
|
|||||||
#define _internal_h_
|
#define _internal_h_
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#if defined(_GLFW_USE_CONFIG_H)
|
||||||
|
#include "glfw_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _GLFW_VERSION_NUMBER "3.1.1"
|
||||||
|
|
||||||
|
#if defined(GLFW_INCLUDE_GLCOREARB) || \
|
||||||
|
defined(GLFW_INCLUDE_ES1) || \
|
||||||
|
defined(GLFW_INCLUDE_ES2) || \
|
||||||
|
defined(GLFW_INCLUDE_ES3) || \
|
||||||
|
defined(GLFW_INCLUDE_NONE) || \
|
||||||
|
defined(GLFW_INCLUDE_GLEXT) || \
|
||||||
|
defined(GLFW_INCLUDE_GLU) || \
|
||||||
|
defined(GLFW_DLL)
|
||||||
|
#error "You may not define any header option macros when compiling GLFW"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
// This is the default for glfw3.h
|
// This is the default for glfw3.h
|
||||||
@@ -57,12 +69,13 @@
|
|||||||
#include "../deps/GL/glext.h"
|
#include "../deps/GL/glext.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _GLFWhints _GLFWhints;
|
|
||||||
typedef struct _GLFWwndconfig _GLFWwndconfig;
|
typedef struct _GLFWwndconfig _GLFWwndconfig;
|
||||||
|
typedef struct _GLFWctxconfig _GLFWctxconfig;
|
||||||
typedef struct _GLFWfbconfig _GLFWfbconfig;
|
typedef struct _GLFWfbconfig _GLFWfbconfig;
|
||||||
typedef struct _GLFWwindow _GLFWwindow;
|
typedef struct _GLFWwindow _GLFWwindow;
|
||||||
typedef struct _GLFWlibrary _GLFWlibrary;
|
typedef struct _GLFWlibrary _GLFWlibrary;
|
||||||
typedef struct _GLFWmonitor _GLFWmonitor;
|
typedef struct _GLFWmonitor _GLFWmonitor;
|
||||||
|
typedef struct _GLFWcursor _GLFWcursor;
|
||||||
|
|
||||||
#if defined(_GLFW_COCOA)
|
#if defined(_GLFW_COCOA)
|
||||||
#include "cocoa_platform.h"
|
#include "cocoa_platform.h"
|
||||||
@@ -70,6 +83,10 @@ typedef struct _GLFWmonitor _GLFWmonitor;
|
|||||||
#include "win32_platform.h"
|
#include "win32_platform.h"
|
||||||
#elif defined(_GLFW_X11)
|
#elif defined(_GLFW_X11)
|
||||||
#include "x11_platform.h"
|
#include "x11_platform.h"
|
||||||
|
#elif defined(_GLFW_WAYLAND)
|
||||||
|
#include "wl_platform.h"
|
||||||
|
#elif defined(_GLFW_MIR)
|
||||||
|
#include "mir_platform.h"
|
||||||
#else
|
#else
|
||||||
#error "No supported window creation API selected"
|
#error "No supported window creation API selected"
|
||||||
#endif
|
#endif
|
||||||
@@ -106,7 +123,7 @@ typedef struct _GLFWmonitor _GLFWmonitor;
|
|||||||
// Helper macros
|
// Helper macros
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
// Checks for whether the library has been intitalized
|
// Checks for whether the library has been initialized
|
||||||
#define _GLFW_REQUIRE_INIT() \
|
#define _GLFW_REQUIRE_INIT() \
|
||||||
if (!_glfwInitialized) \
|
if (!_glfwInitialized) \
|
||||||
{ \
|
{ \
|
||||||
@@ -120,16 +137,25 @@ typedef struct _GLFWmonitor _GLFWmonitor;
|
|||||||
return x; \
|
return x; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Swaps the provided pointers
|
||||||
|
#define _GLFW_SWAP_POINTERS(x, y) \
|
||||||
|
{ \
|
||||||
|
void* t; \
|
||||||
|
t = x; \
|
||||||
|
x = y; \
|
||||||
|
y = t; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Internal types
|
// Platform-independent structures
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
/*! @brief Window and context configuration.
|
/*! @brief Window configuration.
|
||||||
*
|
*
|
||||||
* Parameters relating to the creation of the context and window but not
|
* Parameters relating to the creation of the window but not directly related
|
||||||
* directly related to the framebuffer. This is used to pass window and
|
* to the framebuffer. This is used to pass window creation parameters from
|
||||||
* context creation parameters from shared code to the platform API.
|
* shared code to the platform API.
|
||||||
*/
|
*/
|
||||||
struct _GLFWwndconfig
|
struct _GLFWwndconfig
|
||||||
{
|
{
|
||||||
@@ -139,14 +165,29 @@ struct _GLFWwndconfig
|
|||||||
GLboolean resizable;
|
GLboolean resizable;
|
||||||
GLboolean visible;
|
GLboolean visible;
|
||||||
GLboolean decorated;
|
GLboolean decorated;
|
||||||
int clientAPI;
|
GLboolean focused;
|
||||||
int glMajor;
|
GLboolean autoIconify;
|
||||||
int glMinor;
|
GLboolean floating;
|
||||||
GLboolean glForward;
|
|
||||||
GLboolean glDebug;
|
|
||||||
int glProfile;
|
|
||||||
int glRobustness;
|
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*! @brief Context configuration.
|
||||||
|
*
|
||||||
|
* Parameters relating to the creation of the context but not directly related
|
||||||
|
* to the framebuffer. This is used to pass context creation parameters from
|
||||||
|
* shared code to the platform API.
|
||||||
|
*/
|
||||||
|
struct _GLFWctxconfig
|
||||||
|
{
|
||||||
|
int api;
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
|
GLboolean forward;
|
||||||
|
GLboolean debug;
|
||||||
|
int profile;
|
||||||
|
int robustness;
|
||||||
|
int release;
|
||||||
_GLFWwindow* share;
|
_GLFWwindow* share;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,7 +195,7 @@ struct _GLFWwndconfig
|
|||||||
/*! @brief Framebuffer configuration.
|
/*! @brief Framebuffer configuration.
|
||||||
*
|
*
|
||||||
* This describes buffers and their sizes. It also contains
|
* This describes buffers and their sizes. It also contains
|
||||||
* a platform-specific ID used to map back to the backend API's object.
|
* a platform-specific ID used to map back to the backend API object.
|
||||||
*
|
*
|
||||||
* It is used to pass framebuffer parameters from shared code to the platform
|
* It is used to pass framebuffer parameters from shared code to the platform
|
||||||
* API and also to enumerate and select available framebuffer configs.
|
* API and also to enumerate and select available framebuffer configs.
|
||||||
@@ -172,11 +213,12 @@ struct _GLFWfbconfig
|
|||||||
int accumBlueBits;
|
int accumBlueBits;
|
||||||
int accumAlphaBits;
|
int accumAlphaBits;
|
||||||
int auxBuffers;
|
int auxBuffers;
|
||||||
GLboolean stereo;
|
int stereo;
|
||||||
int samples;
|
int samples;
|
||||||
GLboolean sRGB;
|
int sRGB;
|
||||||
|
int doublebuffer;
|
||||||
|
|
||||||
// This is defined in the context API's platform.h
|
// This is defined in the context API's context.h
|
||||||
_GLFW_PLATFORM_FBCONFIG;
|
_GLFW_PLATFORM_FBCONFIG;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -188,29 +230,34 @@ struct _GLFWwindow
|
|||||||
struct _GLFWwindow* next;
|
struct _GLFWwindow* next;
|
||||||
|
|
||||||
// Window settings and state
|
// Window settings and state
|
||||||
GLboolean iconified;
|
|
||||||
GLboolean resizable;
|
GLboolean resizable;
|
||||||
GLboolean decorated;
|
GLboolean decorated;
|
||||||
GLboolean visible;
|
GLboolean autoIconify;
|
||||||
|
GLboolean floating;
|
||||||
GLboolean closed;
|
GLboolean closed;
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
GLFWvidmode videoMode;
|
GLFWvidmode videoMode;
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
|
_GLFWcursor* cursor;
|
||||||
|
|
||||||
// Window input state
|
// Window input state
|
||||||
GLboolean stickyKeys;
|
GLboolean stickyKeys;
|
||||||
GLboolean stickyMouseButtons;
|
GLboolean stickyMouseButtons;
|
||||||
double cursorPosX, cursorPosY;
|
double cursorPosX, cursorPosY;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
|
||||||
char key[GLFW_KEY_LAST + 1];
|
char keys[GLFW_KEY_LAST + 1];
|
||||||
|
|
||||||
// OpenGL extensions and context attributes
|
// OpenGL extensions and context attributes
|
||||||
int clientAPI;
|
struct {
|
||||||
int glMajor, glMinor, glRevision;
|
int api;
|
||||||
GLboolean glForward, glDebug;
|
int major, minor, revision;
|
||||||
int glProfile;
|
GLboolean forward, debug;
|
||||||
int glRobustness;
|
int profile;
|
||||||
|
int robustness;
|
||||||
|
int release;
|
||||||
|
} context;
|
||||||
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
PFNGLGETSTRINGIPROC GetStringi;
|
PFNGLGETSTRINGIPROC GetStringi;
|
||||||
#endif
|
#endif
|
||||||
@@ -229,11 +276,13 @@ struct _GLFWwindow
|
|||||||
GLFWscrollfun scroll;
|
GLFWscrollfun scroll;
|
||||||
GLFWkeyfun key;
|
GLFWkeyfun key;
|
||||||
GLFWcharfun character;
|
GLFWcharfun character;
|
||||||
|
GLFWcharmodsfun charmods;
|
||||||
|
GLFWdropfun drop;
|
||||||
} callbacks;
|
} callbacks;
|
||||||
|
|
||||||
// This is defined in the window API's platform.h
|
// This is defined in the window API's platform.h
|
||||||
_GLFW_PLATFORM_WINDOW_STATE;
|
_GLFW_PLATFORM_WINDOW_STATE;
|
||||||
// This is defined in the context API's platform.h
|
// This is defined in the context API's context.h
|
||||||
_GLFW_PLATFORM_CONTEXT_STATE;
|
_GLFW_PLATFORM_CONTEXT_STATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -259,6 +308,16 @@ struct _GLFWmonitor
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*! @brief Cursor structure
|
||||||
|
*/
|
||||||
|
struct _GLFWcursor
|
||||||
|
{
|
||||||
|
_GLFWcursor* next;
|
||||||
|
|
||||||
|
// This is defined in the window API's platform.h
|
||||||
|
_GLFW_PLATFORM_CURSOR_STATE;
|
||||||
|
};
|
||||||
|
|
||||||
/*! @brief Library global data.
|
/*! @brief Library global data.
|
||||||
*/
|
*/
|
||||||
struct _GLFWlibrary
|
struct _GLFWlibrary
|
||||||
@@ -275,35 +334,51 @@ struct _GLFWlibrary
|
|||||||
int accumBlueBits;
|
int accumBlueBits;
|
||||||
int accumAlphaBits;
|
int accumAlphaBits;
|
||||||
int auxBuffers;
|
int auxBuffers;
|
||||||
GLboolean stereo;
|
int stereo;
|
||||||
GLboolean resizable;
|
int resizable;
|
||||||
GLboolean visible;
|
int visible;
|
||||||
GLboolean decorated;
|
int decorated;
|
||||||
|
int focused;
|
||||||
|
int autoIconify;
|
||||||
|
int floating;
|
||||||
int samples;
|
int samples;
|
||||||
GLboolean sRGB;
|
int sRGB;
|
||||||
int refreshRate;
|
int refreshRate;
|
||||||
int clientAPI;
|
int doublebuffer;
|
||||||
int glMajor;
|
int api;
|
||||||
int glMinor;
|
int major;
|
||||||
GLboolean glForward;
|
int minor;
|
||||||
GLboolean glDebug;
|
int forward;
|
||||||
int glProfile;
|
int debug;
|
||||||
int glRobustness;
|
int profile;
|
||||||
|
int robustness;
|
||||||
|
int release;
|
||||||
} hints;
|
} hints;
|
||||||
|
|
||||||
double cursorPosX, cursorPosY;
|
double cursorPosX, cursorPosY;
|
||||||
|
|
||||||
|
_GLFWcursor* cursorListHead;
|
||||||
|
|
||||||
_GLFWwindow* windowListHead;
|
_GLFWwindow* windowListHead;
|
||||||
_GLFWwindow* focusedWindow;
|
_GLFWwindow* focusedWindow;
|
||||||
|
|
||||||
_GLFWmonitor** monitors;
|
_GLFWmonitor** monitors;
|
||||||
int monitorCount;
|
int monitorCount;
|
||||||
GLFWmonitorfun monitorCallback;
|
|
||||||
|
struct {
|
||||||
|
GLFWmonitorfun monitor;
|
||||||
|
} callbacks;
|
||||||
|
|
||||||
// This is defined in the window API's platform.h
|
// This is defined in the window API's platform.h
|
||||||
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
|
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
|
||||||
// This is defined in the context API's platform.h
|
// This is defined in the context API's context.h
|
||||||
_GLFW_PLATFORM_LIBRARY_OPENGL_STATE;
|
_GLFW_PLATFORM_LIBRARY_CONTEXT_STATE;
|
||||||
|
// This is defined in the platform's time.h
|
||||||
|
_GLFW_PLATFORM_LIBRARY_TIME_STATE;
|
||||||
|
// This is defined in the platform's joystick.h
|
||||||
|
_GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE;
|
||||||
|
// This is defined in the platform's tls.h
|
||||||
|
_GLFW_PLATFORM_LIBRARY_TLS_STATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -346,17 +421,21 @@ void _glfwPlatformTerminate(void);
|
|||||||
*/
|
*/
|
||||||
const char* _glfwPlatformGetVersionString(void);
|
const char* _glfwPlatformGetVersionString(void);
|
||||||
|
|
||||||
|
/*! @copydoc glfwGetCursorPos
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
|
||||||
|
|
||||||
/*! @copydoc glfwSetCursorPos
|
/*! @copydoc glfwSetCursorPos
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
||||||
|
|
||||||
/*! @brief Sets up the specified cursor mode for the specified window.
|
/*! @brief Applies the cursor mode of the specified window to the system.
|
||||||
* @param[in] window The window whose cursor mode to change.
|
* @param[in] window The window whose cursor mode to apply.
|
||||||
* @param[in] mode The desired cursor mode.
|
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window);
|
||||||
|
|
||||||
/*! @copydoc glfwGetMonitors
|
/*! @copydoc glfwGetMonitors
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
@@ -444,6 +523,7 @@ void _glfwPlatformSetTime(double time);
|
|||||||
*/
|
*/
|
||||||
int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig);
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
|
||||||
/*! @ingroup platform
|
/*! @ingroup platform
|
||||||
@@ -480,6 +560,11 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
|
|||||||
*/
|
*/
|
||||||
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height);
|
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height);
|
||||||
|
|
||||||
|
/*! @copydoc glfwGetWindowFrameSize
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
|
||||||
|
|
||||||
/*! @copydoc glfwIconifyWindow
|
/*! @copydoc glfwIconifyWindow
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
@@ -495,11 +580,30 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window);
|
|||||||
*/
|
*/
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window);
|
void _glfwPlatformShowWindow(_GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformUnhideWindow(_GLFWwindow* window);
|
||||||
|
|
||||||
/*! @copydoc glfwHideWindow
|
/*! @copydoc glfwHideWindow
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
void _glfwPlatformHideWindow(_GLFWwindow* window);
|
void _glfwPlatformHideWindow(_GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns whether the window is focused.
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
int _glfwPlatformWindowFocused(_GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns whether the window is iconified.
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
int _glfwPlatformWindowIconified(_GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns whether the window is visible.
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
int _glfwPlatformWindowVisible(_GLFWwindow* window);
|
||||||
|
|
||||||
/*! @copydoc glfwPollEvents
|
/*! @copydoc glfwPollEvents
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
@@ -510,6 +614,11 @@ void _glfwPlatformPollEvents(void);
|
|||||||
*/
|
*/
|
||||||
void _glfwPlatformWaitEvents(void);
|
void _glfwPlatformWaitEvents(void);
|
||||||
|
|
||||||
|
/*! @copydoc glfwPostEmptyEvent
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformPostEmptyEvent(void);
|
||||||
|
|
||||||
/*! @copydoc glfwMakeContextCurrent
|
/*! @copydoc glfwMakeContextCurrent
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
@@ -530,7 +639,8 @@ void _glfwPlatformSwapBuffers(_GLFWwindow* window);
|
|||||||
*/
|
*/
|
||||||
void _glfwPlatformSwapInterval(int interval);
|
void _glfwPlatformSwapInterval(int interval);
|
||||||
|
|
||||||
/*! @ingroup platform
|
/*! @copydoc glfwExtensionSupported
|
||||||
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
int _glfwPlatformExtensionSupported(const char* extension);
|
int _glfwPlatformExtensionSupported(const char* extension);
|
||||||
|
|
||||||
@@ -539,6 +649,26 @@ int _glfwPlatformExtensionSupported(const char* extension);
|
|||||||
*/
|
*/
|
||||||
GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
|
GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
|
||||||
|
|
||||||
|
/*! @copydoc glfwCreateCursor
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
|
||||||
|
|
||||||
|
/*! @copydoc glfwCreateStandardCursor
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape);
|
||||||
|
|
||||||
|
/*! @copydoc glfwDestroyCursor
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
|
||||||
|
|
||||||
|
/*! @copydoc glfwSetCursor
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Event API functions
|
// Event API functions
|
||||||
@@ -584,14 +714,6 @@ void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height);
|
|||||||
*/
|
*/
|
||||||
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
|
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
|
||||||
|
|
||||||
/*! @brief Notifies shared code of a window show/hide event.
|
|
||||||
* @param[in] window The window that received the event.
|
|
||||||
* @param[in] visible `GL_TRUE` if the window was shown, or `GL_FALSE` if it
|
|
||||||
* was hidden.
|
|
||||||
* @ingroup event
|
|
||||||
*/
|
|
||||||
void _glfwInputWindowVisibility(_GLFWwindow* window, int visible);
|
|
||||||
|
|
||||||
/*! @brief Notifies shared code of a window damage event.
|
/*! @brief Notifies shared code of a window damage event.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
*/
|
*/
|
||||||
@@ -615,10 +737,13 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
|||||||
|
|
||||||
/*! @brief Notifies shared code of a Unicode character input event.
|
/*! @brief Notifies shared code of a Unicode character input event.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
* @param[in] character The Unicode code point of the input character.
|
* @param[in] codepoint The Unicode code point of the input character.
|
||||||
|
* @param[in] mods Bit field describing which modifier keys were held down.
|
||||||
|
* @param[in] plain `GL_TRUE` if the character is regular text input, or
|
||||||
|
* `GL_FALSE` otherwise.
|
||||||
* @ingroup event
|
* @ingroup event
|
||||||
*/
|
*/
|
||||||
void _glfwInputChar(_GLFWwindow* window, unsigned int character);
|
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain);
|
||||||
|
|
||||||
/*! @brief Notifies shared code of a scroll event.
|
/*! @brief Notifies shared code of a scroll event.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
@@ -666,6 +791,14 @@ void _glfwInputMonitorChange(void);
|
|||||||
*/
|
*/
|
||||||
void _glfwInputError(int error, const char* format, ...);
|
void _glfwInputError(int error, const char* format, ...);
|
||||||
|
|
||||||
|
/*! @brief Notifies dropped object over window.
|
||||||
|
* @param[in] window The window that received the event.
|
||||||
|
* @param[in] count The number of dropped objects.
|
||||||
|
* @param[in] names The names of the dropped objects.
|
||||||
|
* @ingroup event
|
||||||
|
*/
|
||||||
|
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names);
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Utility functions
|
// Utility functions
|
||||||
@@ -707,13 +840,14 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
unsigned int count);
|
unsigned int count);
|
||||||
|
|
||||||
/*! @brief Retrieves the attributes of the current context.
|
/*! @brief Retrieves the attributes of the current context.
|
||||||
|
* @param[in] ctxconfig The desired context attributes.
|
||||||
* @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable.
|
* @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable.
|
||||||
* @ingroup utility
|
* @ingroup utility
|
||||||
*/
|
*/
|
||||||
GLboolean _glfwRefreshContextAttribs(void);
|
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig);
|
||||||
|
|
||||||
/*! @brief Checks whether the desired context attributes are valid.
|
/*! @brief Checks whether the desired context attributes are valid.
|
||||||
* @param[in] wndconfig The context attributes to check.
|
* @param[in] ctxconfig The context attributes to check.
|
||||||
* @return `GL_TRUE` if the context attributes are valid, or `GL_FALSE`
|
* @return `GL_TRUE` if the context attributes are valid, or `GL_FALSE`
|
||||||
* otherwise.
|
* otherwise.
|
||||||
* @ingroup utility
|
* @ingroup utility
|
||||||
@@ -722,35 +856,42 @@ GLboolean _glfwRefreshContextAttribs(void);
|
|||||||
* exists and whether all relevant options have supported and non-conflicting
|
* exists and whether all relevant options have supported and non-conflicting
|
||||||
* values.
|
* values.
|
||||||
*/
|
*/
|
||||||
GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig);
|
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
|
||||||
|
|
||||||
/*! @brief Checks whether the current context fulfils the specified hard
|
/*! @brief Checks whether the current context fulfils the specified hard
|
||||||
* constraints.
|
* constraints.
|
||||||
* @param[in] wndconfig The desired context attributes.
|
* @param[in] ctxconfig The desired context attributes.
|
||||||
* @return `GL_TRUE` if the context fulfils the hard constraints, or `GL_FALSE`
|
* @return `GL_TRUE` if the context fulfils the hard constraints, or `GL_FALSE`
|
||||||
* otherwise.
|
* otherwise.
|
||||||
* @ingroup utility
|
* @ingroup utility
|
||||||
*/
|
*/
|
||||||
GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig);
|
GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig);
|
||||||
|
|
||||||
/*! @ingroup utility
|
/*! @ingroup utility
|
||||||
*/
|
*/
|
||||||
void _glfwAllocGammaRamp(GLFWgammaramp* ramp, unsigned int size);
|
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
|
||||||
|
|
||||||
/*! @ingroup utility
|
/*! @ingroup utility
|
||||||
*/
|
*/
|
||||||
void _glfwFreeGammaRamp(GLFWgammaramp* ramp);
|
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
|
||||||
|
|
||||||
|
/*! @brief Allocates and returns a monitor object with the specified name
|
||||||
|
* and dimensions.
|
||||||
|
* @param[in] name The name of the monitor.
|
||||||
|
* @param[in] widthMM The width, in mm, of the monitor's display area.
|
||||||
|
* @param[in] heightMM The height, in mm, of the monitor's display area.
|
||||||
|
* @return The newly created object.
|
||||||
|
* @ingroup utility
|
||||||
|
*/
|
||||||
|
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
|
||||||
|
|
||||||
|
/*! @brief Frees a monitor object and any data associated with it.
|
||||||
|
* @ingroup utility
|
||||||
|
*/
|
||||||
|
void _glfwFreeMonitor(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @ingroup utility
|
/*! @ingroup utility
|
||||||
*/
|
*/
|
||||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM);
|
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count);
|
||||||
|
|
||||||
/*! @ingroup utility
|
|
||||||
*/
|
|
||||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor);
|
|
||||||
|
|
||||||
/*! @ingroup utility
|
|
||||||
*/
|
|
||||||
void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count);
|
|
||||||
|
|
||||||
#endif // _internal_h_
|
#endif // _internal_h_
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 IOKit - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2006-2014 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#ifndef _iokit_joystick_h_
|
||||||
|
#define _iokit_joystick_h_
|
||||||
|
|
||||||
|
#include <IOKit/IOKitLib.h>
|
||||||
|
#include <IOKit/IOCFPlugIn.h>
|
||||||
|
#include <IOKit/hid/IOHIDLib.h>
|
||||||
|
#include <IOKit/hid/IOHIDKeys.h>
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
|
||||||
|
_GLFWjoystickIOKit iokit_js[GLFW_JOYSTICK_LAST + 1]
|
||||||
|
|
||||||
|
|
||||||
|
// IOKit-specific per-joystick data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWjoystickIOKit
|
||||||
|
{
|
||||||
|
int present;
|
||||||
|
char name[256];
|
||||||
|
|
||||||
|
IOHIDDeviceInterface** interface;
|
||||||
|
|
||||||
|
CFMutableArrayRef axisElements;
|
||||||
|
CFMutableArrayRef buttonElements;
|
||||||
|
CFMutableArrayRef hatElements;
|
||||||
|
|
||||||
|
float* axes;
|
||||||
|
unsigned char* buttons;
|
||||||
|
|
||||||
|
} _GLFWjoystickIOKit;
|
||||||
|
|
||||||
|
|
||||||
|
void _glfwInitJoysticks(void);
|
||||||
|
void _glfwTerminateJoysticks(void);
|
||||||
|
|
||||||
|
#endif // _iokit_joystick_h_
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 IOKit - www.glfw.org
|
||||||
// Platform: Cocoa
|
|
||||||
// API Version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
||||||
@@ -61,7 +58,7 @@ static void getElementsCFArrayHandler(const void* value, void* parameter);
|
|||||||
|
|
||||||
// Adds an element to the specified joystick
|
// Adds an element to the specified joystick
|
||||||
//
|
//
|
||||||
static void addJoystickElement(_GLFWjoy* joystick, CFTypeRef elementRef)
|
static void addJoystickElement(_GLFWjoystickIOKit* joystick, CFTypeRef elementRef)
|
||||||
{
|
{
|
||||||
long elementType, usagePage, usage;
|
long elementType, usagePage, usage;
|
||||||
CFMutableArrayRef elementsArray = NULL;
|
CFMutableArrayRef elementsArray = NULL;
|
||||||
@@ -113,7 +110,7 @@ static void addJoystickElement(_GLFWjoy* joystick, CFTypeRef elementRef)
|
|||||||
{
|
{
|
||||||
long number;
|
long number;
|
||||||
CFTypeRef numberRef;
|
CFTypeRef numberRef;
|
||||||
_GLFWjoyelement* element = (_GLFWjoyelement*) malloc(sizeof(_GLFWjoyelement));
|
_GLFWjoyelement* element = calloc(1, sizeof(_GLFWjoyelement));
|
||||||
|
|
||||||
CFArrayAppendValue(elementsArray, element);
|
CFArrayAppendValue(elementsArray, element);
|
||||||
|
|
||||||
@@ -149,12 +146,12 @@ static void addJoystickElement(_GLFWjoy* joystick, CFTypeRef elementRef)
|
|||||||
static void getElementsCFArrayHandler(const void* value, void* parameter)
|
static void getElementsCFArrayHandler(const void* value, void* parameter)
|
||||||
{
|
{
|
||||||
if (CFGetTypeID(value) == CFDictionaryGetTypeID())
|
if (CFGetTypeID(value) == CFDictionaryGetTypeID())
|
||||||
addJoystickElement((_GLFWjoy*) parameter, (CFTypeRef) value);
|
addJoystickElement((_GLFWjoystickIOKit*) parameter, (CFTypeRef) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the value of the specified element of the specified joystick
|
// Returns the value of the specified element of the specified joystick
|
||||||
//
|
//
|
||||||
static long getElementValue(_GLFWjoy* joystick, _GLFWjoyelement* element)
|
static long getElementValue(_GLFWjoystickIOKit* joystick, _GLFWjoyelement* element)
|
||||||
{
|
{
|
||||||
IOReturn result = kIOReturnSuccess;
|
IOReturn result = kIOReturnSuccess;
|
||||||
IOHIDEventStruct hidEvent;
|
IOHIDEventStruct hidEvent;
|
||||||
@@ -181,7 +178,7 @@ static long getElementValue(_GLFWjoy* joystick, _GLFWjoyelement* element)
|
|||||||
|
|
||||||
// Removes the specified joystick
|
// Removes the specified joystick
|
||||||
//
|
//
|
||||||
static void removeJoystick(_GLFWjoy* joystick)
|
static void removeJoystick(_GLFWjoystickIOKit* joystick)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -206,14 +203,14 @@ static void removeJoystick(_GLFWjoy* joystick)
|
|||||||
(*(joystick->interface))->close(joystick->interface);
|
(*(joystick->interface))->close(joystick->interface);
|
||||||
(*(joystick->interface))->Release(joystick->interface);
|
(*(joystick->interface))->Release(joystick->interface);
|
||||||
|
|
||||||
memset(joystick, 0, sizeof(_GLFWjoy));
|
memset(joystick, 0, sizeof(_GLFWjoystickIOKit));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for user-initiated joystick removal
|
// Callback for user-initiated joystick removal
|
||||||
//
|
//
|
||||||
static void removalCallback(void* target, IOReturn result, void* refcon, void* sender)
|
static void removalCallback(void* target, IOReturn result, void* refcon, void* sender)
|
||||||
{
|
{
|
||||||
removeJoystick((_GLFWjoy*) refcon);
|
removeJoystick((_GLFWjoystickIOKit*) refcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polls for joystick events and updates GLFW state
|
// Polls for joystick events and updates GLFW state
|
||||||
@@ -226,7 +223,7 @@ static void pollJoystickEvents(void)
|
|||||||
{
|
{
|
||||||
CFIndex i;
|
CFIndex i;
|
||||||
int buttonIndex = 0;
|
int buttonIndex = 0;
|
||||||
_GLFWjoy* joystick = _glfw.ns.joysticks + joy;
|
_GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy;
|
||||||
|
|
||||||
if (!joystick->present)
|
if (!joystick->present)
|
||||||
continue;
|
continue;
|
||||||
@@ -254,9 +251,6 @@ static void pollJoystickEvents(void)
|
|||||||
joystick->axes[i] = value;
|
joystick->axes[i] = value;
|
||||||
else
|
else
|
||||||
joystick->axes[i] = (2.f * (value - axis->minReport) / readScale) - 1.f;
|
joystick->axes[i] = (2.f * (value - axis->minReport) / readScale) - 1.f;
|
||||||
|
|
||||||
if (i & 1)
|
|
||||||
joystick->axes[i] = -joystick->axes[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CFArrayGetCount(joystick->hatElements); i++)
|
for (i = 0; i < CFArrayGetCount(joystick->hatElements); i++)
|
||||||
@@ -322,39 +316,40 @@ void _glfwInitJoysticks(void)
|
|||||||
|
|
||||||
while ((ioHIDDeviceObject = IOIteratorNext(objectIterator)))
|
while ((ioHIDDeviceObject = IOIteratorNext(objectIterator)))
|
||||||
{
|
{
|
||||||
|
CFMutableDictionaryRef propsRef = NULL;
|
||||||
|
CFTypeRef valueRef = NULL;
|
||||||
kern_return_t result;
|
kern_return_t result;
|
||||||
CFTypeRef valueRef = 0;
|
|
||||||
|
|
||||||
IOCFPlugInInterface** ppPlugInInterface = NULL;
|
IOCFPlugInInterface** ppPlugInInterface = NULL;
|
||||||
HRESULT plugInResult = S_OK;
|
HRESULT plugInResult = S_OK;
|
||||||
SInt32 score = 0;
|
SInt32 score = 0;
|
||||||
|
|
||||||
long usagePage, usage;
|
long usagePage = 0;
|
||||||
|
long usage = 0;
|
||||||
|
|
||||||
// Check device type
|
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
||||||
CFSTR(kIOHIDPrimaryUsagePageKey),
|
CFSTR(kIOHIDPrimaryUsagePageKey),
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault, kNilOptions);
|
||||||
kNilOptions);
|
|
||||||
if (valueRef)
|
if (valueRef)
|
||||||
{
|
{
|
||||||
CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage);
|
CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage);
|
||||||
if (usagePage != kHIDPage_GenericDesktop)
|
|
||||||
{
|
|
||||||
// This device is not relevant to GLFW
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(valueRef);
|
CFRelease(valueRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
||||||
CFSTR(kIOHIDPrimaryUsageKey),
|
CFSTR(kIOHIDPrimaryUsageKey),
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault, kNilOptions);
|
||||||
kNilOptions);
|
|
||||||
if (valueRef)
|
if (valueRef)
|
||||||
{
|
{
|
||||||
CFNumberGetValue(valueRef, kCFNumberLongType, &usage);
|
CFNumberGetValue(valueRef, kCFNumberLongType, &usage);
|
||||||
|
CFRelease(valueRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usagePage != kHIDPage_GenericDesktop)
|
||||||
|
{
|
||||||
|
// This device is not relevant to GLFW
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((usage != kHIDUsage_GD_Joystick &&
|
if ((usage != kHIDUsage_GD_Joystick &&
|
||||||
usage != kHIDUsage_GD_GamePad &&
|
usage != kHIDUsage_GD_GamePad &&
|
||||||
@@ -364,10 +359,15 @@ void _glfwInitJoysticks(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(valueRef);
|
result = IORegistryEntryCreateCFProperties(ioHIDDeviceObject,
|
||||||
}
|
&propsRef,
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
kNilOptions);
|
||||||
|
|
||||||
_GLFWjoy* joystick = _glfw.ns.joysticks + joy;
|
if (result != kIOReturnSuccess)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy;
|
||||||
joystick->present = GL_TRUE;
|
joystick->present = GL_TRUE;
|
||||||
|
|
||||||
result = IOCreatePlugInInterfaceForService(ioHIDDeviceObject,
|
result = IOCreatePlugInInterfaceForService(ioHIDDeviceObject,
|
||||||
@@ -377,7 +377,10 @@ void _glfwInitJoysticks(void)
|
|||||||
&score);
|
&score);
|
||||||
|
|
||||||
if (kIOReturnSuccess != result)
|
if (kIOReturnSuccess != result)
|
||||||
|
{
|
||||||
|
CFRelease(propsRef);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plugInResult = (*ppPlugInInterface)->QueryInterface(
|
plugInResult = (*ppPlugInInterface)->QueryInterface(
|
||||||
ppPlugInInterface,
|
ppPlugInInterface,
|
||||||
@@ -385,7 +388,10 @@ void _glfwInitJoysticks(void)
|
|||||||
(void *) &(joystick->interface));
|
(void *) &(joystick->interface));
|
||||||
|
|
||||||
if (plugInResult != S_OK)
|
if (plugInResult != S_OK)
|
||||||
|
{
|
||||||
|
CFRelease(propsRef);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
(*ppPlugInInterface)->Release(ppPlugInInterface);
|
(*ppPlugInInterface)->Release(ppPlugInInterface);
|
||||||
|
|
||||||
@@ -396,27 +402,20 @@ void _glfwInitJoysticks(void)
|
|||||||
joystick);
|
joystick);
|
||||||
|
|
||||||
// Get product string
|
// Get product string
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDProductKey));
|
||||||
CFSTR(kIOHIDProductKey),
|
|
||||||
kCFAllocatorDefault,
|
|
||||||
kNilOptions);
|
|
||||||
if (valueRef)
|
if (valueRef)
|
||||||
{
|
{
|
||||||
CFStringGetCString(valueRef,
|
CFStringGetCString(valueRef,
|
||||||
joystick->name,
|
joystick->name,
|
||||||
sizeof(joystick->name),
|
sizeof(joystick->name),
|
||||||
kCFStringEncodingUTF8);
|
kCFStringEncodingUTF8);
|
||||||
CFRelease(valueRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDElementKey));
|
||||||
CFSTR(kIOHIDElementKey),
|
|
||||||
kCFAllocatorDefault,
|
|
||||||
kNilOptions);
|
|
||||||
if (CFGetTypeID(valueRef) == CFArrayGetTypeID())
|
if (CFGetTypeID(valueRef) == CFArrayGetTypeID())
|
||||||
{
|
{
|
||||||
CFRange range = { 0, CFArrayGetCount(valueRef) };
|
CFRange range = { 0, CFArrayGetCount(valueRef) };
|
||||||
@@ -424,12 +423,13 @@ void _glfwInitJoysticks(void)
|
|||||||
range,
|
range,
|
||||||
getElementsCFArrayHandler,
|
getElementsCFArrayHandler,
|
||||||
(void*) joystick);
|
(void*) joystick);
|
||||||
CFRelease(valueRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
joystick->axes = (float*) calloc(CFArrayGetCount(joystick->axisElements),
|
CFRelease(propsRef);
|
||||||
|
|
||||||
|
joystick->axes = calloc(CFArrayGetCount(joystick->axisElements),
|
||||||
sizeof(float));
|
sizeof(float));
|
||||||
joystick->buttons = (unsigned char*) calloc(CFArrayGetCount(joystick->buttonElements) +
|
joystick->buttons = calloc(CFArrayGetCount(joystick->buttonElements) +
|
||||||
CFArrayGetCount(joystick->hatElements) * 4, 1);
|
CFArrayGetCount(joystick->hatElements) * 4, 1);
|
||||||
|
|
||||||
joy++;
|
joy++;
|
||||||
@@ -446,8 +446,15 @@ void _glfwTerminateJoysticks(void)
|
|||||||
|
|
||||||
for (i = 0; i < GLFW_JOYSTICK_LAST + 1; i++)
|
for (i = 0; i < GLFW_JOYSTICK_LAST + 1; i++)
|
||||||
{
|
{
|
||||||
_GLFWjoy* joystick = &_glfw.ns.joysticks[i];
|
_GLFWjoystickIOKit* joystick = &_glfw.iokit_js[i];
|
||||||
removeJoystick(joystick);
|
removeJoystick(joystick);
|
||||||
|
|
||||||
|
if (joystick->axisElements)
|
||||||
|
CFRelease(joystick->axisElements);
|
||||||
|
if (joystick->buttonElements)
|
||||||
|
CFRelease(joystick->buttonElements);
|
||||||
|
if (joystick->hatElements)
|
||||||
|
CFRelease(joystick->hatElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,12 +467,12 @@ int _glfwPlatformJoystickPresent(int joy)
|
|||||||
{
|
{
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
||||||
return _glfw.ns.joysticks[joy].present;
|
return _glfw.iokit_js[joy].present;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
||||||
{
|
{
|
||||||
_GLFWjoy* joystick = _glfw.ns.joysticks + joy;
|
_GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy;
|
||||||
|
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
||||||
@@ -478,7 +485,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
|||||||
|
|
||||||
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
|
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
|
||||||
{
|
{
|
||||||
_GLFWjoy* joystick = _glfw.ns.joysticks + joy;
|
_GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy;
|
||||||
|
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
||||||
@@ -494,6 +501,6 @@ const char* _glfwPlatformGetJoystickName(int joy)
|
|||||||
{
|
{
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
||||||
return _glfw.ns.joysticks[joy].name;
|
return _glfw.iokit_js[joy].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
//========================================================================
|
|
||||||
// GLFW - An OpenGL library
|
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW public API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
GLFWAPI int glfwJoystickPresent(int joy)
|
|
||||||
{
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _glfwPlatformJoystickPresent(joy);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
|
|
||||||
{
|
|
||||||
*count = 0;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _glfwPlatformGetJoystickAxes(joy, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
|
|
||||||
{
|
|
||||||
*count = 0;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _glfwPlatformGetJoystickButtons(joy, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetJoystickName(int joy)
|
|
||||||
{
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _glfwPlatformGetJoystickName(joy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Linux - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
#include <linux/joystick.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/inotify.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif // __linux__
|
||||||
|
|
||||||
|
|
||||||
|
// Attempt to open the specified joystick device
|
||||||
|
//
|
||||||
|
static void openJoystickDevice(const char* path)
|
||||||
|
{
|
||||||
|
#if defined(__linux__)
|
||||||
|
char axisCount, buttonCount;
|
||||||
|
char name[256];
|
||||||
|
int joy, fd, version;
|
||||||
|
|
||||||
|
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
||||||
|
{
|
||||||
|
if (!_glfw.linux_js.js[joy].present)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strcmp(_glfw.linux_js.js[joy].path, path) == 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
||||||
|
{
|
||||||
|
if (!_glfw.linux_js.js[joy].present)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (joy > GLFW_JOYSTICK_LAST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fd = open(path, O_RDONLY | O_NONBLOCK);
|
||||||
|
if (fd == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_glfw.linux_js.js[joy].fd = fd;
|
||||||
|
|
||||||
|
// Verify that the joystick driver version is at least 1.0
|
||||||
|
ioctl(fd, JSIOCGVERSION, &version);
|
||||||
|
if (version < 0x010000)
|
||||||
|
{
|
||||||
|
// It's an old 0.x interface (we don't support it)
|
||||||
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0)
|
||||||
|
strncpy(name, "Unknown", sizeof(name));
|
||||||
|
|
||||||
|
_glfw.linux_js.js[joy].name = strdup(name);
|
||||||
|
_glfw.linux_js.js[joy].path = strdup(path);
|
||||||
|
|
||||||
|
ioctl(fd, JSIOCGAXES, &axisCount);
|
||||||
|
_glfw.linux_js.js[joy].axisCount = (int) axisCount;
|
||||||
|
|
||||||
|
ioctl(fd, JSIOCGBUTTONS, &buttonCount);
|
||||||
|
_glfw.linux_js.js[joy].buttonCount = (int) buttonCount;
|
||||||
|
|
||||||
|
_glfw.linux_js.js[joy].axes = calloc(axisCount, sizeof(float));
|
||||||
|
_glfw.linux_js.js[joy].buttons = calloc(buttonCount, 1);
|
||||||
|
|
||||||
|
_glfw.linux_js.js[joy].present = GL_TRUE;
|
||||||
|
#endif // __linux__
|
||||||
|
}
|
||||||
|
|
||||||
|
// Polls for and processes events for all present joysticks
|
||||||
|
//
|
||||||
|
static void pollJoystickEvents(void)
|
||||||
|
{
|
||||||
|
#if defined(__linux__)
|
||||||
|
int i;
|
||||||
|
struct js_event e;
|
||||||
|
ssize_t offset = 0;
|
||||||
|
char buffer[16384];
|
||||||
|
|
||||||
|
const ssize_t size = read(_glfw.linux_js.inotify, buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
while (size > offset)
|
||||||
|
{
|
||||||
|
regmatch_t match;
|
||||||
|
const struct inotify_event* e = (struct inotify_event*) (buffer + offset);
|
||||||
|
|
||||||
|
if (regexec(&_glfw.linux_js.regex, e->name, 1, &match, 0) == 0)
|
||||||
|
{
|
||||||
|
char path[20];
|
||||||
|
snprintf(path, sizeof(path), "/dev/input/%s", e->name);
|
||||||
|
openJoystickDevice(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += sizeof(struct inotify_event) + e->len;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
|
||||||
|
{
|
||||||
|
if (!_glfw.linux_js.js[i].present)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Read all queued events (non-blocking)
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
if (read(_glfw.linux_js.js[i].fd, &e, sizeof(e)) < 0)
|
||||||
|
{
|
||||||
|
if (errno == ENODEV)
|
||||||
|
{
|
||||||
|
// The joystick was disconnected
|
||||||
|
|
||||||
|
free(_glfw.linux_js.js[i].axes);
|
||||||
|
free(_glfw.linux_js.js[i].buttons);
|
||||||
|
free(_glfw.linux_js.js[i].name);
|
||||||
|
free(_glfw.linux_js.js[i].path);
|
||||||
|
|
||||||
|
memset(&_glfw.linux_js.js[i], 0, sizeof(_glfw.linux_js.js[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't care if it's an init event or not
|
||||||
|
e.type &= ~JS_EVENT_INIT;
|
||||||
|
|
||||||
|
switch (e.type)
|
||||||
|
{
|
||||||
|
case JS_EVENT_AXIS:
|
||||||
|
_glfw.linux_js.js[i].axes[e.number] =
|
||||||
|
(float) e.value / 32767.0f;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JS_EVENT_BUTTON:
|
||||||
|
_glfw.linux_js.js[i].buttons[e.number] =
|
||||||
|
e.value ? GLFW_PRESS : GLFW_RELEASE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // __linux__
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Initialize joystick interface
|
||||||
|
//
|
||||||
|
int _glfwInitJoysticks(void)
|
||||||
|
{
|
||||||
|
#if defined(__linux__)
|
||||||
|
const char* dirname = "/dev/input";
|
||||||
|
DIR* dir;
|
||||||
|
|
||||||
|
_glfw.linux_js.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
||||||
|
if (_glfw.linux_js.inotify == -1)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Linux: Failed to initialize inotify: %s",
|
||||||
|
strerror(errno));
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: Register for IN_ATTRIB as well to get notified when udev is done
|
||||||
|
// This works well in practice but the true way is libudev
|
||||||
|
|
||||||
|
_glfw.linux_js.watch = inotify_add_watch(_glfw.linux_js.inotify,
|
||||||
|
dirname,
|
||||||
|
IN_CREATE | IN_ATTRIB);
|
||||||
|
if (_glfw.linux_js.watch == -1)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Linux: Failed to watch for joystick connections in %s: %s",
|
||||||
|
dirname,
|
||||||
|
strerror(errno));
|
||||||
|
// Continue without device connection notifications
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regcomp(&_glfw.linux_js.regex, "^js[0-9]\\+$", 0) != 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = opendir(dirname);
|
||||||
|
if (dir)
|
||||||
|
{
|
||||||
|
struct dirent* entry;
|
||||||
|
|
||||||
|
while ((entry = readdir(dir)))
|
||||||
|
{
|
||||||
|
char path[20];
|
||||||
|
regmatch_t match;
|
||||||
|
|
||||||
|
if (regexec(&_glfw.linux_js.regex, entry->d_name, 1, &match, 0) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
|
||||||
|
openJoystickDevice(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Linux: Failed to open joystick device directory %s: %s",
|
||||||
|
dirname,
|
||||||
|
strerror(errno));
|
||||||
|
// Continue with no joysticks detected
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __linux__
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close all opened joystick handles
|
||||||
|
//
|
||||||
|
void _glfwTerminateJoysticks(void)
|
||||||
|
{
|
||||||
|
#if defined(__linux__)
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
|
||||||
|
{
|
||||||
|
if (_glfw.linux_js.js[i].present)
|
||||||
|
{
|
||||||
|
close(_glfw.linux_js.js[i].fd);
|
||||||
|
free(_glfw.linux_js.js[i].axes);
|
||||||
|
free(_glfw.linux_js.js[i].buttons);
|
||||||
|
free(_glfw.linux_js.js[i].name);
|
||||||
|
free(_glfw.linux_js.js[i].path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
regfree(&_glfw.linux_js.regex);
|
||||||
|
|
||||||
|
if (_glfw.linux_js.inotify > 0)
|
||||||
|
{
|
||||||
|
if (_glfw.linux_js.watch > 0)
|
||||||
|
inotify_rm_watch(_glfw.linux_js.inotify, _glfw.linux_js.watch);
|
||||||
|
|
||||||
|
close(_glfw.linux_js.inotify);
|
||||||
|
}
|
||||||
|
#endif // __linux__
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int _glfwPlatformJoystickPresent(int joy)
|
||||||
|
{
|
||||||
|
pollJoystickEvents();
|
||||||
|
|
||||||
|
return _glfw.linux_js.js[joy].present;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
||||||
|
{
|
||||||
|
pollJoystickEvents();
|
||||||
|
|
||||||
|
*count = _glfw.linux_js.js[joy].axisCount;
|
||||||
|
return _glfw.linux_js.js[joy].axes;
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
|
||||||
|
{
|
||||||
|
pollJoystickEvents();
|
||||||
|
|
||||||
|
*count = _glfw.linux_js.js[joy].buttonCount;
|
||||||
|
return _glfw.linux_js.js[joy].buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetJoystickName(int joy)
|
||||||
|
{
|
||||||
|
pollJoystickEvents();
|
||||||
|
|
||||||
|
return _glfw.linux_js.js[joy].name;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Linux - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#ifndef _linux_joystick_h_
|
||||||
|
#define _linux_joystick_h_
|
||||||
|
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
|
||||||
|
_GLFWjoystickLinux linux_js
|
||||||
|
|
||||||
|
|
||||||
|
// Linux-specific joystick API data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWjoystickLinux
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int present;
|
||||||
|
int fd;
|
||||||
|
float* axes;
|
||||||
|
int axisCount;
|
||||||
|
unsigned char* buttons;
|
||||||
|
int buttonCount;
|
||||||
|
char* name;
|
||||||
|
char* path;
|
||||||
|
} js[GLFW_JOYSTICK_LAST + 1];
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
int inotify;
|
||||||
|
int watch;
|
||||||
|
regex_t regex;
|
||||||
|
#endif /*__linux__*/
|
||||||
|
} _GLFWjoystickLinux;
|
||||||
|
|
||||||
|
|
||||||
|
int _glfwInitJoysticks(void);
|
||||||
|
void _glfwTerminateJoysticks(void);
|
||||||
|
|
||||||
|
#endif // _linux_joystick_h_
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
// Platform: Cocoa
|
|
||||||
// API Version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@@ -51,8 +48,8 @@ void _glfwInitTimer(void)
|
|||||||
mach_timebase_info_data_t info;
|
mach_timebase_info_data_t info;
|
||||||
mach_timebase_info(&info);
|
mach_timebase_info(&info);
|
||||||
|
|
||||||
_glfw.ns.timer.resolution = (double) info.numer / (info.denom * 1.0e9);
|
_glfw.ns_time.resolution = (double) info.numer / (info.denom * 1.0e9);
|
||||||
_glfw.ns.timer.base = getRawTime();
|
_glfw.ns_time.base = getRawTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -62,13 +59,13 @@ void _glfwInitTimer(void)
|
|||||||
|
|
||||||
double _glfwPlatformGetTime(void)
|
double _glfwPlatformGetTime(void)
|
||||||
{
|
{
|
||||||
return (double) (getRawTime() - _glfw.ns.timer.base) *
|
return (double) (getRawTime() - _glfw.ns_time.base) *
|
||||||
_glfw.ns.timer.resolution;
|
_glfw.ns_time.resolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetTime(double time)
|
void _glfwPlatformSetTime(double time)
|
||||||
{
|
{
|
||||||
_glfw.ns.timer.base = getRawTime() -
|
_glfw.ns_time.base = getRawTime() -
|
||||||
(uint64_t) (time / _glfw.ns.timer.resolution);
|
(uint64_t) (time / _glfw.ns_time.resolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Mir - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int _glfwPlatformInit(void)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
|
||||||
|
_glfw.mir.connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
|
if (!mir_connection_is_valid(_glfw.mir.connection))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unable to connect to server: %s",
|
||||||
|
mir_connection_get_error_message(_glfw.mir.connection));
|
||||||
|
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.mir.display =
|
||||||
|
mir_connection_get_egl_native_display(_glfw.mir.connection);
|
||||||
|
|
||||||
|
if (!_glfwInitContextAPI())
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
_glfwInitTimer();
|
||||||
|
_glfwInitJoysticks();
|
||||||
|
|
||||||
|
_glfw.mir.event_queue = calloc(1, sizeof(EventQueue));
|
||||||
|
_glfwInitEventQueue(_glfw.mir.event_queue);
|
||||||
|
|
||||||
|
error = pthread_mutex_init(&_glfw.mir.event_mutex, NULL);
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Failed to create event mutex: %s",
|
||||||
|
strerror(error));
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformTerminate(void)
|
||||||
|
{
|
||||||
|
_glfwTerminateContextAPI();
|
||||||
|
_glfwTerminateJoysticks();
|
||||||
|
|
||||||
|
_glfwDeleteEventQueue(_glfw.mir.event_queue);
|
||||||
|
|
||||||
|
pthread_mutex_destroy(&_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
mir_connection_release(_glfw.mir.connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
|
{
|
||||||
|
const char* version = _GLFW_VERSION_NUMBER " Mir EGL"
|
||||||
|
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
|
||||||
|
" clock_gettime"
|
||||||
|
#endif
|
||||||
|
#if defined(_GLFW_BUILD_DLL)
|
||||||
|
" shared"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Mir - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||||
|
{
|
||||||
|
int i, found = 0;
|
||||||
|
_GLFWmonitor** monitors = NULL;
|
||||||
|
MirDisplayConfiguration* displayConfig =
|
||||||
|
mir_connection_create_display_config(_glfw.mir.connection);
|
||||||
|
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < displayConfig->num_outputs; i++)
|
||||||
|
{
|
||||||
|
const MirDisplayOutput* out = displayConfig->outputs + i;
|
||||||
|
|
||||||
|
if (out->used &&
|
||||||
|
out->connected &&
|
||||||
|
out->num_modes &&
|
||||||
|
out->current_mode < out->num_modes)
|
||||||
|
{
|
||||||
|
found++;
|
||||||
|
monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found);
|
||||||
|
monitors[i] = _glfwAllocMonitor("Unknown",
|
||||||
|
out->physical_width_mm,
|
||||||
|
out->physical_height_mm);
|
||||||
|
|
||||||
|
monitors[i]->mir.x = out->position_x;
|
||||||
|
monitors[i]->mir.y = out->position_y;
|
||||||
|
monitors[i]->mir.output_id = out->output_id;
|
||||||
|
monitors[i]->mir.cur_mode = out->current_mode;
|
||||||
|
|
||||||
|
monitors[i]->modes = _glfwPlatformGetVideoModes(monitors[i],
|
||||||
|
&monitors[i]->modeCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mir_display_config_destroy(displayConfig);
|
||||||
|
|
||||||
|
*count = found;
|
||||||
|
return monitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
||||||
|
{
|
||||||
|
return first->mir.output_id == second->mir.output_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
|
{
|
||||||
|
if (xpos)
|
||||||
|
*xpos = monitor->mir.x;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = monitor->mir.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
GLFWvidmode* modes = NULL;
|
||||||
|
MirDisplayConfiguration* displayConfig =
|
||||||
|
mir_connection_create_display_config(_glfw.mir.connection);
|
||||||
|
|
||||||
|
for (i = 0; i < displayConfig->num_outputs; i++)
|
||||||
|
{
|
||||||
|
const MirDisplayOutput* out = displayConfig->outputs + i;
|
||||||
|
if (out->output_id != monitor->mir.output_id)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
modes = calloc(out->num_modes, sizeof(GLFWvidmode));
|
||||||
|
|
||||||
|
for (*found = 0; *found < out->num_modes; (*found)++)
|
||||||
|
{
|
||||||
|
modes[*found].width = out->modes[*found].horizontal_resolution;
|
||||||
|
modes[*found].height = out->modes[*found].vertical_resolution;
|
||||||
|
modes[*found].refreshRate = out->modes[*found].refresh_rate;
|
||||||
|
modes[*found].redBits = 8;
|
||||||
|
modes[*found].greenBits = 8;
|
||||||
|
modes[*found].blueBits = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mir_display_config_destroy(displayConfig);
|
||||||
|
|
||||||
|
return modes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
||||||
|
{
|
||||||
|
*mode = monitor->modes[monitor->mir.cur_mode];
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Mir - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#ifndef _mir_platform_h_
|
||||||
|
#define _mir_platform_h_
|
||||||
|
|
||||||
|
#include <mir_toolkit/mir_client_library.h>
|
||||||
|
|
||||||
|
#include "posix_tls.h"
|
||||||
|
#include "posix_time.h"
|
||||||
|
#include "linux_joystick.h"
|
||||||
|
|
||||||
|
#include <sys/queue.h>
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#if defined(_GLFW_EGL)
|
||||||
|
#include "egl_context.h"
|
||||||
|
#else
|
||||||
|
#error "The Mir backend depends on EGL platform support"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _GLFW_EGL_NATIVE_WINDOW window->mir.window
|
||||||
|
#define _GLFW_EGL_NATIVE_DISPLAY _glfw.mir.display
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowMir mir
|
||||||
|
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorMir mir
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryMir mir
|
||||||
|
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorMir mir
|
||||||
|
|
||||||
|
// Mir-specific Event Queue
|
||||||
|
//
|
||||||
|
typedef struct EventQueue
|
||||||
|
{
|
||||||
|
TAILQ_HEAD(, EventNode) head;
|
||||||
|
} EventQueue;
|
||||||
|
|
||||||
|
// Mir-specific per-window data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWwindowMir
|
||||||
|
{
|
||||||
|
MirSurface* surface;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
MirEGLNativeWindowType window;
|
||||||
|
|
||||||
|
} _GLFWwindowMir;
|
||||||
|
|
||||||
|
|
||||||
|
// Mir-specific per-monitor data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWmonitorMir
|
||||||
|
{
|
||||||
|
int cur_mode;
|
||||||
|
int output_id;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
} _GLFWmonitorMir;
|
||||||
|
|
||||||
|
|
||||||
|
// Mir-specific global data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWlibraryMir
|
||||||
|
{
|
||||||
|
MirConnection* connection;
|
||||||
|
MirEGLNativeDisplayType display;
|
||||||
|
EventQueue* event_queue;
|
||||||
|
|
||||||
|
pthread_mutex_t event_mutex;
|
||||||
|
pthread_cond_t event_cond;
|
||||||
|
|
||||||
|
} _GLFWlibraryMir;
|
||||||
|
|
||||||
|
|
||||||
|
// Mir-specific per-cursor data
|
||||||
|
// TODO: Only system cursors are implemented in Mir atm. Need to wait for support.
|
||||||
|
//
|
||||||
|
typedef struct _GLFWcursorMir
|
||||||
|
{
|
||||||
|
} _GLFWcursorMir;
|
||||||
|
|
||||||
|
|
||||||
|
extern void _glfwInitEventQueue(EventQueue* queue);
|
||||||
|
extern void _glfwDeleteEventQueue(EventQueue* queue);
|
||||||
|
|
||||||
|
#endif // _mir_platform_h_
|
||||||
@@ -0,0 +1,687 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Mir - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
#include "xkb_unicode.h"
|
||||||
|
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct EventNode
|
||||||
|
{
|
||||||
|
TAILQ_ENTRY(EventNode) entries;
|
||||||
|
MirEvent* event;
|
||||||
|
_GLFWwindow* window;
|
||||||
|
} EventNode;
|
||||||
|
|
||||||
|
static void deleteNode(EventQueue* queue, EventNode* node)
|
||||||
|
{
|
||||||
|
free(node->event);
|
||||||
|
free(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int emptyEventQueue(EventQueue* queue)
|
||||||
|
{
|
||||||
|
return queue->head.tqh_first == NULL ? GL_TRUE : GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static EventNode* newEventNode(MirEvent const* event, _GLFWwindow* context)
|
||||||
|
{
|
||||||
|
EventNode* new_node = calloc(1, sizeof(EventNode));
|
||||||
|
new_node->event = calloc(1, sizeof(MirEvent));
|
||||||
|
new_node->window = context;
|
||||||
|
|
||||||
|
memcpy(new_node->event, event, sizeof(MirEvent));
|
||||||
|
return new_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void enqueueEvent(MirEvent const* event, _GLFWwindow* context)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
EventNode* new_node = newEventNode(event, context);
|
||||||
|
TAILQ_INSERT_TAIL(&_glfw.mir.event_queue->head, new_node, entries);
|
||||||
|
|
||||||
|
pthread_cond_signal(&_glfw.mir.event_cond);
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&_glfw.mir.event_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
static EventNode* dequeueEvent(EventQueue* queue)
|
||||||
|
{
|
||||||
|
EventNode* node = NULL;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
node = queue->head.tqh_first;
|
||||||
|
|
||||||
|
if (node)
|
||||||
|
TAILQ_REMOVE(&queue->head, node, entries);
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MirPixelFormat findValidPixelFormat(void)
|
||||||
|
{
|
||||||
|
unsigned int i, validFormats, mirPixelFormats = 32;
|
||||||
|
MirPixelFormat formats[mir_pixel_formats];
|
||||||
|
|
||||||
|
mir_connection_get_available_surface_formats(_glfw.mir.connection, formats,
|
||||||
|
mirPixelFormats, &validFormats);
|
||||||
|
|
||||||
|
for (i = 0; i < validFormats; i++)
|
||||||
|
{
|
||||||
|
if (formats[i] == mir_pixel_format_abgr_8888 ||
|
||||||
|
formats[i] == mir_pixel_format_xbgr_8888 ||
|
||||||
|
formats[i] == mir_pixel_format_argb_8888 ||
|
||||||
|
formats[i] == mir_pixel_format_xrgb_8888)
|
||||||
|
{
|
||||||
|
return formats[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mir_pixel_format_invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mirModToGLFWMod(uint32_t mods)
|
||||||
|
{
|
||||||
|
int publicMods = 0x0;
|
||||||
|
|
||||||
|
if (mods & mir_key_modifier_alt)
|
||||||
|
publicMods |= GLFW_MOD_ALT;
|
||||||
|
else if (mods & mir_key_modifier_shift)
|
||||||
|
publicMods |= GLFW_MOD_SHIFT;
|
||||||
|
else if (mods & mir_key_modifier_ctrl)
|
||||||
|
publicMods |= GLFW_MOD_CONTROL;
|
||||||
|
else if (mods & mir_key_modifier_meta)
|
||||||
|
publicMods |= GLFW_MOD_SUPER;
|
||||||
|
|
||||||
|
return publicMods;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Taken from wl_init.c
|
||||||
|
static int toGLFWKeyCode(uint32_t key)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case KEY_GRAVE: return GLFW_KEY_GRAVE_ACCENT;
|
||||||
|
case KEY_1: return GLFW_KEY_1;
|
||||||
|
case KEY_2: return GLFW_KEY_2;
|
||||||
|
case KEY_3: return GLFW_KEY_3;
|
||||||
|
case KEY_4: return GLFW_KEY_4;
|
||||||
|
case KEY_5: return GLFW_KEY_5;
|
||||||
|
case KEY_6: return GLFW_KEY_6;
|
||||||
|
case KEY_7: return GLFW_KEY_7;
|
||||||
|
case KEY_8: return GLFW_KEY_8;
|
||||||
|
case KEY_9: return GLFW_KEY_9;
|
||||||
|
case KEY_0: return GLFW_KEY_0;
|
||||||
|
case KEY_MINUS: return GLFW_KEY_MINUS;
|
||||||
|
case KEY_EQUAL: return GLFW_KEY_EQUAL;
|
||||||
|
case KEY_Q: return GLFW_KEY_Q;
|
||||||
|
case KEY_W: return GLFW_KEY_W;
|
||||||
|
case KEY_E: return GLFW_KEY_E;
|
||||||
|
case KEY_R: return GLFW_KEY_R;
|
||||||
|
case KEY_T: return GLFW_KEY_T;
|
||||||
|
case KEY_Y: return GLFW_KEY_Y;
|
||||||
|
case KEY_U: return GLFW_KEY_U;
|
||||||
|
case KEY_I: return GLFW_KEY_I;
|
||||||
|
case KEY_O: return GLFW_KEY_O;
|
||||||
|
case KEY_P: return GLFW_KEY_P;
|
||||||
|
case KEY_LEFTBRACE: return GLFW_KEY_LEFT_BRACKET;
|
||||||
|
case KEY_RIGHTBRACE: return GLFW_KEY_RIGHT_BRACKET;
|
||||||
|
case KEY_A: return GLFW_KEY_A;
|
||||||
|
case KEY_S: return GLFW_KEY_S;
|
||||||
|
case KEY_D: return GLFW_KEY_D;
|
||||||
|
case KEY_F: return GLFW_KEY_F;
|
||||||
|
case KEY_G: return GLFW_KEY_G;
|
||||||
|
case KEY_H: return GLFW_KEY_H;
|
||||||
|
case KEY_J: return GLFW_KEY_J;
|
||||||
|
case KEY_K: return GLFW_KEY_K;
|
||||||
|
case KEY_L: return GLFW_KEY_L;
|
||||||
|
case KEY_SEMICOLON: return GLFW_KEY_SEMICOLON;
|
||||||
|
case KEY_APOSTROPHE: return GLFW_KEY_APOSTROPHE;
|
||||||
|
case KEY_Z: return GLFW_KEY_Z;
|
||||||
|
case KEY_X: return GLFW_KEY_X;
|
||||||
|
case KEY_C: return GLFW_KEY_C;
|
||||||
|
case KEY_V: return GLFW_KEY_V;
|
||||||
|
case KEY_B: return GLFW_KEY_B;
|
||||||
|
case KEY_N: return GLFW_KEY_N;
|
||||||
|
case KEY_M: return GLFW_KEY_M;
|
||||||
|
case KEY_COMMA: return GLFW_KEY_COMMA;
|
||||||
|
case KEY_DOT: return GLFW_KEY_PERIOD;
|
||||||
|
case KEY_SLASH: return GLFW_KEY_SLASH;
|
||||||
|
case KEY_BACKSLASH: return GLFW_KEY_BACKSLASH;
|
||||||
|
case KEY_ESC: return GLFW_KEY_ESCAPE;
|
||||||
|
case KEY_TAB: return GLFW_KEY_TAB;
|
||||||
|
case KEY_LEFTSHIFT: return GLFW_KEY_LEFT_SHIFT;
|
||||||
|
case KEY_RIGHTSHIFT: return GLFW_KEY_RIGHT_SHIFT;
|
||||||
|
case KEY_LEFTCTRL: return GLFW_KEY_LEFT_CONTROL;
|
||||||
|
case KEY_RIGHTCTRL: return GLFW_KEY_RIGHT_CONTROL;
|
||||||
|
case KEY_LEFTALT: return GLFW_KEY_LEFT_ALT;
|
||||||
|
case KEY_RIGHTALT: return GLFW_KEY_RIGHT_ALT;
|
||||||
|
case KEY_LEFTMETA: return GLFW_KEY_LEFT_SUPER;
|
||||||
|
case KEY_RIGHTMETA: return GLFW_KEY_RIGHT_SUPER;
|
||||||
|
case KEY_MENU: return GLFW_KEY_MENU;
|
||||||
|
case KEY_NUMLOCK: return GLFW_KEY_NUM_LOCK;
|
||||||
|
case KEY_CAPSLOCK: return GLFW_KEY_CAPS_LOCK;
|
||||||
|
case KEY_PRINT: return GLFW_KEY_PRINT_SCREEN;
|
||||||
|
case KEY_SCROLLLOCK: return GLFW_KEY_SCROLL_LOCK;
|
||||||
|
case KEY_PAUSE: return GLFW_KEY_PAUSE;
|
||||||
|
case KEY_DELETE: return GLFW_KEY_DELETE;
|
||||||
|
case KEY_BACKSPACE: return GLFW_KEY_BACKSPACE;
|
||||||
|
case KEY_ENTER: return GLFW_KEY_ENTER;
|
||||||
|
case KEY_HOME: return GLFW_KEY_HOME;
|
||||||
|
case KEY_END: return GLFW_KEY_END;
|
||||||
|
case KEY_PAGEUP: return GLFW_KEY_PAGE_UP;
|
||||||
|
case KEY_PAGEDOWN: return GLFW_KEY_PAGE_DOWN;
|
||||||
|
case KEY_INSERT: return GLFW_KEY_INSERT;
|
||||||
|
case KEY_LEFT: return GLFW_KEY_LEFT;
|
||||||
|
case KEY_RIGHT: return GLFW_KEY_RIGHT;
|
||||||
|
case KEY_DOWN: return GLFW_KEY_DOWN;
|
||||||
|
case KEY_UP: return GLFW_KEY_UP;
|
||||||
|
case KEY_F1: return GLFW_KEY_F1;
|
||||||
|
case KEY_F2: return GLFW_KEY_F2;
|
||||||
|
case KEY_F3: return GLFW_KEY_F3;
|
||||||
|
case KEY_F4: return GLFW_KEY_F4;
|
||||||
|
case KEY_F5: return GLFW_KEY_F5;
|
||||||
|
case KEY_F6: return GLFW_KEY_F6;
|
||||||
|
case KEY_F7: return GLFW_KEY_F7;
|
||||||
|
case KEY_F8: return GLFW_KEY_F8;
|
||||||
|
case KEY_F9: return GLFW_KEY_F9;
|
||||||
|
case KEY_F10: return GLFW_KEY_F10;
|
||||||
|
case KEY_F11: return GLFW_KEY_F11;
|
||||||
|
case KEY_F12: return GLFW_KEY_F12;
|
||||||
|
case KEY_F13: return GLFW_KEY_F13;
|
||||||
|
case KEY_F14: return GLFW_KEY_F14;
|
||||||
|
case KEY_F15: return GLFW_KEY_F15;
|
||||||
|
case KEY_F16: return GLFW_KEY_F16;
|
||||||
|
case KEY_F17: return GLFW_KEY_F17;
|
||||||
|
case KEY_F18: return GLFW_KEY_F18;
|
||||||
|
case KEY_F19: return GLFW_KEY_F19;
|
||||||
|
case KEY_F20: return GLFW_KEY_F20;
|
||||||
|
case KEY_F21: return GLFW_KEY_F21;
|
||||||
|
case KEY_F22: return GLFW_KEY_F22;
|
||||||
|
case KEY_F23: return GLFW_KEY_F23;
|
||||||
|
case KEY_F24: return GLFW_KEY_F24;
|
||||||
|
case KEY_KPSLASH: return GLFW_KEY_KP_DIVIDE;
|
||||||
|
case KEY_KPDOT: return GLFW_KEY_KP_MULTIPLY;
|
||||||
|
case KEY_KPMINUS: return GLFW_KEY_KP_SUBTRACT;
|
||||||
|
case KEY_KPPLUS: return GLFW_KEY_KP_ADD;
|
||||||
|
case KEY_KP0: return GLFW_KEY_KP_0;
|
||||||
|
case KEY_KP1: return GLFW_KEY_KP_1;
|
||||||
|
case KEY_KP2: return GLFW_KEY_KP_2;
|
||||||
|
case KEY_KP3: return GLFW_KEY_KP_3;
|
||||||
|
case KEY_KP4: return GLFW_KEY_KP_4;
|
||||||
|
case KEY_KP5: return GLFW_KEY_KP_5;
|
||||||
|
case KEY_KP6: return GLFW_KEY_KP_6;
|
||||||
|
case KEY_KP7: return GLFW_KEY_KP_7;
|
||||||
|
case KEY_KP8: return GLFW_KEY_KP_8;
|
||||||
|
case KEY_KP9: return GLFW_KEY_KP_9;
|
||||||
|
case KEY_KPCOMMA: return GLFW_KEY_KP_DECIMAL;
|
||||||
|
case KEY_KPEQUAL: return GLFW_KEY_KP_EQUAL;
|
||||||
|
case KEY_KPENTER: return GLFW_KEY_KP_ENTER;
|
||||||
|
default: return GLFW_KEY_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleKeyEvent(const MirKeyEvent key, _GLFWwindow* window)
|
||||||
|
{
|
||||||
|
const int pressed = key.action == mir_key_action_up ? GLFW_RELEASE : GLFW_PRESS;
|
||||||
|
const int mods = mirModToGLFWMod(key.modifiers);
|
||||||
|
const long text = _glfwKeySym2Unicode(key.key_code);
|
||||||
|
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
|
||||||
|
|
||||||
|
_glfwInputKey(window, toGLFWKeyCode(key.scan_code), key.scan_code, pressed, mods);
|
||||||
|
|
||||||
|
if (text != -1)
|
||||||
|
_glfwInputChar(window, text, mods, plain);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleMouseButton(_GLFWwindow* window,
|
||||||
|
int pressed, int mods, MirMotionButton button)
|
||||||
|
{
|
||||||
|
static int lastButton;
|
||||||
|
int publicButton;
|
||||||
|
const int publicMods = mirModToGLFWMod(mods);
|
||||||
|
|
||||||
|
switch (button)
|
||||||
|
{
|
||||||
|
case mir_motion_button_primary:
|
||||||
|
publicButton = GLFW_MOUSE_BUTTON_LEFT;
|
||||||
|
break;
|
||||||
|
case mir_motion_button_secondary:
|
||||||
|
publicButton = GLFW_MOUSE_BUTTON_RIGHT;
|
||||||
|
break;
|
||||||
|
case mir_motion_button_tertiary:
|
||||||
|
publicButton = GLFW_MOUSE_BUTTON_MIDDLE;
|
||||||
|
break;
|
||||||
|
case mir_motion_button_forward:
|
||||||
|
// FIXME What is the forward button?
|
||||||
|
publicButton = GLFW_MOUSE_BUTTON_4;
|
||||||
|
break;
|
||||||
|
case mir_motion_button_back:
|
||||||
|
// FIXME What is the back button?
|
||||||
|
publicButton = GLFW_MOUSE_BUTTON_5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
publicButton = lastButton;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastButton = publicButton;
|
||||||
|
|
||||||
|
_glfwInputMouseClick(window, publicButton, pressed, publicMods);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleMouseMotion(_GLFWwindow* window, int x, int y)
|
||||||
|
{
|
||||||
|
_glfwInputCursorMotion(window, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleMouseScroll(_GLFWwindow* window, int dx, int dy)
|
||||||
|
{
|
||||||
|
_glfwInputScroll(window, dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleMouseEvent(const MirMotionEvent motion,
|
||||||
|
int cord_index,
|
||||||
|
_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
switch (motion.action)
|
||||||
|
{
|
||||||
|
case mir_motion_action_down:
|
||||||
|
case mir_motion_action_pointer_down:
|
||||||
|
handleMouseButton(window, GLFW_PRESS,
|
||||||
|
motion.modifiers, motion.button_state);
|
||||||
|
break;
|
||||||
|
case mir_motion_action_up:
|
||||||
|
case mir_motion_action_pointer_up:
|
||||||
|
handleMouseButton(window, GLFW_RELEASE,
|
||||||
|
motion.modifiers, motion.button_state);
|
||||||
|
break;
|
||||||
|
case mir_motion_action_hover_move:
|
||||||
|
case mir_motion_action_move:
|
||||||
|
handleMouseMotion(window,
|
||||||
|
motion.pointer_coordinates[cord_index].x,
|
||||||
|
motion.pointer_coordinates[cord_index].y);
|
||||||
|
break;
|
||||||
|
case mir_motion_action_outside:
|
||||||
|
break;
|
||||||
|
case mir_motion_action_scroll:
|
||||||
|
handleMouseScroll(window,
|
||||||
|
motion.pointer_coordinates[cord_index].hscroll,
|
||||||
|
motion.pointer_coordinates[cord_index].vscroll);
|
||||||
|
break;
|
||||||
|
case mir_motion_action_cancel:
|
||||||
|
case mir_motion_action_hover_enter:
|
||||||
|
case mir_motion_action_hover_exit:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleMotionEvent(const MirMotionEvent motion, _GLFWwindow* window)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < motion.pointer_count; i++)
|
||||||
|
handleMouseEvent(motion, i, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleInput(MirEvent const* event, _GLFWwindow* window)
|
||||||
|
{
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case mir_event_type_key:
|
||||||
|
handleKeyEvent(event->key, window);
|
||||||
|
break;
|
||||||
|
case mir_event_type_motion:
|
||||||
|
handleMotionEvent(event->motion, window);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addNewEvent(MirSurface* surface, MirEvent const* event, void* context)
|
||||||
|
{
|
||||||
|
enqueueEvent(event, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int createSurface(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
MirSurfaceParameters params =
|
||||||
|
{
|
||||||
|
.name = "MirSurface",
|
||||||
|
.width = window->mir.width,
|
||||||
|
.height = window->mir.height,
|
||||||
|
.pixel_format = mir_pixel_format_invalid,
|
||||||
|
.buffer_usage = mir_buffer_usage_hardware,
|
||||||
|
.output_id = mir_display_output_id_invalid
|
||||||
|
};
|
||||||
|
|
||||||
|
MirEventDelegate delegate =
|
||||||
|
{
|
||||||
|
addNewEvent,
|
||||||
|
window
|
||||||
|
};
|
||||||
|
|
||||||
|
params.pixel_format = findValidPixelFormat();
|
||||||
|
if (params.pixel_format == mir_pixel_format_invalid)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unable to find a correct pixel format");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->mir.surface =
|
||||||
|
mir_connection_create_surface_sync(_glfw.mir.connection, ¶ms);
|
||||||
|
if (!mir_surface_is_valid(window->mir.surface))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unable to create surface: %s",
|
||||||
|
mir_surface_get_error_message(window->mir.surface));
|
||||||
|
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
mir_surface_set_event_handler(window->mir.surface, &delegate);
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void _glfwInitEventQueue(EventQueue* queue)
|
||||||
|
{
|
||||||
|
TAILQ_INIT(&queue->head);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwDeleteEventQueue(EventQueue* queue)
|
||||||
|
{
|
||||||
|
if (queue)
|
||||||
|
{
|
||||||
|
EventNode* node, *node_next;
|
||||||
|
node = queue->head.tqh_first;
|
||||||
|
|
||||||
|
while (node != NULL)
|
||||||
|
{
|
||||||
|
node_next = node->entries.tqe_next;
|
||||||
|
|
||||||
|
TAILQ_REMOVE(&queue->head, node, entries);
|
||||||
|
deleteNode(queue, node);
|
||||||
|
|
||||||
|
node = node_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
{
|
||||||
|
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
if (wndconfig->monitor)
|
||||||
|
{
|
||||||
|
GLFWvidmode mode;
|
||||||
|
_glfwPlatformGetVideoMode(wndconfig->monitor, &mode);
|
||||||
|
|
||||||
|
mir_surface_set_state(window->mir.surface, mir_surface_state_fullscreen);
|
||||||
|
|
||||||
|
if (wndconfig->width > mode.width || wndconfig->height > mode.height)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Requested surface size too large: %ix%i",
|
||||||
|
wndconfig->width, wndconfig->height);
|
||||||
|
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window->mir.width = wndconfig->width;
|
||||||
|
window->mir.height = wndconfig->height;
|
||||||
|
|
||||||
|
if (!createSurface(window))
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
window->mir.window = mir_surface_get_egl_native_window(window->mir.surface);
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (mir_surface_is_valid(window->mir.surface))
|
||||||
|
{
|
||||||
|
mir_surface_release_sync(window->mir.surface);
|
||||||
|
window->mir.surface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwDestroyContext(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
||||||
|
int* left, int* top,
|
||||||
|
int* right, int* bottom)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
||||||
|
{
|
||||||
|
if (width)
|
||||||
|
*width = window->mir.width;
|
||||||
|
if (height)
|
||||||
|
*height = window->mir.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
mir_surface_set_state(window->mir.surface, mir_surface_state_minimized);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
mir_surface_set_state(window->mir.surface, mir_surface_state_restored);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformPollEvents(void)
|
||||||
|
{
|
||||||
|
EventNode* node = NULL;
|
||||||
|
|
||||||
|
while ((node = dequeueEvent(_glfw.mir.event_queue)))
|
||||||
|
{
|
||||||
|
handleInput(node->event, node->window);
|
||||||
|
deleteNode(_glfw.mir.event_queue, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformWaitEvents(void)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
if (emptyEventQueue(_glfw.mir.event_queue))
|
||||||
|
pthread_cond_wait(&_glfw.mir.event_cond, &_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&_glfw.mir.event_mutex);
|
||||||
|
|
||||||
|
_glfwPlatformPollEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformPostEmptyEvent(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
|
||||||
|
{
|
||||||
|
if (width)
|
||||||
|
*width = window->mir.width;
|
||||||
|
if (height)
|
||||||
|
*height = window->mir.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
|
const GLFWimage* image,
|
||||||
|
int xhot, int yhot)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
+127
-48
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL framework
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -30,46 +27,34 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <float.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#define strdup _strdup
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Lexical comparison function for GLFW video modes, used by qsort
|
// Lexical comparison function for GLFW video modes, used by qsort
|
||||||
//
|
//
|
||||||
static int compareVideoModes(const void* firstPtr, const void* secondPtr)
|
static int compareVideoModes(const void* firstPtr, const void* secondPtr)
|
||||||
{
|
{
|
||||||
int firstBPP, secondBPP, firstSize, secondSize;
|
int firstBPP, secondBPP, firstSize, secondSize;
|
||||||
GLFWvidmode* first = (GLFWvidmode*) firstPtr;
|
const GLFWvidmode* first = firstPtr;
|
||||||
GLFWvidmode* second = (GLFWvidmode*) secondPtr;
|
const GLFWvidmode* second = secondPtr;
|
||||||
|
|
||||||
// First sort on color bits per pixel
|
// First sort on color bits per pixel
|
||||||
|
firstBPP = first->redBits + first->greenBits + first->blueBits;
|
||||||
firstBPP = first->redBits +
|
secondBPP = second->redBits + second->greenBits + second->blueBits;
|
||||||
first->greenBits +
|
|
||||||
first->blueBits;
|
|
||||||
secondBPP = second->redBits +
|
|
||||||
second->greenBits +
|
|
||||||
second->blueBits;
|
|
||||||
|
|
||||||
if (firstBPP != secondBPP)
|
if (firstBPP != secondBPP)
|
||||||
return firstBPP - secondBPP;
|
return firstBPP - secondBPP;
|
||||||
|
|
||||||
// Then sort on screen area, in pixels
|
// Then sort on screen area, in pixels
|
||||||
|
|
||||||
firstSize = first->width * first->height;
|
firstSize = first->width * first->height;
|
||||||
secondSize = second->width * second->height;
|
secondSize = second->width * second->height;
|
||||||
|
|
||||||
if (firstSize != secondSize)
|
if (firstSize != secondSize)
|
||||||
return firstSize - secondSize;
|
return firstSize - secondSize;
|
||||||
|
|
||||||
// Lastly sort on refresh rate
|
// Lastly sort on refresh rate
|
||||||
|
|
||||||
return first->refreshRate - second->refreshRate;
|
return first->refreshRate - second->refreshRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +101,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
{
|
{
|
||||||
if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j]))
|
if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j]))
|
||||||
{
|
{
|
||||||
_glfwDestroyMonitor(_glfw.monitors[i]);
|
_glfwFreeMonitor(_glfw.monitors[i]);
|
||||||
_glfw.monitors[i] = monitors[j];
|
_glfw.monitors[i] = monitors[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -144,8 +129,8 @@ void _glfwInputMonitorChange(void)
|
|||||||
window->monitor = NULL;
|
window->monitor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.monitorCallback)
|
if (_glfw.callbacks.monitor)
|
||||||
_glfw.monitorCallback((GLFWmonitor*) monitors[i], GLFW_DISCONNECTED);
|
_glfw.callbacks.monitor((GLFWmonitor*) monitors[i], GLFW_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find and report newly connected monitors (not in the old list)
|
// Find and report newly connected monitors (not in the old list)
|
||||||
@@ -166,11 +151,11 @@ void _glfwInputMonitorChange(void)
|
|||||||
if (j < monitorCount)
|
if (j < monitorCount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_glfw.monitorCallback)
|
if (_glfw.callbacks.monitor)
|
||||||
_glfw.monitorCallback((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
_glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwDestroyMonitors(monitors, monitorCount);
|
_glfwFreeMonitors(monitors, monitorCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -178,9 +163,9 @@ void _glfwInputMonitorChange(void)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
|
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
|
||||||
monitor->name = strdup(name);
|
monitor->name = strdup(name);
|
||||||
monitor->widthMM = widthMM;
|
monitor->widthMM = widthMM;
|
||||||
monitor->heightMM = heightMM;
|
monitor->heightMM = heightMM;
|
||||||
@@ -188,25 +173,42 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
|||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
if (monitor == NULL)
|
if (monitor == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_glfwFreeGammaRamp(&monitor->originalRamp);
|
_glfwFreeGammaArrays(&monitor->originalRamp);
|
||||||
_glfwFreeGammaRamp(&monitor->currentRamp);
|
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||||
|
|
||||||
free(monitor->modes);
|
free(monitor->modes);
|
||||||
free(monitor->name);
|
free(monitor->name);
|
||||||
free(monitor);
|
free(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count)
|
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
|
||||||
|
{
|
||||||
|
ramp->red = calloc(size, sizeof(unsigned short));
|
||||||
|
ramp->green = calloc(size, sizeof(unsigned short));
|
||||||
|
ramp->blue = calloc(size, sizeof(unsigned short));
|
||||||
|
ramp->size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwFreeGammaArrays(GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
free(ramp->red);
|
||||||
|
free(ramp->green);
|
||||||
|
free(ramp->blue);
|
||||||
|
|
||||||
|
memset(ramp, 0, sizeof(GLFWgammaramp));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
_glfwDestroyMonitor(monitors[i]);
|
_glfwFreeMonitor(monitors[i]);
|
||||||
|
|
||||||
free(monitors);
|
free(monitors);
|
||||||
}
|
}
|
||||||
@@ -228,15 +230,21 @@ const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
|
|||||||
{
|
{
|
||||||
current = monitor->modes + i;
|
current = monitor->modes + i;
|
||||||
|
|
||||||
colorDiff = abs((current->redBits + current->greenBits + current->blueBits) -
|
colorDiff = 0;
|
||||||
(desired->redBits + desired->greenBits + desired->blueBits));
|
|
||||||
|
if (desired->redBits != GLFW_DONT_CARE)
|
||||||
|
colorDiff += abs(current->redBits - desired->redBits);
|
||||||
|
if (desired->greenBits != GLFW_DONT_CARE)
|
||||||
|
colorDiff += abs(current->greenBits - desired->greenBits);
|
||||||
|
if (desired->blueBits != GLFW_DONT_CARE)
|
||||||
|
colorDiff += abs(current->blueBits - desired->blueBits);
|
||||||
|
|
||||||
sizeDiff = abs((current->width - desired->width) *
|
sizeDiff = abs((current->width - desired->width) *
|
||||||
(current->width - desired->width) +
|
(current->width - desired->width) +
|
||||||
(current->height - desired->height) *
|
(current->height - desired->height) *
|
||||||
(current->height - desired->height));
|
(current->height - desired->height));
|
||||||
|
|
||||||
if (desired->refreshRate)
|
if (desired->refreshRate != GLFW_DONT_CARE)
|
||||||
rateDiff = abs(current->refreshRate - desired->refreshRate);
|
rateDiff = abs(current->refreshRate - desired->refreshRate);
|
||||||
else
|
else
|
||||||
rateDiff = UINT_MAX - current->refreshRate;
|
rateDiff = UINT_MAX - current->refreshRate;
|
||||||
@@ -303,20 +311,32 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
|
|||||||
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
|
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = 0;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
_glfwPlatformGetMonitorPos(monitor, xpos, ypos);
|
_glfwPlatformGetMonitorPos(monitor, xpos, ypos);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* width, int* height)
|
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
|
if (widthMM)
|
||||||
|
*widthMM = 0;
|
||||||
|
if (heightMM)
|
||||||
|
*heightMM = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (width)
|
if (widthMM)
|
||||||
*width = monitor->widthMM;
|
*widthMM = monitor->widthMM;
|
||||||
if (height)
|
if (heightMM)
|
||||||
*height = monitor->heightMM;
|
*heightMM = monitor->heightMM;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
||||||
@@ -328,12 +348,9 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
|||||||
|
|
||||||
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
||||||
{
|
{
|
||||||
GLFWmonitorfun previous;
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(_glfw.callbacks.monitor, cbfun);
|
||||||
previous = _glfw.monitorCallback;
|
return cbfun;
|
||||||
_glfw.monitorCallback = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
||||||
@@ -361,3 +378,65 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
|
|||||||
return &monitor->currentMode;
|
return &monitor->currentMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned short values[256];
|
||||||
|
GLFWgammaramp ramp;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
|
||||||
|
// Calculate intensity
|
||||||
|
value = i / 255.0;
|
||||||
|
// Apply gamma curve
|
||||||
|
value = pow(value, 1.0 / gamma) * 65535.0 + 0.5;
|
||||||
|
|
||||||
|
// Clamp to value range
|
||||||
|
if (value > 65535.0)
|
||||||
|
value = 65535.0;
|
||||||
|
|
||||||
|
values[i] = (unsigned short) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ramp.red = values;
|
||||||
|
ramp.green = values;
|
||||||
|
ramp.blue = values;
|
||||||
|
ramp.size = 256;
|
||||||
|
|
||||||
|
glfwSetGammaRamp(handle, &ramp);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||||
|
_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp);
|
||||||
|
|
||||||
|
return &monitor->currentRamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (!monitor->originalRamp.size)
|
||||||
|
_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp);
|
||||||
|
|
||||||
|
_glfwPlatformSetGammaRamp(monitor, ramp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
// Platform: NSOpenGL
|
|
||||||
// API Version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@@ -27,41 +24,39 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#ifndef _nsgl_platform_h_
|
#ifndef _nsgl_context_h_
|
||||||
#define _nsgl_platform_h_
|
#define _nsgl_context_h_
|
||||||
|
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_FBCONFIG
|
#define _GLFW_PLATFORM_FBCONFIG
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl
|
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl
|
||||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryNSGL nsgl
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// NSGL-specific per-context data
|
||||||
// GLFW platform specific types
|
//
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific OpenGL context structure
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWcontextNSGL
|
typedef struct _GLFWcontextNSGL
|
||||||
{
|
{
|
||||||
id pixelFormat;
|
id pixelFormat;
|
||||||
id context;
|
id context;
|
||||||
|
|
||||||
} _GLFWcontextNSGL;
|
} _GLFWcontextNSGL;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// NSGL-specific global data
|
||||||
// Platform-specific library global data for NSGL
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWlibraryNSGL
|
typedef struct _GLFWlibraryNSGL
|
||||||
{
|
{
|
||||||
// dlopen handle for dynamically loading OpenGL extension entry points
|
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
|
||||||
void* framework;
|
void* framework;
|
||||||
|
|
||||||
// TLS key for per-thread current context/window
|
|
||||||
pthread_key_t current;
|
|
||||||
|
|
||||||
} _GLFWlibraryNSGL;
|
} _GLFWlibraryNSGL;
|
||||||
|
|
||||||
|
|
||||||
#endif // _nsgl_platform_h_
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
|
||||||
|
#endif // _nsgl_context_h_
|
||||||
+88
-76
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
// Platform: Cocoa/NSOpenGL
|
|
||||||
// API Version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@@ -29,8 +26,6 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
@@ -40,18 +35,14 @@
|
|||||||
//
|
//
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
if (pthread_key_create(&_glfw.nsgl.current, NULL) != 0)
|
if (!_glfwInitTLS())
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"NSOpenGL: Failed to create context TLS");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
_glfw.nsgl.framework =
|
_glfw.nsgl.framework =
|
||||||
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
||||||
if (_glfw.nsgl.framework == NULL)
|
if (_glfw.nsgl.framework == NULL)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"NSGL: Failed to locate OpenGL framework");
|
"NSGL: Failed to locate OpenGL framework");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -63,81 +54,63 @@ int _glfwInitContextAPI(void)
|
|||||||
//
|
//
|
||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
pthread_key_delete(_glfw.nsgl.current);
|
_glfwTerminateTLS();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the OpenGL context
|
// Create the OpenGL context
|
||||||
//
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
unsigned int attributeCount = 0;
|
unsigned int attributeCount = 0;
|
||||||
|
|
||||||
// Mac OS X needs non-zero color size, so set resonable values
|
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
int colorBits = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits;
|
|
||||||
if (colorBits == 0)
|
|
||||||
colorBits = 24;
|
|
||||||
else if (colorBits < 15)
|
|
||||||
colorBits = 15;
|
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: This API does not support OpenGL ES");
|
"NSGL: This API does not support OpenGL ES");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
// Fail if any OpenGL version above 2.1 other than 3.2 was requested
|
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
|
||||||
if (wndconfig->glMajor > 3 ||
|
|
||||||
(wndconfig->glMajor == 3 && wndconfig->glMinor != 2))
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X does not "
|
"NSGL: The targeted version of OS X does not support OpenGL 3.0 or 3.1");
|
||||||
"support any OpenGL version above 2.1 except 3.2");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glMajor > 2)
|
if (ctxconfig->major > 2)
|
||||||
{
|
{
|
||||||
if (!wndconfig->glForward)
|
if (!ctxconfig->forward)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X only "
|
"NSGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above");
|
||||||
"supports OpenGL 3.2 contexts if they are "
|
|
||||||
"forward-compatible");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
|
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X only "
|
"NSGL: The targeted version of OS X only supports core profile contexts for OpenGL 3.2 and above");
|
||||||
"supports OpenGL 3.2 contexts if they use the "
|
|
||||||
"core profile");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Fail if OpenGL 3.0 or above was requested
|
// Fail if OpenGL 3.0 or above was requested
|
||||||
if (wndconfig->glMajor > 2)
|
if (ctxconfig->major > 2)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X does not "
|
"NSGL: The targeted version of OS X does not support OpenGL version 3.0 or above");
|
||||||
"support OpenGL version 3.0 or above");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
|
||||||
// Fail if a robustness strategy was requested
|
// Context robustness modes (GL_KHR_robustness) are not yet supported on
|
||||||
if (wndconfig->glRobustness)
|
// OS X but are not a hard constraint, so ignore and continue
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
// Context release behaviors (GL_KHR_context_flush_control) are not yet
|
||||||
"NSOpenGL: Mac OS X does not support OpenGL robustness "
|
// supported on OS X but are not a hard constraint, so ignore and continue
|
||||||
"strategies");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ADD_ATTR(x) { attributes[attributeCount++] = x; }
|
#define ADD_ATTR(x) { attributes[attributeCount++] = x; }
|
||||||
#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); }
|
#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); }
|
||||||
@@ -145,45 +118,89 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
// Arbitrary array size here
|
// Arbitrary array size here
|
||||||
NSOpenGLPixelFormatAttribute attributes[40];
|
NSOpenGLPixelFormatAttribute attributes[40];
|
||||||
|
|
||||||
ADD_ATTR(NSOpenGLPFADoubleBuffer);
|
ADD_ATTR(NSOpenGLPFAAccelerated);
|
||||||
ADD_ATTR(NSOpenGLPFAClosestPolicy);
|
ADD_ATTR(NSOpenGLPFAClosestPolicy);
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
if (wndconfig->glMajor > 2)
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
|
||||||
|
if (ctxconfig->major >= 4)
|
||||||
|
{
|
||||||
|
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
if (ctxconfig->major >= 3)
|
||||||
|
{
|
||||||
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
|
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
|
||||||
|
}
|
||||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
|
||||||
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
|
if (ctxconfig->major <= 2)
|
||||||
|
{
|
||||||
|
if (fbconfig->auxBuffers != GLFW_DONT_CARE)
|
||||||
|
ADD_ATTR2(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
|
||||||
|
|
||||||
if (fbconfig->alphaBits > 0)
|
if (fbconfig->accumRedBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->accumGreenBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->accumBlueBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->accumAlphaBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
const int accumBits = fbconfig->accumRedBits +
|
||||||
|
fbconfig->accumGreenBits +
|
||||||
|
fbconfig->accumBlueBits +
|
||||||
|
fbconfig->accumAlphaBits;
|
||||||
|
|
||||||
|
ADD_ATTR2(NSOpenGLPFAAccumSize, accumBits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fbconfig->redBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->greenBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->blueBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
int colorBits = fbconfig->redBits +
|
||||||
|
fbconfig->greenBits +
|
||||||
|
fbconfig->blueBits;
|
||||||
|
|
||||||
|
// OS X needs non-zero color size, so set reasonable values
|
||||||
|
if (colorBits == 0)
|
||||||
|
colorBits = 24;
|
||||||
|
else if (colorBits < 15)
|
||||||
|
colorBits = 15;
|
||||||
|
|
||||||
|
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fbconfig->alphaBits != GLFW_DONT_CARE)
|
||||||
ADD_ATTR2(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
|
ADD_ATTR2(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
|
||||||
|
|
||||||
if (fbconfig->depthBits > 0)
|
if (fbconfig->depthBits != GLFW_DONT_CARE)
|
||||||
ADD_ATTR2(NSOpenGLPFADepthSize, fbconfig->depthBits);
|
ADD_ATTR2(NSOpenGLPFADepthSize, fbconfig->depthBits);
|
||||||
|
|
||||||
if (fbconfig->stencilBits > 0)
|
if (fbconfig->stencilBits != GLFW_DONT_CARE)
|
||||||
ADD_ATTR2(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
|
ADD_ATTR2(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
|
||||||
|
|
||||||
int accumBits = fbconfig->accumRedBits + fbconfig->accumGreenBits +
|
|
||||||
fbconfig->accumBlueBits + fbconfig->accumAlphaBits;
|
|
||||||
|
|
||||||
if (accumBits > 0)
|
|
||||||
ADD_ATTR2(NSOpenGLPFAAccumSize, accumBits);
|
|
||||||
|
|
||||||
if (fbconfig->auxBuffers > 0)
|
|
||||||
ADD_ATTR2(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
|
|
||||||
|
|
||||||
if (fbconfig->stereo)
|
if (fbconfig->stereo)
|
||||||
ADD_ATTR(NSOpenGLPFAStereo);
|
ADD_ATTR(NSOpenGLPFAStereo);
|
||||||
|
|
||||||
if (fbconfig->samples > 0)
|
if (fbconfig->doublebuffer)
|
||||||
|
ADD_ATTR(NSOpenGLPFADoubleBuffer);
|
||||||
|
|
||||||
|
if (fbconfig->samples != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
if (fbconfig->samples == 0)
|
||||||
|
{
|
||||||
|
ADD_ATTR2(NSOpenGLPFASampleBuffers, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ADD_ATTR2(NSOpenGLPFASampleBuffers, 1);
|
ADD_ATTR2(NSOpenGLPFASampleBuffers, 1);
|
||||||
ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples);
|
ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
|
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
|
||||||
// frambuffer, so there's no need (and no way) to request it
|
// framebuffer, so there's no need (and no way) to request it
|
||||||
|
|
||||||
ADD_ATTR(0);
|
ADD_ATTR(0);
|
||||||
|
|
||||||
@@ -195,22 +212,22 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (window->nsgl.pixelFormat == nil)
|
if (window->nsgl.pixelFormat == nil)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create OpenGL pixel format");
|
"NSGL: Failed to create OpenGL pixel format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSOpenGLContext* share = NULL;
|
NSOpenGLContext* share = NULL;
|
||||||
|
|
||||||
if (wndconfig->share)
|
if (ctxconfig->share)
|
||||||
share = wndconfig->share->nsgl.context;
|
share = ctxconfig->share->nsgl.context;
|
||||||
|
|
||||||
window->nsgl.context =
|
window->nsgl.context =
|
||||||
[[NSOpenGLContext alloc] initWithFormat:window->nsgl.pixelFormat
|
[[NSOpenGLContext alloc] initWithFormat:window->nsgl.pixelFormat
|
||||||
shareContext:share];
|
shareContext:share];
|
||||||
if (window->nsgl.context == nil)
|
if (window->nsgl.context == nil)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: Failed to create OpenGL context");
|
"NSGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,12 +257,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|||||||
else
|
else
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
|
||||||
pthread_setspecific(_glfw.nsgl.current, window);
|
_glfwSetCurrentContext(window);
|
||||||
}
|
|
||||||
|
|
||||||
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
|
||||||
{
|
|
||||||
return (_GLFWwindow*) pthread_getspecific(_glfw.nsgl.current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 POSIX - www.glfw.org
|
||||||
// Platform: X11
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -33,13 +30,12 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
// Return raw time
|
// Return raw time
|
||||||
//
|
//
|
||||||
static uint64_t getRawTime(void)
|
static uint64_t getRawTime(void)
|
||||||
{
|
{
|
||||||
#if defined(CLOCK_MONOTONIC)
|
#if defined(CLOCK_MONOTONIC)
|
||||||
if (_glfw.x11.timer.monotonic)
|
if (_glfw.posix_time.monotonic)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
@@ -70,16 +66,16 @@ void _glfwInitTimer(void)
|
|||||||
|
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
||||||
{
|
{
|
||||||
_glfw.x11.timer.monotonic = GL_TRUE;
|
_glfw.posix_time.monotonic = GL_TRUE;
|
||||||
_glfw.x11.timer.resolution = 1e-9;
|
_glfw.posix_time.resolution = 1e-9;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
_glfw.x11.timer.resolution = 1e-6;
|
_glfw.posix_time.resolution = 1e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfw.x11.timer.base = getRawTime();
|
_glfw.posix_time.base = getRawTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,13 +85,13 @@ void _glfwInitTimer(void)
|
|||||||
|
|
||||||
double _glfwPlatformGetTime(void)
|
double _glfwPlatformGetTime(void)
|
||||||
{
|
{
|
||||||
return (double) (getRawTime() - _glfw.x11.timer.base) *
|
return (double) (getRawTime() - _glfw.posix_time.base) *
|
||||||
_glfw.x11.timer.resolution;
|
_glfw.posix_time.resolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetTime(double time)
|
void _glfwPlatformSetTime(double time)
|
||||||
{
|
{
|
||||||
_glfw.x11.timer.base = getRawTime() -
|
_glfw.posix_time.base = getRawTime() -
|
||||||
(uint64_t) (time / _glfw.x11.timer.resolution);
|
(uint64_t) (time / _glfw.posix_time.resolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 POSIX - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -28,22 +25,25 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include "internal.h"
|
#ifndef _posix_time_h_
|
||||||
|
#define _posix_time_h_
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimePOSIX posix_time
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
// POSIX-specific global timer data
|
||||||
////// GLFW public API //////
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////
|
typedef struct _GLFWtimePOSIX
|
||||||
|
|
||||||
GLFWAPI double glfwGetTime(void)
|
|
||||||
{
|
{
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0.0);
|
GLboolean monotonic;
|
||||||
return _glfwPlatformGetTime();
|
double resolution;
|
||||||
}
|
uint64_t base;
|
||||||
|
|
||||||
GLFWAPI void glfwSetTime(double time)
|
} _GLFWtimePOSIX;
|
||||||
{
|
|
||||||
_GLFW_REQUIRE_INIT();
|
|
||||||
_glfwPlatformSetTime(time);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
void _glfwInitTimer(void);
|
||||||
|
|
||||||
|
#endif // _posix_time_h_
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 POSIX - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied
|
// This software is provided 'as-is', without any express or implied
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -29,25 +27,40 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <string.h>
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int _glfwInitTLS(void)
|
||||||
|
{
|
||||||
|
if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"POSIX: Failed to create context TLS");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateTLS(void)
|
||||||
|
{
|
||||||
|
pthread_key_delete(_glfw.posix_tls.context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwSetCurrentContext(_GLFWwindow* context)
|
||||||
|
{
|
||||||
|
pthread_setspecific(_glfw.posix_tls.context, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW public API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
return pthread_getspecific(_glfw.posix_tls.context);
|
||||||
_GLFW_REQUIRE_INIT();
|
|
||||||
_glfwPlatformSetClipboardString(window, string);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
|
||||||
{
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
|
||||||
return _glfwPlatformGetClipboardString(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 POSIX - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#ifndef _posix_tls_h_
|
||||||
|
#define _posix_tls_h_
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls
|
||||||
|
|
||||||
|
|
||||||
|
// POSIX-specific global TLS data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWtlsPOSIX
|
||||||
|
{
|
||||||
|
pthread_key_t context;
|
||||||
|
|
||||||
|
} _GLFWtlsPOSIX;
|
||||||
|
|
||||||
|
|
||||||
|
int _glfwInitTLS(void);
|
||||||
|
void _glfwTerminateTLS(void);
|
||||||
|
void _glfwSetCurrentContext(_GLFWwindow* context);
|
||||||
|
|
||||||
|
#endif // _posix_tls_h_
|
||||||
+133
-81
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 WGL - www.glfw.org
|
||||||
// Platform: Win32/WGL
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -60,6 +57,7 @@ static void initWGLExtensions(_GLFWwindow* window)
|
|||||||
window->wgl.ARB_create_context_robustness = GL_FALSE;
|
window->wgl.ARB_create_context_robustness = GL_FALSE;
|
||||||
window->wgl.EXT_swap_control = GL_FALSE;
|
window->wgl.EXT_swap_control = GL_FALSE;
|
||||||
window->wgl.ARB_pixel_format = GL_FALSE;
|
window->wgl.ARB_pixel_format = GL_FALSE;
|
||||||
|
window->wgl.ARB_context_flush_control = GL_FALSE;
|
||||||
|
|
||||||
window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
|
window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
|
||||||
wglGetProcAddress("wglGetExtensionsStringEXT");
|
wglGetProcAddress("wglGetExtensionsStringEXT");
|
||||||
@@ -122,6 +120,9 @@ static void initWGLExtensions(_GLFWwindow* window)
|
|||||||
if (window->wgl.GetPixelFormatAttribivARB)
|
if (window->wgl.GetPixelFormatAttribivARB)
|
||||||
window->wgl.ARB_pixel_format = GL_TRUE;
|
window->wgl.ARB_pixel_format = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfwPlatformExtensionSupported("WGL_ARB_context_flush_control"))
|
||||||
|
window->wgl.ARB_context_flush_control = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the specified attribute of the specified pixel format
|
// Returns the specified attribute of the specified pixel format
|
||||||
@@ -166,13 +167,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nativeCount)
|
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
usableConfigs = (_GLFWfbconfig*) calloc(nativeCount, sizeof(_GLFWfbconfig));
|
|
||||||
usableCount = 0;
|
usableCount = 0;
|
||||||
|
|
||||||
for (i = 0; i < nativeCount; i++)
|
for (i = 0; i < nativeCount; i++)
|
||||||
@@ -184,8 +179,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
// Get pixel format attributes through WGL_ARB_pixel_format
|
// Get pixel format attributes through WGL_ARB_pixel_format
|
||||||
if (!getPixelFormatAttrib(window, n, WGL_SUPPORT_OPENGL_ARB) ||
|
if (!getPixelFormatAttrib(window, n, WGL_SUPPORT_OPENGL_ARB) ||
|
||||||
!getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB) ||
|
!getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB))
|
||||||
!getPixelFormatAttrib(window, n, WGL_DOUBLE_BUFFER_ARB))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -216,13 +210,20 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
u->accumAlphaBits = getPixelFormatAttrib(window, n, WGL_ACCUM_ALPHA_BITS_ARB);
|
u->accumAlphaBits = getPixelFormatAttrib(window, n, WGL_ACCUM_ALPHA_BITS_ARB);
|
||||||
|
|
||||||
u->auxBuffers = getPixelFormatAttrib(window, n, WGL_AUX_BUFFERS_ARB);
|
u->auxBuffers = getPixelFormatAttrib(window, n, WGL_AUX_BUFFERS_ARB);
|
||||||
u->stereo = getPixelFormatAttrib(window, n, WGL_STEREO_ARB);
|
|
||||||
|
if (getPixelFormatAttrib(window, n, WGL_STEREO_ARB))
|
||||||
|
u->stereo = GL_TRUE;
|
||||||
|
if (getPixelFormatAttrib(window, n, WGL_DOUBLE_BUFFER_ARB))
|
||||||
|
u->doublebuffer = GL_TRUE;
|
||||||
|
|
||||||
if (window->wgl.ARB_multisample)
|
if (window->wgl.ARB_multisample)
|
||||||
u->samples = getPixelFormatAttrib(window, n, WGL_SAMPLES_ARB);
|
u->samples = getPixelFormatAttrib(window, n, WGL_SAMPLES_ARB);
|
||||||
|
|
||||||
if (window->wgl.ARB_framebuffer_sRGB)
|
if (window->wgl.ARB_framebuffer_sRGB)
|
||||||
u->sRGB = getPixelFormatAttrib(window, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
|
{
|
||||||
|
if (getPixelFormatAttrib(window, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB))
|
||||||
|
u->sRGB = GL_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -239,8 +240,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
|
if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
|
||||||
!(pfd.dwFlags & PFD_SUPPORT_OPENGL) ||
|
!(pfd.dwFlags & PFD_SUPPORT_OPENGL))
|
||||||
!(pfd.dwFlags & PFD_DOUBLEBUFFER))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -268,18 +268,38 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
u->accumAlphaBits = pfd.cAccumAlphaBits;
|
u->accumAlphaBits = pfd.cAccumAlphaBits;
|
||||||
|
|
||||||
u->auxBuffers = pfd.cAuxBuffers;
|
u->auxBuffers = pfd.cAuxBuffers;
|
||||||
u->stereo = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
|
|
||||||
|
if (pfd.dwFlags & PFD_STEREO)
|
||||||
|
u->stereo = GL_TRUE;
|
||||||
|
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
|
||||||
|
u->doublebuffer = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->wgl = n;
|
u->wgl = n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
if (!usableCount)
|
||||||
if (closest)
|
{
|
||||||
*result = closest->wgl;
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"WGL: The driver does not appear to support OpenGL");
|
||||||
|
|
||||||
free(usableConfigs);
|
free(usableConfigs);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
||||||
|
if (!closest)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"WGL: Failed to find a suitable pixel format");
|
||||||
|
|
||||||
|
free(usableConfigs);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*result = closest->wgl;
|
||||||
|
free(usableConfigs);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
@@ -293,16 +313,16 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
//
|
//
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
_glfw.wgl.current = TlsAlloc();
|
if (!_glfwInitTLS())
|
||||||
if (_glfw.wgl.current == TLS_OUT_OF_INDEXES)
|
return GL_FALSE;
|
||||||
|
|
||||||
|
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
|
||||||
|
if (!_glfw.wgl.opengl32.instance)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR, "WGL: Failed to load opengl32.dll");
|
||||||
"WGL: Failed to allocate TLS index");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfw.wgl.hasTLS = GL_TRUE;
|
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,21 +330,23 @@ int _glfwInitContextAPI(void)
|
|||||||
//
|
//
|
||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
if (_glfw.wgl.hasTLS)
|
if (_glfw.wgl.opengl32.instance)
|
||||||
TlsFree(_glfw.wgl.current);
|
FreeLibrary(_glfw.wgl.opengl32.instance);
|
||||||
|
|
||||||
|
_glfwTerminateTLS();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define setWGLattrib(attribName, attribValue) \
|
#define setWGLattrib(attribName, attribValue) \
|
||||||
{ \
|
{ \
|
||||||
attribs[index++] = attribName; \
|
attribs[index++] = attribName; \
|
||||||
attribs[index++] = attribValue; \
|
attribs[index++] = attribValue; \
|
||||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare for creation of the OpenGL context
|
// Create the OpenGL or OpenGL ES context
|
||||||
//
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
int attribs[40];
|
int attribs[40];
|
||||||
@@ -332,36 +354,31 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
HGLRC share = NULL;
|
HGLRC share = NULL;
|
||||||
|
|
||||||
if (wndconfig->share)
|
if (ctxconfig->share)
|
||||||
share = wndconfig->share->wgl.context;
|
share = ctxconfig->share->wgl.context;
|
||||||
|
|
||||||
window->wgl.dc = GetDC(window->win32.handle);
|
window->wgl.dc = GetDC(window->win32.handle);
|
||||||
if (!window->wgl.dc)
|
if (!window->wgl.dc)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve DC for window");
|
"WGL: Failed to retrieve DC for window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
|
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"WGL: Failed to find a suitable pixel format");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve PFD for selected pixel "
|
"WGL: Failed to retrieve PFD for selected pixel format");
|
||||||
"format");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetPixelFormat(window->wgl.dc, pixelFormat, &pfd))
|
if (!SetPixelFormat(window->wgl.dc, pixelFormat, &pfd))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to set selected pixel format");
|
"WGL: Failed to set selected pixel format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,42 +386,63 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
int index = 0, mask = 0, flags = 0, strategy = 0;
|
int index = 0, mask = 0, flags = 0, strategy = 0;
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
if (ctxconfig->api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glForward)
|
if (ctxconfig->forward)
|
||||||
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||||
|
|
||||||
if (wndconfig->glDebug)
|
if (ctxconfig->profile)
|
||||||
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
|
|
||||||
|
|
||||||
if (wndconfig->glProfile)
|
|
||||||
{
|
{
|
||||||
if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE)
|
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
|
||||||
mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE)
|
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
mask |= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
mask |= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT;
|
mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||||
|
|
||||||
if (wndconfig->glRobustness)
|
if (ctxconfig->debug)
|
||||||
|
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
|
||||||
|
|
||||||
|
if (ctxconfig->robustness)
|
||||||
{
|
{
|
||||||
if (window->wgl.ARB_create_context_robustness)
|
if (window->wgl.ARB_create_context_robustness)
|
||||||
{
|
{
|
||||||
if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION)
|
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
|
||||||
strategy = WGL_NO_RESET_NOTIFICATION_ARB;
|
strategy = WGL_NO_RESET_NOTIFICATION_ARB;
|
||||||
else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
strategy = WGL_LOSE_CONTEXT_ON_RESET_ARB;
|
strategy = WGL_LOSE_CONTEXT_ON_RESET_ARB;
|
||||||
|
|
||||||
flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB;
|
flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
if (ctxconfig->release)
|
||||||
{
|
{
|
||||||
setWGLattrib(WGL_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
|
if (window->wgl.ARB_context_flush_control)
|
||||||
setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
|
{
|
||||||
|
if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
|
||||||
|
{
|
||||||
|
setWGLattrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB,
|
||||||
|
WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
|
||||||
|
}
|
||||||
|
else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
{
|
||||||
|
setWGLattrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB,
|
||||||
|
WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
|
{
|
||||||
|
// NOTE: Only request an explicitly versioned context when
|
||||||
|
// necessary, as explicitly requesting version 1.0 does not
|
||||||
|
// always return the highest available version
|
||||||
|
|
||||||
|
setWGLattrib(WGL_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
|
||||||
|
setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
@@ -433,7 +471,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
window->wgl.context = wglCreateContext(window->wgl.dc);
|
window->wgl.context = wglCreateContext(window->wgl.dc);
|
||||||
if (!window->wgl.context)
|
if (!window->wgl.context)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: Failed to create OpenGL context");
|
"WGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -443,8 +481,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!wglShareLists(share, window->wgl.context))
|
if (!wglShareLists(share, window->wgl.context))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"WGL: Failed to enable sharing with specified "
|
"WGL: Failed to enable sharing with specified OpenGL context");
|
||||||
"OpenGL context");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,39 +515,42 @@ void _glfwDestroyContext(_GLFWwindow* window)
|
|||||||
// Analyzes the specified context for possible recreation
|
// Analyzes the specified context for possible recreation
|
||||||
//
|
//
|
||||||
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
GLboolean required = GL_FALSE;
|
GLboolean required = GL_FALSE;
|
||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
if (ctxconfig->api == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if (wndconfig->glForward)
|
if (ctxconfig->forward)
|
||||||
{
|
{
|
||||||
if (!window->wgl.ARB_create_context)
|
if (!window->wgl.ARB_create_context)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: A forward compatible OpenGL context "
|
"WGL: A forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable");
|
||||||
"requested but WGL_ARB_create_context is "
|
|
||||||
"unavailable");
|
|
||||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
required = GL_TRUE;
|
required = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glProfile)
|
if (ctxconfig->profile)
|
||||||
{
|
{
|
||||||
if (!window->wgl.ARB_create_context_profile)
|
if (!window->wgl.ARB_create_context_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: OpenGL profile requested but "
|
"WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable");
|
||||||
"WGL_ARB_create_context_profile is unavailable");
|
|
||||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
required = GL_TRUE;
|
required = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->release)
|
||||||
|
{
|
||||||
|
if (window->wgl.ARB_context_flush_control)
|
||||||
|
required = GL_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -518,22 +558,21 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
!window->wgl.ARB_create_context_profile ||
|
!window->wgl.ARB_create_context_profile ||
|
||||||
!window->wgl.EXT_create_context_es2_profile)
|
!window->wgl.EXT_create_context_es2_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"WGL: OpenGL ES requested but "
|
"WGL: OpenGL ES requested but WGL_ARB_create_context_es2_profile is unavailable");
|
||||||
"WGL_ARB_create_context_es2_profile is unavailable");
|
|
||||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
required = GL_TRUE;
|
required = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
{
|
{
|
||||||
if (window->wgl.ARB_create_context)
|
if (window->wgl.ARB_create_context)
|
||||||
required = GL_TRUE;
|
required = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->glDebug)
|
if (ctxconfig->debug)
|
||||||
{
|
{
|
||||||
if (window->wgl.ARB_create_context)
|
if (window->wgl.ARB_create_context)
|
||||||
required = GL_TRUE;
|
required = GL_TRUE;
|
||||||
@@ -551,6 +590,18 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fbconfig->sRGB)
|
||||||
|
{
|
||||||
|
// We want sRGB, but can we get it?
|
||||||
|
// sRGB is not a hard constraint, so otherwise we just don't care
|
||||||
|
|
||||||
|
if (window->wgl.ARB_framebuffer_sRGB && window->wgl.ARB_pixel_format)
|
||||||
|
{
|
||||||
|
// We appear to have both the extension and the means to ask for it
|
||||||
|
required = GL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (required)
|
if (required)
|
||||||
return _GLFW_RECREATION_REQUIRED;
|
return _GLFW_RECREATION_REQUIRED;
|
||||||
|
|
||||||
@@ -569,12 +620,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|||||||
else
|
else
|
||||||
wglMakeCurrent(NULL, NULL);
|
wglMakeCurrent(NULL, NULL);
|
||||||
|
|
||||||
TlsSetValue(_glfw.wgl.current, window);
|
_glfwSetCurrentContext(window);
|
||||||
}
|
|
||||||
|
|
||||||
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
|
||||||
{
|
|
||||||
return TlsGetValue(_glfw.wgl.current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
||||||
@@ -586,12 +632,14 @@ void _glfwPlatformSwapInterval(int interval)
|
|||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
if (_glfwIsCompositionEnabled())
|
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
|
||||||
|
if (_glfwIsCompositionEnabled() && interval)
|
||||||
{
|
{
|
||||||
// Don't enabled vsync when desktop compositing is enabled, as it leads
|
// Don't enabled vsync when desktop compositing is enabled, as it leads
|
||||||
// to frame jitter
|
// to frame jitter
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (window->wgl.EXT_swap_control)
|
if (window->wgl.EXT_swap_control)
|
||||||
window->wgl.SwapIntervalEXT(interval);
|
window->wgl.SwapIntervalEXT(interval);
|
||||||
@@ -628,7 +676,11 @@ int _glfwPlatformExtensionSupported(const char* extension)
|
|||||||
|
|
||||||
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
|
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
|
||||||
{
|
{
|
||||||
return (GLFWglproc) wglGetProcAddress(procname);
|
const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname);
|
||||||
|
if (proc)
|
||||||
|
return proc;
|
||||||
|
|
||||||
|
return (GLFWglproc) GetProcAddress(_glfw.wgl.opengl32.instance, procname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 WGL - www.glfw.org
|
||||||
// Platform: WGL
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -28,34 +25,27 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#ifndef _wgl_platform_h_
|
#ifndef _wgl_context_h_
|
||||||
#define _wgl_platform_h_
|
#define _wgl_context_h_
|
||||||
|
|
||||||
// This path may need to be changed if you build GLFW using your own setup
|
// This path may need to be changed if you build GLFW using your own setup
|
||||||
// We ship and use our own copy of wglext.h since GLFW uses fairly new
|
// We ship and use our own copy of wglext.h since GLFW uses fairly new
|
||||||
// extensions and not all operating systems come with an up-to-date version
|
// extensions and not all operating systems come with an up-to-date version
|
||||||
#include "../deps/GL/wglext.h"
|
#include "../deps/GL/wglext.h"
|
||||||
|
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_FBCONFIG int wgl
|
#define _GLFW_PLATFORM_FBCONFIG int wgl
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl
|
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl
|
||||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryWGL wgl
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// WGL-specific per-context data
|
||||||
// GLFW platform specific types
|
//
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific OpenGL context structure
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWcontextWGL
|
typedef struct _GLFWcontextWGL
|
||||||
{
|
{
|
||||||
// Platform specific window resources
|
|
||||||
HDC dc; // Private GDI device context
|
HDC dc; // Private GDI device context
|
||||||
HGLRC context; // Permanent rendering context
|
HGLRC context; // Permanent rendering context
|
||||||
|
|
||||||
// Platform specific extensions (context specific)
|
// WGL extensions (context specific)
|
||||||
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
|
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
|
||||||
PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
|
PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
|
||||||
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
|
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
|
||||||
@@ -69,18 +59,31 @@ typedef struct _GLFWcontextWGL
|
|||||||
GLboolean ARB_create_context_profile;
|
GLboolean ARB_create_context_profile;
|
||||||
GLboolean EXT_create_context_es2_profile;
|
GLboolean EXT_create_context_es2_profile;
|
||||||
GLboolean ARB_create_context_robustness;
|
GLboolean ARB_create_context_robustness;
|
||||||
|
GLboolean ARB_context_flush_control;
|
||||||
|
|
||||||
} _GLFWcontextWGL;
|
} _GLFWcontextWGL;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// WGL-specific global data
|
||||||
// Platform-specific library global data for WGL
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWlibraryWGL
|
typedef struct _GLFWlibraryWGL
|
||||||
{
|
{
|
||||||
GLboolean hasTLS;
|
// opengl32.dll (for glfwGetProcAddress)
|
||||||
DWORD current;
|
struct {
|
||||||
|
HINSTANCE instance;
|
||||||
|
} opengl32;
|
||||||
|
|
||||||
} _GLFWlibraryWGL;
|
} _GLFWlibraryWGL;
|
||||||
|
|
||||||
|
|
||||||
#endif // _wgl_platform_h_
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
|
||||||
|
#endif // _wgl_context_h_
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
//========================================================================
|
|
||||||
// GLFW - An OpenGL library
|
|
||||||
// Platform: Win32
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW platform API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|
||||||
{
|
|
||||||
WCHAR* wideString;
|
|
||||||
HANDLE stringHandle;
|
|
||||||
size_t wideSize;
|
|
||||||
|
|
||||||
wideString = _glfwCreateWideStringFromUTF8(string);
|
|
||||||
if (!wideString)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Win32: Failed to convert clipboard string to "
|
|
||||||
"wide string");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wideSize = (wcslen(wideString) + 1) * sizeof(WCHAR);
|
|
||||||
|
|
||||||
stringHandle = GlobalAlloc(GMEM_MOVEABLE, wideSize);
|
|
||||||
if (!stringHandle)
|
|
||||||
{
|
|
||||||
free(wideString);
|
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Win32: Failed to allocate global handle for clipboard");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(GlobalLock(stringHandle), wideString, wideSize);
|
|
||||||
GlobalUnlock(stringHandle);
|
|
||||||
|
|
||||||
if (!OpenClipboard(window->win32.handle))
|
|
||||||
{
|
|
||||||
GlobalFree(stringHandle);
|
|
||||||
free(wideString);
|
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EmptyClipboard();
|
|
||||||
SetClipboardData(CF_UNICODETEXT, stringHandle);
|
|
||||||
CloseClipboard();
|
|
||||||
|
|
||||||
free(wideString);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
HANDLE stringHandle;
|
|
||||||
|
|
||||||
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!OpenClipboard(window->win32.handle))
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
stringHandle = GetClipboardData(CF_UNICODETEXT);
|
|
||||||
if (!stringHandle)
|
|
||||||
{
|
|
||||||
CloseClipboard();
|
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Win32: Failed to retrieve clipboard data");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(_glfw.win32.clipboardString);
|
|
||||||
_glfw.win32.clipboardString =
|
|
||||||
_glfwCreateUTF8FromWideString(GlobalLock(stringHandle));
|
|
||||||
|
|
||||||
GlobalUnlock(stringHandle);
|
|
||||||
CloseClipboard();
|
|
||||||
|
|
||||||
if (!_glfw.win32.clipboardString)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Win32: Failed to convert wide string to UTF-8");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _glfw.win32.clipboardString;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
//========================================================================
|
|
||||||
// GLFW - An OpenGL library
|
|
||||||
// Platform: Win32
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW platform API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|
||||||
{
|
|
||||||
HDC dc;
|
|
||||||
WORD values[768];
|
|
||||||
DISPLAY_DEVICE display;
|
|
||||||
|
|
||||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICE));
|
|
||||||
display.cb = sizeof(DISPLAY_DEVICE);
|
|
||||||
EnumDisplayDevices(monitor->win32.name, 0, &display, 0);
|
|
||||||
|
|
||||||
dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL);
|
|
||||||
GetDeviceGammaRamp(dc, values);
|
|
||||||
DeleteDC(dc);
|
|
||||||
|
|
||||||
_glfwAllocGammaRamp(ramp, 256);
|
|
||||||
|
|
||||||
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
|
||||||
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
|
||||||
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|
||||||
{
|
|
||||||
HDC dc;
|
|
||||||
WORD values[768];
|
|
||||||
DISPLAY_DEVICE display;
|
|
||||||
|
|
||||||
if (ramp->size != 256)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Win32: Gamma ramp size must be 256");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short));
|
|
||||||
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
|
||||||
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
|
||||||
|
|
||||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICE));
|
|
||||||
display.cb = sizeof(DISPLAY_DEVICE);
|
|
||||||
EnumDisplayDevices(monitor->win32.name, 0, &display, 0);
|
|
||||||
|
|
||||||
dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL);
|
|
||||||
SetDeviceGammaRamp(dc, values);
|
|
||||||
DeleteDC(dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
+177
-54
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
// Platform: Win32/WGL
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -33,11 +30,15 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// With the Borland C++ compiler, we want to disable FPU exceptions
|
|
||||||
#include <float.h>
|
|
||||||
#endif // __BORLANDC__
|
|
||||||
|
|
||||||
|
#if defined(_GLFW_USE_OPTIMUS_HPG)
|
||||||
|
|
||||||
|
// Applications exporting this symbol with this value will be automatically
|
||||||
|
// directed to the high-performance GPU on Nvidia Optimus systems
|
||||||
|
//
|
||||||
|
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||||
|
|
||||||
|
#endif // _GLFW_USE_OPTIMUS_HPG
|
||||||
|
|
||||||
#if defined(_GLFW_BUILD_DLL)
|
#if defined(_GLFW_BUILD_DLL)
|
||||||
|
|
||||||
@@ -54,12 +55,13 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
|||||||
//
|
//
|
||||||
static GLboolean initLibraries(void)
|
static GLboolean initLibraries(void)
|
||||||
{
|
{
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
_glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll");
|
||||||
// winmm.dll (for joystick and timer support)
|
|
||||||
|
|
||||||
_glfw.win32.winmm.instance = LoadLibrary(L"winmm.dll");
|
|
||||||
if (!_glfw.win32.winmm.instance)
|
if (!_glfw.win32.winmm.instance)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to load winmm.dll");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
_glfw.win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T)
|
_glfw.win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T)
|
||||||
GetProcAddress(_glfw.win32.winmm.instance, "joyGetDevCapsW");
|
GetProcAddress(_glfw.win32.winmm.instance, "joyGetDevCapsW");
|
||||||
@@ -75,18 +77,21 @@ static GLboolean initLibraries(void)
|
|||||||
!_glfw.win32.winmm.joyGetPosEx ||
|
!_glfw.win32.winmm.joyGetPosEx ||
|
||||||
!_glfw.win32.winmm.timeGetTime)
|
!_glfw.win32.winmm.timeGetTime)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to load winmm functions");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
|
||||||
|
|
||||||
_glfw.win32.user32.instance = LoadLibrary(L"user32.dll");
|
_glfw.win32.user32.instance = LoadLibraryW(L"user32.dll");
|
||||||
if (_glfw.win32.user32.instance)
|
if (_glfw.win32.user32.instance)
|
||||||
{
|
{
|
||||||
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
|
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
|
||||||
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
|
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
|
||||||
|
_glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T)
|
||||||
|
GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfw.win32.dwmapi.instance = LoadLibrary(L"dwmapi.dll");
|
_glfw.win32.dwmapi.instance = LoadLibraryW(L"dwmapi.dll");
|
||||||
if (_glfw.win32.dwmapi.instance)
|
if (_glfw.win32.dwmapi.instance)
|
||||||
{
|
{
|
||||||
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T)
|
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T)
|
||||||
@@ -98,15 +103,144 @@ static GLboolean initLibraries(void)
|
|||||||
|
|
||||||
// Unload used libraries (DLLs)
|
// Unload used libraries (DLLs)
|
||||||
//
|
//
|
||||||
static void freeLibraries(void)
|
static void terminateLibraries(void)
|
||||||
{
|
{
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
if (_glfw.win32.winmm.instance)
|
||||||
if (_glfw.win32.winmm.instance != NULL)
|
|
||||||
{
|
|
||||||
FreeLibrary(_glfw.win32.winmm.instance);
|
FreeLibrary(_glfw.win32.winmm.instance);
|
||||||
_glfw.win32.winmm.instance = NULL;
|
|
||||||
}
|
if (_glfw.win32.user32.instance)
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
FreeLibrary(_glfw.win32.user32.instance);
|
||||||
|
|
||||||
|
if (_glfw.win32.dwmapi.instance)
|
||||||
|
FreeLibrary(_glfw.win32.dwmapi.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create key code translation tables
|
||||||
|
//
|
||||||
|
static void createKeyTables(void)
|
||||||
|
{
|
||||||
|
memset(_glfw.win32.publicKeys, -1, sizeof(_glfw.win32.publicKeys));
|
||||||
|
|
||||||
|
_glfw.win32.publicKeys[0x00B] = GLFW_KEY_0;
|
||||||
|
_glfw.win32.publicKeys[0x002] = GLFW_KEY_1;
|
||||||
|
_glfw.win32.publicKeys[0x003] = GLFW_KEY_2;
|
||||||
|
_glfw.win32.publicKeys[0x004] = GLFW_KEY_3;
|
||||||
|
_glfw.win32.publicKeys[0x005] = GLFW_KEY_4;
|
||||||
|
_glfw.win32.publicKeys[0x006] = GLFW_KEY_5;
|
||||||
|
_glfw.win32.publicKeys[0x007] = GLFW_KEY_6;
|
||||||
|
_glfw.win32.publicKeys[0x008] = GLFW_KEY_7;
|
||||||
|
_glfw.win32.publicKeys[0x009] = GLFW_KEY_8;
|
||||||
|
_glfw.win32.publicKeys[0x00A] = GLFW_KEY_9;
|
||||||
|
_glfw.win32.publicKeys[0x01E] = GLFW_KEY_A;
|
||||||
|
_glfw.win32.publicKeys[0x030] = GLFW_KEY_B;
|
||||||
|
_glfw.win32.publicKeys[0x02E] = GLFW_KEY_C;
|
||||||
|
_glfw.win32.publicKeys[0x020] = GLFW_KEY_D;
|
||||||
|
_glfw.win32.publicKeys[0x012] = GLFW_KEY_E;
|
||||||
|
_glfw.win32.publicKeys[0x021] = GLFW_KEY_F;
|
||||||
|
_glfw.win32.publicKeys[0x022] = GLFW_KEY_G;
|
||||||
|
_glfw.win32.publicKeys[0x023] = GLFW_KEY_H;
|
||||||
|
_glfw.win32.publicKeys[0x017] = GLFW_KEY_I;
|
||||||
|
_glfw.win32.publicKeys[0x024] = GLFW_KEY_J;
|
||||||
|
_glfw.win32.publicKeys[0x025] = GLFW_KEY_K;
|
||||||
|
_glfw.win32.publicKeys[0x026] = GLFW_KEY_L;
|
||||||
|
_glfw.win32.publicKeys[0x032] = GLFW_KEY_M;
|
||||||
|
_glfw.win32.publicKeys[0x031] = GLFW_KEY_N;
|
||||||
|
_glfw.win32.publicKeys[0x018] = GLFW_KEY_O;
|
||||||
|
_glfw.win32.publicKeys[0x019] = GLFW_KEY_P;
|
||||||
|
_glfw.win32.publicKeys[0x010] = GLFW_KEY_Q;
|
||||||
|
_glfw.win32.publicKeys[0x013] = GLFW_KEY_R;
|
||||||
|
_glfw.win32.publicKeys[0x01F] = GLFW_KEY_S;
|
||||||
|
_glfw.win32.publicKeys[0x014] = GLFW_KEY_T;
|
||||||
|
_glfw.win32.publicKeys[0x016] = GLFW_KEY_U;
|
||||||
|
_glfw.win32.publicKeys[0x02F] = GLFW_KEY_V;
|
||||||
|
_glfw.win32.publicKeys[0x011] = GLFW_KEY_W;
|
||||||
|
_glfw.win32.publicKeys[0x02D] = GLFW_KEY_X;
|
||||||
|
_glfw.win32.publicKeys[0x015] = GLFW_KEY_Y;
|
||||||
|
_glfw.win32.publicKeys[0x02C] = GLFW_KEY_Z;
|
||||||
|
|
||||||
|
_glfw.win32.publicKeys[0x028] = GLFW_KEY_APOSTROPHE;
|
||||||
|
_glfw.win32.publicKeys[0x02B] = GLFW_KEY_BACKSLASH;
|
||||||
|
_glfw.win32.publicKeys[0x033] = GLFW_KEY_COMMA;
|
||||||
|
_glfw.win32.publicKeys[0x00D] = GLFW_KEY_EQUAL;
|
||||||
|
_glfw.win32.publicKeys[0x029] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
|
_glfw.win32.publicKeys[0x01A] = GLFW_KEY_LEFT_BRACKET;
|
||||||
|
_glfw.win32.publicKeys[0x00C] = GLFW_KEY_MINUS;
|
||||||
|
_glfw.win32.publicKeys[0x034] = GLFW_KEY_PERIOD;
|
||||||
|
_glfw.win32.publicKeys[0x01B] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
|
_glfw.win32.publicKeys[0x027] = GLFW_KEY_SEMICOLON;
|
||||||
|
_glfw.win32.publicKeys[0x035] = GLFW_KEY_SLASH;
|
||||||
|
_glfw.win32.publicKeys[0x056] = GLFW_KEY_WORLD_2;
|
||||||
|
|
||||||
|
_glfw.win32.publicKeys[0x00E] = GLFW_KEY_BACKSPACE;
|
||||||
|
_glfw.win32.publicKeys[0x153] = GLFW_KEY_DELETE;
|
||||||
|
_glfw.win32.publicKeys[0x14F] = GLFW_KEY_END;
|
||||||
|
_glfw.win32.publicKeys[0x01C] = GLFW_KEY_ENTER;
|
||||||
|
_glfw.win32.publicKeys[0x001] = GLFW_KEY_ESCAPE;
|
||||||
|
_glfw.win32.publicKeys[0x147] = GLFW_KEY_HOME;
|
||||||
|
_glfw.win32.publicKeys[0x152] = GLFW_KEY_INSERT;
|
||||||
|
_glfw.win32.publicKeys[0x15D] = GLFW_KEY_MENU;
|
||||||
|
_glfw.win32.publicKeys[0x151] = GLFW_KEY_PAGE_DOWN;
|
||||||
|
_glfw.win32.publicKeys[0x149] = GLFW_KEY_PAGE_UP;
|
||||||
|
_glfw.win32.publicKeys[0x045] = GLFW_KEY_PAUSE;
|
||||||
|
_glfw.win32.publicKeys[0x039] = GLFW_KEY_SPACE;
|
||||||
|
_glfw.win32.publicKeys[0x00F] = GLFW_KEY_TAB;
|
||||||
|
_glfw.win32.publicKeys[0x03A] = GLFW_KEY_CAPS_LOCK;
|
||||||
|
_glfw.win32.publicKeys[0x145] = GLFW_KEY_NUM_LOCK;
|
||||||
|
_glfw.win32.publicKeys[0x046] = GLFW_KEY_SCROLL_LOCK;
|
||||||
|
_glfw.win32.publicKeys[0x03B] = GLFW_KEY_F1;
|
||||||
|
_glfw.win32.publicKeys[0x03C] = GLFW_KEY_F2;
|
||||||
|
_glfw.win32.publicKeys[0x03D] = GLFW_KEY_F3;
|
||||||
|
_glfw.win32.publicKeys[0x03E] = GLFW_KEY_F4;
|
||||||
|
_glfw.win32.publicKeys[0x03F] = GLFW_KEY_F5;
|
||||||
|
_glfw.win32.publicKeys[0x040] = GLFW_KEY_F6;
|
||||||
|
_glfw.win32.publicKeys[0x041] = GLFW_KEY_F7;
|
||||||
|
_glfw.win32.publicKeys[0x042] = GLFW_KEY_F8;
|
||||||
|
_glfw.win32.publicKeys[0x043] = GLFW_KEY_F9;
|
||||||
|
_glfw.win32.publicKeys[0x044] = GLFW_KEY_F10;
|
||||||
|
_glfw.win32.publicKeys[0x057] = GLFW_KEY_F11;
|
||||||
|
_glfw.win32.publicKeys[0x058] = GLFW_KEY_F12;
|
||||||
|
_glfw.win32.publicKeys[0x064] = GLFW_KEY_F13;
|
||||||
|
_glfw.win32.publicKeys[0x065] = GLFW_KEY_F14;
|
||||||
|
_glfw.win32.publicKeys[0x066] = GLFW_KEY_F15;
|
||||||
|
_glfw.win32.publicKeys[0x067] = GLFW_KEY_F16;
|
||||||
|
_glfw.win32.publicKeys[0x068] = GLFW_KEY_F17;
|
||||||
|
_glfw.win32.publicKeys[0x069] = GLFW_KEY_F18;
|
||||||
|
_glfw.win32.publicKeys[0x06A] = GLFW_KEY_F19;
|
||||||
|
_glfw.win32.publicKeys[0x06B] = GLFW_KEY_F20;
|
||||||
|
_glfw.win32.publicKeys[0x06C] = GLFW_KEY_F21;
|
||||||
|
_glfw.win32.publicKeys[0x06D] = GLFW_KEY_F22;
|
||||||
|
_glfw.win32.publicKeys[0x06E] = GLFW_KEY_F23;
|
||||||
|
_glfw.win32.publicKeys[0x076] = GLFW_KEY_F24;
|
||||||
|
_glfw.win32.publicKeys[0x038] = GLFW_KEY_LEFT_ALT;
|
||||||
|
_glfw.win32.publicKeys[0x01D] = GLFW_KEY_LEFT_CONTROL;
|
||||||
|
_glfw.win32.publicKeys[0x02A] = GLFW_KEY_LEFT_SHIFT;
|
||||||
|
_glfw.win32.publicKeys[0x15B] = GLFW_KEY_LEFT_SUPER;
|
||||||
|
_glfw.win32.publicKeys[0x137] = GLFW_KEY_PRINT_SCREEN;
|
||||||
|
_glfw.win32.publicKeys[0x138] = GLFW_KEY_RIGHT_ALT;
|
||||||
|
_glfw.win32.publicKeys[0x11D] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
|
_glfw.win32.publicKeys[0x036] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
|
_glfw.win32.publicKeys[0x15C] = GLFW_KEY_RIGHT_SUPER;
|
||||||
|
_glfw.win32.publicKeys[0x150] = GLFW_KEY_DOWN;
|
||||||
|
_glfw.win32.publicKeys[0x14B] = GLFW_KEY_LEFT;
|
||||||
|
_glfw.win32.publicKeys[0x14D] = GLFW_KEY_RIGHT;
|
||||||
|
_glfw.win32.publicKeys[0x148] = GLFW_KEY_UP;
|
||||||
|
|
||||||
|
_glfw.win32.publicKeys[0x052] = GLFW_KEY_KP_0;
|
||||||
|
_glfw.win32.publicKeys[0x04F] = GLFW_KEY_KP_1;
|
||||||
|
_glfw.win32.publicKeys[0x050] = GLFW_KEY_KP_2;
|
||||||
|
_glfw.win32.publicKeys[0x051] = GLFW_KEY_KP_3;
|
||||||
|
_glfw.win32.publicKeys[0x04B] = GLFW_KEY_KP_4;
|
||||||
|
_glfw.win32.publicKeys[0x04C] = GLFW_KEY_KP_5;
|
||||||
|
_glfw.win32.publicKeys[0x04D] = GLFW_KEY_KP_6;
|
||||||
|
_glfw.win32.publicKeys[0x047] = GLFW_KEY_KP_7;
|
||||||
|
_glfw.win32.publicKeys[0x048] = GLFW_KEY_KP_8;
|
||||||
|
_glfw.win32.publicKeys[0x049] = GLFW_KEY_KP_9;
|
||||||
|
_glfw.win32.publicKeys[0x04E] = GLFW_KEY_KP_ADD;
|
||||||
|
_glfw.win32.publicKeys[0x053] = GLFW_KEY_KP_DECIMAL;
|
||||||
|
_glfw.win32.publicKeys[0x135] = GLFW_KEY_KP_DIVIDE;
|
||||||
|
_glfw.win32.publicKeys[0x11C] = GLFW_KEY_KP_ENTER;
|
||||||
|
_glfw.win32.publicKeys[0x037] = GLFW_KEY_KP_MULTIPLY;
|
||||||
|
_glfw.win32.publicKeys[0x04A] = GLFW_KEY_KP_SUBTRACT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -140,9 +274,9 @@ WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
|
|||||||
if (!length)
|
if (!length)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
target = (WCHAR*) malloc(sizeof(WCHAR) * (length + 1));
|
target = calloc(length, sizeof(WCHAR));
|
||||||
|
|
||||||
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length + 1))
|
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length))
|
||||||
{
|
{
|
||||||
free(target);
|
free(target);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -162,9 +296,9 @@ char* _glfwCreateUTF8FromWideString(const WCHAR* source)
|
|||||||
if (!length)
|
if (!length)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
target = (char*) malloc(length + 1);
|
target = calloc(length, sizeof(char));
|
||||||
|
|
||||||
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length + 1, NULL, NULL))
|
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length, NULL, NULL))
|
||||||
{
|
{
|
||||||
free(target);
|
free(target);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -183,28 +317,26 @@ int _glfwPlatformInit(void)
|
|||||||
// To make SetForegroundWindow work as we want, we need to fiddle
|
// To make SetForegroundWindow work as we want, we need to fiddle
|
||||||
// with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
|
// with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
|
||||||
// as possible in the hope of still being the foreground process)
|
// as possible in the hope of still being the foreground process)
|
||||||
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
|
SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
|
||||||
&_glfw.win32.foregroundLockTimeout, 0);
|
&_glfw.win32.foregroundLockTimeout, 0);
|
||||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
|
SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
|
||||||
SPIF_SENDCHANGE);
|
SPIF_SENDCHANGE);
|
||||||
|
|
||||||
if (!initLibraries())
|
if (!initLibraries())
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
|
createKeyTables();
|
||||||
|
|
||||||
if (_glfw_SetProcessDPIAware)
|
if (_glfw_SetProcessDPIAware)
|
||||||
_glfw_SetProcessDPIAware();
|
_glfw_SetProcessDPIAware();
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
if (!_glfwRegisterWindowClass())
|
||||||
// With the Borland C++ compiler, we want to disable FPU exceptions
|
return GL_FALSE;
|
||||||
// (this is recommended for OpenGL applications under Windows)
|
|
||||||
_control87(MCW_EM, MCW_EM);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_glfwInitContextAPI())
|
if (!_glfwInitContextAPI())
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
_glfwInitTimer();
|
_glfwInitTimer();
|
||||||
|
|
||||||
_glfwInitJoysticks();
|
_glfwInitJoysticks();
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
@@ -212,27 +344,23 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
void _glfwPlatformTerminate(void)
|
void _glfwPlatformTerminate(void)
|
||||||
{
|
{
|
||||||
if (_glfw.win32.classAtom)
|
_glfwUnregisterWindowClass();
|
||||||
{
|
|
||||||
UnregisterClass(_GLFW_WNDCLASSNAME, GetModuleHandle(NULL));
|
|
||||||
_glfw.win32.classAtom = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwTerminateContextAPI();
|
// Restore previous foreground lock timeout system setting
|
||||||
|
SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
||||||
_glfwTerminateJoysticks();
|
|
||||||
|
|
||||||
freeLibraries();
|
|
||||||
|
|
||||||
// Restore previous FOREGROUNDLOCKTIMEOUT system setting
|
|
||||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
|
||||||
UIntToPtr(_glfw.win32.foregroundLockTimeout),
|
UIntToPtr(_glfw.win32.foregroundLockTimeout),
|
||||||
SPIF_SENDCHANGE);
|
SPIF_SENDCHANGE);
|
||||||
|
|
||||||
|
free(_glfw.win32.clipboardString);
|
||||||
|
|
||||||
|
_glfwTerminateJoysticks();
|
||||||
|
_glfwTerminateContextAPI();
|
||||||
|
terminateLibraries();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
{
|
{
|
||||||
const char* version = _GLFW_VERSION_FULL " Win32"
|
const char* version = _GLFW_VERSION_NUMBER " Win32"
|
||||||
#if defined(_GLFW_WGL)
|
#if defined(_GLFW_WGL)
|
||||||
" WGL"
|
" WGL"
|
||||||
#elif defined(_GLFW_EGL)
|
#elif defined(_GLFW_EGL)
|
||||||
@@ -241,12 +369,7 @@ const char* _glfwPlatformGetVersionString(void)
|
|||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
" MinGW"
|
" MinGW"
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
" VisualC "
|
" VisualC"
|
||||||
#elif defined(__BORLANDC__)
|
|
||||||
" BorlandC"
|
|
||||||
#endif
|
|
||||||
#if !defined(_GLFW_NO_DLOAD_WINMM)
|
|
||||||
" LoadLibrary(winmm)"
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(_GLFW_BUILD_DLL)
|
#if defined(_GLFW_BUILD_DLL)
|
||||||
" DLL"
|
" DLL"
|
||||||
|
|||||||
+127
-66
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
// Platform: X11 (Unix)
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -54,16 +51,15 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
{
|
{
|
||||||
GLFWvidmode current;
|
GLFWvidmode current;
|
||||||
const GLFWvidmode* best;
|
const GLFWvidmode* best;
|
||||||
DEVMODE dm;
|
DEVMODEW dm;
|
||||||
|
|
||||||
best = _glfwChooseVideoMode(monitor, desired);
|
best = _glfwChooseVideoMode(monitor, desired);
|
||||||
|
|
||||||
_glfwPlatformGetVideoMode(monitor, ¤t);
|
_glfwPlatformGetVideoMode(monitor, ¤t);
|
||||||
if (_glfwCompareVideoModes(¤t, best) == 0)
|
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
||||||
ZeroMemory(&dm, sizeof(dm));
|
ZeroMemory(&dm, sizeof(dm));
|
||||||
dm.dmSize = sizeof(DEVMODE);
|
dm.dmSize = sizeof(DEVMODEW);
|
||||||
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL |
|
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL |
|
||||||
DM_DISPLAYFREQUENCY;
|
DM_DISPLAYFREQUENCY;
|
||||||
dm.dmPelsWidth = best->width;
|
dm.dmPelsWidth = best->width;
|
||||||
@@ -74,7 +70,7 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
if (dm.dmBitsPerPel < 15 || dm.dmBitsPerPel >= 24)
|
if (dm.dmBitsPerPel < 15 || dm.dmBitsPerPel >= 24)
|
||||||
dm.dmBitsPerPel = 32;
|
dm.dmBitsPerPel = 32;
|
||||||
|
|
||||||
if (ChangeDisplaySettingsEx(monitor->win32.name,
|
if (ChangeDisplaySettingsExW(monitor->win32.adapterName,
|
||||||
&dm,
|
&dm,
|
||||||
NULL,
|
NULL,
|
||||||
CDS_FULLSCREEN,
|
CDS_FULLSCREEN,
|
||||||
@@ -84,6 +80,7 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
monitor->win32.modeChanged = GL_TRUE;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,8 +88,12 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
//
|
//
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
ChangeDisplaySettingsEx(monitor->win32.name,
|
if (monitor->win32.modeChanged)
|
||||||
|
{
|
||||||
|
ChangeDisplaySettingsExW(monitor->win32.adapterName,
|
||||||
NULL, NULL, CDS_FULLSCREEN, NULL);
|
NULL, NULL, CDS_FULLSCREEN, NULL);
|
||||||
|
monitor->win32.modeChanged = GL_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,77 +105,81 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
{
|
{
|
||||||
int size = 0, found = 0;
|
int size = 0, found = 0;
|
||||||
_GLFWmonitor** monitors = NULL;
|
_GLFWmonitor** monitors = NULL;
|
||||||
DWORD adapterIndex = 0;
|
DWORD adapterIndex, displayIndex;
|
||||||
int primaryIndex = 0;
|
|
||||||
|
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
for (;;)
|
for (adapterIndex = 0; ; adapterIndex++)
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE adapter, display;
|
DISPLAY_DEVICEW adapter;
|
||||||
|
|
||||||
|
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICEW));
|
||||||
|
adapter.cb = sizeof(DISPLAY_DEVICEW);
|
||||||
|
|
||||||
|
if (!EnumDisplayDevicesW(NULL, adapterIndex, &adapter, 0))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (displayIndex = 0; ; displayIndex++)
|
||||||
|
{
|
||||||
|
DISPLAY_DEVICEW display;
|
||||||
char* name;
|
char* name;
|
||||||
HDC dc;
|
HDC dc;
|
||||||
|
|
||||||
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICE));
|
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
|
||||||
adapter.cb = sizeof(DISPLAY_DEVICE);
|
display.cb = sizeof(DISPLAY_DEVICEW);
|
||||||
|
|
||||||
if (!EnumDisplayDevices(NULL, adapterIndex, &adapter, 0))
|
if (!EnumDisplayDevicesW(adapter.DeviceName, displayIndex, &display, 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
adapterIndex++;
|
|
||||||
|
|
||||||
if ((adapter.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ||
|
|
||||||
!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found == size)
|
if (found == size)
|
||||||
{
|
{
|
||||||
if (size)
|
size += 4;
|
||||||
size *= 2;
|
monitors = realloc(monitors, sizeof(_GLFWmonitor*) * size);
|
||||||
else
|
|
||||||
size = 4;
|
|
||||||
|
|
||||||
monitors = (_GLFWmonitor**) realloc(monitors, sizeof(_GLFWmonitor*) * size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICE));
|
|
||||||
display.cb = sizeof(DISPLAY_DEVICE);
|
|
||||||
|
|
||||||
EnumDisplayDevices(adapter.DeviceName, 0, &display, 0);
|
|
||||||
dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL);
|
|
||||||
|
|
||||||
if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
|
|
||||||
primaryIndex = found;
|
|
||||||
|
|
||||||
name = _glfwCreateUTF8FromWideString(display.DeviceString);
|
name = _glfwCreateUTF8FromWideString(display.DeviceString);
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
_glfwDestroyMonitors(monitors, found);
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Failed to convert string to UTF-8");
|
"Win32: Failed to convert string to UTF-8");
|
||||||
|
continue;
|
||||||
free(monitors);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
monitors[found] = _glfwCreateMonitor(name,
|
dc = CreateDCW(L"DISPLAY", adapter.DeviceName, NULL, NULL);
|
||||||
|
|
||||||
|
monitors[found] = _glfwAllocMonitor(name,
|
||||||
GetDeviceCaps(dc, HORZSIZE),
|
GetDeviceCaps(dc, HORZSIZE),
|
||||||
GetDeviceCaps(dc, VERTSIZE));
|
GetDeviceCaps(dc, VERTSIZE));
|
||||||
|
|
||||||
free(name);
|
|
||||||
DeleteDC(dc);
|
DeleteDC(dc);
|
||||||
|
free(name);
|
||||||
|
|
||||||
wcscpy(monitors[found]->win32.name, adapter.DeviceName);
|
wcscpy(monitors[found]->win32.adapterName, adapter.DeviceName);
|
||||||
found++;
|
wcscpy(monitors[found]->win32.displayName, display.DeviceName);
|
||||||
|
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0,
|
||||||
|
adapter.DeviceName, -1,
|
||||||
|
monitors[found]->win32.publicAdapterName,
|
||||||
|
sizeof(monitors[found]->win32.publicAdapterName),
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0,
|
||||||
|
display.DeviceName, -1,
|
||||||
|
monitors[found]->win32.publicDisplayName,
|
||||||
|
sizeof(monitors[found]->win32.publicDisplayName),
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
|
if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE &&
|
||||||
|
displayIndex == 0)
|
||||||
|
{
|
||||||
|
_GLFW_SWAP_POINTERS(monitors[0], monitors[found]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (primaryIndex > 0)
|
found++;
|
||||||
{
|
}
|
||||||
_GLFWmonitor* temp = monitors[0];
|
|
||||||
monitors[0] = monitors[primaryIndex];
|
|
||||||
monitors[primaryIndex] = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*count = found;
|
*count = found;
|
||||||
@@ -183,16 +188,16 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
|
|
||||||
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
||||||
{
|
{
|
||||||
return wcscmp(first->win32.name, second->win32.name) == 0;
|
return wcscmp(first->win32.displayName, second->win32.displayName) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
DEVMODE settings;
|
DEVMODEW settings;
|
||||||
ZeroMemory(&settings, sizeof(DEVMODE));
|
ZeroMemory(&settings, sizeof(DEVMODEW));
|
||||||
settings.dmSize = sizeof(DEVMODE);
|
settings.dmSize = sizeof(DEVMODEW);
|
||||||
|
|
||||||
EnumDisplaySettingsEx(monitor->win32.name,
|
EnumDisplaySettingsExW(monitor->win32.adapterName,
|
||||||
ENUM_CURRENT_SETTINGS,
|
ENUM_CURRENT_SETTINGS,
|
||||||
&settings,
|
&settings,
|
||||||
EDS_ROTATEDMODE);
|
EDS_ROTATEDMODE);
|
||||||
@@ -214,12 +219,12 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GLFWvidmode mode;
|
GLFWvidmode mode;
|
||||||
DEVMODE dm;
|
DEVMODEW dm;
|
||||||
|
|
||||||
ZeroMemory(&dm, sizeof(DEVMODE));
|
ZeroMemory(&dm, sizeof(DEVMODEW));
|
||||||
dm.dmSize = sizeof(DEVMODE);
|
dm.dmSize = sizeof(DEVMODEW);
|
||||||
|
|
||||||
if (!EnumDisplaySettings(monitor->win32.name, modeIndex, &dm))
|
if (!EnumDisplaySettingsW(monitor->win32.adapterName, modeIndex, &dm))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
modeIndex++;
|
modeIndex++;
|
||||||
@@ -269,12 +274,12 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
|
|
||||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
DEVMODE dm;
|
DEVMODEW dm;
|
||||||
|
|
||||||
ZeroMemory(&dm, sizeof(DEVMODE));
|
ZeroMemory(&dm, sizeof(DEVMODEW));
|
||||||
dm.dmSize = sizeof(DEVMODE);
|
dm.dmSize = sizeof(DEVMODEW);
|
||||||
|
|
||||||
EnumDisplaySettings(monitor->win32.name, ENUM_CURRENT_SETTINGS, &dm);
|
EnumDisplaySettingsW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm);
|
||||||
|
|
||||||
mode->width = dm.dmPelsWidth;
|
mode->width = dm.dmPelsWidth;
|
||||||
mode->height = dm.dmPelsHeight;
|
mode->height = dm.dmPelsHeight;
|
||||||
@@ -285,3 +290,59 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
&mode->blueBits);
|
&mode->blueBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
HDC dc;
|
||||||
|
WORD values[768];
|
||||||
|
|
||||||
|
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||||
|
GetDeviceGammaRamp(dc, values);
|
||||||
|
DeleteDC(dc);
|
||||||
|
|
||||||
|
_glfwAllocGammaArrays(ramp, 256);
|
||||||
|
|
||||||
|
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
||||||
|
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
||||||
|
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
HDC dc;
|
||||||
|
WORD values[768];
|
||||||
|
|
||||||
|
if (ramp->size != 256)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Gamma ramp size must be 256");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short));
|
||||||
|
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
||||||
|
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
||||||
|
|
||||||
|
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||||
|
SetDeviceGammaRamp(dc, values);
|
||||||
|
DeleteDC(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return monitor->win32.publicAdapterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return monitor->win32.publicDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+98
-104
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
// Platform: Win32
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -45,9 +42,9 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (to
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
// correctly declare a GL_ARB_debug_output callback, for example) but windows.h
|
// example to allow applications to correctly declare a GL_ARB_debug_output
|
||||||
// thinks it is the only one that gets to do so
|
// callback) but windows.h assumes no one will define APIENTRY before it does
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
|
|
||||||
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
||||||
@@ -55,19 +52,27 @@
|
|||||||
#define UNICODE
|
#define UNICODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GLFW requires Windows XP
|
// GLFW requires Windows XP or later
|
||||||
#ifndef WINVER
|
#if WINVER < 0x0501
|
||||||
|
#undef WINVER
|
||||||
#define WINVER 0x0501
|
#define WINVER 0x0501
|
||||||
#endif
|
#endif
|
||||||
|
#if _WIN32_WINNT < 0x0501
|
||||||
|
#undef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0501
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <dbt.h>
|
#include <dbt.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <malloc.h>
|
||||||
|
#define strdup _strdup
|
||||||
|
#endif
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Hack: Define things that some windows.h variants don't
|
// HACK: Define macros that some older windows.h variants don't
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#ifndef WM_MOUSEHWHEEL
|
#ifndef WM_MOUSEHWHEEL
|
||||||
#define WM_MOUSEHWHEEL 0x020E
|
#define WM_MOUSEHWHEEL 0x020E
|
||||||
@@ -75,108 +80,101 @@
|
|||||||
#ifndef WM_DWMCOMPOSITIONCHANGED
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
||||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef WM_COPYGLOBALDATA
|
||||||
|
#define WM_COPYGLOBALDATA 0x0049
|
||||||
|
#endif
|
||||||
|
#ifndef WM_UNICHAR
|
||||||
|
#define WM_UNICHAR 0x0109
|
||||||
|
#endif
|
||||||
|
#ifndef UNICODE_NOCHAR
|
||||||
|
#define UNICODE_NOCHAR 0xFFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if WINVER < 0x0601
|
||||||
|
typedef struct tagCHANGEFILTERSTRUCT
|
||||||
|
{
|
||||||
|
DWORD cbSize;
|
||||||
|
DWORD ExtStatus;
|
||||||
|
|
||||||
|
} CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT;
|
||||||
|
#ifndef MSGFLT_ALLOW
|
||||||
|
#define MSGFLT_ALLOW 1
|
||||||
|
#endif
|
||||||
|
#endif /*Windows 7*/
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// DLLs that are loaded at glfwInit()
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
// winmm.dll function pointer typedefs
|
// winmm.dll function pointer typedefs
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
|
||||||
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT);
|
typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
|
||||||
typedef MMRESULT (WINAPI * JOYGETPOS_T) (UINT,LPJOYINFO);
|
typedef MMRESULT (WINAPI * JOYGETPOSEX_T)(UINT,LPJOYINFOEX);
|
||||||
typedef MMRESULT (WINAPI * JOYGETPOSEX_T) (UINT,LPJOYINFOEX);
|
typedef DWORD (WINAPI * TIMEGETTIME_T)(void);
|
||||||
typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
|
#define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
#define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos
|
||||||
|
#define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx
|
||||||
|
#define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime
|
||||||
// winmm.dll shortcuts
|
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
|
||||||
#define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps
|
|
||||||
#define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos
|
|
||||||
#define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx
|
|
||||||
#define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime
|
|
||||||
#else
|
|
||||||
#define _glfw_joyGetDevCaps joyGetDevCaps
|
|
||||||
#define _glfw_joyGetPos joyGetPos
|
|
||||||
#define _glfw_joyGetPosEx joyGetPosEx
|
|
||||||
#define _glfw_timeGetTime timeGetTime
|
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
|
||||||
|
|
||||||
// user32.dll function pointer typedefs
|
// user32.dll function pointer typedefs
|
||||||
typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
|
typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
|
||||||
|
typedef BOOL (WINAPI * CHANGEWINDOWMESSAGEFILTEREX_T)(HWND,UINT,DWORD,PCHANGEFILTERSTRUCT);
|
||||||
#define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware
|
#define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware
|
||||||
|
#define _glfw_ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx
|
||||||
|
|
||||||
// dwmapi.dll function pointer typedefs
|
// dwmapi.dll function pointer typedefs
|
||||||
typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
|
typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
|
||||||
#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
|
#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
|
||||||
|
|
||||||
|
|
||||||
// We use versioned window class names in order not to cause conflicts
|
|
||||||
// between applications using different versions of GLFW
|
|
||||||
#define _GLFW_WNDCLASSNAME L"GLFW30"
|
|
||||||
|
|
||||||
#define _GLFW_RECREATION_NOT_NEEDED 0
|
#define _GLFW_RECREATION_NOT_NEEDED 0
|
||||||
#define _GLFW_RECREATION_REQUIRED 1
|
#define _GLFW_RECREATION_REQUIRED 1
|
||||||
#define _GLFW_RECREATION_IMPOSSIBLE 2
|
#define _GLFW_RECREATION_IMPOSSIBLE 2
|
||||||
|
|
||||||
|
|
||||||
|
#include "win32_tls.h"
|
||||||
|
|
||||||
#if defined(_GLFW_WGL)
|
#if defined(_GLFW_WGL)
|
||||||
#include "wgl_platform.h"
|
#include "wgl_context.h"
|
||||||
#elif defined(_GLFW_EGL)
|
#elif defined(_GLFW_EGL)
|
||||||
#define _GLFW_EGL_NATIVE_WINDOW window->win32.handle
|
#define _GLFW_EGL_NATIVE_WINDOW window->win32.handle
|
||||||
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
|
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
|
||||||
#include "egl_platform.h"
|
#include "egl_context.h"
|
||||||
#else
|
#else
|
||||||
#error "No supported context creation API selected"
|
#error "No supported context creation API selected"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "winmm_joystick.h"
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
|
||||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimeWin32 win32_time
|
||||||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
|
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
|
||||||
|
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// Win32-specific per-window data
|
||||||
// GLFW platform specific types
|
//
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Platform-specific window structure
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWwindowWin32
|
typedef struct _GLFWwindowWin32
|
||||||
{
|
{
|
||||||
// Platform specific window resources
|
HWND handle;
|
||||||
HWND handle; // Window handle
|
DWORD dwStyle;
|
||||||
DWORD dwStyle; // Window styles used for window creation
|
DWORD dwExStyle;
|
||||||
DWORD dwExStyle; // --"--
|
|
||||||
|
|
||||||
// Various platform specific internal variables
|
|
||||||
GLboolean cursorCentered;
|
|
||||||
GLboolean cursorInside;
|
GLboolean cursorInside;
|
||||||
GLboolean cursorHidden;
|
GLboolean iconified;
|
||||||
double oldCursorX, oldCursorY;
|
|
||||||
|
// The last received cursor position, regardless of source
|
||||||
|
int cursorPosX, cursorPosY;
|
||||||
|
|
||||||
} _GLFWwindowWin32;
|
} _GLFWwindowWin32;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// Win32-specific global data
|
||||||
// Platform-specific library global data for Win32
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWlibraryWin32
|
typedef struct _GLFWlibraryWin32
|
||||||
{
|
{
|
||||||
ATOM classAtom;
|
|
||||||
DWORD foregroundLockTimeout;
|
DWORD foregroundLockTimeout;
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
short int publicKeys[512];
|
||||||
|
|
||||||
// Timer data
|
|
||||||
struct {
|
|
||||||
GLboolean hasPC;
|
|
||||||
double resolution;
|
|
||||||
unsigned int t0_32;
|
|
||||||
__int64 t0_64;
|
|
||||||
} timer;
|
|
||||||
|
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
|
||||||
// winmm.dll
|
// winmm.dll
|
||||||
struct {
|
struct {
|
||||||
HINSTANCE instance;
|
HINSTANCE instance;
|
||||||
@@ -185,12 +183,12 @@ typedef struct _GLFWlibraryWin32
|
|||||||
JOYGETPOSEX_T joyGetPosEx;
|
JOYGETPOSEX_T joyGetPosEx;
|
||||||
TIMEGETTIME_T timeGetTime;
|
TIMEGETTIME_T timeGetTime;
|
||||||
} winmm;
|
} winmm;
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
|
||||||
|
|
||||||
// user32.dll
|
// user32.dll
|
||||||
struct {
|
struct {
|
||||||
HINSTANCE instance;
|
HINSTANCE instance;
|
||||||
SETPROCESSDPIAWARE_T SetProcessDPIAware;
|
SETPROCESSDPIAWARE_T SetProcessDPIAware;
|
||||||
|
CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx;
|
||||||
} user32;
|
} user32;
|
||||||
|
|
||||||
// dwmapi.dll
|
// dwmapi.dll
|
||||||
@@ -199,58 +197,54 @@ typedef struct _GLFWlibraryWin32
|
|||||||
DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled;
|
DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled;
|
||||||
} dwmapi;
|
} dwmapi;
|
||||||
|
|
||||||
struct {
|
|
||||||
float axes[6];
|
|
||||||
unsigned char buttons[36]; // 32 buttons plus one hat
|
|
||||||
char* name;
|
|
||||||
} joystick[GLFW_JOYSTICK_LAST + 1];
|
|
||||||
|
|
||||||
} _GLFWlibraryWin32;
|
} _GLFWlibraryWin32;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// Win32-specific per-monitor data
|
||||||
// Platform-specific monitor structure
|
//
|
||||||
//------------------------------------------------------------------------
|
|
||||||
typedef struct _GLFWmonitorWin32
|
typedef struct _GLFWmonitorWin32
|
||||||
{
|
{
|
||||||
// This size matches the static size of DISPLAY_DEVICE.DeviceName
|
// This size matches the static size of DISPLAY_DEVICE.DeviceName
|
||||||
WCHAR name[32];
|
WCHAR adapterName[32];
|
||||||
|
WCHAR displayName[32];
|
||||||
|
char publicAdapterName[64];
|
||||||
|
char publicDisplayName[64];
|
||||||
|
GLboolean modeChanged;
|
||||||
|
|
||||||
} _GLFWmonitorWin32;
|
} _GLFWmonitorWin32;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
// Win32-specific per-cursor data
|
||||||
// Prototypes for platform specific internal functions
|
//
|
||||||
//========================================================================
|
typedef struct _GLFWcursorWin32
|
||||||
|
{
|
||||||
|
HCURSOR handle;
|
||||||
|
|
||||||
|
} _GLFWcursorWin32;
|
||||||
|
|
||||||
|
|
||||||
|
// Win32-specific global timer data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWtimeWin32
|
||||||
|
{
|
||||||
|
GLboolean hasPC;
|
||||||
|
double resolution;
|
||||||
|
unsigned __int64 base;
|
||||||
|
|
||||||
|
} _GLFWtimeWin32;
|
||||||
|
|
||||||
|
|
||||||
|
GLboolean _glfwRegisterWindowClass(void);
|
||||||
|
void _glfwUnregisterWindowClass(void);
|
||||||
|
|
||||||
// Desktop compositing
|
|
||||||
BOOL _glfwIsCompositionEnabled(void);
|
BOOL _glfwIsCompositionEnabled(void);
|
||||||
|
|
||||||
// Wide strings
|
|
||||||
WCHAR* _glfwCreateWideStringFromUTF8(const char* source);
|
WCHAR* _glfwCreateWideStringFromUTF8(const char* source);
|
||||||
char* _glfwCreateUTF8FromWideString(const WCHAR* source);
|
char* _glfwCreateUTF8FromWideString(const WCHAR* source);
|
||||||
|
|
||||||
// Time
|
|
||||||
void _glfwInitTimer(void);
|
void _glfwInitTimer(void);
|
||||||
|
|
||||||
// Joystick input
|
|
||||||
void _glfwInitJoysticks(void);
|
|
||||||
void _glfwTerminateJoysticks(void);
|
|
||||||
|
|
||||||
// OpenGL support
|
|
||||||
int _glfwInitContextAPI(void);
|
|
||||||
void _glfwTerminateContextAPI(void);
|
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window);
|
|
||||||
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
|
|
||||||
// Fullscreen support
|
|
||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
|
||||||
#endif // _win32_platform_h_
|
#endif // _win32_platform_h_
|
||||||
|
|||||||
+29
-34
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
// Platform: Win32
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -31,6 +28,21 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Return raw time
|
||||||
|
//
|
||||||
|
static unsigned __int64 getRawTime(void)
|
||||||
|
{
|
||||||
|
if (_glfw.win32_time.hasPC)
|
||||||
|
{
|
||||||
|
unsigned __int64 time;
|
||||||
|
QueryPerformanceCounter((LARGE_INTEGER*) &time);
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (unsigned __int64) _glfw_timeGetTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@@ -39,20 +51,20 @@
|
|||||||
//
|
//
|
||||||
void _glfwInitTimer(void)
|
void _glfwInitTimer(void)
|
||||||
{
|
{
|
||||||
__int64 freq;
|
unsigned __int64 frequency;
|
||||||
|
|
||||||
if (QueryPerformanceFrequency((LARGE_INTEGER*) &freq))
|
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
|
||||||
{
|
{
|
||||||
_glfw.win32.timer.hasPC = GL_TRUE;
|
_glfw.win32_time.hasPC = GL_TRUE;
|
||||||
_glfw.win32.timer.resolution = 1.0 / (double) freq;
|
_glfw.win32_time.resolution = 1.0 / (double) frequency;
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &_glfw.win32.timer.t0_64);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_glfw.win32.timer.hasPC = GL_FALSE;
|
_glfw.win32_time.hasPC = GL_FALSE;
|
||||||
_glfw.win32.timer.resolution = 0.001; // winmm resolution is 1 ms
|
_glfw.win32_time.resolution = 0.001; // winmm resolution is 1 ms
|
||||||
_glfw.win32.timer.t0_32 = _glfw_timeGetTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfw.win32_time.base = getRawTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -62,30 +74,13 @@ void _glfwInitTimer(void)
|
|||||||
|
|
||||||
double _glfwPlatformGetTime(void)
|
double _glfwPlatformGetTime(void)
|
||||||
{
|
{
|
||||||
double t;
|
return (double) (getRawTime() - _glfw.win32_time.base) *
|
||||||
__int64 t_64;
|
_glfw.win32_time.resolution;
|
||||||
|
|
||||||
if (_glfw.win32.timer.hasPC)
|
|
||||||
{
|
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &t_64);
|
|
||||||
t = (double)(t_64 - _glfw.win32.timer.t0_64);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
t = (double)(_glfw_timeGetTime() - _glfw.win32.timer.t0_32);
|
|
||||||
|
|
||||||
return t * _glfw.win32.timer.resolution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetTime(double t)
|
void _glfwPlatformSetTime(double time)
|
||||||
{
|
{
|
||||||
__int64 t_64;
|
_glfw.win32_time.base = getRawTime() -
|
||||||
|
(unsigned __int64) (time / _glfw.win32_time.resolution);
|
||||||
if (_glfw.win32.timer.hasPC)
|
|
||||||
{
|
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &t_64);
|
|
||||||
_glfw.win32.timer.t0_64 = t_64 - (__int64) (t / _glfw.win32.timer.resolution);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_glfw.win32.timer.t0_32 = _glfw_timeGetTime() - (int)(t * 1000.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int _glfwInitTLS(void)
|
||||||
|
{
|
||||||
|
_glfw.win32_tls.context = TlsAlloc();
|
||||||
|
if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to allocate TLS index");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.win32_tls.allocated = GL_TRUE;
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateTLS(void)
|
||||||
|
{
|
||||||
|
if (_glfw.win32_tls.allocated)
|
||||||
|
TlsFree(_glfw.win32_tls.context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwSetCurrentContext(_GLFWwindow* context)
|
||||||
|
{
|
||||||
|
TlsSetValue(_glfw.win32_tls.context, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
||||||
|
{
|
||||||
|
return TlsGetValue(_glfw.win32_tls.context);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#ifndef _win32_tls_h_
|
||||||
|
#define _win32_tls_h_
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsWin32 win32_tls
|
||||||
|
|
||||||
|
|
||||||
|
// Win32-specific global TLS data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWtlsWin32
|
||||||
|
{
|
||||||
|
GLboolean allocated;
|
||||||
|
DWORD context;
|
||||||
|
|
||||||
|
} _GLFWtlsWin32;
|
||||||
|
|
||||||
|
|
||||||
|
int _glfwInitTLS(void);
|
||||||
|
void _glfwTerminateTLS(void);
|
||||||
|
void _glfwSetCurrentContext(_GLFWwindow* context);
|
||||||
|
|
||||||
|
#endif // _win32_tls_h_
|
||||||
+546
-387
File diff suppressed because it is too large
Load Diff
+196
-163
@@ -1,8 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW - An OpenGL library
|
// GLFW 3.1 - www.glfw.org
|
||||||
// Platform: Any
|
|
||||||
// API version: 3.0
|
|
||||||
// WWW: http://www.glfw.org/
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@@ -33,17 +30,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Return the maxiumum of the specified values
|
|
||||||
//
|
|
||||||
static int Max(int a, int b)
|
|
||||||
{
|
|
||||||
return (a > b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@@ -53,18 +39,13 @@ static int Max(int a, int b)
|
|||||||
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
|
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
|
||||||
{
|
{
|
||||||
if (focused)
|
if (focused)
|
||||||
{
|
|
||||||
if (_glfw.focusedWindow != window)
|
|
||||||
{
|
{
|
||||||
_glfw.focusedWindow = window;
|
_glfw.focusedWindow = window;
|
||||||
|
|
||||||
if (window->callbacks.focus)
|
if (window->callbacks.focus)
|
||||||
window->callbacks.focus((GLFWwindow*) window, focused);
|
window->callbacks.focus((GLFWwindow*) window, focused);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (_glfw.focusedWindow == window)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -76,18 +57,17 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
|
|||||||
// Release all pressed keyboard keys
|
// Release all pressed keyboard keys
|
||||||
for (i = 0; i <= GLFW_KEY_LAST; i++)
|
for (i = 0; i <= GLFW_KEY_LAST; i++)
|
||||||
{
|
{
|
||||||
if (window->key[i] == GLFW_PRESS)
|
if (window->keys[i] == GLFW_PRESS)
|
||||||
_glfwInputKey(window, i, 0, GLFW_RELEASE, 0);
|
_glfwInputKey(window, i, 0, GLFW_RELEASE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release all pressed mouse buttons
|
// Release all pressed mouse buttons
|
||||||
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
|
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
|
||||||
{
|
{
|
||||||
if (window->mouseButton[i] == GLFW_PRESS)
|
if (window->mouseButtons[i] == GLFW_PRESS)
|
||||||
_glfwInputMouseClick(window, i, GLFW_RELEASE, 0);
|
_glfwInputMouseClick(window, i, GLFW_RELEASE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
||||||
@@ -104,11 +84,6 @@ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
|
|
||||||
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
|
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
|
||||||
{
|
{
|
||||||
if (window->iconified == iconified)
|
|
||||||
return;
|
|
||||||
|
|
||||||
window->iconified = iconified;
|
|
||||||
|
|
||||||
if (window->callbacks.iconify)
|
if (window->callbacks.iconify)
|
||||||
window->callbacks.iconify((GLFWwindow*) window, iconified);
|
window->callbacks.iconify((GLFWwindow*) window, iconified);
|
||||||
}
|
}
|
||||||
@@ -119,11 +94,6 @@ void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height)
|
|||||||
window->callbacks.fbsize((GLFWwindow*) window, width, height);
|
window->callbacks.fbsize((GLFWwindow*) window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwInputWindowVisibility(_GLFWwindow* window, int visible)
|
|
||||||
{
|
|
||||||
window->visible = visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwInputWindowDamage(_GLFWwindow* window)
|
void _glfwInputWindowDamage(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->callbacks.refresh)
|
if (window->callbacks.refresh)
|
||||||
@@ -149,6 +119,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
GLFWwindow* share)
|
GLFWwindow* share)
|
||||||
{
|
{
|
||||||
_GLFWfbconfig fbconfig;
|
_GLFWfbconfig fbconfig;
|
||||||
|
_GLFWctxconfig ctxconfig;
|
||||||
_GLFWwndconfig wndconfig;
|
_GLFWwndconfig wndconfig;
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
_GLFWwindow* previous;
|
_GLFWwindow* previous;
|
||||||
@@ -158,24 +129,25 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
||||||
return GL_FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up desired framebuffer config
|
// Set up desired framebuffer config
|
||||||
fbconfig.redBits = Max(_glfw.hints.redBits, 0);
|
fbconfig.redBits = _glfw.hints.redBits;
|
||||||
fbconfig.greenBits = Max(_glfw.hints.greenBits, 0);
|
fbconfig.greenBits = _glfw.hints.greenBits;
|
||||||
fbconfig.blueBits = Max(_glfw.hints.blueBits, 0);
|
fbconfig.blueBits = _glfw.hints.blueBits;
|
||||||
fbconfig.alphaBits = Max(_glfw.hints.alphaBits, 0);
|
fbconfig.alphaBits = _glfw.hints.alphaBits;
|
||||||
fbconfig.depthBits = Max(_glfw.hints.depthBits, 0);
|
fbconfig.depthBits = _glfw.hints.depthBits;
|
||||||
fbconfig.stencilBits = Max(_glfw.hints.stencilBits, 0);
|
fbconfig.stencilBits = _glfw.hints.stencilBits;
|
||||||
fbconfig.accumRedBits = Max(_glfw.hints.accumRedBits, 0);
|
fbconfig.accumRedBits = _glfw.hints.accumRedBits;
|
||||||
fbconfig.accumGreenBits = Max(_glfw.hints.accumGreenBits, 0);
|
fbconfig.accumGreenBits = _glfw.hints.accumGreenBits;
|
||||||
fbconfig.accumBlueBits = Max(_glfw.hints.accumBlueBits, 0);
|
fbconfig.accumBlueBits = _glfw.hints.accumBlueBits;
|
||||||
fbconfig.accumAlphaBits = Max(_glfw.hints.accumAlphaBits, 0);
|
fbconfig.accumAlphaBits = _glfw.hints.accumAlphaBits;
|
||||||
fbconfig.auxBuffers = Max(_glfw.hints.auxBuffers, 0);
|
fbconfig.auxBuffers = _glfw.hints.auxBuffers;
|
||||||
fbconfig.stereo = _glfw.hints.stereo ? GL_TRUE : GL_FALSE;
|
fbconfig.stereo = _glfw.hints.stereo ? GL_TRUE : GL_FALSE;
|
||||||
fbconfig.samples = Max(_glfw.hints.samples, 0);
|
fbconfig.samples = _glfw.hints.samples;
|
||||||
fbconfig.sRGB = _glfw.hints.sRGB ? GL_TRUE : GL_FALSE;
|
fbconfig.sRGB = _glfw.hints.sRGB;
|
||||||
|
fbconfig.doublebuffer = _glfw.hints.doublebuffer ? GL_TRUE : GL_FALSE;
|
||||||
|
|
||||||
// Set up desired window config
|
// Set up desired window config
|
||||||
wndconfig.width = width;
|
wndconfig.width = width;
|
||||||
@@ -184,21 +156,27 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE;
|
wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE;
|
wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.decorated = _glfw.hints.decorated ? GL_TRUE : GL_FALSE;
|
wndconfig.decorated = _glfw.hints.decorated ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.clientAPI = _glfw.hints.clientAPI;
|
wndconfig.focused = _glfw.hints.focused ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.glMajor = _glfw.hints.glMajor;
|
wndconfig.autoIconify = _glfw.hints.autoIconify ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.glMinor = _glfw.hints.glMinor;
|
wndconfig.floating = _glfw.hints.floating ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.glForward = _glfw.hints.glForward ? GL_TRUE : GL_FALSE;
|
|
||||||
wndconfig.glDebug = _glfw.hints.glDebug ? GL_TRUE : GL_FALSE;
|
|
||||||
wndconfig.glProfile = _glfw.hints.glProfile;
|
|
||||||
wndconfig.glRobustness = _glfw.hints.glRobustness;
|
|
||||||
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
||||||
wndconfig.share = (_GLFWwindow*) share;
|
|
||||||
|
// Set up desired context config
|
||||||
|
ctxconfig.api = _glfw.hints.api;
|
||||||
|
ctxconfig.major = _glfw.hints.major;
|
||||||
|
ctxconfig.minor = _glfw.hints.minor;
|
||||||
|
ctxconfig.forward = _glfw.hints.forward ? GL_TRUE : GL_FALSE;
|
||||||
|
ctxconfig.debug = _glfw.hints.debug ? GL_TRUE : GL_FALSE;
|
||||||
|
ctxconfig.profile = _glfw.hints.profile;
|
||||||
|
ctxconfig.robustness = _glfw.hints.robustness;
|
||||||
|
ctxconfig.release = _glfw.hints.release;
|
||||||
|
ctxconfig.share = (_GLFWwindow*) share;
|
||||||
|
|
||||||
// Check the OpenGL bits of the window config
|
// Check the OpenGL bits of the window config
|
||||||
if (!_glfwIsValidContextConfig(&wndconfig))
|
if (!_glfwIsValidContextConfig(&ctxconfig))
|
||||||
return GL_FALSE;
|
return NULL;
|
||||||
|
|
||||||
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
window = calloc(1, sizeof(_GLFWwindow));
|
||||||
window->next = _glfw.windowListHead;
|
window->next = _glfw.windowListHead;
|
||||||
_glfw.windowListHead = window;
|
_glfw.windowListHead = window;
|
||||||
|
|
||||||
@@ -206,48 +184,53 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
{
|
{
|
||||||
wndconfig.resizable = GL_TRUE;
|
wndconfig.resizable = GL_TRUE;
|
||||||
wndconfig.visible = GL_TRUE;
|
wndconfig.visible = GL_TRUE;
|
||||||
|
wndconfig.focused = GL_TRUE;
|
||||||
|
|
||||||
// Set up desired video mode
|
// Set up desired video mode
|
||||||
window->videoMode.width = width;
|
window->videoMode.width = width;
|
||||||
window->videoMode.height = height;
|
window->videoMode.height = height;
|
||||||
window->videoMode.redBits = Max(_glfw.hints.redBits, 0);
|
window->videoMode.redBits = _glfw.hints.redBits;
|
||||||
window->videoMode.greenBits = Max(_glfw.hints.greenBits, 0);
|
window->videoMode.greenBits = _glfw.hints.greenBits;
|
||||||
window->videoMode.blueBits = Max(_glfw.hints.blueBits, 0);
|
window->videoMode.blueBits = _glfw.hints.blueBits;
|
||||||
window->videoMode.refreshRate = Max(_glfw.hints.refreshRate, 0);
|
window->videoMode.refreshRate = _glfw.hints.refreshRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Transfer window hints that are persistent settings and not
|
||||||
|
// just initial states
|
||||||
window->monitor = wndconfig.monitor;
|
window->monitor = wndconfig.monitor;
|
||||||
window->resizable = wndconfig.resizable;
|
window->resizable = wndconfig.resizable;
|
||||||
window->decorated = wndconfig.decorated;
|
window->decorated = wndconfig.decorated;
|
||||||
|
window->autoIconify = wndconfig.autoIconify;
|
||||||
|
window->floating = wndconfig.floating;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
|
|
||||||
// Save the currently current context so it can be restored later
|
// Save the currently current context so it can be restored later
|
||||||
previous = (_GLFWwindow*) glfwGetCurrentContext();
|
previous = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
// Open the actual window and create its context
|
// Open the actual window and create its context
|
||||||
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
if (!_glfwPlatformCreateWindow(window, &wndconfig, &ctxconfig, &fbconfig))
|
||||||
{
|
{
|
||||||
glfwDestroyWindow((GLFWwindow*) window);
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
_glfwPlatformMakeContextCurrent(previous);
|
||||||
return GL_FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent((GLFWwindow*) window);
|
_glfwPlatformMakeContextCurrent(window);
|
||||||
|
|
||||||
// Retrieve the actual (as opposed to requested) context attributes
|
// Retrieve the actual (as opposed to requested) context attributes
|
||||||
if (!_glfwRefreshContextAttribs())
|
if (!_glfwRefreshContextAttribs(&ctxconfig))
|
||||||
{
|
{
|
||||||
glfwDestroyWindow((GLFWwindow*) window);
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
_glfwPlatformMakeContextCurrent(previous);
|
||||||
return GL_FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the context against the requested parameters
|
// Verify the context against the requested parameters
|
||||||
if (!_glfwIsValidContext(&wndconfig))
|
if (!_glfwIsValidContext(&ctxconfig))
|
||||||
{
|
{
|
||||||
glfwDestroyWindow((GLFWwindow*) window);
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
_glfwPlatformMakeContextCurrent(previous);
|
||||||
return GL_FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clearing the front buffer to black to avoid garbage pixels left over
|
// Clearing the front buffer to black to avoid garbage pixels left over
|
||||||
@@ -256,10 +239,28 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
_glfwPlatformSwapBuffers(window);
|
_glfwPlatformSwapBuffers(window);
|
||||||
|
|
||||||
// Restore the previously current context (or NULL)
|
// Restore the previously current context (or NULL)
|
||||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
_glfwPlatformMakeContextCurrent(previous);
|
||||||
|
|
||||||
if (wndconfig.monitor == NULL && wndconfig.visible)
|
if (wndconfig.monitor)
|
||||||
glfwShowWindow((GLFWwindow*) window);
|
{
|
||||||
|
int width, height;
|
||||||
|
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||||
|
|
||||||
|
window->cursorPosX = width / 2;
|
||||||
|
window->cursorPosY = height / 2;
|
||||||
|
|
||||||
|
_glfwPlatformSetCursorPos(window, window->cursorPosX, window->cursorPosY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (wndconfig.visible)
|
||||||
|
{
|
||||||
|
if (wndconfig.focused)
|
||||||
|
_glfwPlatformShowWindow(window);
|
||||||
|
else
|
||||||
|
_glfwPlatformUnhideWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (GLFWwindow*) window;
|
return (GLFWwindow*) window;
|
||||||
}
|
}
|
||||||
@@ -271,21 +272,29 @@ void glfwDefaultWindowHints(void)
|
|||||||
memset(&_glfw.hints, 0, sizeof(_glfw.hints));
|
memset(&_glfw.hints, 0, sizeof(_glfw.hints));
|
||||||
|
|
||||||
// The default is OpenGL with minimum version 1.0
|
// The default is OpenGL with minimum version 1.0
|
||||||
_glfw.hints.clientAPI = GLFW_OPENGL_API;
|
_glfw.hints.api = GLFW_OPENGL_API;
|
||||||
_glfw.hints.glMajor = 1;
|
_glfw.hints.major = 1;
|
||||||
_glfw.hints.glMinor = 0;
|
_glfw.hints.minor = 0;
|
||||||
|
|
||||||
// The default is a visible, resizable window with decorations
|
// The default is a focused, visible, resizable window with decorations
|
||||||
_glfw.hints.resizable = GL_TRUE;
|
_glfw.hints.resizable = GL_TRUE;
|
||||||
_glfw.hints.visible = GL_TRUE;
|
_glfw.hints.visible = GL_TRUE;
|
||||||
_glfw.hints.decorated = GL_TRUE;
|
_glfw.hints.decorated = GL_TRUE;
|
||||||
|
_glfw.hints.focused = GL_TRUE;
|
||||||
|
_glfw.hints.autoIconify = GL_TRUE;
|
||||||
|
|
||||||
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil
|
// The default is to select the highest available refresh rate
|
||||||
|
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||||
|
|
||||||
|
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
|
||||||
|
// double buffered
|
||||||
_glfw.hints.redBits = 8;
|
_glfw.hints.redBits = 8;
|
||||||
_glfw.hints.greenBits = 8;
|
_glfw.hints.greenBits = 8;
|
||||||
_glfw.hints.blueBits = 8;
|
_glfw.hints.blueBits = 8;
|
||||||
|
_glfw.hints.alphaBits = 8;
|
||||||
_glfw.hints.depthBits = 24;
|
_glfw.hints.depthBits = 24;
|
||||||
_glfw.hints.stencilBits = 8;
|
_glfw.hints.stencilBits = 8;
|
||||||
|
_glfw.hints.doublebuffer = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwWindowHint(int target, int hint)
|
GLFWAPI void glfwWindowHint(int target, int hint)
|
||||||
@@ -333,12 +342,24 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
case GLFW_REFRESH_RATE:
|
case GLFW_REFRESH_RATE:
|
||||||
_glfw.hints.refreshRate = hint;
|
_glfw.hints.refreshRate = hint;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_DOUBLEBUFFER:
|
||||||
|
_glfw.hints.doublebuffer = hint;
|
||||||
|
break;
|
||||||
case GLFW_RESIZABLE:
|
case GLFW_RESIZABLE:
|
||||||
_glfw.hints.resizable = hint;
|
_glfw.hints.resizable = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_DECORATED:
|
case GLFW_DECORATED:
|
||||||
_glfw.hints.decorated = hint;
|
_glfw.hints.decorated = hint;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_FOCUSED:
|
||||||
|
_glfw.hints.focused = hint;
|
||||||
|
break;
|
||||||
|
case GLFW_AUTO_ICONIFY:
|
||||||
|
_glfw.hints.autoIconify = hint;
|
||||||
|
break;
|
||||||
|
case GLFW_FLOATING:
|
||||||
|
_glfw.hints.floating = hint;
|
||||||
|
break;
|
||||||
case GLFW_VISIBLE:
|
case GLFW_VISIBLE:
|
||||||
_glfw.hints.visible = hint;
|
_glfw.hints.visible = hint;
|
||||||
break;
|
break;
|
||||||
@@ -349,28 +370,31 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
_glfw.hints.sRGB = hint;
|
_glfw.hints.sRGB = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_CLIENT_API:
|
case GLFW_CLIENT_API:
|
||||||
_glfw.hints.clientAPI = hint;
|
_glfw.hints.api = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_CONTEXT_VERSION_MAJOR:
|
case GLFW_CONTEXT_VERSION_MAJOR:
|
||||||
_glfw.hints.glMajor = hint;
|
_glfw.hints.major = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_CONTEXT_VERSION_MINOR:
|
case GLFW_CONTEXT_VERSION_MINOR:
|
||||||
_glfw.hints.glMinor = hint;
|
_glfw.hints.minor = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_CONTEXT_ROBUSTNESS:
|
case GLFW_CONTEXT_ROBUSTNESS:
|
||||||
_glfw.hints.glRobustness = hint;
|
_glfw.hints.robustness = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_OPENGL_FORWARD_COMPAT:
|
case GLFW_OPENGL_FORWARD_COMPAT:
|
||||||
_glfw.hints.glForward = hint;
|
_glfw.hints.forward = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_OPENGL_DEBUG_CONTEXT:
|
case GLFW_OPENGL_DEBUG_CONTEXT:
|
||||||
_glfw.hints.glDebug = hint;
|
_glfw.hints.debug = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_OPENGL_PROFILE:
|
case GLFW_OPENGL_PROFILE:
|
||||||
_glfw.hints.glProfile = hint;
|
_glfw.hints.profile = hint;
|
||||||
|
break;
|
||||||
|
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
|
||||||
|
_glfw.hints.release = hint;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +418,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
|
|||||||
_glfwPlatformMakeContextCurrent(NULL);
|
_glfwPlatformMakeContextCurrent(NULL);
|
||||||
|
|
||||||
// Clear the focused window pointer if this is the focused window
|
// Clear the focused window pointer if this is the focused window
|
||||||
if (window == _glfw.focusedWindow)
|
if (_glfw.focusedWindow == window)
|
||||||
_glfw.focusedWindow = NULL;
|
_glfw.focusedWindow = NULL;
|
||||||
|
|
||||||
_glfwPlatformDestroyWindow(window);
|
_glfwPlatformDestroyWindow(window);
|
||||||
@@ -436,6 +460,12 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
|
|||||||
GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
|
GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = 0;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformGetWindowPos(window, xpos, ypos);
|
_glfwPlatformGetWindowPos(window, xpos, ypos);
|
||||||
}
|
}
|
||||||
@@ -449,7 +479,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
|
|||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Fullscreen windows cannot be positioned");
|
"Full screen windows cannot be moved");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,6 +489,12 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
|
|||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
|
GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
if (width)
|
||||||
|
*width = 0;
|
||||||
|
if (height)
|
||||||
|
*height = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformGetWindowSize(window, width, height);
|
_glfwPlatformGetWindowSize(window, width, height);
|
||||||
}
|
}
|
||||||
@@ -469,12 +505,6 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (window->iconified)
|
|
||||||
{
|
|
||||||
// TODO: Figure out if this is an error
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
window->videoMode.width = width;
|
window->videoMode.width = width;
|
||||||
@@ -488,32 +518,45 @@ GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height)
|
|||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
if (width)
|
||||||
|
*width = 0;
|
||||||
|
if (height)
|
||||||
|
*height = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformGetFramebufferSize(window, width, height);
|
_glfwPlatformGetFramebufferSize(window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle,
|
||||||
|
int* left, int* top,
|
||||||
|
int* right, int* bottom)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
if (left)
|
||||||
|
*left = 0;
|
||||||
|
if (top)
|
||||||
|
*top = 0;
|
||||||
|
if (right)
|
||||||
|
*right = 0;
|
||||||
|
if (bottom)
|
||||||
|
*bottom = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
_glfwPlatformGetWindowFrameSize(window, left, top, right, bottom);
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
|
GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (window->iconified)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_glfwPlatformIconifyWindow(window);
|
_glfwPlatformIconifyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
|
GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (!window->iconified)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_glfwPlatformRestoreWindow(window);
|
_glfwPlatformRestoreWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,34 +593,38 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
|||||||
switch (attrib)
|
switch (attrib)
|
||||||
{
|
{
|
||||||
case GLFW_FOCUSED:
|
case GLFW_FOCUSED:
|
||||||
return window == _glfw.focusedWindow;
|
return _glfwPlatformWindowFocused(window);
|
||||||
case GLFW_ICONIFIED:
|
case GLFW_ICONIFIED:
|
||||||
return window->iconified;
|
return _glfwPlatformWindowIconified(window);
|
||||||
|
case GLFW_VISIBLE:
|
||||||
|
return _glfwPlatformWindowVisible(window);
|
||||||
case GLFW_RESIZABLE:
|
case GLFW_RESIZABLE:
|
||||||
return window->resizable;
|
return window->resizable;
|
||||||
case GLFW_DECORATED:
|
case GLFW_DECORATED:
|
||||||
return window->decorated;
|
return window->decorated;
|
||||||
case GLFW_VISIBLE:
|
case GLFW_FLOATING:
|
||||||
return window->visible;
|
return window->floating;
|
||||||
case GLFW_CLIENT_API:
|
case GLFW_CLIENT_API:
|
||||||
return window->clientAPI;
|
return window->context.api;
|
||||||
case GLFW_CONTEXT_VERSION_MAJOR:
|
case GLFW_CONTEXT_VERSION_MAJOR:
|
||||||
return window->glMajor;
|
return window->context.major;
|
||||||
case GLFW_CONTEXT_VERSION_MINOR:
|
case GLFW_CONTEXT_VERSION_MINOR:
|
||||||
return window->glMinor;
|
return window->context.minor;
|
||||||
case GLFW_CONTEXT_REVISION:
|
case GLFW_CONTEXT_REVISION:
|
||||||
return window->glRevision;
|
return window->context.revision;
|
||||||
case GLFW_CONTEXT_ROBUSTNESS:
|
case GLFW_CONTEXT_ROBUSTNESS:
|
||||||
return window->glRobustness;
|
return window->context.robustness;
|
||||||
case GLFW_OPENGL_FORWARD_COMPAT:
|
case GLFW_OPENGL_FORWARD_COMPAT:
|
||||||
return window->glForward;
|
return window->context.forward;
|
||||||
case GLFW_OPENGL_DEBUG_CONTEXT:
|
case GLFW_OPENGL_DEBUG_CONTEXT:
|
||||||
return window->glDebug;
|
return window->context.debug;
|
||||||
case GLFW_OPENGL_PROFILE:
|
case GLFW_OPENGL_PROFILE:
|
||||||
return window->glProfile;
|
return window->context.profile;
|
||||||
|
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
|
||||||
|
return window->context.release;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,91 +653,63 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowposfun cbfun)
|
GLFWwindowposfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWwindowposfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.pos, cbfun);
|
||||||
previous = window->callbacks.pos;
|
return cbfun;
|
||||||
window->callbacks.pos = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
|
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
|
||||||
GLFWwindowsizefun cbfun)
|
GLFWwindowsizefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWwindowsizefun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.size, cbfun);
|
||||||
previous = window->callbacks.size;
|
return cbfun;
|
||||||
window->callbacks.size = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
|
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
|
||||||
GLFWwindowclosefun cbfun)
|
GLFWwindowclosefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWwindowclosefun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.close, cbfun);
|
||||||
previous = window->callbacks.close;
|
return cbfun;
|
||||||
window->callbacks.close = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle,
|
GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle,
|
||||||
GLFWwindowrefreshfun cbfun)
|
GLFWwindowrefreshfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWwindowrefreshfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.refresh, cbfun);
|
||||||
previous = window->callbacks.refresh;
|
return cbfun;
|
||||||
window->callbacks.refresh = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
|
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
|
||||||
GLFWwindowfocusfun cbfun)
|
GLFWwindowfocusfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWwindowfocusfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.focus, cbfun);
|
||||||
previous = window->callbacks.focus;
|
return cbfun;
|
||||||
window->callbacks.focus = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
|
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
|
||||||
GLFWwindowiconifyfun cbfun)
|
GLFWwindowiconifyfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWwindowiconifyfun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.iconify, cbfun);
|
||||||
previous = window->callbacks.iconify;
|
return cbfun;
|
||||||
window->callbacks.iconify = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle,
|
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle,
|
||||||
GLFWframebuffersizefun cbfun)
|
GLFWframebuffersizefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
GLFWframebuffersizefun previous;
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.fbsize, cbfun);
|
||||||
previous = window->callbacks.fbsize;
|
return cbfun;
|
||||||
window->callbacks.fbsize = cbfun;
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwPollEvents(void)
|
GLFWAPI void glfwPollEvents(void)
|
||||||
@@ -702,6 +721,20 @@ GLFWAPI void glfwPollEvents(void)
|
|||||||
GLFWAPI void glfwWaitEvents(void)
|
GLFWAPI void glfwWaitEvents(void)
|
||||||
{
|
{
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (!_glfw.windowListHead)
|
||||||
|
return;
|
||||||
|
|
||||||
_glfwPlatformWaitEvents();
|
_glfwPlatformWaitEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwPostEmptyEvent(void)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (!_glfw.windowListHead)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_glfwPlatformPostEmptyEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user