vispy 0.15.0__cp313-cp313-macosx_10_13_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vispy might be problematic. Click here for more details.

Files changed (521) hide show
  1. vispy/__init__.py +33 -0
  2. vispy/app/__init__.py +15 -0
  3. vispy/app/_default_app.py +76 -0
  4. vispy/app/_detect_eventloop.py +148 -0
  5. vispy/app/application.py +263 -0
  6. vispy/app/backends/__init__.py +52 -0
  7. vispy/app/backends/_egl.py +264 -0
  8. vispy/app/backends/_glfw.py +513 -0
  9. vispy/app/backends/_jupyter_rfb.py +278 -0
  10. vispy/app/backends/_offscreen_util.py +121 -0
  11. vispy/app/backends/_osmesa.py +235 -0
  12. vispy/app/backends/_pyglet.py +451 -0
  13. vispy/app/backends/_pyqt4.py +36 -0
  14. vispy/app/backends/_pyqt5.py +36 -0
  15. vispy/app/backends/_pyqt6.py +40 -0
  16. vispy/app/backends/_pyside.py +37 -0
  17. vispy/app/backends/_pyside2.py +52 -0
  18. vispy/app/backends/_pyside6.py +53 -0
  19. vispy/app/backends/_qt.py +1003 -0
  20. vispy/app/backends/_sdl2.py +444 -0
  21. vispy/app/backends/_template.py +244 -0
  22. vispy/app/backends/_test.py +8 -0
  23. vispy/app/backends/_tk.py +800 -0
  24. vispy/app/backends/_wx.py +476 -0
  25. vispy/app/backends/tests/__init__.py +0 -0
  26. vispy/app/backends/tests/test_offscreen_util.py +52 -0
  27. vispy/app/backends/tests/test_rfb.py +77 -0
  28. vispy/app/base.py +294 -0
  29. vispy/app/canvas.py +828 -0
  30. vispy/app/qt.py +92 -0
  31. vispy/app/tests/__init__.py +0 -0
  32. vispy/app/tests/qt-designer.ui +58 -0
  33. vispy/app/tests/test_app.py +442 -0
  34. vispy/app/tests/test_backends.py +164 -0
  35. vispy/app/tests/test_canvas.py +122 -0
  36. vispy/app/tests/test_context.py +92 -0
  37. vispy/app/tests/test_qt.py +47 -0
  38. vispy/app/tests/test_simultaneous.py +134 -0
  39. vispy/app/timer.py +174 -0
  40. vispy/color/__init__.py +17 -0
  41. vispy/color/_color_dict.py +193 -0
  42. vispy/color/color_array.py +447 -0
  43. vispy/color/color_space.py +181 -0
  44. vispy/color/colormap.py +1213 -0
  45. vispy/color/tests/__init__.py +0 -0
  46. vispy/color/tests/test_color.py +378 -0
  47. vispy/conftest.py +12 -0
  48. vispy/ext/__init__.py +0 -0
  49. vispy/ext/cocoapy.py +1522 -0
  50. vispy/ext/cubehelix.py +138 -0
  51. vispy/ext/egl.py +375 -0
  52. vispy/ext/fontconfig.py +118 -0
  53. vispy/ext/gdi32plus.py +206 -0
  54. vispy/ext/osmesa.py +105 -0
  55. vispy/geometry/__init__.py +23 -0
  56. vispy/geometry/_triangulation_debugger.py +171 -0
  57. vispy/geometry/calculations.py +162 -0
  58. vispy/geometry/curves.py +399 -0
  59. vispy/geometry/generation.py +643 -0
  60. vispy/geometry/isocurve.py +175 -0
  61. vispy/geometry/isosurface.py +465 -0
  62. vispy/geometry/meshdata.py +700 -0
  63. vispy/geometry/normals.py +78 -0
  64. vispy/geometry/parametric.py +56 -0
  65. vispy/geometry/polygon.py +137 -0
  66. vispy/geometry/rect.py +210 -0
  67. vispy/geometry/tests/__init__.py +0 -0
  68. vispy/geometry/tests/test_calculations.py +23 -0
  69. vispy/geometry/tests/test_generation.py +56 -0
  70. vispy/geometry/tests/test_meshdata.py +106 -0
  71. vispy/geometry/tests/test_triangulation.py +594 -0
  72. vispy/geometry/torusknot.py +142 -0
  73. vispy/geometry/triangulation.py +876 -0
  74. vispy/gloo/__init__.py +56 -0
  75. vispy/gloo/buffer.py +505 -0
  76. vispy/gloo/context.py +272 -0
  77. vispy/gloo/framebuffer.py +257 -0
  78. vispy/gloo/gl/__init__.py +234 -0
  79. vispy/gloo/gl/_constants.py +332 -0
  80. vispy/gloo/gl/_es2.py +986 -0
  81. vispy/gloo/gl/_gl2.py +1365 -0
  82. vispy/gloo/gl/_proxy.py +499 -0
  83. vispy/gloo/gl/_pyopengl2.py +362 -0
  84. vispy/gloo/gl/dummy.py +24 -0
  85. vispy/gloo/gl/es2.py +62 -0
  86. vispy/gloo/gl/gl2.py +98 -0
  87. vispy/gloo/gl/glplus.py +168 -0
  88. vispy/gloo/gl/pyopengl2.py +97 -0
  89. vispy/gloo/gl/tests/__init__.py +0 -0
  90. vispy/gloo/gl/tests/test_basics.py +282 -0
  91. vispy/gloo/gl/tests/test_functionality.py +568 -0
  92. vispy/gloo/gl/tests/test_names.py +246 -0
  93. vispy/gloo/gl/tests/test_use.py +71 -0
  94. vispy/gloo/glir.py +1824 -0
  95. vispy/gloo/globject.py +101 -0
  96. vispy/gloo/preprocessor.py +67 -0
  97. vispy/gloo/program.py +543 -0
  98. vispy/gloo/tests/__init__.py +0 -0
  99. vispy/gloo/tests/test_buffer.py +558 -0
  100. vispy/gloo/tests/test_context.py +119 -0
  101. vispy/gloo/tests/test_framebuffer.py +195 -0
  102. vispy/gloo/tests/test_glir.py +307 -0
  103. vispy/gloo/tests/test_globject.py +35 -0
  104. vispy/gloo/tests/test_program.py +302 -0
  105. vispy/gloo/tests/test_texture.py +732 -0
  106. vispy/gloo/tests/test_use_gloo.py +187 -0
  107. vispy/gloo/tests/test_util.py +60 -0
  108. vispy/gloo/tests/test_wrappers.py +261 -0
  109. vispy/gloo/texture.py +1046 -0
  110. vispy/gloo/util.py +129 -0
  111. vispy/gloo/wrappers.py +762 -0
  112. vispy/glsl/__init__.py +42 -0
  113. vispy/glsl/antialias/antialias.glsl +7 -0
  114. vispy/glsl/antialias/cap-butt.glsl +31 -0
  115. vispy/glsl/antialias/cap-round.glsl +29 -0
  116. vispy/glsl/antialias/cap-square.glsl +30 -0
  117. vispy/glsl/antialias/cap-triangle-in.glsl +30 -0
  118. vispy/glsl/antialias/cap-triangle-out.glsl +30 -0
  119. vispy/glsl/antialias/cap.glsl +67 -0
  120. vispy/glsl/antialias/caps.glsl +67 -0
  121. vispy/glsl/antialias/filled.glsl +50 -0
  122. vispy/glsl/antialias/outline.glsl +40 -0
  123. vispy/glsl/antialias/stroke.glsl +43 -0
  124. vispy/glsl/arrowheads/angle.glsl +99 -0
  125. vispy/glsl/arrowheads/arrowheads.frag +60 -0
  126. vispy/glsl/arrowheads/arrowheads.glsl +12 -0
  127. vispy/glsl/arrowheads/arrowheads.vert +83 -0
  128. vispy/glsl/arrowheads/curved.glsl +48 -0
  129. vispy/glsl/arrowheads/inhibitor.glsl +26 -0
  130. vispy/glsl/arrowheads/stealth.glsl +46 -0
  131. vispy/glsl/arrowheads/triangle.glsl +97 -0
  132. vispy/glsl/arrowheads/util.glsl +13 -0
  133. vispy/glsl/arrows/angle-30.glsl +12 -0
  134. vispy/glsl/arrows/angle-60.glsl +12 -0
  135. vispy/glsl/arrows/angle-90.glsl +12 -0
  136. vispy/glsl/arrows/arrow.frag +39 -0
  137. vispy/glsl/arrows/arrow.vert +49 -0
  138. vispy/glsl/arrows/arrows.glsl +17 -0
  139. vispy/glsl/arrows/common.glsl +187 -0
  140. vispy/glsl/arrows/curved.glsl +63 -0
  141. vispy/glsl/arrows/stealth.glsl +50 -0
  142. vispy/glsl/arrows/triangle-30.glsl +12 -0
  143. vispy/glsl/arrows/triangle-60.glsl +12 -0
  144. vispy/glsl/arrows/triangle-90.glsl +12 -0
  145. vispy/glsl/arrows/util.glsl +98 -0
  146. vispy/glsl/build_spatial_filters.py +660 -0
  147. vispy/glsl/collections/agg-fast-path.frag +20 -0
  148. vispy/glsl/collections/agg-fast-path.vert +78 -0
  149. vispy/glsl/collections/agg-glyph.frag +60 -0
  150. vispy/glsl/collections/agg-glyph.vert +33 -0
  151. vispy/glsl/collections/agg-marker.frag +35 -0
  152. vispy/glsl/collections/agg-marker.vert +48 -0
  153. vispy/glsl/collections/agg-path.frag +55 -0
  154. vispy/glsl/collections/agg-path.vert +166 -0
  155. vispy/glsl/collections/agg-point.frag +21 -0
  156. vispy/glsl/collections/agg-point.vert +35 -0
  157. vispy/glsl/collections/agg-segment.frag +32 -0
  158. vispy/glsl/collections/agg-segment.vert +75 -0
  159. vispy/glsl/collections/marker.frag +38 -0
  160. vispy/glsl/collections/marker.vert +48 -0
  161. vispy/glsl/collections/raw-path.frag +15 -0
  162. vispy/glsl/collections/raw-path.vert +24 -0
  163. vispy/glsl/collections/raw-point.frag +14 -0
  164. vispy/glsl/collections/raw-point.vert +31 -0
  165. vispy/glsl/collections/raw-segment.frag +18 -0
  166. vispy/glsl/collections/raw-segment.vert +26 -0
  167. vispy/glsl/collections/raw-triangle.frag +13 -0
  168. vispy/glsl/collections/raw-triangle.vert +26 -0
  169. vispy/glsl/collections/sdf-glyph-ticks.vert +69 -0
  170. vispy/glsl/collections/sdf-glyph.frag +80 -0
  171. vispy/glsl/collections/sdf-glyph.vert +59 -0
  172. vispy/glsl/collections/tick-labels.vert +71 -0
  173. vispy/glsl/colormaps/autumn.glsl +20 -0
  174. vispy/glsl/colormaps/blues.glsl +20 -0
  175. vispy/glsl/colormaps/color-space.glsl +17 -0
  176. vispy/glsl/colormaps/colormaps.glsl +24 -0
  177. vispy/glsl/colormaps/cool.glsl +20 -0
  178. vispy/glsl/colormaps/fire.glsl +21 -0
  179. vispy/glsl/colormaps/gray.glsl +20 -0
  180. vispy/glsl/colormaps/greens.glsl +20 -0
  181. vispy/glsl/colormaps/hot.glsl +22 -0
  182. vispy/glsl/colormaps/ice.glsl +20 -0
  183. vispy/glsl/colormaps/icefire.glsl +23 -0
  184. vispy/glsl/colormaps/parse.py +40 -0
  185. vispy/glsl/colormaps/reds.glsl +20 -0
  186. vispy/glsl/colormaps/spring.glsl +20 -0
  187. vispy/glsl/colormaps/summer.glsl +20 -0
  188. vispy/glsl/colormaps/user.glsl +22 -0
  189. vispy/glsl/colormaps/util.glsl +41 -0
  190. vispy/glsl/colormaps/wheel.glsl +21 -0
  191. vispy/glsl/colormaps/winter.glsl +20 -0
  192. vispy/glsl/lines/agg.frag +320 -0
  193. vispy/glsl/lines/agg.vert +241 -0
  194. vispy/glsl/markers/arrow.glsl +12 -0
  195. vispy/glsl/markers/asterisk.glsl +16 -0
  196. vispy/glsl/markers/chevron.glsl +14 -0
  197. vispy/glsl/markers/clover.glsl +20 -0
  198. vispy/glsl/markers/club.glsl +31 -0
  199. vispy/glsl/markers/cross.glsl +17 -0
  200. vispy/glsl/markers/diamond.glsl +12 -0
  201. vispy/glsl/markers/disc.glsl +9 -0
  202. vispy/glsl/markers/ellipse.glsl +67 -0
  203. vispy/glsl/markers/hbar.glsl +9 -0
  204. vispy/glsl/markers/heart.glsl +15 -0
  205. vispy/glsl/markers/infinity.glsl +15 -0
  206. vispy/glsl/markers/marker-sdf.frag +74 -0
  207. vispy/glsl/markers/marker-sdf.vert +41 -0
  208. vispy/glsl/markers/marker.frag +36 -0
  209. vispy/glsl/markers/marker.vert +46 -0
  210. vispy/glsl/markers/markers.glsl +24 -0
  211. vispy/glsl/markers/pin.glsl +18 -0
  212. vispy/glsl/markers/ring.glsl +11 -0
  213. vispy/glsl/markers/spade.glsl +28 -0
  214. vispy/glsl/markers/square.glsl +10 -0
  215. vispy/glsl/markers/tag.glsl +11 -0
  216. vispy/glsl/markers/triangle.glsl +14 -0
  217. vispy/glsl/markers/vbar.glsl +9 -0
  218. vispy/glsl/math/circle-through-2-points.glsl +30 -0
  219. vispy/glsl/math/constants.glsl +48 -0
  220. vispy/glsl/math/double.glsl +114 -0
  221. vispy/glsl/math/functions.glsl +20 -0
  222. vispy/glsl/math/point-to-line-distance.glsl +31 -0
  223. vispy/glsl/math/point-to-line-projection.glsl +29 -0
  224. vispy/glsl/math/signed-line-distance.glsl +27 -0
  225. vispy/glsl/math/signed-segment-distance.glsl +30 -0
  226. vispy/glsl/misc/regular-grid.frag +244 -0
  227. vispy/glsl/misc/spatial-filters.frag +1407 -0
  228. vispy/glsl/misc/viewport-NDC.glsl +20 -0
  229. vispy/glsl/transforms/azimuthal-equal-area.glsl +32 -0
  230. vispy/glsl/transforms/azimuthal-equidistant.glsl +38 -0
  231. vispy/glsl/transforms/hammer.glsl +44 -0
  232. vispy/glsl/transforms/identity.glsl +6 -0
  233. vispy/glsl/transforms/identity_forward.glsl +23 -0
  234. vispy/glsl/transforms/identity_inverse.glsl +23 -0
  235. vispy/glsl/transforms/linear-scale.glsl +127 -0
  236. vispy/glsl/transforms/log-scale.glsl +126 -0
  237. vispy/glsl/transforms/mercator-transverse-forward.glsl +40 -0
  238. vispy/glsl/transforms/mercator-transverse-inverse.glsl +40 -0
  239. vispy/glsl/transforms/panzoom.glsl +10 -0
  240. vispy/glsl/transforms/polar.glsl +41 -0
  241. vispy/glsl/transforms/position.glsl +44 -0
  242. vispy/glsl/transforms/power-scale.glsl +139 -0
  243. vispy/glsl/transforms/projection.glsl +7 -0
  244. vispy/glsl/transforms/pvm.glsl +13 -0
  245. vispy/glsl/transforms/rotate.glsl +45 -0
  246. vispy/glsl/transforms/trackball.glsl +15 -0
  247. vispy/glsl/transforms/translate.glsl +35 -0
  248. vispy/glsl/transforms/transverse_mercator.glsl +38 -0
  249. vispy/glsl/transforms/viewport-clipping.glsl +14 -0
  250. vispy/glsl/transforms/viewport-transform.glsl +16 -0
  251. vispy/glsl/transforms/viewport.glsl +50 -0
  252. vispy/glsl/transforms/x.glsl +24 -0
  253. vispy/glsl/transforms/y.glsl +19 -0
  254. vispy/glsl/transforms/z.glsl +14 -0
  255. vispy/io/__init__.py +20 -0
  256. vispy/io/_data/spatial-filters.npy +0 -0
  257. vispy/io/datasets.py +94 -0
  258. vispy/io/image.py +231 -0
  259. vispy/io/mesh.py +122 -0
  260. vispy/io/stl.py +167 -0
  261. vispy/io/tests/__init__.py +0 -0
  262. vispy/io/tests/test_image.py +47 -0
  263. vispy/io/tests/test_io.py +121 -0
  264. vispy/io/wavefront.py +350 -0
  265. vispy/plot/__init__.py +36 -0
  266. vispy/plot/fig.py +58 -0
  267. vispy/plot/plotwidget.py +522 -0
  268. vispy/plot/tests/__init__.py +0 -0
  269. vispy/plot/tests/test_plot.py +46 -0
  270. vispy/scene/__init__.py +43 -0
  271. vispy/scene/cameras/__init__.py +27 -0
  272. vispy/scene/cameras/_base.py +38 -0
  273. vispy/scene/cameras/arcball.py +105 -0
  274. vispy/scene/cameras/base_camera.py +551 -0
  275. vispy/scene/cameras/fly.py +474 -0
  276. vispy/scene/cameras/magnify.py +163 -0
  277. vispy/scene/cameras/panzoom.py +311 -0
  278. vispy/scene/cameras/perspective.py +338 -0
  279. vispy/scene/cameras/tests/__init__.py +0 -0
  280. vispy/scene/cameras/tests/test_cameras.py +27 -0
  281. vispy/scene/cameras/tests/test_link.py +53 -0
  282. vispy/scene/cameras/tests/test_perspective.py +122 -0
  283. vispy/scene/cameras/turntable.py +183 -0
  284. vispy/scene/canvas.py +639 -0
  285. vispy/scene/events.py +85 -0
  286. vispy/scene/node.py +644 -0
  287. vispy/scene/subscene.py +20 -0
  288. vispy/scene/tests/__init__.py +0 -0
  289. vispy/scene/tests/test_canvas.py +119 -0
  290. vispy/scene/tests/test_node.py +142 -0
  291. vispy/scene/tests/test_visuals.py +141 -0
  292. vispy/scene/visuals.py +276 -0
  293. vispy/scene/widgets/__init__.py +18 -0
  294. vispy/scene/widgets/anchor.py +25 -0
  295. vispy/scene/widgets/axis.py +88 -0
  296. vispy/scene/widgets/colorbar.py +176 -0
  297. vispy/scene/widgets/console.py +351 -0
  298. vispy/scene/widgets/grid.py +509 -0
  299. vispy/scene/widgets/label.py +50 -0
  300. vispy/scene/widgets/tests/__init__.py +0 -0
  301. vispy/scene/widgets/tests/test_colorbar.py +47 -0
  302. vispy/scene/widgets/viewbox.py +199 -0
  303. vispy/scene/widgets/widget.py +478 -0
  304. vispy/testing/__init__.py +51 -0
  305. vispy/testing/_runners.py +448 -0
  306. vispy/testing/_testing.py +416 -0
  307. vispy/testing/image_tester.py +494 -0
  308. vispy/testing/rendered_array_tester.py +85 -0
  309. vispy/testing/tests/__init__.py +0 -0
  310. vispy/testing/tests/test_testing.py +20 -0
  311. vispy/util/__init__.py +32 -0
  312. vispy/util/bunch.py +15 -0
  313. vispy/util/check_environment.py +57 -0
  314. vispy/util/config.py +490 -0
  315. vispy/util/dpi/__init__.py +19 -0
  316. vispy/util/dpi/_linux.py +69 -0
  317. vispy/util/dpi/_quartz.py +26 -0
  318. vispy/util/dpi/_win32.py +34 -0
  319. vispy/util/dpi/tests/__init__.py +0 -0
  320. vispy/util/dpi/tests/test_dpi.py +16 -0
  321. vispy/util/eq.py +41 -0
  322. vispy/util/event.py +774 -0
  323. vispy/util/fetching.py +276 -0
  324. vispy/util/filter.py +44 -0
  325. vispy/util/fonts/__init__.py +14 -0
  326. vispy/util/fonts/_freetype.py +73 -0
  327. vispy/util/fonts/_quartz.py +192 -0
  328. vispy/util/fonts/_triage.py +36 -0
  329. vispy/util/fonts/_vispy_fonts.py +20 -0
  330. vispy/util/fonts/_win32.py +105 -0
  331. vispy/util/fonts/data/OpenSans-Bold.ttf +0 -0
  332. vispy/util/fonts/data/OpenSans-BoldItalic.ttf +0 -0
  333. vispy/util/fonts/data/OpenSans-Italic.ttf +0 -0
  334. vispy/util/fonts/data/OpenSans-Regular.ttf +0 -0
  335. vispy/util/fonts/tests/__init__.py +0 -0
  336. vispy/util/fonts/tests/test_font.py +45 -0
  337. vispy/util/fourier.py +69 -0
  338. vispy/util/frozen.py +25 -0
  339. vispy/util/gallery_scraper.py +268 -0
  340. vispy/util/keys.py +91 -0
  341. vispy/util/logs.py +358 -0
  342. vispy/util/osmesa_gl.py +17 -0
  343. vispy/util/profiler.py +135 -0
  344. vispy/util/ptime.py +16 -0
  345. vispy/util/quaternion.py +229 -0
  346. vispy/util/svg/__init__.py +18 -0
  347. vispy/util/svg/base.py +20 -0
  348. vispy/util/svg/color.py +219 -0
  349. vispy/util/svg/element.py +51 -0
  350. vispy/util/svg/geometry.py +478 -0
  351. vispy/util/svg/group.py +66 -0
  352. vispy/util/svg/length.py +81 -0
  353. vispy/util/svg/number.py +25 -0
  354. vispy/util/svg/path.py +332 -0
  355. vispy/util/svg/shapes.py +57 -0
  356. vispy/util/svg/style.py +59 -0
  357. vispy/util/svg/svg.py +40 -0
  358. vispy/util/svg/transform.py +223 -0
  359. vispy/util/svg/transformable.py +28 -0
  360. vispy/util/svg/viewport.py +73 -0
  361. vispy/util/tests/__init__.py +0 -0
  362. vispy/util/tests/test_config.py +58 -0
  363. vispy/util/tests/test_docstring_parameters.py +123 -0
  364. vispy/util/tests/test_emitter_group.py +262 -0
  365. vispy/util/tests/test_event_emitter.py +743 -0
  366. vispy/util/tests/test_fourier.py +35 -0
  367. vispy/util/tests/test_gallery_scraper.py +112 -0
  368. vispy/util/tests/test_import.py +127 -0
  369. vispy/util/tests/test_key.py +22 -0
  370. vispy/util/tests/test_logging.py +45 -0
  371. vispy/util/tests/test_run.py +14 -0
  372. vispy/util/tests/test_transforms.py +42 -0
  373. vispy/util/tests/test_vispy.py +48 -0
  374. vispy/util/transforms.py +201 -0
  375. vispy/util/wrappers.py +155 -0
  376. vispy/version.py +21 -0
  377. vispy/visuals/__init__.py +50 -0
  378. vispy/visuals/_scalable_textures.py +487 -0
  379. vispy/visuals/axis.py +678 -0
  380. vispy/visuals/border.py +208 -0
  381. vispy/visuals/box.py +79 -0
  382. vispy/visuals/collections/__init__.py +30 -0
  383. vispy/visuals/collections/agg_fast_path_collection.py +219 -0
  384. vispy/visuals/collections/agg_path_collection.py +197 -0
  385. vispy/visuals/collections/agg_point_collection.py +52 -0
  386. vispy/visuals/collections/agg_segment_collection.py +142 -0
  387. vispy/visuals/collections/array_list.py +401 -0
  388. vispy/visuals/collections/base_collection.py +482 -0
  389. vispy/visuals/collections/collection.py +253 -0
  390. vispy/visuals/collections/path_collection.py +23 -0
  391. vispy/visuals/collections/point_collection.py +19 -0
  392. vispy/visuals/collections/polygon_collection.py +25 -0
  393. vispy/visuals/collections/raw_path_collection.py +119 -0
  394. vispy/visuals/collections/raw_point_collection.py +113 -0
  395. vispy/visuals/collections/raw_polygon_collection.py +77 -0
  396. vispy/visuals/collections/raw_segment_collection.py +112 -0
  397. vispy/visuals/collections/raw_triangle_collection.py +78 -0
  398. vispy/visuals/collections/segment_collection.py +19 -0
  399. vispy/visuals/collections/triangle_collection.py +16 -0
  400. vispy/visuals/collections/util.py +168 -0
  401. vispy/visuals/colorbar.py +699 -0
  402. vispy/visuals/cube.py +41 -0
  403. vispy/visuals/ellipse.py +162 -0
  404. vispy/visuals/filters/__init__.py +10 -0
  405. vispy/visuals/filters/base_filter.py +242 -0
  406. vispy/visuals/filters/clipper.py +60 -0
  407. vispy/visuals/filters/clipping_planes.py +122 -0
  408. vispy/visuals/filters/color.py +181 -0
  409. vispy/visuals/filters/markers.py +28 -0
  410. vispy/visuals/filters/mesh.py +801 -0
  411. vispy/visuals/filters/picking.py +60 -0
  412. vispy/visuals/filters/tests/__init__.py +3 -0
  413. vispy/visuals/filters/tests/test_primitive_picking_filters.py +70 -0
  414. vispy/visuals/filters/tests/test_wireframe_filter.py +16 -0
  415. vispy/visuals/glsl/__init__.py +1 -0
  416. vispy/visuals/glsl/antialiasing.py +133 -0
  417. vispy/visuals/glsl/color.py +63 -0
  418. vispy/visuals/graphs/__init__.py +1 -0
  419. vispy/visuals/graphs/graph.py +240 -0
  420. vispy/visuals/graphs/layouts/__init__.py +55 -0
  421. vispy/visuals/graphs/layouts/circular.py +49 -0
  422. vispy/visuals/graphs/layouts/force_directed.py +211 -0
  423. vispy/visuals/graphs/layouts/networkx_layout.py +87 -0
  424. vispy/visuals/graphs/layouts/random.py +52 -0
  425. vispy/visuals/graphs/tests/__init__.py +1 -0
  426. vispy/visuals/graphs/tests/test_layouts.py +139 -0
  427. vispy/visuals/graphs/tests/test_networkx_layout.py +47 -0
  428. vispy/visuals/graphs/util.py +120 -0
  429. vispy/visuals/gridlines.py +161 -0
  430. vispy/visuals/gridmesh.py +98 -0
  431. vispy/visuals/histogram.py +58 -0
  432. vispy/visuals/image.py +701 -0
  433. vispy/visuals/image_complex.py +130 -0
  434. vispy/visuals/infinite_line.py +199 -0
  435. vispy/visuals/instanced_mesh.py +152 -0
  436. vispy/visuals/isocurve.py +213 -0
  437. vispy/visuals/isoline.py +241 -0
  438. vispy/visuals/isosurface.py +113 -0
  439. vispy/visuals/line/__init__.py +6 -0
  440. vispy/visuals/line/arrow.py +289 -0
  441. vispy/visuals/line/dash_atlas.py +90 -0
  442. vispy/visuals/line/line.py +545 -0
  443. vispy/visuals/line_plot.py +135 -0
  444. vispy/visuals/linear_region.py +199 -0
  445. vispy/visuals/markers.py +819 -0
  446. vispy/visuals/mesh.py +373 -0
  447. vispy/visuals/mesh_normals.py +159 -0
  448. vispy/visuals/plane.py +54 -0
  449. vispy/visuals/polygon.py +145 -0
  450. vispy/visuals/rectangle.py +196 -0
  451. vispy/visuals/regular_polygon.py +56 -0
  452. vispy/visuals/scrolling_lines.py +197 -0
  453. vispy/visuals/shaders/__init__.py +17 -0
  454. vispy/visuals/shaders/compiler.py +206 -0
  455. vispy/visuals/shaders/expression.py +99 -0
  456. vispy/visuals/shaders/function.py +788 -0
  457. vispy/visuals/shaders/multiprogram.py +145 -0
  458. vispy/visuals/shaders/parsing.py +140 -0
  459. vispy/visuals/shaders/program.py +161 -0
  460. vispy/visuals/shaders/shader_object.py +162 -0
  461. vispy/visuals/shaders/tests/__init__.py +0 -0
  462. vispy/visuals/shaders/tests/test_function.py +486 -0
  463. vispy/visuals/shaders/tests/test_multiprogram.py +78 -0
  464. vispy/visuals/shaders/tests/test_parsing.py +57 -0
  465. vispy/visuals/shaders/variable.py +272 -0
  466. vispy/visuals/spectrogram.py +169 -0
  467. vispy/visuals/sphere.py +80 -0
  468. vispy/visuals/surface_plot.py +192 -0
  469. vispy/visuals/tests/__init__.py +0 -0
  470. vispy/visuals/tests/test_arrows.py +109 -0
  471. vispy/visuals/tests/test_axis.py +120 -0
  472. vispy/visuals/tests/test_collections.py +15 -0
  473. vispy/visuals/tests/test_colorbar.py +179 -0
  474. vispy/visuals/tests/test_colormap.py +97 -0
  475. vispy/visuals/tests/test_ellipse.py +122 -0
  476. vispy/visuals/tests/test_gridlines.py +30 -0
  477. vispy/visuals/tests/test_histogram.py +24 -0
  478. vispy/visuals/tests/test_image.py +392 -0
  479. vispy/visuals/tests/test_image_complex.py +36 -0
  480. vispy/visuals/tests/test_infinite_line.py +53 -0
  481. vispy/visuals/tests/test_instanced_mesh.py +50 -0
  482. vispy/visuals/tests/test_isosurface.py +22 -0
  483. vispy/visuals/tests/test_linear_region.py +152 -0
  484. vispy/visuals/tests/test_markers.py +54 -0
  485. vispy/visuals/tests/test_mesh.py +261 -0
  486. vispy/visuals/tests/test_mesh_normals.py +218 -0
  487. vispy/visuals/tests/test_polygon.py +112 -0
  488. vispy/visuals/tests/test_rectangle.py +163 -0
  489. vispy/visuals/tests/test_regular_polygon.py +111 -0
  490. vispy/visuals/tests/test_scalable_textures.py +196 -0
  491. vispy/visuals/tests/test_sdf.py +73 -0
  492. vispy/visuals/tests/test_spectrogram.py +42 -0
  493. vispy/visuals/tests/test_surface_plot.py +57 -0
  494. vispy/visuals/tests/test_text.py +95 -0
  495. vispy/visuals/tests/test_volume.py +542 -0
  496. vispy/visuals/tests/test_windbarb.py +33 -0
  497. vispy/visuals/text/__init__.py +7 -0
  498. vispy/visuals/text/_sdf_cpu.cpython-313-darwin.so +0 -0
  499. vispy/visuals/text/_sdf_cpu.pyx +112 -0
  500. vispy/visuals/text/_sdf_gpu.py +316 -0
  501. vispy/visuals/text/text.py +675 -0
  502. vispy/visuals/transforms/__init__.py +34 -0
  503. vispy/visuals/transforms/_util.py +191 -0
  504. vispy/visuals/transforms/base_transform.py +233 -0
  505. vispy/visuals/transforms/chain.py +300 -0
  506. vispy/visuals/transforms/interactive.py +98 -0
  507. vispy/visuals/transforms/linear.py +564 -0
  508. vispy/visuals/transforms/nonlinear.py +398 -0
  509. vispy/visuals/transforms/tests/__init__.py +0 -0
  510. vispy/visuals/transforms/tests/test_transforms.py +243 -0
  511. vispy/visuals/transforms/transform_system.py +339 -0
  512. vispy/visuals/tube.py +173 -0
  513. vispy/visuals/visual.py +923 -0
  514. vispy/visuals/volume.py +1366 -0
  515. vispy/visuals/windbarb.py +291 -0
  516. vispy/visuals/xyz_axis.py +34 -0
  517. vispy-0.15.0.dist-info/METADATA +243 -0
  518. vispy-0.15.0.dist-info/RECORD +521 -0
  519. vispy-0.15.0.dist-info/WHEEL +6 -0
  520. vispy-0.15.0.dist-info/licenses/LICENSE.txt +36 -0
  521. vispy-0.15.0.dist-info/top_level.txt +1 -0
