vispy 0.14.0__cp311-cp311-macosx_11_0_arm64.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 (519) 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 +968 -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 +1134 -0
  45. vispy/color/tests/__init__.py +0 -0
  46. vispy/color/tests/test_color.py +352 -0
  47. vispy/conftest.py +12 -0
  48. vispy/ext/__init__.py +0 -0
  49. vispy/ext/cocoapy.py +1542 -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 +134 -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 +698 -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 +506 -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 +566 -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 +1816 -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 +1045 -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 +106 -0
  274. vispy/scene/cameras/base_camera.py +538 -0
  275. vispy/scene/cameras/fly.py +474 -0
  276. vispy/scene/cameras/magnify.py +163 -0
  277. vispy/scene/cameras/panzoom.py +308 -0
  278. vispy/scene/cameras/perspective.py +333 -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 +173 -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 +446 -0
  306. vispy/testing/_testing.py +416 -0
  307. vispy/testing/image_tester.py +473 -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 +17 -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 +4 -0
  377. vispy/visuals/__init__.py +50 -0
  378. vispy/visuals/_scalable_textures.py +485 -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 +163 -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 +796 -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 +105 -0
  430. vispy/visuals/gridmesh.py +98 -0
  431. vispy/visuals/histogram.py +58 -0
  432. vispy/visuals/image.py +688 -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 +810 -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_histogram.py +24 -0
  477. vispy/visuals/tests/test_image.py +390 -0
  478. vispy/visuals/tests/test_image_complex.py +36 -0
  479. vispy/visuals/tests/test_infinite_line.py +53 -0
  480. vispy/visuals/tests/test_instanced_mesh.py +50 -0
  481. vispy/visuals/tests/test_isosurface.py +22 -0
  482. vispy/visuals/tests/test_linear_region.py +152 -0
  483. vispy/visuals/tests/test_markers.py +54 -0
  484. vispy/visuals/tests/test_mesh.py +261 -0
  485. vispy/visuals/tests/test_mesh_normals.py +218 -0
  486. vispy/visuals/tests/test_polygon.py +112 -0
  487. vispy/visuals/tests/test_rectangle.py +163 -0
  488. vispy/visuals/tests/test_regular_polygon.py +111 -0
  489. vispy/visuals/tests/test_scalable_textures.py +180 -0
  490. vispy/visuals/tests/test_sdf.py +73 -0
  491. vispy/visuals/tests/test_spectrogram.py +42 -0
  492. vispy/visuals/tests/test_text.py +95 -0
  493. vispy/visuals/tests/test_volume.py +542 -0
  494. vispy/visuals/tests/test_windbarb.py +33 -0
  495. vispy/visuals/text/__init__.py +7 -0
  496. vispy/visuals/text/_sdf_cpu.cpython-311-darwin.so +0 -0
  497. vispy/visuals/text/_sdf_cpu.pyx +110 -0
  498. vispy/visuals/text/_sdf_gpu.py +316 -0
  499. vispy/visuals/text/text.py +675 -0
  500. vispy/visuals/transforms/__init__.py +34 -0
  501. vispy/visuals/transforms/_util.py +191 -0
  502. vispy/visuals/transforms/base_transform.py +233 -0
  503. vispy/visuals/transforms/chain.py +300 -0
  504. vispy/visuals/transforms/interactive.py +98 -0
  505. vispy/visuals/transforms/linear.py +564 -0
  506. vispy/visuals/transforms/nonlinear.py +398 -0
  507. vispy/visuals/transforms/tests/__init__.py +0 -0
  508. vispy/visuals/transforms/tests/test_transforms.py +243 -0
  509. vispy/visuals/transforms/transform_system.py +339 -0
  510. vispy/visuals/tube.py +173 -0
  511. vispy/visuals/visual.py +923 -0
  512. vispy/visuals/volume.py +1335 -0
  513. vispy/visuals/windbarb.py +291 -0
  514. vispy/visuals/xyz_axis.py +34 -0
  515. vispy-0.14.0.dist-info/LICENSE.txt +36 -0
  516. vispy-0.14.0.dist-info/METADATA +218 -0
  517. vispy-0.14.0.dist-info/RECORD +519 -0
  518. vispy-0.14.0.dist-info/WHEEL +5 -0
  519. vispy-0.14.0.dist-info/top_level.txt +1 -0