vispy/gloo/gl/_es2.py ADDED
@@ -0,0 +1,986 @@
1
+ """GL definitions converted to Python by codegen/createglapi.py.
2
+
3
+ THIS CODE IS AUTO-GENERATED. DO NOT EDIT.
4
+
5
+ GL ES 2.0 API (via Angle/DirectX on Windows)
6
+
7
+ """
8
+
9
+ import ctypes
10
+ from .es2 import _lib
11
+
12
+
13
+ _lib.glActiveTexture.argtypes = ctypes.c_uint,
14
+ # void = glActiveTexture(GLenum texture)
15
+ def glActiveTexture(texture):
16
+ _lib.glActiveTexture(texture)
17
+
18
+
19
+ _lib.glAttachShader.argtypes = ctypes.c_uint, ctypes.c_uint,
20
+ # void = glAttachShader(GLuint program, GLuint shader)
21
+ def glAttachShader(program, shader):
22
+ _lib.glAttachShader(program, shader)
23
+
24
+
25
+ _lib.glBindAttribLocation.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_char_p,
26
+ # void = glBindAttribLocation(GLuint program, GLuint index, GLchar* name)
27
+ def glBindAttribLocation(program, index, name):
28
+ name = ctypes.c_char_p(name.encode('utf-8'))
29
+ res = _lib.glBindAttribLocation(program, index, name)
30
+
31
+
32
+ _lib.glBindBuffer.argtypes = ctypes.c_uint, ctypes.c_uint,
33
+ # void = glBindBuffer(GLenum target, GLuint buffer)
34
+ def glBindBuffer(target, buffer):
35
+ _lib.glBindBuffer(target, buffer)
36
+
37
+
38
+ _lib.glBindFramebuffer.argtypes = ctypes.c_uint, ctypes.c_uint,
39
+ # void = glBindFramebuffer(GLenum target, GLuint framebuffer)
40
+ def glBindFramebuffer(target, framebuffer):
41
+ _lib.glBindFramebuffer(target, framebuffer)
42
+
43
+
44
+ _lib.glBindRenderbuffer.argtypes = ctypes.c_uint, ctypes.c_uint,
45
+ # void = glBindRenderbuffer(GLenum target, GLuint renderbuffer)
46
+ def glBindRenderbuffer(target, renderbuffer):
47
+ _lib.glBindRenderbuffer(target, renderbuffer)
48
+
49
+
50
+ _lib.glBindTexture.argtypes = ctypes.c_uint, ctypes.c_uint,
51
+ # void = glBindTexture(GLenum target, GLuint texture)
52
+ def glBindTexture(target, texture):
53
+ _lib.glBindTexture(target, texture)
54
+
55
+
56
+ _lib.glBlendColor.argtypes = ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,
57
+ # void = glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
58
+ def glBlendColor(red, green, blue, alpha):
59
+ _lib.glBlendColor(red, green, blue, alpha)
60
+
61
+
62
+ _lib.glBlendEquation.argtypes = ctypes.c_uint,
63
+ # void = glBlendEquation(GLenum mode)
64
+ def glBlendEquation(mode):
65
+ _lib.glBlendEquation(mode)
66
+
67
+
68
+ _lib.glBlendEquationSeparate.argtypes = ctypes.c_uint, ctypes.c_uint,
69
+ # void = glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
70
+ def glBlendEquationSeparate(modeRGB, modeAlpha):
71
+ _lib.glBlendEquationSeparate(modeRGB, modeAlpha)
72
+
73
+
74
+ _lib.glBlendFunc.argtypes = ctypes.c_uint, ctypes.c_uint,
75
+ # void = glBlendFunc(GLenum sfactor, GLenum dfactor)
76
+ def glBlendFunc(sfactor, dfactor):
77
+ _lib.glBlendFunc(sfactor, dfactor)
78
+
79
+
80
+ _lib.glBlendFuncSeparate.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,
81
+ # void = glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
82
+ def glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha):
83
+ _lib.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha)
84
+
85
+
86
+ _lib.glBufferData.argtypes = ctypes.c_uint, ctypes.c_ssize_t, ctypes.c_void_p, ctypes.c_uint,
87
+ # void = glBufferData(GLenum target, GLsizeiptr size, GLvoid* data, GLenum usage)
88
+ def glBufferData(target, data, usage):
89
+ """Data can be numpy array or the size of data to allocate."""
90
+ if isinstance(data, int):
91
+ size = data
92
+ data = ctypes.c_voidp(0)
93
+ else:
94
+ if not data.flags['C_CONTIGUOUS'] or not data.flags['ALIGNED']:
95
+ data = data.copy('C')
96
+ data_ = data
97
+ size = data_.nbytes
98
+ data = data_.ctypes.data
99
+ res = _lib.glBufferData(target, size, data, usage)
100
+
101
+
102
+ _lib.glBufferSubData.argtypes = ctypes.c_uint, ctypes.c_ssize_t, ctypes.c_ssize_t, ctypes.c_void_p,
103
+ # void = glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data)
104
+ def glBufferSubData(target, offset, data):
105
+ if not data.flags['C_CONTIGUOUS']:
106
+ data = data.copy('C')
107
+ data_ = data
108
+ size = data_.nbytes
109
+ data = data_.ctypes.data
110
+ res = _lib.glBufferSubData(target, offset, size, data)
111
+
112
+
113
+ _lib.glCheckFramebufferStatus.argtypes = ctypes.c_uint,
114
+ _lib.glCheckFramebufferStatus.restype = ctypes.c_uint
115
+ # GLenum = glCheckFramebufferStatus(GLenum target)
116
+ def glCheckFramebufferStatus(target):
117
+ return _lib.glCheckFramebufferStatus(target)
118
+
119
+
120
+ _lib.glClear.argtypes = ctypes.c_uint,
121
+ # void = glClear(GLbitfield mask)
122
+ def glClear(mask):
123
+ _lib.glClear(mask)
124
+
125
+
126
+ _lib.glClearColor.argtypes = ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,
127
+ # void = glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
128
+ def glClearColor(red, green, blue, alpha):
129
+ _lib.glClearColor(red, green, blue, alpha)
130
+
131
+
132
+ _lib.glClearDepthf.argtypes = ctypes.c_float,
133
+ # void = glClearDepthf(GLclampf depth)
134
+ def glClearDepth(depth):
135
+ _lib.glClearDepthf(depth)
136
+
137
+
138
+ _lib.glClearStencil.argtypes = ctypes.c_int,
139
+ # void = glClearStencil(GLint s)
140
+ def glClearStencil(s):
141
+ _lib.glClearStencil(s)
142
+
143
+
144
+ _lib.glColorMask.argtypes = ctypes.c_bool, ctypes.c_bool, ctypes.c_bool, ctypes.c_bool,
145
+ # void = glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
146
+ def glColorMask(red, green, blue, alpha):
147
+ _lib.glColorMask(red, green, blue, alpha)
148
+
149
+
150
+ _lib.glCompileShader.argtypes = ctypes.c_uint,
151
+ # void = glCompileShader(GLuint shader)
152
+ def glCompileShader(shader):
153
+ _lib.glCompileShader(shader)
154
+
155
+
156
+ _lib.glCompressedTexImage2D.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_void_p,
157
+ # void = glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLvoid* data)
158
+ def glCompressedTexImage2D(target, level, internalformat, width, height, border, data):
159
+ # border = 0 # set in args
160
+ if not data.flags['C_CONTIGUOUS']:
161
+ data = data.copy('C')
162
+ data_ = data
163
+ size = data_.size
164
+ data = data_.ctypes.data
165
+ res = _lib.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data)
166
+
167
+
168
+ _lib.glCompressedTexSubImage2D.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_int, ctypes.c_void_p,
169
+ # void = glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLvoid* data)
170
+ def glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data):
171
+ if not data.flags['C_CONTIGUOUS']:
172
+ data = data.copy('C')
173
+ data_ = data
174
+ size = data_.size
175
+ data = data_.ctypes.data
176
+ res = _lib.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data)
177
+
178
+
179
+ _lib.glCopyTexImage2D.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
180
+ # void = glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
181
+ def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border):
182
+ _lib.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border)
183
+
184
+
185
+ _lib.glCopyTexSubImage2D.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
186
+ # void = glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
187
+ def glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height):
188
+ _lib.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height)
189
+
190
+
191
+ _lib.glCreateProgram.argtypes = ()
192
+ _lib.glCreateProgram.restype = ctypes.c_uint
193
+ # GLuint = glCreateProgram()
194
+ def glCreateProgram():
195
+ return _lib.glCreateProgram()
196
+
197
+
198
+ _lib.glCreateShader.argtypes = ctypes.c_uint,
199
+ _lib.glCreateShader.restype = ctypes.c_uint
200
+ # GLuint = glCreateShader(GLenum type)
201
+ def glCreateShader(type):
202
+ return _lib.glCreateShader(type)
203
+
204
+
205
+ _lib.glCullFace.argtypes = ctypes.c_uint,
206
+ # void = glCullFace(GLenum mode)
207
+ def glCullFace(mode):
208
+ _lib.glCullFace(mode)
209
+
210
+
211
+ _lib.glDeleteBuffers.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
212
+ # void = glDeleteBuffers(GLsizei n, GLuint* buffers)
213
+ def glDeleteBuffer(buffer):
214
+ n = 1
215
+ buffers = (ctypes.c_uint*n)(buffer)
216
+ res = _lib.glDeleteBuffers(n, buffers)
217
+
218
+
219
+ _lib.glDeleteFramebuffers.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
220
+ # void = glDeleteFramebuffers(GLsizei n, GLuint* framebuffers)
221
+ def glDeleteFramebuffer(framebuffer):
222
+ n = 1
223
+ framebuffers = (ctypes.c_uint*n)(framebuffer)
224
+ res = _lib.glDeleteFramebuffers(n, framebuffers)
225
+
226
+
227
+ _lib.glDeleteProgram.argtypes = ctypes.c_uint,
228
+ # void = glDeleteProgram(GLuint program)
229
+ def glDeleteProgram(program):
230
+ _lib.glDeleteProgram(program)
231
+
232
+
233
+ _lib.glDeleteRenderbuffers.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
234
+ # void = glDeleteRenderbuffers(GLsizei n, GLuint* renderbuffers)
235
+ def glDeleteRenderbuffer(renderbuffer):
236
+ n = 1
237
+ renderbuffers = (ctypes.c_uint*n)(renderbuffer)
238
+ res = _lib.glDeleteRenderbuffers(n, renderbuffers)
239
+
240
+
241
+ _lib.glDeleteShader.argtypes = ctypes.c_uint,
242
+ # void = glDeleteShader(GLuint shader)
243
+ def glDeleteShader(shader):
244
+ _lib.glDeleteShader(shader)
245
+
246
+
247
+ _lib.glDeleteTextures.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
248
+ # void = glDeleteTextures(GLsizei n, GLuint* textures)
249
+ def glDeleteTexture(texture):
250
+ n = 1
251
+ textures = (ctypes.c_uint*n)(texture)
252
+ res = _lib.glDeleteTextures(n, textures)
253
+
254
+
255
+ _lib.glDepthFunc.argtypes = ctypes.c_uint,
256
+ # void = glDepthFunc(GLenum func)
257
+ def glDepthFunc(func):
258
+ _lib.glDepthFunc(func)
259
+
260
+
261
+ _lib.glDepthMask.argtypes = ctypes.c_bool,
262
+ # void = glDepthMask(GLboolean flag)
263
+ def glDepthMask(flag):
264
+ _lib.glDepthMask(flag)
265
+
266
+
267
+ _lib.glDepthRangef.argtypes = ctypes.c_float, ctypes.c_float,
268
+ # void = glDepthRangef(GLclampf zNear, GLclampf zFar)
269
+ def glDepthRange(zNear, zFar):
270
+ _lib.glDepthRangef(zNear, zFar)
271
+
272
+
273
+ _lib.glDetachShader.argtypes = ctypes.c_uint, ctypes.c_uint,
274
+ # void = glDetachShader(GLuint program, GLuint shader)
275
+ def glDetachShader(program, shader):
276
+ _lib.glDetachShader(program, shader)
277
+
278
+
279
+ _lib.glDisable.argtypes = ctypes.c_uint,
280
+ # void = glDisable(GLenum cap)
281
+ def glDisable(cap):
282
+ _lib.glDisable(cap)
283
+
284
+
285
+ _lib.glDisableVertexAttribArray.argtypes = ctypes.c_uint,
286
+ # void = glDisableVertexAttribArray(GLuint index)
287
+ def glDisableVertexAttribArray(index):
288
+ _lib.glDisableVertexAttribArray(index)
289
+
290
+
291
+ _lib.glDrawArrays.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_int,
292
+ # void = glDrawArrays(GLenum mode, GLint first, GLsizei count)
293
+ def glDrawArrays(mode, first, count):
294
+ _lib.glDrawArrays(mode, first, count)
295
+
296
+
297
+ _lib.glDrawElements.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_void_p,
298
+ # void = glDrawElements(GLenum mode, GLsizei count, GLenum type, GLvoid* indices)
299
+ def glDrawElements(mode, count, type, offset):
300
+ if offset is None:
301
+ offset = ctypes.c_void_p(0)
302
+ elif isinstance(offset, ctypes.c_void_p):
303
+ pass
304
+ elif isinstance(offset, (int, ctypes.c_int)):
305
+ offset = ctypes.c_void_p(int(offset))
306
+ else:
307
+ if not offset.flags['C_CONTIGUOUS']:
308
+ offset = offset.copy('C')
309
+ offset_ = offset
310
+ offset = offset.ctypes.data
311
+ indices = offset
312
+ res = _lib.glDrawElements(mode, count, type, indices)
313
+
314
+
315
+ _lib.glEnable.argtypes = ctypes.c_uint,
316
+ # void = glEnable(GLenum cap)
317
+ def glEnable(cap):
318
+ _lib.glEnable(cap)
319
+
320
+
321
+ _lib.glEnableVertexAttribArray.argtypes = ctypes.c_uint,
322
+ # void = glEnableVertexAttribArray(GLuint index)
323
+ def glEnableVertexAttribArray(index):
324
+ _lib.glEnableVertexAttribArray(index)
325
+
326
+
327
+ _lib.glFinish.argtypes = ()
328
+ # void = glFinish()
329
+ def glFinish():
330
+ _lib.glFinish()
331
+
332
+
333
+ _lib.glFlush.argtypes = ()
334
+ # void = glFlush()
335
+ def glFlush():
336
+ _lib.glFlush()
337
+
338
+
339
+ _lib.glFramebufferRenderbuffer.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,
340
+ # void = glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
341
+ def glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer):
342
+ _lib.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer)
343
+
344
+
345
+ _lib.glFramebufferTexture2D.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_int,
346
+ # void = glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
347
+ def glFramebufferTexture2D(target, attachment, textarget, texture, level):
348
+ _lib.glFramebufferTexture2D(target, attachment, textarget, texture, level)
349
+
350
+
351
+ _lib.glFrontFace.argtypes = ctypes.c_uint,
352
+ # void = glFrontFace(GLenum mode)
353
+ def glFrontFace(mode):
354
+ _lib.glFrontFace(mode)
355
+
356
+
357
+ _lib.glGenBuffers.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
358
+ # void = glGenBuffers(GLsizei n, GLuint* buffers)
359
+ def glCreateBuffer():
360
+ n = 1
361
+ buffers = (ctypes.c_uint*n)()
362
+ res = _lib.glGenBuffers(n, buffers)
363
+ return buffers[0]
364
+
365
+
366
+ _lib.glGenFramebuffers.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
367
+ # void = glGenFramebuffers(GLsizei n, GLuint* framebuffers)
368
+ def glCreateFramebuffer():
369
+ n = 1
370
+ framebuffers = (ctypes.c_uint*n)()
371
+ res = _lib.glGenFramebuffers(n, framebuffers)
372
+ return framebuffers[0]
373
+
374
+
375
+ _lib.glGenRenderbuffers.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
376
+ # void = glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
377
+ def glCreateRenderbuffer():
378
+ n = 1
379
+ renderbuffers = (ctypes.c_uint*n)()
380
+ res = _lib.glGenRenderbuffers(n, renderbuffers)
381
+ return renderbuffers[0]
382
+
383
+
384
+ _lib.glGenTextures.argtypes = ctypes.c_int, ctypes.POINTER(ctypes.c_uint),
385
+ # void = glGenTextures(GLsizei n, GLuint* textures)
386
+ def glCreateTexture():
387
+ n = 1
388
+ textures = (ctypes.c_uint*n)()
389
+ res = _lib.glGenTextures(n, textures)
390
+ return textures[0]
391
+
392
+
393
+ _lib.glGenerateMipmap.argtypes = ctypes.c_uint,
394
+ # void = glGenerateMipmap(GLenum target)
395
+ def glGenerateMipmap(target):
396
+ _lib.glGenerateMipmap(target)
397
+
398
+
399
+ _lib.glGetActiveAttrib.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_uint), ctypes.c_char_p,
400
+ # void = glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
401
+ def glGetActiveAttrib(program, index):
402
+ bufsize = 256
403
+ length = (ctypes.c_int*1)()
404
+ size = (ctypes.c_int*1)()
405
+ type = (ctypes.c_uint*1)()
406
+ name = ctypes.create_string_buffer(bufsize)
407
+ res = _lib.glGetActiveAttrib(program, index, bufsize, length, size, type, name)
408
+ name = name[:length[0]].decode('utf-8')
409
+ return name, size[0], type[0]
410
+
411
+
412
+ _lib.glGetActiveUniform.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_uint), ctypes.c_char_p,
413
+ # void = glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
414
+ def glGetActiveUniform(program, index):
415
+ bufsize = 256
416
+ length = (ctypes.c_int*1)()
417
+ size = (ctypes.c_int*1)()
418
+ type = (ctypes.c_uint*1)()
419
+ name = ctypes.create_string_buffer(bufsize)
420
+ res = _lib.glGetActiveUniform(program, index, bufsize, length, size, type, name)
421
+ name = name[:length[0]].decode('utf-8')
422
+ return name, size[0], type[0]
423
+
424
+
425
+ _lib.glGetAttachedShaders.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_uint),
426
+ # void = glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
427
+ def glGetAttachedShaders(program):
428
+ maxcount = 256
429
+ count = (ctypes.c_int*1)()
430
+ shaders = (ctypes.c_uint*maxcount)()
431
+ res = _lib.glGetAttachedShaders(program, maxcount, count, shaders)
432
+ return tuple(shaders[:count[0]])
433
+
434
+
435
+ _lib.glGetAttribLocation.argtypes = ctypes.c_uint, ctypes.c_char_p,
436
+ _lib.glGetAttribLocation.restype = ctypes.c_int
437
+ # GLint = glGetAttribLocation(GLuint program, GLchar* name)
438
+ def glGetAttribLocation(program, name):
439
+ name = ctypes.c_char_p(name.encode('utf-8'))
440
+ res = _lib.glGetAttribLocation(program, name)
441
+ return res
442
+
443
+
444
+ _lib.glGetBooleanv.argtypes = ctypes.c_uint, ctypes.POINTER(ctypes.c_bool),
445
+ # void = glGetBooleanv(GLenum pname, GLboolean* params)
446
+ def _glGetBooleanv(pname):
447
+ params = (ctypes.c_bool*1)()
448
+ res = _lib.glGetBooleanv(pname, params)
449
+ return params[0]
450
+
451
+
452
+ _lib.glGetBufferParameteriv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
453
+ # void = glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
454
+ def glGetBufferParameter(target, pname):
455
+ d = -2**31 # smallest 32bit integer
456
+ params = (ctypes.c_int*1)(d)
457
+ res = _lib.glGetBufferParameteriv(target, pname, params)
458
+ return params[0]
459
+
460
+
461
+ _lib.glGetError.argtypes = ()
462
+ _lib.glGetError.restype = ctypes.c_uint
463
+ # GLenum = glGetError()
464
+ def glGetError():
465
+ return _lib.glGetError()
466
+
467
+
468
+ _lib.glGetFloatv.argtypes = ctypes.c_uint, ctypes.POINTER(ctypes.c_float),
469
+ # void = glGetFloatv(GLenum pname, GLfloat* params)
470
+ def _glGetFloatv(pname):
471
+ n = 16
472
+ d = float('Inf')
473
+ params = (ctypes.c_float*n)(*[d for i in range(n)])
474
+ res = _lib.glGetFloatv(pname, params)
475
+ params = [p for p in params if p!=d]
476
+ if len(params) == 1:
477
+ return params[0]
478
+ else:
479
+ return tuple(params)
480
+
481
+
482
+ _lib.glGetFramebufferAttachmentParameteriv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
483
+ # void = glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
484
+ def glGetFramebufferAttachmentParameter(target, attachment, pname):
485
+ d = -2**31 # smallest 32bit integer
486
+ params = (ctypes.c_int*1)(d)
487
+ res = _lib.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params)
488
+ return params[0]
489
+
490
+
491
+ _lib.glGetIntegerv.argtypes = ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
492
+ # void = glGetIntegerv(GLenum pname, GLint* params)
493
+ def _glGetIntegerv(pname):
494
+ n = 16
495
+ d = -2**31 # smallest 32bit integer
496
+ params = (ctypes.c_int*n)(*[d for i in range(n)])
497
+ res = _lib.glGetIntegerv(pname, params)
498
+ params = [p for p in params if p!=d]
499
+ if len(params) == 1:
500
+ return params[0]
501
+ else:
502
+ return tuple(params)
503
+
504
+
505
+ _lib.glGetProgramInfoLog.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_char_p,
506
+ # void = glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
507
+ def glGetProgramInfoLog(program):
508
+ bufsize = 1024
509
+ length = (ctypes.c_int*1)()
510
+ infolog = ctypes.create_string_buffer(bufsize)
511
+ res = _lib.glGetProgramInfoLog(program, bufsize, length, infolog)
512
+ return infolog[:length[0]].decode('utf-8')
513
+
514
+
515
+ _lib.glGetProgramiv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
516
+ # void = glGetProgramiv(GLuint program, GLenum pname, GLint* params)
517
+ def glGetProgramParameter(program, pname):
518
+ params = (ctypes.c_int*1)()
519
+ res = _lib.glGetProgramiv(program, pname, params)
520
+ return params[0]
521
+
522
+
523
+ _lib.glGetRenderbufferParameteriv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
524
+ # void = glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
525
+ def glGetRenderbufferParameter(target, pname):
526
+ d = -2**31 # smallest 32bit integer
527
+ params = (ctypes.c_int*1)(d)
528
+ res = _lib.glGetRenderbufferParameteriv(target, pname, params)
529
+ return params[0]
530
+
531
+
532
+ _lib.glGetShaderInfoLog.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_char_p,
533
+ # void = glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
534
+ def glGetShaderInfoLog(shader):
535
+ bufsize = 1024
536
+ length = (ctypes.c_int*1)()
537
+ infolog = ctypes.create_string_buffer(bufsize)
538
+ res = _lib.glGetShaderInfoLog(shader, bufsize, length, infolog)
539
+ return infolog[:length[0]].decode('utf-8')
540
+
541
+
542
+ _lib.glGetShaderPrecisionFormat.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int),
543
+ # void = glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
544
+ def glGetShaderPrecisionFormat(shadertype, precisiontype):
545
+ range = (ctypes.c_int*1)()
546
+ precision = (ctypes.c_int*1)()
547
+ res = _lib.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision)
548
+ return range[0], precision[0]
549
+
550
+
551
+ _lib.glGetShaderSource.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_char_p,
552
+ # void = glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
553
+ def glGetShaderSource(shader):
554
+ bufsize = 1024*1024
555
+ length = (ctypes.c_int*1)()
556
+ source = (ctypes.c_char*bufsize)()
557
+ res = _lib.glGetShaderSource(shader, bufsize, length, source)
558
+ return source.value[:length[0]].decode('utf-8')
559
+
560
+
561
+ _lib.glGetShaderiv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
562
+ # void = glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
563
+ def glGetShaderParameter(shader, pname):
564
+ params = (ctypes.c_int*1)()
565
+ res = _lib.glGetShaderiv(shader, pname, params)
566
+ return params[0]
567
+
568
+
569
+ _lib.glGetString.argtypes = ctypes.c_uint,
570
+ _lib.glGetString.restype = ctypes.c_char_p
571
+ # GLubyte* = glGetString(GLenum name)
572
+ def glGetParameter(pname):
573
+ if pname in [33902, 33901, 32773, 3106, 2931, 2928,
574
+ 2849, 32824, 10752, 32938]:
575
+ # GL_ALIASED_LINE_WIDTH_RANGE GL_ALIASED_POINT_SIZE_RANGE
576
+ # GL_BLEND_COLOR GL_COLOR_CLEAR_VALUE GL_DEPTH_CLEAR_VALUE
577
+ # GL_DEPTH_RANGE GL_LINE_WIDTH GL_POLYGON_OFFSET_FACTOR
578
+ # GL_POLYGON_OFFSET_UNITS GL_SAMPLE_COVERAGE_VALUE
579
+ return _glGetFloatv(pname)
580
+ elif pname in [7936, 7937, 7938, 35724, 7939]:
581
+ # GL_VENDOR, GL_RENDERER, GL_VERSION, GL_SHADING_LANGUAGE_VERSION,
582
+ # GL_EXTENSIONS are strings
583
+ pass # string handled below
584
+ else:
585
+ return _glGetIntegerv(pname)
586
+ name = pname
587
+ res = _lib.glGetString(name)
588
+ return ctypes.string_at(res).decode('utf-8') if res else ''
589
+
590
+
591
+ _lib.glGetTexParameterfv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_float),
592
+ # void = glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
593
+ def glGetTexParameter(target, pname):
594
+ d = float('Inf')
595
+ params = (ctypes.c_float*1)(d)
596
+ res = _lib.glGetTexParameterfv(target, pname, params)
597
+ return params[0]
598
+
599
+
600
+ _lib.glGetUniformfv.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_float),
601
+ # void = glGetUniformfv(GLuint program, GLint location, GLfloat* params)
602
+ def glGetUniform(program, location):
603
+ n = 16
604
+ d = float('Inf')
605
+ params = (ctypes.c_float*n)(*[d for i in range(n)])
606
+ res = _lib.glGetUniformfv(program, location, params)
607
+ params = [p for p in params if p!=d]
608
+ if len(params) == 1:
609
+ return params[0]
610
+ else:
611
+ return tuple(params)
612
+
613
+
614
+ _lib.glGetUniformLocation.argtypes = ctypes.c_uint, ctypes.c_char_p,
615
+ _lib.glGetUniformLocation.restype = ctypes.c_int
616
+ # GLint = glGetUniformLocation(GLuint program, GLchar* name)
617
+ def glGetUniformLocation(program, name):
618
+ name = ctypes.c_char_p(name.encode('utf-8'))
619
+ res = _lib.glGetUniformLocation(program, name)
620
+ return res
621
+
622
+
623
+ _lib.glGetVertexAttribfv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_float),
624
+ # void = glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
625
+ def glGetVertexAttrib(index, pname):
626
+ n = 4
627
+ d = float('Inf')
628
+ params = (ctypes.c_float*n)(*[d for i in range(n)])
629
+ res = _lib.glGetVertexAttribfv(index, pname, params)
630
+ params = [p for p in params if p!=d]
631
+ if len(params) == 1:
632
+ return params[0]
633
+ else:
634
+ return tuple(params)
635
+
636
+
637
+ _lib.glGetVertexAttribPointerv.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_void_p),
638
+ # void = glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
639
+ def glGetVertexAttribOffset(index, pname):
640
+ pointer = (ctypes.c_void_p*1)()
641
+ res = _lib.glGetVertexAttribPointerv(index, pname, pointer)
642
+ return pointer[0] or 0
643
+
644
+
645
+ _lib.glHint.argtypes = ctypes.c_uint, ctypes.c_uint,
646
+ # void = glHint(GLenum target, GLenum mode)
647
+ def glHint(target, mode):
648
+ _lib.glHint(target, mode)
649
+
650
+
651
+ _lib.glIsBuffer.argtypes = ctypes.c_uint,
652
+ _lib.glIsBuffer.restype = ctypes.c_bool
653
+ # GLboolean = glIsBuffer(GLuint buffer)
654
+ def glIsBuffer(buffer):
655
+ return _lib.glIsBuffer(buffer)
656
+
657
+
658
+ _lib.glIsEnabled.argtypes = ctypes.c_uint,
659
+ _lib.glIsEnabled.restype = ctypes.c_bool
660
+ # GLboolean = glIsEnabled(GLenum cap)
661
+ def glIsEnabled(cap):
662
+ return _lib.glIsEnabled(cap)
663
+
664
+
665
+ _lib.glIsFramebuffer.argtypes = ctypes.c_uint,
666
+ _lib.glIsFramebuffer.restype = ctypes.c_bool
667
+ # GLboolean = glIsFramebuffer(GLuint framebuffer)
668
+ def glIsFramebuffer(framebuffer):
669
+ return _lib.glIsFramebuffer(framebuffer)
670
+
671
+
672
+ _lib.glIsProgram.argtypes = ctypes.c_uint,
673
+ _lib.glIsProgram.restype = ctypes.c_bool
674
+ # GLboolean = glIsProgram(GLuint program)
675
+ def glIsProgram(program):
676
+ return _lib.glIsProgram(program)
677
+
678
+
679
+ _lib.glIsRenderbuffer.argtypes = ctypes.c_uint,
680
+ _lib.glIsRenderbuffer.restype = ctypes.c_bool
681
+ # GLboolean = glIsRenderbuffer(GLuint renderbuffer)
682
+ def glIsRenderbuffer(renderbuffer):
683
+ return _lib.glIsRenderbuffer(renderbuffer)
684
+
685
+
686
+ _lib.glIsShader.argtypes = ctypes.c_uint,
687
+ _lib.glIsShader.restype = ctypes.c_bool
688
+ # GLboolean = glIsShader(GLuint shader)
689
+ def glIsShader(shader):
690
+ return _lib.glIsShader(shader)
691
+
692
+
693
+ _lib.glIsTexture.argtypes = ctypes.c_uint,
694
+ _lib.glIsTexture.restype = ctypes.c_bool
695
+ # GLboolean = glIsTexture(GLuint texture)
696
+ def glIsTexture(texture):
697
+ return _lib.glIsTexture(texture)
698
+
699
+
700
+ _lib.glLineWidth.argtypes = ctypes.c_float,
701
+ # void = glLineWidth(GLfloat width)
702
+ def glLineWidth(width):
703
+ _lib.glLineWidth(width)
704
+
705
+
706
+ _lib.glLinkProgram.argtypes = ctypes.c_uint,
707
+ # void = glLinkProgram(GLuint program)
708
+ def glLinkProgram(program):
709
+ _lib.glLinkProgram(program)
710
+
711
+
712
+ _lib.glPixelStorei.argtypes = ctypes.c_uint, ctypes.c_int,
713
+ # void = glPixelStorei(GLenum pname, GLint param)
714
+ def glPixelStorei(pname, param):
715
+ _lib.glPixelStorei(pname, param)
716
+
717
+
718
+ _lib.glPolygonOffset.argtypes = ctypes.c_float, ctypes.c_float,
719
+ # void = glPolygonOffset(GLfloat factor, GLfloat units)
720
+ def glPolygonOffset(factor, units):
721
+ _lib.glPolygonOffset(factor, units)
722
+
723
+
724
+ _lib.glReadPixels.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_void_p,
725
+ # void = glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
726
+ def glReadPixels(x, y, width, height, format, type):
727
+ # GL_ALPHA, GL_RGB, GL_RGBA
728
+ t = {6406:1, 6407:3, 6408:4}[format]
729
+ # GL_UNSIGNED_BYTE, GL_FLOAT
730
+ nb = {5121:1, 5126:4}[type]
731
+ size = int(width*height*t*nb)
732
+ pixels = ctypes.create_string_buffer(size)
733
+ res = _lib.glReadPixels(x, y, width, height, format, type, pixels)
734
+ return pixels[:]
735
+
736
+
737
+ _lib.glRenderbufferStorage.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_int,
738
+ # void = glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
739
+ def glRenderbufferStorage(target, internalformat, width, height):
740
+ _lib.glRenderbufferStorage(target, internalformat, width, height)
741
+
742
+
743
+ _lib.glSampleCoverage.argtypes = ctypes.c_float, ctypes.c_bool,
744
+ # void = glSampleCoverage(GLclampf value, GLboolean invert)
745
+ def glSampleCoverage(value, invert):
746
+ _lib.glSampleCoverage(value, invert)
747
+
748
+
749
+ _lib.glScissor.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
750
+ # void = glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
751
+ def glScissor(x, y, width, height):
752
+ _lib.glScissor(x, y, width, height)
753
+
754
+
755
+ _lib.glShaderSource.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_int),
756
+ # void = glShaderSource(GLuint shader, GLsizei count, GLchar** string, GLint* length)
757
+ def glShaderSource(shader, source):
758
+ # Some implementation do not like getting a list of single chars
759
+ if isinstance(source, (tuple, list)):
760
+ strings = [s for s in source]
761
+ else:
762
+ strings = [source]
763
+ count = len(strings)
764
+ string = (ctypes.c_char_p*count)(*[s.encode('utf-8') for s in strings])
765
+ length = (ctypes.c_int*count)(*[len(s) for s in strings])
766
+ res = _lib.glShaderSource(shader, count, string, length)
767
+
768
+
769
+ _lib.glStencilFunc.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_uint,
770
+ # void = glStencilFunc(GLenum func, GLint ref, GLuint mask)
771
+ def glStencilFunc(func, ref, mask):
772
+ _lib.glStencilFunc(func, ref, mask)
773
+
774
+
775
+ _lib.glStencilFuncSeparate.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_uint,
776
+ # void = glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
777
+ def glStencilFuncSeparate(face, func, ref, mask):
778
+ _lib.glStencilFuncSeparate(face, func, ref, mask)
779
+
780
+
781
+ _lib.glStencilMask.argtypes = ctypes.c_uint,
782
+ # void = glStencilMask(GLuint mask)
783
+ def glStencilMask(mask):
784
+ _lib.glStencilMask(mask)
785
+
786
+
787
+ _lib.glStencilMaskSeparate.argtypes = ctypes.c_uint, ctypes.c_uint,
788
+ # void = glStencilMaskSeparate(GLenum face, GLuint mask)
789
+ def glStencilMaskSeparate(face, mask):
790
+ _lib.glStencilMaskSeparate(face, mask)
791
+
792
+
793
+ _lib.glStencilOp.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,
794
+ # void = glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
795
+ def glStencilOp(fail, zfail, zpass):
796
+ _lib.glStencilOp(fail, zfail, zpass)
797
+
798
+
799
+ _lib.glStencilOpSeparate.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,
800
+ # void = glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
801
+ def glStencilOpSeparate(face, fail, zfail, zpass):
802
+ _lib.glStencilOpSeparate(face, fail, zfail, zpass)
803
+
804
+
805
+ _lib.glTexImage2D.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_void_p,
806
+ # void = glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid* pixels)
807
+ def glTexImage2D(target, level, internalformat, format, type, pixels):
808
+ border = 0
809
+ if isinstance(pixels, (tuple, list)):
810
+ height, width = pixels
811
+ pixels = ctypes.c_void_p(0)
812
+ pixels = None
813
+ else:
814
+ if not pixels.flags['C_CONTIGUOUS']:
815
+ pixels = pixels.copy('C')
816
+ pixels_ = pixels
817
+ pixels = pixels_.ctypes.data
818
+ height, width = pixels_.shape[:2]
819
+ res = _lib.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels)
820
+
821
+
822
+ _lib.glTexParameterf.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_float,
823
+ def glTexParameterf(target, pname, param):
824
+ _lib.glTexParameterf(target, pname, param)
825
+ _lib.glTexParameteri.argtypes = ctypes.c_uint, ctypes.c_uint, ctypes.c_int,
826
+ def glTexParameteri(target, pname, param):
827
+ _lib.glTexParameteri(target, pname, param)
828
+
829
+
830
+ _lib.glTexSubImage2D.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_void_p,
831
+ # void = glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
832
+ def glTexSubImage2D(target, level, xoffset, yoffset, format, type, pixels):
833
+ if not pixels.flags['C_CONTIGUOUS']:
834
+ pixels = pixels.copy('C')
835
+ pixels_ = pixels
836
+ pixels = pixels_.ctypes.data
837
+ height, width = pixels_.shape[:2]
838
+ res = _lib.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels)
839
+
840
+
841
+ _lib.glUniform1f.argtypes = ctypes.c_int, ctypes.c_float,
842
+ def glUniform1f(location, v1):
843
+ _lib.glUniform1f(location, v1)
844
+ _lib.glUniform2f.argtypes = ctypes.c_int, ctypes.c_float, ctypes.c_float,
845
+ def glUniform2f(location, v1, v2):
846
+ _lib.glUniform2f(location, v1, v2)
847
+ _lib.glUniform3f.argtypes = ctypes.c_int, ctypes.c_float, ctypes.c_float, ctypes.c_float,
848
+ def glUniform3f(location, v1, v2, v3):
849
+ _lib.glUniform3f(location, v1, v2, v3)
850
+ _lib.glUniform4f.argtypes = ctypes.c_int, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,
851
+ def glUniform4f(location, v1, v2, v3, v4):
852
+ _lib.glUniform4f(location, v1, v2, v3, v4)
853
+ _lib.glUniform1i.argtypes = ctypes.c_int, ctypes.c_int,
854
+ def glUniform1i(location, v1):
855
+ _lib.glUniform1i(location, v1)
856
+ _lib.glUniform2i.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_int,
857
+ def glUniform2i(location, v1, v2):
858
+ _lib.glUniform2i(location, v1, v2)
859
+ _lib.glUniform3i.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
860
+ def glUniform3i(location, v1, v2, v3):
861
+ _lib.glUniform3i(location, v1, v2, v3)
862
+ _lib.glUniform4i.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
863
+ def glUniform4i(location, v1, v2, v3, v4):
864
+ _lib.glUniform4i(location, v1, v2, v3, v4)
865
+ _lib.glUniform1fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),
866
+ def glUniform1fv(location, count, values):
867
+ values = [float(val) for val in values]
868
+ values = (ctypes.c_float*len(values))(*values)
869
+ _lib.glUniform1fv(location, count, values)
870
+ _lib.glUniform2fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),
871
+ def glUniform2fv(location, count, values):
872
+ values = [float(val) for val in values]
873
+ values = (ctypes.c_float*len(values))(*values)
874
+ _lib.glUniform2fv(location, count, values)
875
+ _lib.glUniform3fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),
876
+ def glUniform3fv(location, count, values):
877
+ values = [float(val) for val in values]
878
+ values = (ctypes.c_float*len(values))(*values)
879
+ _lib.glUniform3fv(location, count, values)
880
+ _lib.glUniform4fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),
881
+ def glUniform4fv(location, count, values):
882
+ values = [float(val) for val in values]
883
+ values = (ctypes.c_float*len(values))(*values)
884
+ _lib.glUniform4fv(location, count, values)
885
+ _lib.glUniform1iv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),
886
+ def glUniform1iv(location, count, values):
887
+ values = [int(val) for val in values]
888
+ values = (ctypes.c_int*len(values))(*values)
889
+ _lib.glUniform1iv(location, count, values)
890
+ _lib.glUniform2iv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),
891
+ def glUniform2iv(location, count, values):
892
+ values = [int(val) for val in values]
893
+ values = (ctypes.c_int*len(values))(*values)
894
+ _lib.glUniform2iv(location, count, values)
895
+ _lib.glUniform3iv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),
896
+ def glUniform3iv(location, count, values):
897
+ values = [int(val) for val in values]
898
+ values = (ctypes.c_int*len(values))(*values)
899
+ _lib.glUniform3iv(location, count, values)
900
+ _lib.glUniform4iv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),
901
+ def glUniform4iv(location, count, values):
902
+ values = [int(val) for val in values]
903
+ values = (ctypes.c_int*len(values))(*values)
904
+ _lib.glUniform4iv(location, count, values)
905
+
906
+
907
+ _lib.glUniformMatrix2fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_bool, ctypes.POINTER(ctypes.c_float),
908
+ def glUniformMatrix2fv(location, count, transpose, values):
909
+ if not values.flags["C_CONTIGUOUS"]:
910
+ values = values.copy()
911
+ assert values.dtype.name == "float32"
912
+ values_ = values
913
+ values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))
914
+ _lib.glUniformMatrix2fv(location, count, transpose, values)
915
+ _lib.glUniformMatrix3fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_bool, ctypes.POINTER(ctypes.c_float),
916
+ def glUniformMatrix3fv(location, count, transpose, values):
917
+ if not values.flags["C_CONTIGUOUS"]:
918
+ values = values.copy()
919
+ assert values.dtype.name == "float32"
920
+ values_ = values
921
+ values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))
922
+ _lib.glUniformMatrix3fv(location, count, transpose, values)
923
+ _lib.glUniformMatrix4fv.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_bool, ctypes.POINTER(ctypes.c_float),
924
+ def glUniformMatrix4fv(location, count, transpose, values):
925
+ if not values.flags["C_CONTIGUOUS"]:
926
+ values = values.copy()
927
+ assert values.dtype.name == "float32"
928
+ values_ = values
929
+ values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))
930
+ _lib.glUniformMatrix4fv(location, count, transpose, values)
931
+
932
+
933
+ _lib.glUseProgram.argtypes = ctypes.c_uint,
934
+ # void = glUseProgram(GLuint program)
935
+ def glUseProgram(program):
936
+ _lib.glUseProgram(program)
937
+
938
+
939
+ _lib.glValidateProgram.argtypes = ctypes.c_uint,
940
+ # void = glValidateProgram(GLuint program)
941
+ def glValidateProgram(program):
942
+ _lib.glValidateProgram(program)
943
+
944
+
945
+ _lib.glVertexAttrib1f.argtypes = ctypes.c_uint, ctypes.c_float,
946
+ def glVertexAttrib1f(index, v1):
947
+ _lib.glVertexAttrib1f(index, v1)
948
+ _lib.glVertexAttrib2f.argtypes = ctypes.c_uint, ctypes.c_float, ctypes.c_float,
949
+ def glVertexAttrib2f(index, v1, v2):
950
+ _lib.glVertexAttrib2f(index, v1, v2)
951
+ _lib.glVertexAttrib3f.argtypes = ctypes.c_uint, ctypes.c_float, ctypes.c_float, ctypes.c_float,
952
+ def glVertexAttrib3f(index, v1, v2, v3):
953
+ _lib.glVertexAttrib3f(index, v1, v2, v3)
954
+ _lib.glVertexAttrib4f.argtypes = ctypes.c_uint, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,
955
+ def glVertexAttrib4f(index, v1, v2, v3, v4):
956
+ _lib.glVertexAttrib4f(index, v1, v2, v3, v4)
957
+
958
+
959
+ _lib.glVertexAttribPointer.argtypes = ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_bool, ctypes.c_int, ctypes.c_void_p,
960
+ # void = glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid* ptr)
961
+ def glVertexAttribPointer(indx, size, type, normalized, stride, offset):
962
+ if offset is None:
963
+ offset = ctypes.c_void_p(0)
964
+ elif isinstance(offset, ctypes.c_void_p):
965
+ pass
966
+ elif isinstance(offset, (int, ctypes.c_int)):
967
+ offset = ctypes.c_void_p(int(offset))
968
+ else:
969
+ if not offset.flags['C_CONTIGUOUS']:
970
+ offset = offset.copy('C')
971
+ offset_ = offset
972
+ offset = offset.ctypes.data
973
+ # We need to ensure that the data exists at draw time :(
974
+ # PyOpenGL does this too
975
+ key = '_vert_attr_'+str(indx)
976
+ setattr(glVertexAttribPointer, key, offset_)
977
+ ptr = offset
978
+ res = _lib.glVertexAttribPointer(indx, size, type, normalized, stride, ptr)
979
+
980
+
981
+ _lib.glViewport.argtypes = ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
982
+ # void = glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
983
+ def glViewport(x, y, width, height):
984
+ _lib.glViewport(x, y, width, height)
985
+
986
+