vispy/gloo/gl/_gl2.py ADDED
@@ -0,0 +1,1365 @@
1
+ """GL definitions converted to Python by codegen/createglapi.py.
2
+
3
+ THIS CODE IS AUTO-GENERATED. DO NOT EDIT.
4
+
5
+ Subset of desktop GL API compatible with GL ES 2.0
6
+
7
+ """
8
+
9
+ import ctypes
10
+ from .gl2 import _lib, _get_gl_func
11
+
12
+
13
+ # void = glActiveTexture(GLenum texture)
14
+ def glActiveTexture(texture):
15
+ try:
16
+ nativefunc = glActiveTexture._native
17
+ except AttributeError:
18
+ nativefunc = glActiveTexture._native = _get_gl_func("glActiveTexture", None, (ctypes.c_uint,))
19
+ nativefunc(texture)
20
+
21
+
22
+ # void = glAttachShader(GLuint program, GLuint shader)
23
+ def glAttachShader(program, shader):
24
+ try:
25
+ nativefunc = glAttachShader._native
26
+ except AttributeError:
27
+ nativefunc = glAttachShader._native = _get_gl_func("glAttachShader", None, (ctypes.c_uint, ctypes.c_uint,))
28
+ nativefunc(program, shader)
29
+
30
+
31
+ # void = glBindAttribLocation(GLuint program, GLuint index, GLchar* name)
32
+ def glBindAttribLocation(program, index, name):
33
+ name = ctypes.c_char_p(name.encode('utf-8'))
34
+ try:
35
+ nativefunc = glBindAttribLocation._native
36
+ except AttributeError:
37
+ nativefunc = glBindAttribLocation._native = _get_gl_func("glBindAttribLocation", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_char_p,))
38
+ res = nativefunc(program, index, name)
39
+
40
+
41
+ # void = glBindBuffer(GLenum target, GLuint buffer)
42
+ def glBindBuffer(target, buffer):
43
+ try:
44
+ nativefunc = glBindBuffer._native
45
+ except AttributeError:
46
+ nativefunc = glBindBuffer._native = _get_gl_func("glBindBuffer", None, (ctypes.c_uint, ctypes.c_uint,))
47
+ nativefunc(target, buffer)
48
+
49
+
50
+ # void = glBindFramebuffer(GLenum target, GLuint framebuffer)
51
+ def glBindFramebuffer(target, framebuffer):
52
+ try:
53
+ nativefunc = glBindFramebuffer._native
54
+ except AttributeError:
55
+ nativefunc = glBindFramebuffer._native = _get_gl_func("glBindFramebuffer", None, (ctypes.c_uint, ctypes.c_uint,))
56
+ nativefunc(target, framebuffer)
57
+
58
+
59
+ # void = glBindRenderbuffer(GLenum target, GLuint renderbuffer)
60
+ def glBindRenderbuffer(target, renderbuffer):
61
+ try:
62
+ nativefunc = glBindRenderbuffer._native
63
+ except AttributeError:
64
+ nativefunc = glBindRenderbuffer._native = _get_gl_func("glBindRenderbuffer", None, (ctypes.c_uint, ctypes.c_uint,))
65
+ nativefunc(target, renderbuffer)
66
+
67
+
68
+ # void = glBindTexture(GLenum target, GLuint texture)
69
+ def glBindTexture(target, texture):
70
+ try:
71
+ nativefunc = glBindTexture._native
72
+ except AttributeError:
73
+ nativefunc = glBindTexture._native = _get_gl_func("glBindTexture", None, (ctypes.c_uint, ctypes.c_uint,))
74
+ nativefunc(target, texture)
75
+
76
+
77
+ # void = glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
78
+ def glBlendColor(red, green, blue, alpha):
79
+ try:
80
+ nativefunc = glBlendColor._native
81
+ except AttributeError:
82
+ nativefunc = glBlendColor._native = _get_gl_func("glBlendColor", None, (ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,))
83
+ nativefunc(red, green, blue, alpha)
84
+
85
+
86
+ # void = glBlendEquation(GLenum mode)
87
+ def glBlendEquation(mode):
88
+ try:
89
+ nativefunc = glBlendEquation._native
90
+ except AttributeError:
91
+ nativefunc = glBlendEquation._native = _get_gl_func("glBlendEquation", None, (ctypes.c_uint,))
92
+ nativefunc(mode)
93
+
94
+
95
+ # void = glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
96
+ def glBlendEquationSeparate(modeRGB, modeAlpha):
97
+ try:
98
+ nativefunc = glBlendEquationSeparate._native
99
+ except AttributeError:
100
+ nativefunc = glBlendEquationSeparate._native = _get_gl_func("glBlendEquationSeparate", None, (ctypes.c_uint, ctypes.c_uint,))
101
+ nativefunc(modeRGB, modeAlpha)
102
+
103
+
104
+ # void = glBlendFunc(GLenum sfactor, GLenum dfactor)
105
+ def glBlendFunc(sfactor, dfactor):
106
+ try:
107
+ nativefunc = glBlendFunc._native
108
+ except AttributeError:
109
+ nativefunc = glBlendFunc._native = _get_gl_func("glBlendFunc", None, (ctypes.c_uint, ctypes.c_uint,))
110
+ nativefunc(sfactor, dfactor)
111
+
112
+
113
+ # void = glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
114
+ def glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha):
115
+ try:
116
+ nativefunc = glBlendFuncSeparate._native
117
+ except AttributeError:
118
+ nativefunc = glBlendFuncSeparate._native = _get_gl_func("glBlendFuncSeparate", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,))
119
+ nativefunc(srcRGB, dstRGB, srcAlpha, dstAlpha)
120
+
121
+
122
+ # void = glBufferData(GLenum target, GLsizeiptr size, GLvoid* data, GLenum usage)
123
+ def glBufferData(target, data, usage):
124
+ """Data can be numpy array or the size of data to allocate."""
125
+ if isinstance(data, int):
126
+ size = data
127
+ data = ctypes.c_voidp(0)
128
+ else:
129
+ if not data.flags['C_CONTIGUOUS'] or not data.flags['ALIGNED']:
130
+ data = data.copy('C')
131
+ data_ = data
132
+ size = data_.nbytes
133
+ data = data_.ctypes.data
134
+ try:
135
+ nativefunc = glBufferData._native
136
+ except AttributeError:
137
+ nativefunc = glBufferData._native = _get_gl_func("glBufferData", None, (ctypes.c_uint, ctypes.c_ssize_t, ctypes.c_void_p, ctypes.c_uint,))
138
+ res = nativefunc(target, size, data, usage)
139
+
140
+
141
+ # void = glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data)
142
+ def glBufferSubData(target, offset, data):
143
+ if not data.flags['C_CONTIGUOUS']:
144
+ data = data.copy('C')
145
+ data_ = data
146
+ size = data_.nbytes
147
+ data = data_.ctypes.data
148
+ try:
149
+ nativefunc = glBufferSubData._native
150
+ except AttributeError:
151
+ nativefunc = glBufferSubData._native = _get_gl_func("glBufferSubData", None, (ctypes.c_uint, ctypes.c_ssize_t, ctypes.c_ssize_t, ctypes.c_void_p,))
152
+ res = nativefunc(target, offset, size, data)
153
+
154
+
155
+ # GLenum = glCheckFramebufferStatus(GLenum target)
156
+ def glCheckFramebufferStatus(target):
157
+ try:
158
+ nativefunc = glCheckFramebufferStatus._native
159
+ except AttributeError:
160
+ nativefunc = glCheckFramebufferStatus._native = _get_gl_func("glCheckFramebufferStatus", ctypes.c_uint, (ctypes.c_uint,))
161
+ return nativefunc(target)
162
+
163
+
164
+ # void = glClear(GLbitfield mask)
165
+ def glClear(mask):
166
+ try:
167
+ nativefunc = glClear._native
168
+ except AttributeError:
169
+ nativefunc = glClear._native = _get_gl_func("glClear", None, (ctypes.c_uint,))
170
+ nativefunc(mask)
171
+
172
+
173
+ # void = glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
174
+ def glClearColor(red, green, blue, alpha):
175
+ try:
176
+ nativefunc = glClearColor._native
177
+ except AttributeError:
178
+ nativefunc = glClearColor._native = _get_gl_func("glClearColor", None, (ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,))
179
+ nativefunc(red, green, blue, alpha)
180
+
181
+
182
+ # void = glClearDepthf(GLclampf depth)
183
+ def glClearDepth(depth):
184
+ try:
185
+ nativefunc = glClearDepth._native
186
+ except AttributeError:
187
+ nativefunc = glClearDepth._native = _get_gl_func("glClearDepth", None, (ctypes.c_double,))
188
+ nativefunc(depth)
189
+
190
+
191
+ # void = glClearStencil(GLint s)
192
+ def glClearStencil(s):
193
+ try:
194
+ nativefunc = glClearStencil._native
195
+ except AttributeError:
196
+ nativefunc = glClearStencil._native = _get_gl_func("glClearStencil", None, (ctypes.c_int,))
197
+ nativefunc(s)
198
+
199
+
200
+ # void = glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
201
+ def glColorMask(red, green, blue, alpha):
202
+ try:
203
+ nativefunc = glColorMask._native
204
+ except AttributeError:
205
+ nativefunc = glColorMask._native = _get_gl_func("glColorMask", None, (ctypes.c_bool, ctypes.c_bool, ctypes.c_bool, ctypes.c_bool,))
206
+ nativefunc(red, green, blue, alpha)
207
+
208
+
209
+ # void = glCompileShader(GLuint shader)
210
+ def glCompileShader(shader):
211
+ try:
212
+ nativefunc = glCompileShader._native
213
+ except AttributeError:
214
+ nativefunc = glCompileShader._native = _get_gl_func("glCompileShader", None, (ctypes.c_uint,))
215
+ nativefunc(shader)
216
+
217
+
218
+ # void = glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLvoid* data)
219
+ def glCompressedTexImage2D(target, level, internalformat, width, height, border, data):
220
+ # border = 0 # set in args
221
+ if not data.flags['C_CONTIGUOUS']:
222
+ data = data.copy('C')
223
+ data_ = data
224
+ size = data_.size
225
+ data = data_.ctypes.data
226
+ try:
227
+ nativefunc = glCompressedTexImage2D._native
228
+ except AttributeError:
229
+ nativefunc = glCompressedTexImage2D._native = _get_gl_func("glCompressedTexImage2D", None, (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,))
230
+ res = nativefunc(target, level, internalformat, width, height, border, imageSize, data)
231
+
232
+
233
+ # void = glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLvoid* data)
234
+ def glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data):
235
+ if not data.flags['C_CONTIGUOUS']:
236
+ data = data.copy('C')
237
+ data_ = data
238
+ size = data_.size
239
+ data = data_.ctypes.data
240
+ try:
241
+ nativefunc = glCompressedTexSubImage2D._native
242
+ except AttributeError:
243
+ nativefunc = glCompressedTexSubImage2D._native = _get_gl_func("glCompressedTexSubImage2D", None, (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,))
244
+ res = nativefunc(target, level, xoffset, yoffset, width, height, format, imageSize, data)
245
+
246
+
247
+ # void = glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
248
+ def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border):
249
+ try:
250
+ nativefunc = glCopyTexImage2D._native
251
+ except AttributeError:
252
+ nativefunc = glCopyTexImage2D._native = _get_gl_func("glCopyTexImage2D", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
253
+ nativefunc(target, level, internalformat, x, y, width, height, border)
254
+
255
+
256
+ # void = glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
257
+ def glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height):
258
+ try:
259
+ nativefunc = glCopyTexSubImage2D._native
260
+ except AttributeError:
261
+ nativefunc = glCopyTexSubImage2D._native = _get_gl_func("glCopyTexSubImage2D", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
262
+ nativefunc(target, level, xoffset, yoffset, x, y, width, height)
263
+
264
+
265
+ # GLuint = glCreateProgram()
266
+ def glCreateProgram():
267
+ try:
268
+ nativefunc = glCreateProgram._native
269
+ except AttributeError:
270
+ nativefunc = glCreateProgram._native = _get_gl_func("glCreateProgram", ctypes.c_uint, ())
271
+ return nativefunc()
272
+
273
+
274
+ # GLuint = glCreateShader(GLenum type)
275
+ def glCreateShader(type):
276
+ try:
277
+ nativefunc = glCreateShader._native
278
+ except AttributeError:
279
+ nativefunc = glCreateShader._native = _get_gl_func("glCreateShader", ctypes.c_uint, (ctypes.c_uint,))
280
+ return nativefunc(type)
281
+
282
+
283
+ # void = glCullFace(GLenum mode)
284
+ def glCullFace(mode):
285
+ try:
286
+ nativefunc = glCullFace._native
287
+ except AttributeError:
288
+ nativefunc = glCullFace._native = _get_gl_func("glCullFace", None, (ctypes.c_uint,))
289
+ nativefunc(mode)
290
+
291
+
292
+ # void = glDeleteBuffers(GLsizei n, GLuint* buffers)
293
+ def glDeleteBuffer(buffer):
294
+ n = 1
295
+ buffers = (ctypes.c_uint*n)(buffer)
296
+ try:
297
+ nativefunc = glDeleteBuffer._native
298
+ except AttributeError:
299
+ nativefunc = glDeleteBuffer._native = _get_gl_func("glDeleteBuffers", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
300
+ res = nativefunc(n, buffers)
301
+
302
+
303
+ # void = glDeleteFramebuffers(GLsizei n, GLuint* framebuffers)
304
+ def glDeleteFramebuffer(framebuffer):
305
+ n = 1
306
+ framebuffers = (ctypes.c_uint*n)(framebuffer)
307
+ try:
308
+ nativefunc = glDeleteFramebuffer._native
309
+ except AttributeError:
310
+ nativefunc = glDeleteFramebuffer._native = _get_gl_func("glDeleteFramebuffers", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
311
+ res = nativefunc(n, framebuffers)
312
+
313
+
314
+ # void = glDeleteProgram(GLuint program)
315
+ def glDeleteProgram(program):
316
+ try:
317
+ nativefunc = glDeleteProgram._native
318
+ except AttributeError:
319
+ nativefunc = glDeleteProgram._native = _get_gl_func("glDeleteProgram", None, (ctypes.c_uint,))
320
+ nativefunc(program)
321
+
322
+
323
+ # void = glDeleteRenderbuffers(GLsizei n, GLuint* renderbuffers)
324
+ def glDeleteRenderbuffer(renderbuffer):
325
+ n = 1
326
+ renderbuffers = (ctypes.c_uint*n)(renderbuffer)
327
+ try:
328
+ nativefunc = glDeleteRenderbuffer._native
329
+ except AttributeError:
330
+ nativefunc = glDeleteRenderbuffer._native = _get_gl_func("glDeleteRenderbuffers", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
331
+ res = nativefunc(n, renderbuffers)
332
+
333
+
334
+ # void = glDeleteShader(GLuint shader)
335
+ def glDeleteShader(shader):
336
+ try:
337
+ nativefunc = glDeleteShader._native
338
+ except AttributeError:
339
+ nativefunc = glDeleteShader._native = _get_gl_func("glDeleteShader", None, (ctypes.c_uint,))
340
+ nativefunc(shader)
341
+
342
+
343
+ # void = glDeleteTextures(GLsizei n, GLuint* textures)
344
+ def glDeleteTexture(texture):
345
+ n = 1
346
+ textures = (ctypes.c_uint*n)(texture)
347
+ try:
348
+ nativefunc = glDeleteTexture._native
349
+ except AttributeError:
350
+ nativefunc = glDeleteTexture._native = _get_gl_func("glDeleteTextures", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
351
+ res = nativefunc(n, textures)
352
+
353
+
354
+ # void = glDepthFunc(GLenum func)
355
+ def glDepthFunc(func):
356
+ try:
357
+ nativefunc = glDepthFunc._native
358
+ except AttributeError:
359
+ nativefunc = glDepthFunc._native = _get_gl_func("glDepthFunc", None, (ctypes.c_uint,))
360
+ nativefunc(func)
361
+
362
+
363
+ # void = glDepthMask(GLboolean flag)
364
+ def glDepthMask(flag):
365
+ try:
366
+ nativefunc = glDepthMask._native
367
+ except AttributeError:
368
+ nativefunc = glDepthMask._native = _get_gl_func("glDepthMask", None, (ctypes.c_bool,))
369
+ nativefunc(flag)
370
+
371
+
372
+ # void = glDepthRangef(GLclampf zNear, GLclampf zFar)
373
+ def glDepthRange(zNear, zFar):
374
+ try:
375
+ nativefunc = glDepthRange._native
376
+ except AttributeError:
377
+ nativefunc = glDepthRange._native = _get_gl_func("glDepthRange", None, (ctypes.c_double, ctypes.c_double,))
378
+ nativefunc(zNear, zFar)
379
+
380
+
381
+ # void = glDetachShader(GLuint program, GLuint shader)
382
+ def glDetachShader(program, shader):
383
+ try:
384
+ nativefunc = glDetachShader._native
385
+ except AttributeError:
386
+ nativefunc = glDetachShader._native = _get_gl_func("glDetachShader", None, (ctypes.c_uint, ctypes.c_uint,))
387
+ nativefunc(program, shader)
388
+
389
+
390
+ # void = glDisable(GLenum cap)
391
+ def glDisable(cap):
392
+ try:
393
+ nativefunc = glDisable._native
394
+ except AttributeError:
395
+ nativefunc = glDisable._native = _get_gl_func("glDisable", None, (ctypes.c_uint,))
396
+ nativefunc(cap)
397
+
398
+
399
+ # void = glDisableVertexAttribArray(GLuint index)
400
+ def glDisableVertexAttribArray(index):
401
+ try:
402
+ nativefunc = glDisableVertexAttribArray._native
403
+ except AttributeError:
404
+ nativefunc = glDisableVertexAttribArray._native = _get_gl_func("glDisableVertexAttribArray", None, (ctypes.c_uint,))
405
+ nativefunc(index)
406
+
407
+
408
+ # void = glDrawArrays(GLenum mode, GLint first, GLsizei count)
409
+ def glDrawArrays(mode, first, count):
410
+ try:
411
+ nativefunc = glDrawArrays._native
412
+ except AttributeError:
413
+ nativefunc = glDrawArrays._native = _get_gl_func("glDrawArrays", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_int,))
414
+ nativefunc(mode, first, count)
415
+
416
+
417
+ # void = glDrawElements(GLenum mode, GLsizei count, GLenum type, GLvoid* indices)
418
+ def glDrawElements(mode, count, type, offset):
419
+ if offset is None:
420
+ offset = ctypes.c_void_p(0)
421
+ elif isinstance(offset, ctypes.c_void_p):
422
+ pass
423
+ elif isinstance(offset, (int, ctypes.c_int)):
424
+ offset = ctypes.c_void_p(int(offset))
425
+ else:
426
+ if not offset.flags['C_CONTIGUOUS']:
427
+ offset = offset.copy('C')
428
+ offset_ = offset
429
+ offset = offset.ctypes.data
430
+ indices = offset
431
+ try:
432
+ nativefunc = glDrawElements._native
433
+ except AttributeError:
434
+ nativefunc = glDrawElements._native = _get_gl_func("glDrawElements", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_void_p,))
435
+ res = nativefunc(mode, count, type, indices)
436
+
437
+
438
+ # void = glEnable(GLenum cap)
439
+ def glEnable(cap):
440
+ try:
441
+ nativefunc = glEnable._native
442
+ except AttributeError:
443
+ nativefunc = glEnable._native = _get_gl_func("glEnable", None, (ctypes.c_uint,))
444
+ nativefunc(cap)
445
+
446
+
447
+ # void = glEnableVertexAttribArray(GLuint index)
448
+ def glEnableVertexAttribArray(index):
449
+ try:
450
+ nativefunc = glEnableVertexAttribArray._native
451
+ except AttributeError:
452
+ nativefunc = glEnableVertexAttribArray._native = _get_gl_func("glEnableVertexAttribArray", None, (ctypes.c_uint,))
453
+ nativefunc(index)
454
+
455
+
456
+ # void = glFinish()
457
+ def glFinish():
458
+ try:
459
+ nativefunc = glFinish._native
460
+ except AttributeError:
461
+ nativefunc = glFinish._native = _get_gl_func("glFinish", None, ())
462
+ nativefunc()
463
+
464
+
465
+ # void = glFlush()
466
+ def glFlush():
467
+ try:
468
+ nativefunc = glFlush._native
469
+ except AttributeError:
470
+ nativefunc = glFlush._native = _get_gl_func("glFlush", None, ())
471
+ nativefunc()
472
+
473
+
474
+ # void = glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
475
+ def glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer):
476
+ try:
477
+ nativefunc = glFramebufferRenderbuffer._native
478
+ except AttributeError:
479
+ nativefunc = glFramebufferRenderbuffer._native = _get_gl_func("glFramebufferRenderbuffer", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,))
480
+ nativefunc(target, attachment, renderbuffertarget, renderbuffer)
481
+
482
+
483
+ # void = glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
484
+ def glFramebufferTexture2D(target, attachment, textarget, texture, level):
485
+ try:
486
+ nativefunc = glFramebufferTexture2D._native
487
+ except AttributeError:
488
+ nativefunc = glFramebufferTexture2D._native = _get_gl_func("glFramebufferTexture2D", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_int,))
489
+ nativefunc(target, attachment, textarget, texture, level)
490
+
491
+
492
+ # void = glFrontFace(GLenum mode)
493
+ def glFrontFace(mode):
494
+ try:
495
+ nativefunc = glFrontFace._native
496
+ except AttributeError:
497
+ nativefunc = glFrontFace._native = _get_gl_func("glFrontFace", None, (ctypes.c_uint,))
498
+ nativefunc(mode)
499
+
500
+
501
+ # void = glGenBuffers(GLsizei n, GLuint* buffers)
502
+ def glCreateBuffer():
503
+ n = 1
504
+ buffers = (ctypes.c_uint*n)()
505
+ try:
506
+ nativefunc = glCreateBuffer._native
507
+ except AttributeError:
508
+ nativefunc = glCreateBuffer._native = _get_gl_func("glGenBuffers", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
509
+ res = nativefunc(n, buffers)
510
+ return buffers[0]
511
+
512
+
513
+ # void = glGenFramebuffers(GLsizei n, GLuint* framebuffers)
514
+ def glCreateFramebuffer():
515
+ n = 1
516
+ framebuffers = (ctypes.c_uint*n)()
517
+ try:
518
+ nativefunc = glCreateFramebuffer._native
519
+ except AttributeError:
520
+ nativefunc = glCreateFramebuffer._native = _get_gl_func("glGenFramebuffers", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
521
+ res = nativefunc(n, framebuffers)
522
+ return framebuffers[0]
523
+
524
+
525
+ # void = glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
526
+ def glCreateRenderbuffer():
527
+ n = 1
528
+ renderbuffers = (ctypes.c_uint*n)()
529
+ try:
530
+ nativefunc = glCreateRenderbuffer._native
531
+ except AttributeError:
532
+ nativefunc = glCreateRenderbuffer._native = _get_gl_func("glGenRenderbuffers", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
533
+ res = nativefunc(n, renderbuffers)
534
+ return renderbuffers[0]
535
+
536
+
537
+ # void = glGenTextures(GLsizei n, GLuint* textures)
538
+ def glCreateTexture():
539
+ n = 1
540
+ textures = (ctypes.c_uint*n)()
541
+ try:
542
+ nativefunc = glCreateTexture._native
543
+ except AttributeError:
544
+ nativefunc = glCreateTexture._native = _get_gl_func("glGenTextures", None, (ctypes.c_int, ctypes.POINTER(ctypes.c_uint),))
545
+ res = nativefunc(n, textures)
546
+ return textures[0]
547
+
548
+
549
+ # void = glGenerateMipmap(GLenum target)
550
+ def glGenerateMipmap(target):
551
+ try:
552
+ nativefunc = glGenerateMipmap._native
553
+ except AttributeError:
554
+ nativefunc = glGenerateMipmap._native = _get_gl_func("glGenerateMipmap", None, (ctypes.c_uint,))
555
+ nativefunc(target)
556
+
557
+
558
+ # void = glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
559
+ def glGetActiveAttrib(program, index):
560
+ bufsize = 256
561
+ length = (ctypes.c_int*1)()
562
+ size = (ctypes.c_int*1)()
563
+ type = (ctypes.c_uint*1)()
564
+ name = ctypes.create_string_buffer(bufsize)
565
+ try:
566
+ nativefunc = glGetActiveAttrib._native
567
+ except AttributeError:
568
+ nativefunc = glGetActiveAttrib._native = _get_gl_func("glGetActiveAttrib", None, (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,))
569
+ res = nativefunc(program, index, bufsize, length, size, type, name)
570
+ name = name[:length[0]].decode('utf-8')
571
+ return name, size[0], type[0]
572
+
573
+
574
+ # void = glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
575
+ def glGetActiveUniform(program, index):
576
+ bufsize = 256
577
+ length = (ctypes.c_int*1)()
578
+ size = (ctypes.c_int*1)()
579
+ type = (ctypes.c_uint*1)()
580
+ name = ctypes.create_string_buffer(bufsize)
581
+ try:
582
+ nativefunc = glGetActiveUniform._native
583
+ except AttributeError:
584
+ nativefunc = glGetActiveUniform._native = _get_gl_func("glGetActiveUniform", None, (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,))
585
+ res = nativefunc(program, index, bufsize, length, size, type, name)
586
+ name = name[:length[0]].decode('utf-8')
587
+ return name, size[0], type[0]
588
+
589
+
590
+ # void = glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
591
+ def glGetAttachedShaders(program):
592
+ maxcount = 256
593
+ count = (ctypes.c_int*1)()
594
+ shaders = (ctypes.c_uint*maxcount)()
595
+ try:
596
+ nativefunc = glGetAttachedShaders._native
597
+ except AttributeError:
598
+ nativefunc = glGetAttachedShaders._native = _get_gl_func("glGetAttachedShaders", None, (ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_uint),))
599
+ res = nativefunc(program, maxcount, count, shaders)
600
+ return tuple(shaders[:count[0]])
601
+
602
+
603
+ # GLint = glGetAttribLocation(GLuint program, GLchar* name)
604
+ def glGetAttribLocation(program, name):
605
+ name = ctypes.c_char_p(name.encode('utf-8'))
606
+ try:
607
+ nativefunc = glGetAttribLocation._native
608
+ except AttributeError:
609
+ nativefunc = glGetAttribLocation._native = _get_gl_func("glGetAttribLocation", ctypes.c_int, (ctypes.c_uint, ctypes.c_char_p,))
610
+ res = nativefunc(program, name)
611
+ return res
612
+
613
+
614
+ # void = glGetBooleanv(GLenum pname, GLboolean* params)
615
+ def _glGetBooleanv(pname):
616
+ params = (ctypes.c_bool*1)()
617
+ try:
618
+ nativefunc = _glGetBooleanv._native
619
+ except AttributeError:
620
+ nativefunc = _glGetBooleanv._native = _get_gl_func("glGetBooleanv", None, (ctypes.c_uint, ctypes.POINTER(ctypes.c_bool),))
621
+ res = nativefunc(pname, params)
622
+ return params[0]
623
+
624
+
625
+ # void = glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
626
+ def glGetBufferParameter(target, pname):
627
+ d = -2**31 # smallest 32bit integer
628
+ params = (ctypes.c_int*1)(d)
629
+ try:
630
+ nativefunc = glGetBufferParameter._native
631
+ except AttributeError:
632
+ nativefunc = glGetBufferParameter._native = _get_gl_func("glGetBufferParameteriv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),))
633
+ res = nativefunc(target, pname, params)
634
+ return params[0]
635
+
636
+
637
+ # GLenum = glGetError()
638
+ def glGetError():
639
+ try:
640
+ nativefunc = glGetError._native
641
+ except AttributeError:
642
+ nativefunc = glGetError._native = _get_gl_func("glGetError", ctypes.c_uint, ())
643
+ return nativefunc()
644
+
645
+
646
+ # void = glGetFloatv(GLenum pname, GLfloat* params)
647
+ def _glGetFloatv(pname):
648
+ n = 16
649
+ d = float('Inf')
650
+ params = (ctypes.c_float*n)(*[d for i in range(n)])
651
+ try:
652
+ nativefunc = _glGetFloatv._native
653
+ except AttributeError:
654
+ nativefunc = _glGetFloatv._native = _get_gl_func("glGetFloatv", None, (ctypes.c_uint, ctypes.POINTER(ctypes.c_float),))
655
+ res = nativefunc(pname, params)
656
+ params = [p for p in params if p!=d]
657
+ if len(params) == 1:
658
+ return params[0]
659
+ else:
660
+ return tuple(params)
661
+
662
+
663
+ # void = glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
664
+ def glGetFramebufferAttachmentParameter(target, attachment, pname):
665
+ d = -2**31 # smallest 32bit integer
666
+ params = (ctypes.c_int*1)(d)
667
+ try:
668
+ nativefunc = glGetFramebufferAttachmentParameter._native
669
+ except AttributeError:
670
+ nativefunc = glGetFramebufferAttachmentParameter._native = _get_gl_func("glGetFramebufferAttachmentParameteriv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),))
671
+ res = nativefunc(target, attachment, pname, params)
672
+ return params[0]
673
+
674
+
675
+ # void = glGetIntegerv(GLenum pname, GLint* params)
676
+ def _glGetIntegerv(pname):
677
+ n = 16
678
+ d = -2**31 # smallest 32bit integer
679
+ params = (ctypes.c_int*n)(*[d for i in range(n)])
680
+ try:
681
+ nativefunc = _glGetIntegerv._native
682
+ except AttributeError:
683
+ nativefunc = _glGetIntegerv._native = _get_gl_func("glGetIntegerv", None, (ctypes.c_uint, ctypes.POINTER(ctypes.c_int),))
684
+ res = nativefunc(pname, params)
685
+ params = [p for p in params if p!=d]
686
+ if len(params) == 1:
687
+ return params[0]
688
+ else:
689
+ return tuple(params)
690
+
691
+
692
+ # void = glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
693
+ def glGetProgramInfoLog(program):
694
+ bufsize = 1024
695
+ length = (ctypes.c_int*1)()
696
+ infolog = ctypes.create_string_buffer(bufsize)
697
+ try:
698
+ nativefunc = glGetProgramInfoLog._native
699
+ except AttributeError:
700
+ nativefunc = glGetProgramInfoLog._native = _get_gl_func("glGetProgramInfoLog", None, (ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_char_p,))
701
+ res = nativefunc(program, bufsize, length, infolog)
702
+ return infolog[:length[0]].decode('utf-8')
703
+
704
+
705
+ # void = glGetProgramiv(GLuint program, GLenum pname, GLint* params)
706
+ def glGetProgramParameter(program, pname):
707
+ params = (ctypes.c_int*1)()
708
+ try:
709
+ nativefunc = glGetProgramParameter._native
710
+ except AttributeError:
711
+ nativefunc = glGetProgramParameter._native = _get_gl_func("glGetProgramiv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),))
712
+ res = nativefunc(program, pname, params)
713
+ return params[0]
714
+
715
+
716
+ # void = glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
717
+ def glGetRenderbufferParameter(target, pname):
718
+ d = -2**31 # smallest 32bit integer
719
+ params = (ctypes.c_int*1)(d)
720
+ try:
721
+ nativefunc = glGetRenderbufferParameter._native
722
+ except AttributeError:
723
+ nativefunc = glGetRenderbufferParameter._native = _get_gl_func("glGetRenderbufferParameteriv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),))
724
+ res = nativefunc(target, pname, params)
725
+ return params[0]
726
+
727
+
728
+ # void = glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
729
+ def glGetShaderInfoLog(shader):
730
+ bufsize = 1024
731
+ length = (ctypes.c_int*1)()
732
+ infolog = ctypes.create_string_buffer(bufsize)
733
+ try:
734
+ nativefunc = glGetShaderInfoLog._native
735
+ except AttributeError:
736
+ nativefunc = glGetShaderInfoLog._native = _get_gl_func("glGetShaderInfoLog", None, (ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_char_p,))
737
+ res = nativefunc(shader, bufsize, length, infolog)
738
+ return infolog[:length[0]].decode('utf-8')
739
+
740
+
741
+ # void = glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
742
+ def glGetShaderPrecisionFormat(shadertype, precisiontype):
743
+ range = (ctypes.c_int*1)()
744
+ precision = (ctypes.c_int*1)()
745
+ try:
746
+ nativefunc = glGetShaderPrecisionFormat._native
747
+ except AttributeError:
748
+ nativefunc = glGetShaderPrecisionFormat._native = _get_gl_func("glGetShaderPrecisionFormat", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int),))
749
+ res = nativefunc(shadertype, precisiontype, range, precision)
750
+ return range[0], precision[0]
751
+
752
+
753
+ # void = glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
754
+ def glGetShaderSource(shader):
755
+ bufsize = 1024*1024
756
+ length = (ctypes.c_int*1)()
757
+ source = (ctypes.c_char*bufsize)()
758
+ try:
759
+ nativefunc = glGetShaderSource._native
760
+ except AttributeError:
761
+ nativefunc = glGetShaderSource._native = _get_gl_func("glGetShaderSource", None, (ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_char_p,))
762
+ res = nativefunc(shader, bufsize, length, source)
763
+ return source.value[:length[0]].decode('utf-8')
764
+
765
+
766
+ # void = glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
767
+ def glGetShaderParameter(shader, pname):
768
+ params = (ctypes.c_int*1)()
769
+ try:
770
+ nativefunc = glGetShaderParameter._native
771
+ except AttributeError:
772
+ nativefunc = glGetShaderParameter._native = _get_gl_func("glGetShaderiv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_int),))
773
+ res = nativefunc(shader, pname, params)
774
+ return params[0]
775
+
776
+
777
+ # GLubyte* = glGetString(GLenum name)
778
+ def glGetParameter(pname):
779
+ if pname in [33902, 33901, 32773, 3106, 2931, 2928,
780
+ 2849, 32824, 10752, 32938]:
781
+ # GL_ALIASED_LINE_WIDTH_RANGE GL_ALIASED_POINT_SIZE_RANGE
782
+ # GL_BLEND_COLOR GL_COLOR_CLEAR_VALUE GL_DEPTH_CLEAR_VALUE
783
+ # GL_DEPTH_RANGE GL_LINE_WIDTH GL_POLYGON_OFFSET_FACTOR
784
+ # GL_POLYGON_OFFSET_UNITS GL_SAMPLE_COVERAGE_VALUE
785
+ return _glGetFloatv(pname)
786
+ elif pname in [7936, 7937, 7938, 35724, 7939]:
787
+ # GL_VENDOR, GL_RENDERER, GL_VERSION, GL_SHADING_LANGUAGE_VERSION,
788
+ # GL_EXTENSIONS are strings
789
+ pass # string handled below
790
+ else:
791
+ return _glGetIntegerv(pname)
792
+ name = pname
793
+ try:
794
+ nativefunc = glGetParameter._native
795
+ except AttributeError:
796
+ nativefunc = glGetParameter._native = _get_gl_func("glGetString", ctypes.c_char_p, (ctypes.c_uint,))
797
+ res = nativefunc(name)
798
+ return ctypes.string_at(res).decode('utf-8') if res else ''
799
+
800
+
801
+ # void = glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
802
+ def glGetTexParameter(target, pname):
803
+ d = float('Inf')
804
+ params = (ctypes.c_float*1)(d)
805
+ try:
806
+ nativefunc = glGetTexParameter._native
807
+ except AttributeError:
808
+ nativefunc = glGetTexParameter._native = _get_gl_func("glGetTexParameterfv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_float),))
809
+ res = nativefunc(target, pname, params)
810
+ return params[0]
811
+
812
+
813
+ # void = glGetUniformfv(GLuint program, GLint location, GLfloat* params)
814
+ def glGetUniform(program, location):
815
+ n = 16
816
+ d = float('Inf')
817
+ params = (ctypes.c_float*n)(*[d for i in range(n)])
818
+ try:
819
+ nativefunc = glGetUniform._native
820
+ except AttributeError:
821
+ nativefunc = glGetUniform._native = _get_gl_func("glGetUniformfv", None, (ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_float),))
822
+ res = nativefunc(program, location, params)
823
+ params = [p for p in params if p!=d]
824
+ if len(params) == 1:
825
+ return params[0]
826
+ else:
827
+ return tuple(params)
828
+
829
+
830
+ # GLint = glGetUniformLocation(GLuint program, GLchar* name)
831
+ def glGetUniformLocation(program, name):
832
+ name = ctypes.c_char_p(name.encode('utf-8'))
833
+ try:
834
+ nativefunc = glGetUniformLocation._native
835
+ except AttributeError:
836
+ nativefunc = glGetUniformLocation._native = _get_gl_func("glGetUniformLocation", ctypes.c_int, (ctypes.c_uint, ctypes.c_char_p,))
837
+ res = nativefunc(program, name)
838
+ return res
839
+
840
+
841
+ # void = glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
842
+ def glGetVertexAttrib(index, pname):
843
+ n = 4
844
+ d = float('Inf')
845
+ params = (ctypes.c_float*n)(*[d for i in range(n)])
846
+ try:
847
+ nativefunc = glGetVertexAttrib._native
848
+ except AttributeError:
849
+ nativefunc = glGetVertexAttrib._native = _get_gl_func("glGetVertexAttribfv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_float),))
850
+ res = nativefunc(index, pname, params)
851
+ params = [p for p in params if p!=d]
852
+ if len(params) == 1:
853
+ return params[0]
854
+ else:
855
+ return tuple(params)
856
+
857
+
858
+ # void = glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
859
+ def glGetVertexAttribOffset(index, pname):
860
+ pointer = (ctypes.c_void_p*1)()
861
+ try:
862
+ nativefunc = glGetVertexAttribOffset._native
863
+ except AttributeError:
864
+ nativefunc = glGetVertexAttribOffset._native = _get_gl_func("glGetVertexAttribPointerv", None, (ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_void_p),))
865
+ res = nativefunc(index, pname, pointer)
866
+ return pointer[0] or 0
867
+
868
+
869
+ # void = glHint(GLenum target, GLenum mode)
870
+ def glHint(target, mode):
871
+ try:
872
+ nativefunc = glHint._native
873
+ except AttributeError:
874
+ nativefunc = glHint._native = _get_gl_func("glHint", None, (ctypes.c_uint, ctypes.c_uint,))
875
+ nativefunc(target, mode)
876
+
877
+
878
+ # GLboolean = glIsBuffer(GLuint buffer)
879
+ def glIsBuffer(buffer):
880
+ try:
881
+ nativefunc = glIsBuffer._native
882
+ except AttributeError:
883
+ nativefunc = glIsBuffer._native = _get_gl_func("glIsBuffer", ctypes.c_bool, (ctypes.c_uint,))
884
+ return nativefunc(buffer)
885
+
886
+
887
+ # GLboolean = glIsEnabled(GLenum cap)
888
+ def glIsEnabled(cap):
889
+ try:
890
+ nativefunc = glIsEnabled._native
891
+ except AttributeError:
892
+ nativefunc = glIsEnabled._native = _get_gl_func("glIsEnabled", ctypes.c_bool, (ctypes.c_uint,))
893
+ return nativefunc(cap)
894
+
895
+
896
+ # GLboolean = glIsFramebuffer(GLuint framebuffer)
897
+ def glIsFramebuffer(framebuffer):
898
+ try:
899
+ nativefunc = glIsFramebuffer._native
900
+ except AttributeError:
901
+ nativefunc = glIsFramebuffer._native = _get_gl_func("glIsFramebuffer", ctypes.c_bool, (ctypes.c_uint,))
902
+ return nativefunc(framebuffer)
903
+
904
+
905
+ # GLboolean = glIsProgram(GLuint program)
906
+ def glIsProgram(program):
907
+ try:
908
+ nativefunc = glIsProgram._native
909
+ except AttributeError:
910
+ nativefunc = glIsProgram._native = _get_gl_func("glIsProgram", ctypes.c_bool, (ctypes.c_uint,))
911
+ return nativefunc(program)
912
+
913
+
914
+ # GLboolean = glIsRenderbuffer(GLuint renderbuffer)
915
+ def glIsRenderbuffer(renderbuffer):
916
+ try:
917
+ nativefunc = glIsRenderbuffer._native
918
+ except AttributeError:
919
+ nativefunc = glIsRenderbuffer._native = _get_gl_func("glIsRenderbuffer", ctypes.c_bool, (ctypes.c_uint,))
920
+ return nativefunc(renderbuffer)
921
+
922
+
923
+ # GLboolean = glIsShader(GLuint shader)
924
+ def glIsShader(shader):
925
+ try:
926
+ nativefunc = glIsShader._native
927
+ except AttributeError:
928
+ nativefunc = glIsShader._native = _get_gl_func("glIsShader", ctypes.c_bool, (ctypes.c_uint,))
929
+ return nativefunc(shader)
930
+
931
+
932
+ # GLboolean = glIsTexture(GLuint texture)
933
+ def glIsTexture(texture):
934
+ try:
935
+ nativefunc = glIsTexture._native
936
+ except AttributeError:
937
+ nativefunc = glIsTexture._native = _get_gl_func("glIsTexture", ctypes.c_bool, (ctypes.c_uint,))
938
+ return nativefunc(texture)
939
+
940
+
941
+ # void = glLineWidth(GLfloat width)
942
+ def glLineWidth(width):
943
+ try:
944
+ nativefunc = glLineWidth._native
945
+ except AttributeError:
946
+ nativefunc = glLineWidth._native = _get_gl_func("glLineWidth", None, (ctypes.c_float,))
947
+ nativefunc(width)
948
+
949
+
950
+ # void = glLinkProgram(GLuint program)
951
+ def glLinkProgram(program):
952
+ try:
953
+ nativefunc = glLinkProgram._native
954
+ except AttributeError:
955
+ nativefunc = glLinkProgram._native = _get_gl_func("glLinkProgram", None, (ctypes.c_uint,))
956
+ nativefunc(program)
957
+
958
+
959
+ # void = glPixelStorei(GLenum pname, GLint param)
960
+ def glPixelStorei(pname, param):
961
+ try:
962
+ nativefunc = glPixelStorei._native
963
+ except AttributeError:
964
+ nativefunc = glPixelStorei._native = _get_gl_func("glPixelStorei", None, (ctypes.c_uint, ctypes.c_int,))
965
+ nativefunc(pname, param)
966
+
967
+
968
+ # void = glPolygonOffset(GLfloat factor, GLfloat units)
969
+ def glPolygonOffset(factor, units):
970
+ try:
971
+ nativefunc = glPolygonOffset._native
972
+ except AttributeError:
973
+ nativefunc = glPolygonOffset._native = _get_gl_func("glPolygonOffset", None, (ctypes.c_float, ctypes.c_float,))
974
+ nativefunc(factor, units)
975
+
976
+
977
+ # void = glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
978
+ def glReadPixels(x, y, width, height, format, type):
979
+ # GL_ALPHA, GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT
980
+ t = {6406:1, 6407:3, 6408:4, 6402:1}[format]
981
+ # GL_UNSIGNED_BYTE, GL_FLOAT
982
+ nb = {5121:1, 5126:4}[type]
983
+ size = int(width*height*t*nb)
984
+ pixels = ctypes.create_string_buffer(size)
985
+ try:
986
+ nativefunc = glReadPixels._native
987
+ except AttributeError:
988
+ nativefunc = glReadPixels._native = _get_gl_func("glReadPixels", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_void_p,))
989
+ res = nativefunc(x, y, width, height, format, type, pixels)
990
+ return pixels[:]
991
+
992
+
993
+ # void = glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
994
+ def glRenderbufferStorage(target, internalformat, width, height):
995
+ try:
996
+ nativefunc = glRenderbufferStorage._native
997
+ except AttributeError:
998
+ nativefunc = glRenderbufferStorage._native = _get_gl_func("glRenderbufferStorage", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_int,))
999
+ nativefunc(target, internalformat, width, height)
1000
+
1001
+
1002
+ # void = glSampleCoverage(GLclampf value, GLboolean invert)
1003
+ def glSampleCoverage(value, invert):
1004
+ try:
1005
+ nativefunc = glSampleCoverage._native
1006
+ except AttributeError:
1007
+ nativefunc = glSampleCoverage._native = _get_gl_func("glSampleCoverage", None, (ctypes.c_float, ctypes.c_bool,))
1008
+ nativefunc(value, invert)
1009
+
1010
+
1011
+ # void = glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
1012
+ def glScissor(x, y, width, height):
1013
+ try:
1014
+ nativefunc = glScissor._native
1015
+ except AttributeError:
1016
+ nativefunc = glScissor._native = _get_gl_func("glScissor", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
1017
+ nativefunc(x, y, width, height)
1018
+
1019
+
1020
+ # void = glShaderSource(GLuint shader, GLsizei count, GLchar** string, GLint* length)
1021
+ def glShaderSource(shader, source):
1022
+ # Some implementation do not like getting a list of single chars
1023
+ if isinstance(source, (tuple, list)):
1024
+ strings = [s for s in source]
1025
+ else:
1026
+ strings = [source]
1027
+ count = len(strings)
1028
+ string = (ctypes.c_char_p*count)(*[s.encode('utf-8') for s in strings])
1029
+ length = (ctypes.c_int*count)(*[len(s) for s in strings])
1030
+ try:
1031
+ nativefunc = glShaderSource._native
1032
+ except AttributeError:
1033
+ nativefunc = glShaderSource._native = _get_gl_func("glShaderSource", None, (ctypes.c_uint, ctypes.c_int, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_int),))
1034
+ res = nativefunc(shader, count, string, length)
1035
+
1036
+
1037
+ # void = glStencilFunc(GLenum func, GLint ref, GLuint mask)
1038
+ def glStencilFunc(func, ref, mask):
1039
+ try:
1040
+ nativefunc = glStencilFunc._native
1041
+ except AttributeError:
1042
+ nativefunc = glStencilFunc._native = _get_gl_func("glStencilFunc", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_uint,))
1043
+ nativefunc(func, ref, mask)
1044
+
1045
+
1046
+ # void = glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1047
+ def glStencilFuncSeparate(face, func, ref, mask):
1048
+ try:
1049
+ nativefunc = glStencilFuncSeparate._native
1050
+ except AttributeError:
1051
+ nativefunc = glStencilFuncSeparate._native = _get_gl_func("glStencilFuncSeparate", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_uint,))
1052
+ nativefunc(face, func, ref, mask)
1053
+
1054
+
1055
+ # void = glStencilMask(GLuint mask)
1056
+ def glStencilMask(mask):
1057
+ try:
1058
+ nativefunc = glStencilMask._native
1059
+ except AttributeError:
1060
+ nativefunc = glStencilMask._native = _get_gl_func("glStencilMask", None, (ctypes.c_uint,))
1061
+ nativefunc(mask)
1062
+
1063
+
1064
+ # void = glStencilMaskSeparate(GLenum face, GLuint mask)
1065
+ def glStencilMaskSeparate(face, mask):
1066
+ try:
1067
+ nativefunc = glStencilMaskSeparate._native
1068
+ except AttributeError:
1069
+ nativefunc = glStencilMaskSeparate._native = _get_gl_func("glStencilMaskSeparate", None, (ctypes.c_uint, ctypes.c_uint,))
1070
+ nativefunc(face, mask)
1071
+
1072
+
1073
+ # void = glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
1074
+ def glStencilOp(fail, zfail, zpass):
1075
+ try:
1076
+ nativefunc = glStencilOp._native
1077
+ except AttributeError:
1078
+ nativefunc = glStencilOp._native = _get_gl_func("glStencilOp", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,))
1079
+ nativefunc(fail, zfail, zpass)
1080
+
1081
+
1082
+ # void = glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
1083
+ def glStencilOpSeparate(face, fail, zfail, zpass):
1084
+ try:
1085
+ nativefunc = glStencilOpSeparate._native
1086
+ except AttributeError:
1087
+ nativefunc = glStencilOpSeparate._native = _get_gl_func("glStencilOpSeparate", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,))
1088
+ nativefunc(face, fail, zfail, zpass)
1089
+
1090
+
1091
+ # void = glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid* pixels)
1092
+ def glTexImage2D(target, level, internalformat, format, type, pixels):
1093
+ border = 0
1094
+ if isinstance(pixels, (tuple, list)):
1095
+ height, width = pixels
1096
+ pixels = ctypes.c_void_p(0)
1097
+ pixels = None
1098
+ else:
1099
+ if not pixels.flags['C_CONTIGUOUS']:
1100
+ pixels = pixels.copy('C')
1101
+ pixels_ = pixels
1102
+ pixels = pixels_.ctypes.data
1103
+ height, width = pixels_.shape[:2]
1104
+ try:
1105
+ nativefunc = glTexImage2D._native
1106
+ except AttributeError:
1107
+ nativefunc = glTexImage2D._native = _get_gl_func("glTexImage2D", None, (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,))
1108
+ res = nativefunc(target, level, internalformat, width, height, border, format, type, pixels)
1109
+
1110
+
1111
+ def glTexParameterf(target, pname, param):
1112
+ try:
1113
+ nativefunc = glTexParameterf._native
1114
+ except AttributeError:
1115
+ nativefunc = glTexParameterf._native = _get_gl_func("glTexParameterf", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_float,))
1116
+ nativefunc(target, pname, param)
1117
+ def glTexParameteri(target, pname, param):
1118
+ try:
1119
+ nativefunc = glTexParameteri._native
1120
+ except AttributeError:
1121
+ nativefunc = glTexParameteri._native = _get_gl_func("glTexParameteri", None, (ctypes.c_uint, ctypes.c_uint, ctypes.c_int,))
1122
+ nativefunc(target, pname, param)
1123
+
1124
+
1125
+ # void = glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
1126
+ def glTexSubImage2D(target, level, xoffset, yoffset, format, type, pixels):
1127
+ if not pixels.flags['C_CONTIGUOUS']:
1128
+ pixels = pixels.copy('C')
1129
+ pixels_ = pixels
1130
+ pixels = pixels_.ctypes.data
1131
+ height, width = pixels_.shape[:2]
1132
+ try:
1133
+ nativefunc = glTexSubImage2D._native
1134
+ except AttributeError:
1135
+ nativefunc = glTexSubImage2D._native = _get_gl_func("glTexSubImage2D", None, (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,))
1136
+ res = nativefunc(target, level, xoffset, yoffset, width, height, format, type, pixels)
1137
+
1138
+
1139
+ def glUniform1f(location, v1):
1140
+ try:
1141
+ nativefunc = glUniform1f._native
1142
+ except AttributeError:
1143
+ nativefunc = glUniform1f._native = _get_gl_func("glUniform1f", None, (ctypes.c_int, ctypes.c_float,))
1144
+ nativefunc(location, v1)
1145
+ def glUniform2f(location, v1, v2):
1146
+ try:
1147
+ nativefunc = glUniform2f._native
1148
+ except AttributeError:
1149
+ nativefunc = glUniform2f._native = _get_gl_func("glUniform2f", None, (ctypes.c_int, ctypes.c_float, ctypes.c_float,))
1150
+ nativefunc(location, v1, v2)
1151
+ def glUniform3f(location, v1, v2, v3):
1152
+ try:
1153
+ nativefunc = glUniform3f._native
1154
+ except AttributeError:
1155
+ nativefunc = glUniform3f._native = _get_gl_func("glUniform3f", None, (ctypes.c_int, ctypes.c_float, ctypes.c_float, ctypes.c_float,))
1156
+ nativefunc(location, v1, v2, v3)
1157
+ def glUniform4f(location, v1, v2, v3, v4):
1158
+ try:
1159
+ nativefunc = glUniform4f._native
1160
+ except AttributeError:
1161
+ nativefunc = glUniform4f._native = _get_gl_func("glUniform4f", None, (ctypes.c_int, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,))
1162
+ nativefunc(location, v1, v2, v3, v4)
1163
+ def glUniform1i(location, v1):
1164
+ try:
1165
+ nativefunc = glUniform1i._native
1166
+ except AttributeError:
1167
+ nativefunc = glUniform1i._native = _get_gl_func("glUniform1i", None, (ctypes.c_int, ctypes.c_int,))
1168
+ nativefunc(location, v1)
1169
+ def glUniform2i(location, v1, v2):
1170
+ try:
1171
+ nativefunc = glUniform2i._native
1172
+ except AttributeError:
1173
+ nativefunc = glUniform2i._native = _get_gl_func("glUniform2i", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int,))
1174
+ nativefunc(location, v1, v2)
1175
+ def glUniform3i(location, v1, v2, v3):
1176
+ try:
1177
+ nativefunc = glUniform3i._native
1178
+ except AttributeError:
1179
+ nativefunc = glUniform3i._native = _get_gl_func("glUniform3i", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
1180
+ nativefunc(location, v1, v2, v3)
1181
+ def glUniform4i(location, v1, v2, v3, v4):
1182
+ try:
1183
+ nativefunc = glUniform4i._native
1184
+ except AttributeError:
1185
+ nativefunc = glUniform4i._native = _get_gl_func("glUniform4i", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
1186
+ nativefunc(location, v1, v2, v3, v4)
1187
+ def glUniform1fv(location, count, values):
1188
+ values = [float(val) for val in values]
1189
+ values = (ctypes.c_float*len(values))(*values)
1190
+ try:
1191
+ nativefunc = glUniform1fv._native
1192
+ except AttributeError:
1193
+ nativefunc = glUniform1fv._native = _get_gl_func("glUniform1fv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),))
1194
+ nativefunc(location, count, values)
1195
+ def glUniform2fv(location, count, values):
1196
+ values = [float(val) for val in values]
1197
+ values = (ctypes.c_float*len(values))(*values)
1198
+ try:
1199
+ nativefunc = glUniform2fv._native
1200
+ except AttributeError:
1201
+ nativefunc = glUniform2fv._native = _get_gl_func("glUniform2fv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),))
1202
+ nativefunc(location, count, values)
1203
+ def glUniform3fv(location, count, values):
1204
+ values = [float(val) for val in values]
1205
+ values = (ctypes.c_float*len(values))(*values)
1206
+ try:
1207
+ nativefunc = glUniform3fv._native
1208
+ except AttributeError:
1209
+ nativefunc = glUniform3fv._native = _get_gl_func("glUniform3fv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),))
1210
+ nativefunc(location, count, values)
1211
+ def glUniform4fv(location, count, values):
1212
+ values = [float(val) for val in values]
1213
+ values = (ctypes.c_float*len(values))(*values)
1214
+ try:
1215
+ nativefunc = glUniform4fv._native
1216
+ except AttributeError:
1217
+ nativefunc = glUniform4fv._native = _get_gl_func("glUniform4fv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float),))
1218
+ nativefunc(location, count, values)
1219
+ def glUniform1iv(location, count, values):
1220
+ values = [int(val) for val in values]
1221
+ values = (ctypes.c_int*len(values))(*values)
1222
+ try:
1223
+ nativefunc = glUniform1iv._native
1224
+ except AttributeError:
1225
+ nativefunc = glUniform1iv._native = _get_gl_func("glUniform1iv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),))
1226
+ nativefunc(location, count, values)
1227
+ def glUniform2iv(location, count, values):
1228
+ values = [int(val) for val in values]
1229
+ values = (ctypes.c_int*len(values))(*values)
1230
+ try:
1231
+ nativefunc = glUniform2iv._native
1232
+ except AttributeError:
1233
+ nativefunc = glUniform2iv._native = _get_gl_func("glUniform2iv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),))
1234
+ nativefunc(location, count, values)
1235
+ def glUniform3iv(location, count, values):
1236
+ values = [int(val) for val in values]
1237
+ values = (ctypes.c_int*len(values))(*values)
1238
+ try:
1239
+ nativefunc = glUniform3iv._native
1240
+ except AttributeError:
1241
+ nativefunc = glUniform3iv._native = _get_gl_func("glUniform3iv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),))
1242
+ nativefunc(location, count, values)
1243
+ def glUniform4iv(location, count, values):
1244
+ values = [int(val) for val in values]
1245
+ values = (ctypes.c_int*len(values))(*values)
1246
+ try:
1247
+ nativefunc = glUniform4iv._native
1248
+ except AttributeError:
1249
+ nativefunc = glUniform4iv._native = _get_gl_func("glUniform4iv", None, (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int),))
1250
+ nativefunc(location, count, values)
1251
+
1252
+
1253
+ def glUniformMatrix2fv(location, count, transpose, values):
1254
+ if not values.flags["C_CONTIGUOUS"]:
1255
+ values = values.copy()
1256
+ assert values.dtype.name == "float32"
1257
+ values_ = values
1258
+ values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))
1259
+ try:
1260
+ nativefunc = glUniformMatrix2fv._native
1261
+ except AttributeError:
1262
+ nativefunc = glUniformMatrix2fv._native = _get_gl_func("glUniformMatrix2fv", None, (ctypes.c_int, ctypes.c_int, ctypes.c_bool, ctypes.POINTER(ctypes.c_float),))
1263
+ nativefunc(location, count, transpose, values)
1264
+ def glUniformMatrix3fv(location, count, transpose, values):
1265
+ if not values.flags["C_CONTIGUOUS"]:
1266
+ values = values.copy()
1267
+ assert values.dtype.name == "float32"
1268
+ values_ = values
1269
+ values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))
1270
+ try:
1271
+ nativefunc = glUniformMatrix3fv._native
1272
+ except AttributeError:
1273
+ nativefunc = glUniformMatrix3fv._native = _get_gl_func("glUniformMatrix3fv", None, (ctypes.c_int, ctypes.c_int, ctypes.c_bool, ctypes.POINTER(ctypes.c_float),))
1274
+ nativefunc(location, count, transpose, values)
1275
+ def glUniformMatrix4fv(location, count, transpose, values):
1276
+ if not values.flags["C_CONTIGUOUS"]:
1277
+ values = values.copy()
1278
+ assert values.dtype.name == "float32"
1279
+ values_ = values
1280
+ values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))
1281
+ try:
1282
+ nativefunc = glUniformMatrix4fv._native
1283
+ except AttributeError:
1284
+ nativefunc = glUniformMatrix4fv._native = _get_gl_func("glUniformMatrix4fv", None, (ctypes.c_int, ctypes.c_int, ctypes.c_bool, ctypes.POINTER(ctypes.c_float),))
1285
+ nativefunc(location, count, transpose, values)
1286
+
1287
+
1288
+ # void = glUseProgram(GLuint program)
1289
+ def glUseProgram(program):
1290
+ try:
1291
+ nativefunc = glUseProgram._native
1292
+ except AttributeError:
1293
+ nativefunc = glUseProgram._native = _get_gl_func("glUseProgram", None, (ctypes.c_uint,))
1294
+ nativefunc(program)
1295
+
1296
+
1297
+ # void = glValidateProgram(GLuint program)
1298
+ def glValidateProgram(program):
1299
+ try:
1300
+ nativefunc = glValidateProgram._native
1301
+ except AttributeError:
1302
+ nativefunc = glValidateProgram._native = _get_gl_func("glValidateProgram", None, (ctypes.c_uint,))
1303
+ nativefunc(program)
1304
+
1305
+
1306
+ def glVertexAttrib1f(index, v1):
1307
+ try:
1308
+ nativefunc = glVertexAttrib1f._native
1309
+ except AttributeError:
1310
+ nativefunc = glVertexAttrib1f._native = _get_gl_func("glVertexAttrib1f", None, (ctypes.c_uint, ctypes.c_float,))
1311
+ nativefunc(index, v1)
1312
+ def glVertexAttrib2f(index, v1, v2):
1313
+ try:
1314
+ nativefunc = glVertexAttrib2f._native
1315
+ except AttributeError:
1316
+ nativefunc = glVertexAttrib2f._native = _get_gl_func("glVertexAttrib2f", None, (ctypes.c_uint, ctypes.c_float, ctypes.c_float,))
1317
+ nativefunc(index, v1, v2)
1318
+ def glVertexAttrib3f(index, v1, v2, v3):
1319
+ try:
1320
+ nativefunc = glVertexAttrib3f._native
1321
+ except AttributeError:
1322
+ nativefunc = glVertexAttrib3f._native = _get_gl_func("glVertexAttrib3f", None, (ctypes.c_uint, ctypes.c_float, ctypes.c_float, ctypes.c_float,))
1323
+ nativefunc(index, v1, v2, v3)
1324
+ def glVertexAttrib4f(index, v1, v2, v3, v4):
1325
+ try:
1326
+ nativefunc = glVertexAttrib4f._native
1327
+ except AttributeError:
1328
+ nativefunc = glVertexAttrib4f._native = _get_gl_func("glVertexAttrib4f", None, (ctypes.c_uint, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float,))
1329
+ nativefunc(index, v1, v2, v3, v4)
1330
+
1331
+
1332
+ # void = glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid* ptr)
1333
+ def glVertexAttribPointer(indx, size, type, normalized, stride, offset):
1334
+ if offset is None:
1335
+ offset = ctypes.c_void_p(0)
1336
+ elif isinstance(offset, ctypes.c_void_p):
1337
+ pass
1338
+ elif isinstance(offset, (int, ctypes.c_int)):
1339
+ offset = ctypes.c_void_p(int(offset))
1340
+ else:
1341
+ if not offset.flags['C_CONTIGUOUS']:
1342
+ offset = offset.copy('C')
1343
+ offset_ = offset
1344
+ offset = offset.ctypes.data
1345
+ # We need to ensure that the data exists at draw time :(
1346
+ # PyOpenGL does this too
1347
+ key = '_vert_attr_'+str(indx)
1348
+ setattr(glVertexAttribPointer, key, offset_)
1349
+ ptr = offset
1350
+ try:
1351
+ nativefunc = glVertexAttribPointer._native
1352
+ except AttributeError:
1353
+ nativefunc = glVertexAttribPointer._native = _get_gl_func("glVertexAttribPointer", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_uint, ctypes.c_bool, ctypes.c_int, ctypes.c_void_p,))
1354
+ res = nativefunc(indx, size, type, normalized, stride, ptr)
1355
+
1356
+
1357
+ # void = glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
1358
+ def glViewport(x, y, width, height):
1359
+ try:
1360
+ nativefunc = glViewport._native
1361
+ except AttributeError:
1362
+ nativefunc = glViewport._native = _get_gl_func("glViewport", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
1363
+ nativefunc(x, y, width, height)
1364
+
1365
+